diff --git a/.gitignore b/.gitignore index 7fe2778755..0e71421ee7 100644 --- a/.gitignore +++ b/.gitignore @@ -63,4 +63,6 @@ jmeter/src/main/resources/*-JMeter.csv **/tmp **/out-tsc **/nbproject/ -**/nb-configuration.xml \ No newline at end of file +**/nb-configuration.xml +core-scala/.cache-main +core-scala/.cache-tests diff --git a/.travis.yml b/.travis.yml index 5e2d690b4e..5e86714a89 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,7 +4,7 @@ before_install: - echo "MAVEN_OPTS='-Xmx2048M -Xss128M -XX:+CMSClassUnloadingEnabled -XX:+UseG1GC -XX:-UseGCOverheadLimit'" > ~/.mavenrc install: skip -script: travis_wait 60 mvn -q install -Pdefault +script: travis_wait 60 mvn -q install -Pdefault-first,default-second -Dgib.enabled=true sudo: required diff --git a/JGit/src/main/java/com/baeldung/jgit/porcelain/Log.java b/JGit/src/main/java/com/baeldung/jgit/porcelain/Log.java index cb476b9d9e..a50028a9ae 100644 --- a/JGit/src/main/java/com/baeldung/jgit/porcelain/Log.java +++ b/JGit/src/main/java/com/baeldung/jgit/porcelain/Log.java @@ -28,14 +28,14 @@ public class Log { System.out.println("Had " + count + " commits overall on current branch"); logs = git.log() - .add(repository.resolve("remotes/origin/testbranch")) + .add(repository.resolve(git.getRepository().getFullBranch())) .call(); count = 0; for (RevCommit rev : logs) { System.out.println("Commit: " + rev /* + ", name: " + rev.getName() + ", id: " + rev.getId().getName() */); count++; } - System.out.println("Had " + count + " commits overall on test-branch"); + System.out.println("Had " + count + " commits overall on "+git.getRepository().getFullBranch()); logs = git.log() .all() diff --git a/JGit/src/test/java/com/baeldung/jgit/JGitBugIntegrationTest.java b/JGit/src/test/java/com/baeldung/jgit/JGitBugIntegrationTest.java index ed7168b2c2..ad34890996 100644 --- a/JGit/src/test/java/com/baeldung/jgit/JGitBugIntegrationTest.java +++ b/JGit/src/test/java/com/baeldung/jgit/JGitBugIntegrationTest.java @@ -1,3 +1,5 @@ +package com.baeldung.jgit; + import com.baeldung.jgit.helper.Helper; import org.eclipse.jgit.lib.ObjectLoader; import org.eclipse.jgit.lib.ObjectReader; diff --git a/README.md b/README.md index 8e0a5eb9ee..f3fe5e3bf0 100644 --- a/README.md +++ b/README.md @@ -26,3 +26,13 @@ To do the full build, do: `mvn install -Pdefault -Dgib.enabled=false` Building a single module ==================== To build a specific module run the command: `mvn clean install -Dgib.enabled=false` in the module directory + + +Running a Spring Boot module +==================== +To run a Spring Boot module run the command: `mvn spring-boot:run -Dgib.enabled=false` in the module directory + + + + + diff --git a/spring-boot-persistence/.gitignore b/algorithms-genetic/.gitignore similarity index 67% rename from spring-boot-persistence/.gitignore rename to algorithms-genetic/.gitignore index 88e3308e9d..30b2b7442c 100644 --- a/spring-boot-persistence/.gitignore +++ b/algorithms-genetic/.gitignore @@ -1,5 +1,4 @@ -/target/ -.settings/ -.classpath -.project - +/target/ +.settings/ +.classpath +.project \ No newline at end of file diff --git a/algorithms-genetic/README.md b/algorithms-genetic/README.md new file mode 100644 index 0000000000..39f8d59eee --- /dev/null +++ b/algorithms-genetic/README.md @@ -0,0 +1,6 @@ +## Relevant articles: + +- [Introduction to Jenetics Library](http://www.baeldung.com/jenetics) +- [Ant Colony Optimization](http://www.baeldung.com/java-ant-colony-optimization) +- [Design a Genetic Algorithm in Java](https://www.baeldung.com/java-genetic-algorithm) +- [The Traveling Salesman Problem in Java](https://www.baeldung.com/java-simulated-annealing-for-traveling-salesman) diff --git a/algorithms-genetic/pom.xml b/algorithms-genetic/pom.xml new file mode 100644 index 0000000000..fc6d36dac1 --- /dev/null +++ b/algorithms-genetic/pom.xml @@ -0,0 +1,65 @@ + + 4.0.0 + algorithms-genetic + 0.0.1-SNAPSHOT + algorithms-genetic + + + com.baeldung + parent-modules + 1.0.0-SNAPSHOT + + + + + org.apache.commons + commons-math3 + ${commons-math3.version} + + + commons-codec + commons-codec + ${commons-codec.version} + + + org.projectlombok + lombok + ${lombok.version} + provided + + + io.jenetics + jenetics + ${io.jenetics.version} + + + org.assertj + assertj-core + ${org.assertj.core.version} + test + + + + + + + + org.codehaus.mojo + exec-maven-plugin + ${exec-maven-plugin.version} + + + + + + + 1.16.12 + 3.6.1 + 3.7.0 + 3.9.0 + 1.11 + + + + diff --git a/algorithms/src/main/java/com/baeldung/algorithms/RunAlgorithm.java b/algorithms-genetic/src/main/java/com/baeldung/algorithms/RunAlgorithm.java similarity index 71% rename from algorithms/src/main/java/com/baeldung/algorithms/RunAlgorithm.java rename to algorithms-genetic/src/main/java/com/baeldung/algorithms/RunAlgorithm.java index ce04d26db3..779cb9b970 100644 --- a/algorithms/src/main/java/com/baeldung/algorithms/RunAlgorithm.java +++ b/algorithms-genetic/src/main/java/com/baeldung/algorithms/RunAlgorithm.java @@ -5,7 +5,6 @@ import java.util.Scanner; import com.baeldung.algorithms.ga.annealing.SimulatedAnnealing; import com.baeldung.algorithms.ga.ant_colony.AntColonyOptimization; import com.baeldung.algorithms.ga.binary.SimpleGeneticAlgorithm; -import com.baeldung.algorithms.slope_one.SlopeOne; public class RunAlgorithm { @@ -13,11 +12,8 @@ public class RunAlgorithm { Scanner in = new Scanner(System.in); System.out.println("Run algorithm:"); System.out.println("1 - Simulated Annealing"); - System.out.println("2 - Slope One"); - System.out.println("3 - Simple Genetic Algorithm"); - System.out.println("4 - Ant Colony"); - System.out.println("5 - Dijkstra"); - System.out.println("6 - All pairs in an array that add up to a given sum"); + System.out.println("2 - Simple Genetic Algorithm"); + System.out.println("3 - Ant Colony"); int decision = in.nextInt(); switch (decision) { case 1: @@ -25,19 +21,13 @@ public class RunAlgorithm { "Optimized distance for travel: " + SimulatedAnnealing.simulateAnnealing(10, 10000, 0.9995)); break; case 2: - SlopeOne.slopeOne(3); - break; - case 3: SimpleGeneticAlgorithm ga = new SimpleGeneticAlgorithm(); ga.runAlgorithm(50, "1011000100000100010000100000100111001000000100000100000000001111"); break; - case 4: + case 3: AntColonyOptimization antColony = new AntColonyOptimization(21); antColony.startAntOptimization(); break; - case 5: - System.out.println("Please run the DijkstraAlgorithmTest."); - break; default: System.out.println("Unknown option"); break; diff --git a/algorithms/src/main/java/com/baeldung/algorithms/ga/annealing/City.java b/algorithms-genetic/src/main/java/com/baeldung/algorithms/ga/annealing/City.java similarity index 100% rename from algorithms/src/main/java/com/baeldung/algorithms/ga/annealing/City.java rename to algorithms-genetic/src/main/java/com/baeldung/algorithms/ga/annealing/City.java diff --git a/algorithms/src/main/java/com/baeldung/algorithms/ga/annealing/SimulatedAnnealing.java b/algorithms-genetic/src/main/java/com/baeldung/algorithms/ga/annealing/SimulatedAnnealing.java similarity index 100% rename from algorithms/src/main/java/com/baeldung/algorithms/ga/annealing/SimulatedAnnealing.java rename to algorithms-genetic/src/main/java/com/baeldung/algorithms/ga/annealing/SimulatedAnnealing.java diff --git a/algorithms/src/main/java/com/baeldung/algorithms/ga/annealing/Travel.java b/algorithms-genetic/src/main/java/com/baeldung/algorithms/ga/annealing/Travel.java similarity index 100% rename from algorithms/src/main/java/com/baeldung/algorithms/ga/annealing/Travel.java rename to algorithms-genetic/src/main/java/com/baeldung/algorithms/ga/annealing/Travel.java diff --git a/algorithms/src/main/java/com/baeldung/algorithms/ga/ant_colony/Ant.java b/algorithms-genetic/src/main/java/com/baeldung/algorithms/ga/ant_colony/Ant.java similarity index 100% rename from algorithms/src/main/java/com/baeldung/algorithms/ga/ant_colony/Ant.java rename to algorithms-genetic/src/main/java/com/baeldung/algorithms/ga/ant_colony/Ant.java diff --git a/algorithms/src/main/java/com/baeldung/algorithms/ga/ant_colony/AntColonyOptimization.java b/algorithms-genetic/src/main/java/com/baeldung/algorithms/ga/ant_colony/AntColonyOptimization.java similarity index 100% rename from algorithms/src/main/java/com/baeldung/algorithms/ga/ant_colony/AntColonyOptimization.java rename to algorithms-genetic/src/main/java/com/baeldung/algorithms/ga/ant_colony/AntColonyOptimization.java diff --git a/algorithms/src/main/java/com/baeldung/algorithms/ga/binary/Individual.java b/algorithms-genetic/src/main/java/com/baeldung/algorithms/ga/binary/Individual.java similarity index 100% rename from algorithms/src/main/java/com/baeldung/algorithms/ga/binary/Individual.java rename to algorithms-genetic/src/main/java/com/baeldung/algorithms/ga/binary/Individual.java diff --git a/algorithms/src/main/java/com/baeldung/algorithms/ga/binary/Population.java b/algorithms-genetic/src/main/java/com/baeldung/algorithms/ga/binary/Population.java similarity index 100% rename from algorithms/src/main/java/com/baeldung/algorithms/ga/binary/Population.java rename to algorithms-genetic/src/main/java/com/baeldung/algorithms/ga/binary/Population.java diff --git a/algorithms/src/main/java/com/baeldung/algorithms/ga/binary/SimpleGeneticAlgorithm.java b/algorithms-genetic/src/main/java/com/baeldung/algorithms/ga/binary/SimpleGeneticAlgorithm.java similarity index 100% rename from algorithms/src/main/java/com/baeldung/algorithms/ga/binary/SimpleGeneticAlgorithm.java rename to algorithms-genetic/src/main/java/com/baeldung/algorithms/ga/binary/SimpleGeneticAlgorithm.java diff --git a/algorithms/src/main/java/com/baeldung/algorithms/ga/jenetics/Knapsack.java b/algorithms-genetic/src/main/java/com/baeldung/algorithms/ga/jenetics/Knapsack.java similarity index 100% rename from algorithms/src/main/java/com/baeldung/algorithms/ga/jenetics/Knapsack.java rename to algorithms-genetic/src/main/java/com/baeldung/algorithms/ga/jenetics/Knapsack.java diff --git a/algorithms/src/main/java/com/baeldung/algorithms/ga/jenetics/KnapsackFF.java b/algorithms-genetic/src/main/java/com/baeldung/algorithms/ga/jenetics/KnapsackFF.java similarity index 100% rename from algorithms/src/main/java/com/baeldung/algorithms/ga/jenetics/KnapsackFF.java rename to algorithms-genetic/src/main/java/com/baeldung/algorithms/ga/jenetics/KnapsackFF.java diff --git a/algorithms/src/main/java/com/baeldung/algorithms/ga/jenetics/KnapsackItem.java b/algorithms-genetic/src/main/java/com/baeldung/algorithms/ga/jenetics/KnapsackItem.java similarity index 100% rename from algorithms/src/main/java/com/baeldung/algorithms/ga/jenetics/KnapsackItem.java rename to algorithms-genetic/src/main/java/com/baeldung/algorithms/ga/jenetics/KnapsackItem.java diff --git a/algorithms/src/main/java/com/baeldung/algorithms/ga/jenetics/SimpleGeneticAlgorithm.java b/algorithms-genetic/src/main/java/com/baeldung/algorithms/ga/jenetics/SimpleGeneticAlgorithm.java similarity index 100% rename from algorithms/src/main/java/com/baeldung/algorithms/ga/jenetics/SimpleGeneticAlgorithm.java rename to algorithms-genetic/src/main/java/com/baeldung/algorithms/ga/jenetics/SimpleGeneticAlgorithm.java diff --git a/algorithms/src/main/java/com/baeldung/algorithms/ga/jenetics/SpringsteenProblem.java b/algorithms-genetic/src/main/java/com/baeldung/algorithms/ga/jenetics/SpringsteenProblem.java similarity index 100% rename from algorithms/src/main/java/com/baeldung/algorithms/ga/jenetics/SpringsteenProblem.java rename to algorithms-genetic/src/main/java/com/baeldung/algorithms/ga/jenetics/SpringsteenProblem.java diff --git a/algorithms/src/main/java/com/baeldung/algorithms/ga/jenetics/SpringsteenRecord.java b/algorithms-genetic/src/main/java/com/baeldung/algorithms/ga/jenetics/SpringsteenRecord.java similarity index 100% rename from algorithms/src/main/java/com/baeldung/algorithms/ga/jenetics/SpringsteenRecord.java rename to algorithms-genetic/src/main/java/com/baeldung/algorithms/ga/jenetics/SpringsteenRecord.java diff --git a/algorithms/src/main/java/com/baeldung/algorithms/ga/jenetics/SubsetSum.java b/algorithms-genetic/src/main/java/com/baeldung/algorithms/ga/jenetics/SubsetSum.java similarity index 100% rename from algorithms/src/main/java/com/baeldung/algorithms/ga/jenetics/SubsetSum.java rename to algorithms-genetic/src/main/java/com/baeldung/algorithms/ga/jenetics/SubsetSum.java diff --git a/algorithms/src/main/java/com/baeldung/algorithms/ga/jenetics/TravelingSalesman.java b/algorithms-genetic/src/main/java/com/baeldung/algorithms/ga/jenetics/TravelingSalesman.java similarity index 100% rename from algorithms/src/main/java/com/baeldung/algorithms/ga/jenetics/TravelingSalesman.java rename to algorithms-genetic/src/main/java/com/baeldung/algorithms/ga/jenetics/TravelingSalesman.java diff --git a/activejdbc/src/main/resources/logback.xml b/algorithms-genetic/src/main/resources/logback.xml similarity index 100% rename from activejdbc/src/main/resources/logback.xml rename to algorithms-genetic/src/main/resources/logback.xml diff --git a/algorithms/src/test/java/com/baeldung/algorithms/AntColonyOptimizationLongRunningUnitTest.java b/algorithms-genetic/src/test/java/com/baeldung/algorithms/AntColonyOptimizationLongRunningUnitTest.java similarity index 100% rename from algorithms/src/test/java/com/baeldung/algorithms/AntColonyOptimizationLongRunningUnitTest.java rename to algorithms-genetic/src/test/java/com/baeldung/algorithms/AntColonyOptimizationLongRunningUnitTest.java diff --git a/algorithms/src/test/java/com/baeldung/algorithms/BinaryGeneticAlgorithmLongRunningUnitTest.java b/algorithms-genetic/src/test/java/com/baeldung/algorithms/BinaryGeneticAlgorithmLongRunningUnitTest.java similarity index 100% rename from algorithms/src/test/java/com/baeldung/algorithms/BinaryGeneticAlgorithmLongRunningUnitTest.java rename to algorithms-genetic/src/test/java/com/baeldung/algorithms/BinaryGeneticAlgorithmLongRunningUnitTest.java diff --git a/algorithms/src/test/java/com/baeldung/algorithms/SimulatedAnnealingLongRunningUnitTest.java b/algorithms-genetic/src/test/java/com/baeldung/algorithms/SimulatedAnnealingLongRunningUnitTest.java similarity index 100% rename from algorithms/src/test/java/com/baeldung/algorithms/SimulatedAnnealingLongRunningUnitTest.java rename to algorithms-genetic/src/test/java/com/baeldung/algorithms/SimulatedAnnealingLongRunningUnitTest.java diff --git a/algorithms-miscellaneous-1/.gitignore b/algorithms-miscellaneous-1/.gitignore new file mode 100644 index 0000000000..30b2b7442c --- /dev/null +++ b/algorithms-miscellaneous-1/.gitignore @@ -0,0 +1,4 @@ +/target/ +.settings/ +.classpath +.project \ No newline at end of file diff --git a/algorithms-miscellaneous-1/README.md b/algorithms-miscellaneous-1/README.md new file mode 100644 index 0000000000..a04874c4d2 --- /dev/null +++ b/algorithms-miscellaneous-1/README.md @@ -0,0 +1,13 @@ +## Relevant articles: + +- [Validating Input With Finite Automata in Java](http://www.baeldung.com/java-finite-automata) +- [Example of Hill Climbing Algorithm](http://www.baeldung.com/java-hill-climbing-algorithm) +- [Monte Carlo Tree Search for Tic-Tac-Toe Game](http://www.baeldung.com/java-monte-carlo-tree-search) +- [Binary Search Algorithm in Java](http://www.baeldung.com/java-binary-search) +- [Introduction to Minimax Algorithm](http://www.baeldung.com/java-minimax-algorithm) +- [How to Calculate Levenshtein Distance in Java?](http://www.baeldung.com/java-levenshtein-distance) +- [How to Find the Kth Largest Element in Java](http://www.baeldung.com/java-kth-largest-element) +- [Multi-Swarm Optimization Algorithm in Java](http://www.baeldung.com/java-multi-swarm-algorithm) +- [String Search Algorithms for Large Texts](http://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](http://www.baeldung.com/java-linked-list-middle-element) \ No newline at end of file diff --git a/algorithms-miscellaneous-1/pom.xml b/algorithms-miscellaneous-1/pom.xml new file mode 100644 index 0000000000..5006670dd9 --- /dev/null +++ b/algorithms-miscellaneous-1/pom.xml @@ -0,0 +1,84 @@ + + 4.0.0 + algorithms-miscellaneous-1 + 0.0.1-SNAPSHOT + algorithms-miscellaneous-1 + + + com.baeldung + parent-modules + 1.0.0-SNAPSHOT + + + + + org.apache.commons + commons-math3 + ${commons-math3.version} + + + com.google.guava + guava + ${guava.version} + + + commons-codec + commons-codec + ${commons-codec.version} + + + org.projectlombok + lombok + ${lombok.version} + provided + + + org.assertj + assertj-core + ${org.assertj.core.version} + test + + + + + + + + org.codehaus.mojo + exec-maven-plugin + ${exec-maven-plugin.version} + + + + + + + + + org.codehaus.mojo + cobertura-maven-plugin + 2.7 + + + + com/baeldung/algorithms/dijkstra/* + + + com/baeldung/algorithms/dijkstra/* + + + + + + + + + 1.16.12 + 3.6.1 + 3.9.0 + 1.11 + 25.1-jre + + + \ No newline at end of file diff --git a/algorithms/src/main/java/com/baeldung/algorithms/automata/FiniteStateMachine.java b/algorithms-miscellaneous-1/src/main/java/com/baeldung/algorithms/automata/FiniteStateMachine.java similarity index 100% rename from algorithms/src/main/java/com/baeldung/algorithms/automata/FiniteStateMachine.java rename to algorithms-miscellaneous-1/src/main/java/com/baeldung/algorithms/automata/FiniteStateMachine.java diff --git a/algorithms/src/main/java/com/baeldung/algorithms/automata/RtFiniteStateMachine.java b/algorithms-miscellaneous-1/src/main/java/com/baeldung/algorithms/automata/RtFiniteStateMachine.java similarity index 100% rename from algorithms/src/main/java/com/baeldung/algorithms/automata/RtFiniteStateMachine.java rename to algorithms-miscellaneous-1/src/main/java/com/baeldung/algorithms/automata/RtFiniteStateMachine.java diff --git a/algorithms/src/main/java/com/baeldung/algorithms/automata/RtState.java b/algorithms-miscellaneous-1/src/main/java/com/baeldung/algorithms/automata/RtState.java similarity index 100% rename from algorithms/src/main/java/com/baeldung/algorithms/automata/RtState.java rename to algorithms-miscellaneous-1/src/main/java/com/baeldung/algorithms/automata/RtState.java diff --git a/algorithms/src/main/java/com/baeldung/algorithms/automata/RtTransition.java b/algorithms-miscellaneous-1/src/main/java/com/baeldung/algorithms/automata/RtTransition.java similarity index 100% rename from algorithms/src/main/java/com/baeldung/algorithms/automata/RtTransition.java rename to algorithms-miscellaneous-1/src/main/java/com/baeldung/algorithms/automata/RtTransition.java diff --git a/algorithms/src/main/java/com/baeldung/algorithms/automata/State.java b/algorithms-miscellaneous-1/src/main/java/com/baeldung/algorithms/automata/State.java similarity index 100% rename from algorithms/src/main/java/com/baeldung/algorithms/automata/State.java rename to algorithms-miscellaneous-1/src/main/java/com/baeldung/algorithms/automata/State.java diff --git a/algorithms/src/main/java/com/baeldung/algorithms/automata/Transition.java b/algorithms-miscellaneous-1/src/main/java/com/baeldung/algorithms/automata/Transition.java similarity index 100% rename from algorithms/src/main/java/com/baeldung/algorithms/automata/Transition.java rename to algorithms-miscellaneous-1/src/main/java/com/baeldung/algorithms/automata/Transition.java diff --git a/algorithms/src/main/java/com/baeldung/algorithms/binarysearch/BinarySearch.java b/algorithms-miscellaneous-1/src/main/java/com/baeldung/algorithms/binarysearch/BinarySearch.java similarity index 100% rename from algorithms/src/main/java/com/baeldung/algorithms/binarysearch/BinarySearch.java rename to algorithms-miscellaneous-1/src/main/java/com/baeldung/algorithms/binarysearch/BinarySearch.java diff --git a/algorithms-miscellaneous-1/src/main/java/com/baeldung/algorithms/factorial/Factorial.java b/algorithms-miscellaneous-1/src/main/java/com/baeldung/algorithms/factorial/Factorial.java new file mode 100644 index 0000000000..43d2221773 --- /dev/null +++ b/algorithms-miscellaneous-1/src/main/java/com/baeldung/algorithms/factorial/Factorial.java @@ -0,0 +1,63 @@ +package com.baeldung.algorithms.factorial; + +import java.math.BigInteger; +import java.util.stream.LongStream; + +import org.apache.commons.math3.util.CombinatoricsUtils; + +import com.google.common.math.BigIntegerMath; + +public class Factorial { + + public long factorialUsingForLoop(int n) { + long fact = 1; + for (int i = 2; i <= n; i++) { + fact = fact * i; + } + return fact; + } + + public long factorialUsingStreams(int n) { + return LongStream.rangeClosed(1, n) + .reduce(1, (long x, long y) -> x * y); + } + + public long factorialUsingRecursion(int n) { + if (n <= 2) { + return n; + } + return n * factorialUsingRecursion(n - 1); + } + + private Long[] factorials = new Long[20]; + + public long factorialUsingMemoize(int n) { + + if (factorials[n] != null) { + return factorials[n]; + } + + if (n <= 2) { + return n; + } + long nthValue = n * factorialUsingMemoize(n - 1); + factorials[n] = nthValue; + return nthValue; + } + + public BigInteger factorialHavingLargeResult(int n) { + BigInteger result = BigInteger.ONE; + for (int i = 2; i <= n; i++) + result = result.multiply(BigInteger.valueOf(i)); + return result; + } + + public long factorialUsingApacheCommons(int n) { + return CombinatoricsUtils.factorial(n); + } + + public BigInteger factorialUsingGuava(int n) { + return BigIntegerMath.factorial(n); + } + +} diff --git a/algorithms/src/main/java/com/baeldung/algorithms/hillclimbing/HillClimbing.java b/algorithms-miscellaneous-1/src/main/java/com/baeldung/algorithms/hillclimbing/HillClimbing.java similarity index 100% rename from algorithms/src/main/java/com/baeldung/algorithms/hillclimbing/HillClimbing.java rename to algorithms-miscellaneous-1/src/main/java/com/baeldung/algorithms/hillclimbing/HillClimbing.java diff --git a/algorithms/src/main/java/com/baeldung/algorithms/hillclimbing/State.java b/algorithms-miscellaneous-1/src/main/java/com/baeldung/algorithms/hillclimbing/State.java similarity index 100% rename from algorithms/src/main/java/com/baeldung/algorithms/hillclimbing/State.java rename to algorithms-miscellaneous-1/src/main/java/com/baeldung/algorithms/hillclimbing/State.java diff --git a/algorithms/src/main/java/com/baeldung/algorithms/kthlargest/FindKthLargest.java b/algorithms-miscellaneous-1/src/main/java/com/baeldung/algorithms/kthlargest/FindKthLargest.java similarity index 100% rename from algorithms/src/main/java/com/baeldung/algorithms/kthlargest/FindKthLargest.java rename to algorithms-miscellaneous-1/src/main/java/com/baeldung/algorithms/kthlargest/FindKthLargest.java diff --git a/algorithms/src/main/java/com/baeldung/algorithms/linesintersection/LinesIntersectionService.java b/algorithms-miscellaneous-1/src/main/java/com/baeldung/algorithms/linesintersection/LinesIntersectionService.java similarity index 100% rename from algorithms/src/main/java/com/baeldung/algorithms/linesintersection/LinesIntersectionService.java rename to algorithms-miscellaneous-1/src/main/java/com/baeldung/algorithms/linesintersection/LinesIntersectionService.java diff --git a/algorithms/src/main/java/com/baeldung/algorithms/mcts/montecarlo/MonteCarloTreeSearch.java b/algorithms-miscellaneous-1/src/main/java/com/baeldung/algorithms/mcts/montecarlo/MonteCarloTreeSearch.java similarity index 100% rename from algorithms/src/main/java/com/baeldung/algorithms/mcts/montecarlo/MonteCarloTreeSearch.java rename to algorithms-miscellaneous-1/src/main/java/com/baeldung/algorithms/mcts/montecarlo/MonteCarloTreeSearch.java diff --git a/algorithms/src/main/java/com/baeldung/algorithms/mcts/montecarlo/State.java b/algorithms-miscellaneous-1/src/main/java/com/baeldung/algorithms/mcts/montecarlo/State.java similarity index 100% rename from algorithms/src/main/java/com/baeldung/algorithms/mcts/montecarlo/State.java rename to algorithms-miscellaneous-1/src/main/java/com/baeldung/algorithms/mcts/montecarlo/State.java diff --git a/algorithms/src/main/java/com/baeldung/algorithms/mcts/montecarlo/UCT.java b/algorithms-miscellaneous-1/src/main/java/com/baeldung/algorithms/mcts/montecarlo/UCT.java similarity index 100% rename from algorithms/src/main/java/com/baeldung/algorithms/mcts/montecarlo/UCT.java rename to algorithms-miscellaneous-1/src/main/java/com/baeldung/algorithms/mcts/montecarlo/UCT.java diff --git a/algorithms/src/main/java/com/baeldung/algorithms/mcts/tictactoe/Board.java b/algorithms-miscellaneous-1/src/main/java/com/baeldung/algorithms/mcts/tictactoe/Board.java similarity index 100% rename from algorithms/src/main/java/com/baeldung/algorithms/mcts/tictactoe/Board.java rename to algorithms-miscellaneous-1/src/main/java/com/baeldung/algorithms/mcts/tictactoe/Board.java diff --git a/algorithms/src/main/java/com/baeldung/algorithms/mcts/tictactoe/Position.java b/algorithms-miscellaneous-1/src/main/java/com/baeldung/algorithms/mcts/tictactoe/Position.java similarity index 100% rename from algorithms/src/main/java/com/baeldung/algorithms/mcts/tictactoe/Position.java rename to algorithms-miscellaneous-1/src/main/java/com/baeldung/algorithms/mcts/tictactoe/Position.java diff --git a/algorithms/src/main/java/com/baeldung/algorithms/mcts/tree/Node.java b/algorithms-miscellaneous-1/src/main/java/com/baeldung/algorithms/mcts/tree/Node.java similarity index 100% rename from algorithms/src/main/java/com/baeldung/algorithms/mcts/tree/Node.java rename to algorithms-miscellaneous-1/src/main/java/com/baeldung/algorithms/mcts/tree/Node.java diff --git a/algorithms/src/main/java/com/baeldung/algorithms/mcts/tree/Tree.java b/algorithms-miscellaneous-1/src/main/java/com/baeldung/algorithms/mcts/tree/Tree.java similarity index 100% rename from algorithms/src/main/java/com/baeldung/algorithms/mcts/tree/Tree.java rename to algorithms-miscellaneous-1/src/main/java/com/baeldung/algorithms/mcts/tree/Tree.java diff --git a/algorithms/src/main/java/com/baeldung/algorithms/middleelementlookup/MiddleElementLookup.java b/algorithms-miscellaneous-1/src/main/java/com/baeldung/algorithms/middleelementlookup/MiddleElementLookup.java similarity index 100% rename from algorithms/src/main/java/com/baeldung/algorithms/middleelementlookup/MiddleElementLookup.java rename to algorithms-miscellaneous-1/src/main/java/com/baeldung/algorithms/middleelementlookup/MiddleElementLookup.java diff --git a/algorithms/src/main/java/com/baeldung/algorithms/middleelementlookup/Node.java b/algorithms-miscellaneous-1/src/main/java/com/baeldung/algorithms/middleelementlookup/Node.java similarity index 100% rename from algorithms/src/main/java/com/baeldung/algorithms/middleelementlookup/Node.java rename to algorithms-miscellaneous-1/src/main/java/com/baeldung/algorithms/middleelementlookup/Node.java diff --git a/algorithms/src/main/java/com/baeldung/algorithms/minimax/GameOfBones.java b/algorithms-miscellaneous-1/src/main/java/com/baeldung/algorithms/minimax/GameOfBones.java similarity index 100% rename from algorithms/src/main/java/com/baeldung/algorithms/minimax/GameOfBones.java rename to algorithms-miscellaneous-1/src/main/java/com/baeldung/algorithms/minimax/GameOfBones.java diff --git a/algorithms/src/main/java/com/baeldung/algorithms/minimax/MiniMax.java b/algorithms-miscellaneous-1/src/main/java/com/baeldung/algorithms/minimax/MiniMax.java similarity index 100% rename from algorithms/src/main/java/com/baeldung/algorithms/minimax/MiniMax.java rename to algorithms-miscellaneous-1/src/main/java/com/baeldung/algorithms/minimax/MiniMax.java diff --git a/algorithms/src/main/java/com/baeldung/algorithms/minimax/Node.java b/algorithms-miscellaneous-1/src/main/java/com/baeldung/algorithms/minimax/Node.java similarity index 100% rename from algorithms/src/main/java/com/baeldung/algorithms/minimax/Node.java rename to algorithms-miscellaneous-1/src/main/java/com/baeldung/algorithms/minimax/Node.java diff --git a/algorithms/src/main/java/com/baeldung/algorithms/minimax/Tree.java b/algorithms-miscellaneous-1/src/main/java/com/baeldung/algorithms/minimax/Tree.java similarity index 100% rename from algorithms/src/main/java/com/baeldung/algorithms/minimax/Tree.java rename to algorithms-miscellaneous-1/src/main/java/com/baeldung/algorithms/minimax/Tree.java diff --git a/algorithms/src/main/java/com/baeldung/algorithms/multiswarm/Constants.java b/algorithms-miscellaneous-1/src/main/java/com/baeldung/algorithms/multiswarm/Constants.java similarity index 100% rename from algorithms/src/main/java/com/baeldung/algorithms/multiswarm/Constants.java rename to algorithms-miscellaneous-1/src/main/java/com/baeldung/algorithms/multiswarm/Constants.java diff --git a/algorithms/src/main/java/com/baeldung/algorithms/multiswarm/FitnessFunction.java b/algorithms-miscellaneous-1/src/main/java/com/baeldung/algorithms/multiswarm/FitnessFunction.java similarity index 100% rename from algorithms/src/main/java/com/baeldung/algorithms/multiswarm/FitnessFunction.java rename to algorithms-miscellaneous-1/src/main/java/com/baeldung/algorithms/multiswarm/FitnessFunction.java diff --git a/algorithms/src/main/java/com/baeldung/algorithms/multiswarm/Multiswarm.java b/algorithms-miscellaneous-1/src/main/java/com/baeldung/algorithms/multiswarm/Multiswarm.java similarity index 100% rename from algorithms/src/main/java/com/baeldung/algorithms/multiswarm/Multiswarm.java rename to algorithms-miscellaneous-1/src/main/java/com/baeldung/algorithms/multiswarm/Multiswarm.java diff --git a/algorithms/src/main/java/com/baeldung/algorithms/multiswarm/Particle.java b/algorithms-miscellaneous-1/src/main/java/com/baeldung/algorithms/multiswarm/Particle.java similarity index 100% rename from algorithms/src/main/java/com/baeldung/algorithms/multiswarm/Particle.java rename to algorithms-miscellaneous-1/src/main/java/com/baeldung/algorithms/multiswarm/Particle.java diff --git a/algorithms/src/main/java/com/baeldung/algorithms/multiswarm/Swarm.java b/algorithms-miscellaneous-1/src/main/java/com/baeldung/algorithms/multiswarm/Swarm.java similarity index 100% rename from algorithms/src/main/java/com/baeldung/algorithms/multiswarm/Swarm.java rename to algorithms-miscellaneous-1/src/main/java/com/baeldung/algorithms/multiswarm/Swarm.java diff --git a/algorithms/src/main/java/com/baeldung/algorithms/string/EnglishAlphabetLetters.java b/algorithms-miscellaneous-1/src/main/java/com/baeldung/algorithms/string/EnglishAlphabetLetters.java similarity index 100% rename from algorithms/src/main/java/com/baeldung/algorithms/string/EnglishAlphabetLetters.java rename to algorithms-miscellaneous-1/src/main/java/com/baeldung/algorithms/string/EnglishAlphabetLetters.java diff --git a/algorithms-miscellaneous-1/src/main/java/com/baeldung/algorithms/string/LongestSubstringNonRepeatingCharacters.java b/algorithms-miscellaneous-1/src/main/java/com/baeldung/algorithms/string/LongestSubstringNonRepeatingCharacters.java new file mode 100644 index 0000000000..cd1f3e94d5 --- /dev/null +++ b/algorithms-miscellaneous-1/src/main/java/com/baeldung/algorithms/string/LongestSubstringNonRepeatingCharacters.java @@ -0,0 +1,54 @@ +package com.baeldung.algorithms.string; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.Set; + +public class LongestSubstringNonRepeatingCharacters { + + public static String getUniqueCharacterSubstringBruteForce(String input) { + String output = ""; + for (int start = 0; start < input.length(); start++) { + Set visited = new HashSet<>(); + int end = start; + for (; end < input.length(); end++) { + char currChar = input.charAt(end); + if (visited.contains(currChar)) { + break; + } else { + visited.add(currChar); + } + } + if (output.length() < end - start + 1) { + output = input.substring(start, end); + } + } + return output; + } + + public static String getUniqueCharacterSubstring(String input) { + Map visited = new HashMap<>(); + String output = ""; + for (int start = 0, end = 0; end < input.length(); end++) { + char currChar = input.charAt(end); + if (visited.containsKey(currChar)) { + start = Math.max(visited.get(currChar) + 1, start); + } + if (output.length() < end - start + 1) { + output = input.substring(start, end + 1); + } + visited.put(currChar, end); + } + return output; + } + + public static void main(String[] args) { + if(args.length > 0) { + System.out.println(getUniqueCharacterSubstring(args[0])); + } else { + System.err.println("This program expects command-line input. Please try again!"); + } + } + +} diff --git a/algorithms/src/main/java/com/baeldung/algorithms/string/search/StringSearchAlgorithms.java b/algorithms-miscellaneous-1/src/main/java/com/baeldung/algorithms/string/search/StringSearchAlgorithms.java similarity index 100% rename from algorithms/src/main/java/com/baeldung/algorithms/string/search/StringSearchAlgorithms.java rename to algorithms-miscellaneous-1/src/main/java/com/baeldung/algorithms/string/search/StringSearchAlgorithms.java diff --git a/algorithms/src/main/resources/logback.xml b/algorithms-miscellaneous-1/src/main/resources/logback.xml similarity index 100% rename from algorithms/src/main/resources/logback.xml rename to algorithms-miscellaneous-1/src/main/resources/logback.xml diff --git a/algorithms/src/test/java/com/baeldung/algorithms/HillClimbingAlgorithmUnitTest.java b/algorithms-miscellaneous-1/src/test/java/com/baeldung/algorithms/HillClimbingAlgorithmUnitTest.java similarity index 100% rename from algorithms/src/test/java/com/baeldung/algorithms/HillClimbingAlgorithmUnitTest.java rename to algorithms-miscellaneous-1/src/test/java/com/baeldung/algorithms/HillClimbingAlgorithmUnitTest.java diff --git a/algorithms/src/test/java/com/baeldung/algorithms/MiddleElementLookupUnitTest.java b/algorithms-miscellaneous-1/src/test/java/com/baeldung/algorithms/MiddleElementLookupUnitTest.java similarity index 100% rename from algorithms/src/test/java/com/baeldung/algorithms/MiddleElementLookupUnitTest.java rename to algorithms-miscellaneous-1/src/test/java/com/baeldung/algorithms/MiddleElementLookupUnitTest.java diff --git a/algorithms/src/test/java/com/baeldung/algorithms/RtFiniteStateMachineLongRunningUnitTest.java b/algorithms-miscellaneous-1/src/test/java/com/baeldung/algorithms/RtFiniteStateMachineLongRunningUnitTest.java similarity index 100% rename from algorithms/src/test/java/com/baeldung/algorithms/RtFiniteStateMachineLongRunningUnitTest.java rename to algorithms-miscellaneous-1/src/test/java/com/baeldung/algorithms/RtFiniteStateMachineLongRunningUnitTest.java diff --git a/algorithms/src/test/java/com/baeldung/algorithms/StringSearchAlgorithmsUnitTest.java b/algorithms-miscellaneous-1/src/test/java/com/baeldung/algorithms/StringSearchAlgorithmsUnitTest.java similarity index 100% rename from algorithms/src/test/java/com/baeldung/algorithms/StringSearchAlgorithmsUnitTest.java rename to algorithms-miscellaneous-1/src/test/java/com/baeldung/algorithms/StringSearchAlgorithmsUnitTest.java diff --git a/algorithms/src/test/java/com/baeldung/algorithms/binarysearch/BinarySearchUnitTest.java b/algorithms-miscellaneous-1/src/test/java/com/baeldung/algorithms/binarysearch/BinarySearchUnitTest.java similarity index 100% rename from algorithms/src/test/java/com/baeldung/algorithms/binarysearch/BinarySearchUnitTest.java rename to algorithms-miscellaneous-1/src/test/java/com/baeldung/algorithms/binarysearch/BinarySearchUnitTest.java diff --git a/algorithms-miscellaneous-1/src/test/java/com/baeldung/algorithms/factorial/FactorialUnitTest.java b/algorithms-miscellaneous-1/src/test/java/com/baeldung/algorithms/factorial/FactorialUnitTest.java new file mode 100644 index 0000000000..c185dba62b --- /dev/null +++ b/algorithms-miscellaneous-1/src/test/java/com/baeldung/algorithms/factorial/FactorialUnitTest.java @@ -0,0 +1,72 @@ +package com.baeldung.algorithms.factorial; + +import static org.assertj.core.api.Assertions.assertThat; + +import java.math.BigInteger; + +import org.junit.Before; +import org.junit.Test; + +public class FactorialUnitTest { + + Factorial factorial; + + @Before + public void setup() { + factorial = new Factorial(); + } + + @Test + public void whenCalculatingFactorialUsingForLoop_thenCorrect() { + int n = 5; + + assertThat(factorial.factorialUsingForLoop(n)).isEqualTo(120); + } + + @Test + public void whenCalculatingFactorialUsingStreams_thenCorrect() { + int n = 5; + + assertThat(factorial.factorialUsingStreams(n)).isEqualTo(120); + } + + @Test + public void whenCalculatingFactorialUsingRecursion_thenCorrect() { + int n = 5; + + assertThat(factorial.factorialUsingRecursion(n)).isEqualTo(120); + } + + @Test + public void whenCalculatingFactorialUsingMemoize_thenCorrect() { + int n = 5; + + assertThat(factorial.factorialUsingMemoize(n)).isEqualTo(120); + + n = 6; + + assertThat(factorial.factorialUsingMemoize(n)).isEqualTo(720); + } + + @Test + public void whenCalculatingFactorialHavingLargeResult_thenCorrect() { + int n = 22; + + assertThat(factorial.factorialHavingLargeResult(n)).isEqualTo(new BigInteger("1124000727777607680000")); + } + + @Test + public void whenCalculatingFactorialUsingApacheCommons_thenCorrect() { + int n = 5; + + assertThat(factorial.factorialUsingApacheCommons(n)).isEqualTo(120); + } + + @Test + public void whenCalculatingFactorialUsingGuava_thenCorrect() { + int n = 22; + + assertThat(factorial.factorialUsingGuava(n)).isEqualTo(new BigInteger("1124000727777607680000")); + } + +} diff --git a/algorithms/src/test/java/com/baeldung/algorithms/kthlargest/FindKthLargestUnitTest.java b/algorithms-miscellaneous-1/src/test/java/com/baeldung/algorithms/kthlargest/FindKthLargestUnitTest.java similarity index 100% rename from algorithms/src/test/java/com/baeldung/algorithms/kthlargest/FindKthLargestUnitTest.java rename to algorithms-miscellaneous-1/src/test/java/com/baeldung/algorithms/kthlargest/FindKthLargestUnitTest.java diff --git a/algorithms/src/test/java/com/baeldung/algorithms/linesintersection/LinesIntersectionServiceUnitTest.java b/algorithms-miscellaneous-1/src/test/java/com/baeldung/algorithms/linesintersection/LinesIntersectionServiceUnitTest.java similarity index 100% rename from algorithms/src/test/java/com/baeldung/algorithms/linesintersection/LinesIntersectionServiceUnitTest.java rename to algorithms-miscellaneous-1/src/test/java/com/baeldung/algorithms/linesintersection/LinesIntersectionServiceUnitTest.java diff --git a/algorithms/src/test/java/com/baeldung/algorithms/mcts/MCTSUnitTest.java b/algorithms-miscellaneous-1/src/test/java/com/baeldung/algorithms/mcts/MCTSUnitTest.java similarity index 100% rename from algorithms/src/test/java/com/baeldung/algorithms/mcts/MCTSUnitTest.java rename to algorithms-miscellaneous-1/src/test/java/com/baeldung/algorithms/mcts/MCTSUnitTest.java diff --git a/algorithms/src/test/java/com/baeldung/algorithms/minimax/MinimaxUnitTest.java b/algorithms-miscellaneous-1/src/test/java/com/baeldung/algorithms/minimax/MinimaxUnitTest.java similarity index 100% rename from algorithms/src/test/java/com/baeldung/algorithms/minimax/MinimaxUnitTest.java rename to algorithms-miscellaneous-1/src/test/java/com/baeldung/algorithms/minimax/MinimaxUnitTest.java diff --git a/algorithms/src/test/java/com/baeldung/algorithms/multiswarm/LolFitnessFunction.java b/algorithms-miscellaneous-1/src/test/java/com/baeldung/algorithms/multiswarm/LolFitnessFunction.java similarity index 100% rename from algorithms/src/test/java/com/baeldung/algorithms/multiswarm/LolFitnessFunction.java rename to algorithms-miscellaneous-1/src/test/java/com/baeldung/algorithms/multiswarm/LolFitnessFunction.java diff --git a/algorithms/src/test/java/com/baeldung/algorithms/multiswarm/MultiswarmUnitTest.java b/algorithms-miscellaneous-1/src/test/java/com/baeldung/algorithms/multiswarm/MultiswarmUnitTest.java similarity index 100% rename from algorithms/src/test/java/com/baeldung/algorithms/multiswarm/MultiswarmUnitTest.java rename to algorithms-miscellaneous-1/src/test/java/com/baeldung/algorithms/multiswarm/MultiswarmUnitTest.java diff --git a/algorithms/src/test/java/com/baeldung/algorithms/string/EnglishAlphabetLettersUnitTest.java b/algorithms-miscellaneous-1/src/test/java/com/baeldung/algorithms/string/EnglishAlphabetLettersUnitTest.java similarity index 100% rename from algorithms/src/test/java/com/baeldung/algorithms/string/EnglishAlphabetLettersUnitTest.java rename to algorithms-miscellaneous-1/src/test/java/com/baeldung/algorithms/string/EnglishAlphabetLettersUnitTest.java diff --git a/algorithms-miscellaneous-1/src/test/java/com/baeldung/algorithms/string/LongestSubstringNonRepeatingCharactersUnitTest.java b/algorithms-miscellaneous-1/src/test/java/com/baeldung/algorithms/string/LongestSubstringNonRepeatingCharactersUnitTest.java new file mode 100644 index 0000000000..9f1e6a2519 --- /dev/null +++ b/algorithms-miscellaneous-1/src/test/java/com/baeldung/algorithms/string/LongestSubstringNonRepeatingCharactersUnitTest.java @@ -0,0 +1,31 @@ +package com.baeldung.algorithms.string; + +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static com.baeldung.algorithms.string.LongestSubstringNonRepeatingCharacters.getUniqueCharacterSubstring; +import static com.baeldung.algorithms.string.LongestSubstringNonRepeatingCharacters.getUniqueCharacterSubstringBruteForce; + +public class LongestSubstringNonRepeatingCharactersUnitTest { + + @Test + void givenString_whenGetUniqueCharacterSubstringBruteForceCalled_thenResultFoundAsExpectedUnitTest() { + assertEquals("", getUniqueCharacterSubstringBruteForce("")); + assertEquals("A", getUniqueCharacterSubstringBruteForce("A")); + assertEquals("ABCDEF", getUniqueCharacterSubstringBruteForce("AABCDEF")); + assertEquals("ABCDEF", getUniqueCharacterSubstringBruteForce("ABCDEFF")); + assertEquals("NGISAWE", getUniqueCharacterSubstringBruteForce("CODINGISAWESOME")); + assertEquals("be coding", getUniqueCharacterSubstringBruteForce("always be coding")); + } + + @Test + void givenString_whenGetUniqueCharacterSubstringCalled_thenResultFoundAsExpectedUnitTest() { + assertEquals("", getUniqueCharacterSubstring("")); + assertEquals("A", getUniqueCharacterSubstring("A")); + assertEquals("ABCDEF", getUniqueCharacterSubstring("AABCDEF")); + assertEquals("ABCDEF", getUniqueCharacterSubstring("ABCDEFF")); + assertEquals("NGISAWE", getUniqueCharacterSubstring("CODINGISAWESOME")); + assertEquals("be coding", getUniqueCharacterSubstring("always be coding")); + } + +} diff --git a/algorithms/src/test/java/com/baeldung/algorithms/support/MayFailRule.java b/algorithms-miscellaneous-1/src/test/java/com/baeldung/algorithms/support/MayFailRule.java similarity index 100% rename from algorithms/src/test/java/com/baeldung/algorithms/support/MayFailRule.java rename to algorithms-miscellaneous-1/src/test/java/com/baeldung/algorithms/support/MayFailRule.java diff --git a/algorithms-miscellaneous-2/.gitignore b/algorithms-miscellaneous-2/.gitignore new file mode 100644 index 0000000000..30b2b7442c --- /dev/null +++ b/algorithms-miscellaneous-2/.gitignore @@ -0,0 +1,4 @@ +/target/ +.settings/ +.classpath +.project \ No newline at end of file diff --git a/algorithms/README.md b/algorithms-miscellaneous-2/README.md similarity index 51% rename from algorithms/README.md rename to algorithms-miscellaneous-2/README.md index 9d347869bd..d693a44f66 100644 --- a/algorithms/README.md +++ b/algorithms-miscellaneous-2/README.md @@ -2,32 +2,19 @@ - [Dijkstra Algorithm in Java](http://www.baeldung.com/java-dijkstra) - [Introduction to Cobertura](http://www.baeldung.com/cobertura) -- [Ant Colony Optimization](http://www.baeldung.com/java-ant-colony-optimization) -- [Validating Input With Finite Automata in Java](http://www.baeldung.com/java-finite-automata) -- [Introduction to Jenetics Library](http://www.baeldung.com/jenetics) -- [Example of Hill Climbing Algorithm](http://www.baeldung.com/java-hill-climbing-algorithm) -- [Monte Carlo Tree Search for Tic-Tac-Toe Game](http://www.baeldung.com/java-monte-carlo-tree-search) -- [String Search Algorithms for Large Texts](http://www.baeldung.com/java-full-text-search-algorithms) - [Test a Linked List for Cyclicity](http://www.baeldung.com/java-linked-list-cyclicity) -- [Binary Search Algorithm in Java](http://www.baeldung.com/java-binary-search) -- [Bubble Sort in Java](http://www.baeldung.com/java-bubble-sort) - [Introduction to JGraphT](http://www.baeldung.com/jgrapht) -- [Introduction to Minimax Algorithm](http://www.baeldung.com/java-minimax-algorithm) -- [How to Calculate Levenshtein Distance in Java?](http://www.baeldung.com/java-levenshtein-distance) -- [How to Find the Kth Largest Element in Java](http://www.baeldung.com/java-kth-largest-element) -- [Multi-Swarm Optimization Algorithm in Java](http://www.baeldung.com/java-multi-swarm-algorithm) - [A Maze Solver in Java](http://www.baeldung.com/java-solve-maze) - [Create a Sudoku Solver in Java](http://www.baeldung.com/java-sudoku) - [Displaying Money Amounts in Words](http://www.baeldung.com/java-money-into-words) - [A Collaborative Filtering Recommendation System in Java](http://www.baeldung.com/java-collaborative-filtering-recommendations) - [Converting Between Roman and Arabic Numerals in Java](http://www.baeldung.com/java-convert-roman-arabic) - [Practical Java Examples of the Big O Notation](http://www.baeldung.com/java-algorithm-complexity) -- [Find the Middle Element of a Linked List](http://www.baeldung.com/java-linked-list-middle-element) - [An Introduction to the Theory of Big-O Notation](http://www.baeldung.com/big-o-notation) - [Check If Two Rectangles Overlap In Java](https://www.baeldung.com/java-check-if-two-rectangles-overlap) - [Calculate the Distance Between Two Points in Java](https://www.baeldung.com/java-distance-between-two-points) - [Find the Intersection of Two Lines in Java](https://www.baeldung.com/java-intersection-of-two-lines) -- [Check If a String Contains All The Letters of The Alphabet](https://www.baeldung.com/java-string-contains-all-letters) - [Round Up to the Nearest Hundred](https://www.baeldung.com/java-round-up-nearest-hundred) -- [Merge Sort in Java](https://www.baeldung.com/java-merge-sort) - [Calculate Percentage in Java](https://www.baeldung.com/java-calculate-percentage) +- [Converting Between Byte Arrays and Hexadecimal Strings in Java](https://www.baeldung.com/java-byte-arrays-hex-strings) +- [Convert Latitude and Longitude to a 2D Point in Java](https://www.baeldung.com/java-convert-latitude-longitude) diff --git a/algorithms/pom.xml b/algorithms-miscellaneous-2/pom.xml similarity index 88% rename from algorithms/pom.xml rename to algorithms-miscellaneous-2/pom.xml index db4a1c2eff..25472d4888 100644 --- a/algorithms/pom.xml +++ b/algorithms-miscellaneous-2/pom.xml @@ -1,96 +1,90 @@ - - 4.0.0 - com.baeldung - algorithms - 0.0.1-SNAPSHOT - - - com.baeldung - parent-modules - 1.0.0-SNAPSHOT - - - - - org.apache.commons - commons-math3 - ${commons-math3.version} - - - commons-codec - commons-codec - ${commons-codec.version} - - - org.projectlombok - lombok - ${lombok.version} - provided - - - io.jenetics - jenetics - ${io.jenetics.version} - - - org.jgrapht - jgrapht-core - ${org.jgrapht.core.version} - - - pl.allegro.finance - tradukisto - ${tradukisto.version} - - - org.assertj - assertj-core - ${org.assertj.core.version} - test - - - - - - - - org.codehaus.mojo - exec-maven-plugin - ${exec-maven-plugin.version} - - - - - - - - - org.codehaus.mojo - cobertura-maven-plugin - 2.7 - - - - com/baeldung/algorithms/dijkstra/* - - - com/baeldung/algorithms/dijkstra/* - - - - - - - - - 1.16.12 - 3.6.1 - 1.0.1 - 3.7.0 - 1.0.1 - 3.9.0 - 1.11 - - + + 4.0.0 + algorithms-miscellaneous-2 + 0.0.1-SNAPSHOT + algorithms-miscellaneous-2 + + + com.baeldung + parent-modules + 1.0.0-SNAPSHOT + + + + + org.apache.commons + commons-math3 + ${commons-math3.version} + + + commons-codec + commons-codec + ${commons-codec.version} + + + org.projectlombok + lombok + ${lombok.version} + provided + + + org.jgrapht + jgrapht-core + ${org.jgrapht.core.version} + + + pl.allegro.finance + tradukisto + ${tradukisto.version} + + + org.assertj + assertj-core + ${org.assertj.core.version} + test + + + + + + + + org.codehaus.mojo + exec-maven-plugin + ${exec-maven-plugin.version} + + + + + + + + + org.codehaus.mojo + cobertura-maven-plugin + 2.7 + + + + com/baeldung/algorithms/dijkstra/* + + + com/baeldung/algorithms/dijkstra/* + + + + + + + + + 1.16.12 + 3.6.1 + 1.0.1 + 1.0.1 + 3.9.0 + 1.11 + + \ No newline at end of file diff --git a/algorithms-miscellaneous-2/src/main/java/com/baeldung/algorithms/RunAlgorithm.java b/algorithms-miscellaneous-2/src/main/java/com/baeldung/algorithms/RunAlgorithm.java new file mode 100644 index 0000000000..a1a096bc30 --- /dev/null +++ b/algorithms-miscellaneous-2/src/main/java/com/baeldung/algorithms/RunAlgorithm.java @@ -0,0 +1,28 @@ +package com.baeldung.algorithms; + +import java.util.Scanner; + +import com.baeldung.algorithms.slope_one.SlopeOne; + +public class RunAlgorithm { + + public static void main(String[] args) throws InstantiationException, IllegalAccessException { + Scanner in = new Scanner(System.in); + System.out.println("1 - Slope One"); + System.out.println("2 - Dijkstra"); + int decision = in.nextInt(); + switch (decision) { + case 1: + SlopeOne.slopeOne(3); + break; + case 2: + System.out.println("Please run the DijkstraAlgorithmLongRunningUnitTest."); + break; + default: + System.out.println("Unknown option"); + break; + } + in.close(); + } + +} diff --git a/algorithms/src/main/java/com/baeldung/algorithms/conversion/HexStringConverter.java b/algorithms-miscellaneous-2/src/main/java/com/baeldung/algorithms/conversion/HexStringConverter.java similarity index 100% rename from algorithms/src/main/java/com/baeldung/algorithms/conversion/HexStringConverter.java rename to algorithms-miscellaneous-2/src/main/java/com/baeldung/algorithms/conversion/HexStringConverter.java diff --git a/algorithms/src/main/java/com/baeldung/algorithms/distancebetweenpoints/DistanceBetweenPointsService.java b/algorithms-miscellaneous-2/src/main/java/com/baeldung/algorithms/distancebetweenpoints/DistanceBetweenPointsService.java similarity index 100% rename from algorithms/src/main/java/com/baeldung/algorithms/distancebetweenpoints/DistanceBetweenPointsService.java rename to algorithms-miscellaneous-2/src/main/java/com/baeldung/algorithms/distancebetweenpoints/DistanceBetweenPointsService.java diff --git a/algorithms/src/main/java/com/baeldung/algorithms/editdistance/EditDistanceBase.java b/algorithms-miscellaneous-2/src/main/java/com/baeldung/algorithms/editdistance/EditDistanceBase.java similarity index 95% rename from algorithms/src/main/java/com/baeldung/algorithms/editdistance/EditDistanceBase.java rename to algorithms-miscellaneous-2/src/main/java/com/baeldung/algorithms/editdistance/EditDistanceBase.java index ec66621928..4df1de9994 100644 --- a/algorithms/src/main/java/com/baeldung/algorithms/editdistance/EditDistanceBase.java +++ b/algorithms-miscellaneous-2/src/main/java/com/baeldung/algorithms/editdistance/EditDistanceBase.java @@ -1,15 +1,15 @@ -package com.baeldung.algorithms.editdistance; - -import java.util.Arrays; - -public class EditDistanceBase { - - static int costOfSubstitution(char a, char b) { - return a == b ? 0 : 1; - } - - static int min(int... numbers) { - return Arrays.stream(numbers) - .min().orElse(Integer.MAX_VALUE); - } -} +package com.baeldung.algorithms.editdistance; + +import java.util.Arrays; + +public class EditDistanceBase { + + static int costOfSubstitution(char a, char b) { + return a == b ? 0 : 1; + } + + static int min(int... numbers) { + return Arrays.stream(numbers) + .min().orElse(Integer.MAX_VALUE); + } +} diff --git a/algorithms/src/main/java/com/baeldung/algorithms/editdistance/EditDistanceDynamicProgramming.java b/algorithms-miscellaneous-2/src/main/java/com/baeldung/algorithms/editdistance/EditDistanceDynamicProgramming.java similarity index 96% rename from algorithms/src/main/java/com/baeldung/algorithms/editdistance/EditDistanceDynamicProgramming.java rename to algorithms-miscellaneous-2/src/main/java/com/baeldung/algorithms/editdistance/EditDistanceDynamicProgramming.java index 1f8824c4f4..10ce43bf5f 100644 --- a/algorithms/src/main/java/com/baeldung/algorithms/editdistance/EditDistanceDynamicProgramming.java +++ b/algorithms-miscellaneous-2/src/main/java/com/baeldung/algorithms/editdistance/EditDistanceDynamicProgramming.java @@ -1,26 +1,26 @@ -package com.baeldung.algorithms.editdistance; - -public class EditDistanceDynamicProgramming extends EditDistanceBase { - - static int calculate(String x, String y) { - int[][] dp = new int[x.length() + 1][y.length() + 1]; - - for (int i = 0; i <= x.length(); i++) { - for (int j = 0; j <= y.length(); j++) { - if (i == 0) - dp[i][j] = j; - - else if (j == 0) - dp[i][j] = i; - - else { - dp[i][j] = min(dp[i - 1][j - 1] - + costOfSubstitution(x.charAt(i - 1), y.charAt(j - 1)), - dp[i - 1][j] + 1, dp[i][j - 1] + 1); - } - } - } - - return dp[x.length()][y.length()]; - } -} +package com.baeldung.algorithms.editdistance; + +public class EditDistanceDynamicProgramming extends EditDistanceBase { + + static int calculate(String x, String y) { + int[][] dp = new int[x.length() + 1][y.length() + 1]; + + for (int i = 0; i <= x.length(); i++) { + for (int j = 0; j <= y.length(); j++) { + if (i == 0) + dp[i][j] = j; + + else if (j == 0) + dp[i][j] = i; + + else { + dp[i][j] = min(dp[i - 1][j - 1] + + costOfSubstitution(x.charAt(i - 1), y.charAt(j - 1)), + dp[i - 1][j] + 1, dp[i][j - 1] + 1); + } + } + } + + return dp[x.length()][y.length()]; + } +} diff --git a/algorithms/src/main/java/com/baeldung/algorithms/editdistance/EditDistanceRecursive.java b/algorithms-miscellaneous-2/src/main/java/com/baeldung/algorithms/editdistance/EditDistanceRecursive.java similarity index 96% rename from algorithms/src/main/java/com/baeldung/algorithms/editdistance/EditDistanceRecursive.java rename to algorithms-miscellaneous-2/src/main/java/com/baeldung/algorithms/editdistance/EditDistanceRecursive.java index 8ed48dc554..fc907c45f8 100644 --- a/algorithms/src/main/java/com/baeldung/algorithms/editdistance/EditDistanceRecursive.java +++ b/algorithms-miscellaneous-2/src/main/java/com/baeldung/algorithms/editdistance/EditDistanceRecursive.java @@ -1,21 +1,21 @@ -package com.baeldung.algorithms.editdistance; - -public class EditDistanceRecursive extends EditDistanceBase { - - static int calculate(String x, String y) { - - if (x.isEmpty()) { - return y.length(); - } - - if (y.isEmpty()) { - return x.length(); - } - - int substitution = calculate(x.substring(1), y.substring(1)) + costOfSubstitution(x.charAt(0), y.charAt(0)); - int insertion = calculate(x, y.substring(1)) + 1; - int deletion = calculate(x.substring(1), y) + 1; - - return min(substitution, insertion, deletion); - } -} +package com.baeldung.algorithms.editdistance; + +public class EditDistanceRecursive extends EditDistanceBase { + + static int calculate(String x, String y) { + + if (x.isEmpty()) { + return y.length(); + } + + if (y.isEmpty()) { + return x.length(); + } + + int substitution = calculate(x.substring(1), y.substring(1)) + costOfSubstitution(x.charAt(0), y.charAt(0)); + int insertion = calculate(x, y.substring(1)) + 1; + int deletion = calculate(x.substring(1), y) + 1; + + return min(substitution, insertion, deletion); + } +} diff --git a/algorithms/src/main/java/com/baeldung/algorithms/ga/dijkstra/Dijkstra.java b/algorithms-miscellaneous-2/src/main/java/com/baeldung/algorithms/ga/dijkstra/Dijkstra.java similarity index 100% rename from algorithms/src/main/java/com/baeldung/algorithms/ga/dijkstra/Dijkstra.java rename to algorithms-miscellaneous-2/src/main/java/com/baeldung/algorithms/ga/dijkstra/Dijkstra.java diff --git a/algorithms/src/main/java/com/baeldung/algorithms/ga/dijkstra/Graph.java b/algorithms-miscellaneous-2/src/main/java/com/baeldung/algorithms/ga/dijkstra/Graph.java similarity index 100% rename from algorithms/src/main/java/com/baeldung/algorithms/ga/dijkstra/Graph.java rename to algorithms-miscellaneous-2/src/main/java/com/baeldung/algorithms/ga/dijkstra/Graph.java diff --git a/algorithms/src/main/java/com/baeldung/algorithms/ga/dijkstra/Node.java b/algorithms-miscellaneous-2/src/main/java/com/baeldung/algorithms/ga/dijkstra/Node.java similarity index 100% rename from algorithms/src/main/java/com/baeldung/algorithms/ga/dijkstra/Node.java rename to algorithms-miscellaneous-2/src/main/java/com/baeldung/algorithms/ga/dijkstra/Node.java diff --git a/algorithms/src/main/java/com/baeldung/algorithms/linkedlist/CycleDetectionBruteForce.java b/algorithms-miscellaneous-2/src/main/java/com/baeldung/algorithms/linkedlist/CycleDetectionBruteForce.java similarity index 96% rename from algorithms/src/main/java/com/baeldung/algorithms/linkedlist/CycleDetectionBruteForce.java rename to algorithms-miscellaneous-2/src/main/java/com/baeldung/algorithms/linkedlist/CycleDetectionBruteForce.java index 1df425ad2e..907bd9042d 100644 --- a/algorithms/src/main/java/com/baeldung/algorithms/linkedlist/CycleDetectionBruteForce.java +++ b/algorithms-miscellaneous-2/src/main/java/com/baeldung/algorithms/linkedlist/CycleDetectionBruteForce.java @@ -1,38 +1,38 @@ -package com.baeldung.algorithms.linkedlist; - -public class CycleDetectionBruteForce { - - public static CycleDetectionResult detectCycle(Node head) { - if (head == null) { - return new CycleDetectionResult<>(false, null); - } - - Node it1 = head; - int nodesTraversedByOuter = 0; - while (it1 != null && it1.next != null) { - it1 = it1.next; - nodesTraversedByOuter++; - - int x = nodesTraversedByOuter; - Node it2 = head; - int noOfTimesCurrentNodeVisited = 0; - - while (x > 0) { - it2 = it2.next; - - if (it2 == it1) { - noOfTimesCurrentNodeVisited++; - } - - if (noOfTimesCurrentNodeVisited == 2) { - return new CycleDetectionResult<>(true, it1); - } - - x--; - } - } - - return new CycleDetectionResult<>(false, null); - } - -} +package com.baeldung.algorithms.linkedlist; + +public class CycleDetectionBruteForce { + + public static CycleDetectionResult detectCycle(Node head) { + if (head == null) { + return new CycleDetectionResult<>(false, null); + } + + Node it1 = head; + int nodesTraversedByOuter = 0; + while (it1 != null && it1.next != null) { + it1 = it1.next; + nodesTraversedByOuter++; + + int x = nodesTraversedByOuter; + Node it2 = head; + int noOfTimesCurrentNodeVisited = 0; + + while (x > 0) { + it2 = it2.next; + + if (it2 == it1) { + noOfTimesCurrentNodeVisited++; + } + + if (noOfTimesCurrentNodeVisited == 2) { + return new CycleDetectionResult<>(true, it1); + } + + x--; + } + } + + return new CycleDetectionResult<>(false, null); + } + +} diff --git a/algorithms/src/main/java/com/baeldung/algorithms/linkedlist/CycleDetectionByFastAndSlowIterators.java b/algorithms-miscellaneous-2/src/main/java/com/baeldung/algorithms/linkedlist/CycleDetectionByFastAndSlowIterators.java similarity index 96% rename from algorithms/src/main/java/com/baeldung/algorithms/linkedlist/CycleDetectionByFastAndSlowIterators.java rename to algorithms-miscellaneous-2/src/main/java/com/baeldung/algorithms/linkedlist/CycleDetectionByFastAndSlowIterators.java index ab088de44a..2817f6f783 100644 --- a/algorithms/src/main/java/com/baeldung/algorithms/linkedlist/CycleDetectionByFastAndSlowIterators.java +++ b/algorithms-miscellaneous-2/src/main/java/com/baeldung/algorithms/linkedlist/CycleDetectionByFastAndSlowIterators.java @@ -1,25 +1,25 @@ -package com.baeldung.algorithms.linkedlist; - -public class CycleDetectionByFastAndSlowIterators { - - public static CycleDetectionResult detectCycle(Node head) { - if (head == null) { - return new CycleDetectionResult<>(false, null); - } - - Node slow = head; - Node fast = head; - - while (fast != null && fast.next != null) { - slow = slow.next; - fast = fast.next.next; - - if (slow == fast) { - return new CycleDetectionResult<>(true, fast); - } - } - - return new CycleDetectionResult<>(false, null); - } - -} +package com.baeldung.algorithms.linkedlist; + +public class CycleDetectionByFastAndSlowIterators { + + public static CycleDetectionResult detectCycle(Node head) { + if (head == null) { + return new CycleDetectionResult<>(false, null); + } + + Node slow = head; + Node fast = head; + + while (fast != null && fast.next != null) { + slow = slow.next; + fast = fast.next.next; + + if (slow == fast) { + return new CycleDetectionResult<>(true, fast); + } + } + + return new CycleDetectionResult<>(false, null); + } + +} diff --git a/algorithms/src/main/java/com/baeldung/algorithms/linkedlist/CycleDetectionByHashing.java b/algorithms-miscellaneous-2/src/main/java/com/baeldung/algorithms/linkedlist/CycleDetectionByHashing.java similarity index 96% rename from algorithms/src/main/java/com/baeldung/algorithms/linkedlist/CycleDetectionByHashing.java rename to algorithms-miscellaneous-2/src/main/java/com/baeldung/algorithms/linkedlist/CycleDetectionByHashing.java index 90d5ecd711..fba4cad2e6 100644 --- a/algorithms/src/main/java/com/baeldung/algorithms/linkedlist/CycleDetectionByHashing.java +++ b/algorithms-miscellaneous-2/src/main/java/com/baeldung/algorithms/linkedlist/CycleDetectionByHashing.java @@ -1,27 +1,27 @@ -package com.baeldung.algorithms.linkedlist; - -import java.util.HashSet; -import java.util.Set; - -public class CycleDetectionByHashing { - - public static CycleDetectionResult detectCycle(Node head) { - if (head == null) { - return new CycleDetectionResult<>(false, null); - } - - Set> set = new HashSet<>(); - Node node = head; - - while (node != null) { - if (set.contains(node)) { - return new CycleDetectionResult<>(true, node); - } - set.add(node); - node = node.next; - } - - return new CycleDetectionResult<>(false, null); - } - -} +package com.baeldung.algorithms.linkedlist; + +import java.util.HashSet; +import java.util.Set; + +public class CycleDetectionByHashing { + + public static CycleDetectionResult detectCycle(Node head) { + if (head == null) { + return new CycleDetectionResult<>(false, null); + } + + Set> set = new HashSet<>(); + Node node = head; + + while (node != null) { + if (set.contains(node)) { + return new CycleDetectionResult<>(true, node); + } + set.add(node); + node = node.next; + } + + return new CycleDetectionResult<>(false, null); + } + +} diff --git a/algorithms/src/main/java/com/baeldung/algorithms/linkedlist/CycleDetectionResult.java b/algorithms-miscellaneous-2/src/main/java/com/baeldung/algorithms/linkedlist/CycleDetectionResult.java similarity index 96% rename from algorithms/src/main/java/com/baeldung/algorithms/linkedlist/CycleDetectionResult.java rename to algorithms-miscellaneous-2/src/main/java/com/baeldung/algorithms/linkedlist/CycleDetectionResult.java index e7556311b3..4e258ec2ef 100644 --- a/algorithms/src/main/java/com/baeldung/algorithms/linkedlist/CycleDetectionResult.java +++ b/algorithms-miscellaneous-2/src/main/java/com/baeldung/algorithms/linkedlist/CycleDetectionResult.java @@ -1,12 +1,12 @@ -package com.baeldung.algorithms.linkedlist; - -public class CycleDetectionResult { - boolean cycleExists; - Node node; - - public CycleDetectionResult(boolean cycleExists, Node node) { - super(); - this.cycleExists = cycleExists; - this.node = node; - } -} +package com.baeldung.algorithms.linkedlist; + +public class CycleDetectionResult { + boolean cycleExists; + Node node; + + public CycleDetectionResult(boolean cycleExists, Node node) { + super(); + this.cycleExists = cycleExists; + this.node = node; + } +} diff --git a/algorithms/src/main/java/com/baeldung/algorithms/linkedlist/CycleRemovalBruteForce.java b/algorithms-miscellaneous-2/src/main/java/com/baeldung/algorithms/linkedlist/CycleRemovalBruteForce.java similarity index 96% rename from algorithms/src/main/java/com/baeldung/algorithms/linkedlist/CycleRemovalBruteForce.java rename to algorithms-miscellaneous-2/src/main/java/com/baeldung/algorithms/linkedlist/CycleRemovalBruteForce.java index a2bfaee9a1..216ebcdde3 100644 --- a/algorithms/src/main/java/com/baeldung/algorithms/linkedlist/CycleRemovalBruteForce.java +++ b/algorithms-miscellaneous-2/src/main/java/com/baeldung/algorithms/linkedlist/CycleRemovalBruteForce.java @@ -1,56 +1,56 @@ -package com.baeldung.algorithms.linkedlist; - -public class CycleRemovalBruteForce { - - public static boolean detectAndRemoveCycle(Node head) { - CycleDetectionResult result = CycleDetectionByFastAndSlowIterators.detectCycle(head); - - if (result.cycleExists) { - removeCycle(result.node, head); - } - - return result.cycleExists; - } - - /** - * @param loopNodeParam - reference to the node where Flyods cycle - * finding algorithm ends, i.e. the fast and the slow iterators - * meet. - * @param head - reference to the head of the list - */ - private static void removeCycle(Node loopNodeParam, Node head) { - Node it = head; - - while (it != null) { - if (isNodeReachableFromLoopNode(it, loopNodeParam)) { - Node loopStart = it; - findEndNodeAndBreakCycle(loopStart); - break; - } - it = it.next; - } - } - - private static boolean isNodeReachableFromLoopNode(Node it, Node loopNodeParam) { - Node loopNode = loopNodeParam; - - do { - if (it == loopNode) { - return true; - } - loopNode = loopNode.next; - } while (loopNode.next != loopNodeParam); - - return false; - } - - private static void findEndNodeAndBreakCycle(Node loopStartParam) { - Node loopStart = loopStartParam; - - while (loopStart.next != loopStartParam) { - loopStart = loopStart.next; - } - - loopStart.next = null; - } -} +package com.baeldung.algorithms.linkedlist; + +public class CycleRemovalBruteForce { + + public static boolean detectAndRemoveCycle(Node head) { + CycleDetectionResult result = CycleDetectionByFastAndSlowIterators.detectCycle(head); + + if (result.cycleExists) { + removeCycle(result.node, head); + } + + return result.cycleExists; + } + + /** + * @param loopNodeParam - reference to the node where Flyods cycle + * finding algorithm ends, i.e. the fast and the slow iterators + * meet. + * @param head - reference to the head of the list + */ + private static void removeCycle(Node loopNodeParam, Node head) { + Node it = head; + + while (it != null) { + if (isNodeReachableFromLoopNode(it, loopNodeParam)) { + Node loopStart = it; + findEndNodeAndBreakCycle(loopStart); + break; + } + it = it.next; + } + } + + private static boolean isNodeReachableFromLoopNode(Node it, Node loopNodeParam) { + Node loopNode = loopNodeParam; + + do { + if (it == loopNode) { + return true; + } + loopNode = loopNode.next; + } while (loopNode.next != loopNodeParam); + + return false; + } + + private static void findEndNodeAndBreakCycle(Node loopStartParam) { + Node loopStart = loopStartParam; + + while (loopStart.next != loopStartParam) { + loopStart = loopStart.next; + } + + loopStart.next = null; + } +} diff --git a/algorithms/src/main/java/com/baeldung/algorithms/linkedlist/CycleRemovalByCountingLoopNodes.java b/algorithms-miscellaneous-2/src/main/java/com/baeldung/algorithms/linkedlist/CycleRemovalByCountingLoopNodes.java similarity index 96% rename from algorithms/src/main/java/com/baeldung/algorithms/linkedlist/CycleRemovalByCountingLoopNodes.java rename to algorithms-miscellaneous-2/src/main/java/com/baeldung/algorithms/linkedlist/CycleRemovalByCountingLoopNodes.java index d8db37fc4c..f961feb97d 100644 --- a/algorithms/src/main/java/com/baeldung/algorithms/linkedlist/CycleRemovalByCountingLoopNodes.java +++ b/algorithms-miscellaneous-2/src/main/java/com/baeldung/algorithms/linkedlist/CycleRemovalByCountingLoopNodes.java @@ -1,44 +1,44 @@ -package com.baeldung.algorithms.linkedlist; - -public class CycleRemovalByCountingLoopNodes { - - public static boolean detectAndRemoveCycle(Node head) { - CycleDetectionResult result = CycleDetectionByFastAndSlowIterators.detectCycle(head); - - if (result.cycleExists) { - removeCycle(result.node, head); - } - - return result.cycleExists; - } - - private static void removeCycle(Node loopNodeParam, Node head) { - int cycleLength = calculateCycleLength(loopNodeParam); - Node cycleLengthAdvancedIterator = head; - Node it = head; - - for (int i = 0; i < cycleLength; i++) { - cycleLengthAdvancedIterator = cycleLengthAdvancedIterator.next; - } - - while (it.next != cycleLengthAdvancedIterator.next) { - it = it.next; - cycleLengthAdvancedIterator = cycleLengthAdvancedIterator.next; - } - - cycleLengthAdvancedIterator.next = null; - } - - private static int calculateCycleLength(Node loopNodeParam) { - Node loopNode = loopNodeParam; - int length = 1; - - while (loopNode.next != loopNodeParam) { - length++; - loopNode = loopNode.next; - } - - return length; - } - -} +package com.baeldung.algorithms.linkedlist; + +public class CycleRemovalByCountingLoopNodes { + + public static boolean detectAndRemoveCycle(Node head) { + CycleDetectionResult result = CycleDetectionByFastAndSlowIterators.detectCycle(head); + + if (result.cycleExists) { + removeCycle(result.node, head); + } + + return result.cycleExists; + } + + private static void removeCycle(Node loopNodeParam, Node head) { + int cycleLength = calculateCycleLength(loopNodeParam); + Node cycleLengthAdvancedIterator = head; + Node it = head; + + for (int i = 0; i < cycleLength; i++) { + cycleLengthAdvancedIterator = cycleLengthAdvancedIterator.next; + } + + while (it.next != cycleLengthAdvancedIterator.next) { + it = it.next; + cycleLengthAdvancedIterator = cycleLengthAdvancedIterator.next; + } + + cycleLengthAdvancedIterator.next = null; + } + + private static int calculateCycleLength(Node loopNodeParam) { + Node loopNode = loopNodeParam; + int length = 1; + + while (loopNode.next != loopNodeParam) { + length++; + loopNode = loopNode.next; + } + + return length; + } + +} diff --git a/algorithms/src/main/java/com/baeldung/algorithms/linkedlist/CycleRemovalWithoutCountingLoopNodes.java b/algorithms-miscellaneous-2/src/main/java/com/baeldung/algorithms/linkedlist/CycleRemovalWithoutCountingLoopNodes.java similarity index 96% rename from algorithms/src/main/java/com/baeldung/algorithms/linkedlist/CycleRemovalWithoutCountingLoopNodes.java rename to algorithms-miscellaneous-2/src/main/java/com/baeldung/algorithms/linkedlist/CycleRemovalWithoutCountingLoopNodes.java index b979f7f677..1e41c832db 100644 --- a/algorithms/src/main/java/com/baeldung/algorithms/linkedlist/CycleRemovalWithoutCountingLoopNodes.java +++ b/algorithms-miscellaneous-2/src/main/java/com/baeldung/algorithms/linkedlist/CycleRemovalWithoutCountingLoopNodes.java @@ -1,27 +1,27 @@ -package com.baeldung.algorithms.linkedlist; - -public class CycleRemovalWithoutCountingLoopNodes { - - public static boolean detectAndRemoveCycle(Node head) { - CycleDetectionResult result = CycleDetectionByFastAndSlowIterators.detectCycle(head); - - if (result.cycleExists) { - removeCycle(result.node, head); - } - - return result.cycleExists; - } - - private static void removeCycle(Node meetingPointParam, Node head) { - Node loopNode = meetingPointParam; - Node it = head; - - while (loopNode.next != it.next) { - it = it.next; - loopNode = loopNode.next; - } - - loopNode.next = null; - } - -} +package com.baeldung.algorithms.linkedlist; + +public class CycleRemovalWithoutCountingLoopNodes { + + public static boolean detectAndRemoveCycle(Node head) { + CycleDetectionResult result = CycleDetectionByFastAndSlowIterators.detectCycle(head); + + if (result.cycleExists) { + removeCycle(result.node, head); + } + + return result.cycleExists; + } + + private static void removeCycle(Node meetingPointParam, Node head) { + Node loopNode = meetingPointParam; + Node it = head; + + while (loopNode.next != it.next) { + it = it.next; + loopNode = loopNode.next; + } + + loopNode.next = null; + } + +} diff --git a/algorithms/src/main/java/com/baeldung/algorithms/linkedlist/Node.java b/algorithms-miscellaneous-2/src/main/java/com/baeldung/algorithms/linkedlist/Node.java similarity index 95% rename from algorithms/src/main/java/com/baeldung/algorithms/linkedlist/Node.java rename to algorithms-miscellaneous-2/src/main/java/com/baeldung/algorithms/linkedlist/Node.java index 4add22c77d..9573bcd981 100644 --- a/algorithms/src/main/java/com/baeldung/algorithms/linkedlist/Node.java +++ b/algorithms-miscellaneous-2/src/main/java/com/baeldung/algorithms/linkedlist/Node.java @@ -1,38 +1,38 @@ -package com.baeldung.algorithms.linkedlist; - -public class Node { - T data; - Node next; - - public static Node createNewNode(T data, Node next) { - Node node = new Node(); - node.data = data; - node.next = next; - return node; - } - - public static void traverseList(Node root) { - if (root == null) { - return; - } - - Node node = root; - while (node != null) { - System.out.println(node.data); - node = node.next; - } - } - - public static Node getTail(Node root) { - if (root == null) { - return null; - } - - Node node = root; - while (node.next != null) { - node = node.next; - } - return node; - } - +package com.baeldung.algorithms.linkedlist; + +public class Node { + T data; + Node next; + + public static Node createNewNode(T data, Node next) { + Node node = new Node(); + node.data = data; + node.next = next; + return node; + } + + public static void traverseList(Node root) { + if (root == null) { + return; + } + + Node node = root; + while (node != null) { + System.out.println(node.data); + node = node.next; + } + } + + public static Node getTail(Node root) { + if (root == null) { + return null; + } + + Node node = root; + while (node.next != null) { + node = node.next; + } + return node; + } + } \ No newline at end of file diff --git a/algorithms/src/main/java/com/baeldung/algorithms/maze/solver/BFSMazeSolver.java b/algorithms-miscellaneous-2/src/main/java/com/baeldung/algorithms/maze/solver/BFSMazeSolver.java similarity index 96% rename from algorithms/src/main/java/com/baeldung/algorithms/maze/solver/BFSMazeSolver.java rename to algorithms-miscellaneous-2/src/main/java/com/baeldung/algorithms/maze/solver/BFSMazeSolver.java index 08972251b8..0e3101925c 100644 --- a/algorithms/src/main/java/com/baeldung/algorithms/maze/solver/BFSMazeSolver.java +++ b/algorithms-miscellaneous-2/src/main/java/com/baeldung/algorithms/maze/solver/BFSMazeSolver.java @@ -1,52 +1,52 @@ -package com.baeldung.algorithms.maze.solver; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.LinkedList; -import java.util.List; - -public class BFSMazeSolver { - private static final int[][] DIRECTIONS = { { 0, 1 }, { 1, 0 }, { 0, -1 }, { -1, 0 } }; - - public List solve(Maze maze) { - LinkedList nextToVisit = new LinkedList<>(); - Coordinate start = maze.getEntry(); - nextToVisit.add(start); - - while (!nextToVisit.isEmpty()) { - Coordinate cur = nextToVisit.remove(); - - if (!maze.isValidLocation(cur.getX(), cur.getY()) || maze.isExplored(cur.getX(), cur.getY())) { - continue; - } - - if (maze.isWall(cur.getX(), cur.getY())) { - maze.setVisited(cur.getX(), cur.getY(), true); - continue; - } - - if (maze.isExit(cur.getX(), cur.getY())) { - return backtrackPath(cur); - } - - for (int[] direction : DIRECTIONS) { - Coordinate coordinate = new Coordinate(cur.getX() + direction[0], cur.getY() + direction[1], cur); - nextToVisit.add(coordinate); - maze.setVisited(cur.getX(), cur.getY(), true); - } - } - return Collections.emptyList(); - } - - private List backtrackPath(Coordinate cur) { - List path = new ArrayList<>(); - Coordinate iter = cur; - - while (iter != null) { - path.add(iter); - iter = iter.parent; - } - - return path; - } -} +package com.baeldung.algorithms.maze.solver; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.LinkedList; +import java.util.List; + +public class BFSMazeSolver { + private static final int[][] DIRECTIONS = { { 0, 1 }, { 1, 0 }, { 0, -1 }, { -1, 0 } }; + + public List solve(Maze maze) { + LinkedList nextToVisit = new LinkedList<>(); + Coordinate start = maze.getEntry(); + nextToVisit.add(start); + + while (!nextToVisit.isEmpty()) { + Coordinate cur = nextToVisit.remove(); + + if (!maze.isValidLocation(cur.getX(), cur.getY()) || maze.isExplored(cur.getX(), cur.getY())) { + continue; + } + + if (maze.isWall(cur.getX(), cur.getY())) { + maze.setVisited(cur.getX(), cur.getY(), true); + continue; + } + + if (maze.isExit(cur.getX(), cur.getY())) { + return backtrackPath(cur); + } + + for (int[] direction : DIRECTIONS) { + Coordinate coordinate = new Coordinate(cur.getX() + direction[0], cur.getY() + direction[1], cur); + nextToVisit.add(coordinate); + maze.setVisited(cur.getX(), cur.getY(), true); + } + } + return Collections.emptyList(); + } + + private List backtrackPath(Coordinate cur) { + List path = new ArrayList<>(); + Coordinate iter = cur; + + while (iter != null) { + path.add(iter); + iter = iter.parent; + } + + return path; + } +} diff --git a/algorithms/src/main/java/com/baeldung/algorithms/maze/solver/Coordinate.java b/algorithms-miscellaneous-2/src/main/java/com/baeldung/algorithms/maze/solver/Coordinate.java similarity index 94% rename from algorithms/src/main/java/com/baeldung/algorithms/maze/solver/Coordinate.java rename to algorithms-miscellaneous-2/src/main/java/com/baeldung/algorithms/maze/solver/Coordinate.java index 09b2ced5e6..8202c89076 100644 --- a/algorithms/src/main/java/com/baeldung/algorithms/maze/solver/Coordinate.java +++ b/algorithms-miscellaneous-2/src/main/java/com/baeldung/algorithms/maze/solver/Coordinate.java @@ -1,31 +1,31 @@ -package com.baeldung.algorithms.maze.solver; - -public class Coordinate { - int x; - int y; - Coordinate parent; - - public Coordinate(int x, int y) { - this.x = x; - this.y = y; - this.parent = null; - } - - public Coordinate(int x, int y, Coordinate parent) { - this.x = x; - this.y = y; - this.parent = parent; - } - - int getX() { - return x; - } - - int getY() { - return y; - } - - Coordinate getParent() { - return parent; - } -} +package com.baeldung.algorithms.maze.solver; + +public class Coordinate { + int x; + int y; + Coordinate parent; + + public Coordinate(int x, int y) { + this.x = x; + this.y = y; + this.parent = null; + } + + public Coordinate(int x, int y, Coordinate parent) { + this.x = x; + this.y = y; + this.parent = parent; + } + + int getX() { + return x; + } + + int getY() { + return y; + } + + Coordinate getParent() { + return parent; + } +} diff --git a/algorithms/src/main/java/com/baeldung/algorithms/maze/solver/DFSMazeSolver.java b/algorithms-miscellaneous-2/src/main/java/com/baeldung/algorithms/maze/solver/DFSMazeSolver.java similarity index 96% rename from algorithms/src/main/java/com/baeldung/algorithms/maze/solver/DFSMazeSolver.java rename to algorithms-miscellaneous-2/src/main/java/com/baeldung/algorithms/maze/solver/DFSMazeSolver.java index f9640066b9..ee821631db 100644 --- a/algorithms/src/main/java/com/baeldung/algorithms/maze/solver/DFSMazeSolver.java +++ b/algorithms-miscellaneous-2/src/main/java/com/baeldung/algorithms/maze/solver/DFSMazeSolver.java @@ -1,48 +1,48 @@ -package com.baeldung.algorithms.maze.solver; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -public class DFSMazeSolver { - private static final int[][] DIRECTIONS = { { 0, 1 }, { 1, 0 }, { 0, -1 }, { -1, 0 } }; - - public List solve(Maze maze) { - List path = new ArrayList<>(); - if (explore(maze, maze.getEntry() - .getX(), - maze.getEntry() - .getY(), - path)) { - return path; - } - return Collections.emptyList(); - } - - private boolean explore(Maze maze, int row, int col, List path) { - if (!maze.isValidLocation(row, col) || maze.isWall(row, col) || maze.isExplored(row, col)) { - return false; - } - - path.add(new Coordinate(row, col)); - maze.setVisited(row, col, true); - - if (maze.isExit(row, col)) { - return true; - } - - for (int[] direction : DIRECTIONS) { - Coordinate coordinate = getNextCoordinate(row, col, direction[0], direction[1]); - if (explore(maze, coordinate.getX(), coordinate.getY(), path)) { - return true; - } - } - - path.remove(path.size() - 1); - return false; - } - - private Coordinate getNextCoordinate(int row, int col, int i, int j) { - return new Coordinate(row + i, col + j); - } -} +package com.baeldung.algorithms.maze.solver; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +public class DFSMazeSolver { + private static final int[][] DIRECTIONS = { { 0, 1 }, { 1, 0 }, { 0, -1 }, { -1, 0 } }; + + public List solve(Maze maze) { + List path = new ArrayList<>(); + if (explore(maze, maze.getEntry() + .getX(), + maze.getEntry() + .getY(), + path)) { + return path; + } + return Collections.emptyList(); + } + + private boolean explore(Maze maze, int row, int col, List path) { + if (!maze.isValidLocation(row, col) || maze.isWall(row, col) || maze.isExplored(row, col)) { + return false; + } + + path.add(new Coordinate(row, col)); + maze.setVisited(row, col, true); + + if (maze.isExit(row, col)) { + return true; + } + + for (int[] direction : DIRECTIONS) { + Coordinate coordinate = getNextCoordinate(row, col, direction[0], direction[1]); + if (explore(maze, coordinate.getX(), coordinate.getY(), path)) { + return true; + } + } + + path.remove(path.size() - 1); + return false; + } + + private Coordinate getNextCoordinate(int row, int col, int i, int j) { + return new Coordinate(row + i, col + j); + } +} diff --git a/algorithms/src/main/java/com/baeldung/algorithms/maze/solver/Maze.java b/algorithms-miscellaneous-2/src/main/java/com/baeldung/algorithms/maze/solver/Maze.java similarity index 96% rename from algorithms/src/main/java/com/baeldung/algorithms/maze/solver/Maze.java rename to algorithms-miscellaneous-2/src/main/java/com/baeldung/algorithms/maze/solver/Maze.java index 8aaa44d9b1..d0a0ed65d9 100644 --- a/algorithms/src/main/java/com/baeldung/algorithms/maze/solver/Maze.java +++ b/algorithms-miscellaneous-2/src/main/java/com/baeldung/algorithms/maze/solver/Maze.java @@ -1,141 +1,141 @@ -package com.baeldung.algorithms.maze.solver; - -import java.io.File; -import java.io.FileNotFoundException; -import java.util.Arrays; -import java.util.List; -import java.util.Scanner; - -public class Maze { - private static final int ROAD = 0; - private static final int WALL = 1; - private static final int START = 2; - private static final int EXIT = 3; - private static final int PATH = 4; - - private int[][] maze; - private boolean[][] visited; - private Coordinate start; - private Coordinate end; - - public Maze(File maze) throws FileNotFoundException { - String fileText = ""; - try (Scanner input = new Scanner(maze)) { - while (input.hasNextLine()) { - fileText += input.nextLine() + "\n"; - } - } - initializeMaze(fileText); - } - - private void initializeMaze(String text) { - if (text == null || (text = text.trim()).length() == 0) { - throw new IllegalArgumentException("empty lines data"); - } - - String[] lines = text.split("[\r]?\n"); - maze = new int[lines.length][lines[0].length()]; - visited = new boolean[lines.length][lines[0].length()]; - - for (int row = 0; row < getHeight(); row++) { - if (lines[row].length() != getWidth()) { - throw new IllegalArgumentException("line " + (row + 1) + " wrong length (was " + lines[row].length() + " but should be " + getWidth() + ")"); - } - - for (int col = 0; col < getWidth(); col++) { - if (lines[row].charAt(col) == '#') - maze[row][col] = WALL; - else if (lines[row].charAt(col) == 'S') { - maze[row][col] = START; - start = new Coordinate(row, col); - } else if (lines[row].charAt(col) == 'E') { - maze[row][col] = EXIT; - end = new Coordinate(row, col); - } else - maze[row][col] = ROAD; - } - } - } - - public int getHeight() { - return maze.length; - } - - public int getWidth() { - return maze[0].length; - } - - public Coordinate getEntry() { - return start; - } - - public Coordinate getExit() { - return end; - } - - public boolean isExit(int x, int y) { - return x == end.getX() && y == end.getY(); - } - - public boolean isStart(int x, int y) { - return x == start.getX() && y == start.getY(); - } - - public boolean isExplored(int row, int col) { - return visited[row][col]; - } - - public boolean isWall(int row, int col) { - return maze[row][col] == WALL; - } - - public void setVisited(int row, int col, boolean value) { - visited[row][col] = value; - } - - public boolean isValidLocation(int row, int col) { - if (row < 0 || row >= getHeight() || col < 0 || col >= getWidth()) { - return false; - } - return true; - } - - public void printPath(List path) { - int[][] tempMaze = Arrays.stream(maze) - .map(int[]::clone) - .toArray(int[][]::new); - for (Coordinate coordinate : path) { - if (isStart(coordinate.getX(), coordinate.getY()) || isExit(coordinate.getX(), coordinate.getY())) { - continue; - } - tempMaze[coordinate.getX()][coordinate.getY()] = PATH; - } - System.out.println(toString(tempMaze)); - } - - public String toString(int[][] maze) { - StringBuilder result = new StringBuilder(getWidth() * (getHeight() + 1)); - for (int row = 0; row < getHeight(); row++) { - for (int col = 0; col < getWidth(); col++) { - if (maze[row][col] == ROAD) { - result.append(' '); - } else if (maze[row][col] == WALL) { - result.append('#'); - } else if (maze[row][col] == START) { - result.append('S'); - } else if (maze[row][col] == EXIT) { - result.append('E'); - } else { - result.append('.'); - } - } - result.append('\n'); - } - return result.toString(); - } - - public void reset() { - for (int i = 0; i < visited.length; i++) - Arrays.fill(visited[i], false); - } -} +package com.baeldung.algorithms.maze.solver; + +import java.io.File; +import java.io.FileNotFoundException; +import java.util.Arrays; +import java.util.List; +import java.util.Scanner; + +public class Maze { + private static final int ROAD = 0; + private static final int WALL = 1; + private static final int START = 2; + private static final int EXIT = 3; + private static final int PATH = 4; + + private int[][] maze; + private boolean[][] visited; + private Coordinate start; + private Coordinate end; + + public Maze(File maze) throws FileNotFoundException { + String fileText = ""; + try (Scanner input = new Scanner(maze)) { + while (input.hasNextLine()) { + fileText += input.nextLine() + "\n"; + } + } + initializeMaze(fileText); + } + + private void initializeMaze(String text) { + if (text == null || (text = text.trim()).length() == 0) { + throw new IllegalArgumentException("empty lines data"); + } + + String[] lines = text.split("[\r]?\n"); + maze = new int[lines.length][lines[0].length()]; + visited = new boolean[lines.length][lines[0].length()]; + + for (int row = 0; row < getHeight(); row++) { + if (lines[row].length() != getWidth()) { + throw new IllegalArgumentException("line " + (row + 1) + " wrong length (was " + lines[row].length() + " but should be " + getWidth() + ")"); + } + + for (int col = 0; col < getWidth(); col++) { + if (lines[row].charAt(col) == '#') + maze[row][col] = WALL; + else if (lines[row].charAt(col) == 'S') { + maze[row][col] = START; + start = new Coordinate(row, col); + } else if (lines[row].charAt(col) == 'E') { + maze[row][col] = EXIT; + end = new Coordinate(row, col); + } else + maze[row][col] = ROAD; + } + } + } + + public int getHeight() { + return maze.length; + } + + public int getWidth() { + return maze[0].length; + } + + public Coordinate getEntry() { + return start; + } + + public Coordinate getExit() { + return end; + } + + public boolean isExit(int x, int y) { + return x == end.getX() && y == end.getY(); + } + + public boolean isStart(int x, int y) { + return x == start.getX() && y == start.getY(); + } + + public boolean isExplored(int row, int col) { + return visited[row][col]; + } + + public boolean isWall(int row, int col) { + return maze[row][col] == WALL; + } + + public void setVisited(int row, int col, boolean value) { + visited[row][col] = value; + } + + public boolean isValidLocation(int row, int col) { + if (row < 0 || row >= getHeight() || col < 0 || col >= getWidth()) { + return false; + } + return true; + } + + public void printPath(List path) { + int[][] tempMaze = Arrays.stream(maze) + .map(int[]::clone) + .toArray(int[][]::new); + for (Coordinate coordinate : path) { + if (isStart(coordinate.getX(), coordinate.getY()) || isExit(coordinate.getX(), coordinate.getY())) { + continue; + } + tempMaze[coordinate.getX()][coordinate.getY()] = PATH; + } + System.out.println(toString(tempMaze)); + } + + public String toString(int[][] maze) { + StringBuilder result = new StringBuilder(getWidth() * (getHeight() + 1)); + for (int row = 0; row < getHeight(); row++) { + for (int col = 0; col < getWidth(); col++) { + if (maze[row][col] == ROAD) { + result.append(' '); + } else if (maze[row][col] == WALL) { + result.append('#'); + } else if (maze[row][col] == START) { + result.append('S'); + } else if (maze[row][col] == EXIT) { + result.append('E'); + } else { + result.append('.'); + } + } + result.append('\n'); + } + return result.toString(); + } + + public void reset() { + for (int i = 0; i < visited.length; i++) + Arrays.fill(visited[i], false); + } +} diff --git a/algorithms/src/main/java/com/baeldung/algorithms/maze/solver/MazeDriver.java b/algorithms-miscellaneous-2/src/main/java/com/baeldung/algorithms/maze/solver/MazeDriver.java similarity index 96% rename from algorithms/src/main/java/com/baeldung/algorithms/maze/solver/MazeDriver.java rename to algorithms-miscellaneous-2/src/main/java/com/baeldung/algorithms/maze/solver/MazeDriver.java index 60263deba3..a47c3c8581 100644 --- a/algorithms/src/main/java/com/baeldung/algorithms/maze/solver/MazeDriver.java +++ b/algorithms-miscellaneous-2/src/main/java/com/baeldung/algorithms/maze/solver/MazeDriver.java @@ -1,34 +1,34 @@ -package com.baeldung.algorithms.maze.solver; - -import java.io.File; -import java.util.List; - -public class MazeDriver { - public static void main(String[] args) throws Exception { - File maze1 = new File("src/main/resources/maze/maze1.txt"); - File maze2 = new File("src/main/resources/maze/maze2.txt"); - - execute(maze1); - execute(maze2); - } - - private static void execute(File file) throws Exception { - Maze maze = new Maze(file); - dfs(maze); - bfs(maze); - } - - private static void bfs(Maze maze) { - BFSMazeSolver bfs = new BFSMazeSolver(); - List path = bfs.solve(maze); - maze.printPath(path); - maze.reset(); - } - - private static void dfs(Maze maze) { - DFSMazeSolver dfs = new DFSMazeSolver(); - List path = dfs.solve(maze); - maze.printPath(path); - maze.reset(); - } -} +package com.baeldung.algorithms.maze.solver; + +import java.io.File; +import java.util.List; + +public class MazeDriver { + public static void main(String[] args) throws Exception { + File maze1 = new File("src/main/resources/maze/maze1.txt"); + File maze2 = new File("src/main/resources/maze/maze2.txt"); + + execute(maze1); + execute(maze2); + } + + private static void execute(File file) throws Exception { + Maze maze = new Maze(file); + dfs(maze); + bfs(maze); + } + + private static void bfs(Maze maze) { + BFSMazeSolver bfs = new BFSMazeSolver(); + List path = bfs.solve(maze); + maze.printPath(path); + maze.reset(); + } + + private static void dfs(Maze maze) { + DFSMazeSolver dfs = new DFSMazeSolver(); + List path = dfs.solve(maze); + maze.printPath(path); + maze.reset(); + } +} diff --git a/algorithms-miscellaneous-2/src/main/java/com/baeldung/algorithms/mercator/EllipticalMercator.java b/algorithms-miscellaneous-2/src/main/java/com/baeldung/algorithms/mercator/EllipticalMercator.java new file mode 100644 index 0000000000..e1c41f9518 --- /dev/null +++ b/algorithms-miscellaneous-2/src/main/java/com/baeldung/algorithms/mercator/EllipticalMercator.java @@ -0,0 +1,22 @@ +package com.baeldung.algorithms.mercator; + +class EllipticalMercator extends Mercator { + + @Override + double yAxisProjection(double input) { + + input = Math.min(Math.max(input, -89.5), 89.5); + double earthDimensionalRateNormalized = 1.0 - Math.pow(RADIUS_MINOR / RADIUS_MAJOR, 2); + + double inputOnEarthProj = Math.sqrt(earthDimensionalRateNormalized) * Math.sin( Math.toRadians(input)); + + inputOnEarthProj = Math.pow(((1.0 - inputOnEarthProj)/(1.0+inputOnEarthProj)), 0.5 * Math.sqrt(earthDimensionalRateNormalized)); + double inputOnEarthProjNormalized = Math.tan(0.5 * ((Math.PI*0.5) - Math.toRadians(input)))/inputOnEarthProj; + return (-1) * RADIUS_MAJOR * Math.log(inputOnEarthProjNormalized); + } + + @Override + double xAxisProjection(double input) { + return RADIUS_MAJOR * Math.toRadians(input); + } +} diff --git a/algorithms-miscellaneous-2/src/main/java/com/baeldung/algorithms/mercator/Mercator.java b/algorithms-miscellaneous-2/src/main/java/com/baeldung/algorithms/mercator/Mercator.java new file mode 100644 index 0000000000..b289b1839d --- /dev/null +++ b/algorithms-miscellaneous-2/src/main/java/com/baeldung/algorithms/mercator/Mercator.java @@ -0,0 +1,10 @@ +package com.baeldung.algorithms.mercator; + +abstract class Mercator { + final static double RADIUS_MAJOR = 6378137.0; + final static double RADIUS_MINOR = 6356752.3142; + + abstract double yAxisProjection(double input); + + abstract double xAxisProjection(double input); +} diff --git a/algorithms-miscellaneous-2/src/main/java/com/baeldung/algorithms/mercator/SphericalMercator.java b/algorithms-miscellaneous-2/src/main/java/com/baeldung/algorithms/mercator/SphericalMercator.java new file mode 100644 index 0000000000..1be976d82e --- /dev/null +++ b/algorithms-miscellaneous-2/src/main/java/com/baeldung/algorithms/mercator/SphericalMercator.java @@ -0,0 +1,14 @@ +package com.baeldung.algorithms.mercator; + +public class SphericalMercator extends Mercator { + + @Override + double xAxisProjection(double input) { + return Math.toRadians(input) * RADIUS_MAJOR; + } + + @Override + double yAxisProjection(double input) { + return Math.log(Math.tan(Math.PI / 4 + Math.toRadians(input) / 2)) * RADIUS_MAJOR; + } +} diff --git a/algorithms/src/main/java/com/baeldung/algorithms/numberwordconverter/NumberWordConverter.java b/algorithms-miscellaneous-2/src/main/java/com/baeldung/algorithms/numberwordconverter/NumberWordConverter.java similarity index 100% rename from algorithms/src/main/java/com/baeldung/algorithms/numberwordconverter/NumberWordConverter.java rename to algorithms-miscellaneous-2/src/main/java/com/baeldung/algorithms/numberwordconverter/NumberWordConverter.java diff --git a/algorithms/src/main/java/com/baeldung/algorithms/rectanglesoverlap/Point.java b/algorithms-miscellaneous-2/src/main/java/com/baeldung/algorithms/rectanglesoverlap/Point.java similarity index 100% rename from algorithms/src/main/java/com/baeldung/algorithms/rectanglesoverlap/Point.java rename to algorithms-miscellaneous-2/src/main/java/com/baeldung/algorithms/rectanglesoverlap/Point.java diff --git a/algorithms/src/main/java/com/baeldung/algorithms/rectanglesoverlap/Rectangle.java b/algorithms-miscellaneous-2/src/main/java/com/baeldung/algorithms/rectanglesoverlap/Rectangle.java similarity index 100% rename from algorithms/src/main/java/com/baeldung/algorithms/rectanglesoverlap/Rectangle.java rename to algorithms-miscellaneous-2/src/main/java/com/baeldung/algorithms/rectanglesoverlap/Rectangle.java diff --git a/algorithms/src/main/java/com/baeldung/algorithms/romannumerals/RomanArabicConverter.java b/algorithms-miscellaneous-2/src/main/java/com/baeldung/algorithms/romannumerals/RomanArabicConverter.java similarity index 96% rename from algorithms/src/main/java/com/baeldung/algorithms/romannumerals/RomanArabicConverter.java rename to algorithms-miscellaneous-2/src/main/java/com/baeldung/algorithms/romannumerals/RomanArabicConverter.java index ab0922ecf4..acd275e609 100644 --- a/algorithms/src/main/java/com/baeldung/algorithms/romannumerals/RomanArabicConverter.java +++ b/algorithms-miscellaneous-2/src/main/java/com/baeldung/algorithms/romannumerals/RomanArabicConverter.java @@ -1,52 +1,52 @@ -package com.baeldung.algorithms.romannumerals; - -import java.util.List; - -class RomanArabicConverter { - - public static int romanToArabic(String input) { - String romanNumeral = input.toUpperCase(); - int result = 0; - - List romanNumerals = RomanNumeral.getReverseSortedValues(); - - int i = 0; - - while ((romanNumeral.length() > 0) && (i < romanNumerals.size())) { - RomanNumeral symbol = romanNumerals.get(i); - if (romanNumeral.startsWith(symbol.name())) { - result += symbol.getValue(); - romanNumeral = romanNumeral.substring(symbol.name().length()); - } else { - i++; - } - } - if (romanNumeral.length() > 0) { - throw new IllegalArgumentException(input + " cannot be converted to a Roman Numeral"); - } - - return result; - } - - public static String arabicToRoman(int number) { - if ((number <= 0) || (number > 4000)) { - throw new IllegalArgumentException(number + " is not in range (0,4000]"); - } - - List romanNumerals = RomanNumeral.getReverseSortedValues(); - - int i = 0; - StringBuilder sb = new StringBuilder(); - - while (number > 0 && i < romanNumerals.size()) { - RomanNumeral currentSymbol = romanNumerals.get(i); - if (currentSymbol.getValue() <= number) { - sb.append(currentSymbol.name()); - number -= currentSymbol.getValue(); - } else { - i++; - } - } - return sb.toString(); - } -} +package com.baeldung.algorithms.romannumerals; + +import java.util.List; + +class RomanArabicConverter { + + public static int romanToArabic(String input) { + String romanNumeral = input.toUpperCase(); + int result = 0; + + List romanNumerals = RomanNumeral.getReverseSortedValues(); + + int i = 0; + + while ((romanNumeral.length() > 0) && (i < romanNumerals.size())) { + RomanNumeral symbol = romanNumerals.get(i); + if (romanNumeral.startsWith(symbol.name())) { + result += symbol.getValue(); + romanNumeral = romanNumeral.substring(symbol.name().length()); + } else { + i++; + } + } + if (romanNumeral.length() > 0) { + throw new IllegalArgumentException(input + " cannot be converted to a Roman Numeral"); + } + + return result; + } + + public static String arabicToRoman(int number) { + if ((number <= 0) || (number > 4000)) { + throw new IllegalArgumentException(number + " is not in range (0,4000]"); + } + + List romanNumerals = RomanNumeral.getReverseSortedValues(); + + int i = 0; + StringBuilder sb = new StringBuilder(); + + while (number > 0 && i < romanNumerals.size()) { + RomanNumeral currentSymbol = romanNumerals.get(i); + if (currentSymbol.getValue() <= number) { + sb.append(currentSymbol.name()); + number -= currentSymbol.getValue(); + } else { + i++; + } + } + return sb.toString(); + } +} diff --git a/algorithms/src/main/java/com/baeldung/algorithms/romannumerals/RomanNumeral.java b/algorithms-miscellaneous-2/src/main/java/com/baeldung/algorithms/romannumerals/RomanNumeral.java similarity index 96% rename from algorithms/src/main/java/com/baeldung/algorithms/romannumerals/RomanNumeral.java rename to algorithms-miscellaneous-2/src/main/java/com/baeldung/algorithms/romannumerals/RomanNumeral.java index 219f0b5090..2ee5bb6d75 100644 --- a/algorithms/src/main/java/com/baeldung/algorithms/romannumerals/RomanNumeral.java +++ b/algorithms-miscellaneous-2/src/main/java/com/baeldung/algorithms/romannumerals/RomanNumeral.java @@ -1,26 +1,26 @@ -package com.baeldung.algorithms.romannumerals; - -import java.util.Arrays; -import java.util.Comparator; -import java.util.List; -import java.util.stream.Collectors; - -enum RomanNumeral { - I(1), IV(4), V(5), IX(9), X(10), XL(40), L(50), XC(90), C(100), CD(400), D(500), CM(900), M(1000); - - private int value; - - RomanNumeral(int value) { - this.value = value; - } - - public int getValue() { - return value; - } - - public static List getReverseSortedValues() { - return Arrays.stream(values()) - .sorted(Comparator.comparing((RomanNumeral e) -> e.value).reversed()) - .collect(Collectors.toList()); - } -} +package com.baeldung.algorithms.romannumerals; + +import java.util.Arrays; +import java.util.Comparator; +import java.util.List; +import java.util.stream.Collectors; + +enum RomanNumeral { + I(1), IV(4), V(5), IX(9), X(10), XL(40), L(50), XC(90), C(100), CD(400), D(500), CM(900), M(1000); + + private int value; + + RomanNumeral(int value) { + this.value = value; + } + + public int getValue() { + return value; + } + + public static List getReverseSortedValues() { + return Arrays.stream(values()) + .sorted(Comparator.comparing((RomanNumeral e) -> e.value).reversed()) + .collect(Collectors.toList()); + } +} diff --git a/algorithms/roundUpToHundred/src/com/java/src/RoundUpToHundred.java b/algorithms-miscellaneous-2/src/main/java/com/baeldung/algorithms/roundedup/RoundUpToHundred.java similarity index 90% rename from algorithms/roundUpToHundred/src/com/java/src/RoundUpToHundred.java rename to algorithms-miscellaneous-2/src/main/java/com/baeldung/algorithms/roundedup/RoundUpToHundred.java index f5024c227d..333019e294 100644 --- a/algorithms/roundUpToHundred/src/com/java/src/RoundUpToHundred.java +++ b/algorithms-miscellaneous-2/src/main/java/com/baeldung/algorithms/roundedup/RoundUpToHundred.java @@ -1,20 +1,20 @@ -package com.java.src; - -import java.util.Scanner; - -public class RoundUpToHundred { - - public static void main(String[] args) { - Scanner scanner = new Scanner(System.in); - double input = scanner.nextDouble(); - scanner.close(); - - RoundUpToHundred.round(input); - } - - static long round(double input) { - long i = (long) Math.ceil(input); - return ((i + 99) / 100) * 100; - }; - -} +package com.baeldung.algorithms.roundedup; + +import java.util.Scanner; + +public class RoundUpToHundred { + + public static void main(String[] args) { + Scanner scanner = new Scanner(System.in); + double input = scanner.nextDouble(); + scanner.close(); + + RoundUpToHundred.round(input); + } + + static long round(double input) { + long i = (long) Math.ceil(input); + return ((i + 99) / 100) * 100; + }; + +} diff --git a/algorithms/src/main/java/com/baeldung/algorithms/slope_one/InputData.java b/algorithms-miscellaneous-2/src/main/java/com/baeldung/algorithms/slope_one/InputData.java similarity index 100% rename from algorithms/src/main/java/com/baeldung/algorithms/slope_one/InputData.java rename to algorithms-miscellaneous-2/src/main/java/com/baeldung/algorithms/slope_one/InputData.java diff --git a/algorithms/src/main/java/com/baeldung/algorithms/slope_one/Item.java b/algorithms-miscellaneous-2/src/main/java/com/baeldung/algorithms/slope_one/Item.java similarity index 100% rename from algorithms/src/main/java/com/baeldung/algorithms/slope_one/Item.java rename to algorithms-miscellaneous-2/src/main/java/com/baeldung/algorithms/slope_one/Item.java diff --git a/algorithms/src/main/java/com/baeldung/algorithms/slope_one/SlopeOne.java b/algorithms-miscellaneous-2/src/main/java/com/baeldung/algorithms/slope_one/SlopeOne.java similarity index 100% rename from algorithms/src/main/java/com/baeldung/algorithms/slope_one/SlopeOne.java rename to algorithms-miscellaneous-2/src/main/java/com/baeldung/algorithms/slope_one/SlopeOne.java diff --git a/algorithms/src/main/java/com/baeldung/algorithms/slope_one/User.java b/algorithms-miscellaneous-2/src/main/java/com/baeldung/algorithms/slope_one/User.java similarity index 100% rename from algorithms/src/main/java/com/baeldung/algorithms/slope_one/User.java rename to algorithms-miscellaneous-2/src/main/java/com/baeldung/algorithms/slope_one/User.java diff --git a/algorithms/src/main/java/com/baeldung/algorithms/sudoku/BacktrackingAlgorithm.java b/algorithms-miscellaneous-2/src/main/java/com/baeldung/algorithms/sudoku/BacktrackingAlgorithm.java similarity index 100% rename from algorithms/src/main/java/com/baeldung/algorithms/sudoku/BacktrackingAlgorithm.java rename to algorithms-miscellaneous-2/src/main/java/com/baeldung/algorithms/sudoku/BacktrackingAlgorithm.java diff --git a/algorithms/src/main/java/com/baeldung/algorithms/sudoku/ColumnNode.java b/algorithms-miscellaneous-2/src/main/java/com/baeldung/algorithms/sudoku/ColumnNode.java similarity index 100% rename from algorithms/src/main/java/com/baeldung/algorithms/sudoku/ColumnNode.java rename to algorithms-miscellaneous-2/src/main/java/com/baeldung/algorithms/sudoku/ColumnNode.java diff --git a/algorithms/src/main/java/com/baeldung/algorithms/sudoku/DancingLinks.java b/algorithms-miscellaneous-2/src/main/java/com/baeldung/algorithms/sudoku/DancingLinks.java similarity index 100% rename from algorithms/src/main/java/com/baeldung/algorithms/sudoku/DancingLinks.java rename to algorithms-miscellaneous-2/src/main/java/com/baeldung/algorithms/sudoku/DancingLinks.java diff --git a/algorithms/src/main/java/com/baeldung/algorithms/sudoku/DancingLinksAlgorithm.java b/algorithms-miscellaneous-2/src/main/java/com/baeldung/algorithms/sudoku/DancingLinksAlgorithm.java similarity index 100% rename from algorithms/src/main/java/com/baeldung/algorithms/sudoku/DancingLinksAlgorithm.java rename to algorithms-miscellaneous-2/src/main/java/com/baeldung/algorithms/sudoku/DancingLinksAlgorithm.java diff --git a/algorithms/src/main/java/com/baeldung/algorithms/sudoku/DancingNode.java b/algorithms-miscellaneous-2/src/main/java/com/baeldung/algorithms/sudoku/DancingNode.java similarity index 100% rename from algorithms/src/main/java/com/baeldung/algorithms/sudoku/DancingNode.java rename to algorithms-miscellaneous-2/src/main/java/com/baeldung/algorithms/sudoku/DancingNode.java diff --git a/apache-cayenne/src/main/resources/logback.xml b/algorithms-miscellaneous-2/src/main/resources/logback.xml similarity index 100% rename from apache-cayenne/src/main/resources/logback.xml rename to algorithms-miscellaneous-2/src/main/resources/logback.xml diff --git a/algorithms/src/main/resources/maze/maze1.txt b/algorithms-miscellaneous-2/src/main/resources/maze/maze1.txt similarity index 85% rename from algorithms/src/main/resources/maze/maze1.txt rename to algorithms-miscellaneous-2/src/main/resources/maze/maze1.txt index 0a6309d25b..8b48c325d2 100644 --- a/algorithms/src/main/resources/maze/maze1.txt +++ b/algorithms-miscellaneous-2/src/main/resources/maze/maze1.txt @@ -1,12 +1,12 @@ -S ######## -# # -# ### ## # -# # # # -# # # # # -# ## ##### -# # # -# # # # # -##### #### -# # E -# # # # +S ######## +# # +# ### ## # +# # # # +# # # # # +# ## ##### +# # # +# # # # # +##### #### +# # E +# # # # ########## \ No newline at end of file diff --git a/algorithms/src/main/resources/maze/maze2.txt b/algorithms-miscellaneous-2/src/main/resources/maze/maze2.txt similarity index 92% rename from algorithms/src/main/resources/maze/maze2.txt rename to algorithms-miscellaneous-2/src/main/resources/maze/maze2.txt index 22e6d0382a..df5b6bc66b 100644 --- a/algorithms/src/main/resources/maze/maze2.txt +++ b/algorithms-miscellaneous-2/src/main/resources/maze/maze2.txt @@ -1,22 +1,22 @@ -S ########################## -# # # # -# # #### ############### # -# # # # # # -# # #### # # ############### -# # # # # # # -# # # #### ### ########### # -# # # # # # -# ################## # -######### # # # # # -# # #### # ####### # # -# # ### ### # # # # # -# # ## # ##### # # -##### ####### # # # # # -# # ## ## #### # # -# ##### ####### # # -# # ############ -####### ######### # # -# # ######## # -# ####### ###### ## # E -# # # ## # +S ########################## +# # # # +# # #### ############### # +# # # # # # +# # #### # # ############### +# # # # # # # +# # # #### ### ########### # +# # # # # # +# ################## # +######### # # # # # +# # #### # ####### # # +# # ### ### # # # # # +# # ## # ##### # # +##### ####### # # # # # +# # ## ## #### # # +# ##### ####### # # +# # ############ +####### ######### # # +# # ######## # +# ####### ###### ## # E +# # # ## # ############################ \ No newline at end of file diff --git a/algorithms/src/test/java/com/baeldung/algorithms/DijkstraAlgorithmLongRunningUnitTest.java b/algorithms-miscellaneous-2/src/test/java/com/baeldung/algorithms/DijkstraAlgorithmLongRunningUnitTest.java similarity index 100% rename from algorithms/src/test/java/com/baeldung/algorithms/DijkstraAlgorithmLongRunningUnitTest.java rename to algorithms-miscellaneous-2/src/test/java/com/baeldung/algorithms/DijkstraAlgorithmLongRunningUnitTest.java diff --git a/algorithms/src/test/java/com/baeldung/algorithms/analysis/AnalysisRunnerLiveTest.java b/algorithms-miscellaneous-2/src/test/java/com/baeldung/algorithms/analysis/AnalysisRunnerLiveTest.java similarity index 100% rename from algorithms/src/test/java/com/baeldung/algorithms/analysis/AnalysisRunnerLiveTest.java rename to algorithms-miscellaneous-2/src/test/java/com/baeldung/algorithms/analysis/AnalysisRunnerLiveTest.java diff --git a/algorithms/src/test/java/com/baeldung/algorithms/conversion/ByteArrayConverterUnitTest.java b/algorithms-miscellaneous-2/src/test/java/com/baeldung/algorithms/conversion/ByteArrayConverterUnitTest.java similarity index 100% rename from algorithms/src/test/java/com/baeldung/algorithms/conversion/ByteArrayConverterUnitTest.java rename to algorithms-miscellaneous-2/src/test/java/com/baeldung/algorithms/conversion/ByteArrayConverterUnitTest.java diff --git a/algorithms/src/test/java/com/baeldung/algorithms/distancebetweenpoints/DistanceBetweenPointsServiceUnitTest.java b/algorithms-miscellaneous-2/src/test/java/com/baeldung/algorithms/distancebetweenpoints/DistanceBetweenPointsServiceUnitTest.java similarity index 100% rename from algorithms/src/test/java/com/baeldung/algorithms/distancebetweenpoints/DistanceBetweenPointsServiceUnitTest.java rename to algorithms-miscellaneous-2/src/test/java/com/baeldung/algorithms/distancebetweenpoints/DistanceBetweenPointsServiceUnitTest.java diff --git a/algorithms/src/test/java/com/baeldung/algorithms/editdistance/EditDistanceDataProvider.java b/algorithms-miscellaneous-2/src/test/java/com/baeldung/algorithms/editdistance/EditDistanceDataProvider.java similarity index 96% rename from algorithms/src/test/java/com/baeldung/algorithms/editdistance/EditDistanceDataProvider.java rename to algorithms-miscellaneous-2/src/test/java/com/baeldung/algorithms/editdistance/EditDistanceDataProvider.java index 89bd871616..d11da61191 100644 --- a/algorithms/src/test/java/com/baeldung/algorithms/editdistance/EditDistanceDataProvider.java +++ b/algorithms-miscellaneous-2/src/test/java/com/baeldung/algorithms/editdistance/EditDistanceDataProvider.java @@ -1,21 +1,21 @@ -package com.baeldung.algorithms.editdistance; - -import org.junit.runners.Parameterized.Parameters; - -import java.util.Arrays; -import java.util.Collection; - -public class EditDistanceDataProvider { - - @Parameters - public static Collection getLists() { - return Arrays.asList(new Object[][] { - { "", "", 0 }, - { "ago", "", 3 }, - { "", "do", 2 }, - { "abc", "adc", 1 }, - { "peek", "pesek", 1 }, - { "sunday", "saturday", 3 } - }); - } -} +package com.baeldung.algorithms.editdistance; + +import org.junit.runners.Parameterized.Parameters; + +import java.util.Arrays; +import java.util.Collection; + +public class EditDistanceDataProvider { + + @Parameters + public static Collection getLists() { + return Arrays.asList(new Object[][] { + { "", "", 0 }, + { "ago", "", 3 }, + { "", "do", 2 }, + { "abc", "adc", 1 }, + { "peek", "pesek", 1 }, + { "sunday", "saturday", 3 } + }); + } +} diff --git a/algorithms/src/test/java/com/baeldung/algorithms/editdistance/EditDistanceUnitTest.java b/algorithms-miscellaneous-2/src/test/java/com/baeldung/algorithms/editdistance/EditDistanceUnitTest.java similarity index 96% rename from algorithms/src/test/java/com/baeldung/algorithms/editdistance/EditDistanceUnitTest.java rename to algorithms-miscellaneous-2/src/test/java/com/baeldung/algorithms/editdistance/EditDistanceUnitTest.java index 0df4715b80..3dd63e86ab 100644 --- a/algorithms/src/test/java/com/baeldung/algorithms/editdistance/EditDistanceUnitTest.java +++ b/algorithms-miscellaneous-2/src/test/java/com/baeldung/algorithms/editdistance/EditDistanceUnitTest.java @@ -1,32 +1,32 @@ -package com.baeldung.algorithms.editdistance; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.junit.runners.Parameterized; - -import static org.junit.Assert.assertEquals; - -@RunWith(Parameterized.class) -public class EditDistanceUnitTest extends EditDistanceDataProvider { - - private String x; - private String y; - private int result; - - public EditDistanceUnitTest(String a, String b, int res) { - super(); - x = a; - y = b; - result = res; - } - - @Test - public void testEditDistance_RecursiveImplementation() { - assertEquals(result, EditDistanceRecursive.calculate(x, y)); - } - - @Test - public void testEditDistance_givenDynamicProgrammingImplementation() { - assertEquals(result, EditDistanceDynamicProgramming.calculate(x, y)); - } -} +package com.baeldung.algorithms.editdistance; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.Parameterized; + +import static org.junit.Assert.assertEquals; + +@RunWith(Parameterized.class) +public class EditDistanceUnitTest extends EditDistanceDataProvider { + + private String x; + private String y; + private int result; + + public EditDistanceUnitTest(String a, String b, int res) { + super(); + x = a; + y = b; + result = res; + } + + @Test + public void testEditDistance_RecursiveImplementation() { + assertEquals(result, EditDistanceRecursive.calculate(x, y)); + } + + @Test + public void testEditDistance_givenDynamicProgrammingImplementation() { + assertEquals(result, EditDistanceDynamicProgramming.calculate(x, y)); + } +} diff --git a/algorithms/src/test/java/com/baeldung/algorithms/linkedlist/CycleDetectionBruteForceUnitTest.java b/algorithms-miscellaneous-2/src/test/java/com/baeldung/algorithms/linkedlist/CycleDetectionBruteForceUnitTest.java similarity index 96% rename from algorithms/src/test/java/com/baeldung/algorithms/linkedlist/CycleDetectionBruteForceUnitTest.java rename to algorithms-miscellaneous-2/src/test/java/com/baeldung/algorithms/linkedlist/CycleDetectionBruteForceUnitTest.java index af2430ec55..33889fbec6 100644 --- a/algorithms/src/test/java/com/baeldung/algorithms/linkedlist/CycleDetectionBruteForceUnitTest.java +++ b/algorithms-miscellaneous-2/src/test/java/com/baeldung/algorithms/linkedlist/CycleDetectionBruteForceUnitTest.java @@ -1,23 +1,23 @@ -package com.baeldung.algorithms.linkedlist; - -import org.junit.Assert; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.junit.runners.Parameterized; - -@RunWith(value = Parameterized.class) -public class CycleDetectionBruteForceUnitTest extends CycleDetectionTestBase { - boolean cycleExists; - Node head; - - public CycleDetectionBruteForceUnitTest(Node head, boolean cycleExists) { - super(); - this.cycleExists = cycleExists; - this.head = head; - } - - @Test - public void givenList_detectLoop() { - Assert.assertEquals(cycleExists, CycleDetectionBruteForce.detectCycle(head).cycleExists); - } -} +package com.baeldung.algorithms.linkedlist; + +import org.junit.Assert; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.Parameterized; + +@RunWith(value = Parameterized.class) +public class CycleDetectionBruteForceUnitTest extends CycleDetectionTestBase { + boolean cycleExists; + Node head; + + public CycleDetectionBruteForceUnitTest(Node head, boolean cycleExists) { + super(); + this.cycleExists = cycleExists; + this.head = head; + } + + @Test + public void givenList_detectLoop() { + Assert.assertEquals(cycleExists, CycleDetectionBruteForce.detectCycle(head).cycleExists); + } +} diff --git a/algorithms/src/test/java/com/baeldung/algorithms/linkedlist/CycleDetectionByFastAndSlowIteratorsUnitTest.java b/algorithms-miscellaneous-2/src/test/java/com/baeldung/algorithms/linkedlist/CycleDetectionByFastAndSlowIteratorsUnitTest.java similarity index 96% rename from algorithms/src/test/java/com/baeldung/algorithms/linkedlist/CycleDetectionByFastAndSlowIteratorsUnitTest.java rename to algorithms-miscellaneous-2/src/test/java/com/baeldung/algorithms/linkedlist/CycleDetectionByFastAndSlowIteratorsUnitTest.java index ce31c84067..1496840771 100644 --- a/algorithms/src/test/java/com/baeldung/algorithms/linkedlist/CycleDetectionByFastAndSlowIteratorsUnitTest.java +++ b/algorithms-miscellaneous-2/src/test/java/com/baeldung/algorithms/linkedlist/CycleDetectionByFastAndSlowIteratorsUnitTest.java @@ -1,23 +1,23 @@ -package com.baeldung.algorithms.linkedlist; - -import org.junit.Assert; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.junit.runners.Parameterized; - -@RunWith(value = Parameterized.class) -public class CycleDetectionByFastAndSlowIteratorsUnitTest extends CycleDetectionTestBase { - boolean cycleExists; - Node head; - - public CycleDetectionByFastAndSlowIteratorsUnitTest(Node head, boolean cycleExists) { - super(); - this.cycleExists = cycleExists; - this.head = head; - } - - @Test - public void givenList_detectLoop() { - Assert.assertEquals(cycleExists, CycleDetectionByFastAndSlowIterators.detectCycle(head).cycleExists); - } -} +package com.baeldung.algorithms.linkedlist; + +import org.junit.Assert; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.Parameterized; + +@RunWith(value = Parameterized.class) +public class CycleDetectionByFastAndSlowIteratorsUnitTest extends CycleDetectionTestBase { + boolean cycleExists; + Node head; + + public CycleDetectionByFastAndSlowIteratorsUnitTest(Node head, boolean cycleExists) { + super(); + this.cycleExists = cycleExists; + this.head = head; + } + + @Test + public void givenList_detectLoop() { + Assert.assertEquals(cycleExists, CycleDetectionByFastAndSlowIterators.detectCycle(head).cycleExists); + } +} diff --git a/algorithms/src/test/java/com/baeldung/algorithms/linkedlist/CycleDetectionByHashingUnitTest.java b/algorithms-miscellaneous-2/src/test/java/com/baeldung/algorithms/linkedlist/CycleDetectionByHashingUnitTest.java similarity index 96% rename from algorithms/src/test/java/com/baeldung/algorithms/linkedlist/CycleDetectionByHashingUnitTest.java rename to algorithms-miscellaneous-2/src/test/java/com/baeldung/algorithms/linkedlist/CycleDetectionByHashingUnitTest.java index 4451c3d3c9..136f55f834 100644 --- a/algorithms/src/test/java/com/baeldung/algorithms/linkedlist/CycleDetectionByHashingUnitTest.java +++ b/algorithms-miscellaneous-2/src/test/java/com/baeldung/algorithms/linkedlist/CycleDetectionByHashingUnitTest.java @@ -1,23 +1,23 @@ -package com.baeldung.algorithms.linkedlist; - -import org.junit.Assert; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.junit.runners.Parameterized; - -@RunWith(value = Parameterized.class) -public class CycleDetectionByHashingUnitTest extends CycleDetectionTestBase { - boolean cycleExists; - Node head; - - public CycleDetectionByHashingUnitTest(Node head, boolean cycleExists) { - super(); - this.cycleExists = cycleExists; - this.head = head; - } - - @Test - public void givenList_detectLoop() { - Assert.assertEquals(cycleExists, CycleDetectionByHashing.detectCycle(head).cycleExists); - } -} +package com.baeldung.algorithms.linkedlist; + +import org.junit.Assert; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.Parameterized; + +@RunWith(value = Parameterized.class) +public class CycleDetectionByHashingUnitTest extends CycleDetectionTestBase { + boolean cycleExists; + Node head; + + public CycleDetectionByHashingUnitTest(Node head, boolean cycleExists) { + super(); + this.cycleExists = cycleExists; + this.head = head; + } + + @Test + public void givenList_detectLoop() { + Assert.assertEquals(cycleExists, CycleDetectionByHashing.detectCycle(head).cycleExists); + } +} diff --git a/algorithms/src/test/java/com/baeldung/algorithms/linkedlist/CycleDetectionTestBase.java b/algorithms-miscellaneous-2/src/test/java/com/baeldung/algorithms/linkedlist/CycleDetectionTestBase.java similarity index 96% rename from algorithms/src/test/java/com/baeldung/algorithms/linkedlist/CycleDetectionTestBase.java rename to algorithms-miscellaneous-2/src/test/java/com/baeldung/algorithms/linkedlist/CycleDetectionTestBase.java index 51906de8e5..1c6f56b20d 100644 --- a/algorithms/src/test/java/com/baeldung/algorithms/linkedlist/CycleDetectionTestBase.java +++ b/algorithms-miscellaneous-2/src/test/java/com/baeldung/algorithms/linkedlist/CycleDetectionTestBase.java @@ -1,62 +1,62 @@ -package com.baeldung.algorithms.linkedlist; - -import java.util.Arrays; -import java.util.Collection; - -import org.junit.runners.Parameterized.Parameters; - -public class CycleDetectionTestBase { - - @Parameters - public static Collection getLists() { - return Arrays.asList(new Object[][] { - { createList(), false }, - { createListWithLoop(), true }, - { createListWithFullCycle(), true }, - { createListWithSingleNodeInCycle(), true } - }); - } - - public static Node createList() { - Node root = Node.createNewNode(10, null); - - for (int i = 9; i >= 1; --i) { - Node current = Node.createNewNode(i, root); - root = current; - } - - return root; - } - - public static Node createListWithLoop() { - Node node = createList(); - createLoop(node); - return node; - } - - public static Node createListWithFullCycle() { - Node head = createList(); - Node tail = Node.getTail(head); - tail.next = head; - return head; - } - - public static Node createListWithSingleNodeInCycle() { - Node head = createList(); - Node tail = Node.getTail(head); - tail.next = tail; - return head; - } - - public static void createLoop(Node root) { - Node tail = Node.getTail(root); - - Node middle = root; - for (int i = 1; i <= 4; i++) { - middle = middle.next; - } - - tail.next = middle; - } - -} +package com.baeldung.algorithms.linkedlist; + +import java.util.Arrays; +import java.util.Collection; + +import org.junit.runners.Parameterized.Parameters; + +public class CycleDetectionTestBase { + + @Parameters + public static Collection getLists() { + return Arrays.asList(new Object[][] { + { createList(), false }, + { createListWithLoop(), true }, + { createListWithFullCycle(), true }, + { createListWithSingleNodeInCycle(), true } + }); + } + + public static Node createList() { + Node root = Node.createNewNode(10, null); + + for (int i = 9; i >= 1; --i) { + Node current = Node.createNewNode(i, root); + root = current; + } + + return root; + } + + public static Node createListWithLoop() { + Node node = createList(); + createLoop(node); + return node; + } + + public static Node createListWithFullCycle() { + Node head = createList(); + Node tail = Node.getTail(head); + tail.next = head; + return head; + } + + public static Node createListWithSingleNodeInCycle() { + Node head = createList(); + Node tail = Node.getTail(head); + tail.next = tail; + return head; + } + + public static void createLoop(Node root) { + Node tail = Node.getTail(root); + + Node middle = root; + for (int i = 1; i <= 4; i++) { + middle = middle.next; + } + + tail.next = middle; + } + +} diff --git a/algorithms/src/test/java/com/baeldung/algorithms/linkedlist/CycleRemovalBruteForceUnitTest.java b/algorithms-miscellaneous-2/src/test/java/com/baeldung/algorithms/linkedlist/CycleRemovalBruteForceUnitTest.java similarity index 97% rename from algorithms/src/test/java/com/baeldung/algorithms/linkedlist/CycleRemovalBruteForceUnitTest.java rename to algorithms-miscellaneous-2/src/test/java/com/baeldung/algorithms/linkedlist/CycleRemovalBruteForceUnitTest.java index f69e3c35ba..36f08d2b76 100644 --- a/algorithms/src/test/java/com/baeldung/algorithms/linkedlist/CycleRemovalBruteForceUnitTest.java +++ b/algorithms-miscellaneous-2/src/test/java/com/baeldung/algorithms/linkedlist/CycleRemovalBruteForceUnitTest.java @@ -1,24 +1,24 @@ -package com.baeldung.algorithms.linkedlist; - -import org.junit.Assert; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.junit.runners.Parameterized; - -@RunWith(value = Parameterized.class) -public class CycleRemovalBruteForceUnitTest extends CycleDetectionTestBase { - boolean cycleExists; - Node head; - - public CycleRemovalBruteForceUnitTest(Node head, boolean cycleExists) { - super(); - this.cycleExists = cycleExists; - this.head = head; - } - - @Test - public void givenList_ifLoopExists_thenDetectAndRemoveLoop() { - Assert.assertEquals(cycleExists, CycleRemovalBruteForce.detectAndRemoveCycle(head)); - Assert.assertFalse(CycleDetectionByFastAndSlowIterators.detectCycle(head).cycleExists); - } -} +package com.baeldung.algorithms.linkedlist; + +import org.junit.Assert; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.Parameterized; + +@RunWith(value = Parameterized.class) +public class CycleRemovalBruteForceUnitTest extends CycleDetectionTestBase { + boolean cycleExists; + Node head; + + public CycleRemovalBruteForceUnitTest(Node head, boolean cycleExists) { + super(); + this.cycleExists = cycleExists; + this.head = head; + } + + @Test + public void givenList_ifLoopExists_thenDetectAndRemoveLoop() { + Assert.assertEquals(cycleExists, CycleRemovalBruteForce.detectAndRemoveCycle(head)); + Assert.assertFalse(CycleDetectionByFastAndSlowIterators.detectCycle(head).cycleExists); + } +} diff --git a/algorithms/src/test/java/com/baeldung/algorithms/linkedlist/CycleRemovalByCountingLoopNodesUnitTest.java b/algorithms-miscellaneous-2/src/test/java/com/baeldung/algorithms/linkedlist/CycleRemovalByCountingLoopNodesUnitTest.java similarity index 97% rename from algorithms/src/test/java/com/baeldung/algorithms/linkedlist/CycleRemovalByCountingLoopNodesUnitTest.java rename to algorithms-miscellaneous-2/src/test/java/com/baeldung/algorithms/linkedlist/CycleRemovalByCountingLoopNodesUnitTest.java index c17aa6eeab..cc7589c53d 100644 --- a/algorithms/src/test/java/com/baeldung/algorithms/linkedlist/CycleRemovalByCountingLoopNodesUnitTest.java +++ b/algorithms-miscellaneous-2/src/test/java/com/baeldung/algorithms/linkedlist/CycleRemovalByCountingLoopNodesUnitTest.java @@ -1,24 +1,24 @@ -package com.baeldung.algorithms.linkedlist; - -import org.junit.Assert; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.junit.runners.Parameterized; - -@RunWith(value = Parameterized.class) -public class CycleRemovalByCountingLoopNodesUnitTest extends CycleDetectionTestBase { - boolean cycleExists; - Node head; - - public CycleRemovalByCountingLoopNodesUnitTest(Node head, boolean cycleExists) { - super(); - this.cycleExists = cycleExists; - this.head = head; - } - - @Test - public void givenList_ifLoopExists_thenDetectAndRemoveLoop() { - Assert.assertEquals(cycleExists, CycleRemovalByCountingLoopNodes.detectAndRemoveCycle(head)); - Assert.assertFalse(CycleDetectionByFastAndSlowIterators.detectCycle(head).cycleExists); - } -} +package com.baeldung.algorithms.linkedlist; + +import org.junit.Assert; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.Parameterized; + +@RunWith(value = Parameterized.class) +public class CycleRemovalByCountingLoopNodesUnitTest extends CycleDetectionTestBase { + boolean cycleExists; + Node head; + + public CycleRemovalByCountingLoopNodesUnitTest(Node head, boolean cycleExists) { + super(); + this.cycleExists = cycleExists; + this.head = head; + } + + @Test + public void givenList_ifLoopExists_thenDetectAndRemoveLoop() { + Assert.assertEquals(cycleExists, CycleRemovalByCountingLoopNodes.detectAndRemoveCycle(head)); + Assert.assertFalse(CycleDetectionByFastAndSlowIterators.detectCycle(head).cycleExists); + } +} diff --git a/algorithms/src/test/java/com/baeldung/algorithms/linkedlist/CycleRemovalWithoutCountingLoopNodesUnitTest.java b/algorithms-miscellaneous-2/src/test/java/com/baeldung/algorithms/linkedlist/CycleRemovalWithoutCountingLoopNodesUnitTest.java similarity index 97% rename from algorithms/src/test/java/com/baeldung/algorithms/linkedlist/CycleRemovalWithoutCountingLoopNodesUnitTest.java rename to algorithms-miscellaneous-2/src/test/java/com/baeldung/algorithms/linkedlist/CycleRemovalWithoutCountingLoopNodesUnitTest.java index 06ff840a59..350e63dcc3 100644 --- a/algorithms/src/test/java/com/baeldung/algorithms/linkedlist/CycleRemovalWithoutCountingLoopNodesUnitTest.java +++ b/algorithms-miscellaneous-2/src/test/java/com/baeldung/algorithms/linkedlist/CycleRemovalWithoutCountingLoopNodesUnitTest.java @@ -1,24 +1,24 @@ -package com.baeldung.algorithms.linkedlist; - -import org.junit.Assert; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.junit.runners.Parameterized; - -@RunWith(value = Parameterized.class) -public class CycleRemovalWithoutCountingLoopNodesUnitTest extends CycleDetectionTestBase { - boolean cycleExists; - Node head; - - public CycleRemovalWithoutCountingLoopNodesUnitTest(Node head, boolean cycleExists) { - super(); - this.cycleExists = cycleExists; - this.head = head; - } - - @Test - public void givenList_ifLoopExists_thenDetectAndRemoveLoop() { - Assert.assertEquals(cycleExists, CycleRemovalWithoutCountingLoopNodes.detectAndRemoveCycle(head)); - Assert.assertFalse(CycleDetectionByFastAndSlowIterators.detectCycle(head).cycleExists); - } +package com.baeldung.algorithms.linkedlist; + +import org.junit.Assert; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.Parameterized; + +@RunWith(value = Parameterized.class) +public class CycleRemovalWithoutCountingLoopNodesUnitTest extends CycleDetectionTestBase { + boolean cycleExists; + Node head; + + public CycleRemovalWithoutCountingLoopNodesUnitTest(Node head, boolean cycleExists) { + super(); + this.cycleExists = cycleExists; + this.head = head; + } + + @Test + public void givenList_ifLoopExists_thenDetectAndRemoveLoop() { + Assert.assertEquals(cycleExists, CycleRemovalWithoutCountingLoopNodes.detectAndRemoveCycle(head)); + Assert.assertFalse(CycleDetectionByFastAndSlowIterators.detectCycle(head).cycleExists); + } } \ No newline at end of file diff --git a/algorithms-miscellaneous-2/src/test/java/com/baeldung/algorithms/mercator/EllipticalMercatorUnitTest.java b/algorithms-miscellaneous-2/src/test/java/com/baeldung/algorithms/mercator/EllipticalMercatorUnitTest.java new file mode 100644 index 0000000000..96b644c46c --- /dev/null +++ b/algorithms-miscellaneous-2/src/test/java/com/baeldung/algorithms/mercator/EllipticalMercatorUnitTest.java @@ -0,0 +1,22 @@ +package com.baeldung.algorithms.mercator; + +import org.junit.Assert; +import org.junit.Test; + + +public class EllipticalMercatorUnitTest { + + @Test + public void giventThatTheInputIs22_whenXAxisProjectionIsCalled_thenTheResultIsTheCorrectOne() { + Mercator mercator = new EllipticalMercator(); + double result = mercator.xAxisProjection(22); + Assert.assertEquals(result, 2449028.7974520186, 0.0); + } + + @Test + public void giventThatTheInputIs44_whenYAxisProjectionIsCalled_thenTheResultIsTheCorrectOne() { + Mercator mercator = new EllipticalMercator(); + double result = mercator.yAxisProjection(44); + Assert.assertEquals(result, 5435749.887511954, 0.0); + } +} diff --git a/algorithms-miscellaneous-2/src/test/java/com/baeldung/algorithms/mercator/SphericalMercatorUnitTest.java b/algorithms-miscellaneous-2/src/test/java/com/baeldung/algorithms/mercator/SphericalMercatorUnitTest.java new file mode 100644 index 0000000000..348c6ad3e4 --- /dev/null +++ b/algorithms-miscellaneous-2/src/test/java/com/baeldung/algorithms/mercator/SphericalMercatorUnitTest.java @@ -0,0 +1,21 @@ +package com.baeldung.algorithms.mercator; + +import org.junit.Assert; +import org.junit.Test; + +public class SphericalMercatorUnitTest { + + @Test + public void giventThatTheInputIs22_whenXAxisProjectionIsCalled_thenTheResultIsTheCorrectOne() { + Mercator mercator = new SphericalMercator(); + double result = mercator.xAxisProjection(22); + Assert.assertEquals(result, 2449028.7974520186, 0.0); + } + + @Test + public void giventThatTheInputIs44_whenYAxisProjectionIsCalled_thenTheResultIsTheCorrectOne() { + Mercator mercator = new SphericalMercator(); + double result = mercator.yAxisProjection(44); + Assert.assertEquals(result, 5465442.183322753, 0.0); + } +} diff --git a/algorithms/src/test/java/com/baeldung/algorithms/moneywords/NumberWordConverterUnitTest.java b/algorithms-miscellaneous-2/src/test/java/com/baeldung/algorithms/moneywords/NumberWordConverterUnitTest.java similarity index 100% rename from algorithms/src/test/java/com/baeldung/algorithms/moneywords/NumberWordConverterUnitTest.java rename to algorithms-miscellaneous-2/src/test/java/com/baeldung/algorithms/moneywords/NumberWordConverterUnitTest.java diff --git a/algorithms/src/test/java/com/baeldung/algorithms/rectanglesoverlap/RectangleUnitTest.java b/algorithms-miscellaneous-2/src/test/java/com/baeldung/algorithms/rectanglesoverlap/RectangleUnitTest.java similarity index 100% rename from algorithms/src/test/java/com/baeldung/algorithms/rectanglesoverlap/RectangleUnitTest.java rename to algorithms-miscellaneous-2/src/test/java/com/baeldung/algorithms/rectanglesoverlap/RectangleUnitTest.java diff --git a/algorithms/src/test/java/com/baeldung/algorithms/romannumerals/RomanArabicConverterUnitTest.java b/algorithms-miscellaneous-2/src/test/java/com/baeldung/algorithms/romannumerals/RomanArabicConverterUnitTest.java similarity index 95% rename from algorithms/src/test/java/com/baeldung/algorithms/romannumerals/RomanArabicConverterUnitTest.java rename to algorithms-miscellaneous-2/src/test/java/com/baeldung/algorithms/romannumerals/RomanArabicConverterUnitTest.java index b289ec6bc9..9043cfe9cc 100644 --- a/algorithms/src/test/java/com/baeldung/algorithms/romannumerals/RomanArabicConverterUnitTest.java +++ b/algorithms-miscellaneous-2/src/test/java/com/baeldung/algorithms/romannumerals/RomanArabicConverterUnitTest.java @@ -1,29 +1,29 @@ -package com.baeldung.algorithms.romannumerals; - -import static org.assertj.core.api.Assertions.assertThat; - -import org.junit.Test; - -public class RomanArabicConverterUnitTest { - - @Test - public void given2018Roman_WhenConvertingToArabic_ThenReturn2018() { - - String roman2018 = "MMXVIII"; - - int result = RomanArabicConverter.romanToArabic(roman2018); - - assertThat(result).isEqualTo(2018); - } - - @Test - public void given1999Arabic_WhenConvertingToRoman_ThenReturnMCMXCIX() { - - int arabic1999 = 1999; - - String result = RomanArabicConverter.arabicToRoman(arabic1999); - - assertThat(result).isEqualTo("MCMXCIX"); - } - -} +package com.baeldung.algorithms.romannumerals; + +import static org.assertj.core.api.Assertions.assertThat; + +import org.junit.Test; + +public class RomanArabicConverterUnitTest { + + @Test + public void given2018Roman_WhenConvertingToArabic_ThenReturn2018() { + + String roman2018 = "MMXVIII"; + + int result = RomanArabicConverter.romanToArabic(roman2018); + + assertThat(result).isEqualTo(2018); + } + + @Test + public void given1999Arabic_WhenConvertingToRoman_ThenReturnMCMXCIX() { + + int arabic1999 = 1999; + + String result = RomanArabicConverter.arabicToRoman(arabic1999); + + assertThat(result).isEqualTo("MCMXCIX"); + } + +} diff --git a/algorithms/roundUpToHundred/src/com/java/src/RoundUpToHundredTest.java b/algorithms-miscellaneous-2/src/test/java/com/baeldung/algorithms/roundedup/RoundUpToHundredUnitTest.java similarity index 83% rename from algorithms/roundUpToHundred/src/com/java/src/RoundUpToHundredTest.java rename to algorithms-miscellaneous-2/src/test/java/com/baeldung/algorithms/roundedup/RoundUpToHundredUnitTest.java index f35a9a249f..5191d65787 100644 --- a/algorithms/roundUpToHundred/src/com/java/src/RoundUpToHundredTest.java +++ b/algorithms-miscellaneous-2/src/test/java/com/baeldung/algorithms/roundedup/RoundUpToHundredUnitTest.java @@ -1,14 +1,14 @@ -package com.java.src; - -import static org.junit.Assert.assertEquals; - -import org.junit.Test; - -public class RoundUpToHundredTest { - @Test - public void givenInput_whenRound_thenRoundUpToTheNearestHundred() { - assertEquals("Rounded up to hundred", 100, RoundUpToHundred.round(99)); - assertEquals("Rounded up to three hundred ", 300, RoundUpToHundred.round(200.2)); - assertEquals("Returns same rounded value", 400, RoundUpToHundred.round(400)); - } -} +package com.baeldung.algorithms.roundedup; + +import static org.junit.Assert.assertEquals; + +import org.junit.Test; + +public class RoundUpToHundredUnitTest { + @Test + public void givenInput_whenRound_thenRoundUpToTheNearestHundred() { + assertEquals("Rounded up to hundred", 100, RoundUpToHundred.round(99)); + assertEquals("Rounded up to three hundred ", 300, RoundUpToHundred.round(200.2)); + assertEquals("Returns same rounded value", 400, RoundUpToHundred.round(400)); + } +} diff --git a/algorithms/src/test/java/com/baeldung/jgrapht/CompleteGraphUnitTest.java b/algorithms-miscellaneous-2/src/test/java/com/baeldung/jgrapht/CompleteGraphUnitTest.java similarity index 100% rename from algorithms/src/test/java/com/baeldung/jgrapht/CompleteGraphUnitTest.java rename to algorithms-miscellaneous-2/src/test/java/com/baeldung/jgrapht/CompleteGraphUnitTest.java diff --git a/algorithms/src/test/java/com/baeldung/jgrapht/DirectedGraphUnitTest.java b/algorithms-miscellaneous-2/src/test/java/com/baeldung/jgrapht/DirectedGraphUnitTest.java similarity index 100% rename from algorithms/src/test/java/com/baeldung/jgrapht/DirectedGraphUnitTest.java rename to algorithms-miscellaneous-2/src/test/java/com/baeldung/jgrapht/DirectedGraphUnitTest.java diff --git a/algorithms/src/test/java/com/baeldung/jgrapht/EulerianCircuitUnitTest.java b/algorithms-miscellaneous-2/src/test/java/com/baeldung/jgrapht/EulerianCircuitUnitTest.java similarity index 100% rename from algorithms/src/test/java/com/baeldung/jgrapht/EulerianCircuitUnitTest.java rename to algorithms-miscellaneous-2/src/test/java/com/baeldung/jgrapht/EulerianCircuitUnitTest.java diff --git a/algorithms-sorting/.gitignore b/algorithms-sorting/.gitignore new file mode 100644 index 0000000000..30b2b7442c --- /dev/null +++ b/algorithms-sorting/.gitignore @@ -0,0 +1,4 @@ +/target/ +.settings/ +.classpath +.project \ No newline at end of file diff --git a/algorithms-sorting/README.md b/algorithms-sorting/README.md new file mode 100644 index 0000000000..36460293b0 --- /dev/null +++ b/algorithms-sorting/README.md @@ -0,0 +1,7 @@ +## Relevant articles: + +- [Bubble Sort in Java](http://www.baeldung.com/java-bubble-sort) +- [Merge Sort in Java](https://www.baeldung.com/java-merge-sort) +- [Quicksort Algorithm Implementation in Java](https://www.baeldung.com/java-quicksort) +- [Insertion Sort in Java](https://www.baeldung.com/java-insertion-sort) +- [Heap Sort in Java](https://www.baeldung.com/java-heap-sort) diff --git a/algorithms-sorting/pom.xml b/algorithms-sorting/pom.xml new file mode 100644 index 0000000000..2aee6e9199 --- /dev/null +++ b/algorithms-sorting/pom.xml @@ -0,0 +1,58 @@ + + 4.0.0 + algorithms-sorting + 0.0.1-SNAPSHOT + algorithms-sorting + + + com.baeldung + parent-modules + 1.0.0-SNAPSHOT + + + + + org.apache.commons + commons-math3 + ${commons-math3.version} + + + commons-codec + commons-codec + ${commons-codec.version} + + + org.projectlombok + lombok + ${lombok.version} + provided + + + org.assertj + assertj-core + ${org.assertj.core.version} + test + + + + + + + + org.codehaus.mojo + exec-maven-plugin + ${exec-maven-plugin.version} + + + + + + + 1.16.12 + 3.6.1 + 3.9.0 + 1.11 + + + \ No newline at end of file diff --git a/algorithms/src/main/java/com/baeldung/algorithms/bubblesort/BubbleSort.java b/algorithms-sorting/src/main/java/com/baeldung/algorithms/bubblesort/BubbleSort.java similarity index 91% rename from algorithms/src/main/java/com/baeldung/algorithms/bubblesort/BubbleSort.java rename to algorithms-sorting/src/main/java/com/baeldung/algorithms/bubblesort/BubbleSort.java index a561072b2e..2528032676 100644 --- a/algorithms/src/main/java/com/baeldung/algorithms/bubblesort/BubbleSort.java +++ b/algorithms-sorting/src/main/java/com/baeldung/algorithms/bubblesort/BubbleSort.java @@ -1,40 +1,40 @@ -package com.baeldung.algorithms.bubblesort; - -import java.util.stream.IntStream; - -public class BubbleSort { - - void bubbleSort(Integer[] arr) { - int n = arr.length; - IntStream.range(0, n - 1) - .flatMap(i -> IntStream.range(i + 1, n - i)) - .forEach(j -> { - if (arr[j - 1] > arr[j]) { - int temp = arr[j]; - arr[j] = arr[j - 1]; - arr[j - 1] = temp; - } - }); - } - - void optimizedBubbleSort(Integer[] arr) { - int i = 0, n = arr.length; - - boolean swapNeeded = true; - while (i < n - 1 && swapNeeded) { - swapNeeded = false; - for (int j = 1; j < n - i; j++) { - if (arr[j - 1] > arr[j]) { - - int temp = arr[j - 1]; - arr[j - 1] = arr[j]; - arr[j] = temp; - swapNeeded = true; - } - } - if (!swapNeeded) - break; - i++; - } - } -} +package com.baeldung.algorithms.bubblesort; + +import java.util.stream.IntStream; + +public class BubbleSort { + + void bubbleSort(Integer[] arr) { + int n = arr.length; + IntStream.range(0, n - 1) + .flatMap(i -> IntStream.range(1, n - i)) + .forEach(j -> { + if (arr[j - 1] > arr[j]) { + int temp = arr[j]; + arr[j] = arr[j - 1]; + arr[j - 1] = temp; + } + }); + } + + void optimizedBubbleSort(Integer[] arr) { + int i = 0, n = arr.length; + + boolean swapNeeded = true; + while (i < n - 1 && swapNeeded) { + swapNeeded = false; + for (int j = 1; j < n - i; j++) { + if (arr[j - 1] > arr[j]) { + + int temp = arr[j - 1]; + arr[j - 1] = arr[j]; + arr[j] = temp; + swapNeeded = true; + } + } + if (!swapNeeded) + break; + i++; + } + } +} diff --git a/core-java/src/main/java/com/baeldung/heapsort/Heap.java b/algorithms-sorting/src/main/java/com/baeldung/algorithms/heapsort/Heap.java similarity index 98% rename from core-java/src/main/java/com/baeldung/heapsort/Heap.java rename to algorithms-sorting/src/main/java/com/baeldung/algorithms/heapsort/Heap.java index 95e0e1d8cd..8c98e4fc5c 100644 --- a/core-java/src/main/java/com/baeldung/heapsort/Heap.java +++ b/algorithms-sorting/src/main/java/com/baeldung/algorithms/heapsort/Heap.java @@ -1,4 +1,4 @@ -package com.baeldung.heapsort; +package com.baeldung.algorithms.heapsort; import java.util.ArrayList; import java.util.Arrays; diff --git a/algorithms/src/main/java/com/baeldung/algorithms/insertionsort/InsertionSort.java b/algorithms-sorting/src/main/java/com/baeldung/algorithms/insertionsort/InsertionSort.java similarity index 100% rename from algorithms/src/main/java/com/baeldung/algorithms/insertionsort/InsertionSort.java rename to algorithms-sorting/src/main/java/com/baeldung/algorithms/insertionsort/InsertionSort.java diff --git a/algorithms/src/main/java/com/baeldung/algorithms/mergesort/MergeSort.java b/algorithms-sorting/src/main/java/com/baeldung/algorithms/mergesort/MergeSort.java similarity index 100% rename from algorithms/src/main/java/com/baeldung/algorithms/mergesort/MergeSort.java rename to algorithms-sorting/src/main/java/com/baeldung/algorithms/mergesort/MergeSort.java diff --git a/algorithms/src/main/java/com/baeldung/algorithms/quicksort/QuickSort.java b/algorithms-sorting/src/main/java/com/baeldung/algorithms/quicksort/QuickSort.java similarity index 100% rename from algorithms/src/main/java/com/baeldung/algorithms/quicksort/QuickSort.java rename to algorithms-sorting/src/main/java/com/baeldung/algorithms/quicksort/QuickSort.java diff --git a/algorithms/src/main/java/com/baeldung/algorithms/quicksort/ThreeWayQuickSort.java b/algorithms-sorting/src/main/java/com/baeldung/algorithms/quicksort/ThreeWayQuickSort.java similarity index 100% rename from algorithms/src/main/java/com/baeldung/algorithms/quicksort/ThreeWayQuickSort.java rename to algorithms-sorting/src/main/java/com/baeldung/algorithms/quicksort/ThreeWayQuickSort.java diff --git a/core-java-persistence/src/main/resources/logback.xml b/algorithms-sorting/src/main/resources/logback.xml similarity index 100% rename from core-java-persistence/src/main/resources/logback.xml rename to algorithms-sorting/src/main/resources/logback.xml diff --git a/algorithms/src/test/java/com/baeldung/algorithms/bubblesort/BubbleSortUnitTest.java b/algorithms-sorting/src/test/java/com/baeldung/algorithms/bubblesort/BubbleSortUnitTest.java similarity index 88% rename from algorithms/src/test/java/com/baeldung/algorithms/bubblesort/BubbleSortUnitTest.java rename to algorithms-sorting/src/test/java/com/baeldung/algorithms/bubblesort/BubbleSortUnitTest.java index c7f3f7dc38..210ee2378a 100644 --- a/algorithms/src/test/java/com/baeldung/algorithms/bubblesort/BubbleSortUnitTest.java +++ b/algorithms-sorting/src/test/java/com/baeldung/algorithms/bubblesort/BubbleSortUnitTest.java @@ -1,26 +1,26 @@ -package com.baeldung.algorithms.bubblesort; - -import static org.junit.Assert.*; - -import org.junit.Test; - -public class BubbleSortUnitTest { - - @Test - public void givenIntegerArray_whenSortedWithBubbleSort_thenGetSortedArray() { - Integer[] array = { 2, 1, 4, 6, 3, 5 }; - Integer[] sortedArray = { 1, 2, 3, 4, 5, 6 }; - BubbleSort bubbleSort = new BubbleSort(); - bubbleSort.bubbleSort(array); - assertArrayEquals(array, sortedArray); - } - - @Test - public void givenIntegerArray_whenSortedWithOptimizedBubbleSort_thenGetSortedArray() { - Integer[] array = { 2, 1, 4, 6, 3, 5 }; - Integer[] sortedArray = { 1, 2, 3, 4, 5, 6 }; - BubbleSort bubbleSort = new BubbleSort(); - bubbleSort.optimizedBubbleSort(array); - assertArrayEquals(array, sortedArray); - } +package com.baeldung.algorithms.bubblesort; + +import static org.junit.jupiter.api.Assertions.assertArrayEquals; + +import org.junit.jupiter.api.Test; + +public class BubbleSortUnitTest { + + @Test + public void givenIntegerArray_whenSortedWithBubbleSort_thenGetSortedArray() { + Integer[] array = { 2, 1, 4, 6, 3, 5 }; + Integer[] sortedArray = { 1, 2, 3, 4, 5, 6 }; + BubbleSort bubbleSort = new BubbleSort(); + bubbleSort.bubbleSort(array); + assertArrayEquals(array, sortedArray); + } + + @Test + public void givenIntegerArray_whenSortedWithOptimizedBubbleSort_thenGetSortedArray() { + Integer[] array = { 2, 1, 4, 6, 3, 5 }; + Integer[] sortedArray = { 1, 2, 3, 4, 5, 6 }; + BubbleSort bubbleSort = new BubbleSort(); + bubbleSort.optimizedBubbleSort(array); + assertArrayEquals(array, sortedArray); + } } \ No newline at end of file diff --git a/core-java/src/test/java/com/baeldung/heapsort/HeapUnitTest.java b/algorithms-sorting/src/test/java/com/baeldung/algorithms/heapsort/HeapUnitTest.java similarity index 95% rename from core-java/src/test/java/com/baeldung/heapsort/HeapUnitTest.java rename to algorithms-sorting/src/test/java/com/baeldung/algorithms/heapsort/HeapUnitTest.java index cc3e49b6c9..96e4936eaf 100644 --- a/core-java/src/test/java/com/baeldung/heapsort/HeapUnitTest.java +++ b/algorithms-sorting/src/test/java/com/baeldung/algorithms/heapsort/HeapUnitTest.java @@ -1,4 +1,4 @@ -package com.baeldung.heapsort; +package com.baeldung.algorithms.heapsort; import static org.assertj.core.api.Assertions.assertThat; diff --git a/algorithms/src/test/java/com/baeldung/algorithms/insertionsort/InsertionSortUnitTest.java b/algorithms-sorting/src/test/java/com/baeldung/algorithms/insertionsort/InsertionSortUnitTest.java similarity index 100% rename from algorithms/src/test/java/com/baeldung/algorithms/insertionsort/InsertionSortUnitTest.java rename to algorithms-sorting/src/test/java/com/baeldung/algorithms/insertionsort/InsertionSortUnitTest.java diff --git a/algorithms/src/test/java/com/baeldung/algorithms/mergesort/MergeSortUnitTest.java b/algorithms-sorting/src/test/java/com/baeldung/algorithms/mergesort/MergeSortUnitTest.java similarity index 100% rename from algorithms/src/test/java/com/baeldung/algorithms/mergesort/MergeSortUnitTest.java rename to algorithms-sorting/src/test/java/com/baeldung/algorithms/mergesort/MergeSortUnitTest.java diff --git a/algorithms/src/test/java/com/baeldung/algorithms/quicksort/QuickSortUnitTest.java b/algorithms-sorting/src/test/java/com/baeldung/algorithms/quicksort/QuickSortUnitTest.java similarity index 100% rename from algorithms/src/test/java/com/baeldung/algorithms/quicksort/QuickSortUnitTest.java rename to algorithms-sorting/src/test/java/com/baeldung/algorithms/quicksort/QuickSortUnitTest.java diff --git a/algorithms/src/test/java/com/baeldung/algorithms/quicksort/ThreeWayQuickSortUnitTest.java b/algorithms-sorting/src/test/java/com/baeldung/algorithms/quicksort/ThreeWayQuickSortUnitTest.java similarity index 100% rename from algorithms/src/test/java/com/baeldung/algorithms/quicksort/ThreeWayQuickSortUnitTest.java rename to algorithms-sorting/src/test/java/com/baeldung/algorithms/quicksort/ThreeWayQuickSortUnitTest.java diff --git a/algorithms/.gitignore b/algorithms/.gitignore deleted file mode 100644 index b83d22266a..0000000000 --- a/algorithms/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/target/ diff --git a/algorithms/roundUpToHundred/.gitignore b/algorithms/roundUpToHundred/.gitignore deleted file mode 100644 index ae3c172604..0000000000 --- a/algorithms/roundUpToHundred/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/bin/ diff --git a/annotations/annotation-processing/pom.xml b/annotations/annotation-processing/pom.xml index 8e53334521..d9aca6040d 100644 --- a/annotations/annotation-processing/pom.xml +++ b/annotations/annotation-processing/pom.xml @@ -3,7 +3,8 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 annotation-processing - + annotation-processing + com.baeldung 1.0.0-SNAPSHOT diff --git a/annotations/annotation-user/pom.xml b/annotations/annotation-user/pom.xml index 07ea9a5b5a..422cc7f119 100644 --- a/annotations/annotation-user/pom.xml +++ b/annotations/annotation-user/pom.xml @@ -3,6 +3,7 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 annotation-user + annotation-user annotations diff --git a/annotations/pom.xml b/annotations/pom.xml index 2c73d3d91b..6d83f5b057 100644 --- a/annotations/pom.xml +++ b/annotations/pom.xml @@ -4,7 +4,8 @@ 4.0.0 annotations pom - + annotations + parent-modules com.baeldung diff --git a/apache-avro/pom.xml b/apache-avro/pom.xml index ddf5844271..18f9c34d64 100644 --- a/apache-avro/pom.xml +++ b/apache-avro/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"> 4.0.0 - com.baeldung apache-avro 0.0.1-SNAPSHOT - Apache Avro + apache-avro UTF-8 diff --git a/apache-bval/pom.xml b/apache-bval/pom.xml index 5ddb1ecb59..786f587fb1 100644 --- a/apache-bval/pom.xml +++ b/apache-bval/pom.xml @@ -4,7 +4,8 @@ apache-bval apache-bval 0.0.1-SNAPSHOT - + apache-bval + com.baeldung parent-modules diff --git a/apache-curator/pom.xml b/apache-curator/pom.xml index ac10811e7a..bcca38b199 100644 --- a/apache-curator/pom.xml +++ b/apache-curator/pom.xml @@ -4,6 +4,7 @@ apache-curator 0.0.1-SNAPSHOT jar + apache-curator com.baeldung diff --git a/apache-cxf/cxf-aegis/pom.xml b/apache-cxf/cxf-aegis/pom.xml index b7e9e426a2..1d36178b82 100644 --- a/apache-cxf/cxf-aegis/pom.xml +++ b/apache-cxf/cxf-aegis/pom.xml @@ -2,7 +2,8 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> 4.0.0 cxf-aegis - + cxf-aegis + com.baeldung apache-cxf diff --git a/apache-cxf/cxf-introduction/pom.xml b/apache-cxf/cxf-introduction/pom.xml index a9e82c16b3..17f03afd25 100644 --- a/apache-cxf/cxf-introduction/pom.xml +++ b/apache-cxf/cxf-introduction/pom.xml @@ -4,7 +4,8 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> 4.0.0 cxf-introduction - + cxf-introduction + com.baeldung apache-cxf diff --git a/apache-cxf/cxf-jaxrs-implementation/pom.xml b/apache-cxf/cxf-jaxrs-implementation/pom.xml index 89acbdf1bd..03d0f67c90 100644 --- a/apache-cxf/cxf-jaxrs-implementation/pom.xml +++ b/apache-cxf/cxf-jaxrs-implementation/pom.xml @@ -4,7 +4,8 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> 4.0.0 cxf-jaxrs-implementation - + cxf-jaxrs-implementation + com.baeldung apache-cxf diff --git a/apache-cxf/cxf-spring/pom.xml b/apache-cxf/cxf-spring/pom.xml index 31e75e7cdd..97715af54c 100644 --- a/apache-cxf/cxf-spring/pom.xml +++ b/apache-cxf/cxf-spring/pom.xml @@ -3,6 +3,7 @@ 4.0.0 cxf-spring war + cxf-spring com.baeldung diff --git a/apache-cxf/pom.xml b/apache-cxf/pom.xml index 8918fd4450..0016f33d70 100644 --- a/apache-cxf/pom.xml +++ b/apache-cxf/pom.xml @@ -1,9 +1,9 @@ 4.0.0 - com.baeldung apache-cxf 0.0.1-SNAPSHOT + apache-cxf pom diff --git a/apache-cxf/sse-jaxrs/pom.xml b/apache-cxf/sse-jaxrs/pom.xml index d4b6c19d03..cb5c96660a 100644 --- a/apache-cxf/sse-jaxrs/pom.xml +++ b/apache-cxf/sse-jaxrs/pom.xml @@ -3,8 +3,8 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 - sse-jaxrs + sse-jaxrs pom diff --git a/apache-cxf/sse-jaxrs/sse-jaxrs-client/pom.xml b/apache-cxf/sse-jaxrs/sse-jaxrs-client/pom.xml index 0f5406fbc7..c7acf22c32 100644 --- a/apache-cxf/sse-jaxrs/sse-jaxrs-client/pom.xml +++ b/apache-cxf/sse-jaxrs/sse-jaxrs-client/pom.xml @@ -3,15 +3,15 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 - + sse-jaxrs-client + sse-jaxrs-client + com.baeldung sse-jaxrs 0.0.1-SNAPSHOT - sse-jaxrs-client - 3.2.0 @@ -21,7 +21,6 @@ org.codehaus.mojo exec-maven-plugin - 1.6.0 singleEvent diff --git a/apache-cxf/sse-jaxrs/sse-jaxrs-server/pom.xml b/apache-cxf/sse-jaxrs/sse-jaxrs-server/pom.xml index 2e82dc3829..eeb5726ee1 100644 --- a/apache-cxf/sse-jaxrs/sse-jaxrs-server/pom.xml +++ b/apache-cxf/sse-jaxrs/sse-jaxrs-server/pom.xml @@ -3,16 +3,16 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 - + sse-jaxrs-server + sse-jaxrs-server + war + com.baeldung sse-jaxrs 0.0.1-SNAPSHOT - sse-jaxrs-server - war - 2.4.2 false diff --git a/apache-geode/README.md b/apache-geode/README.md new file mode 100644 index 0000000000..2f04418825 --- /dev/null +++ b/apache-geode/README.md @@ -0,0 +1,3 @@ +### Relevant Articles: + +- [A Quick Guide to Apache Geode](https://www.baeldung.com/apache-geode) diff --git a/apache-geode/pom.xml b/apache-geode/pom.xml index a3f6604ac4..738accdcb8 100644 --- a/apache-geode/pom.xml +++ b/apache-geode/pom.xml @@ -3,11 +3,10 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 - - com.baeldung apache-geode 1.0-SNAPSHOT - + apache-geode + com.baeldung parent-modules diff --git a/apache-opennlp/pom.xml b/apache-opennlp/pom.xml index 985c9a2df2..6b2e6a9729 100644 --- a/apache-opennlp/pom.xml +++ b/apache-opennlp/pom.xml @@ -4,6 +4,7 @@ 4.0.0 apache-opennlp 1.0-SNAPSHOT + apache-opennlp jar diff --git a/apache-poi/pom.xml b/apache-poi/pom.xml index a1ec626d43..54c3e8e928 100644 --- a/apache-poi/pom.xml +++ b/apache-poi/pom.xml @@ -1,9 +1,9 @@ 4.0.0 - com.baeldung apache-poi 0.0.1-SNAPSHOT + apache-poi com.baeldung diff --git a/apache-pulsar/.gitignore b/apache-pulsar/.gitignore new file mode 100755 index 0000000000..1c53e03007 --- /dev/null +++ b/apache-pulsar/.gitignore @@ -0,0 +1,8 @@ +.classpath +.project +.settings +target +.idea +*.iml +.gradle/ +build/ diff --git a/apache-pulsar/README.md b/apache-pulsar/README.md new file mode 100644 index 0000000000..2970bc3d88 --- /dev/null +++ b/apache-pulsar/README.md @@ -0,0 +1,3 @@ +### Relevant Articles: + +- [Introduction to Apache Pulsar](https://www.baeldung.com/apache-pulsar) diff --git a/apache-pulsar/pom.xml b/apache-pulsar/pom.xml new file mode 100644 index 0000000000..a4c09586eb --- /dev/null +++ b/apache-pulsar/pom.xml @@ -0,0 +1,22 @@ + + + 4.0.0 + com.baeldung.pulsar + apache-pulsar + 0.0.1 + apache-pulsar + + + + org.apache.pulsar + pulsar-client + 2.1.1-incubating + compile + + + + 1.8 + 1.8 + + diff --git a/apache-pulsar/src/main/java/com/baeldung/ConsumerTest.java b/apache-pulsar/src/main/java/com/baeldung/ConsumerTest.java new file mode 100755 index 0000000000..72dc10b542 --- /dev/null +++ b/apache-pulsar/src/main/java/com/baeldung/ConsumerTest.java @@ -0,0 +1,48 @@ +package com.baeldung; + +import java.io.IOException; + +import org.apache.pulsar.client.api.Consumer; +import org.apache.pulsar.client.api.Message; +import org.apache.pulsar.client.api.PulsarClient; +import org.apache.pulsar.client.api.SubscriptionType; + +public class ConsumerTest { + + private static final String SERVICE_URL = "pulsar://localhost:6650"; + private static final String TOPIC_NAME = "test-topic"; + private static final String SUBSCRIPTION_NAME = "test-subscription"; + + public static void main(String[] args) throws IOException { + // Create a Pulsar client instance. A single instance can be shared across many + // producers and consumer within the same application + PulsarClient client = PulsarClient.builder() + .serviceUrl(SERVICE_URL) + .build(); + + //Configure consumer specific settings. + Consumer consumer = client.newConsumer() + .topic(TOPIC_NAME) + // Allow multiple consumers to attach to the same subscription + // and get messages dispatched as a queue + .subscriptionType(SubscriptionType.Shared) + .subscriptionName(SUBSCRIPTION_NAME) + .subscribe(); + + + // Once the consumer is created, it can be used for the entire application lifecycle + System.out.println("Created consumer for the topic "+ TOPIC_NAME); + + do { + // Wait until a message is available + Message msg = consumer.receive(); + + // Extract the message as a printable string and then log + String content = new String(msg.getData()); + System.out.println("Received message '"+content+"' with ID "+msg.getMessageId()); + + // Acknowledge processing of the message so that it can be deleted + consumer.acknowledge(msg); + } while (true); + } +} diff --git a/apache-pulsar/src/main/java/com/baeldung/ProducerTest.java b/apache-pulsar/src/main/java/com/baeldung/ProducerTest.java new file mode 100755 index 0000000000..08ee0e89b9 --- /dev/null +++ b/apache-pulsar/src/main/java/com/baeldung/ProducerTest.java @@ -0,0 +1,58 @@ +package com.baeldung; + +import org.apache.pulsar.client.api.CompressionType; +import org.apache.pulsar.client.api.Message; +import org.apache.pulsar.client.api.MessageBuilder; +import org.apache.pulsar.client.api.MessageId; +import org.apache.pulsar.client.api.Producer; +import org.apache.pulsar.client.api.PulsarClient; +import org.apache.pulsar.client.api.PulsarClientException; + +import java.io.IOException; +import java.util.stream.IntStream; + +public class ProducerTest { + + private static final String SERVICE_URL = "pulsar://localhost:6650"; + private static final String TOPIC_NAME = "test-topic"; + + public static void main(String[] args) throws IOException { + // Create a Pulsar client instance. A single instance can be shared across many + // producers and consumer within the same application + PulsarClient client = PulsarClient.builder() + .serviceUrl(SERVICE_URL) + .build(); + + // Configure producer specific settings + Producer producer = client.newProducer() + // Set the topic + .topic(TOPIC_NAME) + // Enable compression + .compressionType(CompressionType.LZ4) + .create(); + + // Once the producer is created, it can be used for the entire application life-cycle + System.out.println("Created producer for the topic "+TOPIC_NAME); + + // Send 5 test messages + IntStream.range(1, 5).forEach(i -> { + String content = String.format("hi-pulsar-%d", i); + + // Build a message object + Message msg = MessageBuilder.create() + .setContent(content.getBytes()) + .build(); + + // Send each message and log message content and ID when successfully received + try { + MessageId msgId = producer.send(msg); + + System.out.println("Published message '"+content+"' with the ID "+msgId); + } catch (PulsarClientException e) { + System.out.println(e.getMessage()); + } + }); + + client.close(); + } +} diff --git a/apache-pulsar/src/main/java/com/baeldung/subscriptions/ExclusiveSubscriptionTest.java b/apache-pulsar/src/main/java/com/baeldung/subscriptions/ExclusiveSubscriptionTest.java new file mode 100644 index 0000000000..efb898eaf4 --- /dev/null +++ b/apache-pulsar/src/main/java/com/baeldung/subscriptions/ExclusiveSubscriptionTest.java @@ -0,0 +1,59 @@ +package com.baeldung.subscriptions; + +import org.apache.pulsar.client.api.ConsumerBuilder; +import org.apache.pulsar.client.api.Message; +import org.apache.pulsar.client.api.MessageBuilder; +import org.apache.pulsar.client.api.Producer; +import org.apache.pulsar.client.api.PulsarClient; +import org.apache.pulsar.client.api.PulsarClientException; +import org.apache.pulsar.client.api.SubscriptionType; + +import java.util.stream.IntStream; + +public class ExclusiveSubscriptionTest { + private static final String SERVICE_URL = "pulsar://localhost:6650"; + private static final String TOPIC_NAME = "test-topic"; + private static final String SUBSCRIPTION_NAME = "test-subscription"; + private static final SubscriptionType SUBSCRIPTION_TYPE = SubscriptionType.Exclusive; + + public static void main(String[] args) throws PulsarClientException { + PulsarClient client = PulsarClient.builder() + .serviceUrl(SERVICE_URL) + .build(); + + Producer producer = client.newProducer() + .topic(TOPIC_NAME) + .create(); + + ConsumerBuilder consumer1 = client.newConsumer() + .topic(TOPIC_NAME) + .subscriptionName(SUBSCRIPTION_NAME) + .subscriptionType(SUBSCRIPTION_TYPE); + + ConsumerBuilder consumer2 = client.newConsumer() + .topic(TOPIC_NAME) + .subscriptionName(SUBSCRIPTION_NAME) + .subscriptionType(SUBSCRIPTION_TYPE); + + IntStream.range(0, 999).forEach(i -> { + Message msg = MessageBuilder.create() + .setContent(String.format("message-%d", i).getBytes()) + .build(); + try { + producer.send(msg); + } catch (PulsarClientException e) { + System.out.println(e.getMessage()); + } + }); + + // Consumer 1 can subscribe to the topic + consumer1.subscribe(); + + // Consumer 2 cannot due to the exclusive subscription held by consumer 1 + consumer2.subscribeAsync() + .handle((consumer, exception) -> { + System.out.println(exception.getMessage()); + return null; + }); + } +} diff --git a/apache-pulsar/src/main/java/com/baeldung/subscriptions/FailoverSubscriptionTest.java b/apache-pulsar/src/main/java/com/baeldung/subscriptions/FailoverSubscriptionTest.java new file mode 100644 index 0000000000..545661e0c3 --- /dev/null +++ b/apache-pulsar/src/main/java/com/baeldung/subscriptions/FailoverSubscriptionTest.java @@ -0,0 +1,76 @@ +package com.baeldung.subscriptions; + +import org.apache.pulsar.client.api.Consumer; +import org.apache.pulsar.client.api.ConsumerBuilder; +import org.apache.pulsar.client.api.Message; +import org.apache.pulsar.client.api.MessageBuilder; +import org.apache.pulsar.client.api.Producer; +import org.apache.pulsar.client.api.PulsarClient; +import org.apache.pulsar.client.api.PulsarClientException; +import org.apache.pulsar.client.api.SubscriptionType; + +import java.util.stream.IntStream; + +public class FailoverSubscriptionTest { + private static final String SERVICE_URL = "pulsar://localhost:6650"; + private static final String TOPIC_NAME = "failover-subscription-test-topic"; + private static final String SUBSCRIPTION_NAME = "test-subscription"; + private static final SubscriptionType SUBSCRIPTION_TYPE = SubscriptionType.Failover; + private static final int NUM_MSGS = 10; + + public static void main(String[] args) throws PulsarClientException { + PulsarClient client = PulsarClient.builder() + .serviceUrl(SERVICE_URL) + .build(); + + Producer producer = client.newProducer() + .topic(TOPIC_NAME) + .create(); + + ConsumerBuilder consumerBuilder = client.newConsumer() + .topic(TOPIC_NAME) + .subscriptionName(SUBSCRIPTION_NAME) + .subscriptionType(SUBSCRIPTION_TYPE); + + Consumer mainConsumer = consumerBuilder + .consumerName("consumer-a") + .messageListener((consumer, msg) -> { + System.out.println("Message received by main consumer"); + + try { + consumer.acknowledge(msg); + } catch (PulsarClientException e) { + System.out.println(e.getMessage()); + } + }) + .subscribe(); + + Consumer failoverConsumer = consumerBuilder + .consumerName("consumer-b") + .messageListener((consumer, msg) -> { + System.out.println("Message received by failover consumer"); + + try { + consumer.acknowledge(msg); + } catch (PulsarClientException e) { + System.out.println(e.getMessage()); + } + }) + .subscribe(); + + IntStream.range(0, NUM_MSGS).forEach(i -> { + Message msg = MessageBuilder.create() + .setContent(String.format("message-%d", i).getBytes()) + .build(); + try { + producer.send(msg); + + Thread.sleep(100); + + if (i > 5) mainConsumer.close(); + } catch (InterruptedException | PulsarClientException e) { + System.out.println(e.getMessage()); + } + }); + } +} diff --git a/apache-shiro/pom.xml b/apache-shiro/pom.xml index 98d9563284..644d70b30a 100644 --- a/apache-shiro/pom.xml +++ b/apache-shiro/pom.xml @@ -5,7 +5,8 @@ 4.0.0 apache-shiro 1.0-SNAPSHOT - + apache-shiro + parent-boot-1 com.baeldung diff --git a/apache-thrift/pom.xml b/apache-thrift/pom.xml index b22364cb19..ab54fc2cef 100644 --- a/apache-thrift/pom.xml +++ b/apache-thrift/pom.xml @@ -1,9 +1,9 @@ 4.0.0 - com.baeldung apache-thrift 0.0.1-SNAPSHOT + apache-thrift pom diff --git a/apache-tika/pom.xml b/apache-tika/pom.xml index 5a76fdeeda..0399914a5f 100644 --- a/apache-tika/pom.xml +++ b/apache-tika/pom.xml @@ -1,10 +1,10 @@ 4.0.0 - com.baeldung apache-tika 0.0.1-SNAPSHOT - + apache-tika + com.baeldung parent-modules diff --git a/apache-zookeeper/pom.xml b/apache-zookeeper/pom.xml index 0b29186ccc..53e4217358 100644 --- a/apache-zookeeper/pom.xml +++ b/apache-zookeeper/pom.xml @@ -1,9 +1,9 @@ 4.0.0 - com.baeldung apache-zookeeper 0.0.1-SNAPSHOT + apache-zookeeper jar diff --git a/asm/pom.xml b/asm/pom.xml index 5aad2a0e37..e56438c808 100644 --- a/asm/pom.xml +++ b/asm/pom.xml @@ -5,6 +5,7 @@ com.baeldung.examples asm 1.0 + asm jar diff --git a/atomix/pom.xml b/atomix/pom.xml index f85d2d7484..e50c1d867f 100644 --- a/atomix/pom.xml +++ b/atomix/pom.xml @@ -4,7 +4,8 @@ com.atomix.io atomix 0.0.1-SNAPSHOT - + atomix + com.baeldung parent-modules diff --git a/axon/pom.xml b/axon/pom.xml index 915a04feb5..c643ea9e57 100644 --- a/axon/pom.xml +++ b/axon/pom.xml @@ -3,7 +3,8 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 axon - + axon + parent-modules com.baeldung diff --git a/cas/cas-server/pom.xml b/cas/cas-server/pom.xml index 9b61aaec3d..98f5f10493 100644 --- a/cas/cas-server/pom.xml +++ b/cas/cas-server/pom.xml @@ -3,8 +3,9 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd "> 4.0.0 cas-server - war 1.0 + cas-server + war parent-boot-1 diff --git a/cdi-portable-extension/flyway-cdi/pom.xml b/cdi-portable-extension/flyway-cdi/pom.xml deleted file mode 100644 index 9fb781aaab..0000000000 --- a/cdi-portable-extension/flyway-cdi/pom.xml +++ /dev/null @@ -1,38 +0,0 @@ - - - 4.0.0 - - flyway-cdi - - - com.baeldung - cdi-portable-extension - 1.0-SNAPSHOT - - - - - javax.enterprise - cdi-api - 2.0.SP1 - - - org.flywaydb - flyway-core - 5.1.4 - - - org.apache.tomcat - tomcat-jdbc - 8.5.33 - - - javax.annotation - javax.annotation-api - 1.3.2 - - - - diff --git a/cdi-portable-extension/flyway-cdi/src/main/java/com/baeldung/cdi/extension/FlywayExtension.java b/cdi-portable-extension/flyway-cdi/src/main/java/com/baeldung/cdi/extension/FlywayExtension.java deleted file mode 100644 index a5019b82c1..0000000000 --- a/cdi-portable-extension/flyway-cdi/src/main/java/com/baeldung/cdi/extension/FlywayExtension.java +++ /dev/null @@ -1,74 +0,0 @@ -package com.baeldung.cdi.extension; - -import org.apache.tomcat.jdbc.pool.DataSource; -import org.flywaydb.core.Flyway; - -import javax.annotation.sql.DataSourceDefinition; -import javax.enterprise.context.ApplicationScoped; -import javax.enterprise.event.Observes; -import javax.enterprise.inject.Any; -import javax.enterprise.inject.Default; -import javax.enterprise.inject.literal.InjectLiteral; -import javax.enterprise.inject.spi.*; -import javax.enterprise.util.AnnotationLiteral; - - -/** - * Flyway is now under CDI container like: - * - * @ApplicationScoped - * @FlywayType public class Flyway{ - * @Inject setDataSource(DataSource dataSource){ - * //... - * } - * } - */ - -public class FlywayExtension implements Extension { - - DataSourceDefinition dataSourceDefinition = null; - - public void registerFlywayType(@Observes BeforeBeanDiscovery bbdEvent) { - bbdEvent.addAnnotatedType(Flyway.class, Flyway.class.getName()); - } - - public void detectDataSourceDefinition(@Observes @WithAnnotations(DataSourceDefinition.class) ProcessAnnotatedType patEvent) { - AnnotatedType at = patEvent.getAnnotatedType(); - dataSourceDefinition = at.getAnnotation(DataSourceDefinition.class); - } - - public void processAnnotatedType(@Observes ProcessAnnotatedType patEvent) { - patEvent.configureAnnotatedType() - //Add Scope - .add(ApplicationScoped.Literal.INSTANCE) - //Add Qualifier - .add(new AnnotationLiteral() { - }) - //Decorate setDataSource(DataSource dataSource){} with @Inject - .filterMethods(annotatedMethod -> { - return annotatedMethod.getParameters().size() == 1 && - annotatedMethod.getParameters().get(0).getBaseType().equals(javax.sql.DataSource.class); - }) - .findFirst().get().add(InjectLiteral.INSTANCE); - } - - void afterBeanDiscovery(@Observes AfterBeanDiscovery abdEvent, BeanManager bm) { - abdEvent.addBean() - .types(javax.sql.DataSource.class, DataSource.class) - .qualifiers(new AnnotationLiteral() {}, new AnnotationLiteral() {}) - .scope(ApplicationScoped.class) - .name(DataSource.class.getName()) - .beanClass(DataSource.class) - .createWith(creationalContext -> { - DataSource instance = new DataSource(); - instance.setUrl(dataSourceDefinition.url()); - instance.setDriverClassName(dataSourceDefinition.className()); - return instance; - }); - } - - void runFlywayMigration(@Observes AfterDeploymentValidation adv, BeanManager manager) { - Flyway flyway = manager.createInstance().select(Flyway.class, new AnnotationLiteral() {}).get(); - flyway.migrate(); - } -} diff --git a/cdi-portable-extension/flyway-cdi/src/main/java/com/baeldung/cdi/extension/FlywayType.java b/cdi-portable-extension/flyway-cdi/src/main/java/com/baeldung/cdi/extension/FlywayType.java deleted file mode 100644 index 7c3a5affa6..0000000000 --- a/cdi-portable-extension/flyway-cdi/src/main/java/com/baeldung/cdi/extension/FlywayType.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.baeldung.cdi.extension; - -import javax.inject.Qualifier; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -import static java.lang.annotation.ElementType.*; - -@Retention(RetentionPolicy.RUNTIME) -@Target({FIELD, METHOD, PARAMETER, TYPE}) -@Qualifier -public @interface FlywayType { -} \ No newline at end of file diff --git a/cdi-portable-extension/flyway-cdi/src/main/resources/META-INF/beans.xml b/cdi-portable-extension/flyway-cdi/src/main/resources/META-INF/beans.xml deleted file mode 100644 index 44959bfa99..0000000000 --- a/cdi-portable-extension/flyway-cdi/src/main/resources/META-INF/beans.xml +++ /dev/null @@ -1,6 +0,0 @@ - - \ No newline at end of file diff --git a/cdi-portable-extension/flyway-cdi/src/main/resources/META-INF/services/javax.enterprise.inject.spi.Extension b/cdi-portable-extension/flyway-cdi/src/main/resources/META-INF/services/javax.enterprise.inject.spi.Extension deleted file mode 100644 index a82dc47714..0000000000 --- a/cdi-portable-extension/flyway-cdi/src/main/resources/META-INF/services/javax.enterprise.inject.spi.Extension +++ /dev/null @@ -1,2 +0,0 @@ -com.baeldung.cdi.extension.FlywayExtension - diff --git a/cdi-portable-extension/main-app/pom.xml b/cdi-portable-extension/main-app/pom.xml deleted file mode 100644 index fab9b8bf07..0000000000 --- a/cdi-portable-extension/main-app/pom.xml +++ /dev/null @@ -1,52 +0,0 @@ - - - 4.0.0 - - main-app - jar - - - com.baeldung - cdi-portable-extension - 1.0-SNAPSHOT - - - - - - javax.enterprise - cdi-api - 2.0.SP1 - - - org.jboss.weld.se - weld-se-core - 3.0.5.Final - runtime - - - - com.baeldung - flyway-cdi - 1.0-SNAPSHOT - runtime - - - - com.h2database - h2 - 1.4.197 - runtime - - - - javax.annotation - javax.annotation-api - 1.3.2 - - - - - \ No newline at end of file diff --git a/cdi-portable-extension/main-app/src/main/java/com/baeldung/cdi/extension/MainApp.java b/cdi-portable-extension/main-app/src/main/java/com/baeldung/cdi/extension/MainApp.java deleted file mode 100644 index 1f6c5b43ba..0000000000 --- a/cdi-portable-extension/main-app/src/main/java/com/baeldung/cdi/extension/MainApp.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.baeldung.cdi.extension; - -import javax.annotation.sql.DataSourceDefinition; -import javax.enterprise.context.ApplicationScoped; -import javax.enterprise.inject.se.SeContainer; -import javax.enterprise.inject.se.SeContainerInitializer; - -@ApplicationScoped -@DataSourceDefinition(name = "ds", className = "org.h2.Driver", url = "jdbc:h2:mem:testdb") -public class MainApp { - public static void main(String[] args) { - SeContainerInitializer initializer = SeContainerInitializer.newInstance(); - try (SeContainer container = initializer.initialize()) { - } - } -} \ No newline at end of file diff --git a/cdi-portable-extension/main-app/src/main/resources/META-INF/beans.xml b/cdi-portable-extension/main-app/src/main/resources/META-INF/beans.xml deleted file mode 100644 index 44959bfa99..0000000000 --- a/cdi-portable-extension/main-app/src/main/resources/META-INF/beans.xml +++ /dev/null @@ -1,6 +0,0 @@ - - \ No newline at end of file diff --git a/cdi-portable-extension/main-app/src/main/resources/db/migration/V1__Create_person_table.sql b/cdi-portable-extension/main-app/src/main/resources/db/migration/V1__Create_person_table.sql deleted file mode 100644 index 6bddc7689e..0000000000 --- a/cdi-portable-extension/main-app/src/main/resources/db/migration/V1__Create_person_table.sql +++ /dev/null @@ -1,4 +0,0 @@ -create table PERSON ( - ID int not null, - NAME varchar(100) not null -); diff --git a/cdi-portable-extension/main-app/src/main/resources/db/migration/V2__Add_people.sql b/cdi-portable-extension/main-app/src/main/resources/db/migration/V2__Add_people.sql deleted file mode 100644 index d8f1d62667..0000000000 --- a/cdi-portable-extension/main-app/src/main/resources/db/migration/V2__Add_people.sql +++ /dev/null @@ -1,3 +0,0 @@ -insert into PERSON (ID, NAME) values (1, 'Axel'); -insert into PERSON (ID, NAME) values (2, 'Mr. Foo'); -insert into PERSON (ID, NAME) values (3, 'Ms. Bar'); diff --git a/cdi-portable-extension/pom.xml b/cdi-portable-extension/pom.xml deleted file mode 100644 index 66913de84d..0000000000 --- a/cdi-portable-extension/pom.xml +++ /dev/null @@ -1,30 +0,0 @@ - - - 4.0.0 - - com.baeldung - cdi-portable-extension - 1.0-SNAPSHOT - pom - - - 1.8 - 1.8 - - - - main-app - flyway-cdi - - - - - javax.enterprise - cdi-api - 2.0.SP1 - - - - \ No newline at end of file diff --git a/cdi/README.md b/cdi/README.md index 0477ce85bd..bfb635be9e 100644 --- a/cdi/README.md +++ b/cdi/README.md @@ -1,3 +1,5 @@ ### Relevant Articles: - [CDI Interceptor vs Spring AspectJ](http://www.baeldung.com/cdi-interceptor-vs-spring-aspectj) - [An Introduction to CDI (Contexts and Dependency Injection) in Java](http://www.baeldung.com/java-ee-cdi) +- [Introduction to the Event Notification Model in CDI 2.0](https://www.baeldung.com/cdi-event-notification) + diff --git a/cdi/pom.xml b/cdi/pom.xml index 2c719c1d7f..0cf5062ccc 100644 --- a/cdi/pom.xml +++ b/cdi/pom.xml @@ -2,10 +2,10 @@ 4.0.0 - com.baeldung cdi 1.0-SNAPSHOT - + cdi + com.baeldung parent-spring-4 @@ -14,6 +14,16 @@ + + javax.enterprise + cdi-api + ${cdi-api.version} + + + org.jboss.weld.se + weld-se-core + ${weld-se-core.version} + org.hamcrest hamcrest-core @@ -42,11 +52,6 @@ aspectjweaver ${aspectjweaver.version} - - org.jboss.weld.se - weld-se-core - ${weld-se-core.version} - org.springframework spring-test @@ -54,13 +59,13 @@ test - - 1.8.9 - 2.4.1.Final + 2.0.SP1 + 3.0.5.Final + 1.9.2 1.3 3.10.0 4.12 + 5.1.2.RELEASE - diff --git a/cdi/src/main/java/com/baeldung/cdi2observers/application/BootstrappingApplication.java b/cdi/src/main/java/com/baeldung/cdi2observers/application/BootstrappingApplication.java new file mode 100644 index 0000000000..4896408502 --- /dev/null +++ b/cdi/src/main/java/com/baeldung/cdi2observers/application/BootstrappingApplication.java @@ -0,0 +1,15 @@ +package com.baeldung.cdi.cdi2observers.application; + +import com.baeldung.cdi.cdi2observers.events.ExampleEvent; +import javax.enterprise.inject.se.SeContainer; +import javax.enterprise.inject.se.SeContainerInitializer; + +public class BootstrappingApplication { + + public static void main(String... args) { + SeContainerInitializer containerInitializer = SeContainerInitializer.newInstance(); + try (SeContainer container = containerInitializer.initialize()) { + container.getBeanManager().fireEvent(new ExampleEvent("Welcome to Baeldung!")); + } + } +} diff --git a/cdi/src/main/java/com/baeldung/cdi2observers/events/ExampleEvent.java b/cdi/src/main/java/com/baeldung/cdi2observers/events/ExampleEvent.java new file mode 100644 index 0000000000..a2329d2ef1 --- /dev/null +++ b/cdi/src/main/java/com/baeldung/cdi2observers/events/ExampleEvent.java @@ -0,0 +1,14 @@ +package com.baeldung.cdi.cdi2observers.events; + +public class ExampleEvent { + + private final String eventMessage; + + public ExampleEvent(String eventMessage) { + this.eventMessage = eventMessage; + } + + public String getEventMessage() { + return eventMessage; + } +} diff --git a/cdi/src/main/java/com/baeldung/cdi2observers/events/ExampleEventSource.java b/cdi/src/main/java/com/baeldung/cdi2observers/events/ExampleEventSource.java new file mode 100644 index 0000000000..f37030778a --- /dev/null +++ b/cdi/src/main/java/com/baeldung/cdi2observers/events/ExampleEventSource.java @@ -0,0 +1,14 @@ +package com.baeldung.cdi.cdi2observers.events; + +import javax.enterprise.event.Event; +import javax.inject.Inject; + +public class ExampleEventSource { + + @Inject + Event exampleEvent; + + public void fireEvent() { + exampleEvent.fireAsync(new ExampleEvent("Welcome to Baeldung!")); + } +} diff --git a/cdi/src/main/java/com/baeldung/cdi2observers/observers/AnotherExampleEventObserver.java b/cdi/src/main/java/com/baeldung/cdi2observers/observers/AnotherExampleEventObserver.java new file mode 100644 index 0000000000..34520c2b3d --- /dev/null +++ b/cdi/src/main/java/com/baeldung/cdi2observers/observers/AnotherExampleEventObserver.java @@ -0,0 +1,12 @@ +package com.baeldung.cdi.cdi2observers.observers; + +import com.baeldung.cdi.cdi2observers.events.ExampleEvent; +import javax.annotation.Priority; +import javax.enterprise.event.Observes; + +public class AnotherExampleEventObserver { + + public String onEvent(@Observes @Priority(2) ExampleEvent event) { + return event.getEventMessage(); + } +} diff --git a/cdi/src/main/java/com/baeldung/cdi2observers/observers/ExampleEventObserver.java b/cdi/src/main/java/com/baeldung/cdi2observers/observers/ExampleEventObserver.java new file mode 100644 index 0000000000..b3522b2ad0 --- /dev/null +++ b/cdi/src/main/java/com/baeldung/cdi2observers/observers/ExampleEventObserver.java @@ -0,0 +1,13 @@ +package com.baeldung.cdi.cdi2observers.observers; + +import com.baeldung.cdi.cdi2observers.events.ExampleEvent; +import com.baeldung.cdi.cdi2observers.services.TextService; +import javax.annotation.Priority; +import javax.enterprise.event.Observes; + +public class ExampleEventObserver { + + public String onEvent(@Observes @Priority(1) ExampleEvent event, TextService textService) { + return textService.parseText(event.getEventMessage()); + } +} diff --git a/cdi/src/main/java/com/baeldung/cdi2observers/services/TextService.java b/cdi/src/main/java/com/baeldung/cdi2observers/services/TextService.java new file mode 100644 index 0000000000..47788a0657 --- /dev/null +++ b/cdi/src/main/java/com/baeldung/cdi2observers/services/TextService.java @@ -0,0 +1,8 @@ +package com.baeldung.cdi.cdi2observers.services; + +public class TextService { + + public String parseText(String text) { + return text.toUpperCase(); + } +} diff --git a/cdi/src/test/java/com/baeldung/test/cdi2observers/tests/TextServiceUnitTest.java b/cdi/src/test/java/com/baeldung/test/cdi2observers/tests/TextServiceUnitTest.java new file mode 100644 index 0000000000..deecf13f9a --- /dev/null +++ b/cdi/src/test/java/com/baeldung/test/cdi2observers/tests/TextServiceUnitTest.java @@ -0,0 +1,14 @@ +package com.baeldung.cdi.cdi2observers.tests; + +import com.baeldung.cdi.cdi2observers.services.TextService; +import static org.assertj.core.api.Assertions.assertThat; +import org.junit.Test; + +public class TextServiceUnitTest { + + @Test + public void givenTextServiceInstance_whenCalledparseText_thenCorrect() { + TextService textService = new TextService(); + assertThat(textService.parseText("Baeldung")).isEqualTo("BAELDUNG"); + } +} diff --git a/core-groovy/pom.xml b/core-groovy/pom.xml index 909250710e..e54c766280 100644 --- a/core-groovy/pom.xml +++ b/core-groovy/pom.xml @@ -4,6 +4,7 @@ 4.0.0 core-groovy 1.0-SNAPSHOT + core-groovy jar diff --git a/core-java-10/README.md b/core-java-10/README.md index 84fa381a26..f0a25712a7 100644 --- a/core-java-10/README.md +++ b/core-java-10/README.md @@ -4,3 +4,4 @@ - [Java 10 LocalVariable Type-Inference](http://www.baeldung.com/java-10-local-variable-type-inference) - [Guide to Java 10](http://www.baeldung.com/java-10-overview) - [Copy a List to Another List in Java](http://www.baeldung.com/java-copy-list-to-another) +- [Deep Dive Into the New Java JIT Compiler – Graal](https://www.baeldung.com/graal-java-jit-compiler) diff --git a/core-java-10/src/main/java/com/baeldung/graal/CountUppercase.java b/core-java-10/src/main/java/com/baeldung/graal/CountUppercase.java new file mode 100644 index 0000000000..4cad9cb965 --- /dev/null +++ b/core-java-10/src/main/java/com/baeldung/graal/CountUppercase.java @@ -0,0 +1,25 @@ +package com.baeldung.graal; + +public class CountUppercase { + static final int ITERATIONS = Math.max(Integer.getInteger("iterations", 1), 1); + + public static void main(String[] args) { + String sentence = String.join(" ", args); + for (int iter = 0; iter < ITERATIONS; iter++) { + if (ITERATIONS != 1) System.out.println("-- iteration " + (iter + 1) + " --"); + long total = 0, start = System.currentTimeMillis(), last = start; + for (int i = 1; i < 10_000_000; i++) { + total += sentence + .chars() + .filter(Character::isUpperCase) + .count(); + if (i % 1_000_000 == 0) { + long now = System.currentTimeMillis(); + System.out.printf("%d (%d ms)%n", i / 1_000_000, now - last); + last = now; + } + } + System.out.printf("total: %d (%d ms)%n", total, System.currentTimeMillis() - start); + } + } +} diff --git a/core-java-8/README.md b/core-java-8/README.md index 64d423aafe..6786b29120 100644 --- a/core-java-8/README.md +++ b/core-java-8/README.md @@ -32,3 +32,5 @@ - [Set the Time Zone of a Date in Java](https://www.baeldung.com/java-set-date-time-zone) - [An Overview of Regular Expressions Performance in Java](https://www.baeldung.com/java-regex-performance) - [Java Primitives versus Objects](https://www.baeldung.com/java-primitives-vs-objects) +- [How to Use if/else Logic in Java 8 Streams](https://www.baeldung.com/java-8-streams-if-else-logic) +- [How to Replace Many if Statements in Java](https://www.baeldung.com/java-replace-if-statements) diff --git a/core-java-8/src/main/java/com/baeldung/reducingIfElse/AddCommand.java b/core-java-8/src/main/java/com/baeldung/reducingIfElse/AddCommand.java new file mode 100644 index 0000000000..279a3b2c55 --- /dev/null +++ b/core-java-8/src/main/java/com/baeldung/reducingIfElse/AddCommand.java @@ -0,0 +1,17 @@ +package com.baeldung.reducingIfElse; + +public class AddCommand implements Command { + + private int a; + private int b; + + public AddCommand(int a, int b) { + this.a = a; + this.b = b; + } + + @Override + public Integer execute() { + return a + b; + } +} diff --git a/core-java-8/src/main/java/com/baeldung/reducingIfElse/AddRule.java b/core-java-8/src/main/java/com/baeldung/reducingIfElse/AddRule.java new file mode 100644 index 0000000000..f24c973ead --- /dev/null +++ b/core-java-8/src/main/java/com/baeldung/reducingIfElse/AddRule.java @@ -0,0 +1,21 @@ +package com.baeldung.reducingIfElse; + +public class AddRule implements Rule { + + private int result; + + @Override + public boolean evaluate(Expression expression) { + boolean evalResult = false; + if (expression.getOperator() == Operator.ADD) { + this.result = expression.getX() + expression.getY(); + evalResult = true; + } + return evalResult; + } + + @Override + public Result getResult() { + return new Result(result); + } +} diff --git a/core-java-8/src/main/java/com/baeldung/reducingIfElse/Addition.java b/core-java-8/src/main/java/com/baeldung/reducingIfElse/Addition.java new file mode 100644 index 0000000000..3174ea558c --- /dev/null +++ b/core-java-8/src/main/java/com/baeldung/reducingIfElse/Addition.java @@ -0,0 +1,8 @@ +package com.baeldung.reducingIfElse; + +public class Addition implements Operation { + @Override + public int apply(int a, int b) { + return a + b; + } +} diff --git a/core-java-8/src/main/java/com/baeldung/reducingIfElse/Calculator.java b/core-java-8/src/main/java/com/baeldung/reducingIfElse/Calculator.java new file mode 100644 index 0000000000..550d92e183 --- /dev/null +++ b/core-java-8/src/main/java/com/baeldung/reducingIfElse/Calculator.java @@ -0,0 +1,83 @@ +package com.baeldung.reducingIfElse; + +public class Calculator { + + public int calculate(int a, int b, String operator) { + int result = Integer.MIN_VALUE; + + if ("add".equals(operator)) { + result = a + b; + } else if ("multiply".equals(operator)) { + result = a * b; + } else if ("divide".equals(operator)) { + result = a / b; + } else if ("subtract".equals(operator)) { + result = a - b; + } else if ("modulo".equals(operator)) { + result = a % b; + } + return result; + } + + public int calculateUsingSwitch(int a, int b, String operator) { + int result = 0; + switch (operator) { + case "add": + result = a + b; + break; + case "multiply": + result = a * b; + break; + case "divide": + result = a / b; + break; + case "subtract": + result = a - b; + break; + case "modulo": + result = a % b; + break; + default: + result = Integer.MIN_VALUE; + } + return result; + } + + public int calculateUsingSwitch(int a, int b, Operator operator) { + int result = 0; + switch (operator) { + case ADD: + result = a + b; + break; + case MULTIPLY: + result = a * b; + break; + case DIVIDE: + result = a / b; + break; + case SUBTRACT: + result = a - b; + break; + case MODULO: + result = a % b; + break; + default: + result = Integer.MIN_VALUE; + } + return result; + } + + public int calculate(int a, int b, Operator operator) { + return operator.apply(a, b); + } + + public int calculateUsingFactory(int a, int b, String operation) { + Operation targetOperation = OperatorFactory.getOperation(operation) + .orElseThrow(() -> new IllegalArgumentException("Invalid Operator")); + return targetOperation.apply(a, b); + } + + public int calculate(Command command) { + return command.execute(); + } +} diff --git a/core-java-8/src/main/java/com/baeldung/reducingIfElse/Command.java b/core-java-8/src/main/java/com/baeldung/reducingIfElse/Command.java new file mode 100644 index 0000000000..c084fcc6a0 --- /dev/null +++ b/core-java-8/src/main/java/com/baeldung/reducingIfElse/Command.java @@ -0,0 +1,5 @@ +package com.baeldung.reducingIfElse; + +public interface Command { + Integer execute(); +} \ No newline at end of file diff --git a/core-java-8/src/main/java/com/baeldung/reducingIfElse/Division.java b/core-java-8/src/main/java/com/baeldung/reducingIfElse/Division.java new file mode 100644 index 0000000000..75b1297655 --- /dev/null +++ b/core-java-8/src/main/java/com/baeldung/reducingIfElse/Division.java @@ -0,0 +1,7 @@ +package com.baeldung.reducingIfElse; + +public class Division implements Operation { + @Override public int apply(int a, int b) { + return a / b; + } +} diff --git a/core-java-8/src/main/java/com/baeldung/reducingIfElse/Expression.java b/core-java-8/src/main/java/com/baeldung/reducingIfElse/Expression.java new file mode 100644 index 0000000000..4d3fe1b824 --- /dev/null +++ b/core-java-8/src/main/java/com/baeldung/reducingIfElse/Expression.java @@ -0,0 +1,26 @@ +package com.baeldung.reducingIfElse; + +public class Expression { + + private Integer x; + private Integer y; + private Operator operator; + + public Expression(Integer x, Integer y, Operator operator) { + this.x = x; + this.y = y; + this.operator = operator; + } + + public Integer getX() { + return x; + } + + public Integer getY() { + return y; + } + + public Operator getOperator() { + return operator; + } +} diff --git a/core-java-8/src/main/java/com/baeldung/reducingIfElse/Modulo.java b/core-java-8/src/main/java/com/baeldung/reducingIfElse/Modulo.java new file mode 100644 index 0000000000..a7a081704c --- /dev/null +++ b/core-java-8/src/main/java/com/baeldung/reducingIfElse/Modulo.java @@ -0,0 +1,7 @@ +package com.baeldung.reducingIfElse; + +public class Modulo implements Operation { + @Override public int apply(int a, int b) { + return a % b; + } +} diff --git a/core-java-8/src/main/java/com/baeldung/reducingIfElse/Multiplication.java b/core-java-8/src/main/java/com/baeldung/reducingIfElse/Multiplication.java new file mode 100644 index 0000000000..e1a39b33c4 --- /dev/null +++ b/core-java-8/src/main/java/com/baeldung/reducingIfElse/Multiplication.java @@ -0,0 +1,7 @@ +package com.baeldung.reducingIfElse; + +public class Multiplication implements Operation { + @Override public int apply(int a, int b) { + return 0; + } +} diff --git a/core-java-8/src/main/java/com/baeldung/reducingIfElse/Operation.java b/core-java-8/src/main/java/com/baeldung/reducingIfElse/Operation.java new file mode 100644 index 0000000000..41241fa810 --- /dev/null +++ b/core-java-8/src/main/java/com/baeldung/reducingIfElse/Operation.java @@ -0,0 +1,5 @@ +package com.baeldung.reducingIfElse; + +public interface Operation { + int apply(int a, int b); +} diff --git a/core-java-8/src/main/java/com/baeldung/reducingIfElse/Operator.java b/core-java-8/src/main/java/com/baeldung/reducingIfElse/Operator.java new file mode 100644 index 0000000000..831b8fa146 --- /dev/null +++ b/core-java-8/src/main/java/com/baeldung/reducingIfElse/Operator.java @@ -0,0 +1,41 @@ +package com.baeldung.reducingIfElse; + +public enum Operator { + + ADD { + @Override + public int apply(int a, int b) { + return a + b; + } + }, + + MULTIPLY { + @Override + public int apply(int a, int b) { + return a * b; + } + }, + + SUBTRACT { + @Override + public int apply(int a, int b) { + return a - b; + } + }, + + DIVIDE { + @Override + public int apply(int a, int b) { + return a / b; + } + }, + + MODULO { + @Override + public int apply(int a, int b) { + return a % b; + } + }; + + public abstract int apply(int a, int b); +} diff --git a/core-java-8/src/main/java/com/baeldung/reducingIfElse/OperatorFactory.java b/core-java-8/src/main/java/com/baeldung/reducingIfElse/OperatorFactory.java new file mode 100644 index 0000000000..18ed63adbd --- /dev/null +++ b/core-java-8/src/main/java/com/baeldung/reducingIfElse/OperatorFactory.java @@ -0,0 +1,21 @@ +package com.baeldung.reducingIfElse; + +import java.util.HashMap; +import java.util.Map; +import java.util.Optional; + +public class OperatorFactory { + + static Map operationMap = new HashMap<>(); + static { + operationMap.put("add", new Addition()); + operationMap.put("divide", new Division()); + operationMap.put("multiply", new Multiplication()); + operationMap.put("subtract", new Subtraction()); + operationMap.put("modulo", new Modulo()); + } + + public static Optional getOperation(String operation) { + return Optional.ofNullable(operationMap.get(operation)); + } +} diff --git a/core-java-8/src/main/java/com/baeldung/reducingIfElse/Result.java b/core-java-8/src/main/java/com/baeldung/reducingIfElse/Result.java new file mode 100644 index 0000000000..d5ed12202e --- /dev/null +++ b/core-java-8/src/main/java/com/baeldung/reducingIfElse/Result.java @@ -0,0 +1,13 @@ +package com.baeldung.reducingIfElse; + +public class Result { + int value; + + public Result(int value) { + this.value = value; + } + + public int getValue() { + return value; + } +} diff --git a/core-java-8/src/main/java/com/baeldung/reducingIfElse/Rule.java b/core-java-8/src/main/java/com/baeldung/reducingIfElse/Rule.java new file mode 100644 index 0000000000..5a6c84b0f9 --- /dev/null +++ b/core-java-8/src/main/java/com/baeldung/reducingIfElse/Rule.java @@ -0,0 +1,8 @@ +package com.baeldung.reducingIfElse; + +public interface Rule { + + boolean evaluate(Expression expression); + + Result getResult(); +} diff --git a/core-java-8/src/main/java/com/baeldung/reducingIfElse/RuleEngine.java b/core-java-8/src/main/java/com/baeldung/reducingIfElse/RuleEngine.java new file mode 100644 index 0000000000..ac56915dee --- /dev/null +++ b/core-java-8/src/main/java/com/baeldung/reducingIfElse/RuleEngine.java @@ -0,0 +1,24 @@ +package com.baeldung.reducingIfElse; + +import java.util.ArrayList; +import java.util.List; +import java.util.Optional; +import java.util.stream.Collectors; + +public class RuleEngine { + + private static List rules = new ArrayList<>(); + + static { + rules.add(new AddRule()); + } + + public Result process(Expression expression) { + + Rule rule = rules.stream() + .filter(r -> r.evaluate(expression)) + .findFirst() + .orElseThrow(() -> new IllegalArgumentException("Expression does not matches any Rule")); + return rule.getResult(); + } +} diff --git a/core-java-8/src/main/java/com/baeldung/reducingIfElse/Subtraction.java b/core-java-8/src/main/java/com/baeldung/reducingIfElse/Subtraction.java new file mode 100644 index 0000000000..948998810e --- /dev/null +++ b/core-java-8/src/main/java/com/baeldung/reducingIfElse/Subtraction.java @@ -0,0 +1,7 @@ +package com.baeldung.reducingIfElse; + +public class Subtraction implements Operation { + @Override public int apply(int a, int b) { + return a - b; + } +} diff --git a/core-java-8/src/test/java/com/baeldung/java8/Java8ForEachUnitTest.java b/core-java-8/src/test/java/com/baeldung/java8/Java8ForEachUnitTest.java index 6a485e939f..f5201f54cf 100644 --- a/core-java-8/src/test/java/com/baeldung/java8/Java8ForEachUnitTest.java +++ b/core-java-8/src/test/java/com/baeldung/java8/Java8ForEachUnitTest.java @@ -1,13 +1,20 @@ package com.baeldung.java8; +import java.util.ArrayDeque; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Queue; +import java.util.Set; +import java.util.function.Consumer; + import org.junit.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.util.ArrayList; -import java.util.List; -import java.util.function.Consumer; - public class Java8ForEachUnitTest { private static final Logger LOG = LoggerFactory.getLogger(Java8ForEachUnitTest.class); @@ -29,8 +36,18 @@ public class Java8ForEachUnitTest { } // Java 8 - forEach - LOG.debug("--- forEach method ---"); - names.forEach(name -> LOG.debug(name)); + names.forEach(name -> { + System.out.println(name); + }); + + LOG.debug("--- Print Consumer ---"); + Consumer printConsumer = new Consumer() { + public void accept(String name) { + System.out.println(name); + }; + }; + + names.forEach(printConsumer); // Anonymous inner class that implements Consumer interface LOG.debug("--- Anonymous inner class ---"); @@ -40,17 +57,55 @@ public class Java8ForEachUnitTest { } }); - // Create a Consumer implementation to then use in a forEach method - Consumer consumerNames = name -> { - LOG.debug(name); - }; - LOG.debug("--- Implementation of Consumer interface ---"); - names.forEach(consumerNames); + // Java 8 - forEach - Lambda Syntax + LOG.debug("--- forEach method ---"); + names.forEach(name -> LOG.debug(name)); - // Print elements using a Method Reference + // Java 8 - forEach - Print elements using a Method Reference LOG.debug("--- Method Reference ---"); names.forEach(LOG::debug); + } + @Test + public void givenList_thenIterateAndPrintResults() { + List names = Arrays.asList("Larry", "Steve", "James"); + + names.forEach(System.out::println); + } + + @Test + public void givenSet_thenIterateAndPrintResults() { + Set uniqueNames = new HashSet<>(Arrays.asList("Larry", "Steve", "James")); + + uniqueNames.forEach(System.out::println); + } + + @Test + public void givenQueue_thenIterateAndPrintResults() { + Queue namesQueue = new ArrayDeque<>(Arrays.asList("Larry", "Steve", "James")); + + namesQueue.forEach(System.out::println); + } + + @Test + public void givenMap_thenIterateAndPrintResults() { + Map namesMap = new HashMap<>(); + namesMap.put(1, "Larry"); + namesMap.put(2, "Steve"); + namesMap.put(3, "James"); + + namesMap.entrySet() + .forEach(entry -> System.out.println(entry.getKey() + " " + entry.getValue())); + } + + @Test + public void givenMap_whenUsingBiConsumer_thenIterateAndPrintResults2() { + Map namesMap = new HashMap<>(); + namesMap.put(1, "Larry"); + namesMap.put(2, "Steve"); + namesMap.put(3, "James"); + + namesMap.forEach((key, value) -> System.out.println(key + " " + value)); } } diff --git a/core-java-8/src/test/java/com/baeldung/reduceIfelse/CalculatorUnitTest.java b/core-java-8/src/test/java/com/baeldung/reduceIfelse/CalculatorUnitTest.java new file mode 100644 index 0000000000..fa351930d8 --- /dev/null +++ b/core-java-8/src/test/java/com/baeldung/reduceIfelse/CalculatorUnitTest.java @@ -0,0 +1,32 @@ +package com.baeldung.reduceIfelse; + +import com.baeldung.reducingIfElse.AddCommand; +import com.baeldung.reducingIfElse.Calculator; +import com.baeldung.reducingIfElse.Operator; +import org.junit.Test; + +import static org.junit.Assert.assertEquals; + +public class CalculatorUnitTest { + + @Test + public void whenCalculateUsingStringOperator_thenReturnCorrectResult() { + Calculator calculator = new Calculator(); + int result = calculator.calculate(3, 4, "add"); + assertEquals(7, result); + } + + @Test + public void whenCalculateUsingEnumOperator_thenReturnCorrectResult() { + Calculator calculator = new Calculator(); + int result = calculator.calculate(3, 4, Operator.valueOf("ADD")); + assertEquals(7, result); + } + + @Test + public void whenCalculateUsingCommand_thenReturnCorrectResult() { + Calculator calculator = new Calculator(); + int result = calculator.calculate(new AddCommand(3, 7)); + assertEquals(10, result); + } +} diff --git a/core-java-8/src/test/java/com/baeldung/reduceIfelse/RuleEngineUnitTest.java b/core-java-8/src/test/java/com/baeldung/reduceIfelse/RuleEngineUnitTest.java new file mode 100644 index 0000000000..4a30b3efac --- /dev/null +++ b/core-java-8/src/test/java/com/baeldung/reduceIfelse/RuleEngineUnitTest.java @@ -0,0 +1,23 @@ +package com.baeldung.reduceIfelse; + +import com.baeldung.reducingIfElse.Expression; +import com.baeldung.reducingIfElse.Operator; +import com.baeldung.reducingIfElse.Result; +import com.baeldung.reducingIfElse.RuleEngine; +import org.junit.Test; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; + +public class RuleEngineUnitTest { + + @Test + public void whenNumbersGivenToRuleEngine_thenReturnCorrectResult() { + Expression expression = new Expression(5, 5, Operator.ADD); + RuleEngine engine = new RuleEngine(); + Result result = engine.process(expression); + + assertNotNull(result); + assertEquals(10, result.getValue()); + } +} diff --git a/core-java-9/pom.xml b/core-java-9/pom.xml index f22d0a3ed9..cd1fa74dbb 100644 --- a/core-java-9/pom.xml +++ b/core-java-9/pom.xml @@ -1,7 +1,6 @@ 4.0.0 - com.baeldung core-java-9 0.2-SNAPSHOT core-java-9 diff --git a/core-java-arrays/.gitignore b/core-java-arrays/.gitignore new file mode 100644 index 0000000000..374c8bf907 --- /dev/null +++ b/core-java-arrays/.gitignore @@ -0,0 +1,25 @@ +*.class + +0.* + +#folders# +/target +/neoDb* +/data +/src/main/webapp/WEB-INF/classes +*/META-INF/* +.resourceCache + +# Packaged files # +*.jar +*.war +*.ear + +# Files generated by integration tests +backup-pom.xml +/bin/ +/temp + +#IntelliJ specific +.idea/ +*.iml \ No newline at end of file diff --git a/core-java-arrays/README.md b/core-java-arrays/README.md new file mode 100644 index 0000000000..56110585ac --- /dev/null +++ b/core-java-arrays/README.md @@ -0,0 +1,15 @@ +========= + +## Core Java Arrays Cookbooks and Examples + +### Relevant Articles: +- [How to Copy an Array in Java](http://www.baeldung.com/java-array-copy) +- [Check if a Java Array Contains a Value](http://www.baeldung.com/java-array-contains-value) +- [Initializing Arrays in Java](http://www.baeldung.com/java-initialize-array) +- [Guide to the java.util.Arrays Class](http://www.baeldung.com/java-util-arrays) +- [Jagged Arrays In Java](http://www.baeldung.com/java-jagged-arrays) +- [Find Sum and Average in a Java Array](http://www.baeldung.com/java-array-sum-average) +- [Arrays in Java: A Reference Guide](https://www.baeldung.com/java-arrays-guide) +- [How to Invert an Array in Java](http://www.baeldung.com/java-invert-array) +- [Array Operations in Java](http://www.baeldung.com/java-common-array-operations) +- [Intersection Between two Integer Arrays](https://www.baeldung.com/java-array-intersection) diff --git a/core-java-arrays/pom.xml b/core-java-arrays/pom.xml new file mode 100644 index 0000000000..d2d0453e87 --- /dev/null +++ b/core-java-arrays/pom.xml @@ -0,0 +1,412 @@ + + 4.0.0 + com.baeldung + core-java-arrays + 0.1.0-SNAPSHOT + jar + core-java-arrays + + + com.baeldung + parent-java + 0.0.1-SNAPSHOT + ../parent-java + + + + + org.apache.commons + commons-lang3 + ${commons-lang3.version} + + + log4j + log4j + ${log4j.version} + + + org.slf4j + log4j-over-slf4j + ${org.slf4j.version} + + + + org.assertj + assertj-core + ${assertj-core.version} + test + + + org.openjdk.jmh + jmh-core + ${jmh-core.version} + + + org.openjdk.jmh + jmh-generator-annprocess + ${jmh-generator-annprocess.version} + + + org.springframework + spring-web + ${springframework.spring-web.version} + + + + + core-java-arrays + + + src/main/resources + true + + + + + + org.apache.maven.plugins + maven-surefire-plugin + + + **/*LiveTest.java + **/*IntegrationTest.java + **/*IntTest.java + **/*LongRunningUnitTest.java + **/*ManualTest.java + + true + + + + + org.apache.maven.plugins + maven-dependency-plugin + + + copy-dependencies + prepare-package + + copy-dependencies + + + ${project.build.directory}/libs + + + + + + + org.apache.maven.plugins + maven-jar-plugin + ${maven-jar-plugin.version} + + + + true + libs/ + org.baeldung.executable.ExecutableMavenJar + + + + + + + org.apache.maven.plugins + maven-assembly-plugin + + + package + + single + + + ${project.basedir} + + + org.baeldung.executable.ExecutableMavenJar + + + + jar-with-dependencies + + + + + + + + org.apache.maven.plugins + maven-shade-plugin + ${maven-shade-plugin.version} + + + + shade + + + true + + + org.baeldung.executable.ExecutableMavenJar + + + + + + + + + com.jolira + onejar-maven-plugin + ${onejar-maven-plugin.version} + + + + org.baeldung.executable.ExecutableMavenJar + true + ${project.build.finalName}-onejar.${project.packaging} + + + one-jar + + + + + + + org.springframework.boot + spring-boot-maven-plugin + ${spring-boot-maven-plugin.version} + + + + repackage + + + spring-boot + org.baeldung.executable.ExecutableMavenJar + + + + + + + org.codehaus.mojo + exec-maven-plugin + ${exec-maven-plugin.version} + + java + com.baeldung.outofmemoryerror.OutOfMemoryGCLimitExceed + + -Xmx300m + -XX:+UseParallelGC + -classpath + + com.baeldung.outofmemoryerror.OutOfMemoryGCLimitExceed + + + + + + org.apache.maven.plugins + maven-javadoc-plugin + ${maven-javadoc-plugin.version} + + 1.8 + 1.8 + + + + + + + + integration + + + + org.apache.maven.plugins + maven-surefire-plugin + + + integration-test + + test + + + + **/*ManualTest.java + + + **/*IntegrationTest.java + **/*IntTest.java + + + + + + + json + + + + + org.codehaus.mojo + exec-maven-plugin + ${exec-maven-plugin.version} + + + run-benchmarks + + none + + exec + + + test + java + + -classpath + + org.openjdk.jmh.Main + .* + + + + + + + + + + + + buildAgentLoader + + + + org.apache.maven.plugins + maven-jar-plugin + + + package + + jar + + + agentLoader + target/classes + + + true + + ${project.build.outputDirectory}/META-INF/MANIFEST.MF + + + + com/baeldung/instrumentation/application/AgentLoader.class + com/baeldung/instrumentation/application/Launcher.class + + + + + + + + + + buildApplication + + + + org.apache.maven.plugins + maven-jar-plugin + + + package + + jar + + + application + target/classes + + + true + + ${project.build.outputDirectory}/META-INF/MANIFEST.MF + + + + com/baeldung/instrumentation/application/MyAtm.class + com/baeldung/instrumentation/application/MyAtmApplication.class + com/baeldung/instrumentation/application/Launcher.class + + + + + + + + + + buildAgent + + + + org.apache.maven.plugins + maven-jar-plugin + + + package + + jar + + + agent + target/classes + + + true + + ${project.build.outputDirectory}/META-INF/MANIFEST.MF + + + + com/baeldung/instrumentation/agent/AtmTransformer.class + com/baeldung/instrumentation/agent/MyInstrumentationAgent.class + + + + + + + + + + + + + + 3.8.1 + 1.16.12 + + 1.19 + 1.19 + + + 3.10.0 + + + 2.21.0 + 4.3.4.RELEASE + 3.0.0-M1 + 3.0.2 + 1.4.4 + 3.1.1 + 2.0.3.RELEASE + 1.6.0 + + + diff --git a/core-java/src/main/java/com/baeldung/array/ArrayBenchmarkRunner.java b/core-java-arrays/src/main/java/com/baeldung/array/ArrayBenchmarkRunner.java similarity index 100% rename from core-java/src/main/java/com/baeldung/array/ArrayBenchmarkRunner.java rename to core-java-arrays/src/main/java/com/baeldung/array/ArrayBenchmarkRunner.java diff --git a/core-java/src/main/java/com/baeldung/array/ArrayInitializer.java b/core-java-arrays/src/main/java/com/baeldung/array/ArrayInitializer.java similarity index 97% rename from core-java/src/main/java/com/baeldung/array/ArrayInitializer.java rename to core-java-arrays/src/main/java/com/baeldung/array/ArrayInitializer.java index 0ba6c342d9..d2b0428904 100644 --- a/core-java/src/main/java/com/baeldung/array/ArrayInitializer.java +++ b/core-java-arrays/src/main/java/com/baeldung/array/ArrayInitializer.java @@ -2,7 +2,7 @@ package com.baeldung.array; import java.util.Arrays; -import org.apache.commons.lang.ArrayUtils; +import org.apache.commons.lang3.ArrayUtils; public class ArrayInitializer { diff --git a/core-java/src/main/java/com/baeldung/array/ArrayInverter.java b/core-java-arrays/src/main/java/com/baeldung/array/ArrayInverter.java similarity index 100% rename from core-java/src/main/java/com/baeldung/array/ArrayInverter.java rename to core-java-arrays/src/main/java/com/baeldung/array/ArrayInverter.java diff --git a/core-java-arrays/src/main/java/com/baeldung/array/ArrayReferenceGuide.java b/core-java-arrays/src/main/java/com/baeldung/array/ArrayReferenceGuide.java new file mode 100644 index 0000000000..7d7dec85b0 --- /dev/null +++ b/core-java-arrays/src/main/java/com/baeldung/array/ArrayReferenceGuide.java @@ -0,0 +1,159 @@ +package com.baeldung.array; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Comparator; +import java.util.List; +import java.util.stream.IntStream; +import java.util.stream.Stream; + +public class ArrayReferenceGuide { + + public static void main(String[] args) { + declaration(); + + initialization(); + + access(); + + iterating(); + + varargs(); + + transformIntoList(); + + transformIntoStream(); + + sort(); + + search(); + + merge(); + } + + private static void declaration() { + int[] anArray; + int anotherArray[]; + } + + private static void initialization() { + int[] anArray = new int[10]; + anArray[0] = 10; + anArray[5] = 4; + + int[] anotherArray = new int[] {1, 2, 3, 4, 5}; + } + + private static void access() { + int[] anArray = new int[10]; + anArray[0] = 10; + anArray[5] = 4; + + System.out.println(anArray[0]); + } + + private static void iterating() { + int[] anArray = new int[] {1, 2, 3, 4, 5}; + for (int i = 0; i < anArray.length; i++) { + System.out.println(anArray[i]); + } + + for (int element : anArray) { + System.out.println(element); + } + } + + private static void varargs() { + String[] groceries = new String[] {"Milk", "Tomato", "Chips"}; + varargMethod(groceries); + varargMethod("Milk", "Tomato", "Chips"); + } + + private static void varargMethod(String... varargs) { + for (String element : varargs) { + System.out.println(element); + } + } + + private static void transformIntoList() { + Integer[] anArray = new Integer[] {1, 2, 3, 4, 5}; + + // Naïve implementation + List aList = new ArrayList<>(); // We create an empty list + for (int element : anArray) { + // We iterate over array's elements and add them to the list + aList.add(element); + } + + // Pretty implementation + aList = Arrays.asList(anArray); + + // Drawbacks + try { + aList.remove(0); + } catch (UnsupportedOperationException e) { + System.out.println(e.getMessage()); + } + + try { + aList.add(6); + } catch (UnsupportedOperationException e) { + System.out.println(e.getMessage()); + } + + int[] anotherArray = new int[] {1, 2, 3, 4, 5}; +// List anotherList = Arrays.asList(anotherArray); + } + + private static void transformIntoStream() { + int[] anArray = new int[] {1, 2, 3, 4, 5}; + IntStream aStream = Arrays.stream(anArray); + + Integer[] anotherArray = new Integer[] {1, 2, 3, 4, 5}; + Stream anotherStream = Arrays.stream(anotherArray, 2, 4); + } + + private static void sort() { + int[] anArray = new int[] {5, 2, 1, 4, 8}; + Arrays.sort(anArray); // anArray is now {1, 2, 4, 5, 8} + + Integer[] anotherArray = new Integer[] {5, 2, 1, 4, 8}; + Arrays.sort(anotherArray); // anArray is now {1, 2, 4, 5, 8} + + String[] yetAnotherArray = new String[] {"A", "E", "Z", "B", "C"}; + Arrays.sort(yetAnotherArray, 1, 3, Comparator.comparing(String::toString).reversed()); // yetAnotherArray is now {"A", "Z", "E", "B", "C"} + } + + private static void search() { + int[] anArray = new int[] {5, 2, 1, 4, 8}; + for (int i = 0; i < anArray.length; i++) { + if (anArray[i] == 4) { + System.out.println("Found at index " + i); + break; + } + } + + Arrays.sort(anArray); + int index = Arrays.binarySearch(anArray, 4); + System.out.println("Found at index " + index); + } + + private static void merge() { + int[] anArray = new int[] {5, 2, 1, 4, 8}; + int[] anotherArray = new int[] {10, 4, 9, 11, 2}; + + int[] resultArray = new int[anArray.length + anotherArray.length]; + for (int i = 0; i < resultArray.length; i++) { + resultArray[i] = (i < anArray.length ? anArray[i] : anotherArray[i - anArray.length]); + } + for (int element : resultArray) { + System.out.println(element); + } + + Arrays.setAll(resultArray, i -> (i < anArray.length ? anArray[i] : anotherArray[i - anArray.length])); + for (int element : resultArray) { + System.out.println(element); + } + } + +} diff --git a/core-java/src/main/java/com/baeldung/array/Find2ndLargestInArray.java b/core-java-arrays/src/main/java/com/baeldung/array/Find2ndLargestInArray.java similarity index 100% rename from core-java/src/main/java/com/baeldung/array/Find2ndLargestInArray.java rename to core-java-arrays/src/main/java/com/baeldung/array/Find2ndLargestInArray.java diff --git a/core-java/src/main/java/com/baeldung/array/FindElementInArray.java b/core-java-arrays/src/main/java/com/baeldung/array/FindElementInArray.java similarity index 100% rename from core-java/src/main/java/com/baeldung/array/FindElementInArray.java rename to core-java-arrays/src/main/java/com/baeldung/array/FindElementInArray.java diff --git a/core-java/src/main/java/com/baeldung/array/JaggedArray.java b/core-java-arrays/src/main/java/com/baeldung/array/JaggedArray.java similarity index 100% rename from core-java/src/main/java/com/baeldung/array/JaggedArray.java rename to core-java-arrays/src/main/java/com/baeldung/array/JaggedArray.java diff --git a/core-java/src/main/java/com/baeldung/array/SearchArrayUnitTest.java b/core-java-arrays/src/main/java/com/baeldung/array/SearchArrayUnitTest.java similarity index 100% rename from core-java/src/main/java/com/baeldung/array/SearchArrayUnitTest.java rename to core-java-arrays/src/main/java/com/baeldung/array/SearchArrayUnitTest.java diff --git a/core-java/src/main/java/com/baeldung/array/SumAndAverageInArray.java b/core-java-arrays/src/main/java/com/baeldung/array/SumAndAverageInArray.java similarity index 100% rename from core-java/src/main/java/com/baeldung/array/SumAndAverageInArray.java rename to core-java-arrays/src/main/java/com/baeldung/array/SumAndAverageInArray.java diff --git a/core-java-arrays/src/main/java/com/baeldung/array/operations/ArrayOperations.java b/core-java-arrays/src/main/java/com/baeldung/array/operations/ArrayOperations.java new file mode 100644 index 0000000000..d8cc0afd61 --- /dev/null +++ b/core-java-arrays/src/main/java/com/baeldung/array/operations/ArrayOperations.java @@ -0,0 +1,211 @@ +package com.baeldung.array.operations; + +import java.lang.reflect.Array; +import java.util.Arrays; +import java.util.HashSet; +import java.util.LinkedHashSet; +import java.util.LinkedList; +import java.util.Random; +import java.util.Set; +import java.util.function.Function; +import java.util.function.IntPredicate; +import java.util.function.Predicate; +import java.util.stream.Stream; + +import org.apache.commons.lang3.ArrayUtils; + +public class ArrayOperations { + + // Get the first and last item of an array + public static T getFirstObject(T[] array) { + return array[0]; + } + + public static int getFirstInt(int[] array) { + return array[0]; + } + + public static T getLastObject(T[] array) { + return array[array.length - 1]; + } + + public static int getLastInt(int[] array) { + return array[array.length - 1]; + } + + // Append a new item to an array + public static T[] appendObject(T[] array, T newItem) { + return ArrayUtils.add(array, newItem); + } + + public static int[] appendInt(int[] array, int newItem) { + int[] newArray = Arrays.copyOf(array, array.length + 1); + newArray[newArray.length - 1] = newItem; + return newArray; + } + + public static int[] appendIntWithUtils(int[] array, int newItem) { + return ArrayUtils.add(array, newItem); + } + + // Compare two arrays to check if they have the same elements + public static boolean compareObjectArrays(T[] array1, T[] array2) { + return Arrays.equals(array1, array2); + } + + public static boolean compareIntArrays(int[] array1, int[] array2) { + return Arrays.equals(array1, array2); + } + + // Deep Compare (for nested arrays) + public static boolean deepCompareObjectArrayUsingArrays(T[][] array1, T[][] array2) { + // We can use Objects.deepEquals for a broader approach + return Arrays.deepEquals(array1, array2); + } + + public static boolean deepCompareIntArrayUsingArrays(int[][] array1, int[][] array2) { + return Arrays.deepEquals(array1, array2); + } + + // Check if array is empty + public static boolean isEmptyObjectArrayUsingUtils(T[] array1) { + return ArrayUtils.isEmpty(array1); + } + + public static boolean isEmptyIntArrayUsingUtils(int[] array1) { + return ArrayUtils.isEmpty(array1); + } + + // Remove duplicates + public static Integer[] removeDuplicateObjects(Integer[] array) { + // We can use other ways of converting the array to a set too + Set set = new HashSet<>(Arrays.asList(array)); + return set.toArray(new Integer[set.size()]); + } + + public static int[] removeDuplicateInts(int[] array) { + // Box + Integer[] list = ArrayUtils.toObject(array); + // Remove duplicates + Set set = new HashSet(Arrays.asList(list)); + // Create array and unbox + return ArrayUtils.toPrimitive(set.toArray(new Integer[set.size()])); + } + + // Remove duplicates preserving the order + public static Integer[] removeDuplicateWithOrderObjectArray(Integer[] array) { + // We can use other ways of converting the array to a set too + Set set = new LinkedHashSet<>(Arrays.asList(array)); + return set.toArray(new Integer[set.size()]); + } + + public static int[] removeDuplicateWithOrderIntArray(int[] array) { + // Box + Integer[] list = ArrayUtils.toObject(array); + // Remove duplicates + Set set = new LinkedHashSet(Arrays.asList(list)); + // Create array and unbox + return ArrayUtils.toPrimitive(set.toArray(new Integer[set.size()])); + } + + // Print an array + public static String printObjectArray(Integer[] array) { + return ArrayUtils.toString(array); + } + + public static String printObjectArray(Integer[][] array) { + return ArrayUtils.toString(array); + } + + public static String printIntArray(int[] array) { + return ArrayUtils.toString(array); + } + + public static String printIntArray(int[][] array) { + return ArrayUtils.toString(array); + } + + // Box or Unbox values + public static int[] unboxIntegerArray(Integer[] array) { + return ArrayUtils.toPrimitive(array); + } + + public static Integer[] boxIntArray(int[] array) { + return ArrayUtils.toObject(array); + } + + // Map array values + @SuppressWarnings("unchecked") + public static U[] mapObjectArray(T[] array, Function function, Class targetClazz) { + U[] newArray = (U[]) Array.newInstance(targetClazz, array.length); + for (int i = 0; i < array.length; i++) { + newArray[i] = function.apply(array[i]); + } + return newArray; + } + + public static String[] mapIntArrayToString(int[] array) { + return Arrays.stream(array) + .mapToObj(value -> String.format("Value: %s", value)) + .toArray(String[]::new); + } + + // Filter array values + public static Integer[] filterObjectArray(Integer[] array, Predicate predicate) { + return Arrays.stream(array) + .filter(predicate) + .toArray(Integer[]::new); + } + + public static int[] filterIntArray(int[] array, IntPredicate predicate) { + return Arrays.stream(array) + .filter(predicate) + .toArray(); + } + + // Insert item between others + public static int[] insertBetweenIntArray(int[] array, int... values) { + return ArrayUtils.insert(2, array, values); + } + + @SuppressWarnings("unchecked") + public static T[] insertBetweenObjectArray(T[] array, T... values) { + return ArrayUtils.insert(2, array, values); + } + + // Shuffling arrays + public static int[] shuffleIntArray(int[] array) { + // we create a different array instance for testing purposes + int[] shuffled = Arrays.copyOf(array, array.length); + ArrayUtils.shuffle(shuffled); + return shuffled; + } + + public static T[] shuffleObjectArray(T[] array) { + // we create a different array instance for testing purposes + T[] shuffled = Arrays.copyOf(array, array.length); + ArrayUtils.shuffle(shuffled); + return shuffled; + } + + // Get random number + public static int getRandomFromIntArray(int[] array) { + return array[new Random().nextInt(array.length)]; + } + + public static T getRandomFromObjectArray(T[] array) { + return array[new Random().nextInt(array.length)]; + } + + public static Integer[] intersectionSimple(final Integer[] a, final Integer[] b){ + return Stream.of(a).filter(Arrays.asList(b)::contains).toArray(Integer[]::new); + } + + public static Integer[] intersectionSet(final Integer[] a, final Integer[] b){ + return Stream.of(a).filter(Arrays.asList(b)::contains).distinct().toArray(Integer[]::new); + } + + public static Integer[] intersectionMultiSet(final Integer[] a, final Integer[] b){ + return Stream.of(a).filter(new LinkedList<>(Arrays.asList(b))::remove).toArray(Integer[]::new); + } +} diff --git a/core-java/src/main/java/com/baeldung/arraycopy/model/Address.java b/core-java-arrays/src/main/java/com/baeldung/arraycopy/model/Address.java similarity index 100% rename from core-java/src/main/java/com/baeldung/arraycopy/model/Address.java rename to core-java-arrays/src/main/java/com/baeldung/arraycopy/model/Address.java diff --git a/core-java/src/main/java/com/baeldung/arraycopy/model/Employee.java b/core-java-arrays/src/main/java/com/baeldung/arraycopy/model/Employee.java similarity index 100% rename from core-java/src/main/java/com/baeldung/arraycopy/model/Employee.java rename to core-java-arrays/src/main/java/com/baeldung/arraycopy/model/Employee.java diff --git a/core-java/src/test/java/com/baeldung/array/ArrayInitializerUnitTest.java b/core-java-arrays/src/test/java/com/baeldung/array/ArrayInitializerUnitTest.java similarity index 100% rename from core-java/src/test/java/com/baeldung/array/ArrayInitializerUnitTest.java rename to core-java-arrays/src/test/java/com/baeldung/array/ArrayInitializerUnitTest.java diff --git a/core-java/src/test/java/com/baeldung/array/ArrayInverterUnitTest.java b/core-java-arrays/src/test/java/com/baeldung/array/ArrayInverterUnitTest.java similarity index 100% rename from core-java/src/test/java/com/baeldung/array/ArrayInverterUnitTest.java rename to core-java-arrays/src/test/java/com/baeldung/array/ArrayInverterUnitTest.java diff --git a/core-java/src/test/java/com/baeldung/array/Find2ndLargestInArrayUnitTest.java b/core-java-arrays/src/test/java/com/baeldung/array/Find2ndLargestInArrayUnitTest.java similarity index 100% rename from core-java/src/test/java/com/baeldung/array/Find2ndLargestInArrayUnitTest.java rename to core-java-arrays/src/test/java/com/baeldung/array/Find2ndLargestInArrayUnitTest.java diff --git a/core-java/src/test/java/com/baeldung/array/FindElementInArrayUnitTest.java b/core-java-arrays/src/test/java/com/baeldung/array/FindElementInArrayUnitTest.java similarity index 100% rename from core-java/src/test/java/com/baeldung/array/FindElementInArrayUnitTest.java rename to core-java-arrays/src/test/java/com/baeldung/array/FindElementInArrayUnitTest.java diff --git a/core-java/src/test/java/com/baeldung/array/JaggedArrayUnitTest.java b/core-java-arrays/src/test/java/com/baeldung/array/JaggedArrayUnitTest.java similarity index 100% rename from core-java/src/test/java/com/baeldung/array/JaggedArrayUnitTest.java rename to core-java-arrays/src/test/java/com/baeldung/array/JaggedArrayUnitTest.java diff --git a/core-java/src/test/java/com/baeldung/array/SumAndAverageInArrayUnitTest.java b/core-java-arrays/src/test/java/com/baeldung/array/SumAndAverageInArrayUnitTest.java similarity index 100% rename from core-java/src/test/java/com/baeldung/array/SumAndAverageInArrayUnitTest.java rename to core-java-arrays/src/test/java/com/baeldung/array/SumAndAverageInArrayUnitTest.java diff --git a/core-java-arrays/src/test/java/com/baeldung/array/operations/ArrayOperationsUnitTest.java b/core-java-arrays/src/test/java/com/baeldung/array/operations/ArrayOperationsUnitTest.java new file mode 100644 index 0000000000..a9c6d97d9f --- /dev/null +++ b/core-java-arrays/src/test/java/com/baeldung/array/operations/ArrayOperationsUnitTest.java @@ -0,0 +1,365 @@ +package com.baeldung.array.operations; + +import static org.assertj.core.api.Assertions.assertThat; + +import java.util.Arrays; + +import org.assertj.core.api.Condition; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + +public class ArrayOperationsUnitTest { + + private Integer[] defaultObjectArray; + private int[] defaultIntArray; + private Integer[][] defaultJaggedObjectArray; + private int[][] defaultJaggedIntArray; + + @BeforeEach + public void setupDefaults() { + defaultObjectArray = new Integer[] { 3, 5, 2, 5, 14, 4 }; + defaultIntArray = new int[] { 3, 5, 2, 5, 14, 4 }; + defaultJaggedObjectArray = new Integer[][] { { 1, 3 }, { 5 }, {} }; + defaultJaggedIntArray = new int[][] { { 1, 3 }, { 5 }, {} }; + } + + // Get the first and last item of an array + @Test + public void whenGetFirstObjectCalled_thenReturnFirstItemOfArray() { + Integer output = ArrayOperations.getFirstObject(defaultObjectArray); + + assertThat(output).isEqualTo(3); + } + + @Test + public void whenGetFirstIntCalled_thenReturnFirstItemOfArray() { + int output = ArrayOperations.getFirstInt(defaultIntArray); + + assertThat(output).isEqualTo(3); + } + + @Test + public void whenGetLastObjectCalled_thenReturnLastItemOfArray() { + Integer output = ArrayOperations.getLastObject(defaultObjectArray); + + assertThat(output).isEqualTo(4); + } + + @Test + public void whenGetLastIntCalled_thenReturnLastItemOfArray() { + int output = ArrayOperations.getLastInt(defaultIntArray); + + assertThat(output).isEqualTo(4); + } + + // Append a new item to an array + @Test + public void whenAppendObject_thenReturnArrayWithExtraItem() { + Integer[] output = ArrayOperations.appendObject(defaultObjectArray, 7); + + assertThat(output).endsWith(4, 7) + .hasSize(7); + } + + @Test + public void whenAppendInt_thenReturnArrayWithExtraItem() { + int[] output = ArrayOperations.appendInt(defaultIntArray, 7); + int[] outputUsingUtils = ArrayOperations.appendIntWithUtils(defaultIntArray, 7); + + assertThat(output).endsWith(4, 7) + .hasSize(7); + assertThat(outputUsingUtils).endsWith(4, 7) + .hasSize(7); + } + + // Compare two arrays to check if they have the same elements + @Test + public void whenCompareObjectArrays_thenReturnBoolean() { + Integer[] array2 = { 8, 7, 6 }; + Integer[] sameArray = { 3, 5, 2, 5, 14, 4 }; + boolean output = ArrayOperations.compareObjectArrays(defaultObjectArray, array2); + boolean output2 = ArrayOperations.compareObjectArrays(defaultObjectArray, sameArray); + + assertThat(output).isFalse(); + assertThat(output2).isTrue(); + } + + @Test + public void whenCompareIntArrays_thenReturnBoolean() { + int[] array2 = { 8, 7, 6 }; + int[] sameArray = { 3, 5, 2, 5, 14, 4 }; + boolean output = ArrayOperations.compareIntArrays(defaultIntArray, array2); + boolean output2 = ArrayOperations.compareIntArrays(defaultIntArray, sameArray); + + assertThat(output).isFalse(); + assertThat(output2).isTrue(); + } + + // Deep compare + @Test + public void whenDeepCompareObjectArrays_thenReturnBoolean() { + Integer[][] sameArray = { { 1, 3 }, { 5 }, {} }; + Integer[][] array2 = { { 1, 3 }, { 5 }, { 3 } }; + boolean output = ArrayOperations.deepCompareObjectArrayUsingArrays(defaultJaggedObjectArray, array2); + boolean output2 = ArrayOperations.deepCompareObjectArrayUsingArrays(defaultJaggedObjectArray, sameArray); + // Because arrays are Objects, we could wrongly use the non-deep approach + boolean outputUsingNonDeep = ArrayOperations.compareObjectArrays(defaultJaggedObjectArray, sameArray); + + assertThat(output).isFalse(); + assertThat(output2).isTrue(); + // This is not what we would expect! + assertThat(outputUsingNonDeep).isFalse(); + } + + @Test + public void whenDeepCompareIntArrays_thenReturnBoolean() { + int[][] sameArray = { { 1, 3 }, { 5 }, {} }; + int[][] array2 = { { 1, 3 }, { 5 }, { 3 } }; + boolean output = ArrayOperations.deepCompareIntArrayUsingArrays(defaultJaggedIntArray, array2); + boolean output2 = ArrayOperations.deepCompareIntArrayUsingArrays(defaultJaggedIntArray, sameArray); + + assertThat(output).isFalse(); + assertThat(output2).isTrue(); + } + + // Empty Check + @Test + public void whenIsEmptyObjectArray_thenReturnBoolean() { + Integer[] array2 = {}; + Integer[] array3 = null; + Integer[] array4 = { null, null, null }; + Integer[] array5 = { null }; + Integer[][] array6 = { {}, {}, {} }; + boolean output = ArrayOperations.isEmptyObjectArrayUsingUtils(defaultObjectArray); + boolean output2 = ArrayOperations.isEmptyObjectArrayUsingUtils(array2); + boolean output3 = ArrayOperations.isEmptyObjectArrayUsingUtils(array3); + boolean output4 = ArrayOperations.isEmptyObjectArrayUsingUtils(array4); + boolean output5 = ArrayOperations.isEmptyObjectArrayUsingUtils(array5); + boolean output6 = ArrayOperations.isEmptyObjectArrayUsingUtils(array6); + + assertThat(output).isFalse(); + assertThat(output2).isTrue(); + assertThat(output3).isTrue(); + // Mind these edge cases! + assertThat(output4).isFalse(); + assertThat(output5).isFalse(); + assertThat(output6).isFalse(); + } + + @Test + public void whenIsEmptyIntArray_thenReturnBoolean() { + int[] array2 = {}; + boolean output = ArrayOperations.isEmptyIntArrayUsingUtils(defaultIntArray); + boolean output2 = ArrayOperations.isEmptyIntArrayUsingUtils(array2); + + assertThat(output).isFalse(); + assertThat(output2).isTrue(); + } + + // Remove Duplicates + @Test + public void whenRemoveDuplicateObjectArray_thenReturnArrayWithNoDuplicates() { + Integer[] output = ArrayOperations.removeDuplicateObjects(defaultObjectArray); + + assertThat(output).containsOnlyOnce(5) + .hasSize(5) + .doesNotHaveDuplicates(); + } + + @Test + public void whenRemoveDuplicateIntArray_thenReturnArrayWithNoDuplicates() { + int[] output = ArrayOperations.removeDuplicateInts(defaultIntArray); + + assertThat(output).containsOnlyOnce(5) + .hasSize(5) + .doesNotHaveDuplicates(); + } + + // Remove Duplicates Preserving order + @Test + public void whenRemoveDuplicatePreservingOrderObjectArray_thenReturnArrayWithNoDuplicates() { + Integer[] array2 = { 3, 5, 2, 14, 4 }; + Integer[] output = ArrayOperations.removeDuplicateWithOrderObjectArray(defaultObjectArray); + + assertThat(output).containsOnlyOnce(5) + .hasSize(5) + .containsExactly(array2); + } + + @Test + public void whenRemoveDuplicatePreservingOrderIntArray_thenReturnArrayWithNoDuplicates() { + int[] array2 = { 3, 5, 2, 14, 4 }; + int[] output = ArrayOperations.removeDuplicateWithOrderIntArray(defaultIntArray); + + assertThat(output).containsOnlyOnce(5) + .hasSize(5) + .containsExactly(array2); + } + + // Print + @Test + public void whenPrintObjectArray_thenReturnString() { + String output = ArrayOperations.printObjectArray(defaultObjectArray); + String jaggedOutput = ArrayOperations.printObjectArray(defaultJaggedObjectArray); + // Comparing to Arrays output: + String wrongArraysOutput = Arrays.toString(defaultJaggedObjectArray); + String differentFormatArraysOutput = Arrays.toString(defaultObjectArray); + // We should use Arrays.deepToString for jagged arrays + String differentFormatJaggedArraysOutput = Arrays.deepToString(defaultJaggedObjectArray); + + assertThat(output).isEqualTo("{3,5,2,5,14,4}"); + assertThat(jaggedOutput).isEqualTo("{{1,3},{5},{}}"); + assertThat(differentFormatArraysOutput).isEqualTo("[3, 5, 2, 5, 14, 4]"); + assertThat(wrongArraysOutput).contains("[[Ljava.lang.Integer;@"); + assertThat(differentFormatJaggedArraysOutput).contains("[[1, 3], [5], []]"); + } + + @Test + public void whenPrintIntArray_thenReturnString() { + String output = ArrayOperations.printIntArray(defaultIntArray); + String jaggedOutput = ArrayOperations.printIntArray(defaultJaggedIntArray); + // Comparing to Arrays output: + String wrongArraysOutput = Arrays.toString(defaultJaggedObjectArray); + String differentFormatArraysOutput = Arrays.toString(defaultObjectArray); + + assertThat(output).isEqualTo("{3,5,2,5,14,4}"); + assertThat(jaggedOutput).isEqualTo("{{1,3},{5},{}}"); + assertThat(differentFormatArraysOutput).isEqualTo("[3, 5, 2, 5, 14, 4]"); + assertThat(wrongArraysOutput).contains("[[Ljava.lang.Integer;@"); + } + + // Box and unbox + @Test + public void whenUnboxObjectArray_thenReturnPrimitiveArray() { + int[] output = ArrayOperations.unboxIntegerArray(defaultObjectArray); + + assertThat(output).containsExactly(defaultIntArray); + } + + @Test + public void henBoxPrimitiveArray_thenReturnObjectArray() { + Integer[] output = ArrayOperations.boxIntArray(defaultIntArray); + + assertThat(output).containsExactly(defaultObjectArray); + } + + // Map values + @Test + public void whenMapMultiplyingObjectArray_thenReturnMultipliedArray() { + Integer[] multipliedExpectedArray = new Integer[] { 6, 10, 4, 10, 28, 8 }; + Integer[] output = ArrayOperations.mapObjectArray(defaultObjectArray, value -> value * 2, Integer.class); + + assertThat(output).containsExactly(multipliedExpectedArray); + } + + @Test + public void whenMapDividingObjectArray_thenReturnDividedArray() { + Double[] multipliedExpectedArray = new Double[] { 1.5, 2.5, 1.0, 2.5, 7.0, 2.0 }; + Double[] output = ArrayOperations.mapObjectArray(defaultObjectArray, value -> value / 2.0, Double.class); + + assertThat(output).containsExactly(multipliedExpectedArray); + } + + @Test + public void whenMapIntArrayToString_thenReturnArray() { + String[] expectedArray = new String[] { "Value: 3", "Value: 5", "Value: 2", "Value: 5", "Value: 14", + "Value: 4" }; + String[] output = ArrayOperations.mapIntArrayToString(defaultIntArray); + + assertThat(output).containsExactly(expectedArray); + } + + // Filter values + @Test + public void whenFilterObjectArray_thenReturnFilteredArray() { + Integer[] multipliedExpectedArray = new Integer[] { 2, 14, 4 }; + Integer[] output = ArrayOperations.filterObjectArray(defaultObjectArray, value -> value % 2 == 0); + + assertThat(output).containsExactly(multipliedExpectedArray); + } + + @Test + public void whenFilterIntArray_thenReturnFilteredArray() { + int[] expectedArray = new int[] { 2, 14, 4 }; + int[] output = ArrayOperations.filterIntArray(defaultIntArray, value -> (int) value % 2 == 0); + + assertThat(output).containsExactly(expectedArray); + } + + // Insert between + @Test + public void whenInsertBetweenIntArrayToString_thenReturnNewArray() { + int[] expectedArray = { 3, 5, 77, 88, 2, 5, 14, 4 }; + int[] output = ArrayOperations.insertBetweenIntArray(defaultIntArray, 77, 88); + + assertThat(output).containsExactly(expectedArray); + } + + @Test + public void whenInsertBetweenObjectArrayToString_thenReturnNewArray() { + Integer[] expectedArray = { 3, 5, 77, 99, 2, 5, 14, 4 }; + Integer[] output = ArrayOperations.insertBetweenObjectArray(defaultObjectArray, 77, 99); + + assertThat(output).containsExactly(expectedArray); + } + + // Shuffle between + @Test + public void whenShufflingIntArraySeveralTimes_thenAtLeastOneWithDifferentOrder() { + int[] output = ArrayOperations.shuffleIntArray(defaultIntArray); + int[] output2 = ArrayOperations.shuffleIntArray(defaultIntArray); + int[] output3 = ArrayOperations.shuffleIntArray(defaultIntArray); + int[] output4 = ArrayOperations.shuffleIntArray(defaultIntArray); + int[] output5 = ArrayOperations.shuffleIntArray(defaultIntArray); + int[] output6 = ArrayOperations.shuffleIntArray(defaultIntArray); + + Condition atLeastOneArraysIsNotEqual = new Condition( + "at least one output should be different (order-wise)") { + @Override + public boolean matches(int[] value) { + return !Arrays.equals(value, output) || !Arrays.equals(value, output2) || !Arrays.equals(value, output3) + || !Arrays.equals(value, output4) || !Arrays.equals(value, output5) + || !Arrays.equals(value, output6); + } + }; + + assertThat(defaultIntArray).has(atLeastOneArraysIsNotEqual); + } + + @Test + public void whenShufflingObjectArraySeveralTimes_thenAtLeastOneWithDifferentOrder() { + Integer[] output = ArrayOperations.shuffleObjectArray(defaultObjectArray); + Integer[] output2 = ArrayOperations.shuffleObjectArray(defaultObjectArray); + Integer[] output3 = ArrayOperations.shuffleObjectArray(defaultObjectArray); + Integer[] output4 = ArrayOperations.shuffleObjectArray(defaultObjectArray); + Integer[] output5 = ArrayOperations.shuffleObjectArray(defaultObjectArray); + Integer[] output6 = ArrayOperations.shuffleObjectArray(defaultObjectArray); + + Condition atLeastOneArraysIsNotEqual = new Condition( + "at least one output should be different (order-wise)") { + @Override + public boolean matches(Integer[] value) { + return !Arrays.equals(value, output) || !Arrays.equals(value, output2) || !Arrays.equals(value, output3) + || !Arrays.equals(value, output4) || !Arrays.equals(value, output5) + || !Arrays.equals(value, output6); + } + }; + + assertThat(defaultObjectArray).has(atLeastOneArraysIsNotEqual); + } + + // Get random item + @Test + public void whenGetRandomFromIntArrayToString_thenReturnItemContainedInArray() { + int output = ArrayOperations.getRandomFromIntArray(defaultIntArray); + + assertThat(defaultIntArray).contains(output); + } + + @Test + public void whenGetRandomFromObjectArrayToString_thenReturnItemContainedInArray() { + Integer output = ArrayOperations.getRandomFromObjectArray(defaultObjectArray); + + assertThat(defaultObjectArray).contains(output); + } +} diff --git a/core-java-arrays/src/test/java/com/baeldung/array/operations/IntersectionUnitTest.java b/core-java-arrays/src/test/java/com/baeldung/array/operations/IntersectionUnitTest.java new file mode 100644 index 0000000000..3c61060ea8 --- /dev/null +++ b/core-java-arrays/src/test/java/com/baeldung/array/operations/IntersectionUnitTest.java @@ -0,0 +1,66 @@ +package com.baeldung.array.operations; + +import org.junit.jupiter.api.Test; + +import static com.baeldung.array.operations.ArrayOperations.intersectionMultiSet; +import static com.baeldung.array.operations.ArrayOperations.intersectionSet; +import static com.baeldung.array.operations.ArrayOperations.intersectionSimple; +import static org.assertj.core.api.Assertions.assertThat; + +class IntersectionUnitTest { + private static final Integer[] a = { 1, 3, 2 }; + private static final Integer[] b = { 4, 3, 2, 4, 2, 3, 4, 4, 3 }; + private static final Integer[] c = { 1, 3, 2, 3, 3, 2 }; + + @Test + void whenIntersectionSimpleIsUsed_thenCommonEntriesAreInTheResult() { + assertThat(intersectionSimple(a, b)).isEqualTo(new Integer[] { 3, 2 }); + assertThat(intersectionSimple(b, a)).isEqualTo(new Integer[] { 3, 2, 2, 3, 3 }); + } + + @Test + void whenIntersectionSimpleIsUsedWithAnArrayAndItself_thenTheResultIsTheIdentity() { + assertThat(intersectionSimple(b, b)).isEqualTo(b); + assertThat(intersectionSimple(a, a)).isEqualTo(a); + } + + @Test + void whenIntersectionSetIsUsed_thenCommonEntriesAreInTheResult() { + assertThat(intersectionSet(b, a)).isEqualTo(new Integer[] { 3, 2 }); + } + + @Test + void whenIntersectionSetIsUsed_thenTheNumberOfEntriesDoesNotChangeWithTheParameterOrder() { + assertThat(intersectionSet(a, b)).isEqualTo(new Integer[] { 3, 2 }); + assertThat(intersectionSet(b, a)).isEqualTo(new Integer[] { 3, 2 }); + } + + @Test + void whenIntersectionSetIsUsedWithAnArrayAndWithItself_andTheInputHasNoDuplicateEntries_ThenTheResultIsTheIdentity() { + assertThat(intersectionSet(a, a)).isEqualTo(a); + } + + @Test + void whenIntersectionSetIsUsedWithAnArrayAndWithItself_andTheInputHasDuplicateEntries_ThenTheResultIsNotTheIdentity() { + assertThat(intersectionSet(b, b)).isNotEqualTo(b); + } + + @Test + void whenMultiSetIsUsed_thenCommonEntriesAreInTheResult() { + assertThat(intersectionMultiSet(b, a)).isEqualTo(new Integer[] { 3, 2 }); + } + + @Test + void whenIntersectionMultiSetIsUsed_thenTheNumberOfEntriesDoesNotChangeWithTheParameterOrder() { + assertThat(intersectionMultiSet(a, b)).isEqualTo(new Integer[] { 3, 2 }); + assertThat(intersectionMultiSet(b, a)).isEqualTo(new Integer[] { 3, 2 }); + assertThat(intersectionMultiSet(b, c)).isEqualTo(new Integer[] { 3, 2, 2, 3, 3 }); + assertThat(intersectionMultiSet(c, b)).isEqualTo(new Integer[] { 3, 2, 3, 3, 2 }); + } + + @Test + void whenIntersectionMultiSetIsUsedWithAnArrayAndWithItself_ThenTheResultIsTheIdentity() { + assertThat(intersectionMultiSet(b, b)).isEqualTo(b); + assertThat(intersectionMultiSet(a, a)).isEqualTo(a); + } +} \ No newline at end of file diff --git a/core-java/src/test/java/com/baeldung/arraycopy/ArrayCopyUtilUnitTest.java b/core-java-arrays/src/test/java/com/baeldung/arraycopy/ArrayCopyUtilUnitTest.java similarity index 100% rename from core-java/src/test/java/com/baeldung/arraycopy/ArrayCopyUtilUnitTest.java rename to core-java-arrays/src/test/java/com/baeldung/arraycopy/ArrayCopyUtilUnitTest.java diff --git a/core-java/src/test/java/com/baeldung/arrays/ArraysUnitTest.java b/core-java-arrays/src/test/java/com/baeldung/arrays/ArraysUnitTest.java similarity index 100% rename from core-java/src/test/java/com/baeldung/arrays/ArraysUnitTest.java rename to core-java-arrays/src/test/java/com/baeldung/arrays/ArraysUnitTest.java diff --git a/core-java-collections/README.md b/core-java-collections/README.md index aef640634e..4c0b24cd5d 100644 --- a/core-java-collections/README.md +++ b/core-java-collections/README.md @@ -4,37 +4,23 @@ ### Relevant Articles: - [Immutable ArrayList in Java](http://www.baeldung.com/java-immutable-list) -- [Converting between an Array and a List in Java](http://www.baeldung.com/convert-array-to-list-and-list-to-array) -- [Converting between an Array and a Set in Java](http://www.baeldung.com/convert-array-to-set-and-set-to-array) -- [Converting between a List and a Set in Java](http://www.baeldung.com/convert-list-to-set-and-set-to-list) -- [Convert a Map to an Array, List or Set in Java](http://www.baeldung.com/convert-map-values-to-array-list-set) - [Guide to the Java ArrayList](http://www.baeldung.com/java-arraylist) - [Random List Element](http://www.baeldung.com/java-random-list-element) - [Java - Combine Multiple Collections](http://www.baeldung.com/java-combine-multiple-collections) -- [Guide to WeakHashMap in Java](http://www.baeldung.com/java-weakhashmap) -- [Guide to the Guava BiMap](http://www.baeldung.com/guava-bimap) -- [The Java HashMap Under the Hood](http://www.baeldung.com/java-hashmap) -- [A Guide to LinkedHashMap in Java](http://www.baeldung.com/java-linked-hashmap) -- [A Guide to TreeMap in Java](http://www.baeldung.com/java-treemap) - [Removing all nulls from a List in Java](http://www.baeldung.com/java-remove-nulls-from-list) - [Removing all duplicates from a List in Java](http://www.baeldung.com/java-remove-duplicates-from-list) - [Flattening Nested Collections in Java](http://www.baeldung.com/java-flatten-nested-collections) - [HashSet and TreeSet Comparison](http://www.baeldung.com/java-hashset-vs-treeset) -- [Iterate over a Map in Java](http://www.baeldung.com/java-iterate-map) - [Collect a Java Stream to an Immutable Collection](http://www.baeldung.com/java-stream-immutable-collection) -- [Converting a List to String in Java](http://www.baeldung.com/java-list-to-string) - [Introduction to the Java ArrayDeque](http://www.baeldung.com/java-array-deque) - [A Guide to HashSet in Java](http://www.baeldung.com/java-hashset) - [A Guide to TreeSet in Java](http://www.baeldung.com/java-tree-set) -- [Java TreeMap vs HashMap](http://www.baeldung.com/java-treemap-vs-hashmap) - [How to TDD a List Implementation in Java](http://www.baeldung.com/java-test-driven-list) -- [How to Store Duplicate Keys in a Map in Java?](http://www.baeldung.com/java-map-duplicate-keys) - [Getting the Size of an Iterable in Java](http://www.baeldung.com/java-iterable-size) - [Iterating Backward Through a List](http://www.baeldung.com/java-list-iterate-backwards) - [How to Filter a Collection in Java](http://www.baeldung.com/java-collection-filtering) - [Add Multiple Items to an Java ArrayList](http://www.baeldung.com/java-add-items-array-list) - [Remove the First Element from a List](http://www.baeldung.com/java-remove-first-element-from-list) -- [How to Convert List to Map in Java](http://www.baeldung.com/java-list-to-map) - [Initializing HashSet at the Time of Construction](http://www.baeldung.com/java-initialize-hashset) - [Removing the First Element of an Array](https://www.baeldung.com/java-array-remove-first-element) - [Fail-Safe Iterator vs Fail-Fast Iterator](http://www.baeldung.com/java-fail-safe-vs-fail-fast-iterator) @@ -47,11 +33,22 @@ - [Remove All Occurrences of a Specific Value from a List](https://www.baeldung.com/java-remove-value-from-list) - [Thread Safe LIFO Data Structure Implementations](https://www.baeldung.com/java-lifo-thread-safe) - [Collections.emptyList() vs. New List Instance](https://www.baeldung.com/java-collections-emptylist-new-list) -- [Initialize a HashMap in Java](https://www.baeldung.com/java-initialize-hashmap) - [Differences Between Collection.clear() and Collection.removeAll()](https://www.baeldung.com/java-collection-clear-vs-removeall) - [Performance of contains() in a HashSet vs ArrayList](https://www.baeldung.com/java-hashset-arraylist-contains-performance) -- [Get the Key for a Value from a Java Map](https://www.baeldung.com/java-map-key-from-value) - [Time Complexity of Java Collections](https://www.baeldung.com/java-collections-complexity) -- [Sort a HashMap in Java](https://www.baeldung.com/java-hashmap-sort) -- [Finding the Highest Value in a Java Map](https://www.baeldung.com/java-find-map-max) - [Operating on and Removing an Item from Stream](https://www.baeldung.com/java-use-remove-item-stream) +- [An Introduction to Synchronized Java Collections](https://www.baeldung.com/java-synchronized-collections) +- [Guide to EnumSet](https://www.baeldung.com/java-enumset) +- [Removing Elements from Java Collections](https://www.baeldung.com/java-collection-remove-elements) +- [Converting a Collection to ArrayList in Java](https://www.baeldung.com/java-convert-collection-arraylist) +- [Java 8 Streams: Find Items From One List Based On Values From Another List](https://www.baeldung.com/java-streams-find-list-items) +- [Combining Different Types of Collections in Java](https://www.baeldung.com/java-combine-collections) +- [Sorting in Java](http://www.baeldung.com/java-sorting) +- [A Guide to the Java LinkedList](http://www.baeldung.com/java-linkedlist) +- [Java List UnsupportedOperationException](http://www.baeldung.com/java-list-unsupported-operation-exception) +- [Join and Split Arrays and Collections in Java](http://www.baeldung.com/java-join-and-split) +- [Check If Two Lists are Equal in Java](http://www.baeldung.com/java-test-a-list-for-ordinality-and-equality) +- [Java List Initialization in One Line](https://www.baeldung.com/java-init-list-one-line) +- [ClassCastException: Arrays$ArrayList cannot be cast to ArrayList](https://www.baeldung.com/java-classcastexception-arrays-arraylist) +- [A Guide to EnumMap](https://www.baeldung.com/java-enum-map) +- [Ways to Iterate Over a List in Java](https://www.baeldung.com/java-iterate-list) diff --git a/core-java-collections/pom.xml b/core-java-collections/pom.xml index b4a6e26d13..2201ee8b15 100644 --- a/core-java-collections/pom.xml +++ b/core-java-collections/pom.xml @@ -14,22 +14,11 @@ - - net.sourceforge.collections - collections-generic - ${collections-generic.version} - org.apache.commons commons-collections4 ${commons-collections4.version} - - com.jayway.awaitility - awaitility - ${avaitility.version} - test - org.apache.commons commons-lang3 @@ -67,22 +56,23 @@ commons-exec 1.3 - - one.util - streamex - 0.6.5 + org.projectlombok + lombok + ${lombok.version} + provided 1.19 1.2.0 - 3.5 + 3.8.1 4.1 4.01 1.7.0 - 3.6.1 + 3.11.1 7.1.0 + 1.16.12 diff --git a/core-java/src/main/java/com/baeldung/classcastexception/ClassCastException.java b/core-java-collections/src/main/java/com/baeldung/classcastexception/ClassCastException.java similarity index 100% rename from core-java/src/main/java/com/baeldung/classcastexception/ClassCastException.java rename to core-java-collections/src/main/java/com/baeldung/classcastexception/ClassCastException.java diff --git a/core-java-collections/src/main/java/com/baeldung/java/list/WaysToIterate.java b/core-java-collections/src/main/java/com/baeldung/java/list/WaysToIterate.java new file mode 100644 index 0000000000..3cce08eabb --- /dev/null +++ b/core-java-collections/src/main/java/com/baeldung/java/list/WaysToIterate.java @@ -0,0 +1,67 @@ +package com.baeldung.java.list; + +import java.util.Arrays; +import java.util.Iterator; +import java.util.List; +import java.util.ListIterator; + +/** + * Demonstrates the different ways to loop over + * the elements of a list. + */ +public class WaysToIterate { + + List countries = Arrays.asList("Germany", "Panama", "Australia"); + + /** + * Iterate over a list using a basic for loop + */ + public void iterateWithForLoop() { + for (int i = 0; i < countries.size(); i++) { + System.out.println(countries.get(i)); + } + } + + /** + * Iterate over a list using the enhanced for loop + */ + public void iterateWithEnhancedForLoop() { + for (String country : countries) { + System.out.println(country); + } + } + + /** + * Iterate over a list using an Iterator + */ + public void iterateWithIterator() { + Iterator countriesIterator = countries.iterator(); + while(countriesIterator.hasNext()) { + System.out.println(countriesIterator.next()); + } + } + + /** + * Iterate over a list using a ListIterator + */ + public void iterateWithListIterator() { + ListIterator listIterator = countries.listIterator(); + while(listIterator.hasNext()) { + System.out.println(listIterator.next()); + } + } + + /** + * Iterate over a list using the Iterable.forEach() method + */ + public void iterateWithForEach() { + countries.forEach(System.out::println); + } + + /** + * Iterate over a list using the Stream.forEach() method + */ + public void iterateWithStreamForEach() { + countries.stream().forEach((c) -> System.out.println(c)); + } +} \ No newline at end of file diff --git a/core-java-collections/src/main/java/com/baeldung/removal/CollectionRemoveIf.java b/core-java-collections/src/main/java/com/baeldung/removal/CollectionRemoveIf.java new file mode 100644 index 0000000000..2f5e91596f --- /dev/null +++ b/core-java-collections/src/main/java/com/baeldung/removal/CollectionRemoveIf.java @@ -0,0 +1,19 @@ +package com.baeldung.removal; + +import java.util.ArrayList; +import java.util.Collection; + +public class CollectionRemoveIf { + + public static void main(String args[]) { + Collection names = new ArrayList<>(); + names.add("John"); + names.add("Ana"); + names.add("Mary"); + names.add("Anthony"); + names.add("Mark"); + + names.removeIf(e -> e.startsWith("A")); + System.out.println(String.join(",", names)); + } +} diff --git a/core-java-collections/src/main/java/com/baeldung/removal/Iterators.java b/core-java-collections/src/main/java/com/baeldung/removal/Iterators.java new file mode 100644 index 0000000000..86b91b3fdc --- /dev/null +++ b/core-java-collections/src/main/java/com/baeldung/removal/Iterators.java @@ -0,0 +1,28 @@ +package com.baeldung.removal; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.Iterator; + +public class Iterators { + + public static void main(String args[]) { + Collection names = new ArrayList<>(); + names.add("John"); + names.add("Ana"); + names.add("Mary"); + names.add("Anthony"); + names.add("Mark"); + + Iterator i = names.iterator(); + + while (i.hasNext()) { + String e = i.next(); + if (e.startsWith("A")) { + i.remove(); + } + } + + System.out.println(String.join(",", names)); + } +} diff --git a/core-java-collections/src/main/java/com/baeldung/removal/StreamFilterAndCollector.java b/core-java-collections/src/main/java/com/baeldung/removal/StreamFilterAndCollector.java new file mode 100644 index 0000000000..bf6db68bae --- /dev/null +++ b/core-java-collections/src/main/java/com/baeldung/removal/StreamFilterAndCollector.java @@ -0,0 +1,23 @@ +package com.baeldung.removal; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.stream.Collectors; + +public class StreamFilterAndCollector { + + public static void main(String args[]) { + Collection names = new ArrayList<>(); + names.add("John"); + names.add("Ana"); + names.add("Mary"); + names.add("Anthony"); + names.add("Mark"); + + Collection filteredCollection = names + .stream() + .filter(e -> !e.startsWith("A")) + .collect(Collectors.toList()); + System.out.println(String.join(",", filteredCollection)); + } +} diff --git a/core-java-collections/src/main/java/com/baeldung/removal/StreamPartitioningBy.java b/core-java-collections/src/main/java/com/baeldung/removal/StreamPartitioningBy.java new file mode 100644 index 0000000000..c77e996616 --- /dev/null +++ b/core-java-collections/src/main/java/com/baeldung/removal/StreamPartitioningBy.java @@ -0,0 +1,28 @@ +package com.baeldung.removal; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +public class StreamPartitioningBy { + + public static void main(String args[]) { + Collection names = new ArrayList<>(); + names.add("John"); + names.add("Ana"); + names.add("Mary"); + names.add("Anthony"); + names.add("Mark"); + + Map> classifiedElements = names + .stream() + .collect(Collectors.partitioningBy((String e) -> !e.startsWith("A"))); + + String matching = String.join(",", classifiedElements.get(Boolean.TRUE)); + String nonMatching = String.join(",", classifiedElements.get(Boolean.FALSE)); + System.out.println("Matching elements: " + matching); + System.out.println("Non matching elements: " + nonMatching); + } +} diff --git a/core-java-collections/src/test/java/com/baeldung/enummap/DummyEnum.java b/core-java-collections/src/test/java/com/baeldung/enummap/DummyEnum.java new file mode 100644 index 0000000000..906c820fa3 --- /dev/null +++ b/core-java-collections/src/test/java/com/baeldung/enummap/DummyEnum.java @@ -0,0 +1,13 @@ +package com.baeldung.enummap; + +/** + * This enum is used for benchmarking, therefore has many values. + */ +public enum DummyEnum { + CCC_000, + CCC_001,CCC_002,CCC_003,CCC_004,CCC_005,CCC_006,CCC_007,CCC_008,CCC_009,CCC_010, + CCC_011,CCC_012,CCC_013,CCC_014,CCC_015,CCC_016,CCC_017,CCC_018,CCC_019,CCC_020, + CCC_021,CCC_022,CCC_023,CCC_024,CCC_025,CCC_026,CCC_027,CCC_028,CCC_029,CCC_030, + CCC_031,CCC_032,CCC_033,CCC_034,CCC_035,CCC_036,CCC_037,CCC_038,CCC_039,CCC_040, + CCC_041,CCC_042,CCC_043,CCC_044,CCC_045,CCC_046,CCC_047,CCC_048,CCC_049, +} diff --git a/core-java-collections/src/test/java/com/baeldung/enummap/EnumMapBenchmarkLiveTest.java b/core-java-collections/src/test/java/com/baeldung/enummap/EnumMapBenchmarkLiveTest.java new file mode 100644 index 0000000000..997a8ba65b --- /dev/null +++ b/core-java-collections/src/test/java/com/baeldung/enummap/EnumMapBenchmarkLiveTest.java @@ -0,0 +1,119 @@ +package com.baeldung.enummap; + +import org.openjdk.jmh.annotations.*; +import org.openjdk.jmh.runner.Runner; +import org.openjdk.jmh.runner.options.Options; +import org.openjdk.jmh.runner.options.OptionsBuilder; + +import java.util.*; +import java.util.concurrent.TimeUnit; + +@BenchmarkMode({ Mode.AverageTime }) +@OutputTimeUnit(TimeUnit.NANOSECONDS) +@Warmup(iterations = 5) +@Measurement(iterations = 5) +public class EnumMapBenchmarkLiveTest { + + @State(Scope.Thread) + public static class BenchmarkState { + EnumMap enumMap = new EnumMap<>(DummyEnum.class); + HashMap hashMap = new HashMap<>(); + TreeMap treeMap = new TreeMap<>(); + int len = DummyEnum.values().length; + Random random = new Random(); + int randomIndex; + + @Setup(Level.Trial) + public void setUp() { + DummyEnum[] values = DummyEnum.values(); + for (int i = 0; i < len; i++) { + enumMap.put(values[i], values[i].toString()); + hashMap.put(values[i], values[i].toString()); + treeMap.put(values[i], values[i].toString()); + } + } + + @Setup(Level.Invocation) + public void additionalSetup() { + randomIndex = random.nextInt(len); + } + + } + + @Benchmark + public int benchmark01_EnumMapPut(BenchmarkState s) { + s.enumMap.put(DummyEnum.values()[s.randomIndex], DummyEnum.values()[s.randomIndex].toString()); + return ++s.randomIndex; + } + + @Benchmark + public int benchmark01_HashMapPut(BenchmarkState s) { + s.hashMap.put(DummyEnum.values()[s.randomIndex], DummyEnum.values()[s.randomIndex].toString()); + return ++s.randomIndex; + } + + @Benchmark + public int benchmark01_TreeMapPut(BenchmarkState s) { + s.treeMap.put(DummyEnum.values()[s.randomIndex], DummyEnum.values()[s.randomIndex].toString()); + return ++s.randomIndex; + } + + @Benchmark + public int benchmark02_EnumMapGet(BenchmarkState s) { + s.enumMap.get(DummyEnum.values()[s.randomIndex]); + return ++s.randomIndex; + } + + @Benchmark + public int benchmark02_HashMapGet(BenchmarkState s) { + s.hashMap.get(DummyEnum.values()[s.randomIndex]); + return ++s.randomIndex; + } + + @Benchmark + public int benchmark02_TreeMapGet(BenchmarkState s) { + s.treeMap.get(DummyEnum.values()[s.randomIndex]); + return ++s.randomIndex; + } + + @Benchmark + public int benchmark03_EnumMapContainsKey(BenchmarkState s) { + s.enumMap.containsKey(DummyEnum.values()[s.randomIndex]); + return ++s.randomIndex; + } + + @Benchmark + public int benchmark03_HashMapContainsKey(BenchmarkState s) { + s.hashMap.containsKey(DummyEnum.values()[s.randomIndex]); + return ++s.randomIndex; + } + + @Benchmark + public int benchmark03_TreeMapContainsKey(BenchmarkState s) { + s.treeMap.containsKey(DummyEnum.values()[s.randomIndex]); + return ++s.randomIndex; + } + + @Benchmark + public int benchmark04_EnumMapContainsValue(BenchmarkState s) { + s.enumMap.containsValue(DummyEnum.values()[s.randomIndex].toString()); + return ++s.randomIndex; + } + + @Benchmark + public int benchmark04_HashMapContainsValue(BenchmarkState s) { + s.hashMap.containsValue(DummyEnum.values()[s.randomIndex].toString()); + return ++s.randomIndex; + } + + @Benchmark + public int benchmark04_TreeMapContainsValue(BenchmarkState s) { + s.treeMap.containsValue(DummyEnum.values()[s.randomIndex].toString()); + return ++s.randomIndex; + } + + public static void main(String[] args) throws Exception { + Options options = new OptionsBuilder().include(EnumMapBenchmarkLiveTest.class.getSimpleName()).threads(1).forks(0).shouldFailOnError(true).shouldDoGC(false).jvmArgs("-server").build(); + new Runner(options).run(); + } +} diff --git a/core-java-collections/src/test/java/com/baeldung/enummap/EnumMapUnitTest.java b/core-java-collections/src/test/java/com/baeldung/enummap/EnumMapUnitTest.java new file mode 100644 index 0000000000..d9d6cf2c39 --- /dev/null +++ b/core-java-collections/src/test/java/com/baeldung/enummap/EnumMapUnitTest.java @@ -0,0 +1,144 @@ +package com.baeldung.enummap; + +import org.junit.Test; + +import java.util.*; +import java.util.concurrent.TimeUnit; + +import static java.util.AbstractMap.SimpleEntry; +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThatCode; + +public class EnumMapUnitTest { + public enum DayOfWeek { + MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY, SATURDAY, SUNDAY + } + + @Test + public void whenContructedWithEnumType_ThenOnlyAcceptThatAsKey() { + Map dayMap = new EnumMap<>(DayOfWeek.class); + assertThatCode( + () -> dayMap.put(TimeUnit.NANOSECONDS, "NANOSECONDS")) + .isInstanceOf(ClassCastException.class); + } + + @Test + public void whenConstructedWithEnumMap_ThenSameKeyTypeAndInitialMappings() { + EnumMap activityMap = new EnumMap<>(DayOfWeek.class); + activityMap.put(DayOfWeek.MONDAY, "Soccer"); + activityMap.put(DayOfWeek.TUESDAY, "Basketball"); + + EnumMap activityMapCopy = new EnumMap<>(activityMap); + assertThat(activityMapCopy.size()).isEqualTo(2); + assertThat(activityMapCopy.get(DayOfWeek.MONDAY)) + .isEqualTo("Soccer"); + assertThat(activityMapCopy.get(DayOfWeek.TUESDAY)) + .isEqualTo("Basketball"); + } + + @Test + public void givenEmptyMap_whenConstructedWithMap_ThenException() { + HashMap ordinaryMap = new HashMap(); + assertThatCode(() -> new EnumMap(ordinaryMap)) + .isInstanceOf(IllegalArgumentException.class) + .hasMessage("Specified map is empty"); + } + + @Test + public void givenMapWithEntries_whenConstructedWithMap_ThenSucceed() { + HashMap ordinaryMap = new HashMap<>(); + ordinaryMap.put(DayOfWeek.MONDAY, "Soccer"); + ordinaryMap.put(DayOfWeek.TUESDAY, "Basketball"); + EnumMap enumMap = new EnumMap<>(ordinaryMap); + assertThat(enumMap.size()).isEqualTo(2); + assertThat(enumMap.get(DayOfWeek.MONDAY)).isEqualTo("Soccer"); + assertThat(enumMap.get(DayOfWeek.TUESDAY)).isEqualTo("Basketball"); + } + + @Test + public void givenMapWithMultiTypeEntries_whenConstructedWithMap_ThenException() { + HashMap ordinaryMap = new HashMap<>(); + ordinaryMap.put(DayOfWeek.MONDAY, "Soccer"); + ordinaryMap.put(TimeUnit.MILLISECONDS, "Other enum type"); + assertThatCode(() -> new EnumMap(ordinaryMap)) + .isInstanceOf(ClassCastException.class); + } + + @Test + public void whenPut_thenGet() { + Map activityMap = new EnumMap(DayOfWeek.class); + activityMap.put(DayOfWeek.WEDNESDAY, "Hiking"); + activityMap.put(DayOfWeek.THURSDAY, null); + assertThat(activityMap.get(DayOfWeek.WEDNESDAY)).isEqualTo("Hiking"); + assertThat(activityMap.get(DayOfWeek.THURSDAY)).isNull(); + } + + @Test + public void givenMapping_whenContains_thenTrue() { + EnumMap activityMap = new EnumMap(DayOfWeek.class); + assertThat(activityMap.containsKey(DayOfWeek.WEDNESDAY)).isFalse(); + assertThat(activityMap.containsValue("Hiking")).isFalse(); + activityMap.put(DayOfWeek.WEDNESDAY, "Hiking"); + assertThat(activityMap.containsKey(DayOfWeek.WEDNESDAY)).isTrue(); + assertThat(activityMap.containsValue("Hiking")).isTrue(); + + assertThat(activityMap.containsKey(DayOfWeek.SATURDAY)).isFalse(); + assertThat(activityMap.containsValue(null)).isFalse(); + activityMap.put(DayOfWeek.SATURDAY, null); + assertThat(activityMap.containsKey(DayOfWeek.SATURDAY)).isTrue(); + assertThat(activityMap.containsValue(null)).isTrue(); + } + + @Test + public void whenRemove_thenRemoved() { + EnumMap activityMap = new EnumMap(DayOfWeek.class); + + activityMap.put(DayOfWeek.MONDAY, "Soccer"); + assertThat(activityMap.remove(DayOfWeek.MONDAY)).isEqualTo("Soccer"); + assertThat(activityMap.containsKey(DayOfWeek.MONDAY)).isFalse(); + + activityMap.put(DayOfWeek.MONDAY, "Soccer"); + assertThat(activityMap.remove(DayOfWeek.MONDAY, "Hiking")).isEqualTo(false); + assertThat(activityMap.remove(DayOfWeek.MONDAY, "Soccer")).isEqualTo(true); + } + + @Test + public void whenSubView_thenSubViewOrdered() { + EnumMap activityMap = new EnumMap(DayOfWeek.class); + activityMap.put(DayOfWeek.THURSDAY, "Karate"); + activityMap.put(DayOfWeek.WEDNESDAY, "Hiking"); + activityMap.put(DayOfWeek.MONDAY, "Soccer"); + + Collection values = activityMap.values(); + assertThat(values).containsExactly("Soccer", "Hiking", "Karate"); + + Set keys = activityMap.keySet(); + assertThat(keys) + .containsExactly(DayOfWeek.MONDAY, DayOfWeek.WEDNESDAY,DayOfWeek.THURSDAY); + + assertThat(activityMap.entrySet()) + .containsExactly( + new SimpleEntry(DayOfWeek.MONDAY, "Soccer"), + new SimpleEntry(DayOfWeek.WEDNESDAY, "Hiking"), + new SimpleEntry(DayOfWeek.THURSDAY, "Karate")); + } + + @Test + public void givenSubView_whenChange_thenReflected() { + EnumMap activityMap = new EnumMap(DayOfWeek.class); + activityMap.put(DayOfWeek.THURSDAY, "Karate"); + activityMap.put(DayOfWeek.WEDNESDAY, "Hiking"); + activityMap.put(DayOfWeek.MONDAY, "Soccer"); + + Collection values = activityMap.values(); + assertThat(values).containsExactly("Soccer", "Hiking", "Karate"); + + activityMap.put(DayOfWeek.TUESDAY, "Basketball"); + assertThat(values) + .containsExactly("Soccer", "Basketball", "Hiking", "Karate"); + + values.remove("Hiking"); + assertThat(activityMap.containsKey(DayOfWeek.WEDNESDAY)).isFalse(); + assertThat(activityMap.size()).isEqualTo(3); + } +} diff --git a/core-java-collections/src/test/java/com/baeldung/java/list/WaysToIterateUnitTest.java b/core-java-collections/src/test/java/com/baeldung/java/list/WaysToIterateUnitTest.java new file mode 100644 index 0000000000..973c60b233 --- /dev/null +++ b/core-java-collections/src/test/java/com/baeldung/java/list/WaysToIterateUnitTest.java @@ -0,0 +1,71 @@ +package com.baeldung.java.list; + +import static org.junit.Assert.assertEquals; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Iterator; +import java.util.List; +import java.util.ListIterator; + +import org.junit.Test; + +public class WaysToIterateUnitTest { + + List globalCountries = new ArrayList(); + List europeanCountries = Arrays.asList("Germany", "Panama", "Australia"); + + @Test + public void whenIteratingUsingForLoop_thenReturnThreeAsSizeOfList() { + for (int i = 0; i < europeanCountries.size(); i++) { + globalCountries.add(europeanCountries.get(i)); + } + assertEquals(globalCountries.size(), 3); + globalCountries.clear(); + } + + @Test + public void whenIteratingUsingEnhancedForLoop_thenReturnThreeAsSizeOfList() { + for (String country : europeanCountries) { + globalCountries.add(country); + } + assertEquals(globalCountries.size(), 3); + globalCountries.clear(); + } + + @Test + public void whenIteratingUsingIterator_thenReturnThreeAsSizeOfList() { + Iterator countriesIterator = europeanCountries.iterator(); + while (countriesIterator.hasNext()) { + globalCountries.add(countriesIterator.next()); + } + + assertEquals(globalCountries.size(), 3); + globalCountries.clear(); + } + + @Test + public void whenIteratingUsingListIterator_thenReturnThreeAsSizeOfList() { + ListIterator countriesIterator = europeanCountries.listIterator(); + while (countriesIterator.hasNext()) { + globalCountries.add(countriesIterator.next()); + } + + assertEquals(globalCountries.size(), 3); + globalCountries.clear(); + } + + @Test + public void whenIteratingUsingForEach_thenReturnThreeAsSizeOfList() { + europeanCountries.forEach(country -> globalCountries.add(country)); + assertEquals(globalCountries.size(), 3); + globalCountries.clear(); + } + + @Test + public void whenIteratingUsingStreamForEach_thenReturnThreeAsSizeOfList() { + europeanCountries.stream().forEach((country) -> globalCountries.add(country)); + assertEquals(globalCountries.size(), 3); + globalCountries.clear(); + } +} \ No newline at end of file diff --git a/core-java/src/test/java/com/baeldung/java/listInitialization/ListInitializationUnitTest.java b/core-java-collections/src/test/java/com/baeldung/java/listInitialization/ListInitializationUnitTest.java similarity index 100% rename from core-java/src/test/java/com/baeldung/java/listInitialization/ListInitializationUnitTest.java rename to core-java-collections/src/test/java/com/baeldung/java/listInitialization/ListInitializationUnitTest.java diff --git a/core-java-collections/src/test/java/com/baeldung/removal/RemovalUnitTest.java b/core-java-collections/src/test/java/com/baeldung/removal/RemovalUnitTest.java new file mode 100644 index 0000000000..1b379f32de --- /dev/null +++ b/core-java-collections/src/test/java/com/baeldung/removal/RemovalUnitTest.java @@ -0,0 +1,77 @@ +package com.baeldung.removal; + +import org.junit.Before; +import org.junit.Test; + +import java.util.*; +import java.util.stream.Collectors; + +import static org.hamcrest.Matchers.is; +import static org.junit.Assert.assertThat; + +public class RemovalUnitTest { + + Collection names; + Collection expected; + Collection removed; + + @Before + public void setupTestData() { + names = new ArrayList<>(); + expected = new ArrayList<>(); + removed = new ArrayList<>(); + + names.add("John"); + names.add("Ana"); + names.add("Mary"); + names.add("Anthony"); + names.add("Mark"); + + expected.add("John"); + expected.add("Mary"); + expected.add("Mark"); + + removed.add("Ana"); + removed.add("Anthony"); + } + + @Test + public void givenCollectionOfNames_whenUsingIteratorToRemoveAllNamesStartingWithLetterA_finalListShouldContainNoNamesStartingWithLetterA() { + Iterator i = names.iterator(); + + while (i.hasNext()) { + String e = i.next(); + if (e.startsWith("A")) { + i.remove(); + } + } + + assertThat(names, is(expected)); + } + + @Test + public void givenCollectionOfNames_whenUsingRemoveIfToRemoveAllNamesStartingWithLetterA_finalListShouldContainNoNamesStartingWithLetterA() { + names.removeIf(e -> e.startsWith("A")); + assertThat(names, is(expected)); + } + + @Test + public void givenCollectionOfNames_whenUsingStreamToFilterAllNamesStartingWithLetterA_finalListShouldContainNoNamesStartingWithLetterA() { + Collection filteredCollection = names + .stream() + .filter(e -> !e.startsWith("A")) + .collect(Collectors.toList()); + assertThat(filteredCollection, is(expected)); + } + + @Test + public void givenCollectionOfNames_whenUsingStreamAndPartitioningByToFindNamesThatStartWithLetterA_shouldFind3MatchingAnd2NonMatching() { + Map> classifiedElements = names + .stream() + .collect(Collectors.partitioningBy((String e) -> !e.startsWith("A"))); + + assertThat(classifiedElements.get(Boolean.TRUE), is(expected)); + assertThat(classifiedElements.get(Boolean.FALSE), is(removed)); + } + +} diff --git a/core-java/src/test/java/org/baeldung/java/sorting/Employee.java b/core-java-collections/src/test/java/org/baeldung/java/sorting/Employee.java similarity index 100% rename from core-java/src/test/java/org/baeldung/java/sorting/Employee.java rename to core-java-collections/src/test/java/org/baeldung/java/sorting/Employee.java diff --git a/core-java/src/test/java/org/baeldung/java/sorting/JavaSortingUnitTest.java b/core-java-collections/src/test/java/org/baeldung/java/sorting/JavaSortingUnitTest.java similarity index 100% rename from core-java/src/test/java/org/baeldung/java/sorting/JavaSortingUnitTest.java rename to core-java-collections/src/test/java/org/baeldung/java/sorting/JavaSortingUnitTest.java diff --git a/core-java-concurrency/README.md b/core-java-concurrency/README.md index eeb9a83748..682c9b8ef0 100644 --- a/core-java-concurrency/README.md +++ b/core-java-concurrency/README.md @@ -30,3 +30,5 @@ - [Life Cycle of a Thread in Java](http://www.baeldung.com/java-thread-lifecycle) - [Runnable vs. Callable in Java](http://www.baeldung.com/java-runnable-callable) - [Brief Introduction to Java Thread.yield()](https://www.baeldung.com/java-thread-yield) +- [Print Even and Odd Numbers Using 2 Threads](https://www.baeldung.com/java-even-odd-numbers-with-2-threads) +- [Java CyclicBarrier vs CountDownLatch](https://www.baeldung.com/java-cyclicbarrier-countdownlatch) diff --git a/core-java-concurrency/src/main/java/com/baeldung/concurrent/Scheduledexecutorservice/ScheduledExecutorServiceDemo.java b/core-java-concurrency/src/main/java/com/baeldung/concurrent/Scheduledexecutorservice/ScheduledExecutorServiceDemo.java index b77019eea5..0989195ba7 100644 --- a/core-java-concurrency/src/main/java/com/baeldung/concurrent/Scheduledexecutorservice/ScheduledExecutorServiceDemo.java +++ b/core-java-concurrency/src/main/java/com/baeldung/concurrent/Scheduledexecutorservice/ScheduledExecutorServiceDemo.java @@ -1,34 +1,52 @@ package com.baeldung.concurrent.Scheduledexecutorservice; import java.util.concurrent.Executors; -import java.util.concurrent.Future; import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.ScheduledFuture; import java.util.concurrent.TimeUnit; +import java.util.function.Function; public class ScheduledExecutorServiceDemo { - public void execute() { + private void execute() { ScheduledExecutorService executorService = Executors.newSingleThreadScheduledExecutor(); - - ScheduledFuture scheduledFuture = executorService.schedule(() -> { - // Task - }, 1, TimeUnit.SECONDS); - - executorService.scheduleAtFixedRate(() -> { - // Task - }, 1, 10, TimeUnit.SECONDS); - - executorService.scheduleWithFixedDelay(() -> { - // Task - }, 1, 10, TimeUnit.SECONDS); - - Future future = executorService.schedule(() -> { - // Task - return "Hellow world"; - }, 1, TimeUnit.SECONDS); - + getTasksToRun().apply(executorService); executorService.shutdown(); } + private void executeWithMultiThread() { + ScheduledExecutorService executorService = Executors.newScheduledThreadPool(2); + getTasksToRun().apply(executorService); + executorService.shutdown(); + } + + private Function getTasksToRun() { + return (executorService -> { + ScheduledFuture scheduledFuture1 = executorService.schedule(() -> { + // Task + }, 1, TimeUnit.SECONDS); + + ScheduledFuture scheduledFuture2 = executorService.scheduleAtFixedRate(() -> { + // Task + }, 1, 10, TimeUnit.SECONDS); + + ScheduledFuture scheduledFuture3 = executorService.scheduleWithFixedDelay(() -> { + // Task + }, 1, 10, TimeUnit.SECONDS); + + ScheduledFuture scheduledFuture4 = executorService.schedule(() -> { + // Task + return "Hellow world"; + }, 1, TimeUnit.SECONDS); + return null; + }); + } + + public static void main(String... args) { + ScheduledExecutorServiceDemo demo = new ScheduledExecutorServiceDemo(); + demo.execute(); + demo.executeWithMultiThread(); + } + + } diff --git a/core-java-concurrency/src/main/java/com/baeldung/concurrent/countdownlatch/CountdownLatchCountExample.java b/core-java-concurrency/src/main/java/com/baeldung/concurrent/countdownlatch/CountdownLatchCountExample.java new file mode 100644 index 0000000000..08c7eeec03 --- /dev/null +++ b/core-java-concurrency/src/main/java/com/baeldung/concurrent/countdownlatch/CountdownLatchCountExample.java @@ -0,0 +1,33 @@ +package com.baeldung.concurrent.countdownlatch; + +import java.util.concurrent.CountDownLatch; + +public class CountdownLatchCountExample { + + private int count; + + public CountdownLatchCountExample(int count) { + this.count = count; + } + + public boolean callTwiceInSameThread() { + CountDownLatch countDownLatch = new CountDownLatch(count); + Thread t = new Thread(() -> { + countDownLatch.countDown(); + countDownLatch.countDown(); + }); + t.start(); + + try { + countDownLatch.await(); + } catch (InterruptedException e) { + e.printStackTrace(); + } + return countDownLatch.getCount() == 0; + } + + public static void main(String[] args) { + CountdownLatchCountExample ex = new CountdownLatchCountExample(2); + System.out.println("Is CountDown Completed : " + ex.callTwiceInSameThread()); + } +} diff --git a/core-java-concurrency/src/main/java/com/baeldung/concurrent/countdownlatch/CountdownLatchResetExample.java b/core-java-concurrency/src/main/java/com/baeldung/concurrent/countdownlatch/CountdownLatchResetExample.java new file mode 100644 index 0000000000..1828b7f91e --- /dev/null +++ b/core-java-concurrency/src/main/java/com/baeldung/concurrent/countdownlatch/CountdownLatchResetExample.java @@ -0,0 +1,41 @@ +package com.baeldung.concurrent.countdownlatch; + +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.concurrent.atomic.AtomicInteger; + +public class CountdownLatchResetExample { + + private int count; + private int threadCount; + private final AtomicInteger updateCount; + + CountdownLatchResetExample(int count, int threadCount) { + updateCount = new AtomicInteger(0); + this.count = count; + this.threadCount = threadCount; + } + + public int countWaits() { + CountDownLatch countDownLatch = new CountDownLatch(count); + ExecutorService es = Executors.newFixedThreadPool(threadCount); + for (int i = 0; i < threadCount; i++) { + es.execute(() -> { + long prevValue = countDownLatch.getCount(); + countDownLatch.countDown(); + if (countDownLatch.getCount() != prevValue) { + updateCount.incrementAndGet(); + } + }); + } + + es.shutdown(); + return updateCount.get(); + } + + public static void main(String[] args) { + CountdownLatchResetExample ex = new CountdownLatchResetExample(5, 20); + System.out.println("Count : " + ex.countWaits()); + } +} diff --git a/core-java-concurrency/src/main/java/com/baeldung/concurrent/cyclicbarrier/CyclicBarrierCompletionMethodExample.java b/core-java-concurrency/src/main/java/com/baeldung/concurrent/cyclicbarrier/CyclicBarrierCompletionMethodExample.java new file mode 100644 index 0000000000..7c1299da62 --- /dev/null +++ b/core-java-concurrency/src/main/java/com/baeldung/concurrent/cyclicbarrier/CyclicBarrierCompletionMethodExample.java @@ -0,0 +1,45 @@ +package com.baeldung.concurrent.cyclicbarrier; + +import java.util.concurrent.BrokenBarrierException; +import java.util.concurrent.CyclicBarrier; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.concurrent.atomic.AtomicInteger; + +public class CyclicBarrierCompletionMethodExample { + + private int count; + private int threadCount; + private final AtomicInteger updateCount; + + CyclicBarrierCompletionMethodExample(int count, int threadCount) { + updateCount = new AtomicInteger(0); + this.count = count; + this.threadCount = threadCount; + } + + public int countTrips() { + + CyclicBarrier cyclicBarrier = new CyclicBarrier(count, () -> { + updateCount.incrementAndGet(); + }); + + ExecutorService es = Executors.newFixedThreadPool(threadCount); + for (int i = 0; i < threadCount; i++) { + es.execute(() -> { + try { + cyclicBarrier.await(); + } catch (InterruptedException | BrokenBarrierException e) { + e.printStackTrace(); + } + }); + } + es.shutdown(); + return updateCount.get(); + } + + public static void main(String[] args) { + CyclicBarrierCompletionMethodExample ex = new CyclicBarrierCompletionMethodExample(5, 20); + System.out.println("Count : " + ex.countTrips()); + } +} diff --git a/core-java-concurrency/src/main/java/com/baeldung/concurrent/cyclicbarrier/CyclicBarrierCountExample.java b/core-java-concurrency/src/main/java/com/baeldung/concurrent/cyclicbarrier/CyclicBarrierCountExample.java new file mode 100644 index 0000000000..9d637b428b --- /dev/null +++ b/core-java-concurrency/src/main/java/com/baeldung/concurrent/cyclicbarrier/CyclicBarrierCountExample.java @@ -0,0 +1,32 @@ +package com.baeldung.concurrent.cyclicbarrier; + +import java.util.concurrent.BrokenBarrierException; +import java.util.concurrent.CyclicBarrier; + +public class CyclicBarrierCountExample { + + private int count; + + public CyclicBarrierCountExample(int count) { + this.count = count; + } + + public boolean callTwiceInSameThread() { + CyclicBarrier cyclicBarrier = new CyclicBarrier(count); + Thread t = new Thread(() -> { + try { + cyclicBarrier.await(); + cyclicBarrier.await(); + } catch (InterruptedException | BrokenBarrierException e) { + e.printStackTrace(); + } + }); + t.start(); + return cyclicBarrier.isBroken(); + } + + public static void main(String[] args) { + CyclicBarrierCountExample ex = new CyclicBarrierCountExample(7); + System.out.println("Count : " + ex.callTwiceInSameThread()); + } +} diff --git a/core-java-concurrency/src/main/java/com/baeldung/concurrent/cyclicbarrier/CyclicBarrierResetExample.java b/core-java-concurrency/src/main/java/com/baeldung/concurrent/cyclicbarrier/CyclicBarrierResetExample.java new file mode 100644 index 0000000000..76b6198bc4 --- /dev/null +++ b/core-java-concurrency/src/main/java/com/baeldung/concurrent/cyclicbarrier/CyclicBarrierResetExample.java @@ -0,0 +1,46 @@ +package com.baeldung.concurrent.cyclicbarrier; + +import java.util.concurrent.BrokenBarrierException; +import java.util.concurrent.CyclicBarrier; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.concurrent.atomic.AtomicInteger; + +public class CyclicBarrierResetExample { + + private int count; + private int threadCount; + private final AtomicInteger updateCount; + + CyclicBarrierResetExample(int count, int threadCount) { + updateCount = new AtomicInteger(0); + this.count = count; + this.threadCount = threadCount; + } + + public int countWaits() { + + CyclicBarrier cyclicBarrier = new CyclicBarrier(count); + + ExecutorService es = Executors.newFixedThreadPool(threadCount); + for (int i = 0; i < threadCount; i++) { + es.execute(() -> { + try { + if (cyclicBarrier.getNumberWaiting() > 0) { + updateCount.incrementAndGet(); + } + cyclicBarrier.await(); + } catch (InterruptedException | BrokenBarrierException e) { + e.printStackTrace(); + } + }); + } + es.shutdown(); + return updateCount.get(); + } + + public static void main(String[] args) { + CyclicBarrierResetExample ex = new CyclicBarrierResetExample(7, 20); + System.out.println("Count : " + ex.countWaits()); + } +} diff --git a/core-java-concurrency/src/main/java/com/baeldung/concurrent/daemon/MultipleThreadsExample.java b/core-java-concurrency/src/main/java/com/baeldung/concurrent/daemon/MultipleThreadsExample.java new file mode 100644 index 0000000000..492466e0c3 --- /dev/null +++ b/core-java-concurrency/src/main/java/com/baeldung/concurrent/daemon/MultipleThreadsExample.java @@ -0,0 +1,12 @@ +package com.baeldung.concurrent.daemon; + +public class MultipleThreadsExample { + public static void main(String[] args) { + NewThread t1 = new NewThread(); + t1.setName("MyThread-1"); + NewThread t2 = new NewThread(); + t2.setName("MyThread-2"); + t1.start(); + t2.start(); + } +} diff --git a/core-java-concurrency/src/main/java/com/baeldung/concurrent/daemon/NewThread.java b/core-java-concurrency/src/main/java/com/baeldung/concurrent/daemon/NewThread.java index 4d87978070..370ce99c09 100644 --- a/core-java-concurrency/src/main/java/com/baeldung/concurrent/daemon/NewThread.java +++ b/core-java-concurrency/src/main/java/com/baeldung/concurrent/daemon/NewThread.java @@ -1,14 +1,18 @@ package com.baeldung.concurrent.daemon; public class NewThread extends Thread { - public void run() { long startTime = System.currentTimeMillis(); while (true) { for (int i = 0; i < 10; i++) { - System.out.println("New Thread is running..." + i); + System.out.println(this.getName() + ": New Thread is running..." + i); + try { + //Wait for one sec so it doesn't print too fast + Thread.sleep(1000); + } catch (InterruptedException e) { + e.printStackTrace(); + } } - // prevent the Thread to run forever. It will finish it's execution after 2 seconds if (System.currentTimeMillis() - startTime > 2000) { Thread.currentThread().interrupt(); diff --git a/core-java-concurrency/src/main/java/com/baeldung/concurrent/daemon/SingleThreadExample.java b/core-java-concurrency/src/main/java/com/baeldung/concurrent/daemon/SingleThreadExample.java new file mode 100644 index 0000000000..16d8b2be1e --- /dev/null +++ b/core-java-concurrency/src/main/java/com/baeldung/concurrent/daemon/SingleThreadExample.java @@ -0,0 +1,8 @@ +package com.baeldung.concurrent.daemon; + +public class SingleThreadExample { + public static void main(String[] args) { + NewThread t = new NewThread(); + t.start(); + } +} diff --git a/core-java-concurrency/src/main/java/com/baeldung/concurrent/evenandodd/PrintEvenOddSemaphore.java b/core-java-concurrency/src/main/java/com/baeldung/concurrent/evenandodd/PrintEvenOddSemaphore.java new file mode 100644 index 0000000000..8b58916707 --- /dev/null +++ b/core-java-concurrency/src/main/java/com/baeldung/concurrent/evenandodd/PrintEvenOddSemaphore.java @@ -0,0 +1,75 @@ +package com.baeldung.concurrent.evenandodd; + +import java.util.concurrent.Semaphore; + +public class PrintEvenOddSemaphore { + + public static void main(String[] args) { + SharedPrinter sp = new SharedPrinter(); + Thread odd = new Thread(new Odd(sp, 10), "Odd"); + Thread even = new Thread(new Even(sp, 10), "Even"); + + odd.start(); + even.start(); + } +} + +class SharedPrinter { + + private final Semaphore semEven = new Semaphore(0); + private final Semaphore semOdd = new Semaphore(1); + + void printEvenNum(int num) { + try { + semEven.acquire(); + } catch (InterruptedException e) { + Thread.currentThread().interrupt(); + } + System.out.println(Thread.currentThread().getName() + ":"+num); + semOdd.release(); + } + + void printOddNum(int num) { + try { + semOdd.acquire(); + } catch (InterruptedException e) { + Thread.currentThread().interrupt(); + } + System.out.println(Thread.currentThread().getName() + ":"+ num); + semEven.release(); + } +} + +class Even implements Runnable { + private final SharedPrinter sp; + private final int max; + + Even(SharedPrinter sp, int max) { + this.sp = sp; + this.max = max; + } + + @Override + public void run() { + for (int i = 2; i <= max; i = i + 2) { + sp.printEvenNum(i); + } + } +} + +class Odd implements Runnable { + private SharedPrinter sp; + private int max; + + Odd(SharedPrinter sp, int max) { + this.sp = sp; + this.max = max; + } + + @Override + public void run() { + for (int i = 1; i <= max; i = i + 2) { + sp.printOddNum(i); + } + } +} diff --git a/core-java-concurrency/src/main/java/com/baeldung/concurrent/evenandodd/PrintEvenOddWaitNotify.java b/core-java-concurrency/src/main/java/com/baeldung/concurrent/evenandodd/PrintEvenOddWaitNotify.java new file mode 100644 index 0000000000..2b59f22a6e --- /dev/null +++ b/core-java-concurrency/src/main/java/com/baeldung/concurrent/evenandodd/PrintEvenOddWaitNotify.java @@ -0,0 +1,68 @@ +package com.baeldung.concurrent.evenandodd; + +public class PrintEvenOddWaitNotify { + + public static void main(String... args) { + Printer print = new Printer(); + Thread t1 = new Thread(new TaskEvenOdd(print, 10, false), "Odd"); + Thread t2 = new Thread(new TaskEvenOdd(print, 10, true), "Even"); + t1.start(); + t2.start(); + } +} + +class TaskEvenOdd implements Runnable { + private final int max; + private final Printer print; + private final boolean isEvenNumber; + + TaskEvenOdd(Printer print, int max, boolean isEvenNumber) { + this.print = print; + this.max = max; + this.isEvenNumber = isEvenNumber; + } + + @Override + public void run() { + int number = isEvenNumber ? 2 : 1; + while (number <= max) { + if (isEvenNumber) { + print.printEven(number); + } else { + print.printOdd(number); + } + number += 2; + } + } +} + +class Printer { + private volatile boolean isOdd; + + synchronized void printEven(int number) { + while (!isOdd) { + try { + wait(); + } catch (InterruptedException e) { + Thread.currentThread().interrupt(); + } + } + System.out.println(Thread.currentThread().getName() + ":" + number); + isOdd = false; + notify(); + } + + synchronized void printOdd(int number) { + while (isOdd) { + try { + wait(); + } catch (InterruptedException e) { + Thread.currentThread().interrupt(); + } + } + System.out.println(Thread.currentThread().getName() + ":" + number); + isOdd = true; + notify(); + } + +} diff --git a/core-java-concurrency/src/test/java/com/baeldung/concurrent/countdownlatch/CountdownLatchCountExampleUnitTest.java b/core-java-concurrency/src/test/java/com/baeldung/concurrent/countdownlatch/CountdownLatchCountExampleUnitTest.java new file mode 100644 index 0000000000..835efa53f2 --- /dev/null +++ b/core-java-concurrency/src/test/java/com/baeldung/concurrent/countdownlatch/CountdownLatchCountExampleUnitTest.java @@ -0,0 +1,15 @@ +package com.baeldung.concurrent.countdownlatch; + +import static org.junit.Assert.assertTrue; + +import org.junit.Test; + +public class CountdownLatchCountExampleUnitTest { + + @Test + public void whenCountDownLatch_completed() { + CountdownLatchCountExample ex = new CountdownLatchCountExample(2); + boolean isCompleted = ex.callTwiceInSameThread(); + assertTrue(isCompleted); + } +} diff --git a/core-java-concurrency/src/test/java/com/baeldung/concurrent/countdownlatch/CountdownLatchResetExampleUnitTest.java b/core-java-concurrency/src/test/java/com/baeldung/concurrent/countdownlatch/CountdownLatchResetExampleUnitTest.java new file mode 100644 index 0000000000..d2d43f6312 --- /dev/null +++ b/core-java-concurrency/src/test/java/com/baeldung/concurrent/countdownlatch/CountdownLatchResetExampleUnitTest.java @@ -0,0 +1,15 @@ +package com.baeldung.concurrent.countdownlatch; + +import static org.junit.Assert.assertTrue; + +import org.junit.Test; + +public class CountdownLatchResetExampleUnitTest { + + @Test + public void whenCountDownLatch_noReset() { + CountdownLatchResetExample ex = new CountdownLatchResetExample(7,20); + int lineCount = ex.countWaits(); + assertTrue(lineCount <= 7); + } +} diff --git a/core-java-concurrency/src/test/java/com/baeldung/concurrent/cyclicbarrier/CyclicBarrierCompletionMethodExampleUnitTest.java b/core-java-concurrency/src/test/java/com/baeldung/concurrent/cyclicbarrier/CyclicBarrierCompletionMethodExampleUnitTest.java new file mode 100644 index 0000000000..310063c86c --- /dev/null +++ b/core-java-concurrency/src/test/java/com/baeldung/concurrent/cyclicbarrier/CyclicBarrierCompletionMethodExampleUnitTest.java @@ -0,0 +1,15 @@ +package com.baeldung.concurrent.cyclicbarrier; + +import static org.junit.Assert.assertEquals; + +import org.junit.Test; + +public class CyclicBarrierCompletionMethodExampleUnitTest { + + @Test + public void whenCyclicBarrier_countTrips() { + CyclicBarrierCompletionMethodExample ex = new CyclicBarrierCompletionMethodExample(7,20); + int lineCount = ex.countTrips(); + assertEquals(2, lineCount); + } +} diff --git a/core-java-concurrency/src/test/java/com/baeldung/concurrent/cyclicbarrier/CyclicBarrierCountExampleUnitTest.java b/core-java-concurrency/src/test/java/com/baeldung/concurrent/cyclicbarrier/CyclicBarrierCountExampleUnitTest.java new file mode 100644 index 0000000000..9b7f3d9945 --- /dev/null +++ b/core-java-concurrency/src/test/java/com/baeldung/concurrent/cyclicbarrier/CyclicBarrierCountExampleUnitTest.java @@ -0,0 +1,15 @@ +package com.baeldung.concurrent.cyclicbarrier; + +import static org.junit.Assert.assertFalse; + +import org.junit.Test; + +public class CyclicBarrierCountExampleUnitTest { + + @Test + public void whenCyclicBarrier_notCompleted() { + CyclicBarrierCountExample ex = new CyclicBarrierCountExample(2); + boolean isCompleted = ex.callTwiceInSameThread(); + assertFalse(isCompleted); + } +} diff --git a/core-java-concurrency/src/test/java/com/baeldung/concurrent/cyclicbarrier/CyclicBarrierResetExampleUnitTest.java b/core-java-concurrency/src/test/java/com/baeldung/concurrent/cyclicbarrier/CyclicBarrierResetExampleUnitTest.java new file mode 100644 index 0000000000..8d2b148f06 --- /dev/null +++ b/core-java-concurrency/src/test/java/com/baeldung/concurrent/cyclicbarrier/CyclicBarrierResetExampleUnitTest.java @@ -0,0 +1,15 @@ +package com.baeldung.concurrent.cyclicbarrier; + +import static org.junit.Assert.assertTrue; + +import org.junit.Test; + +public class CyclicBarrierResetExampleUnitTest { + + @Test + public void whenCyclicBarrier_reset() { + CyclicBarrierResetExample ex = new CyclicBarrierResetExample(7,20); + int lineCount = ex.countWaits(); + assertTrue(lineCount > 7); + } +} diff --git a/core-java-concurrency/src/test/java/com/baeldung/concurrent/semaphores/SemaphoresManualTest.java b/core-java-concurrency/src/test/java/com/baeldung/concurrent/semaphores/SemaphoresManualTest.java index 8d64bb6809..cf3bdeda5b 100644 --- a/core-java-concurrency/src/test/java/com/baeldung/concurrent/semaphores/SemaphoresManualTest.java +++ b/core-java-concurrency/src/test/java/com/baeldung/concurrent/semaphores/SemaphoresManualTest.java @@ -4,6 +4,7 @@ import org.junit.Test; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; +import java.util.concurrent.TimeUnit; import java.util.stream.IntStream; import static org.junit.Assert.assertEquals; @@ -15,26 +16,28 @@ public class SemaphoresManualTest { // ========= login queue ====== @Test - public void givenLoginQueue_whenReachLimit_thenBlocked() { + public void givenLoginQueue_whenReachLimit_thenBlocked() throws InterruptedException { final int slots = 10; final ExecutorService executorService = Executors.newFixedThreadPool(slots); final LoginQueueUsingSemaphore loginQueue = new LoginQueueUsingSemaphore(slots); IntStream.range(0, slots) .forEach(user -> executorService.execute(loginQueue::tryLogin)); executorService.shutdown(); + executorService.awaitTermination(10, TimeUnit.SECONDS); assertEquals(0, loginQueue.availableSlots()); assertFalse(loginQueue.tryLogin()); } @Test - public void givenLoginQueue_whenLogout_thenSlotsAvailable() { + public void givenLoginQueue_whenLogout_thenSlotsAvailable() throws InterruptedException { final int slots = 10; final ExecutorService executorService = Executors.newFixedThreadPool(slots); final LoginQueueUsingSemaphore loginQueue = new LoginQueueUsingSemaphore(slots); IntStream.range(0, slots) .forEach(user -> executorService.execute(loginQueue::tryLogin)); executorService.shutdown(); + executorService.awaitTermination(10, TimeUnit.SECONDS); assertEquals(0, loginQueue.availableSlots()); loginQueue.logout(); @@ -45,13 +48,14 @@ public class SemaphoresManualTest { // ========= delay queue ======= @Test - public void givenDelayQueue_whenReachLimit_thenBlocked() { + public void givenDelayQueue_whenReachLimit_thenBlocked() throws InterruptedException { final int slots = 50; final ExecutorService executorService = Executors.newFixedThreadPool(slots); final DelayQueueUsingTimedSemaphore delayQueue = new DelayQueueUsingTimedSemaphore(1, slots); IntStream.range(0, slots) .forEach(user -> executorService.execute(delayQueue::tryAdd)); executorService.shutdown(); + executorService.awaitTermination(10, TimeUnit.SECONDS); assertEquals(0, delayQueue.availableSlots()); assertFalse(delayQueue.tryAdd()); @@ -65,6 +69,7 @@ public class SemaphoresManualTest { IntStream.range(0, slots) .forEach(user -> executorService.execute(delayQueue::tryAdd)); executorService.shutdown(); + executorService.awaitTermination(10, TimeUnit.SECONDS); assertEquals(0, delayQueue.availableSlots()); Thread.sleep(1000); diff --git a/core-java-io/README.md b/core-java-io/README.md index 58e331b6fc..3d028783ed 100644 --- a/core-java-io/README.md +++ b/core-java-io/README.md @@ -31,4 +31,7 @@ - [Create a Symbolic Link with Java](http://www.baeldung.com/java-symlink) - [Quick Use of FilenameFilter](http://www.baeldung.com/java-filename-filter) - [Initialize a HashMap in Java](https://www.baeldung.com/java-initialize-hashmap) -- [ Read a File into an ArrayList](https://www.baeldung.com/java-file-to-arraylist) +- [Read a File into an ArrayList](https://www.baeldung.com/java-file-to-arraylist) +- [Guide to Java OutputStream](https://www.baeldung.com/java-outputstream) +- [Reading a CSV File into an Array](https://www.baeldung.com/java-csv-file-array) +- [Guide to BufferedReader](https://www.baeldung.com/java-buffered-reader) diff --git a/core-java-io/pom.xml b/core-java-io/pom.xml index cf3e950cb8..efa32b8e3e 100644 --- a/core-java-io/pom.xml +++ b/core-java-io/pom.xml @@ -154,6 +154,12 @@ async-http-client ${async-http-client.version} + + com.opencsv + opencsv + ${opencsv.version} + test + @@ -247,7 +253,7 @@ 1.13 0.6.5 0.9.0 - + 4.1 3.6.1 1.7.0 diff --git a/core-java-io/src/main/java/com/baeldung/unzip/UnzipFile.java b/core-java-io/src/main/java/com/baeldung/unzip/UnzipFile.java index 6648d5f926..140d809d44 100644 --- a/core-java-io/src/main/java/com/baeldung/unzip/UnzipFile.java +++ b/core-java-io/src/main/java/com/baeldung/unzip/UnzipFile.java @@ -9,13 +9,13 @@ import java.util.zip.ZipInputStream; public class UnzipFile { public static void main(final String[] args) throws IOException { - final String fileZip = "src/main/resources/compressed.zip"; + final String fileZip = "src/main/resources/unzipTest/compressed.zip"; + final File destDir = new File("src/main/resources/unzipTest"); final byte[] buffer = new byte[1024]; final ZipInputStream zis = new ZipInputStream(new FileInputStream(fileZip)); ZipEntry zipEntry = zis.getNextEntry(); while (zipEntry != null) { - final String fileName = zipEntry.getName(); - final File newFile = new File("src/main/resources/unzipTest/" + fileName); + final File newFile = newFile(destDir, zipEntry); final FileOutputStream fos = new FileOutputStream(newFile); int len; while ((len = zis.read(buffer)) > 0) { @@ -27,4 +27,20 @@ public class UnzipFile { zis.closeEntry(); zis.close(); } + + /** + * @see https://snyk.io/research/zip-slip-vulnerability + */ + public static File newFile(File destinationDir, ZipEntry zipEntry) throws IOException { + File destFile = new File(destinationDir, zipEntry.getName()); + + String destDirPath = destinationDir.getCanonicalPath(); + String destFilePath = destFile.getCanonicalPath(); + + if (!destFilePath.startsWith(destDirPath + File.separator)) { + throw new IOException("Entry is outside of the target dir: " + zipEntry.getName()); + } + + return destFile; + } } \ No newline at end of file diff --git a/core-java-io/src/main/resources/unzipTest/compressed.zip b/core-java-io/src/main/resources/unzipTest/compressed.zip new file mode 100644 index 0000000000..89a9fd831c Binary files /dev/null and b/core-java-io/src/main/resources/unzipTest/compressed.zip differ diff --git a/core-java-io/src/test/java/com/baeldung/csv/ReadCSVInArrayUnitTest.java b/core-java-io/src/test/java/com/baeldung/csv/ReadCSVInArrayUnitTest.java new file mode 100644 index 0000000000..2593eee82b --- /dev/null +++ b/core-java-io/src/test/java/com/baeldung/csv/ReadCSVInArrayUnitTest.java @@ -0,0 +1,106 @@ +package com.baeldung.csv; + +import java.io.BufferedReader; +import java.io.File; +import java.io.FileNotFoundException; +import java.io.FileReader; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; +import java.util.Scanner; + +import org.junit.Assert; +import org.junit.Test; + +import com.opencsv.CSVReader; + +public class ReadCSVInArrayUnitTest { + public static final String COMMA_DELIMITER = ","; + public static final String CSV_FILE = "src/test/resources/book.csv"; + public static final List> EXPECTED_ARRAY = Collections.unmodifiableList(new ArrayList>() { + { + add(new ArrayList() { + { + add("Mary Kom"); + add("Unbreakable"); + } + }); + add(new ArrayList() { + { + add("Kapil Isapuari"); + add("Farishta"); + } + }); + } + }); + + @Test + public void givenCSVFile_whenBufferedReader_thenContentsAsExpected() throws IOException { + List> records = new ArrayList>(); + try (BufferedReader br = new BufferedReader(new FileReader(CSV_FILE))) { + String line = ""; + while ((line = br.readLine()) != null) { + String[] values = line.split(COMMA_DELIMITER); + records.add(Arrays.asList(values)); + } + } catch (Exception e) { + e.printStackTrace(); + } + for (int i = 0; i < EXPECTED_ARRAY.size(); i++) { + Assert.assertArrayEquals(EXPECTED_ARRAY.get(i) + .toArray(), + records.get(i) + .toArray()); + } + } + + @Test + public void givenCSVFile_whenScanner_thenContentsAsExpected() throws IOException { + List> records = new ArrayList>(); + try (Scanner scanner = new Scanner(new File(CSV_FILE));) { + while (scanner.hasNextLine()) { + records.add(getRecordFromLine(scanner.nextLine())); + } + } catch (FileNotFoundException e) { + e.printStackTrace(); + } + for (int i = 0; i < EXPECTED_ARRAY.size(); i++) { + Assert.assertArrayEquals(EXPECTED_ARRAY.get(i) + .toArray(), + records.get(i) + .toArray()); + } + } + + private List getRecordFromLine(String line) { + List values = new ArrayList(); + try (Scanner rowScanner = new Scanner(line)) { + rowScanner.useDelimiter(COMMA_DELIMITER); + while (rowScanner.hasNext()) { + values.add(rowScanner.next()); + } + } + return values; + } + + @Test + public void givenCSVFile_whenOpencsv_thenContentsAsExpected() throws IOException { + List> records = new ArrayList>(); + try (CSVReader csvReader = new CSVReader(new FileReader(CSV_FILE));) { + String[] values = null; + while ((values = csvReader.readNext()) != null) { + records.add(Arrays.asList(values)); + } + } catch (Exception e) { + e.printStackTrace(); + } + for (int i = 0; i < EXPECTED_ARRAY.size(); i++) { + Assert.assertArrayEquals(EXPECTED_ARRAY.get(i) + .toArray(), + records.get(i) + .toArray()); + } + } +} diff --git a/core-java-io/src/test/resources/book.csv b/core-java-io/src/test/resources/book.csv new file mode 100644 index 0000000000..b7c4b80499 --- /dev/null +++ b/core-java-io/src/test/resources/book.csv @@ -0,0 +1,2 @@ +Mary Kom,Unbreakable +Kapil Isapuari,Farishta \ No newline at end of file diff --git a/core-java-lang/.gitignore b/core-java-lang/.gitignore new file mode 100644 index 0000000000..374c8bf907 --- /dev/null +++ b/core-java-lang/.gitignore @@ -0,0 +1,25 @@ +*.class + +0.* + +#folders# +/target +/neoDb* +/data +/src/main/webapp/WEB-INF/classes +*/META-INF/* +.resourceCache + +# Packaged files # +*.jar +*.war +*.ear + +# Files generated by integration tests +backup-pom.xml +/bin/ +/temp + +#IntelliJ specific +.idea/ +*.iml \ No newline at end of file diff --git a/core-java-lang/README.md b/core-java-lang/README.md new file mode 100644 index 0000000000..69209bb193 --- /dev/null +++ b/core-java-lang/README.md @@ -0,0 +1,61 @@ +========= + +## Core Java Lang Cookbooks and Examples + +### Relevant Articles: +- [Guide to Java Reflection](http://www.baeldung.com/java-reflection) +- [Introduction to Java Generics](http://www.baeldung.com/java-generics) +- [Generate equals() and hashCode() with Eclipse](http://www.baeldung.com/java-eclipse-equals-and-hashcode) +- [Chained Exceptions in Java](http://www.baeldung.com/java-chained-exceptions) +- [Java Primitive Conversions](http://www.baeldung.com/java-primitive-conversions) +- [Call Methods at Runtime Using Java Reflection](http://www.baeldung.com/java-method-reflection) +- [Iterating Over Enum Values in Java](http://www.baeldung.com/java-enum-iteration) +- [Changing Annotation Parameters At Runtime](http://www.baeldung.com/java-reflection-change-annotation-params) +- [Dynamic Proxies in Java](http://www.baeldung.com/java-dynamic-proxies) +- [Java Double Brace Initialization](http://www.baeldung.com/java-double-brace-initialization) +- [Guide to hashCode() in Java](http://www.baeldung.com/java-hashcode) +- [Guide to the Diamond Operator in Java](http://www.baeldung.com/java-diamond-operator) +- [A Guide to the Static Keyword in Java](http://www.baeldung.com/java-static) +- [Quick Example - Comparator vs Comparable in Java](http://www.baeldung.com/java-comparator-comparable) +- [The Java continue and break Keywords](http://www.baeldung.com/java-continue-and-break) +- [A Guide to Java Initialization](http://www.baeldung.com/java-initialization) +- [Nested Classes in Java](http://www.baeldung.com/java-nested-classes) +- [A Guide to Java Loops](http://www.baeldung.com/java-loops) +- [Varargs in Java](http://www.baeldung.com/java-varargs) +- [A Guide to Inner Interfaces in Java](http://www.baeldung.com/java-inner-interfaces) +- [Polymorphism in Java](http://www.baeldung.com/java-polymorphism) +- [Recursion In Java](http://www.baeldung.com/java-recursion) +- [A Guide to the finalize Method in Java](http://www.baeldung.com/java-finalize) +- [Method Overloading and Overriding in Java](http://www.baeldung.com/java-method-overload-override) +- [How to Make a Deep Copy of an Object in Java](http://www.baeldung.com/java-deep-copy) +- [Guide to Inheritance in Java](http://www.baeldung.com/java-inheritance) +- [Object Type Casting in Java](http://www.baeldung.com/java-type-casting) +- [The "final" Keyword in Java](http://www.baeldung.com/java-final) +- [A Guide to Java Enums](http://www.baeldung.com/a-guide-to-java-enums) +- [Infinite Loops in Java](http://www.baeldung.com/infinite-loops-java) +- [Quick Guide to java.lang.System](http://www.baeldung.com/java-lang-system) +- [Type Erasure in Java Explained](http://www.baeldung.com/java-type-erasure) +- [Using Java Assertions](http://www.baeldung.com/java-assert) +- [Pass-By-Value as a Parameter Passing Mechanism in Java](http://www.baeldung.com/java-pass-by-value-or-pass-by-reference) +- [Variable and Method Hiding in Java](http://www.baeldung.com/java-variable-method-hiding) +- [Access Modifiers in Java](http://www.baeldung.com/java-access-modifiers) +- [Guide to the super Java Keyword](http://www.baeldung.com/java-super) +- [Guide to the this Java Keyword](http://www.baeldung.com/java-this) +- [Immutable Objects in Java](http://www.baeldung.com/java-immutable-object) +- [ClassNotFoundException vs NoClassDefFoundError](http://www.baeldung.com/java-classnotfoundexception-and-noclassdeffounderror) +- [The StackOverflowError in Java](http://www.baeldung.com/java-stack-overflow-error) +- [Create a Custom Exception in Java](http://www.baeldung.com/java-new-custom-exception) +- [Exception Handling in Java](http://www.baeldung.com/java-exceptions) +- [Differences Between Final, Finally and Finalize in Java](https://www.baeldung.com/java-final-finally-finalize) +- [Static and Dynamic Binding in Java](https://www.baeldung.com/java-static-dynamic-binding) +- [Difference Between Throw and Throws in Java](https://www.baeldung.com/java-throw-throws) +- [Synthetic Constructs in Java](https://www.baeldung.com/java-synthetic) +- [Java Switch Statement](https://www.baeldung.com/java-switch) +- [The Modulo Operator in Java](https://www.baeldung.com/modulo-java) +- [Ternary Operator In Java](https://www.baeldung.com/java-ternary-operator) +- [How to Separate Double into Integer and Decimal Parts](https://www.baeldung.com/java-separate-double-into-integer-decimal-parts) +- [“Sneaky Throws” in Java](http://www.baeldung.com/java-sneaky-throws) +- [Inheritance and Composition (Is-a vs Has-a relationship) in Java](http://www.baeldung.com/java-inheritance-composition) +- [A Guide to Constructors in Java](https://www.baeldung.com/java-constructors) +- [Retrieving a Class Name in Java](https://www.baeldung.com/java-class-name) +- [Java equals() and hashCode() Contracts](https://www.baeldung.com/java-equals-hashcode-contracts) diff --git a/core-java-lang/pom.xml b/core-java-lang/pom.xml new file mode 100644 index 0000000000..2f307859f1 --- /dev/null +++ b/core-java-lang/pom.xml @@ -0,0 +1,436 @@ + + 4.0.0 + com.baeldung + core-java-lang + 0.1.0-SNAPSHOT + jar + core-java-lang + + + com.baeldung + parent-java + 0.0.1-SNAPSHOT + ../parent-java + + + + + org.apache.commons + commons-lang3 + ${commons-lang3.version} + + + + + com.fasterxml.jackson.core + jackson-databind + ${jackson.version} + + + com.google.code.gson + gson + ${gson.version} + + + + log4j + log4j + ${log4j.version} + + + org.slf4j + log4j-over-slf4j + ${org.slf4j.version} + + + org.projectlombok + lombok + ${lombok.version} + provided + + + + org.assertj + assertj-core + ${assertj-core.version} + test + + + org.springframework + spring-web + ${springframework.spring-web.version} + + + javax.mail + mail + ${javax.mail.version} + + + nl.jqno.equalsverifier + equalsverifier + ${equalsverifier.version} + test + + + + + core-java-lang + + + src/main/resources + true + + + + + + org.apache.maven.plugins + maven-surefire-plugin + + + **/*LiveTest.java + **/*IntegrationTest.java + **/*IntTest.java + **/*LongRunningUnitTest.java + **/*ManualTest.java + + true + + + + + org.apache.maven.plugins + maven-dependency-plugin + + + copy-dependencies + prepare-package + + copy-dependencies + + + ${project.build.directory}/libs + + + + + + + org.apache.maven.plugins + maven-jar-plugin + ${maven-jar-plugin.version} + + + + true + libs/ + org.baeldung.executable.ExecutableMavenJar + + + + + + + org.apache.maven.plugins + maven-assembly-plugin + + + package + + single + + + ${project.basedir} + + + org.baeldung.executable.ExecutableMavenJar + + + + jar-with-dependencies + + + + + + + + org.apache.maven.plugins + maven-shade-plugin + ${maven-shade-plugin.version} + + + + shade + + + true + + + org.baeldung.executable.ExecutableMavenJar + + + + + + + + + com.jolira + onejar-maven-plugin + ${onejar-maven-plugin.version} + + + + org.baeldung.executable.ExecutableMavenJar + true + ${project.build.finalName}-onejar.${project.packaging} + + + one-jar + + + + + + + org.springframework.boot + spring-boot-maven-plugin + ${spring-boot-maven-plugin.version} + + + + repackage + + + spring-boot + org.baeldung.executable.ExecutableMavenJar + + + + + + + org.codehaus.mojo + exec-maven-plugin + ${exec-maven-plugin.version} + + java + com.baeldung.outofmemoryerror.OutOfMemoryGCLimitExceed + + -Xmx300m + -XX:+UseParallelGC + -classpath + + com.baeldung.outofmemoryerror.OutOfMemoryGCLimitExceed + + + + + + org.apache.maven.plugins + maven-javadoc-plugin + ${maven-javadoc-plugin.version} + + 1.8 + 1.8 + + + + + + + + integration + + + + org.apache.maven.plugins + maven-surefire-plugin + + + integration-test + + test + + + + **/*ManualTest.java + + + **/*IntegrationTest.java + **/*IntTest.java + + + + + + + json + + + + + org.codehaus.mojo + exec-maven-plugin + ${exec-maven-plugin.version} + + + run-benchmarks + + none + + exec + + + test + java + + -classpath + + org.openjdk.jmh.Main + .* + + + + + + + + + + + + buildAgentLoader + + + + org.apache.maven.plugins + maven-jar-plugin + + + package + + jar + + + agentLoader + target/classes + + + true + + ${project.build.outputDirectory}/META-INF/MANIFEST.MF + + + + com/baeldung/instrumentation/application/AgentLoader.class + com/baeldung/instrumentation/application/Launcher.class + + + + + + + + + + buildApplication + + + + org.apache.maven.plugins + maven-jar-plugin + + + package + + jar + + + application + target/classes + + + true + + ${project.build.outputDirectory}/META-INF/MANIFEST.MF + + + + com/baeldung/instrumentation/application/MyAtm.class + com/baeldung/instrumentation/application/MyAtmApplication.class + com/baeldung/instrumentation/application/Launcher.class + + + + + + + + + + buildAgent + + + + org.apache.maven.plugins + maven-jar-plugin + + + package + + jar + + + agent + target/classes + + + true + + ${project.build.outputDirectory}/META-INF/MANIFEST.MF + + + + com/baeldung/instrumentation/agent/AtmTransformer.class + com/baeldung/instrumentation/agent/MyInstrumentationAgent.class + + + + + + + + + + + + + + 2.8.5 + 2.8.2 + + + 3.5 + 1.16.12 + + 1.5.0-b01 + + + 3.10.0 + + + 2.21.0 + 4.3.4.RELEASE + 3.0.0-M1 + 3.0.2 + 1.4.4 + 3.1.1 + 2.0.3.RELEASE + 1.6.0 + 3.0.3 + + + diff --git a/core-java/src/main/java/com/baeldung/accessmodifiers/Public.java b/core-java-lang/src/main/java/com/baeldung/accessmodifiers/Public.java similarity index 100% rename from core-java/src/main/java/com/baeldung/accessmodifiers/Public.java rename to core-java-lang/src/main/java/com/baeldung/accessmodifiers/Public.java diff --git a/core-java/src/main/java/com/baeldung/accessmodifiers/SubClass.java b/core-java-lang/src/main/java/com/baeldung/accessmodifiers/SubClass.java similarity index 100% rename from core-java/src/main/java/com/baeldung/accessmodifiers/SubClass.java rename to core-java-lang/src/main/java/com/baeldung/accessmodifiers/SubClass.java diff --git a/core-java/src/main/java/com/baeldung/accessmodifiers/SuperPublic.java b/core-java-lang/src/main/java/com/baeldung/accessmodifiers/SuperPublic.java similarity index 100% rename from core-java/src/main/java/com/baeldung/accessmodifiers/SuperPublic.java rename to core-java-lang/src/main/java/com/baeldung/accessmodifiers/SuperPublic.java diff --git a/core-java/src/main/java/com/baeldung/accessmodifiers/another/AnotherPublic.java b/core-java-lang/src/main/java/com/baeldung/accessmodifiers/another/AnotherPublic.java similarity index 100% rename from core-java/src/main/java/com/baeldung/accessmodifiers/another/AnotherPublic.java rename to core-java-lang/src/main/java/com/baeldung/accessmodifiers/another/AnotherPublic.java diff --git a/core-java/src/main/java/com/baeldung/accessmodifiers/another/AnotherSubClass.java b/core-java-lang/src/main/java/com/baeldung/accessmodifiers/another/AnotherSubClass.java similarity index 100% rename from core-java/src/main/java/com/baeldung/accessmodifiers/another/AnotherSubClass.java rename to core-java-lang/src/main/java/com/baeldung/accessmodifiers/another/AnotherSubClass.java diff --git a/core-java/src/main/java/com/baeldung/accessmodifiers/another/AnotherSuperPublic.java b/core-java-lang/src/main/java/com/baeldung/accessmodifiers/another/AnotherSuperPublic.java similarity index 100% rename from core-java/src/main/java/com/baeldung/accessmodifiers/another/AnotherSuperPublic.java rename to core-java-lang/src/main/java/com/baeldung/accessmodifiers/another/AnotherSuperPublic.java diff --git a/core-java/src/main/java/com/baeldung/assertion/Assertion.java b/core-java-lang/src/main/java/com/baeldung/assertion/Assertion.java similarity index 100% rename from core-java/src/main/java/com/baeldung/assertion/Assertion.java rename to core-java-lang/src/main/java/com/baeldung/assertion/Assertion.java diff --git a/core-java/src/main/java/com/baeldung/binding/Animal.java b/core-java-lang/src/main/java/com/baeldung/binding/Animal.java similarity index 100% rename from core-java/src/main/java/com/baeldung/binding/Animal.java rename to core-java-lang/src/main/java/com/baeldung/binding/Animal.java diff --git a/core-java/src/main/java/com/baeldung/binding/AnimalActivity.java b/core-java-lang/src/main/java/com/baeldung/binding/AnimalActivity.java similarity index 100% rename from core-java/src/main/java/com/baeldung/binding/AnimalActivity.java rename to core-java-lang/src/main/java/com/baeldung/binding/AnimalActivity.java diff --git a/core-java/src/main/java/com/baeldung/binding/Cat.java b/core-java-lang/src/main/java/com/baeldung/binding/Cat.java similarity index 100% rename from core-java/src/main/java/com/baeldung/binding/Cat.java rename to core-java-lang/src/main/java/com/baeldung/binding/Cat.java diff --git a/core-java/src/main/java/com/baeldung/breakcontinue/BreakContinue.java b/core-java-lang/src/main/java/com/baeldung/breakcontinue/BreakContinue.java similarity index 99% rename from core-java/src/main/java/com/baeldung/breakcontinue/BreakContinue.java rename to core-java-lang/src/main/java/com/baeldung/breakcontinue/BreakContinue.java index ce85b487c1..23bb531273 100644 --- a/core-java/src/main/java/com/baeldung/breakcontinue/BreakContinue.java +++ b/core-java-lang/src/main/java/com/baeldung/breakcontinue/BreakContinue.java @@ -11,6 +11,7 @@ import java.util.Map.Entry; * @author Santosh * */ + public class BreakContinue { public static int unlabeledBreak() { diff --git a/core-java/src/main/java/com/baeldung/casting/Animal.java b/core-java-lang/src/main/java/com/baeldung/casting/Animal.java similarity index 100% rename from core-java/src/main/java/com/baeldung/casting/Animal.java rename to core-java-lang/src/main/java/com/baeldung/casting/Animal.java diff --git a/core-java/src/main/java/com/baeldung/casting/AnimalFeeder.java b/core-java-lang/src/main/java/com/baeldung/casting/AnimalFeeder.java similarity index 100% rename from core-java/src/main/java/com/baeldung/casting/AnimalFeeder.java rename to core-java-lang/src/main/java/com/baeldung/casting/AnimalFeeder.java diff --git a/core-java/src/main/java/com/baeldung/casting/AnimalFeederGeneric.java b/core-java-lang/src/main/java/com/baeldung/casting/AnimalFeederGeneric.java similarity index 100% rename from core-java/src/main/java/com/baeldung/casting/AnimalFeederGeneric.java rename to core-java-lang/src/main/java/com/baeldung/casting/AnimalFeederGeneric.java diff --git a/core-java/src/main/java/com/baeldung/casting/Cat.java b/core-java-lang/src/main/java/com/baeldung/casting/Cat.java similarity index 100% rename from core-java/src/main/java/com/baeldung/casting/Cat.java rename to core-java-lang/src/main/java/com/baeldung/casting/Cat.java diff --git a/core-java/src/main/java/com/baeldung/casting/Dog.java b/core-java-lang/src/main/java/com/baeldung/casting/Dog.java similarity index 100% rename from core-java/src/main/java/com/baeldung/casting/Dog.java rename to core-java-lang/src/main/java/com/baeldung/casting/Dog.java diff --git a/core-java/src/main/java/com/baeldung/casting/Mew.java b/core-java-lang/src/main/java/com/baeldung/casting/Mew.java similarity index 100% rename from core-java/src/main/java/com/baeldung/casting/Mew.java rename to core-java-lang/src/main/java/com/baeldung/casting/Mew.java diff --git a/core-java/src/main/java/com/baeldung/chainedexception/LogWithChain.java b/core-java-lang/src/main/java/com/baeldung/chainedexception/LogWithChain.java similarity index 100% rename from core-java/src/main/java/com/baeldung/chainedexception/LogWithChain.java rename to core-java-lang/src/main/java/com/baeldung/chainedexception/LogWithChain.java diff --git a/core-java/src/main/java/com/baeldung/chainedexception/LogWithoutChain.java b/core-java-lang/src/main/java/com/baeldung/chainedexception/LogWithoutChain.java similarity index 100% rename from core-java/src/main/java/com/baeldung/chainedexception/LogWithoutChain.java rename to core-java-lang/src/main/java/com/baeldung/chainedexception/LogWithoutChain.java diff --git a/core-java/src/main/java/com/baeldung/chainedexception/exceptions/GirlFriendOfManagerUpsetException.java b/core-java-lang/src/main/java/com/baeldung/chainedexception/exceptions/GirlFriendOfManagerUpsetException.java similarity index 100% rename from core-java/src/main/java/com/baeldung/chainedexception/exceptions/GirlFriendOfManagerUpsetException.java rename to core-java-lang/src/main/java/com/baeldung/chainedexception/exceptions/GirlFriendOfManagerUpsetException.java diff --git a/core-java/src/main/java/com/baeldung/chainedexception/exceptions/ManagerUpsetException.java b/core-java-lang/src/main/java/com/baeldung/chainedexception/exceptions/ManagerUpsetException.java similarity index 100% rename from core-java/src/main/java/com/baeldung/chainedexception/exceptions/ManagerUpsetException.java rename to core-java-lang/src/main/java/com/baeldung/chainedexception/exceptions/ManagerUpsetException.java diff --git a/core-java/src/main/java/com/baeldung/chainedexception/exceptions/NoLeaveGrantedException.java b/core-java-lang/src/main/java/com/baeldung/chainedexception/exceptions/NoLeaveGrantedException.java similarity index 100% rename from core-java/src/main/java/com/baeldung/chainedexception/exceptions/NoLeaveGrantedException.java rename to core-java-lang/src/main/java/com/baeldung/chainedexception/exceptions/NoLeaveGrantedException.java diff --git a/core-java/src/main/java/com/baeldung/chainedexception/exceptions/TeamLeadUpsetException.java b/core-java-lang/src/main/java/com/baeldung/chainedexception/exceptions/TeamLeadUpsetException.java similarity index 100% rename from core-java/src/main/java/com/baeldung/chainedexception/exceptions/TeamLeadUpsetException.java rename to core-java-lang/src/main/java/com/baeldung/chainedexception/exceptions/TeamLeadUpsetException.java diff --git a/core-java-lang/src/main/java/com/baeldung/className/RetrievingClassName.java b/core-java-lang/src/main/java/com/baeldung/className/RetrievingClassName.java new file mode 100644 index 0000000000..ab6c8a51ff --- /dev/null +++ b/core-java-lang/src/main/java/com/baeldung/className/RetrievingClassName.java @@ -0,0 +1,9 @@ +package com.baeldung.className; + +public class RetrievingClassName { + + public class InnerClass { + + } + +} diff --git a/core-java/src/main/java/com/baeldung/comparable/Player.java b/core-java-lang/src/main/java/com/baeldung/comparable/Player.java similarity index 100% rename from core-java/src/main/java/com/baeldung/comparable/Player.java rename to core-java-lang/src/main/java/com/baeldung/comparable/Player.java diff --git a/core-java/src/main/java/com/baeldung/comparable/PlayerSorter.java b/core-java-lang/src/main/java/com/baeldung/comparable/PlayerSorter.java similarity index 100% rename from core-java/src/main/java/com/baeldung/comparable/PlayerSorter.java rename to core-java-lang/src/main/java/com/baeldung/comparable/PlayerSorter.java diff --git a/core-java/src/main/java/com/baeldung/comparator/Player.java b/core-java-lang/src/main/java/com/baeldung/comparator/Player.java similarity index 100% rename from core-java/src/main/java/com/baeldung/comparator/Player.java rename to core-java-lang/src/main/java/com/baeldung/comparator/Player.java diff --git a/core-java/src/main/java/com/baeldung/comparator/PlayerAgeComparator.java b/core-java-lang/src/main/java/com/baeldung/comparator/PlayerAgeComparator.java similarity index 100% rename from core-java/src/main/java/com/baeldung/comparator/PlayerAgeComparator.java rename to core-java-lang/src/main/java/com/baeldung/comparator/PlayerAgeComparator.java diff --git a/core-java/src/main/java/com/baeldung/comparator/PlayerAgeSorter.java b/core-java-lang/src/main/java/com/baeldung/comparator/PlayerAgeSorter.java similarity index 100% rename from core-java/src/main/java/com/baeldung/comparator/PlayerAgeSorter.java rename to core-java-lang/src/main/java/com/baeldung/comparator/PlayerAgeSorter.java diff --git a/core-java/src/main/java/com/baeldung/comparator/PlayerRankingComparator.java b/core-java-lang/src/main/java/com/baeldung/comparator/PlayerRankingComparator.java similarity index 100% rename from core-java/src/main/java/com/baeldung/comparator/PlayerRankingComparator.java rename to core-java-lang/src/main/java/com/baeldung/comparator/PlayerRankingComparator.java diff --git a/core-java/src/main/java/com/baeldung/comparator/PlayerRankingSorter.java b/core-java-lang/src/main/java/com/baeldung/comparator/PlayerRankingSorter.java similarity index 100% rename from core-java/src/main/java/com/baeldung/comparator/PlayerRankingSorter.java rename to core-java-lang/src/main/java/com/baeldung/comparator/PlayerRankingSorter.java diff --git a/core-java-lang/src/main/java/com/baeldung/constructors/BankAccount.java b/core-java-lang/src/main/java/com/baeldung/constructors/BankAccount.java new file mode 100644 index 0000000000..3d50e85245 --- /dev/null +++ b/core-java-lang/src/main/java/com/baeldung/constructors/BankAccount.java @@ -0,0 +1,56 @@ +package com.baeldung.constructors; + +import java.time.LocalDateTime; + +class BankAccount { + String name; + LocalDateTime opened; + double balance; + + @Override + public String toString() { + return String.format("%s, %s, %f", this.name, this.opened.toString(), this.balance); + } + + public String getName() { + return name; + } + + public LocalDateTime getOpened() { + return opened; + } + + public double getBalance() { + return this.balance; + } +} + +class BankAccountEmptyConstructor extends BankAccount { + public BankAccountEmptyConstructor() { + this.name = ""; + this.opened = LocalDateTime.now(); + this.balance = 0.0d; + } +} + +class BankAccountParameterizedConstructor extends BankAccount { + public BankAccountParameterizedConstructor(String name, LocalDateTime opened, double balance) { + this.name = name; + this.opened = opened; + this.balance = balance; + } +} + +class BankAccountCopyConstructor extends BankAccount { + public BankAccountCopyConstructor(String name, LocalDateTime opened, double balance) { + this.name = name; + this.opened = opened; + this.balance = balance; + } + + public BankAccountCopyConstructor(BankAccount other) { + this.name = other.name; + this.opened = LocalDateTime.now(); + this.balance = 0.0f; + } +} diff --git a/core-java-lang/src/main/java/com/baeldung/constructors/Transaction.java b/core-java-lang/src/main/java/com/baeldung/constructors/Transaction.java new file mode 100644 index 0000000000..14704f507a --- /dev/null +++ b/core-java-lang/src/main/java/com/baeldung/constructors/Transaction.java @@ -0,0 +1,25 @@ +package com.baeldung.constructors; + +import java.time.LocalDateTime; + +class Transaction { + final BankAccountEmptyConstructor bankAccount; + final LocalDateTime date; + final double amount; + + public Transaction(BankAccountEmptyConstructor account, LocalDateTime date, double amount) { + this.bankAccount = account; + this.date = date; + this.amount = amount; + } + + /* + * Compilation Error :'(, all final variables must be explicitly initialised. + * public Transaction() { + * } + */ + + public void invalidMethod() { + // this.amount = 102.03; // Results in a compiler error. You cannot change the value of a final variable. + } +} diff --git a/core-java/src/main/java/com/baeldung/customexception/FileManager.java b/core-java-lang/src/main/java/com/baeldung/customexception/FileManager.java similarity index 100% rename from core-java/src/main/java/com/baeldung/customexception/FileManager.java rename to core-java-lang/src/main/java/com/baeldung/customexception/FileManager.java diff --git a/core-java/src/main/java/com/baeldung/customexception/IncorrectFileExtensionException.java b/core-java-lang/src/main/java/com/baeldung/customexception/IncorrectFileExtensionException.java similarity index 100% rename from core-java/src/main/java/com/baeldung/customexception/IncorrectFileExtensionException.java rename to core-java-lang/src/main/java/com/baeldung/customexception/IncorrectFileExtensionException.java diff --git a/core-java/src/main/java/com/baeldung/customexception/IncorrectFileNameException.java b/core-java-lang/src/main/java/com/baeldung/customexception/IncorrectFileNameException.java similarity index 100% rename from core-java/src/main/java/com/baeldung/customexception/IncorrectFileNameException.java rename to core-java-lang/src/main/java/com/baeldung/customexception/IncorrectFileNameException.java diff --git a/core-java/src/main/java/com/baeldung/deepcopy/Address.java b/core-java-lang/src/main/java/com/baeldung/deepcopy/Address.java similarity index 100% rename from core-java/src/main/java/com/baeldung/deepcopy/Address.java rename to core-java-lang/src/main/java/com/baeldung/deepcopy/Address.java diff --git a/core-java/src/main/java/com/baeldung/deepcopy/User.java b/core-java-lang/src/main/java/com/baeldung/deepcopy/User.java similarity index 100% rename from core-java/src/main/java/com/baeldung/deepcopy/User.java rename to core-java-lang/src/main/java/com/baeldung/deepcopy/User.java diff --git a/core-java/src/main/java/com/baeldung/doubles/SplitFloatingPointNumbers.java b/core-java-lang/src/main/java/com/baeldung/doubles/SplitFloatingPointNumbers.java similarity index 100% rename from core-java/src/main/java/com/baeldung/doubles/SplitFloatingPointNumbers.java rename to core-java-lang/src/main/java/com/baeldung/doubles/SplitFloatingPointNumbers.java diff --git a/core-java/src/main/java/com/baeldung/dynamicproxy/DynamicInvocationHandler.java b/core-java-lang/src/main/java/com/baeldung/dynamicproxy/DynamicInvocationHandler.java similarity index 100% rename from core-java/src/main/java/com/baeldung/dynamicproxy/DynamicInvocationHandler.java rename to core-java-lang/src/main/java/com/baeldung/dynamicproxy/DynamicInvocationHandler.java diff --git a/core-java/src/main/java/com/baeldung/dynamicproxy/TimingDynamicInvocationHandler.java b/core-java-lang/src/main/java/com/baeldung/dynamicproxy/TimingDynamicInvocationHandler.java similarity index 100% rename from core-java/src/main/java/com/baeldung/dynamicproxy/TimingDynamicInvocationHandler.java rename to core-java-lang/src/main/java/com/baeldung/dynamicproxy/TimingDynamicInvocationHandler.java diff --git a/core-java/src/main/java/com/baeldung/enums/Pizza.java b/core-java-lang/src/main/java/com/baeldung/enums/Pizza.java similarity index 100% rename from core-java/src/main/java/com/baeldung/enums/Pizza.java rename to core-java-lang/src/main/java/com/baeldung/enums/Pizza.java diff --git a/core-java/src/main/java/com/baeldung/enums/PizzaDeliveryStrategy.java b/core-java-lang/src/main/java/com/baeldung/enums/PizzaDeliveryStrategy.java similarity index 100% rename from core-java/src/main/java/com/baeldung/enums/PizzaDeliveryStrategy.java rename to core-java-lang/src/main/java/com/baeldung/enums/PizzaDeliveryStrategy.java diff --git a/core-java/src/main/java/com/baeldung/enums/PizzaDeliverySystemConfiguration.java b/core-java-lang/src/main/java/com/baeldung/enums/PizzaDeliverySystemConfiguration.java similarity index 100% rename from core-java/src/main/java/com/baeldung/enums/PizzaDeliverySystemConfiguration.java rename to core-java-lang/src/main/java/com/baeldung/enums/PizzaDeliverySystemConfiguration.java diff --git a/core-java/src/main/java/com/baeldung/enums/README.md b/core-java-lang/src/main/java/com/baeldung/enums/README.md similarity index 100% rename from core-java/src/main/java/com/baeldung/enums/README.md rename to core-java-lang/src/main/java/com/baeldung/enums/README.md diff --git a/core-java-lang/src/main/java/com/baeldung/equalshashcode/Money.java b/core-java-lang/src/main/java/com/baeldung/equalshashcode/Money.java new file mode 100644 index 0000000000..60c043545d --- /dev/null +++ b/core-java-lang/src/main/java/com/baeldung/equalshashcode/Money.java @@ -0,0 +1,36 @@ +package com.baeldung.equalshashcode; + +class Money { + + int amount; + String currencyCode; + + Money(int amount, String currencyCode) { + this.amount = amount; + this.currencyCode = currencyCode; + } + + @Override + public boolean equals(Object o) { + if (o == this) + return true; + if (!(o instanceof Money)) + return false; + Money other = (Money)o; + boolean currencyCodeEquals = (this.currencyCode == null && other.currencyCode == null) + || (this.currencyCode != null && this.currencyCode.equals(other.currencyCode)); + return this.amount == other.amount + && currencyCodeEquals; + } + + @Override + public int hashCode() { + int result = 17; + result = 31 * result + amount; + if (currencyCode != null) { + result = 31 * result + currencyCode.hashCode(); + } + return result; + } + +} diff --git a/core-java-lang/src/main/java/com/baeldung/equalshashcode/Team.java b/core-java-lang/src/main/java/com/baeldung/equalshashcode/Team.java new file mode 100644 index 0000000000..c2dee1de6b --- /dev/null +++ b/core-java-lang/src/main/java/com/baeldung/equalshashcode/Team.java @@ -0,0 +1,39 @@ +package com.baeldung.equalshashcode; + +class Team { + + final String city; + final String department; + + Team(String city, String department) { + this.city = city; + this.department = department; + } + + @Override + public final boolean equals(Object o) { + if (o == this) + return true; + if (!(o instanceof Team)) + return false; + Team otherTeam = (Team)o; + boolean cityEquals = (this.city == null && otherTeam.city == null) + || this.city != null && this.city.equals(otherTeam.city); + boolean departmentEquals = (this.department == null && otherTeam.department == null) + || this.department != null && this.department.equals(otherTeam.department); + return cityEquals && departmentEquals; + } + + @Override + public final int hashCode() { + int result = 17; + if (city != null) { + result = 31 * result + city.hashCode(); + } + if (department != null) { + result = 31 * result + department.hashCode(); + } + return result; + } + +} diff --git a/core-java-lang/src/main/java/com/baeldung/equalshashcode/Voucher.java b/core-java-lang/src/main/java/com/baeldung/equalshashcode/Voucher.java new file mode 100644 index 0000000000..19f46e0358 --- /dev/null +++ b/core-java-lang/src/main/java/com/baeldung/equalshashcode/Voucher.java @@ -0,0 +1,38 @@ +package com.baeldung.equalshashcode; + +class Voucher { + + private Money value; + private String store; + + Voucher(int amount, String currencyCode, String store) { + this.value = new Money(amount, currencyCode); + this.store = store; + } + + @Override + public boolean equals(Object o) { + if (o == this) + return true; + if (!(o instanceof Voucher)) + return false; + Voucher other = (Voucher)o; + boolean valueEquals = (this.value == null && other.value == null) + || (this.value != null && this.value.equals(other.value)); + boolean storeEquals = (this.store == null && other.store == null) + || (this.store != null && this.store.equals(other.store)); + return valueEquals && storeEquals; + } + + @Override + public int hashCode() { + int result = 17; + if (this.value != null) { + result = 31 * result + value.hashCode(); + } + if (this.store != null) { + result = 31 * result + store.hashCode(); + } + return result; + } +} \ No newline at end of file diff --git a/core-java-lang/src/main/java/com/baeldung/equalshashcode/WrongTeam.java b/core-java-lang/src/main/java/com/baeldung/equalshashcode/WrongTeam.java new file mode 100644 index 0000000000..c4477aa790 --- /dev/null +++ b/core-java-lang/src/main/java/com/baeldung/equalshashcode/WrongTeam.java @@ -0,0 +1,30 @@ +package com.baeldung.equalshashcode; + +/* (non-Javadoc) +* This class overrides equals, but it doesn't override hashCode. +* +* To see which problems this leads to: +* TeamUnitTest.givenMapKeyWithoutHashCode_whenSearched_thenReturnsWrongValue +*/ +class WrongTeam { + + String city; + String department; + + WrongTeam(String city, String department) { + this.city = city; + this.department = department; + } + + @Override + public boolean equals(Object o) { + if (o == this) + return true; + if (!(o instanceof WrongTeam)) + return false; + WrongTeam otherTeam = (WrongTeam)o; + return this.city == otherTeam.city + && this.department == otherTeam.department; + } + +} diff --git a/core-java-lang/src/main/java/com/baeldung/equalshashcode/WrongVoucher.java b/core-java-lang/src/main/java/com/baeldung/equalshashcode/WrongVoucher.java new file mode 100644 index 0000000000..97935bf8de --- /dev/null +++ b/core-java-lang/src/main/java/com/baeldung/equalshashcode/WrongVoucher.java @@ -0,0 +1,47 @@ +package com.baeldung.equalshashcode; + +/* (non-Javadoc) +* This class extends the Money class that has overridden the equals method and once again overrides the equals method. +* +* To see which problems this leads to: +* MoneyUnitTest.givenMoneyAndVoucherInstances_whenEquals_thenReturnValuesArentSymmetric +*/ +class WrongVoucher extends Money { + + private String store; + + WrongVoucher(int amount, String currencyCode, String store) { + super(amount, currencyCode); + + this.store = store; + } + + @Override + public boolean equals(Object o) { + if (o == this) + return true; + if (!(o instanceof WrongVoucher)) + return false; + WrongVoucher other = (WrongVoucher)o; + boolean currencyCodeEquals = (this.currencyCode == null && other.currencyCode == null) + || (this.currencyCode != null && this.currencyCode.equals(other.currencyCode)); + boolean storeEquals = (this.store == null && other.store == null) + || (this.store != null && this.store.equals(other.store)); + return this.amount == other.amount + && currencyCodeEquals + && storeEquals; + } + + @Override + public int hashCode() { + int result = 17; + result = 31 * result + amount; + if (this.currencyCode != null) { + result = 31 * result + currencyCode.hashCode(); + } + if (this.store != null) { + result = 31 * result + store.hashCode(); + } + return result; + } +} \ No newline at end of file diff --git a/core-java/src/main/java/com/baeldung/equalshashcode/entities/ComplexClass.java b/core-java-lang/src/main/java/com/baeldung/equalshashcode/entities/ComplexClass.java similarity index 100% rename from core-java/src/main/java/com/baeldung/equalshashcode/entities/ComplexClass.java rename to core-java-lang/src/main/java/com/baeldung/equalshashcode/entities/ComplexClass.java diff --git a/core-java/src/main/java/com/baeldung/equalshashcode/entities/PrimitiveClass.java b/core-java-lang/src/main/java/com/baeldung/equalshashcode/entities/PrimitiveClass.java similarity index 100% rename from core-java/src/main/java/com/baeldung/equalshashcode/entities/PrimitiveClass.java rename to core-java-lang/src/main/java/com/baeldung/equalshashcode/entities/PrimitiveClass.java diff --git a/core-java/src/main/java/com/baeldung/equalshashcode/entities/Rectangle.java b/core-java-lang/src/main/java/com/baeldung/equalshashcode/entities/Rectangle.java similarity index 100% rename from core-java/src/main/java/com/baeldung/equalshashcode/entities/Rectangle.java rename to core-java-lang/src/main/java/com/baeldung/equalshashcode/entities/Rectangle.java diff --git a/core-java/src/main/java/com/baeldung/equalshashcode/entities/Shape.java b/core-java-lang/src/main/java/com/baeldung/equalshashcode/entities/Shape.java similarity index 100% rename from core-java/src/main/java/com/baeldung/equalshashcode/entities/Shape.java rename to core-java-lang/src/main/java/com/baeldung/equalshashcode/entities/Shape.java diff --git a/core-java/src/main/java/com/baeldung/equalshashcode/entities/Square.java b/core-java-lang/src/main/java/com/baeldung/equalshashcode/entities/Square.java similarity index 100% rename from core-java/src/main/java/com/baeldung/equalshashcode/entities/Square.java rename to core-java-lang/src/main/java/com/baeldung/equalshashcode/entities/Square.java diff --git a/core-java/src/main/java/com/baeldung/exceptionhandling/Exceptions.java b/core-java-lang/src/main/java/com/baeldung/exceptionhandling/Exceptions.java similarity index 100% rename from core-java/src/main/java/com/baeldung/exceptionhandling/Exceptions.java rename to core-java-lang/src/main/java/com/baeldung/exceptionhandling/Exceptions.java diff --git a/core-java/src/main/java/com/baeldung/exceptionhandling/MyException.java b/core-java-lang/src/main/java/com/baeldung/exceptionhandling/MyException.java similarity index 100% rename from core-java/src/main/java/com/baeldung/exceptionhandling/MyException.java rename to core-java-lang/src/main/java/com/baeldung/exceptionhandling/MyException.java diff --git a/core-java/src/main/java/com/baeldung/exceptionhandling/Player.java b/core-java-lang/src/main/java/com/baeldung/exceptionhandling/Player.java similarity index 100% rename from core-java/src/main/java/com/baeldung/exceptionhandling/Player.java rename to core-java-lang/src/main/java/com/baeldung/exceptionhandling/Player.java diff --git a/core-java/src/main/java/com/baeldung/exceptionhandling/PlayerLoadException.java b/core-java-lang/src/main/java/com/baeldung/exceptionhandling/PlayerLoadException.java similarity index 100% rename from core-java/src/main/java/com/baeldung/exceptionhandling/PlayerLoadException.java rename to core-java-lang/src/main/java/com/baeldung/exceptionhandling/PlayerLoadException.java diff --git a/core-java/src/main/java/com/baeldung/exceptionhandling/PlayerScoreException.java b/core-java-lang/src/main/java/com/baeldung/exceptionhandling/PlayerScoreException.java similarity index 100% rename from core-java/src/main/java/com/baeldung/exceptionhandling/PlayerScoreException.java rename to core-java-lang/src/main/java/com/baeldung/exceptionhandling/PlayerScoreException.java diff --git a/core-java/src/main/java/com/baeldung/exceptionhandling/TimeoutException.java b/core-java-lang/src/main/java/com/baeldung/exceptionhandling/TimeoutException.java similarity index 100% rename from core-java/src/main/java/com/baeldung/exceptionhandling/TimeoutException.java rename to core-java-lang/src/main/java/com/baeldung/exceptionhandling/TimeoutException.java diff --git a/core-java/src/main/java/com/baeldung/finalize/CloseableResource.java b/core-java-lang/src/main/java/com/baeldung/finalize/CloseableResource.java similarity index 100% rename from core-java/src/main/java/com/baeldung/finalize/CloseableResource.java rename to core-java-lang/src/main/java/com/baeldung/finalize/CloseableResource.java diff --git a/core-java/src/main/java/com/baeldung/finalize/Finalizable.java b/core-java-lang/src/main/java/com/baeldung/finalize/Finalizable.java similarity index 100% rename from core-java/src/main/java/com/baeldung/finalize/Finalizable.java rename to core-java-lang/src/main/java/com/baeldung/finalize/Finalizable.java diff --git a/core-java/src/main/java/com/baeldung/finalkeyword/BlackCat.java b/core-java-lang/src/main/java/com/baeldung/finalkeyword/BlackCat.java similarity index 100% rename from core-java/src/main/java/com/baeldung/finalkeyword/BlackCat.java rename to core-java-lang/src/main/java/com/baeldung/finalkeyword/BlackCat.java diff --git a/core-java/src/main/java/com/baeldung/finalkeyword/BlackDog.java b/core-java-lang/src/main/java/com/baeldung/finalkeyword/BlackDog.java similarity index 100% rename from core-java/src/main/java/com/baeldung/finalkeyword/BlackDog.java rename to core-java-lang/src/main/java/com/baeldung/finalkeyword/BlackDog.java diff --git a/core-java/src/main/java/com/baeldung/finalkeyword/Cat.java b/core-java-lang/src/main/java/com/baeldung/finalkeyword/Cat.java similarity index 100% rename from core-java/src/main/java/com/baeldung/finalkeyword/Cat.java rename to core-java-lang/src/main/java/com/baeldung/finalkeyword/Cat.java diff --git a/core-java/src/main/java/com/baeldung/finalkeyword/Dog.java b/core-java-lang/src/main/java/com/baeldung/finalkeyword/Dog.java similarity index 100% rename from core-java/src/main/java/com/baeldung/finalkeyword/Dog.java rename to core-java-lang/src/main/java/com/baeldung/finalkeyword/Dog.java diff --git a/core-java/src/main/java/com/baeldung/generics/Building.java b/core-java-lang/src/main/java/com/baeldung/generics/Building.java similarity index 100% rename from core-java/src/main/java/com/baeldung/generics/Building.java rename to core-java-lang/src/main/java/com/baeldung/generics/Building.java diff --git a/core-java/src/main/java/com/baeldung/generics/Generics.java b/core-java-lang/src/main/java/com/baeldung/generics/Generics.java similarity index 100% rename from core-java/src/main/java/com/baeldung/generics/Generics.java rename to core-java-lang/src/main/java/com/baeldung/generics/Generics.java diff --git a/core-java/src/main/java/com/baeldung/generics/House.java b/core-java-lang/src/main/java/com/baeldung/generics/House.java similarity index 100% rename from core-java/src/main/java/com/baeldung/generics/House.java rename to core-java-lang/src/main/java/com/baeldung/generics/House.java diff --git a/core-java/src/main/java/com/baeldung/hashcode/entities/User.java b/core-java-lang/src/main/java/com/baeldung/hashcode/entities/User.java similarity index 100% rename from core-java/src/main/java/com/baeldung/hashcode/entities/User.java rename to core-java-lang/src/main/java/com/baeldung/hashcode/entities/User.java diff --git a/core-java/src/main/java/com/baeldung/immutableobjects/Currency.java b/core-java-lang/src/main/java/com/baeldung/immutableobjects/Currency.java similarity index 100% rename from core-java/src/main/java/com/baeldung/immutableobjects/Currency.java rename to core-java-lang/src/main/java/com/baeldung/immutableobjects/Currency.java diff --git a/core-java/src/main/java/com/baeldung/immutableobjects/Money.java b/core-java-lang/src/main/java/com/baeldung/immutableobjects/Money.java similarity index 100% rename from core-java/src/main/java/com/baeldung/immutableobjects/Money.java rename to core-java-lang/src/main/java/com/baeldung/immutableobjects/Money.java diff --git a/core-java/src/main/java/com/baeldung/inheritance/ArmoredCar.java b/core-java-lang/src/main/java/com/baeldung/inheritance/ArmoredCar.java similarity index 100% rename from core-java/src/main/java/com/baeldung/inheritance/ArmoredCar.java rename to core-java-lang/src/main/java/com/baeldung/inheritance/ArmoredCar.java diff --git a/core-java/src/main/java/com/baeldung/inheritance/BMW.java b/core-java-lang/src/main/java/com/baeldung/inheritance/BMW.java similarity index 100% rename from core-java/src/main/java/com/baeldung/inheritance/BMW.java rename to core-java-lang/src/main/java/com/baeldung/inheritance/BMW.java diff --git a/core-java/src/main/java/com/baeldung/inheritance/Car.java b/core-java-lang/src/main/java/com/baeldung/inheritance/Car.java similarity index 100% rename from core-java/src/main/java/com/baeldung/inheritance/Car.java rename to core-java-lang/src/main/java/com/baeldung/inheritance/Car.java diff --git a/core-java/src/main/java/com/baeldung/inheritance/Employee.java b/core-java-lang/src/main/java/com/baeldung/inheritance/Employee.java similarity index 100% rename from core-java/src/main/java/com/baeldung/inheritance/Employee.java rename to core-java-lang/src/main/java/com/baeldung/inheritance/Employee.java diff --git a/core-java/src/main/java/com/baeldung/inheritance/Floatable.java b/core-java-lang/src/main/java/com/baeldung/inheritance/Floatable.java similarity index 100% rename from core-java/src/main/java/com/baeldung/inheritance/Floatable.java rename to core-java-lang/src/main/java/com/baeldung/inheritance/Floatable.java diff --git a/core-java/src/main/java/com/baeldung/inheritance/Flyable.java b/core-java-lang/src/main/java/com/baeldung/inheritance/Flyable.java similarity index 100% rename from core-java/src/main/java/com/baeldung/inheritance/Flyable.java rename to core-java-lang/src/main/java/com/baeldung/inheritance/Flyable.java diff --git a/core-java/src/main/java/com/baeldung/inheritance/SpaceCar.java b/core-java-lang/src/main/java/com/baeldung/inheritance/SpaceCar.java similarity index 100% rename from core-java/src/main/java/com/baeldung/inheritance/SpaceCar.java rename to core-java-lang/src/main/java/com/baeldung/inheritance/SpaceCar.java diff --git a/core-java/src/main/java/com/baeldung/inheritance/SpaceTraveller.java b/core-java-lang/src/main/java/com/baeldung/inheritance/SpaceTraveller.java similarity index 100% rename from core-java/src/main/java/com/baeldung/inheritance/SpaceTraveller.java rename to core-java-lang/src/main/java/com/baeldung/inheritance/SpaceTraveller.java diff --git a/core-java/src/main/java/com/baeldung/inheritancecomposition/application/Application.java b/core-java-lang/src/main/java/com/baeldung/inheritancecomposition/application/Application.java similarity index 100% rename from core-java/src/main/java/com/baeldung/inheritancecomposition/application/Application.java rename to core-java-lang/src/main/java/com/baeldung/inheritancecomposition/application/Application.java diff --git a/core-java/src/main/java/com/baeldung/inheritancecomposition/model/Actress.java b/core-java-lang/src/main/java/com/baeldung/inheritancecomposition/model/Actress.java similarity index 100% rename from core-java/src/main/java/com/baeldung/inheritancecomposition/model/Actress.java rename to core-java-lang/src/main/java/com/baeldung/inheritancecomposition/model/Actress.java diff --git a/core-java/src/main/java/com/baeldung/inheritancecomposition/model/Computer.java b/core-java-lang/src/main/java/com/baeldung/inheritancecomposition/model/Computer.java similarity index 100% rename from core-java/src/main/java/com/baeldung/inheritancecomposition/model/Computer.java rename to core-java-lang/src/main/java/com/baeldung/inheritancecomposition/model/Computer.java diff --git a/core-java/src/main/java/com/baeldung/inheritancecomposition/model/Memory.java b/core-java-lang/src/main/java/com/baeldung/inheritancecomposition/model/Memory.java similarity index 100% rename from core-java/src/main/java/com/baeldung/inheritancecomposition/model/Memory.java rename to core-java-lang/src/main/java/com/baeldung/inheritancecomposition/model/Memory.java diff --git a/core-java/src/main/java/com/baeldung/inheritancecomposition/model/Person.java b/core-java-lang/src/main/java/com/baeldung/inheritancecomposition/model/Person.java similarity index 100% rename from core-java/src/main/java/com/baeldung/inheritancecomposition/model/Person.java rename to core-java-lang/src/main/java/com/baeldung/inheritancecomposition/model/Person.java diff --git a/core-java/src/main/java/com/baeldung/inheritancecomposition/model/Processor.java b/core-java-lang/src/main/java/com/baeldung/inheritancecomposition/model/Processor.java similarity index 100% rename from core-java/src/main/java/com/baeldung/inheritancecomposition/model/Processor.java rename to core-java-lang/src/main/java/com/baeldung/inheritancecomposition/model/Processor.java diff --git a/core-java/src/main/java/com/baeldung/inheritancecomposition/model/SoundCard.java b/core-java-lang/src/main/java/com/baeldung/inheritancecomposition/model/SoundCard.java similarity index 100% rename from core-java/src/main/java/com/baeldung/inheritancecomposition/model/SoundCard.java rename to core-java-lang/src/main/java/com/baeldung/inheritancecomposition/model/SoundCard.java diff --git a/core-java/src/main/java/com/baeldung/inheritancecomposition/model/StandardMemory.java b/core-java-lang/src/main/java/com/baeldung/inheritancecomposition/model/StandardMemory.java similarity index 100% rename from core-java/src/main/java/com/baeldung/inheritancecomposition/model/StandardMemory.java rename to core-java-lang/src/main/java/com/baeldung/inheritancecomposition/model/StandardMemory.java diff --git a/core-java/src/main/java/com/baeldung/inheritancecomposition/model/StandardProcessor.java b/core-java-lang/src/main/java/com/baeldung/inheritancecomposition/model/StandardProcessor.java similarity index 100% rename from core-java/src/main/java/com/baeldung/inheritancecomposition/model/StandardProcessor.java rename to core-java-lang/src/main/java/com/baeldung/inheritancecomposition/model/StandardProcessor.java diff --git a/core-java/src/main/java/com/baeldung/inheritancecomposition/model/StandardSoundCard.java b/core-java-lang/src/main/java/com/baeldung/inheritancecomposition/model/StandardSoundCard.java similarity index 100% rename from core-java/src/main/java/com/baeldung/inheritancecomposition/model/StandardSoundCard.java rename to core-java-lang/src/main/java/com/baeldung/inheritancecomposition/model/StandardSoundCard.java diff --git a/core-java/src/main/java/com/baeldung/inheritancecomposition/model/Waitress.java b/core-java-lang/src/main/java/com/baeldung/inheritancecomposition/model/Waitress.java similarity index 100% rename from core-java/src/main/java/com/baeldung/inheritancecomposition/model/Waitress.java rename to core-java-lang/src/main/java/com/baeldung/inheritancecomposition/model/Waitress.java diff --git a/core-java/src/main/java/com/baeldung/initializationguide/User.java b/core-java-lang/src/main/java/com/baeldung/initializationguide/User.java similarity index 100% rename from core-java/src/main/java/com/baeldung/initializationguide/User.java rename to core-java-lang/src/main/java/com/baeldung/initializationguide/User.java diff --git a/core-java/src/main/java/com/baeldung/interfaces/CommaSeparatedCustomers.java b/core-java-lang/src/main/java/com/baeldung/interfaces/CommaSeparatedCustomers.java similarity index 100% rename from core-java/src/main/java/com/baeldung/interfaces/CommaSeparatedCustomers.java rename to core-java-lang/src/main/java/com/baeldung/interfaces/CommaSeparatedCustomers.java diff --git a/core-java/src/main/java/com/baeldung/interfaces/Customer.java b/core-java-lang/src/main/java/com/baeldung/interfaces/Customer.java similarity index 100% rename from core-java/src/main/java/com/baeldung/interfaces/Customer.java rename to core-java-lang/src/main/java/com/baeldung/interfaces/Customer.java diff --git a/core-java/src/main/java/com/baeldung/java/reflection/Animal.java b/core-java-lang/src/main/java/com/baeldung/java/reflection/Animal.java similarity index 100% rename from core-java/src/main/java/com/baeldung/java/reflection/Animal.java rename to core-java-lang/src/main/java/com/baeldung/java/reflection/Animal.java diff --git a/core-java/src/main/java/com/baeldung/java/reflection/Bird.java b/core-java-lang/src/main/java/com/baeldung/java/reflection/Bird.java similarity index 100% rename from core-java/src/main/java/com/baeldung/java/reflection/Bird.java rename to core-java-lang/src/main/java/com/baeldung/java/reflection/Bird.java diff --git a/core-java/src/main/java/com/baeldung/java/reflection/DynamicGreeter.java b/core-java-lang/src/main/java/com/baeldung/java/reflection/DynamicGreeter.java similarity index 100% rename from core-java/src/main/java/com/baeldung/java/reflection/DynamicGreeter.java rename to core-java-lang/src/main/java/com/baeldung/java/reflection/DynamicGreeter.java diff --git a/core-java/src/main/java/com/baeldung/java/reflection/Eating.java b/core-java-lang/src/main/java/com/baeldung/java/reflection/Eating.java similarity index 100% rename from core-java/src/main/java/com/baeldung/java/reflection/Eating.java rename to core-java-lang/src/main/java/com/baeldung/java/reflection/Eating.java diff --git a/core-java/src/main/java/com/baeldung/java/reflection/Goat.java b/core-java-lang/src/main/java/com/baeldung/java/reflection/Goat.java similarity index 100% rename from core-java/src/main/java/com/baeldung/java/reflection/Goat.java rename to core-java-lang/src/main/java/com/baeldung/java/reflection/Goat.java diff --git a/core-java/src/main/java/com/baeldung/java/reflection/Greeter.java b/core-java-lang/src/main/java/com/baeldung/java/reflection/Greeter.java similarity index 100% rename from core-java/src/main/java/com/baeldung/java/reflection/Greeter.java rename to core-java-lang/src/main/java/com/baeldung/java/reflection/Greeter.java diff --git a/core-java/src/main/java/com/baeldung/java/reflection/GreetingAnnotation.java b/core-java-lang/src/main/java/com/baeldung/java/reflection/GreetingAnnotation.java similarity index 100% rename from core-java/src/main/java/com/baeldung/java/reflection/GreetingAnnotation.java rename to core-java-lang/src/main/java/com/baeldung/java/reflection/GreetingAnnotation.java diff --git a/core-java/src/main/java/com/baeldung/java/reflection/Greetings.java b/core-java-lang/src/main/java/com/baeldung/java/reflection/Greetings.java similarity index 100% rename from core-java/src/main/java/com/baeldung/java/reflection/Greetings.java rename to core-java-lang/src/main/java/com/baeldung/java/reflection/Greetings.java diff --git a/core-java/src/main/java/com/baeldung/java/reflection/Locomotion.java b/core-java-lang/src/main/java/com/baeldung/java/reflection/Locomotion.java similarity index 100% rename from core-java/src/main/java/com/baeldung/java/reflection/Locomotion.java rename to core-java-lang/src/main/java/com/baeldung/java/reflection/Locomotion.java diff --git a/core-java/src/main/java/com/baeldung/java/reflection/Operations.java b/core-java-lang/src/main/java/com/baeldung/java/reflection/Operations.java similarity index 100% rename from core-java/src/main/java/com/baeldung/java/reflection/Operations.java rename to core-java-lang/src/main/java/com/baeldung/java/reflection/Operations.java diff --git a/core-java/src/main/java/com/baeldung/java/reflection/Person.java b/core-java-lang/src/main/java/com/baeldung/java/reflection/Person.java similarity index 100% rename from core-java/src/main/java/com/baeldung/java/reflection/Person.java rename to core-java-lang/src/main/java/com/baeldung/java/reflection/Person.java diff --git a/core-java/src/main/java/com/baeldung/keyword/KeywordDemo.java b/core-java-lang/src/main/java/com/baeldung/keyword/KeywordDemo.java similarity index 100% rename from core-java/src/main/java/com/baeldung/keyword/KeywordDemo.java rename to core-java-lang/src/main/java/com/baeldung/keyword/KeywordDemo.java diff --git a/core-java/src/main/java/com/baeldung/keyword/superkeyword/SuperBase.java b/core-java-lang/src/main/java/com/baeldung/keyword/superkeyword/SuperBase.java similarity index 100% rename from core-java/src/main/java/com/baeldung/keyword/superkeyword/SuperBase.java rename to core-java-lang/src/main/java/com/baeldung/keyword/superkeyword/SuperBase.java diff --git a/core-java/src/main/java/com/baeldung/keyword/superkeyword/SuperSub.java b/core-java-lang/src/main/java/com/baeldung/keyword/superkeyword/SuperSub.java similarity index 100% rename from core-java/src/main/java/com/baeldung/keyword/superkeyword/SuperSub.java rename to core-java-lang/src/main/java/com/baeldung/keyword/superkeyword/SuperSub.java diff --git a/core-java/src/main/java/com/baeldung/keyword/thiskeyword/KeywordUnitTest.java b/core-java-lang/src/main/java/com/baeldung/keyword/thiskeyword/KeywordUnitTest.java similarity index 100% rename from core-java/src/main/java/com/baeldung/keyword/thiskeyword/KeywordUnitTest.java rename to core-java-lang/src/main/java/com/baeldung/keyword/thiskeyword/KeywordUnitTest.java diff --git a/core-java/src/main/java/com/baeldung/keywords/finalize/FinalizeObject.java b/core-java-lang/src/main/java/com/baeldung/keywords/finalize/FinalizeObject.java similarity index 100% rename from core-java/src/main/java/com/baeldung/keywords/finalize/FinalizeObject.java rename to core-java-lang/src/main/java/com/baeldung/keywords/finalize/FinalizeObject.java diff --git a/core-java/src/main/java/com/baeldung/keywords/finalkeyword/Child.java b/core-java-lang/src/main/java/com/baeldung/keywords/finalkeyword/Child.java similarity index 100% rename from core-java/src/main/java/com/baeldung/keywords/finalkeyword/Child.java rename to core-java-lang/src/main/java/com/baeldung/keywords/finalkeyword/Child.java diff --git a/core-java/src/main/java/com/baeldung/keywords/finalkeyword/GrandChild.java b/core-java-lang/src/main/java/com/baeldung/keywords/finalkeyword/GrandChild.java similarity index 100% rename from core-java/src/main/java/com/baeldung/keywords/finalkeyword/GrandChild.java rename to core-java-lang/src/main/java/com/baeldung/keywords/finalkeyword/GrandChild.java diff --git a/core-java/src/main/java/com/baeldung/keywords/finalkeyword/Parent.java b/core-java-lang/src/main/java/com/baeldung/keywords/finalkeyword/Parent.java similarity index 100% rename from core-java/src/main/java/com/baeldung/keywords/finalkeyword/Parent.java rename to core-java-lang/src/main/java/com/baeldung/keywords/finalkeyword/Parent.java diff --git a/core-java/src/main/java/com/baeldung/keywords/finallykeyword/FinallyExample.java b/core-java-lang/src/main/java/com/baeldung/keywords/finallykeyword/FinallyExample.java similarity index 100% rename from core-java/src/main/java/com/baeldung/keywords/finallykeyword/FinallyExample.java rename to core-java-lang/src/main/java/com/baeldung/keywords/finallykeyword/FinallyExample.java diff --git a/core-java/src/main/java/com/baeldung/loops/InfiniteLoops.java b/core-java-lang/src/main/java/com/baeldung/loops/InfiniteLoops.java similarity index 100% rename from core-java/src/main/java/com/baeldung/loops/InfiniteLoops.java rename to core-java-lang/src/main/java/com/baeldung/loops/InfiniteLoops.java diff --git a/core-java/src/main/java/com/baeldung/loops/LoopsInJava.java b/core-java-lang/src/main/java/com/baeldung/loops/LoopsInJava.java similarity index 100% rename from core-java/src/main/java/com/baeldung/loops/LoopsInJava.java rename to core-java-lang/src/main/java/com/baeldung/loops/LoopsInJava.java diff --git a/core-java/src/main/java/com/baeldung/methodoverloadingoverriding/application/Application.java b/core-java-lang/src/main/java/com/baeldung/methodoverloadingoverriding/application/Application.java similarity index 100% rename from core-java/src/main/java/com/baeldung/methodoverloadingoverriding/application/Application.java rename to core-java-lang/src/main/java/com/baeldung/methodoverloadingoverriding/application/Application.java diff --git a/core-java/src/main/java/com/baeldung/methodoverloadingoverriding/model/Car.java b/core-java-lang/src/main/java/com/baeldung/methodoverloadingoverriding/model/Car.java similarity index 100% rename from core-java/src/main/java/com/baeldung/methodoverloadingoverriding/model/Car.java rename to core-java-lang/src/main/java/com/baeldung/methodoverloadingoverriding/model/Car.java diff --git a/core-java/src/main/java/com/baeldung/methodoverloadingoverriding/model/Vehicle.java b/core-java-lang/src/main/java/com/baeldung/methodoverloadingoverriding/model/Vehicle.java similarity index 100% rename from core-java/src/main/java/com/baeldung/methodoverloadingoverriding/model/Vehicle.java rename to core-java-lang/src/main/java/com/baeldung/methodoverloadingoverriding/model/Vehicle.java diff --git a/core-java/src/main/java/com/baeldung/methodoverloadingoverriding/util/Multiplier.java b/core-java-lang/src/main/java/com/baeldung/methodoverloadingoverriding/util/Multiplier.java similarity index 100% rename from core-java/src/main/java/com/baeldung/methodoverloadingoverriding/util/Multiplier.java rename to core-java-lang/src/main/java/com/baeldung/methodoverloadingoverriding/util/Multiplier.java diff --git a/core-java/src/main/java/com/baeldung/noclassdeffounderror/ClassWithInitErrors.java b/core-java-lang/src/main/java/com/baeldung/noclassdeffounderror/ClassWithInitErrors.java similarity index 100% rename from core-java/src/main/java/com/baeldung/noclassdeffounderror/ClassWithInitErrors.java rename to core-java-lang/src/main/java/com/baeldung/noclassdeffounderror/ClassWithInitErrors.java diff --git a/core-java/src/main/java/com/baeldung/noclassdeffounderror/NoClassDefFoundErrorExample.java b/core-java-lang/src/main/java/com/baeldung/noclassdeffounderror/NoClassDefFoundErrorExample.java similarity index 100% rename from core-java/src/main/java/com/baeldung/noclassdeffounderror/NoClassDefFoundErrorExample.java rename to core-java-lang/src/main/java/com/baeldung/noclassdeffounderror/NoClassDefFoundErrorExample.java diff --git a/core-java/src/main/java/com/baeldung/parameterpassing/NonPrimitives.java b/core-java-lang/src/main/java/com/baeldung/parameterpassing/NonPrimitives.java similarity index 100% rename from core-java/src/main/java/com/baeldung/parameterpassing/NonPrimitives.java rename to core-java-lang/src/main/java/com/baeldung/parameterpassing/NonPrimitives.java diff --git a/core-java/src/main/java/com/baeldung/parameterpassing/Primitives.java b/core-java-lang/src/main/java/com/baeldung/parameterpassing/Primitives.java similarity index 100% rename from core-java/src/main/java/com/baeldung/parameterpassing/Primitives.java rename to core-java-lang/src/main/java/com/baeldung/parameterpassing/Primitives.java diff --git a/core-java/src/main/java/com/baeldung/polymorphism/FileManager.java b/core-java-lang/src/main/java/com/baeldung/polymorphism/FileManager.java similarity index 100% rename from core-java/src/main/java/com/baeldung/polymorphism/FileManager.java rename to core-java-lang/src/main/java/com/baeldung/polymorphism/FileManager.java diff --git a/core-java/src/main/java/com/baeldung/polymorphism/GenericFile.java b/core-java-lang/src/main/java/com/baeldung/polymorphism/GenericFile.java similarity index 100% rename from core-java/src/main/java/com/baeldung/polymorphism/GenericFile.java rename to core-java-lang/src/main/java/com/baeldung/polymorphism/GenericFile.java diff --git a/core-java/src/main/java/com/baeldung/polymorphism/ImageFile.java b/core-java-lang/src/main/java/com/baeldung/polymorphism/ImageFile.java similarity index 100% rename from core-java/src/main/java/com/baeldung/polymorphism/ImageFile.java rename to core-java-lang/src/main/java/com/baeldung/polymorphism/ImageFile.java diff --git a/core-java/src/main/java/com/baeldung/polymorphism/TextFile.java b/core-java-lang/src/main/java/com/baeldung/polymorphism/TextFile.java similarity index 100% rename from core-java/src/main/java/com/baeldung/polymorphism/TextFile.java rename to core-java-lang/src/main/java/com/baeldung/polymorphism/TextFile.java diff --git a/core-java/src/main/java/com/baeldung/recursion/BinaryNode.java b/core-java-lang/src/main/java/com/baeldung/recursion/BinaryNode.java similarity index 100% rename from core-java/src/main/java/com/baeldung/recursion/BinaryNode.java rename to core-java-lang/src/main/java/com/baeldung/recursion/BinaryNode.java diff --git a/core-java/src/main/java/com/baeldung/recursion/RecursionExample.java b/core-java-lang/src/main/java/com/baeldung/recursion/RecursionExample.java similarity index 100% rename from core-java/src/main/java/com/baeldung/recursion/RecursionExample.java rename to core-java-lang/src/main/java/com/baeldung/recursion/RecursionExample.java diff --git a/core-java/src/main/java/com/baeldung/scope/method/BaseMethodClass.java b/core-java-lang/src/main/java/com/baeldung/scope/method/BaseMethodClass.java similarity index 100% rename from core-java/src/main/java/com/baeldung/scope/method/BaseMethodClass.java rename to core-java-lang/src/main/java/com/baeldung/scope/method/BaseMethodClass.java diff --git a/core-java/src/main/java/com/baeldung/scope/method/ChildMethodClass.java b/core-java-lang/src/main/java/com/baeldung/scope/method/ChildMethodClass.java similarity index 100% rename from core-java/src/main/java/com/baeldung/scope/method/ChildMethodClass.java rename to core-java-lang/src/main/java/com/baeldung/scope/method/ChildMethodClass.java diff --git a/core-java/src/main/java/com/baeldung/scope/method/MethodHidingDemo.java b/core-java-lang/src/main/java/com/baeldung/scope/method/MethodHidingDemo.java similarity index 100% rename from core-java/src/main/java/com/baeldung/scope/method/MethodHidingDemo.java rename to core-java-lang/src/main/java/com/baeldung/scope/method/MethodHidingDemo.java diff --git a/core-java/src/main/java/com/baeldung/scope/variable/ChildVariable.java b/core-java-lang/src/main/java/com/baeldung/scope/variable/ChildVariable.java similarity index 100% rename from core-java/src/main/java/com/baeldung/scope/variable/ChildVariable.java rename to core-java-lang/src/main/java/com/baeldung/scope/variable/ChildVariable.java diff --git a/core-java/src/main/java/com/baeldung/scope/variable/HideVariable.java b/core-java-lang/src/main/java/com/baeldung/scope/variable/HideVariable.java similarity index 100% rename from core-java/src/main/java/com/baeldung/scope/variable/HideVariable.java rename to core-java-lang/src/main/java/com/baeldung/scope/variable/HideVariable.java diff --git a/core-java/src/main/java/com/baeldung/scope/variable/ParentVariable.java b/core-java-lang/src/main/java/com/baeldung/scope/variable/ParentVariable.java similarity index 100% rename from core-java/src/main/java/com/baeldung/scope/variable/ParentVariable.java rename to core-java-lang/src/main/java/com/baeldung/scope/variable/ParentVariable.java diff --git a/core-java/src/main/java/com/baeldung/scope/variable/VariableHidingDemo.java b/core-java-lang/src/main/java/com/baeldung/scope/variable/VariableHidingDemo.java similarity index 100% rename from core-java/src/main/java/com/baeldung/scope/variable/VariableHidingDemo.java rename to core-java-lang/src/main/java/com/baeldung/scope/variable/VariableHidingDemo.java diff --git a/core-java/src/main/java/com/baeldung/sneakythrows/SneakyRunnable.java b/core-java-lang/src/main/java/com/baeldung/sneakythrows/SneakyRunnable.java similarity index 100% rename from core-java/src/main/java/com/baeldung/sneakythrows/SneakyRunnable.java rename to core-java-lang/src/main/java/com/baeldung/sneakythrows/SneakyRunnable.java diff --git a/core-java/src/main/java/com/baeldung/sneakythrows/SneakyThrows.java b/core-java-lang/src/main/java/com/baeldung/sneakythrows/SneakyThrows.java similarity index 100% rename from core-java/src/main/java/com/baeldung/sneakythrows/SneakyThrows.java rename to core-java-lang/src/main/java/com/baeldung/sneakythrows/SneakyThrows.java diff --git a/core-java/src/main/java/com/baeldung/stackoverflowerror/AccountHolder.java b/core-java-lang/src/main/java/com/baeldung/stackoverflowerror/AccountHolder.java similarity index 100% rename from core-java/src/main/java/com/baeldung/stackoverflowerror/AccountHolder.java rename to core-java-lang/src/main/java/com/baeldung/stackoverflowerror/AccountHolder.java diff --git a/core-java/src/main/java/com/baeldung/stackoverflowerror/ClassOne.java b/core-java-lang/src/main/java/com/baeldung/stackoverflowerror/ClassOne.java similarity index 100% rename from core-java/src/main/java/com/baeldung/stackoverflowerror/ClassOne.java rename to core-java-lang/src/main/java/com/baeldung/stackoverflowerror/ClassOne.java diff --git a/core-java/src/main/java/com/baeldung/stackoverflowerror/ClassTwo.java b/core-java-lang/src/main/java/com/baeldung/stackoverflowerror/ClassTwo.java similarity index 100% rename from core-java/src/main/java/com/baeldung/stackoverflowerror/ClassTwo.java rename to core-java-lang/src/main/java/com/baeldung/stackoverflowerror/ClassTwo.java diff --git a/core-java/src/main/java/com/baeldung/stackoverflowerror/InfiniteRecursionWithTerminationCondition.java b/core-java-lang/src/main/java/com/baeldung/stackoverflowerror/InfiniteRecursionWithTerminationCondition.java similarity index 100% rename from core-java/src/main/java/com/baeldung/stackoverflowerror/InfiniteRecursionWithTerminationCondition.java rename to core-java-lang/src/main/java/com/baeldung/stackoverflowerror/InfiniteRecursionWithTerminationCondition.java diff --git a/core-java/src/main/java/com/baeldung/stackoverflowerror/RecursionWithCorrectTerminationCondition.java b/core-java-lang/src/main/java/com/baeldung/stackoverflowerror/RecursionWithCorrectTerminationCondition.java similarity index 100% rename from core-java/src/main/java/com/baeldung/stackoverflowerror/RecursionWithCorrectTerminationCondition.java rename to core-java-lang/src/main/java/com/baeldung/stackoverflowerror/RecursionWithCorrectTerminationCondition.java diff --git a/core-java/src/main/java/com/baeldung/stackoverflowerror/UnintendedInfiniteRecursion.java b/core-java-lang/src/main/java/com/baeldung/stackoverflowerror/UnintendedInfiniteRecursion.java similarity index 100% rename from core-java/src/main/java/com/baeldung/stackoverflowerror/UnintendedInfiniteRecursion.java rename to core-java-lang/src/main/java/com/baeldung/stackoverflowerror/UnintendedInfiniteRecursion.java diff --git a/core-java/src/main/java/com/baeldung/staticdemo/Car.java b/core-java-lang/src/main/java/com/baeldung/staticdemo/Car.java similarity index 100% rename from core-java/src/main/java/com/baeldung/staticdemo/Car.java rename to core-java-lang/src/main/java/com/baeldung/staticdemo/Car.java diff --git a/core-java/src/main/java/com/baeldung/staticdemo/Singleton.java b/core-java-lang/src/main/java/com/baeldung/staticdemo/Singleton.java similarity index 100% rename from core-java/src/main/java/com/baeldung/staticdemo/Singleton.java rename to core-java-lang/src/main/java/com/baeldung/staticdemo/Singleton.java diff --git a/core-java/src/main/java/com/baeldung/staticdemo/StaticBlock.java b/core-java-lang/src/main/java/com/baeldung/staticdemo/StaticBlock.java similarity index 100% rename from core-java/src/main/java/com/baeldung/staticdemo/StaticBlock.java rename to core-java-lang/src/main/java/com/baeldung/staticdemo/StaticBlock.java diff --git a/core-java/src/main/java/com/baeldung/switchstatement/SwitchStatement.java b/core-java-lang/src/main/java/com/baeldung/switchstatement/SwitchStatement.java similarity index 100% rename from core-java/src/main/java/com/baeldung/switchstatement/SwitchStatement.java rename to core-java-lang/src/main/java/com/baeldung/switchstatement/SwitchStatement.java diff --git a/core-java/src/main/java/com/baeldung/synthetic/BridgeMethodDemo.java b/core-java-lang/src/main/java/com/baeldung/synthetic/BridgeMethodDemo.java similarity index 100% rename from core-java/src/main/java/com/baeldung/synthetic/BridgeMethodDemo.java rename to core-java-lang/src/main/java/com/baeldung/synthetic/BridgeMethodDemo.java diff --git a/core-java/src/main/java/com/baeldung/synthetic/SyntheticConstructorDemo.java b/core-java-lang/src/main/java/com/baeldung/synthetic/SyntheticConstructorDemo.java similarity index 100% rename from core-java/src/main/java/com/baeldung/synthetic/SyntheticConstructorDemo.java rename to core-java-lang/src/main/java/com/baeldung/synthetic/SyntheticConstructorDemo.java diff --git a/core-java/src/main/java/com/baeldung/synthetic/SyntheticFieldDemo.java b/core-java-lang/src/main/java/com/baeldung/synthetic/SyntheticFieldDemo.java similarity index 100% rename from core-java/src/main/java/com/baeldung/synthetic/SyntheticFieldDemo.java rename to core-java-lang/src/main/java/com/baeldung/synthetic/SyntheticFieldDemo.java diff --git a/core-java/src/main/java/com/baeldung/synthetic/SyntheticMethodDemo.java b/core-java-lang/src/main/java/com/baeldung/synthetic/SyntheticMethodDemo.java similarity index 100% rename from core-java/src/main/java/com/baeldung/synthetic/SyntheticMethodDemo.java rename to core-java-lang/src/main/java/com/baeldung/synthetic/SyntheticMethodDemo.java diff --git a/core-java/src/main/java/com/baeldung/system/ChatWindow.java b/core-java-lang/src/main/java/com/baeldung/system/ChatWindow.java similarity index 100% rename from core-java/src/main/java/com/baeldung/system/ChatWindow.java rename to core-java-lang/src/main/java/com/baeldung/system/ChatWindow.java diff --git a/core-java/src/main/java/com/baeldung/system/DateTimeService.java b/core-java-lang/src/main/java/com/baeldung/system/DateTimeService.java similarity index 100% rename from core-java/src/main/java/com/baeldung/system/DateTimeService.java rename to core-java-lang/src/main/java/com/baeldung/system/DateTimeService.java diff --git a/core-java/src/main/java/com/baeldung/system/EnvironmentVariables.java b/core-java-lang/src/main/java/com/baeldung/system/EnvironmentVariables.java similarity index 100% rename from core-java/src/main/java/com/baeldung/system/EnvironmentVariables.java rename to core-java-lang/src/main/java/com/baeldung/system/EnvironmentVariables.java diff --git a/core-java/src/main/java/com/baeldung/system/SystemErrDemo.java b/core-java-lang/src/main/java/com/baeldung/system/SystemErrDemo.java similarity index 100% rename from core-java/src/main/java/com/baeldung/system/SystemErrDemo.java rename to core-java-lang/src/main/java/com/baeldung/system/SystemErrDemo.java diff --git a/core-java/src/main/java/com/baeldung/system/SystemExitDemo.java b/core-java-lang/src/main/java/com/baeldung/system/SystemExitDemo.java similarity index 100% rename from core-java/src/main/java/com/baeldung/system/SystemExitDemo.java rename to core-java-lang/src/main/java/com/baeldung/system/SystemExitDemo.java diff --git a/core-java/src/main/java/com/baeldung/system/SystemOutDemo.java b/core-java-lang/src/main/java/com/baeldung/system/SystemOutDemo.java similarity index 100% rename from core-java/src/main/java/com/baeldung/system/SystemOutDemo.java rename to core-java-lang/src/main/java/com/baeldung/system/SystemOutDemo.java diff --git a/core-java/src/main/java/com/baeldung/system/UserCredentials.java b/core-java-lang/src/main/java/com/baeldung/system/UserCredentials.java similarity index 100% rename from core-java/src/main/java/com/baeldung/system/UserCredentials.java rename to core-java-lang/src/main/java/com/baeldung/system/UserCredentials.java diff --git a/core-java/src/main/java/com/baeldung/throwsexception/DataAccessException.java b/core-java-lang/src/main/java/com/baeldung/throwsexception/DataAccessException.java similarity index 100% rename from core-java/src/main/java/com/baeldung/throwsexception/DataAccessException.java rename to core-java-lang/src/main/java/com/baeldung/throwsexception/DataAccessException.java diff --git a/core-java/src/main/java/com/baeldung/throwsexception/Main.java b/core-java-lang/src/main/java/com/baeldung/throwsexception/Main.java similarity index 100% rename from core-java/src/main/java/com/baeldung/throwsexception/Main.java rename to core-java-lang/src/main/java/com/baeldung/throwsexception/Main.java diff --git a/core-java/src/main/java/com/baeldung/throwsexception/PersonRepository.java b/core-java-lang/src/main/java/com/baeldung/throwsexception/PersonRepository.java similarity index 100% rename from core-java/src/main/java/com/baeldung/throwsexception/PersonRepository.java rename to core-java-lang/src/main/java/com/baeldung/throwsexception/PersonRepository.java diff --git a/core-java/src/main/java/com/baeldung/throwsexception/SimpleService.java b/core-java-lang/src/main/java/com/baeldung/throwsexception/SimpleService.java similarity index 100% rename from core-java/src/main/java/com/baeldung/throwsexception/SimpleService.java rename to core-java-lang/src/main/java/com/baeldung/throwsexception/SimpleService.java diff --git a/core-java/src/main/java/com/baeldung/throwsexception/TryCatch.java b/core-java-lang/src/main/java/com/baeldung/throwsexception/TryCatch.java similarity index 100% rename from core-java/src/main/java/com/baeldung/throwsexception/TryCatch.java rename to core-java-lang/src/main/java/com/baeldung/throwsexception/TryCatch.java diff --git a/core-java/src/main/java/com/baeldung/typeerasure/ArrayContentPrintUtil.java b/core-java-lang/src/main/java/com/baeldung/typeerasure/ArrayContentPrintUtil.java similarity index 100% rename from core-java/src/main/java/com/baeldung/typeerasure/ArrayContentPrintUtil.java rename to core-java-lang/src/main/java/com/baeldung/typeerasure/ArrayContentPrintUtil.java diff --git a/core-java/src/main/java/com/baeldung/typeerasure/BoundStack.java b/core-java-lang/src/main/java/com/baeldung/typeerasure/BoundStack.java similarity index 100% rename from core-java/src/main/java/com/baeldung/typeerasure/BoundStack.java rename to core-java-lang/src/main/java/com/baeldung/typeerasure/BoundStack.java diff --git a/core-java/src/main/java/com/baeldung/typeerasure/IntegerStack.java b/core-java-lang/src/main/java/com/baeldung/typeerasure/IntegerStack.java similarity index 100% rename from core-java/src/main/java/com/baeldung/typeerasure/IntegerStack.java rename to core-java-lang/src/main/java/com/baeldung/typeerasure/IntegerStack.java diff --git a/core-java/src/main/java/com/baeldung/typeerasure/Stack.java b/core-java-lang/src/main/java/com/baeldung/typeerasure/Stack.java similarity index 100% rename from core-java/src/main/java/com/baeldung/typeerasure/Stack.java rename to core-java-lang/src/main/java/com/baeldung/typeerasure/Stack.java diff --git a/core-java/src/main/resources/file.txt b/core-java-lang/src/main/resources/file.txt similarity index 100% rename from core-java/src/main/resources/file.txt rename to core-java-lang/src/main/resources/file.txt diff --git a/core-java/src/test/java/com/baeldung/binding/AnimalActivityUnitTest.java b/core-java-lang/src/test/java/com/baeldung/binding/AnimalActivityUnitTest.java similarity index 100% rename from core-java/src/test/java/com/baeldung/binding/AnimalActivityUnitTest.java rename to core-java-lang/src/test/java/com/baeldung/binding/AnimalActivityUnitTest.java diff --git a/core-java/src/test/java/com/baeldung/binding/AnimalUnitTest.java b/core-java-lang/src/test/java/com/baeldung/binding/AnimalUnitTest.java similarity index 100% rename from core-java/src/test/java/com/baeldung/binding/AnimalUnitTest.java rename to core-java-lang/src/test/java/com/baeldung/binding/AnimalUnitTest.java diff --git a/core-java/src/test/java/com/baeldung/binding/CatUnitTest.java b/core-java-lang/src/test/java/com/baeldung/binding/CatUnitTest.java similarity index 100% rename from core-java/src/test/java/com/baeldung/binding/CatUnitTest.java rename to core-java-lang/src/test/java/com/baeldung/binding/CatUnitTest.java diff --git a/core-java/src/test/java/com/baeldung/breakcontinue/BreakContinueUnitTest.java b/core-java-lang/src/test/java/com/baeldung/breakcontinue/BreakContinueUnitTest.java similarity index 100% rename from core-java/src/test/java/com/baeldung/breakcontinue/BreakContinueUnitTest.java rename to core-java-lang/src/test/java/com/baeldung/breakcontinue/BreakContinueUnitTest.java diff --git a/core-java/src/test/java/com/baeldung/casting/CastingUnitTest.java b/core-java-lang/src/test/java/com/baeldung/casting/CastingUnitTest.java similarity index 100% rename from core-java/src/test/java/com/baeldung/casting/CastingUnitTest.java rename to core-java-lang/src/test/java/com/baeldung/casting/CastingUnitTest.java diff --git a/core-java-lang/src/test/java/com/baeldung/className/RetrievingClassNameUnitTest.java b/core-java-lang/src/test/java/com/baeldung/className/RetrievingClassNameUnitTest.java new file mode 100644 index 0000000000..f9dbf91d2c --- /dev/null +++ b/core-java-lang/src/test/java/com/baeldung/className/RetrievingClassNameUnitTest.java @@ -0,0 +1,156 @@ +package com.baeldung.className; + +import org.junit.Test; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNull; + +public class RetrievingClassNameUnitTest { + + // Retrieving Simple Name + @Test + public void givenRetrievingClassName_whenGetSimpleName_thenRetrievingClassName() { + assertEquals("RetrievingClassName", RetrievingClassName.class.getSimpleName()); + } + + @Test + public void givenPrimitiveInt_whenGetSimpleName_thenInt() { + assertEquals("int", int.class.getSimpleName()); + } + + @Test + public void givenRetrievingClassNameArray_whenGetSimpleName_thenRetrievingClassNameWithBrackets() { + assertEquals("RetrievingClassName[]", RetrievingClassName[].class.getSimpleName()); + assertEquals("RetrievingClassName[][]", RetrievingClassName[][].class.getSimpleName()); + } + + @Test + public void givenAnonymousClass_whenGetSimpleName_thenEmptyString() { + assertEquals("", new RetrievingClassName() {}.getClass().getSimpleName()); + } + + // Retrieving Other Names + // - Primitive Types + @Test + public void givenPrimitiveInt_whenGetName_thenInt() { + assertEquals("int", int.class.getName()); + } + + @Test + public void givenPrimitiveInt_whenGetTypeName_thenInt() { + assertEquals("int", int.class.getTypeName()); + } + + @Test + public void givenPrimitiveInt_whenGetCanonicalName_thenInt() { + assertEquals("int", int.class.getCanonicalName()); + } + + // - Object Types + @Test + public void givenRetrievingClassName_whenGetName_thenCanonicalName() { + assertEquals("com.baeldung.className.RetrievingClassName", RetrievingClassName.class.getName()); + } + + @Test + public void givenRetrievingClassName_whenGetTypeName_thenCanonicalName() { + assertEquals("com.baeldung.className.RetrievingClassName", RetrievingClassName.class.getTypeName()); + } + + @Test + public void givenRetrievingClassName_whenGetCanonicalName_thenCanonicalName() { + assertEquals("com.baeldung.className.RetrievingClassName", RetrievingClassName.class.getCanonicalName()); + } + + // - Inner Classes + @Test + public void givenRetrievingClassNameInnerClass_whenGetName_thenCanonicalNameWithDollarSeparator() { + assertEquals("com.baeldung.className.RetrievingClassName$InnerClass", RetrievingClassName.InnerClass.class.getName()); + } + + @Test + public void givenRetrievingClassNameInnerClass_whenGetTypeName_thenCanonicalNameWithDollarSeparator() { + assertEquals("com.baeldung.className.RetrievingClassName$InnerClass", RetrievingClassName.InnerClass.class.getTypeName()); + } + + @Test + public void givenRetrievingClassNameInnerClass_whenGetCanonicalName_thenCanonicalName() { + assertEquals("com.baeldung.className.RetrievingClassName.InnerClass", RetrievingClassName.InnerClass.class.getCanonicalName()); + } + + // - Anonymous Classes + @Test + public void givenAnonymousClass_whenGetName_thenCallingClassCanonicalNameWithDollarSeparatorAndCountNumber() { + // These are the second and third appearences of an anonymous class in RetrievingClassNameUnitTest, hence $2 and $3 expectations + assertEquals("com.baeldung.className.RetrievingClassNameUnitTest$2", new RetrievingClassName() {}.getClass().getName()); + assertEquals("com.baeldung.className.RetrievingClassNameUnitTest$3", new RetrievingClassName() {}.getClass().getName()); + } + + @Test + public void givenAnonymousClass_whenGetTypeName_thenCallingClassCanonicalNameWithDollarSeparatorAndCountNumber() { + // These are the fourth and fifth appearences of an anonymous class in RetrievingClassNameUnitTest, hence $4 and $5 expectations + assertEquals("com.baeldung.className.RetrievingClassNameUnitTest$4", new RetrievingClassName() {}.getClass().getTypeName()); + assertEquals("com.baeldung.className.RetrievingClassNameUnitTest$5", new RetrievingClassName() {}.getClass().getTypeName()); + } + + @Test + public void givenAnonymousClass_whenGetCanonicalName_thenNull() { + assertNull(new RetrievingClassName() {}.getClass().getCanonicalName()); + } + + // - Arrays + @Test + public void givenPrimitiveIntArray_whenGetName_thenOpeningBracketsAndPrimitiveIntLetter() { + assertEquals("[I", int[].class.getName()); + assertEquals("[[I", int[][].class.getName()); + } + + @Test + public void givenRetrievingClassNameArray_whenGetName_thenOpeningBracketsLetterLAndRetrievingClassNameGetName() { + assertEquals("[Lcom.baeldung.className.RetrievingClassName;", RetrievingClassName[].class.getName()); + assertEquals("[[Lcom.baeldung.className.RetrievingClassName;", RetrievingClassName[][].class.getName()); + } + + @Test + public void givenRetrievingClassNameInnerClassArray_whenGetName_thenOpeningBracketsLetterLAndRetrievingClassNameInnerClassGetName() { + assertEquals("[Lcom.baeldung.className.RetrievingClassName$InnerClass;", RetrievingClassName.InnerClass[].class.getName()); + assertEquals("[[Lcom.baeldung.className.RetrievingClassName$InnerClass;", RetrievingClassName.InnerClass[][].class.getName()); + } + + @Test + public void givenPrimitiveIntArray_whenGetTypeName_thenPrimitiveIntGetTypeNameWithBrackets() { + assertEquals("int[]", int[].class.getTypeName()); + assertEquals("int[][]", int[][].class.getTypeName()); + } + + @Test + public void givenRetrievingClassNameArray_whenGetTypeName_thenRetrievingClassNameGetTypeNameWithBrackets() { + assertEquals("com.baeldung.className.RetrievingClassName[]", RetrievingClassName[].class.getTypeName()); + assertEquals("com.baeldung.className.RetrievingClassName[][]", RetrievingClassName[][].class.getTypeName()); + } + + @Test + public void givenRetrievingClassNameInnerClassArray_whenGetTypeName_thenRetrievingClassNameInnerClassGetTypeNameWithBrackets() { + assertEquals("com.baeldung.className.RetrievingClassName$InnerClass[]", RetrievingClassName.InnerClass[].class.getTypeName()); + assertEquals("com.baeldung.className.RetrievingClassName$InnerClass[][]", RetrievingClassName.InnerClass[][].class.getTypeName()); + } + + @Test + public void givenPrimitiveIntArray_whenGetCanonicalName_thenPrimitiveIntGetCanonicalNameWithBrackets() { + assertEquals("int[]", int[].class.getCanonicalName()); + assertEquals("int[][]", int[][].class.getCanonicalName()); + } + + @Test + public void givenRetrievingClassNameArray_whenGetCanonicalName_thenRetrievingClassNameGetCanonicalNameWithBrackets() { + assertEquals("com.baeldung.className.RetrievingClassName[]", RetrievingClassName[].class.getCanonicalName()); + assertEquals("com.baeldung.className.RetrievingClassName[][]", RetrievingClassName[][].class.getCanonicalName()); + } + + @Test + public void givenRetrievingClassNameInnerClassArray_whenGetCanonicalName_thenRetrievingClassNameInnerClassGetCanonicalNameWithBrackets() { + assertEquals("com.baeldung.className.RetrievingClassName.InnerClass[]", RetrievingClassName.InnerClass[].class.getCanonicalName()); + assertEquals("com.baeldung.className.RetrievingClassName.InnerClass[][]", RetrievingClassName.InnerClass[][].class.getCanonicalName()); + } + +} \ No newline at end of file diff --git a/core-java/src/test/java/com/baeldung/classnotfoundexception/ClassNotFoundExceptionUnitTest.java b/core-java-lang/src/test/java/com/baeldung/classnotfoundexception/ClassNotFoundExceptionUnitTest.java similarity index 100% rename from core-java/src/test/java/com/baeldung/classnotfoundexception/ClassNotFoundExceptionUnitTest.java rename to core-java-lang/src/test/java/com/baeldung/classnotfoundexception/ClassNotFoundExceptionUnitTest.java diff --git a/core-java/src/test/java/com/baeldung/comparable/ComparableUnitTest.java b/core-java-lang/src/test/java/com/baeldung/comparable/ComparableUnitTest.java similarity index 100% rename from core-java/src/test/java/com/baeldung/comparable/ComparableUnitTest.java rename to core-java-lang/src/test/java/com/baeldung/comparable/ComparableUnitTest.java diff --git a/core-java/src/test/java/com/baeldung/comparator/ComparatorUnitTest.java b/core-java-lang/src/test/java/com/baeldung/comparator/ComparatorUnitTest.java similarity index 100% rename from core-java/src/test/java/com/baeldung/comparator/ComparatorUnitTest.java rename to core-java-lang/src/test/java/com/baeldung/comparator/ComparatorUnitTest.java diff --git a/core-java/src/test/java/com/baeldung/comparator/Java8ComparatorUnitTest.java b/core-java-lang/src/test/java/com/baeldung/comparator/Java8ComparatorUnitTest.java similarity index 100% rename from core-java/src/test/java/com/baeldung/comparator/Java8ComparatorUnitTest.java rename to core-java-lang/src/test/java/com/baeldung/comparator/Java8ComparatorUnitTest.java diff --git a/core-java-lang/src/test/java/com/baeldung/compoundoperators/CompoundOperatorsUnitTest.java b/core-java-lang/src/test/java/com/baeldung/compoundoperators/CompoundOperatorsUnitTest.java new file mode 100644 index 0000000000..532776edd4 --- /dev/null +++ b/core-java-lang/src/test/java/com/baeldung/compoundoperators/CompoundOperatorsUnitTest.java @@ -0,0 +1,111 @@ +package com.baeldung.compoundoperators; + +import org.junit.Test; + +import static org.junit.Assert.assertEquals; + +public class CompoundOperatorsUnitTest { + + @Test + public void whenAssignmentOperatorIsUsed_thenValueIsAssigned() { + int x = 5; + + assertEquals(5, x); + } + + @Test + public void whenCompoundAssignmentUsed_thenSameAsSimpleAssignment() { + int a = 3, b = 3, c = -2; + a = a * c; // Simple assignment operator + b *= c; // Compound assignment operator + + assertEquals(a, b); + } + + @Test + public void whenAssignmentOperatorIsUsed_thenValueIsReturned() { + long x = 1; + long y = (x+=2); + + assertEquals(3, y); + assertEquals(y, x); + } + + @Test + public void whenCompoundOperatorsAreUsed_thenOperationsArePerformedAndAssigned() { + //Simple assignment + int x = 5; //x is 5 + + //Incrementation + x += 5; //x is 10 + assertEquals(10, x); + + //Decrementation + x -= 2; //x is 8 + assertEquals(8, x); + + //Multiplication + x *= 2; //x is 16 + assertEquals(16, x); + + //Division + x /= 4; //x is 4 + assertEquals(4, x); + + //Modulus + x %= 3; //x is 1 + assertEquals(1, x); + + + //Binary AND + x &= 4; //x is 0 + assertEquals(0, x); + + //Binary exclusive OR + x ^= 4; //x is 4 + assertEquals(4, x); + + //Binary inclusive OR + x |= 8; //x is 12 + assertEquals(12, x); + + + //Binary Left Shift + x <<= 2; //x is 48 + assertEquals(48, x); + + //Binary Right Shift + x >>= 2; //x is 12 + assertEquals(12, x); + + //Shift right zero fill + x >>>= 1; //x is 6 + assertEquals(6, x); + } + + @Test(expected = NullPointerException.class) + public void whenArrayIsNull_thenThrowNullException() { + int[] numbers = null; + + //Trying Incrementation + numbers[2] += 5; + } + + @Test(expected = ArrayIndexOutOfBoundsException.class) + public void whenArrayIndexNotCorrect_thenThrowArrayIndexException() { + int[] numbers = {0, 1}; + + //Trying Incrementation + numbers[2] += 5; + } + + @Test + public void whenArrayIndexIsCorrect_thenPerformOperation() { + int[] numbers = {0, 1}; + + //Incrementation + numbers[1] += 5; + assertEquals(6, numbers[1]); + } + +} diff --git a/core-java-lang/src/test/java/com/baeldung/constructors/ConstructorUnitTest.java b/core-java-lang/src/test/java/com/baeldung/constructors/ConstructorUnitTest.java new file mode 100644 index 0000000000..2cd8832fbf --- /dev/null +++ b/core-java-lang/src/test/java/com/baeldung/constructors/ConstructorUnitTest.java @@ -0,0 +1,53 @@ +package com.baeldung.constructors; + +import com.baeldung.constructors.*; + +import java.util.logging.Logger; +import java.time.LocalDateTime; +import java.time.Month; + +import org.junit.Test; +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThatCode; +import static org.assertj.core.api.Assertions.assertThatThrownBy; + +public class ConstructorUnitTest { + final static Logger LOGGER = Logger.getLogger(ConstructorUnitTest.class.getName()); + + @Test + public void givenNoExplicitContructor_whenUsed_thenFails() { + BankAccount account = new BankAccount(); + assertThatThrownBy(() -> { account.toString(); }).isInstanceOf(Exception.class); + } + + @Test + public void givenNoArgumentConstructor_whenUsed_thenSucceeds() { + BankAccountEmptyConstructor account = new BankAccountEmptyConstructor(); + assertThatCode(() -> { + account.toString(); + }).doesNotThrowAnyException(); + } + + @Test + public void givenParameterisedConstructor_whenUsed_thenSucceeds() { + LocalDateTime opened = LocalDateTime.of(2018, Month.JUNE, 29, 06, 30, 00); + BankAccountParameterizedConstructor account = + new BankAccountParameterizedConstructor("Tom", opened, 1000.0f); + + assertThatCode(() -> { + account.toString(); + }).doesNotThrowAnyException(); + } + + @Test + public void givenCopyContructor_whenUser_thenMaintainsLogic() { + LocalDateTime opened = LocalDateTime.of(2018, Month.JUNE, 29, 06, 30, 00); + BankAccountCopyConstructor account = new BankAccountCopyConstructor("Tim", opened, 1000.0f); + BankAccountCopyConstructor newAccount = new BankAccountCopyConstructor(account); + + assertThat(account.getName()).isEqualTo(newAccount.getName()); + assertThat(account.getOpened()).isNotEqualTo(newAccount.getOpened()); + + assertThat(newAccount.getBalance()).isEqualTo(0.0f); + } +} diff --git a/core-java/src/test/java/com/baeldung/customexception/IncorrectFileExtensionExceptionUnitTest.java b/core-java-lang/src/test/java/com/baeldung/customexception/IncorrectFileExtensionExceptionUnitTest.java similarity index 100% rename from core-java/src/test/java/com/baeldung/customexception/IncorrectFileExtensionExceptionUnitTest.java rename to core-java-lang/src/test/java/com/baeldung/customexception/IncorrectFileExtensionExceptionUnitTest.java diff --git a/core-java/src/test/java/com/baeldung/customexception/IncorrectFileNameExceptionUnitTest.java b/core-java-lang/src/test/java/com/baeldung/customexception/IncorrectFileNameExceptionUnitTest.java similarity index 100% rename from core-java/src/test/java/com/baeldung/customexception/IncorrectFileNameExceptionUnitTest.java rename to core-java-lang/src/test/java/com/baeldung/customexception/IncorrectFileNameExceptionUnitTest.java diff --git a/core-java/src/test/java/com/baeldung/deepcopy/DeepCopyUnitTest.java b/core-java-lang/src/test/java/com/baeldung/deepcopy/DeepCopyUnitTest.java similarity index 98% rename from core-java/src/test/java/com/baeldung/deepcopy/DeepCopyUnitTest.java rename to core-java-lang/src/test/java/com/baeldung/deepcopy/DeepCopyUnitTest.java index 196b69fbf7..d6b1cd90b9 100644 --- a/core-java/src/test/java/com/baeldung/deepcopy/DeepCopyUnitTest.java +++ b/core-java-lang/src/test/java/com/baeldung/deepcopy/DeepCopyUnitTest.java @@ -4,7 +4,7 @@ import static org.assertj.core.api.Assertions.assertThat; import java.io.IOException; -import org.apache.commons.lang.SerializationUtils; +import org.apache.commons.lang3.SerializationUtils; import org.junit.Ignore; import org.junit.Test; diff --git a/core-java/src/test/java/com/baeldung/deepcopy/ShallowCopyUnitTest.java b/core-java-lang/src/test/java/com/baeldung/deepcopy/ShallowCopyUnitTest.java similarity index 100% rename from core-java/src/test/java/com/baeldung/deepcopy/ShallowCopyUnitTest.java rename to core-java-lang/src/test/java/com/baeldung/deepcopy/ShallowCopyUnitTest.java diff --git a/core-java/src/test/java/com/baeldung/dynamicproxy/DynamicProxyIntegrationTest.java b/core-java-lang/src/test/java/com/baeldung/dynamicproxy/DynamicProxyIntegrationTest.java similarity index 100% rename from core-java/src/test/java/com/baeldung/dynamicproxy/DynamicProxyIntegrationTest.java rename to core-java-lang/src/test/java/com/baeldung/dynamicproxy/DynamicProxyIntegrationTest.java diff --git a/core-java/src/test/java/com/baeldung/enums/PizzaUnitTest.java b/core-java-lang/src/test/java/com/baeldung/enums/PizzaUnitTest.java similarity index 100% rename from core-java/src/test/java/com/baeldung/enums/PizzaUnitTest.java rename to core-java-lang/src/test/java/com/baeldung/enums/PizzaUnitTest.java diff --git a/core-java-lang/src/test/java/com/baeldung/equalshashcode/MoneyUnitTest.java b/core-java-lang/src/test/java/com/baeldung/equalshashcode/MoneyUnitTest.java new file mode 100644 index 0000000000..60584fdb53 --- /dev/null +++ b/core-java-lang/src/test/java/com/baeldung/equalshashcode/MoneyUnitTest.java @@ -0,0 +1,27 @@ +package com.baeldung.equalshashcode; + +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.assertFalse; + +import org.junit.Test; + +public class MoneyUnitTest { + + @Test + public void givenMoneyInstancesWithSameAmountAndCurrency_whenEquals_thenReturnsTrue() { + Money income = new Money(55, "USD"); + Money expenses = new Money(55, "USD"); + + assertTrue(income.equals(expenses)); + } + + @Test + public void givenMoneyAndVoucherInstances_whenEquals_thenReturnValuesArentSymmetric() { + Money cash = new Money(42, "USD"); + WrongVoucher voucher = new WrongVoucher(42, "USD", "Amazon"); + + assertFalse(voucher.equals(cash)); + assertTrue(cash.equals(voucher)); + } + +} diff --git a/core-java-lang/src/test/java/com/baeldung/equalshashcode/TeamUnitTest.java b/core-java-lang/src/test/java/com/baeldung/equalshashcode/TeamUnitTest.java new file mode 100644 index 0000000000..a2de408796 --- /dev/null +++ b/core-java-lang/src/test/java/com/baeldung/equalshashcode/TeamUnitTest.java @@ -0,0 +1,46 @@ +package com.baeldung.equalshashcode; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; + +import java.util.HashMap; +import java.util.Map; + +import org.junit.Test; + +import nl.jqno.equalsverifier.EqualsVerifier; + +public class TeamUnitTest { + + @Test + public void givenMapKeyWithHashCode_whenSearched_thenReturnsCorrectValue() { + Map leaders = new HashMap<>(); + leaders.put(new Team("New York", "development"), "Anne"); + leaders.put(new Team("Boston", "development"), "Brian"); + leaders.put(new Team("Boston", "marketing"), "Charlie"); + + Team myTeam = new Team("New York", "development"); + String myTeamleader = leaders.get(myTeam); + + assertEquals("Anne", myTeamleader); + } + + @Test + public void givenMapKeyWithoutHashCode_whenSearched_thenReturnsWrongValue() { + Map leaders = new HashMap<>(); + leaders.put(new WrongTeam("New York", "development"), "Anne"); + leaders.put(new WrongTeam("Boston", "development"), "Brian"); + leaders.put(new WrongTeam("Boston", "marketing"), "Charlie"); + + WrongTeam myTeam = new WrongTeam("New York", "development"); + String myTeamleader = leaders.get(myTeam); + + assertFalse("Anne".equals(myTeamleader)); + } + + @Test + public void equalsContract() { + EqualsVerifier.forClass(Team.class).verify(); + } + +} diff --git a/core-java/src/test/java/org/baeldung/equalshashcode/entities/ComplexClassUnitTest.java b/core-java-lang/src/test/java/com/baeldung/equalshashcode/entities/ComplexClassUnitTest.java similarity index 95% rename from core-java/src/test/java/org/baeldung/equalshashcode/entities/ComplexClassUnitTest.java rename to core-java-lang/src/test/java/com/baeldung/equalshashcode/entities/ComplexClassUnitTest.java index 680a6d57b5..0cb4ace0ab 100644 --- a/core-java/src/test/java/org/baeldung/equalshashcode/entities/ComplexClassUnitTest.java +++ b/core-java-lang/src/test/java/com/baeldung/equalshashcode/entities/ComplexClassUnitTest.java @@ -1,4 +1,4 @@ -package org.baeldung.equalshashcode.entities; +package com.baeldung.equalshashcode.entities; import java.util.ArrayList; import java.util.HashSet; diff --git a/core-java/src/test/java/org/baeldung/equalshashcode/entities/PrimitiveClassUnitTest.java b/core-java-lang/src/test/java/com/baeldung/equalshashcode/entities/PrimitiveClassUnitTest.java similarity index 85% rename from core-java/src/test/java/org/baeldung/equalshashcode/entities/PrimitiveClassUnitTest.java rename to core-java-lang/src/test/java/com/baeldung/equalshashcode/entities/PrimitiveClassUnitTest.java index f4e9f2b99f..457d7a2b5e 100644 --- a/core-java/src/test/java/org/baeldung/equalshashcode/entities/PrimitiveClassUnitTest.java +++ b/core-java-lang/src/test/java/com/baeldung/equalshashcode/entities/PrimitiveClassUnitTest.java @@ -1,10 +1,8 @@ -package org.baeldung.equalshashcode.entities; +package com.baeldung.equalshashcode.entities; import org.junit.Assert; import org.junit.Test; -import com.baeldung.equalshashcode.entities.PrimitiveClass; - public class PrimitiveClassUnitTest { @Test diff --git a/core-java/src/test/java/org/baeldung/equalshashcode/entities/SquareClassUnitTest.java b/core-java-lang/src/test/java/com/baeldung/equalshashcode/entities/SquareClassUnitTest.java similarity index 93% rename from core-java/src/test/java/org/baeldung/equalshashcode/entities/SquareClassUnitTest.java rename to core-java-lang/src/test/java/com/baeldung/equalshashcode/entities/SquareClassUnitTest.java index 5c860bd62d..a25e8bd486 100644 --- a/core-java/src/test/java/org/baeldung/equalshashcode/entities/SquareClassUnitTest.java +++ b/core-java-lang/src/test/java/com/baeldung/equalshashcode/entities/SquareClassUnitTest.java @@ -1,4 +1,4 @@ -package org.baeldung.equalshashcode.entities; +package com.baeldung.equalshashcode.entities; import java.awt.Color; diff --git a/core-java/src/test/java/com/baeldung/exceptionhandling/ExceptionsUnitTest.java b/core-java-lang/src/test/java/com/baeldung/exceptionhandling/ExceptionsUnitTest.java similarity index 100% rename from core-java/src/test/java/com/baeldung/exceptionhandling/ExceptionsUnitTest.java rename to core-java-lang/src/test/java/com/baeldung/exceptionhandling/ExceptionsUnitTest.java diff --git a/core-java/src/test/java/com/baeldung/finalize/FinalizeUnitTest.java b/core-java-lang/src/test/java/com/baeldung/finalize/FinalizeUnitTest.java similarity index 100% rename from core-java/src/test/java/com/baeldung/finalize/FinalizeUnitTest.java rename to core-java-lang/src/test/java/com/baeldung/finalize/FinalizeUnitTest.java diff --git a/core-java/src/test/java/com/baeldung/finalkeyword/FinalUnitTest.java b/core-java-lang/src/test/java/com/baeldung/finalkeyword/FinalUnitTest.java similarity index 100% rename from core-java/src/test/java/com/baeldung/finalkeyword/FinalUnitTest.java rename to core-java-lang/src/test/java/com/baeldung/finalkeyword/FinalUnitTest.java diff --git a/core-java/src/test/java/com/baeldung/generics/GenericsUnitTest.java b/core-java-lang/src/test/java/com/baeldung/generics/GenericsUnitTest.java similarity index 100% rename from core-java/src/test/java/com/baeldung/generics/GenericsUnitTest.java rename to core-java-lang/src/test/java/com/baeldung/generics/GenericsUnitTest.java diff --git a/core-java/src/test/java/com/baeldung/hashcode/application/ApplicationUnitTest.java b/core-java-lang/src/test/java/com/baeldung/hashcode/application/ApplicationUnitTest.java similarity index 100% rename from core-java/src/test/java/com/baeldung/hashcode/application/ApplicationUnitTest.java rename to core-java-lang/src/test/java/com/baeldung/hashcode/application/ApplicationUnitTest.java diff --git a/core-java/src/test/java/com/baeldung/hashcode/entities/UserUnitTest.java b/core-java-lang/src/test/java/com/baeldung/hashcode/entities/UserUnitTest.java similarity index 100% rename from core-java/src/test/java/com/baeldung/hashcode/entities/UserUnitTest.java rename to core-java-lang/src/test/java/com/baeldung/hashcode/entities/UserUnitTest.java diff --git a/core-java/src/test/java/com/baeldung/immutableobjects/ImmutableObjectsUnitTest.java b/core-java-lang/src/test/java/com/baeldung/immutableobjects/ImmutableObjectsUnitTest.java similarity index 100% rename from core-java/src/test/java/com/baeldung/immutableobjects/ImmutableObjectsUnitTest.java rename to core-java-lang/src/test/java/com/baeldung/immutableobjects/ImmutableObjectsUnitTest.java diff --git a/core-java/src/test/java/com/baeldung/inheritance/AppUnitTest.java b/core-java-lang/src/test/java/com/baeldung/inheritance/AppUnitTest.java similarity index 100% rename from core-java/src/test/java/com/baeldung/inheritance/AppUnitTest.java rename to core-java-lang/src/test/java/com/baeldung/inheritance/AppUnitTest.java diff --git a/core-java/src/test/java/com/baeldung/inheritancecomposition/test/ActressUnitTest.java b/core-java-lang/src/test/java/com/baeldung/inheritancecomposition/test/ActressUnitTest.java similarity index 100% rename from core-java/src/test/java/com/baeldung/inheritancecomposition/test/ActressUnitTest.java rename to core-java-lang/src/test/java/com/baeldung/inheritancecomposition/test/ActressUnitTest.java diff --git a/core-java/src/test/java/com/baeldung/inheritancecomposition/test/CompositionUnitTest.java b/core-java-lang/src/test/java/com/baeldung/inheritancecomposition/test/CompositionUnitTest.java similarity index 100% rename from core-java/src/test/java/com/baeldung/inheritancecomposition/test/CompositionUnitTest.java rename to core-java-lang/src/test/java/com/baeldung/inheritancecomposition/test/CompositionUnitTest.java diff --git a/core-java/src/test/java/com/baeldung/inheritancecomposition/test/InheritanceUnitTest.java b/core-java-lang/src/test/java/com/baeldung/inheritancecomposition/test/InheritanceUnitTest.java similarity index 100% rename from core-java/src/test/java/com/baeldung/inheritancecomposition/test/InheritanceUnitTest.java rename to core-java-lang/src/test/java/com/baeldung/inheritancecomposition/test/InheritanceUnitTest.java diff --git a/core-java/src/test/java/com/baeldung/inheritancecomposition/test/PersonUnitTest.java b/core-java-lang/src/test/java/com/baeldung/inheritancecomposition/test/PersonUnitTest.java similarity index 100% rename from core-java/src/test/java/com/baeldung/inheritancecomposition/test/PersonUnitTest.java rename to core-java-lang/src/test/java/com/baeldung/inheritancecomposition/test/PersonUnitTest.java diff --git a/core-java/src/test/java/com/baeldung/inheritancecomposition/test/WaitressUnitTest.java b/core-java-lang/src/test/java/com/baeldung/inheritancecomposition/test/WaitressUnitTest.java similarity index 100% rename from core-java/src/test/java/com/baeldung/inheritancecomposition/test/WaitressUnitTest.java rename to core-java-lang/src/test/java/com/baeldung/inheritancecomposition/test/WaitressUnitTest.java diff --git a/core-java/src/test/java/com/baeldung/initializationguide/UserUnitTest.java b/core-java-lang/src/test/java/com/baeldung/initializationguide/UserUnitTest.java similarity index 100% rename from core-java/src/test/java/com/baeldung/initializationguide/UserUnitTest.java rename to core-java-lang/src/test/java/com/baeldung/initializationguide/UserUnitTest.java diff --git a/core-java/src/test/java/com/baeldung/interfaces/InnerInterfaceUnitTest.java b/core-java-lang/src/test/java/com/baeldung/interfaces/InnerInterfaceUnitTest.java similarity index 100% rename from core-java/src/test/java/com/baeldung/interfaces/InnerInterfaceUnitTest.java rename to core-java-lang/src/test/java/com/baeldung/interfaces/InnerInterfaceUnitTest.java diff --git a/core-java/src/test/java/org/baeldung/java/diamond/Car.java b/core-java-lang/src/test/java/com/baeldung/java/diamond/Car.java similarity index 64% rename from core-java/src/test/java/org/baeldung/java/diamond/Car.java rename to core-java-lang/src/test/java/com/baeldung/java/diamond/Car.java index 9f923e0f3b..a680c4e670 100644 --- a/core-java/src/test/java/org/baeldung/java/diamond/Car.java +++ b/core-java-lang/src/test/java/com/baeldung/java/diamond/Car.java @@ -1,4 +1,4 @@ -package org.baeldung.java.diamond; +package com.baeldung.java.diamond; public class Car implements Vehicle { diff --git a/core-java/src/test/java/org/baeldung/java/diamond/DiamondOperatorUnitTest.java b/core-java-lang/src/test/java/com/baeldung/java/diamond/DiamondOperatorUnitTest.java similarity index 88% rename from core-java/src/test/java/org/baeldung/java/diamond/DiamondOperatorUnitTest.java rename to core-java-lang/src/test/java/com/baeldung/java/diamond/DiamondOperatorUnitTest.java index f6c7f7162f..ee5f639926 100644 --- a/core-java/src/test/java/org/baeldung/java/diamond/DiamondOperatorUnitTest.java +++ b/core-java-lang/src/test/java/com/baeldung/java/diamond/DiamondOperatorUnitTest.java @@ -1,4 +1,4 @@ -package org.baeldung.java.diamond; +package com.baeldung.java.diamond; import static org.junit.Assert.assertNotNull; diff --git a/core-java/src/test/java/org/baeldung/java/diamond/Diesel.java b/core-java-lang/src/test/java/com/baeldung/java/diamond/Diesel.java similarity index 78% rename from core-java/src/test/java/org/baeldung/java/diamond/Diesel.java rename to core-java-lang/src/test/java/com/baeldung/java/diamond/Diesel.java index dc4256cdae..90eb7d9340 100644 --- a/core-java/src/test/java/org/baeldung/java/diamond/Diesel.java +++ b/core-java-lang/src/test/java/com/baeldung/java/diamond/Diesel.java @@ -1,4 +1,4 @@ -package org.baeldung.java.diamond; +package com.baeldung.java.diamond; public class Diesel implements Engine { diff --git a/core-java/src/test/java/org/baeldung/java/diamond/Engine.java b/core-java-lang/src/test/java/com/baeldung/java/diamond/Engine.java similarity index 56% rename from core-java/src/test/java/org/baeldung/java/diamond/Engine.java rename to core-java-lang/src/test/java/com/baeldung/java/diamond/Engine.java index c18a8f64b5..746baf3254 100644 --- a/core-java/src/test/java/org/baeldung/java/diamond/Engine.java +++ b/core-java-lang/src/test/java/com/baeldung/java/diamond/Engine.java @@ -1,4 +1,4 @@ -package org.baeldung.java.diamond; +package com.baeldung.java.diamond; public interface Engine { diff --git a/core-java/src/test/java/org/baeldung/java/diamond/Vehicle.java b/core-java-lang/src/test/java/com/baeldung/java/diamond/Vehicle.java similarity index 58% rename from core-java/src/test/java/org/baeldung/java/diamond/Vehicle.java rename to core-java-lang/src/test/java/com/baeldung/java/diamond/Vehicle.java index f61cf59620..8395cdd970 100644 --- a/core-java/src/test/java/org/baeldung/java/diamond/Vehicle.java +++ b/core-java-lang/src/test/java/com/baeldung/java/diamond/Vehicle.java @@ -1,4 +1,4 @@ -package org.baeldung.java.diamond; +package com.baeldung.java.diamond; public interface Vehicle { diff --git a/core-java/src/test/java/com/baeldung/java/doublebrace/DoubleBraceUnitTest.java b/core-java-lang/src/test/java/com/baeldung/java/doublebrace/DoubleBraceUnitTest.java similarity index 100% rename from core-java/src/test/java/com/baeldung/java/doublebrace/DoubleBraceUnitTest.java rename to core-java-lang/src/test/java/com/baeldung/java/doublebrace/DoubleBraceUnitTest.java diff --git a/core-java/src/main/java/com/baeldung/java/enumiteration/DaysOfWeekEnum.java b/core-java-lang/src/test/java/com/baeldung/java/enumiteration/DaysOfWeekEnum.java similarity index 100% rename from core-java/src/main/java/com/baeldung/java/enumiteration/DaysOfWeekEnum.java rename to core-java-lang/src/test/java/com/baeldung/java/enumiteration/DaysOfWeekEnum.java diff --git a/core-java/src/main/java/com/baeldung/java/enumiteration/EnumIterationExamples.java b/core-java-lang/src/test/java/com/baeldung/java/enumiteration/EnumIterationExamples.java similarity index 100% rename from core-java/src/main/java/com/baeldung/java/enumiteration/EnumIterationExamples.java rename to core-java-lang/src/test/java/com/baeldung/java/enumiteration/EnumIterationExamples.java diff --git a/core-java/src/test/java/com/baeldung/java/reflection/OperationsUnitTest.java b/core-java-lang/src/test/java/com/baeldung/java/reflection/OperationsUnitTest.java similarity index 100% rename from core-java/src/test/java/com/baeldung/java/reflection/OperationsUnitTest.java rename to core-java-lang/src/test/java/com/baeldung/java/reflection/OperationsUnitTest.java diff --git a/core-java/src/test/java/com/baeldung/java/reflection/ReflectionUnitTest.java b/core-java-lang/src/test/java/com/baeldung/java/reflection/ReflectionUnitTest.java similarity index 100% rename from core-java/src/test/java/com/baeldung/java/reflection/ReflectionUnitTest.java rename to core-java-lang/src/test/java/com/baeldung/java/reflection/ReflectionUnitTest.java diff --git a/core-java/src/test/java/com/baeldung/loops/WhenUsingLoops.java b/core-java-lang/src/test/java/com/baeldung/loops/WhenUsingLoops.java similarity index 100% rename from core-java/src/test/java/com/baeldung/loops/WhenUsingLoops.java rename to core-java-lang/src/test/java/com/baeldung/loops/WhenUsingLoops.java diff --git a/core-java/src/test/java/com/baeldung/methodoverloadingoverriding/test/MethodOverloadingUnitTest.java b/core-java-lang/src/test/java/com/baeldung/methodoverloadingoverriding/test/MethodOverloadingUnitTest.java similarity index 100% rename from core-java/src/test/java/com/baeldung/methodoverloadingoverriding/test/MethodOverloadingUnitTest.java rename to core-java-lang/src/test/java/com/baeldung/methodoverloadingoverriding/test/MethodOverloadingUnitTest.java diff --git a/core-java/src/test/java/com/baeldung/methodoverloadingoverriding/test/MethodOverridingUnitTest.java b/core-java-lang/src/test/java/com/baeldung/methodoverloadingoverriding/test/MethodOverridingUnitTest.java similarity index 100% rename from core-java/src/test/java/com/baeldung/methodoverloadingoverriding/test/MethodOverridingUnitTest.java rename to core-java-lang/src/test/java/com/baeldung/methodoverloadingoverriding/test/MethodOverridingUnitTest.java diff --git a/core-java/src/test/java/com/baeldung/modulo/ModuloUnitTest.java b/core-java-lang/src/test/java/com/baeldung/modulo/ModuloUnitTest.java similarity index 100% rename from core-java/src/test/java/com/baeldung/modulo/ModuloUnitTest.java rename to core-java-lang/src/test/java/com/baeldung/modulo/ModuloUnitTest.java diff --git a/core-java/src/test/java/com/baeldung/nestedclass/AnonymousInner.java b/core-java-lang/src/test/java/com/baeldung/nestedclass/AnonymousInner.java similarity index 100% rename from core-java/src/test/java/com/baeldung/nestedclass/AnonymousInner.java rename to core-java-lang/src/test/java/com/baeldung/nestedclass/AnonymousInner.java diff --git a/core-java/src/test/java/com/baeldung/nestedclass/Enclosing.java b/core-java-lang/src/test/java/com/baeldung/nestedclass/Enclosing.java similarity index 100% rename from core-java/src/test/java/com/baeldung/nestedclass/Enclosing.java rename to core-java-lang/src/test/java/com/baeldung/nestedclass/Enclosing.java diff --git a/core-java/src/test/java/com/baeldung/nestedclass/NewEnclosing.java b/core-java-lang/src/test/java/com/baeldung/nestedclass/NewEnclosing.java similarity index 100% rename from core-java/src/test/java/com/baeldung/nestedclass/NewEnclosing.java rename to core-java-lang/src/test/java/com/baeldung/nestedclass/NewEnclosing.java diff --git a/core-java/src/test/java/com/baeldung/nestedclass/NewOuter.java b/core-java-lang/src/test/java/com/baeldung/nestedclass/NewOuter.java similarity index 100% rename from core-java/src/test/java/com/baeldung/nestedclass/NewOuter.java rename to core-java-lang/src/test/java/com/baeldung/nestedclass/NewOuter.java diff --git a/core-java/src/test/java/com/baeldung/nestedclass/Outer.java b/core-java-lang/src/test/java/com/baeldung/nestedclass/Outer.java similarity index 100% rename from core-java/src/test/java/com/baeldung/nestedclass/Outer.java rename to core-java-lang/src/test/java/com/baeldung/nestedclass/Outer.java diff --git a/core-java/src/test/java/com/baeldung/noclassdeffounderror/NoClassDefFoundErrorUnitTest.java b/core-java-lang/src/test/java/com/baeldung/noclassdeffounderror/NoClassDefFoundErrorUnitTest.java similarity index 100% rename from core-java/src/test/java/com/baeldung/noclassdeffounderror/NoClassDefFoundErrorUnitTest.java rename to core-java-lang/src/test/java/com/baeldung/noclassdeffounderror/NoClassDefFoundErrorUnitTest.java diff --git a/core-java/src/test/java/com/baeldung/parameterpassing/NonPrimitivesUnitTest.java b/core-java-lang/src/test/java/com/baeldung/parameterpassing/NonPrimitivesUnitTest.java similarity index 100% rename from core-java/src/test/java/com/baeldung/parameterpassing/NonPrimitivesUnitTest.java rename to core-java-lang/src/test/java/com/baeldung/parameterpassing/NonPrimitivesUnitTest.java diff --git a/core-java/src/test/java/com/baeldung/parameterpassing/PrimitivesUnitTest.java b/core-java-lang/src/test/java/com/baeldung/parameterpassing/PrimitivesUnitTest.java similarity index 100% rename from core-java/src/test/java/com/baeldung/parameterpassing/PrimitivesUnitTest.java rename to core-java-lang/src/test/java/com/baeldung/parameterpassing/PrimitivesUnitTest.java diff --git a/core-java/src/test/java/com/baeldung/polymorphism/PolymorphismUnitTest.java b/core-java-lang/src/test/java/com/baeldung/polymorphism/PolymorphismUnitTest.java similarity index 100% rename from core-java/src/test/java/com/baeldung/polymorphism/PolymorphismUnitTest.java rename to core-java-lang/src/test/java/com/baeldung/polymorphism/PolymorphismUnitTest.java diff --git a/core-java/src/test/java/com/baeldung/PrimitiveConversionsJUnitTest.java b/core-java-lang/src/test/java/com/baeldung/primitiveconversion/PrimitiveConversionsJUnitTest.java similarity index 99% rename from core-java/src/test/java/com/baeldung/PrimitiveConversionsJUnitTest.java rename to core-java-lang/src/test/java/com/baeldung/primitiveconversion/PrimitiveConversionsJUnitTest.java index 69a6c18dfd..cb83f4a5ed 100644 --- a/core-java/src/test/java/com/baeldung/PrimitiveConversionsJUnitTest.java +++ b/core-java-lang/src/test/java/com/baeldung/primitiveconversion/PrimitiveConversionsJUnitTest.java @@ -1,4 +1,4 @@ -package com.baeldung; +package com.baeldung.primitiveconversion; import org.junit.Test; import org.slf4j.Logger; diff --git a/core-java/src/test/java/com/baeldung/recursion/RecursionExampleUnitTest.java b/core-java-lang/src/test/java/com/baeldung/recursion/RecursionExampleUnitTest.java similarity index 100% rename from core-java/src/test/java/com/baeldung/recursion/RecursionExampleUnitTest.java rename to core-java-lang/src/test/java/com/baeldung/recursion/RecursionExampleUnitTest.java diff --git a/core-java/src/test/java/com/baeldung/sneakythrows/SneakyRunnableUnitTest.java b/core-java-lang/src/test/java/com/baeldung/sneakythrows/SneakyRunnableUnitTest.java similarity index 100% rename from core-java/src/test/java/com/baeldung/sneakythrows/SneakyRunnableUnitTest.java rename to core-java-lang/src/test/java/com/baeldung/sneakythrows/SneakyRunnableUnitTest.java diff --git a/core-java/src/test/java/com/baeldung/sneakythrows/SneakyThrowsUnitTest.java b/core-java-lang/src/test/java/com/baeldung/sneakythrows/SneakyThrowsUnitTest.java similarity index 100% rename from core-java/src/test/java/com/baeldung/sneakythrows/SneakyThrowsUnitTest.java rename to core-java-lang/src/test/java/com/baeldung/sneakythrows/SneakyThrowsUnitTest.java diff --git a/core-java/src/test/java/com/baeldung/stackoverflowerror/AccountHolderManualTest.java b/core-java-lang/src/test/java/com/baeldung/stackoverflowerror/AccountHolderManualTest.java similarity index 100% rename from core-java/src/test/java/com/baeldung/stackoverflowerror/AccountHolderManualTest.java rename to core-java-lang/src/test/java/com/baeldung/stackoverflowerror/AccountHolderManualTest.java diff --git a/core-java/src/test/java/com/baeldung/stackoverflowerror/CyclicDependancyManualTest.java b/core-java-lang/src/test/java/com/baeldung/stackoverflowerror/CyclicDependancyManualTest.java similarity index 100% rename from core-java/src/test/java/com/baeldung/stackoverflowerror/CyclicDependancyManualTest.java rename to core-java-lang/src/test/java/com/baeldung/stackoverflowerror/CyclicDependancyManualTest.java diff --git a/core-java/src/test/java/com/baeldung/stackoverflowerror/InfiniteRecursionWithTerminationConditionManualTest.java b/core-java-lang/src/test/java/com/baeldung/stackoverflowerror/InfiniteRecursionWithTerminationConditionManualTest.java similarity index 100% rename from core-java/src/test/java/com/baeldung/stackoverflowerror/InfiniteRecursionWithTerminationConditionManualTest.java rename to core-java-lang/src/test/java/com/baeldung/stackoverflowerror/InfiniteRecursionWithTerminationConditionManualTest.java diff --git a/core-java/src/test/java/com/baeldung/stackoverflowerror/RecursionWithCorrectTerminationConditionManualTest.java b/core-java-lang/src/test/java/com/baeldung/stackoverflowerror/RecursionWithCorrectTerminationConditionManualTest.java similarity index 100% rename from core-java/src/test/java/com/baeldung/stackoverflowerror/RecursionWithCorrectTerminationConditionManualTest.java rename to core-java-lang/src/test/java/com/baeldung/stackoverflowerror/RecursionWithCorrectTerminationConditionManualTest.java diff --git a/core-java/src/test/java/com/baeldung/stackoverflowerror/UnintendedInfiniteRecursionManualTest.java b/core-java-lang/src/test/java/com/baeldung/stackoverflowerror/UnintendedInfiniteRecursionManualTest.java similarity index 100% rename from core-java/src/test/java/com/baeldung/stackoverflowerror/UnintendedInfiniteRecursionManualTest.java rename to core-java-lang/src/test/java/com/baeldung/stackoverflowerror/UnintendedInfiniteRecursionManualTest.java diff --git a/core-java/src/test/java/com/baeldung/staticdemo/CarIntegrationTest.java b/core-java-lang/src/test/java/com/baeldung/staticdemo/CarIntegrationTest.java similarity index 100% rename from core-java/src/test/java/com/baeldung/staticdemo/CarIntegrationTest.java rename to core-java-lang/src/test/java/com/baeldung/staticdemo/CarIntegrationTest.java diff --git a/core-java/src/test/java/com/baeldung/staticdemo/SingletonIntegrationTest.java b/core-java-lang/src/test/java/com/baeldung/staticdemo/SingletonIntegrationTest.java similarity index 100% rename from core-java/src/test/java/com/baeldung/staticdemo/SingletonIntegrationTest.java rename to core-java-lang/src/test/java/com/baeldung/staticdemo/SingletonIntegrationTest.java diff --git a/core-java/src/test/java/com/baeldung/staticdemo/StaticBlockIntegrationTest.java b/core-java-lang/src/test/java/com/baeldung/staticdemo/StaticBlockIntegrationTest.java similarity index 100% rename from core-java/src/test/java/com/baeldung/staticdemo/StaticBlockIntegrationTest.java rename to core-java-lang/src/test/java/com/baeldung/staticdemo/StaticBlockIntegrationTest.java diff --git a/core-java/src/test/java/com/baeldung/switchstatement/SwitchStatementUnitTest.java b/core-java-lang/src/test/java/com/baeldung/switchstatement/SwitchStatementUnitTest.java similarity index 100% rename from core-java/src/test/java/com/baeldung/switchstatement/SwitchStatementUnitTest.java rename to core-java-lang/src/test/java/com/baeldung/switchstatement/SwitchStatementUnitTest.java diff --git a/core-java/src/test/java/com/baeldung/synthetic/SyntheticUnitTest.java b/core-java-lang/src/test/java/com/baeldung/synthetic/SyntheticUnitTest.java similarity index 100% rename from core-java/src/test/java/com/baeldung/synthetic/SyntheticUnitTest.java rename to core-java-lang/src/test/java/com/baeldung/synthetic/SyntheticUnitTest.java diff --git a/core-java/src/test/java/com/baeldung/system/DateTimeServiceUnitTest.java b/core-java-lang/src/test/java/com/baeldung/system/DateTimeServiceUnitTest.java similarity index 100% rename from core-java/src/test/java/com/baeldung/system/DateTimeServiceUnitTest.java rename to core-java-lang/src/test/java/com/baeldung/system/DateTimeServiceUnitTest.java diff --git a/core-java/src/test/java/com/baeldung/system/EnvironmentVariablesUnitTest.java b/core-java-lang/src/test/java/com/baeldung/system/EnvironmentVariablesUnitTest.java similarity index 100% rename from core-java/src/test/java/com/baeldung/system/EnvironmentVariablesUnitTest.java rename to core-java-lang/src/test/java/com/baeldung/system/EnvironmentVariablesUnitTest.java diff --git a/core-java/src/test/java/com/baeldung/system/SystemArrayCopyUnitTest.java b/core-java-lang/src/test/java/com/baeldung/system/SystemArrayCopyUnitTest.java similarity index 100% rename from core-java/src/test/java/com/baeldung/system/SystemArrayCopyUnitTest.java rename to core-java-lang/src/test/java/com/baeldung/system/SystemArrayCopyUnitTest.java diff --git a/core-java/src/test/java/com/baeldung/system/SystemNanoUnitTest.java b/core-java-lang/src/test/java/com/baeldung/system/SystemNanoUnitTest.java similarity index 100% rename from core-java/src/test/java/com/baeldung/system/SystemNanoUnitTest.java rename to core-java-lang/src/test/java/com/baeldung/system/SystemNanoUnitTest.java diff --git a/core-java/src/test/java/com/baeldung/system/SystemPropertiesUnitTest.java b/core-java-lang/src/test/java/com/baeldung/system/SystemPropertiesUnitTest.java similarity index 100% rename from core-java/src/test/java/com/baeldung/system/SystemPropertiesUnitTest.java rename to core-java-lang/src/test/java/com/baeldung/system/SystemPropertiesUnitTest.java diff --git a/core-java/src/test/java/com/baeldung/ternaryoperator/TernaryOperatorUnitTest.java b/core-java-lang/src/test/java/com/baeldung/ternaryoperator/TernaryOperatorUnitTest.java similarity index 100% rename from core-java/src/test/java/com/baeldung/ternaryoperator/TernaryOperatorUnitTest.java rename to core-java-lang/src/test/java/com/baeldung/ternaryoperator/TernaryOperatorUnitTest.java diff --git a/core-java/src/test/java/com/baeldung/throwsexception/SimpleServiceUnitTest.java b/core-java-lang/src/test/java/com/baeldung/throwsexception/SimpleServiceUnitTest.java similarity index 100% rename from core-java/src/test/java/com/baeldung/throwsexception/SimpleServiceUnitTest.java rename to core-java-lang/src/test/java/com/baeldung/throwsexception/SimpleServiceUnitTest.java diff --git a/core-java/src/test/java/com/baeldung/typeerasure/TypeErasureUnitTest.java b/core-java-lang/src/test/java/com/baeldung/typeerasure/TypeErasureUnitTest.java similarity index 100% rename from core-java/src/test/java/com/baeldung/typeerasure/TypeErasureUnitTest.java rename to core-java-lang/src/test/java/com/baeldung/typeerasure/TypeErasureUnitTest.java diff --git a/core-java/src/test/java/com/baeldung/varargs/FormatterUnitTest.java b/core-java-lang/src/test/java/com/baeldung/varargs/FormatterUnitTest.java similarity index 100% rename from core-java/src/test/java/com/baeldung/varargs/FormatterUnitTest.java rename to core-java-lang/src/test/java/com/baeldung/varargs/FormatterUnitTest.java diff --git a/core-java/src/test/resources/correctFileNameWithoutProperExtension b/core-java-lang/src/test/resources/correctFileNameWithoutProperExtension similarity index 100% rename from core-java/src/test/resources/correctFileNameWithoutProperExtension rename to core-java-lang/src/test/resources/correctFileNameWithoutProperExtension diff --git a/core-java-networking/.gitignore b/core-java-networking/.gitignore new file mode 100644 index 0000000000..374c8bf907 --- /dev/null +++ b/core-java-networking/.gitignore @@ -0,0 +1,25 @@ +*.class + +0.* + +#folders# +/target +/neoDb* +/data +/src/main/webapp/WEB-INF/classes +*/META-INF/* +.resourceCache + +# Packaged files # +*.jar +*.war +*.ear + +# Files generated by integration tests +backup-pom.xml +/bin/ +/temp + +#IntelliJ specific +.idea/ +*.iml \ No newline at end of file diff --git a/core-java-networking/README.md b/core-java-networking/README.md new file mode 100644 index 0000000000..b7a142ea27 --- /dev/null +++ b/core-java-networking/README.md @@ -0,0 +1,3 @@ +========= + +## Core Java Net diff --git a/core-java-networking/pom.xml b/core-java-networking/pom.xml new file mode 100644 index 0000000000..178295e1ec --- /dev/null +++ b/core-java-networking/pom.xml @@ -0,0 +1,19 @@ + + 4.0.0 + core-java-networking + 0.1.0-SNAPSHOT + jar + core-java-networking + + + com.baeldung + parent-java + 0.0.1-SNAPSHOT + ../parent-java + + + + core-java-networking + + diff --git a/core-java-networking/src/main/java/com/baeldung/networking/proxies/CommandLineProxyDemo.java b/core-java-networking/src/main/java/com/baeldung/networking/proxies/CommandLineProxyDemo.java new file mode 100644 index 0000000000..bbc8a81c98 --- /dev/null +++ b/core-java-networking/src/main/java/com/baeldung/networking/proxies/CommandLineProxyDemo.java @@ -0,0 +1,17 @@ +package com.baeldung.networking.proxies; + +import java.net.URL; +import java.net.URLConnection; + +public class CommandLineProxyDemo { + + public static final String RESOURCE_URL = "http://www.google.com"; + + public static void main(String[] args) throws Exception { + + URL url = new URL(RESOURCE_URL); + URLConnection con = url.openConnection(); + System.out.println(UrlConnectionUtils.contentAsString(con)); + } + +} \ No newline at end of file diff --git a/core-java-networking/src/main/java/com/baeldung/networking/proxies/DirectProxyDemo.java b/core-java-networking/src/main/java/com/baeldung/networking/proxies/DirectProxyDemo.java new file mode 100644 index 0000000000..07a7880886 --- /dev/null +++ b/core-java-networking/src/main/java/com/baeldung/networking/proxies/DirectProxyDemo.java @@ -0,0 +1,20 @@ +package com.baeldung.networking.proxies; + +import java.io.IOException; +import java.net.HttpURLConnection; +import java.net.Proxy; +import java.net.URL; + +public class DirectProxyDemo { + + private static final String URL_STRING = "http://www.google.com"; + + public static void main(String... args) throws IOException { + + URL weburl = new URL(URL_STRING); + HttpURLConnection directConnection + = (HttpURLConnection) weburl.openConnection(Proxy.NO_PROXY); + System.out.println(UrlConnectionUtils.contentAsString(directConnection)); + } + +} diff --git a/core-java-networking/src/main/java/com/baeldung/networking/proxies/SocksProxyDemo.java b/core-java-networking/src/main/java/com/baeldung/networking/proxies/SocksProxyDemo.java new file mode 100644 index 0000000000..e7ac3c0264 --- /dev/null +++ b/core-java-networking/src/main/java/com/baeldung/networking/proxies/SocksProxyDemo.java @@ -0,0 +1,32 @@ +package com.baeldung.networking.proxies; + +import java.io.IOException; +import java.net.HttpURLConnection; +import java.net.InetSocketAddress; +import java.net.Proxy; +import java.net.Socket; +import java.net.URL; + +public class SocksProxyDemo { + + private static final String URL_STRING = "http://www.google.com"; + private static final String SOCKET_SERVER_HOST = "someserver.baeldung.com"; + private static final int SOCKET_SERVER_PORT = 1111; + + public static void main(String... args) throws IOException { + + URL weburl = new URL(URL_STRING); + Proxy socksProxy + = new Proxy(Proxy.Type.SOCKS, new InetSocketAddress("127.0.0.1", 1080)); + HttpURLConnection socksConnection + = (HttpURLConnection) weburl.openConnection(socksProxy); + System.out.println(UrlConnectionUtils.contentAsString(socksConnection)); + + Socket proxySocket = new Socket(socksProxy); + InetSocketAddress socketHost + = new InetSocketAddress(SOCKET_SERVER_HOST, SOCKET_SERVER_PORT); + proxySocket.connect(socketHost); + // do stuff with the socket + } + +} diff --git a/core-java-networking/src/main/java/com/baeldung/networking/proxies/SystemPropertyProxyDemo.java b/core-java-networking/src/main/java/com/baeldung/networking/proxies/SystemPropertyProxyDemo.java new file mode 100644 index 0000000000..1f589eac58 --- /dev/null +++ b/core-java-networking/src/main/java/com/baeldung/networking/proxies/SystemPropertyProxyDemo.java @@ -0,0 +1,23 @@ +package com.baeldung.networking.proxies; + +import java.net.URL; +import java.net.URLConnection; + +public class SystemPropertyProxyDemo { + + public static final String RESOURCE_URL = "http://www.google.com"; + + public static void main(String[] args) throws Exception { + + System.setProperty("http.proxyHost", "127.0.0.1"); + System.setProperty("http.proxyPort", "3128"); + + URL url = new URL(RESOURCE_URL); + URLConnection con = url.openConnection(); + System.out.println(UrlConnectionUtils.contentAsString(con)); + + System.setProperty("http.proxyHost", null); + // proxy will no longer be used for http connections + } + +} diff --git a/core-java-networking/src/main/java/com/baeldung/networking/proxies/UrlConnectionUtils.java b/core-java-networking/src/main/java/com/baeldung/networking/proxies/UrlConnectionUtils.java new file mode 100644 index 0000000000..aa12824a90 --- /dev/null +++ b/core-java-networking/src/main/java/com/baeldung/networking/proxies/UrlConnectionUtils.java @@ -0,0 +1,21 @@ +package com.baeldung.networking.proxies; + +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStreamReader; +import java.net.URLConnection; + +class UrlConnectionUtils { + + public static String contentAsString(URLConnection con) throws IOException { + StringBuilder builder = new StringBuilder(); + try (BufferedReader reader + = new BufferedReader(new InputStreamReader(con.getInputStream()))){ + while (reader.ready()) { + builder.append(reader.readLine()); + } + } + return builder.toString(); + } + +} diff --git a/core-java-networking/src/main/java/com/baeldung/networking/proxies/WebProxyDemo.java b/core-java-networking/src/main/java/com/baeldung/networking/proxies/WebProxyDemo.java new file mode 100644 index 0000000000..41caaf3439 --- /dev/null +++ b/core-java-networking/src/main/java/com/baeldung/networking/proxies/WebProxyDemo.java @@ -0,0 +1,23 @@ +package com.baeldung.networking.proxies; + +import java.io.IOException; +import java.net.HttpURLConnection; +import java.net.InetSocketAddress; +import java.net.Proxy; +import java.net.URL; + +public class WebProxyDemo { + + private static final String URL_STRING = "http://www.google.com"; + + public static void main(String... args) throws IOException { + + URL weburl = new URL(URL_STRING); + Proxy webProxy + = new Proxy(Proxy.Type.HTTP, new InetSocketAddress("127.0.0.1", 3128)); + HttpURLConnection webProxyConnection + = (HttpURLConnection) weburl.openConnection(webProxy); + System.out.println(UrlConnectionUtils.contentAsString(webProxyConnection)); + } + +} diff --git a/out/production/main/com/baeldung/.gitignore b/core-java-networking/src/test/resources/.gitignore similarity index 100% rename from out/production/main/com/baeldung/.gitignore rename to core-java-networking/src/test/resources/.gitignore diff --git a/core-java/README.md b/core-java/README.md index 9e38dfc47d..20f6ef5ea7 100644 --- a/core-java/README.md +++ b/core-java/README.md @@ -6,118 +6,56 @@ - [Java Timer](http://www.baeldung.com/java-timer-and-timertask) - [How to Run a Shell Command in Java](http://www.baeldung.com/run-shell-command-in-java) - [MD5 Hashing in Java](http://www.baeldung.com/java-md5) -- [Guide to Java Reflection](http://www.baeldung.com/java-reflection) - [A Guide to Java Sockets](http://www.baeldung.com/a-guide-to-java-sockets) -- [Java – Try with Resources](http://www.baeldung.com/java-try-with-resources) - [Guide to the Fork/Join Framework in Java](http://www.baeldung.com/java-fork-join) - [How to Print Screen in Java](http://www.baeldung.com/print-screen-in-java) -- [Introduction to Java Generics](http://www.baeldung.com/java-generics) -- [Generate equals() and hashCode() with Eclipse](http://www.baeldung.com/java-eclipse-equals-and-hashcode) - [A Guide To Java Regular Expressions API](http://www.baeldung.com/regular-expressions-java) -- [Sorting in Java](http://www.baeldung.com/java-sorting) - [Getting Started with Java Properties](http://www.baeldung.com/java-properties) -- [Grep in Java](http://www.baeldung.com/grep-in-java) -- [Simulated Annealing for Travelling Salesman Problem](http://www.baeldung.com/java-simulated-annealing-for-traveling-salesman) -- [Slope One Algorithm: Collaborative Filtering Recommendation Systems](http://www.baeldung.com/java-collaborative-filtering-recommendations) - [Pattern Search with Grep in Java](http://www.baeldung.com/grep-in-java) - [URL Encoding and Decoding in Java](http://www.baeldung.com/java-url-encoding-decoding) -- [The Basics of Java Generics](http://www.baeldung.com/java-generics) -- [The Traveling Salesman Problem in Java](http://www.baeldung.com/java-simulated-annealing-for-traveling-salesman) - [How to Create an Executable JAR with Maven](http://www.baeldung.com/executable-jar-with-maven) - [How to Design a Genetic Algorithm in Java](http://www.baeldung.com/java-genetic-algorithm) - [Basic Introduction to JMX](http://www.baeldung.com/java-management-extensions) - [AWS Lambda With Java](http://www.baeldung.com/java-aws-lambda) - [Introduction to Nashorn](http://www.baeldung.com/java-nashorn) -- [Chained Exceptions in Java](http://www.baeldung.com/java-chained-exceptions) -- [A Quick JUnit vs TestNG Comparison](http://www.baeldung.com/junit-vs-testng) -- [Java Primitive Conversions](http://www.baeldung.com/java-primitive-conversions) - [Java Money and the Currency API](http://www.baeldung.com/java-money-and-currency) - [JVM Log Forging](http://www.baeldung.com/jvm-log-forging) - [Guide to sun.misc.Unsafe](http://www.baeldung.com/java-unsafe) - [How to Perform a Simple HTTP Request in Java](http://www.baeldung.com/java-http-request) -- [Call Methods at Runtime Using Java Reflection](http://www.baeldung.com/java-method-reflection) - [How to Add a Single Element to a Stream](http://www.baeldung.com/java-stream-append-prepend) -- [Iterating Over Enum Values in Java](http://www.baeldung.com/java-enum-iteration) - [Kotlin Java Interoperability](http://www.baeldung.com/kotlin-java-interoperability) -- [Changing Annotation Parameters At Runtime](http://www.baeldung.com/java-reflection-change-annotation-params) - [How to Find all Getters Returning Null](http://www.baeldung.com/java-getters-returning-null) -- [Changing the Order in a Sum Operation Can Produce Different Results?](http://www.baeldung.com/java-floating-point-sum-order) - [How to Get a Name of a Method Being Executed?](http://www.baeldung.com/java-name-of-executing-method) -- [Dynamic Proxies in Java](http://www.baeldung.com/java-dynamic-proxies) -- [How to Copy an Array in Java](http://www.baeldung.com/java-array-copy) - [Converting a Stack Trace to a String in Java](http://www.baeldung.com/java-stacktrace-to-string) -- [Java Double Brace Initialization](http://www.baeldung.com/java-double-brace-initialization) -- [The StackOverflowError in Java](http://www.baeldung.com/java-stack-overflow-error) - [Introduction to Java Serialization](http://www.baeldung.com/java-serialization) -- [ClassNotFoundException vs NoClassDefFoundError](http://www.baeldung.com/java-classnotfoundexception-and-noclassdeffounderror) - [Guide to UUID in Java](http://www.baeldung.com/java-uuid) - [Guide to Escaping Characters in Java RegExps](http://www.baeldung.com/java-regexp-escape-char) -- [Guide to hashCode() in Java](http://www.baeldung.com/java-hashcode) - [Difference between URL and URI](http://www.baeldung.com/java-url-vs-uri) - [Broadcasting and Multicasting in Java](http://www.baeldung.com/java-broadcast-multicast) - [Period and Duration in Java](http://www.baeldung.com/java-period-duration) -- [Guide to the Diamond Operator in Java](http://www.baeldung.com/java-diamond-operator) -- [“Sneaky Throws” in Java](http://www.baeldung.com/java-sneaky-throws) - [OutOfMemoryError: GC Overhead Limit Exceeded](http://www.baeldung.com/java-gc-overhead-limit-exceeded) - [Creating a Java Compiler Plugin](http://www.baeldung.com/java-build-compiler-plugin) -- [A Guide to the Static Keyword in Java](http://www.baeldung.com/java-static) -- [Initializing Arrays in Java](http://www.baeldung.com/java-initialize-array) -- [Quick Example - Comparator vs Comparable in Java](http://www.baeldung.com/java-comparator-comparable) - [Quick Guide to Java Stack](http://www.baeldung.com/java-stack) -- [The Java continue and break Keywords](http://www.baeldung.com/java-continue-and-break) - [Guide to java.util.Formatter](http://www.baeldung.com/java-string-formatter) -- [Check if a Java Array Contains a Value](http://www.baeldung.com/java-array-contains-value) -- [How to Invert an Array in Java](http://www.baeldung.com/java-invert-array) - [Guide to the Cipher Class](http://www.baeldung.com/java-cipher-class) -- [A Guide to Java Initialization](http://www.baeldung.com/java-initialization) -- [Implementing a Binary Tree in Java](http://www.baeldung.com/java-binary-tree) - [A Guide to ThreadLocalRandom in Java](http://www.baeldung.com/java-thread-local-random) -- [Nested Classes in Java](http://www.baeldung.com/java-nested-classes) -- [A Guide to Java Loops](http://www.baeldung.com/java-loops) -- [Varargs in Java](http://www.baeldung.com/java-varargs) -- [A Guide to Inner Interfaces in Java](http://www.baeldung.com/java-inner-interfaces) -- [Polymorphism in Java](http://www.baeldung.com/java-polymorphism) -- [Recursion In Java](http://www.baeldung.com/java-recursion) -- [A Guide to the finalize Method in Java](http://www.baeldung.com/java-finalize) - [Compiling Java *.class Files with javac](http://www.baeldung.com/javac) -- [Method Overloading and Overriding in Java](http://www.baeldung.com/java-method-overload-override) -- [Guide to ThreadLocalRandom in Java](http://www.baeldung.com/java-thread-local-random) - [A Guide to Iterator in Java](http://www.baeldung.com/java-iterator) - [The Trie Data Structure in Java](http://www.baeldung.com/trie-java) - [Introduction to Javadoc](http://www.baeldung.com/javadoc) -- [How to Make a Deep Copy of an Object in Java](http://www.baeldung.com/java-deep-copy) -- [Guide to Inheritance in Java](http://www.baeldung.com/java-inheritance) - [Guide to Externalizable Interface in Java](http://www.baeldung.com/java-externalizable) -- [Object Type Casting in Java](http://www.baeldung.com/java-type-casting) - [A Practical Guide to DecimalFormat](http://www.baeldung.com/java-decimalformat) - [How to Detect the OS Using Java](http://www.baeldung.com/java-detect-os) - [ASCII Art in Java](http://www.baeldung.com/ascii-art-in-java) -- [Inheritance and Composition (Is-a vs Has-a relationship) in Java](http://www.baeldung.com/java-inheritance-composition) -- [Finding Max/Min of a List or Collection](http://www.baeldung.com/java-collection-min-max) -- [The "final" Keyword in Java](http://www.baeldung.com/java-final) - [What is the serialVersionUID?](http://www.baeldung.com/java-serial-version-uid) - [A Guide To UDP In Java](http://www.baeldung.com/udp-in-java) -- [A Guide to the Java LinkedList](http://www.baeldung.com/java-linkedlist) -- [A Guide to Java Enums](http://www.baeldung.com/a-guide-to-java-enums) - [A Guide to the ResourceBundle](http://www.baeldung.com/java-resourcebundle) -- [Quick Guide to java.lang.System](http://www.baeldung.com/java-lang-system) - [Class Loaders in Java](http://www.baeldung.com/java-classloaders) -- [Find Sum and Average in a Java Array](http://www.baeldung.com/java-array-sum-average) -- [Java List UnsupportedOperationException](http://www.baeldung.com/java-list-unsupported-operation-exception) -- [Type Erasure in Java Explained](http://www.baeldung.com/java-type-erasure) -- [Join and Split Arrays and Collections in Java](http://www.baeldung.com/java-join-and-split) -- [Check If Two Lists are Equal in Java](http://www.baeldung.com/java-test-a-list-for-ordinality-and-equality) - [Sending Emails with Java](http://www.baeldung.com/java-email) - [Introduction to SSL in Java](http://www.baeldung.com/java-ssl) - [Java KeyStore API](http://www.baeldung.com/java-keystore) - [Double-Checked Locking with Singleton](http://www.baeldung.com/java-singleton-double-checked-locking) - [Guide to Java Clock Class](http://www.baeldung.com/java-clock) -- [Infinite Loops in Java](http://www.baeldung.com/infinite-loops-java) -- [Using Java Assertions](http://www.baeldung.com/java-assert) -- [Pass-By-Value as a Parameter Passing Mechanism in Java](http://www.baeldung.com/java-pass-by-value-or-pass-by-reference) -- [Variable and Method Hiding in Java](http://www.baeldung.com/java-variable-method-hiding) -- [Access Modifiers in Java](http://www.baeldung.com/java-access-modifiers) -- [Infinite Loops in Java](http://www.baeldung.com/infinite-loops-java) - [Introduction to Creational Design Patterns](http://www.baeldung.com/creational-design-patterns) - [Proxy, Decorator, Adapter and Bridge Patterns](http://www.baeldung.com/java-structural-design-patterns) - [Singletons in Java](http://www.baeldung.com/java-singleton) @@ -125,34 +63,32 @@ - [The Observer Pattern in Java](http://www.baeldung.com/java-observer-pattern) - [Service Locator Pattern](http://www.baeldung.com/java-service-locator-pattern) - [The Thread.join() Method in Java](http://www.baeldung.com/java-thread-join) -- [Guide to the super Java Keyword](http://www.baeldung.com/java-super) -- [Guide to the this Java Keyword](http://www.baeldung.com/java-this) -- [Jagged Arrays In Java](http://www.baeldung.com/java-jagged-arrays) - [Importance of Main Manifest Attribute in a Self-Executing JAR](http://www.baeldung.com/java-jar-executable-manifest-main-class) - [How to Get the File Extension of a File in Java](http://www.baeldung.com/java-file-extension) -- [Immutable Objects in Java](http://www.baeldung.com/java-immutable-object) - [Console I/O in Java](http://www.baeldung.com/java-console-input-output) -- [Guide to the java.util.Arrays Class](http://www.baeldung.com/java-util-arrays) -- [Create a Custom Exception in Java](http://www.baeldung.com/java-new-custom-exception) - [Java Global Exception Handler](http://www.baeldung.com/java-global-exception-handler) - [Encrypting and Decrypting Files in Java](http://www.baeldung.com/java-cipher-input-output-stream) - [How to Get the Size of an Object in Java](http://www.baeldung.com/java-size-of-object) -- [Exception Handling in Java](http://www.baeldung.com/java-exceptions) - [Guide to Java Instrumentation](http://www.baeldung.com/java-instrumentation) - [Getting a File’s Mime Type in Java](http://www.baeldung.com/java-file-mime-type) - [Common Java Exceptions](http://www.baeldung.com/java-common-exceptions) - [Java Constructors vs Static Factory Methods](https://www.baeldung.com/java-constructors-vs-static-factory-methods) -- [Differences Between Final, Finally and Finalize in Java](https://www.baeldung.com/java-final-finally-finalize) -- [Static and Dynamic Binding in Java](https://www.baeldung.com/java-static-dynamic-binding) -- [Java List Initialization in One Line](https://www.baeldung.com/java-init-list-one-line) -- [Difference Between Throw and Throws in Java](https://www.baeldung.com/java-throw-throws) -- [ClassCastException: Arrays$ArrayList cannot be cast to ArrayList](https://www.baeldung.com/java-classcastexception-arrays-arraylist) - [Throw Exception in Optional in Java 8](https://www.baeldung.com/java-optional-throw-exception) - [Add a Character to a String at a Given Position](https://www.baeldung.com/java-add-character-to-string) -- [Synthetic Constructs in Java](https://www.baeldung.com/java-synthetic) +- [Calculating the nth Root in Java](https://www.baeldung.com/java-nth-root) - [Convert Double to String, Removing Decimal Places](https://www.baeldung.com/java-double-to-string) - [Different Ways to Capture Java Heap Dumps](https://www.baeldung.com/java-heap-dump-capture) -- [How to Separate Double into Integer and Decimal Parts](https://www.baeldung.com/java-separate-double-into-integer-decimal-parts) - [ZoneOffset in Java](https://www.baeldung.com/java-zone-offset) - [Hashing a Password in Java](https://www.baeldung.com/java-password-hashing) -- [Java Switch Statement](https://www.baeldung.com/java-switch) +- [Merging java.util.Properties Objects](https://www.baeldung.com/java-merging-properties) +- [Understanding Memory Leaks in Java](https://www.baeldung.com/java-memory-leaks) +- [A Guide to SimpleDateFormat](https://www.baeldung.com/java-simple-date-format) +- [SSL Handshake Failures](https://www.baeldung.com/java-ssl-handshake-failures) +- [Implementing a Binary Tree in Java](https://www.baeldung.com/java-binary-tree) +- [Changing the Order in a Sum Operation Can Produce Different Results?](https://www.baeldung.com/java-floating-point-sum-order) +- [Java – Try with Resources](https://www.baeldung.com/java-try-with-resources) +- [Abstract Classes in Java](https://www.baeldung.com/java-abstract-class) +- [Guide to Character Encoding](https://www.baeldung.com/java-char-encoding) +- [Calculate the Area of a Circle in Java](https://www.baeldung.com/java-calculate-circle-area) +- [A Guide to the Java Math Class](https://www.baeldung.com/java-lang-math) +- [Graphs in Java](https://www.baeldung.com/java-graphs) diff --git a/core-java/pom.xml b/core-java/pom.xml index 477a01375d..64345ab14c 100644 --- a/core-java/pom.xml +++ b/core-java/pom.xml @@ -1,11 +1,10 @@ 4.0.0 - com.baeldung core-java 0.1.0-SNAPSHOT - jar core-java + jar com.baeldung @@ -157,7 +156,7 @@ com.sun tools - 1.8.0 + ${sun.tools.version} system ${java.home}/../lib/tools.jar @@ -173,21 +172,6 @@ - - org.apache.maven.plugins - maven-surefire-plugin - - - **/*LiveTest.java - **/*IntegrationTest.java - **/*IntTest.java - **/*LongRunningUnitTest.java - **/*ManualTest.java - - true - - - org.apache.maven.plugins maven-dependency-plugin @@ -542,6 +526,7 @@ 0.1.5 3.21.0-GA + + 1.8.0 - diff --git a/core-java/src/main/java/com/baeldung/abstractclasses/application/Application.java b/core-java/src/main/java/com/baeldung/abstractclasses/application/Application.java new file mode 100644 index 0000000000..3180762227 --- /dev/null +++ b/core-java/src/main/java/com/baeldung/abstractclasses/application/Application.java @@ -0,0 +1,29 @@ +package com.baeldung.abstractclasses.application; + +import com.baeldung.abstractclasses.filereaders.BaseFileReader; +import com.baeldung.abstractclasses.filereaders.LowercaseFileReader; +import com.baeldung.abstractclasses.filereaders.UppercaseFileReader; +import java.io.IOException; +import java.net.URISyntaxException; +import java.nio.file.Path; +import java.nio.file.Paths; + +public class Application { + + public static void main(String[] args) throws IOException, URISyntaxException { + + Application application = new Application(); + Path path = application.getPathFromResourcesFile("files/test.txt"); + BaseFileReader lowercaseFileReader = new LowercaseFileReader(path); + lowercaseFileReader.readFile().forEach(line -> System.out.println(line)); + + BaseFileReader uppercaseFileReader = new UppercaseFileReader(path); + uppercaseFileReader.readFile().forEach(line -> System.out.println(line)); + + } + + private Path getPathFromResourcesFile(String filePath) throws URISyntaxException { + return Paths.get(getClass().getClassLoader().getResource(filePath).toURI()); + + } +} diff --git a/core-java/src/main/java/com/baeldung/abstractclasses/filereaders/BaseFileReader.java b/core-java/src/main/java/com/baeldung/abstractclasses/filereaders/BaseFileReader.java new file mode 100644 index 0000000000..97452a9eca --- /dev/null +++ b/core-java/src/main/java/com/baeldung/abstractclasses/filereaders/BaseFileReader.java @@ -0,0 +1,27 @@ +package com.baeldung.abstractclasses.filereaders; + +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Path; +import java.util.List; +import java.util.stream.Collectors; + +public abstract class BaseFileReader { + + protected Path filePath; + + protected BaseFileReader(Path filePath) { + this.filePath = filePath; + } + + public Path getFilePath() { + return filePath; + } + + public List readFile() throws IOException { + return Files.lines(filePath) + .map(this::mapFileLine).collect(Collectors.toList()); + } + + protected abstract String mapFileLine(String line); +} diff --git a/core-java/src/main/java/com/baeldung/abstractclasses/filereaders/LowercaseFileReader.java b/core-java/src/main/java/com/baeldung/abstractclasses/filereaders/LowercaseFileReader.java new file mode 100644 index 0000000000..53820d393c --- /dev/null +++ b/core-java/src/main/java/com/baeldung/abstractclasses/filereaders/LowercaseFileReader.java @@ -0,0 +1,15 @@ +package com.baeldung.abstractclasses.filereaders; + +import java.nio.file.Path; + +public class LowercaseFileReader extends BaseFileReader { + + public LowercaseFileReader(Path filePath) { + super(filePath); + } + + @Override + public String mapFileLine(String line) { + return line.toLowerCase(); + } +} diff --git a/core-java/src/main/java/com/baeldung/abstractclasses/filereaders/UppercaseFileReader.java b/core-java/src/main/java/com/baeldung/abstractclasses/filereaders/UppercaseFileReader.java new file mode 100644 index 0000000000..3144a4f27f --- /dev/null +++ b/core-java/src/main/java/com/baeldung/abstractclasses/filereaders/UppercaseFileReader.java @@ -0,0 +1,15 @@ +package com.baeldung.abstractclasses.filereaders; + +import java.nio.file.Path; + +public class UppercaseFileReader extends BaseFileReader { + + public UppercaseFileReader(Path filePath) { + super(filePath); + } + + @Override + public String mapFileLine(String line) { + return line.toUpperCase(); + } +} diff --git a/core-java/src/main/java/com/baeldung/area/circle/Circle.java b/core-java/src/main/java/com/baeldung/area/circle/Circle.java new file mode 100644 index 0000000000..40eed079e4 --- /dev/null +++ b/core-java/src/main/java/com/baeldung/area/circle/Circle.java @@ -0,0 +1,26 @@ +package com.baeldung.area.circle; + +public class Circle { + + private double radius; + + public Circle(double radius) { + this.radius = radius; + } + + public double getRadius() { + return radius; + } + + public void setRadius(double radius) { + this.radius = radius; + } + + private double calculateArea() { + return radius * radius * Math.PI; + } + + public String toString() { + return "The area of the circle [radius = " + radius + "]: " + calculateArea(); + } +} diff --git a/core-java/src/main/java/com/baeldung/area/circle/CircleArea.java b/core-java/src/main/java/com/baeldung/area/circle/CircleArea.java new file mode 100644 index 0000000000..4d78637af6 --- /dev/null +++ b/core-java/src/main/java/com/baeldung/area/circle/CircleArea.java @@ -0,0 +1,36 @@ +package com.baeldung.area.circle; + +import java.util.InputMismatchException; +import java.util.Scanner; + +public class CircleArea { + + public static void main(String[] args) { + if (args.length > 0) { + try { + double radius = Double.parseDouble(args[0]); + calculateArea(radius); + } catch (NumberFormatException nfe) { + System.out.println("Invalid value for radius"); + System.exit(0); + } + } + + try (Scanner scanner = new Scanner(System.in)) { + System.out.println("Please enter radius value: "); + double radius = scanner.nextDouble(); + calculateArea(radius); + } catch (InputMismatchException e) { + System.out.println("Invalid value for radius"); + System.exit(0); + } + + Circle circle = new Circle(7); + System.out.println(circle); + } + + private static void calculateArea(double radius) { + double area = radius * radius * Math.PI; + System.out.println("The area of the circle [radius = " + radius + "]: " + area); + } +} diff --git a/core-java/src/main/java/com/baeldung/basicsyntax/SimpleAddition.java b/core-java/src/main/java/com/baeldung/basicsyntax/SimpleAddition.java new file mode 100644 index 0000000000..20a13178cc --- /dev/null +++ b/core-java/src/main/java/com/baeldung/basicsyntax/SimpleAddition.java @@ -0,0 +1,11 @@ +package com.baeldung.basicsyntax; + +public class SimpleAddition { + + public static void main(String[] args) { + int a = 10; + int b = 5; + double c = a + b; + System.out.println( a + " + " + b + " = " + c); + } +} diff --git a/core-java/src/main/java/com/baeldung/encoding/CharacterEncodingExamples.java b/core-java/src/main/java/com/baeldung/encoding/CharacterEncodingExamples.java new file mode 100644 index 0000000000..bdd92e37f6 --- /dev/null +++ b/core-java/src/main/java/com/baeldung/encoding/CharacterEncodingExamples.java @@ -0,0 +1,32 @@ +package com.baeldung.encoding; + +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.io.InputStreamReader; +import java.io.UnsupportedEncodingException; + +public class CharacterEncodingExamples { + + static String readFile(String filePath, String encoding) throws IOException { + File file = new File(filePath); + StringBuffer buffer = new StringBuffer(); + try (InputStreamReader isr = new InputStreamReader(new FileInputStream(file), encoding)) { + int data; + while ((data = isr.read()) != -1) { + buffer.append((char) data); + } + } + return buffer.toString(); + } + + static String convertToBinary(String input, String encoding) throws UnsupportedEncodingException { + byte[] bytes = input.getBytes(encoding); + StringBuffer buffer = new StringBuffer(); + for (int b : bytes) { + buffer.append(Integer.toBinaryString((b + 256) % 256)); + buffer.append(" "); + } + return buffer.toString(); + } +} diff --git a/core-java/src/main/java/com/baeldung/graph/Graph.java b/core-java/src/main/java/com/baeldung/graph/Graph.java new file mode 100644 index 0000000000..43b5c0aa08 --- /dev/null +++ b/core-java/src/main/java/com/baeldung/graph/Graph.java @@ -0,0 +1,76 @@ +package com.baeldung.graph; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +public class Graph { + private Map> adjVertices; + + Graph() { + this.adjVertices = new HashMap>(); + } + + void addVertex(String label) { + adjVertices.putIfAbsent(new Vertex(label), new ArrayList<>()); + } + + void removeVertex(String label) { + Vertex v = new Vertex(label); + adjVertices.values().stream().map(e -> e.remove(v)).collect(Collectors.toList()); + adjVertices.remove(new Vertex(label)); + } + + void addEdge(String label1, String label2) { + Vertex v1 = new Vertex(label1); + Vertex v2 = new Vertex(label2); + adjVertices.get(v1).add(v2); + adjVertices.get(v2).add(v1); + } + + void removeEdge(String label1, String label2) { + Vertex v1 = new Vertex(label1); + Vertex v2 = new Vertex(label2); + List eV1 = adjVertices.get(v1); + List eV2 = adjVertices.get(v2); + if (eV1 != null) + eV1.remove(v2); + if (eV2 != null) + eV2.remove(v1); + } + + List getAdjVertices(String label) { + return adjVertices.get(new Vertex(label)); + } + + String printGraph() { + StringBuffer sb = new StringBuffer(); + for(Vertex v : adjVertices.keySet()) { + sb.append(v); + sb.append(adjVertices.get(v)); + } + return sb.toString(); + } + + class Vertex { + String label; + Vertex(String label) { + this.label = label; + } + @Override + public boolean equals(Object obj) { + Vertex vertex = (Vertex) obj; + return vertex.label == label; + } + @Override + public int hashCode() { + return label.hashCode(); + } + @Override + public String toString() { + return label; + } + } +} \ No newline at end of file diff --git a/core-java/src/main/java/com/baeldung/graph/GraphTraversal.java b/core-java/src/main/java/com/baeldung/graph/GraphTraversal.java new file mode 100644 index 0000000000..479e653a5c --- /dev/null +++ b/core-java/src/main/java/com/baeldung/graph/GraphTraversal.java @@ -0,0 +1,44 @@ +package com.baeldung.graph; + +import java.util.LinkedHashSet; +import java.util.LinkedList; +import java.util.Queue; +import java.util.Set; +import java.util.Stack; + +import com.baeldung.graph.Graph.Vertex; + +public class GraphTraversal { + static Set depthFirstTraversal(Graph graph, String root) { + Set visited = new LinkedHashSet(); + Stack stack = new Stack(); + stack.push(root); + while (!stack.isEmpty()) { + String vertex = stack.pop(); + if (!visited.contains(vertex)) { + visited.add(vertex); + for (Vertex v : graph.getAdjVertices(vertex)) { + stack.push(v.label); + } + } + } + return visited; + } + + static Set breadthFirstTraversal(Graph graph, String root) { + Set visited = new LinkedHashSet(); + Queue queue = new LinkedList(); + queue.add(root); + visited.add(root); + while (!queue.isEmpty()) { + String vertex = queue.poll(); + for (Vertex v : graph.getAdjVertices(vertex)) { + if (!visited.contains(v.label)) { + visited.add(v.label); + queue.add(v.label); + } + } + } + return visited; + } +} \ No newline at end of file diff --git a/core-java/src/main/java/com/baeldung/printf/PrintfExamples.java b/core-java/src/main/java/com/baeldung/printf/PrintfExamples.java new file mode 100644 index 0000000000..3d451f6f50 --- /dev/null +++ b/core-java/src/main/java/com/baeldung/printf/PrintfExamples.java @@ -0,0 +1,61 @@ +package com.baeldung.printf; + +import java.util.Date; +import java.util.Locale; + +public class PrintfExamples { + + public static void main(String[] args) { + + printfNewLine(); + printfChar(); + printfString(); + printfNumber(); + printfDateTime(); + printfBoolean(); + } + + private static void printfNewLine() { + System.out.printf("baeldung%nline%nterminator"); + } + + private static void printfString() { + System.out.printf("'%s' %n", "baeldung"); + System.out.printf("'%S' %n", "baeldung"); + System.out.printf("'%15s' %n", "baeldung"); + System.out.printf("'%-10s' %n", "baeldung"); + } + + private static void printfChar() { + System.out.printf("%c%n", 's'); + System.out.printf("%C%n", 's'); + } + + private static void printfNumber() { + System.out.printf("simple integer: %d%n", 10000L); + + System.out.printf(Locale.US, "%,d %n", 10000); + System.out.printf(Locale.ITALY, "%,d %n", 10000); + + System.out.printf("%f%n", 5.1473); + System.out.printf("'%5.2f'%n", 5.1473); + System.out.printf("'%5.2e'%n", 5.1473); + } + + private static void printfBoolean() { + System.out.printf("%b%n", null); + System.out.printf("%B%n", false); + System.out.printf("%B%n", 5.3); + System.out.printf("%b%n", "random text"); + } + + private static void printfDateTime() { + Date date = new Date(); + System.out.printf("%tT%n", date); + System.out.printf("hours %tH: minutes %tM: seconds %tS%n", date, date, date); + System.out.printf("%1$tH:%1$tM:%1$tS %1$tp %1$tL %1$tN %1$tz %n", date); + + System.out.printf("%1$tA %1$tB %1$tY %n", date); + System.out.printf("%1$td.%1$tm.%1$ty %n", date); + } +} diff --git a/core-java/src/main/java/com/baeldung/ssl/example/SimpleClient.java b/core-java/src/main/java/com/baeldung/ssl/example/SimpleClient.java new file mode 100644 index 0000000000..d6efc34c3e --- /dev/null +++ b/core-java/src/main/java/com/baeldung/ssl/example/SimpleClient.java @@ -0,0 +1,33 @@ +package com.baeldung.ssl.example; + +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStreamReader; +import java.net.Socket; + +import javax.net.SocketFactory; +import javax.net.ssl.SSLSocket; +import javax.net.ssl.SSLSocketFactory; +import javax.net.ssl.SSLParameters; + +public class SimpleClient { + static String startClient(String host, int port) throws IOException { + SocketFactory factory = SSLSocketFactory.getDefault(); + + try (Socket connection = factory.createSocket(host, port)) { + ((SSLSocket) connection).setEnabledCipherSuites( + new String[] { "TLS_DHE_DSS_WITH_AES_256_CBC_SHA256"}); + ((SSLSocket) connection).setEnabledProtocols( + new String[] { "TLSv1.2"}); + SSLParameters sslParams = new SSLParameters(); + sslParams.setEndpointIdentificationAlgorithm("HTTPS"); + ((SSLSocket) connection).setSSLParameters(sslParams); + BufferedReader input = new BufferedReader(new InputStreamReader(connection.getInputStream())); + return input.readLine(); + } + } + + public static void main(String[] args) throws IOException { + System.out.println(startClient("localhost", 8443)); + } +} diff --git a/core-java/src/main/java/com/baeldung/ssl/example/SimpleServer.java b/core-java/src/main/java/com/baeldung/ssl/example/SimpleServer.java new file mode 100644 index 0000000000..27d15d04d7 --- /dev/null +++ b/core-java/src/main/java/com/baeldung/ssl/example/SimpleServer.java @@ -0,0 +1,34 @@ +package com.baeldung.ssl.example; + +import java.io.IOException; +import java.io.PrintWriter; +import java.net.ServerSocket; +import java.net.Socket; + +import javax.net.ServerSocketFactory; +import javax.net.ssl.SSLServerSocket; +import javax.net.ssl.SSLServerSocketFactory; + +public class SimpleServer { + static void startServer(int port) throws IOException { + ServerSocketFactory factory = SSLServerSocketFactory.getDefault(); + + try (ServerSocket listener = factory.createServerSocket(port)) { + ((SSLServerSocket) listener).setNeedClientAuth(true); + ((SSLServerSocket) listener).setEnabledCipherSuites( + new String[] { "TLS_DHE_DSS_WITH_AES_256_CBC_SHA256"}); + ((SSLServerSocket) listener).setEnabledProtocols( + new String[] { "TLSv1.2"}); + while (true) { + try (Socket socket = listener.accept()) { + PrintWriter out = new PrintWriter(socket.getOutputStream(), true); + out.println("Hello World!"); + } + } + } + } + + public static void main(String[] args) throws IOException { + startServer(8443); + } +} \ No newline at end of file diff --git a/core-java/src/main/java/com/baeldung/string/DoubleToString.java b/core-java/src/main/java/com/baeldung/string/DoubleToString.java new file mode 100644 index 0000000000..d26d26f3df --- /dev/null +++ b/core-java/src/main/java/com/baeldung/string/DoubleToString.java @@ -0,0 +1,41 @@ +package com.baeldung.string; + +import java.math.RoundingMode; +import java.text.DecimalFormat; +import java.text.NumberFormat; + +public class DoubleToString { + + public static String truncateByCast(double d) { + return String.valueOf((int) d); + } + + public static String roundWithStringFormat(double d) { + return String.format("%.0f", d); + } + + public static String truncateWithNumberFormat(double d) { + NumberFormat nf = NumberFormat.getInstance(); + nf.setMaximumFractionDigits(0); + nf.setRoundingMode(RoundingMode.FLOOR); + return nf.format(d); + } + + public static String roundWithNumberFormat(double d) { + NumberFormat nf = NumberFormat.getInstance(); + nf.setMaximumFractionDigits(0); + return nf.format(d); + } + + public static String truncateWithDecimalFormat(double d) { + DecimalFormat df = new DecimalFormat("#,###"); + df.setRoundingMode(RoundingMode.FLOOR); + return df.format(d); + } + + public static String roundWithDecimalFormat(double d) { + DecimalFormat df = new DecimalFormat("#,###"); + return df.format(d); + } + +} diff --git a/core-java/src/main/java/org/baeldung/equalshashcode/entities/ComplexClass.java b/core-java/src/main/java/org/baeldung/equalshashcode/entities/ComplexClass.java deleted file mode 100644 index 6329f41252..0000000000 --- a/core-java/src/main/java/org/baeldung/equalshashcode/entities/ComplexClass.java +++ /dev/null @@ -1,63 +0,0 @@ -package org.baeldung.equalshashcode.entities; - -import java.util.List; -import java.util.Set; - -public class ComplexClass { - - private List genericList; - private Set integerSet; - - public ComplexClass(List genericArrayList, Set integerHashSet) { - super(); - this.genericList = genericArrayList; - this.integerSet = integerHashSet; - } - - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + ((genericList == null) ? 0 : genericList.hashCode()); - result = prime * result + ((integerSet == null) ? 0 : integerSet.hashCode()); - return result; - } - - @Override - public boolean equals(Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (!(obj instanceof ComplexClass)) - return false; - ComplexClass other = (ComplexClass) obj; - if (genericList == null) { - if (other.genericList != null) - return false; - } else if (!genericList.equals(other.genericList)) - return false; - if (integerSet == null) { - if (other.integerSet != null) - return false; - } else if (!integerSet.equals(other.integerSet)) - return false; - return true; - } - - protected List getGenericList() { - return genericList; - } - - protected void setGenericArrayList(List genericList) { - this.genericList = genericList; - } - - protected Set getIntegerSet() { - return integerSet; - } - - protected void setIntegerSet(Set integerSet) { - this.integerSet = integerSet; - } -} diff --git a/core-java/src/main/java/org/baeldung/equalshashcode/entities/PrimitiveClass.java b/core-java/src/main/java/org/baeldung/equalshashcode/entities/PrimitiveClass.java deleted file mode 100644 index ebe005688c..0000000000 --- a/core-java/src/main/java/org/baeldung/equalshashcode/entities/PrimitiveClass.java +++ /dev/null @@ -1,54 +0,0 @@ -package org.baeldung.equalshashcode.entities; - -public class PrimitiveClass { - - private boolean primitiveBoolean; - private int primitiveInt; - - public PrimitiveClass(boolean primitiveBoolean, int primitiveInt) { - super(); - this.primitiveBoolean = primitiveBoolean; - this.primitiveInt = primitiveInt; - } - - protected boolean isPrimitiveBoolean() { - return primitiveBoolean; - } - - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + (primitiveBoolean ? 1231 : 1237); - result = prime * result + primitiveInt; - return result; - } - - @Override - public boolean equals(Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (getClass() != obj.getClass()) - return false; - PrimitiveClass other = (PrimitiveClass) obj; - if (primitiveBoolean != other.primitiveBoolean) - return false; - if (primitiveInt != other.primitiveInt) - return false; - return true; - } - - protected void setPrimitiveBoolean(boolean primitiveBoolean) { - this.primitiveBoolean = primitiveBoolean; - } - - protected int getPrimitiveInt() { - return primitiveInt; - } - - protected void setPrimitiveInt(int primitiveInt) { - this.primitiveInt = primitiveInt; - } -} diff --git a/core-java/src/main/java/org/baeldung/equalshashcode/entities/Rectangle.java b/core-java/src/main/java/org/baeldung/equalshashcode/entities/Rectangle.java deleted file mode 100644 index 5e38eb6088..0000000000 --- a/core-java/src/main/java/org/baeldung/equalshashcode/entities/Rectangle.java +++ /dev/null @@ -1,58 +0,0 @@ -package org.baeldung.equalshashcode.entities; - -public class Rectangle extends Shape { - private double width; - private double length; - - Rectangle(double width, double length) { - this.width = width; - this.length = length; - } - - @Override - public double area() { - return width * length; - } - - @Override - public double perimeter() { - return 2 * (width + length); - } - - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - long temp; - temp = Double.doubleToLongBits(length); - result = prime * result + (int) (temp ^ (temp >>> 32)); - temp = Double.doubleToLongBits(width); - result = prime * result + (int) (temp ^ (temp >>> 32)); - return result; - } - - @Override - public boolean equals(Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (getClass() != obj.getClass()) - return false; - Rectangle other = (Rectangle) obj; - if (Double.doubleToLongBits(length) != Double.doubleToLongBits(other.length)) - return false; - if (Double.doubleToLongBits(width) != Double.doubleToLongBits(other.width)) - return false; - return true; - } - - protected double getWidth() { - return width; - } - - protected double getLength() { - return length; - } - -} \ No newline at end of file diff --git a/core-java/src/main/java/org/baeldung/equalshashcode/entities/Shape.java b/core-java/src/main/java/org/baeldung/equalshashcode/entities/Shape.java deleted file mode 100644 index 3bfc81da8f..0000000000 --- a/core-java/src/main/java/org/baeldung/equalshashcode/entities/Shape.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.baeldung.equalshashcode.entities; - -public abstract class Shape { - public abstract double area(); - - public abstract double perimeter(); -} diff --git a/core-java/src/main/java/org/baeldung/equalshashcode/entities/Square.java b/core-java/src/main/java/org/baeldung/equalshashcode/entities/Square.java deleted file mode 100644 index f11e34f0ba..0000000000 --- a/core-java/src/main/java/org/baeldung/equalshashcode/entities/Square.java +++ /dev/null @@ -1,58 +0,0 @@ -package org.baeldung.equalshashcode.entities; - -import java.awt.Color; - -public class Square extends Rectangle { - - Color color; - - public Square(double width, Color color) { - super(width, width); - this.color = color; - } - - /* (non-Javadoc) - * @see java.lang.Object#hashCode() - */ - @Override - public int hashCode() { - final int prime = 31; - int result = super.hashCode(); - result = prime * result + ((color == null) ? 0 : color.hashCode()); - return result; - } - - /* (non-Javadoc) - * @see java.lang.Object#equals(java.lang.Object) - */ - @Override - public boolean equals(Object obj) { - if (this == obj) { - return true; - } - if (!super.equals(obj)) { - return false; - } - if (!(obj instanceof Square)) { - return false; - } - Square other = (Square) obj; - if (color == null) { - if (other.color != null) { - return false; - } - } else if (!color.equals(other.color)) { - return false; - } - return true; - } - - protected Color getColor() { - return color; - } - - protected void setColor(Color color) { - this.color = color; - } - -} diff --git a/core-java/src/main/resources/files/test.txt b/core-java/src/main/resources/files/test.txt new file mode 100644 index 0000000000..08e53af69d --- /dev/null +++ b/core-java/src/main/resources/files/test.txt @@ -0,0 +1,10 @@ +This is line 1 +This is line 2 +This is line 3 +This is line 4 +This is line 5 +This is line 6 +This is line 7 +This is line 8 +This is line 9 +This is line 10 \ No newline at end of file diff --git a/core-java/src/test/java/com/baeldung/abstractclasses/test/LowercaseFileReaderUnitTest.java b/core-java/src/test/java/com/baeldung/abstractclasses/test/LowercaseFileReaderUnitTest.java new file mode 100644 index 0000000000..4f0d3a7cd5 --- /dev/null +++ b/core-java/src/test/java/com/baeldung/abstractclasses/test/LowercaseFileReaderUnitTest.java @@ -0,0 +1,20 @@ +package com.baeldung.abstractclasses.test; + +import com.baeldung.abstractclasses.filereaders.BaseFileReader; +import com.baeldung.abstractclasses.filereaders.LowercaseFileReader; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.util.List; +import static org.assertj.core.api.Assertions.assertThat; +import org.junit.Test; + +public class LowercaseFileReaderUnitTest { + + @Test + public void givenLowercaseFileReaderInstance_whenCalledreadFile_thenCorrect() throws Exception { + Path path = Paths.get(getClass().getClassLoader().getResource("files/test.txt").toURI()); + BaseFileReader lowercaseFileReader = new LowercaseFileReader(path); + + assertThat(lowercaseFileReader.readFile()).isInstanceOf(List.class); + } +} diff --git a/core-java/src/test/java/com/baeldung/abstractclasses/test/UppercaseFileReaderUnitTest.java b/core-java/src/test/java/com/baeldung/abstractclasses/test/UppercaseFileReaderUnitTest.java new file mode 100644 index 0000000000..e11db57000 --- /dev/null +++ b/core-java/src/test/java/com/baeldung/abstractclasses/test/UppercaseFileReaderUnitTest.java @@ -0,0 +1,20 @@ +package com.baeldung.abstractclasses.test; + +import com.baeldung.abstractclasses.filereaders.BaseFileReader; +import com.baeldung.abstractclasses.filereaders.UppercaseFileReader; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.util.List; +import static org.assertj.core.api.Assertions.assertThat; +import org.junit.Test; + +public class UppercaseFileReaderUnitTest { + + @Test + public void givenUppercaseFileReaderInstance_whenCalledreadFile_thenCorrect() throws Exception { + Path path = Paths.get(getClass().getClassLoader().getResource("files/test.txt").toURI()); + BaseFileReader uppercaseFileReader = new UppercaseFileReader(path); + + assertThat(uppercaseFileReader.readFile()).isInstanceOf(List.class); + } +} diff --git a/core-java/src/test/java/com/baeldung/encoding/CharacterEncodingExamplesUnitTest.java b/core-java/src/test/java/com/baeldung/encoding/CharacterEncodingExamplesUnitTest.java new file mode 100644 index 0000000000..95b3605d95 --- /dev/null +++ b/core-java/src/test/java/com/baeldung/encoding/CharacterEncodingExamplesUnitTest.java @@ -0,0 +1,61 @@ +package com.baeldung.encoding; + +import java.io.IOException; + +import org.junit.Assert; +import org.junit.Test; + +public class CharacterEncodingExamplesUnitTest { + + @Test + public void givenTextFile_whenCalledWithEncodingASCII_thenProduceIncorrectResult() throws IOException { + Assert.assertEquals( + CharacterEncodingExamples.readFile( + "src/test/resources/encoding.txt", "US-ASCII"), + "The fa��ade pattern is a software-design pattern commonly used with object-oriented programming."); + } + + @Test + public void givenTextFile_whenCalledWithEncodingUTF8_thenProduceCorrectResult() throws IOException { + Assert.assertEquals( + CharacterEncodingExamples.readFile( + "src/test/resources/encoding.txt", "UTF-8"), + "The façade pattern is a software-design pattern commonly used with object-oriented programming."); + } + + @Test + public void givenCharacterA_whenConvertedtoBinaryWithEncodingASCII_thenProduceResult() throws IOException { + Assert.assertEquals( + CharacterEncodingExamples.convertToBinary("A", "US-ASCII"), + "1000001 "); + } + + @Test + public void givenCharacterA_whenConvertedtoBinaryWithEncodingUTF8_thenProduceResult() throws IOException { + Assert.assertEquals( + CharacterEncodingExamples.convertToBinary("A", "UTF-8"), + "1000001 "); + } + + @Test + public void givenCharacterCh_whenConvertedtoBinaryWithEncodingBig5_thenProduceResult() throws IOException { + Assert.assertEquals( + CharacterEncodingExamples.convertToBinary("語", "Big5"), + "10111011 1111001 "); + } + + @Test + public void givenCharacterCh_whenConvertedtoBinaryWithEncodingUTF8_thenProduceResult() throws IOException { + Assert.assertEquals( + CharacterEncodingExamples.convertToBinary("語", "UTF-8"), + "11101000 10101010 10011110 "); + } + + @Test + public void givenCharacterCh_whenConvertedtoBinaryWithEncodingUTF32_thenProduceResult() throws IOException { + Assert.assertEquals( + CharacterEncodingExamples.convertToBinary("語", "UTF-32"), + "0 0 10001010 10011110 "); + } + +} diff --git a/core-java/src/test/java/com/baeldung/graph/GraphTraversalUnitTest.java b/core-java/src/test/java/com/baeldung/graph/GraphTraversalUnitTest.java new file mode 100644 index 0000000000..d955d56d95 --- /dev/null +++ b/core-java/src/test/java/com/baeldung/graph/GraphTraversalUnitTest.java @@ -0,0 +1,36 @@ +package com.baeldung.graph; + +import org.junit.Assert; +import org.junit.Test; + +public class GraphTraversalUnitTest { + @Test + public void givenAGraph_whenTraversingDepthFirst_thenExpectedResult() { + Graph graph = createGraph(); + Assert.assertEquals("[Bob, Rob, Maria, Alice, Mark]", + GraphTraversal.depthFirstTraversal(graph, "Bob").toString()); + } + + @Test + public void givenAGraph_whenTraversingBreadthFirst_thenExpectedResult() { + Graph graph = createGraph(); + Assert.assertEquals("[Bob, Alice, Rob, Mark, Maria]", + GraphTraversal.breadthFirstTraversal(graph, "Bob").toString()); + } + + Graph createGraph() { + Graph graph = new Graph(); + graph.addVertex("Bob"); + graph.addVertex("Alice"); + graph.addVertex("Mark"); + graph.addVertex("Rob"); + graph.addVertex("Maria"); + graph.addEdge("Bob", "Alice"); + graph.addEdge("Bob", "Rob"); + graph.addEdge("Alice", "Mark"); + graph.addEdge("Rob", "Mark"); + graph.addEdge("Alice", "Maria"); + graph.addEdge("Rob", "Maria"); + return graph; + } +} \ No newline at end of file diff --git a/core-java/src/test/java/com/baeldung/java/math/MathUnitTest.java b/core-java/src/test/java/com/baeldung/java/math/MathUnitTest.java new file mode 100644 index 0000000000..6d1872f05f --- /dev/null +++ b/core-java/src/test/java/com/baeldung/java/math/MathUnitTest.java @@ -0,0 +1,175 @@ +package com.baeldung.java.math; + +import org.junit.Test; + +import static org.junit.Assert.assertEquals; + +public class MathUnitTest { + + @Test + public void whenAbsInteger_thenReturnAbsoluteValue() { + assertEquals(5,Math.abs(-5)); + } + + @Test + public void whenMaxBetweenTwoValue_thenReturnMaximum() { + assertEquals(10, Math.max(5,10)); + } + + @Test + public void whenMinBetweenTwoValue_thenReturnMinimum() { + assertEquals(5, Math.min(5,10)); + } + + @Test + public void whenSignumWithNegativeNumber_thenReturnMinusOne() { + assertEquals(-1, Math.signum(-5), 0); + } + + @Test + public void whenCopySignWithNegativeSign_thenReturnNegativeArgument() { + assertEquals(-5, Math.copySign(5,-1), 0); + } + + @Test + public void whenPow_thenReturnPoweredValue() { + assertEquals(25, Math.pow(5,2),0); + } + + @Test + public void whenSqrt_thenReturnSquareRoot() { + assertEquals(5, Math.sqrt(25),0); + } + + @Test + public void whenCbrt_thenReturnCubeRoot() { + assertEquals(5, Math.cbrt(125),0); + } + + @Test + public void whenExp_thenReturnEulerNumberRaised() { + assertEquals(2.718, Math.exp(1),0.1); + } + + @Test + public void whenExpm1_thenReturnEulerNumberMinusOne() { + assertEquals(1.718, Math.expm1(1),0.1); + } + + @Test + public void whenGetExponent_thenReturnUnbiasedExponent() { + assertEquals(8, Math.getExponent(333.3),0); + assertEquals(7, Math.getExponent(222.2f),0); + } + + @Test + public void whenLog_thenReturnValue() { + assertEquals(1, Math.log(Math.E),0); + } + + @Test + public void whenLog10_thenReturnValue() { + assertEquals(1, Math.log10(10),0); + } + + @Test + public void whenLog1p_thenReturnValue() { + assertEquals(1.31, Math.log1p(Math.E),0.1); + } + + @Test + public void whenSin_thenReturnValue() { + assertEquals(1, Math.sin(Math.PI/2),0); + } + + @Test + public void whenCos_thenReturnValue() { + assertEquals(1, Math.cos(0),0); + } + + @Test + public void whenTan_thenReturnValue() { + assertEquals(1, Math.tan(Math.PI/4),0.1); + } + + @Test + public void whenAsin_thenReturnValue() { + assertEquals(Math.PI/2, Math.asin(1),0); + } + + @Test + public void whenAcos_thenReturnValue() { + assertEquals(Math.PI/2, Math.acos(0),0); + } + + @Test + public void whenAtan_thenReturnValue() { + assertEquals(Math.PI/4, Math.atan(1),0); + } + + @Test + public void whenAtan2_thenReturnValue() { + assertEquals(Math.PI/4, Math.atan2(1,1),0); + } + + @Test + public void whenToDegrees_thenReturnValue() { + assertEquals(180, Math.toDegrees(Math.PI),0); + } + + @Test + public void whenToRadians_thenReturnValue() { + assertEquals(Math.PI, Math.toRadians(180),0); + } + + @Test + public void whenCeil_thenReturnValue() { + assertEquals(4, Math.ceil(Math.PI),0); + } + + @Test + public void whenFloor_thenReturnValue() { + assertEquals(3, Math.floor(Math.PI),0); + } + + @Test + public void whenGetExponent_thenReturnValue() { + assertEquals(8, Math.getExponent(333.3),0); + } + + @Test + public void whenIEEERemainder_thenReturnValue() { + assertEquals(1.0, Math.IEEEremainder(5,2),0); + } + + @Test + public void whenNextAfter_thenReturnValue() { + assertEquals(1.9499999284744263, Math.nextAfter(1.95f,1),0.0000001); + } + + @Test + public void whenNextUp_thenReturnValue() { + assertEquals(1.9500002, Math.nextUp(1.95f),0.0000001); + } + + @Test + public void whenRint_thenReturnValue() { + assertEquals(2.0, Math.rint(1.95f),0.0); + } + + @Test + public void whenRound_thenReturnValue() { + assertEquals(2.0, Math.round(1.95f),0.0); + } + + @Test + public void whenScalb_thenReturnValue() { + assertEquals(48, Math.scalb(3, 4),0.0); + } + + @Test + public void whenHypot_thenReturnValue() { + assertEquals(5, Math.hypot(4, 3),0.0); + } + +} diff --git a/core-java/src/test/java/com/baeldung/java/properties/PropertiesUnitTest.java b/core-java/src/test/java/com/baeldung/java/properties/PropertiesUnitTest.java new file mode 100644 index 0000000000..b669947d9c --- /dev/null +++ b/core-java/src/test/java/com/baeldung/java/properties/PropertiesUnitTest.java @@ -0,0 +1,171 @@ +package com.baeldung.java.properties; + +import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNull; + +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.FileWriter; +import java.io.IOException; +import java.util.Enumeration; +import java.util.Properties; + +import org.junit.Test; + +public class PropertiesUnitTest { + + @Test + public void givenPropertyValue_whenPropertiesFileLoaded_thenCorrect() throws IOException { + + String rootPath = Thread.currentThread().getContextClassLoader().getResource("").getPath(); + String appConfigPath = rootPath + "app.properties"; + String catalogConfigPath = rootPath + "catalog"; + + Properties appProps = new Properties(); + appProps.load(new FileInputStream(appConfigPath)); + + Properties catalogProps = new Properties(); + catalogProps.load(new FileInputStream(catalogConfigPath)); + + String appVersion = appProps.getProperty("version"); + assertEquals("1.0", appVersion); + + assertEquals("files", catalogProps.getProperty("c1")); + } + + @Test + public void givenPropertyValue_whenXMLPropertiesFileLoaded_thenCorrect() throws IOException { + + String rootPath = Thread.currentThread().getContextClassLoader().getResource("").getPath(); + String iconConfigPath = rootPath + "icons.xml"; + Properties iconProps = new Properties(); + iconProps.loadFromXML(new FileInputStream(iconConfigPath)); + + assertEquals("icon1.jpg", iconProps.getProperty("fileIcon")); + } + + @Test + public void givenAbsentProperty_whenPropertiesFileLoaded_thenReturnsDefault() throws IOException { + + String rootPath = Thread.currentThread().getContextClassLoader().getResource("").getPath(); + String appConfigPath = rootPath + "app.properties"; + Properties appProps = new Properties(); + appProps.load(new FileInputStream(appConfigPath)); + + String appVersion = appProps.getProperty("version"); + String appName = appProps.getProperty("name", "defaultName"); + String appGroup = appProps.getProperty("group", "baeldung"); + String appDownloadAddr = appProps.getProperty("downloadAddr"); + + assertEquals("1.0", appVersion); + assertEquals("TestApp", appName); + assertEquals("baeldung", appGroup); + assertNull(appDownloadAddr); + } + + @Test(expected = Exception.class) + public void givenImproperObjectCasting_whenPropertiesFileLoaded_thenThrowsException() throws IOException { + + String rootPath = Thread.currentThread().getContextClassLoader().getResource("").getPath(); + String appConfigPath = rootPath + "app.properties"; + Properties appProps = new Properties(); + appProps.load(new FileInputStream(appConfigPath)); + + float appVerFloat = (float) appProps.get("version"); + } + + @Test + public void givenPropertyValue_whenPropertiesSet_thenCorrect() throws IOException { + + String rootPath = Thread.currentThread().getContextClassLoader().getResource("").getPath(); + String appConfigPath = rootPath + "app.properties"; + Properties appProps = new Properties(); + appProps.load(new FileInputStream(appConfigPath)); + + appProps.setProperty("name", "NewAppName"); + appProps.setProperty("downloadAddr", "www.baeldung.com/downloads"); + + String newAppName = appProps.getProperty("name"); + assertEquals("NewAppName", newAppName); + + String newAppDownloadAddr = appProps.getProperty("downloadAddr"); + assertEquals("www.baeldung.com/downloads", newAppDownloadAddr); + } + + @Test + public void givenPropertyValueNull_whenPropertiesRemoved_thenCorrect() throws IOException { + + String rootPath = Thread.currentThread().getContextClassLoader().getResource("").getPath(); + String appConfigPath = rootPath + "app.properties"; + Properties appProps = new Properties(); + appProps.load(new FileInputStream(appConfigPath)); + + String versionBeforeRemoval = appProps.getProperty("version"); + assertEquals("1.0", versionBeforeRemoval); + + appProps.remove("version"); + String versionAfterRemoval = appProps.getProperty("version"); + assertNull(versionAfterRemoval); + } + + @Test + public void whenPropertiesStoredInFile_thenCorrect() throws IOException { + + String rootPath = Thread.currentThread().getContextClassLoader().getResource("").getPath(); + String appConfigPath = rootPath + "app.properties"; + Properties appProps = new Properties(); + appProps.load(new FileInputStream(appConfigPath)); + + String newAppConfigPropertiesFile = rootPath + "newApp.properties"; + appProps.store(new FileWriter(newAppConfigPropertiesFile), "store to properties file"); + + String newAppConfigXmlFile = rootPath + "newApp.xml"; + appProps.storeToXML(new FileOutputStream(newAppConfigXmlFile), "store to xml file"); + } + + @Test + public void givenPropertyValueAbsent_LoadsValuesFromDefaultProperties() throws IOException { + + String rootPath = Thread.currentThread().getContextClassLoader().getResource("").getPath(); + + String defaultConfigPath = rootPath + "default.properties"; + Properties defaultProps = new Properties(); + defaultProps.load(new FileInputStream(defaultConfigPath)); + + String appConfigPath = rootPath + "app.properties"; + Properties appProps = new Properties(defaultProps); + appProps.load(new FileInputStream(appConfigPath)); + + String appName = appProps.getProperty("name"); + String appVersion = appProps.getProperty("version"); + String defaultSite = appProps.getProperty("site"); + + assertEquals("1.0", appVersion); + assertEquals("TestApp", appName); + assertEquals("www.google.com", defaultSite); + } + + @Test + public void givenPropertiesSize_whenPropertyFileLoaded_thenCorrect() throws IOException { + + String rootPath = Thread.currentThread().getContextClassLoader().getResource("").getPath(); + String appPropsPath = rootPath + "app.properties"; + Properties appProps = new Properties(); + appProps.load(new FileInputStream(appPropsPath)); + + appProps.list(System.out); // list all key-value pairs + + Enumeration valueEnumeration = appProps.elements(); + while (valueEnumeration.hasMoreElements()) { + System.out.println(valueEnumeration.nextElement()); + } + + Enumeration keyEnumeration = appProps.keys(); + while (keyEnumeration.hasMoreElements()) { + System.out.println(keyEnumeration.nextElement()); + } + + int size = appProps.size(); + assertEquals(3, size); + } +} diff --git a/core-java/src/test/java/com/baeldung/java/reflection/operations/MoreOperationsUnitTest.java b/core-java/src/test/java/com/baeldung/java/reflection/operations/MoreOperationsUnitTest.java deleted file mode 100644 index 2fe0a54664..0000000000 --- a/core-java/src/test/java/com/baeldung/java/reflection/operations/MoreOperationsUnitTest.java +++ /dev/null @@ -1,38 +0,0 @@ -package com.baeldung.java.reflection.operations; - -import com.baeldung.java.reflection.*; -import static org.hamcrest.CoreMatchers.equalTo; - -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; - -import org.junit.Test; -import static org.junit.Assert.assertThat; - -public class MoreOperationsUnitTest { - - public MoreOperationsUnitTest() { - } - - @Test(expected = IllegalAccessException.class) - public void givenObject_whenInvokeProtectedMethod_thenFail() throws NoSuchMethodException, IllegalAccessException, IllegalArgumentException, InvocationTargetException { - Method maxProtectedMethod = Operations.class.getDeclaredMethod("protectedMax", int.class, int.class); - - Operations operationsInstance = new Operations(); - Integer result = (Integer) maxProtectedMethod.invoke(operationsInstance, 2, 4); - - assertThat(result, equalTo(4)); - } - - @Test - public void givenObject_whenInvokeProtectedMethod_thenCorrect() throws Exception { - Method maxProtectedMethod = Operations.class.getDeclaredMethod("protectedMax", int.class, int.class); - maxProtectedMethod.setAccessible(true); - - Operations operationsInstance = new Operations(); - Integer result = (Integer) maxProtectedMethod.invoke(operationsInstance, 2, 4); - - assertThat(result, equalTo(4)); - } - -} diff --git a/core-java/src/test/java/com/baeldung/nth/root/calculator/NthRootCalculatorUnitTest.java b/core-java/src/test/java/com/baeldung/nth/root/calculator/NthRootCalculatorUnitTest.java index 286dffb56a..ab962fc150 100644 --- a/core-java/src/test/java/com/baeldung/nth/root/calculator/NthRootCalculatorUnitTest.java +++ b/core-java/src/test/java/com/baeldung/nth/root/calculator/NthRootCalculatorUnitTest.java @@ -7,14 +7,12 @@ import org.junit.runner.RunWith; import org.mockito.InjectMocks; import org.mockito.junit.MockitoJUnitRunner; -@RunWith(MockitoJUnitRunner.class) public class NthRootCalculatorUnitTest { - @InjectMocks - private NthRootCalculator nthRootCalculator; + private NthRootCalculator nthRootCalculator = new NthRootCalculator(); @Test - public void giventThatTheBaseIs125_andTheExpIs3_whenCalculateIsCalled_thenTheResultIsTheCorrectOne() { + public void whenBaseIs125AndNIs3_thenNthRootIs5() { Double result = nthRootCalculator.calculate(125.0, 3.0); assertEquals(result, (Double) 5.0d); } diff --git a/core-java/src/test/java/com/baeldung/properties/MergePropertiesUnitTest.java b/core-java/src/test/java/com/baeldung/properties/MergePropertiesUnitTest.java new file mode 100644 index 0000000000..8720aff36b --- /dev/null +++ b/core-java/src/test/java/com/baeldung/properties/MergePropertiesUnitTest.java @@ -0,0 +1,84 @@ +package com.baeldung.properties; + +import static org.hamcrest.CoreMatchers.equalTo; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertThat; + +import java.util.Map; +import java.util.Properties; +import java.util.Set; +import java.util.stream.Stream; + +import org.junit.Test; + +public class MergePropertiesUnitTest { + + @Test + public void givenTwoProperties_whenMergedUsingIteration_thenAllPropertiesInResult() { + Properties globalProperties = mergePropertiesByIteratingKeySet(propertiesA(), propertiesB()); + + testMergedProperties(globalProperties); + } + + @Test + public void givenTwoProperties_whenMergedUsingPutAll_thenAllPropertiesInResult() { + Properties globalProperties = mergePropertiesByUsingPutAll(propertiesA(), propertiesB()); + + testMergedProperties(globalProperties); + } + + @Test + public void givenTwoProperties_whenMergedUsingStreamAPI_thenAllPropertiesInResult() { + Properties globalProperties = mergePropertiesByUsingStreamApi(propertiesB(), propertiesA()); + + testMergedProperties(globalProperties); + } + + private Properties mergePropertiesByIteratingKeySet(Properties... properties) { + Properties mergedProperties = new Properties(); + for (Properties property : properties) { + Set propertyNames = property.stringPropertyNames(); + for (String name : propertyNames) { + String propertyValue = property.getProperty(name); + mergedProperties.setProperty(name, propertyValue); + } + } + return mergedProperties; + } + + private Properties mergePropertiesByUsingPutAll(Properties... properties) { + Properties mergedProperties = new Properties(); + for (Properties property : properties) { + mergedProperties.putAll(property); + } + return mergedProperties; + } + + private Properties mergePropertiesByUsingStreamApi(Properties... properties) { + return Stream.of(properties) + .collect(Properties::new, Map::putAll, Map::putAll); + } + + private Properties propertiesA() { + Properties properties = new Properties(); + properties.setProperty("application.name", "my-app"); + properties.setProperty("application.version", "1.0"); + return properties; + } + + private Properties propertiesB() { + Properties properties = new Properties(); + properties.setProperty("property-1", "sample property"); + properties.setProperty("property-2", "another sample property"); + return properties; + } + + private void testMergedProperties(Properties globalProperties) { + assertThat("There should be 4 properties", globalProperties.size(), equalTo(4)); + assertEquals("Property should be", globalProperties.getProperty("application.name"), "my-app"); + assertEquals("Property should be", globalProperties.getProperty("application.version"), "1.0"); + assertEquals("Property should be", globalProperties.getProperty("property-1"), "sample property"); + assertEquals("Property should be", globalProperties.getProperty("property-2"), "another sample property"); + } + +} diff --git a/core-java/src/test/java/com/baeldung/regexp/optmization/OptimizedMatcherUnitTest.java b/core-java/src/test/java/com/baeldung/regexp/optmization/OptimizedMatcherManualTest.java similarity index 65% rename from core-java/src/test/java/com/baeldung/regexp/optmization/OptimizedMatcherUnitTest.java rename to core-java/src/test/java/com/baeldung/regexp/optmization/OptimizedMatcherManualTest.java index f21a755b01..f44968a5a7 100644 --- a/core-java/src/test/java/com/baeldung/regexp/optmization/OptimizedMatcherUnitTest.java +++ b/core-java/src/test/java/com/baeldung/regexp/optmization/OptimizedMatcherManualTest.java @@ -1,6 +1,5 @@ package com.baeldung.regexp.optmization; -import org.junit.After; import org.junit.Before; import org.junit.Test; @@ -12,15 +11,17 @@ import java.util.regex.Pattern; import static org.junit.Assert.assertTrue; -public class OptimizedMatcherUnitTest { - - private long time; - private long mstimePreCompiled; - private long mstimeNotPreCompiled; +public class OptimizedMatcherManualTest { private String action; private List items; + + private class TimeWrapper { + private long time; + private long mstimePreCompiled; + private long mstimeNotPreCompiled; + } @Before public void setup() { @@ -48,27 +49,27 @@ public class OptimizedMatcherUnitTest { @Test public void givenANotPreCompiledAndAPreCompiledPatternA_whenMatcheItems_thenPreCompiledFasterThanNotPreCompiled() { - - testPatterns("A*"); - assertTrue(mstimePreCompiled < mstimeNotPreCompiled); + TimeWrapper timeObj = new TimeWrapper(); + testPatterns("A*", timeObj); + assertTrue(timeObj.mstimePreCompiled < timeObj.mstimeNotPreCompiled); } @Test public void givenANotPreCompiledAndAPreCompiledPatternABC_whenMatcheItems_thenPreCompiledFasterThanNotPreCompiled() { - - testPatterns("A*B*C*"); - assertTrue(mstimePreCompiled < mstimeNotPreCompiled); + TimeWrapper timeObj = new TimeWrapper(); + testPatterns("A*B*C*", timeObj); + assertTrue(timeObj.mstimePreCompiled < timeObj.mstimeNotPreCompiled); } @Test public void givenANotPreCompiledAndAPreCompiledPatternECWF_whenMatcheItems_thenPreCompiledFasterThanNotPreCompiled() { - - testPatterns("E*C*W*F*"); - assertTrue(mstimePreCompiled < mstimeNotPreCompiled); + TimeWrapper timeObj = new TimeWrapper(); + testPatterns("E*C*W*F*", timeObj); + assertTrue(timeObj.mstimePreCompiled < timeObj.mstimeNotPreCompiled); } - private void testPatterns(String regex) { - time = System.nanoTime(); + private void testPatterns(String regex, TimeWrapper timeObj) { + timeObj.time = System.nanoTime(); int matched = 0; int unmatched = 0; @@ -83,10 +84,10 @@ public class OptimizedMatcherUnitTest { this.action = "uncompiled: regex=" + regex + " matched=" + matched + " unmatched=" + unmatched; - this.mstimeNotPreCompiled = (System.nanoTime() - time) / 1000000; - System.out.println(this.action + ": " + mstimeNotPreCompiled + "ms"); + timeObj.mstimeNotPreCompiled = (System.nanoTime() - timeObj.time) / 1000000; + System.out.println(this.action + ": " + timeObj.mstimeNotPreCompiled + "ms"); - time = System.nanoTime(); + timeObj.time = System.nanoTime(); Matcher matcher = Pattern.compile(regex).matcher(""); matched = 0; @@ -103,7 +104,7 @@ public class OptimizedMatcherUnitTest { this.action = "compiled: regex=" + regex + " matched=" + matched + " unmatched=" + unmatched; - this.mstimePreCompiled = (System.nanoTime() - time) / 1000000; - System.out.println(this.action + ": " + mstimePreCompiled + "ms"); + timeObj.mstimePreCompiled = (System.nanoTime() - timeObj.time) / 1000000; + System.out.println(this.action + ": " + timeObj.mstimePreCompiled + "ms"); } } diff --git a/core-java/src/test/java/com/baeldung/simpledateformat/SimpleDateFormatUnitTest.java b/core-java/src/test/java/com/baeldung/simpledateformat/SimpleDateFormatUnitTest.java new file mode 100644 index 0000000000..7e1fcd9b3d --- /dev/null +++ b/core-java/src/test/java/com/baeldung/simpledateformat/SimpleDateFormatUnitTest.java @@ -0,0 +1,60 @@ +package com.baeldung.simpledateformat; + +import org.junit.Test; + +import java.text.DateFormat; +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.Locale; +import java.util.TimeZone; +import java.util.logging.Logger; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + + +public class SimpleDateFormatUnitTest { + + private static final Logger logger = Logger.getLogger(SimpleDateFormatUnitTest.class.getName()); + + @Test + public void givenSpecificDate_whenFormatted_thenCheckFormatCorrect() throws Exception { + SimpleDateFormat formatter = new SimpleDateFormat("dd-MM-yyyy"); + assertEquals("24-05-1977", formatter.format(new Date(233345223232L))); + } + + @Test + public void givenSpecificDate_whenFormattedUsingDateFormat_thenCheckFormatCorrect() throws Exception { + DateFormat formatter = DateFormat.getDateInstance(DateFormat.SHORT, Locale.US); + assertEquals("5/24/77", formatter.format(new Date(233345223232L))); + } + + @Test + public void givenStringDate_whenParsed_thenCheckDateCorrect() throws Exception{ + SimpleDateFormat formatter = new SimpleDateFormat("dd-MM-yyyy"); + formatter.setTimeZone(TimeZone.getTimeZone("Europe/London")); + Date myDate = new Date(233276400000L); + Date parsedDate = formatter.parse("24-05-1977"); + assertEquals(myDate.getTime(), parsedDate.getTime()); + } + + @Test + public void givenFranceLocale_whenFormatted_thenCheckFormatCorrect() throws Exception{ + SimpleDateFormat franceDateFormatter = new SimpleDateFormat("EEEEE dd-MMMMMMM-yyyy", Locale.FRANCE); + Date myWednesday = new Date(1539341312904L); + assertTrue(franceDateFormatter.format(myWednesday).startsWith("vendredi")); + } + + @Test + public void given2TimeZones_whenFormatted_thenCheckTimeDifference() throws Exception { + Date now = new Date(); + + SimpleDateFormat simpleDateFormat = new SimpleDateFormat("EEEE dd-MMM-yy HH:mm:ssZ"); + + simpleDateFormat.setTimeZone(TimeZone.getTimeZone("Europe/London")); + logger.info(simpleDateFormat.format(now)); + //change the date format + simpleDateFormat.setTimeZone(TimeZone.getTimeZone("America/New_York")); + logger.info(simpleDateFormat.format(now)); + } +} diff --git a/core-java/src/test/java/com/baeldung/string/DoubleToStringUnitTest.java b/core-java/src/test/java/com/baeldung/string/DoubleToStringUnitTest.java new file mode 100644 index 0000000000..5212d7aa1a --- /dev/null +++ b/core-java/src/test/java/com/baeldung/string/DoubleToStringUnitTest.java @@ -0,0 +1,45 @@ +package com.baeldung.string; + +import static org.assertj.core.api.Assertions.assertThat; + +import org.junit.Test; + +public class DoubleToStringUnitTest { + + private static final double DOUBLE_VALUE = 3.56; + private static final String TRUNCATED_DOUBLE = "3"; + private static final String ROUNDED_UP_DOUBLE = "4"; + + + @Test + public void truncateByCastTest() { + assertThat(DoubleToString.truncateByCast(DOUBLE_VALUE)).isEqualTo(TRUNCATED_DOUBLE); + } + + @Test + public void roundingWithStringFormatTest() { + assertThat(DoubleToString.roundWithStringFormat(DOUBLE_VALUE)).isEqualTo(ROUNDED_UP_DOUBLE); + } + + @Test + public void truncateWithNumberFormatTest() { + assertThat(DoubleToString.truncateWithNumberFormat(DOUBLE_VALUE)).isEqualTo(TRUNCATED_DOUBLE); + } + + @Test + public void roundWithNumberFormatTest() { + assertThat(DoubleToString.roundWithNumberFormat(DOUBLE_VALUE)).isEqualTo(ROUNDED_UP_DOUBLE); + } + + @Test + public void truncateWithDecimalFormatTest() { + assertThat(DoubleToString.truncateWithDecimalFormat(DOUBLE_VALUE)).isEqualTo(TRUNCATED_DOUBLE); + } + + @Test + public void roundWithDecimalFormatTest() { + assertThat(DoubleToString.roundWithDecimalFormat(DOUBLE_VALUE)).isEqualTo(ROUNDED_UP_DOUBLE); + } + + +} diff --git a/core-java/src/test/java/com/baeldung/string/StringReplaceAndRemoveUnitTest.java b/core-java/src/test/java/com/baeldung/string/StringReplaceAndRemoveUnitTest.java new file mode 100644 index 0000000000..d952d2383b --- /dev/null +++ b/core-java/src/test/java/com/baeldung/string/StringReplaceAndRemoveUnitTest.java @@ -0,0 +1,83 @@ +package com.baeldung.string; + + +import org.apache.commons.lang3.StringUtils; +import org.junit.Test; + +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + +public class StringReplaceAndRemoveUnitTest { + + + @Test + public void givenTestStrings_whenReplace_thenProcessedString() { + + String master = "Hello World Baeldung!"; + String target = "Baeldung"; + String replacement = "Java"; + String processed = master.replace(target, replacement); + assertTrue(processed.contains(replacement)); + assertFalse(processed.contains(target)); + + } + + @Test + public void givenTestStrings_whenReplaceAll_thenProcessedString() { + + String master2 = "Welcome to Baeldung, Hello World Baeldung"; + String regexTarget= "(Baeldung)$"; + String replacement = "Java"; + String processed2 = master2.replaceAll(regexTarget, replacement); + assertTrue(processed2.endsWith("Java")); + + } + + @Test + public void givenTestStrings_whenStringBuilderMethods_thenProcessedString() { + + String master = "Hello World Baeldung!"; + String target = "Baeldung"; + String replacement = "Java"; + + int startIndex = master.indexOf(target); + int stopIndex = startIndex + target.length(); + + StringBuilder builder = new StringBuilder(master); + + + builder.delete(startIndex, stopIndex); + assertFalse(builder.toString().contains(target)); + + + builder.replace(startIndex, stopIndex, replacement); + assertTrue(builder.toString().contains(replacement)); + + + } + + + @Test + public void givenTestStrings_whenStringUtilsMethods_thenProcessedStrings() { + + String master = "Hello World Baeldung!"; + String target = "Baeldung"; + String replacement = "Java"; + + String processed = StringUtils.replace(master, target, replacement); + assertTrue(processed.contains(replacement)); + + String master2 = "Hello World Baeldung!"; + String target2 = "baeldung"; + String processed2 = StringUtils.replaceIgnoreCase(master2, target2, replacement); + assertFalse(processed2.contains(target)); + + } + + + + + + + +} diff --git a/core-java/src/test/resources/app.properties b/core-java/src/test/resources/app.properties new file mode 100644 index 0000000000..ff6174ec2a --- /dev/null +++ b/core-java/src/test/resources/app.properties @@ -0,0 +1,3 @@ +version=1.0 +name=TestApp +date=2016-11-12 \ No newline at end of file diff --git a/core-java/src/test/resources/catalog b/core-java/src/test/resources/catalog new file mode 100644 index 0000000000..488513d0ce --- /dev/null +++ b/core-java/src/test/resources/catalog @@ -0,0 +1,3 @@ +c1=files +c2=images +c3=videos \ No newline at end of file diff --git a/core-java/src/test/resources/default.properties b/core-java/src/test/resources/default.properties new file mode 100644 index 0000000000..df1bab371c --- /dev/null +++ b/core-java/src/test/resources/default.properties @@ -0,0 +1,4 @@ +site=www.google.com +name=DefaultAppName +topic=Properties +category=core-java \ No newline at end of file diff --git a/core-java/src/test/resources/encoding.txt b/core-java/src/test/resources/encoding.txt new file mode 100644 index 0000000000..e1cf027df0 --- /dev/null +++ b/core-java/src/test/resources/encoding.txt @@ -0,0 +1 @@ +The façade pattern is a software-design pattern commonly used with object-oriented programming. \ No newline at end of file diff --git a/core-java/src/test/resources/icons.xml b/core-java/src/test/resources/icons.xml new file mode 100644 index 0000000000..0db7b2699a --- /dev/null +++ b/core-java/src/test/resources/icons.xml @@ -0,0 +1,8 @@ + + + + xml example + icon1.jpg + icon2.jpg + icon3.jpg + \ No newline at end of file diff --git a/core-kotlin/README.md b/core-kotlin/README.md index 523f5b6e78..828293ec90 100644 --- a/core-kotlin/README.md +++ b/core-kotlin/README.md @@ -39,3 +39,12 @@ - [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) +- [Threads vs Coroutines in Kotlin](https://www.baeldung.com/kotlin-threads-coroutines) +- [Guide to Kotlin Interfaces](https://www.baeldung.com/kotlin-interfaces) +- [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) diff --git a/core-kotlin/pom.xml b/core-kotlin/pom.xml index 0894a57320..ed79ebc01b 100644 --- a/core-kotlin/pom.xml +++ b/core-kotlin/pom.xml @@ -3,6 +3,7 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 core-kotlin + core-kotlin jar @@ -18,6 +19,11 @@ commons-math3 ${commons-math3.version} + + org.apache.commons + commons-lang3 + ${commons-lang3.version} + org.junit.platform junit-platform-runner @@ -61,10 +67,16 @@ 3.3.0 pom + + uy.kohesive.injekt + injekt-core + 1.16.1 + 3.6.1 + 3.8.1 1.1.1 5.2.0 3.10.0 diff --git a/core-kotlin/src/main/kotlin/com/baeldung/datamapping/User.kt b/core-kotlin/src/main/kotlin/com/baeldung/datamapping/User.kt new file mode 100644 index 0000000000..fdbf95f7ba --- /dev/null +++ b/core-kotlin/src/main/kotlin/com/baeldung/datamapping/User.kt @@ -0,0 +1,10 @@ +package com.baeldung.datamapping + +data class User( + val firstName: String, + val lastName: String, + val street: String, + val houseNumber: String, + val phone: String, + val age: Int, + val password: String) \ No newline at end of file diff --git a/core-kotlin/src/main/kotlin/com/baeldung/datamapping/UserExtensions.kt b/core-kotlin/src/main/kotlin/com/baeldung/datamapping/UserExtensions.kt new file mode 100644 index 0000000000..6113ed3591 --- /dev/null +++ b/core-kotlin/src/main/kotlin/com/baeldung/datamapping/UserExtensions.kt @@ -0,0 +1,22 @@ +package com.baeldung.datamapping + +import kotlin.reflect.full.memberProperties + +fun User.toUserView() = UserView( + name = "$firstName $lastName", + address = "$street $houseNumber", + telephone = phone, + age = age +) + +fun User.toUserViewReflection() = with(::UserView) { + val propertiesByName = User::class.memberProperties.associateBy { it.name } + callBy(parameters.associate { parameter -> + parameter to when (parameter.name) { + UserView::name.name -> "$firstName $lastName" + UserView::address.name -> "$street $houseNumber" + UserView::telephone.name -> phone + else -> propertiesByName[parameter.name]?.get(this@toUserViewReflection) + } + }) +} \ No newline at end of file diff --git a/core-kotlin/src/main/kotlin/com/baeldung/datamapping/UserView.kt b/core-kotlin/src/main/kotlin/com/baeldung/datamapping/UserView.kt new file mode 100644 index 0000000000..e1b6de6b57 --- /dev/null +++ b/core-kotlin/src/main/kotlin/com/baeldung/datamapping/UserView.kt @@ -0,0 +1,8 @@ +package com.baeldung.datamapping + +data class UserView( + val name: String, + val address: String, + val telephone: String, + val age: Int +) \ No newline at end of file diff --git a/core-kotlin/src/main/kotlin/com/baeldung/functions/Inline.kt b/core-kotlin/src/main/kotlin/com/baeldung/functions/Inline.kt new file mode 100644 index 0000000000..239c425c03 --- /dev/null +++ b/core-kotlin/src/main/kotlin/com/baeldung/functions/Inline.kt @@ -0,0 +1,28 @@ +package com.baeldung.functions + +import kotlin.random.Random + +/** + * An extension function on all collections to apply a function to all collection + * elements. + */ +fun Collection.each(block: (T) -> Unit) { + for (e in this) block(e) +} + +/** + * In order to see the the JVM bytecode: + * 1. Compile the Kotlin file using `kotlinc Inline.kt` + * 2. Take a peek at the bytecode using the `javap -c InlineKt` + */ +fun main() { + val numbers = listOf(1, 2, 3, 4, 5) + val random = random() + + numbers.each { println(random * it) } // capturing the random variable +} + +/** + * Generates a random number. + */ +private fun random(): Int = Random.nextInt() \ No newline at end of file diff --git a/core-kotlin/src/main/kotlin/com/baeldung/generic/Reified.kt b/core-kotlin/src/main/kotlin/com/baeldung/generic/Reified.kt new file mode 100644 index 0000000000..37a632fe41 --- /dev/null +++ b/core-kotlin/src/main/kotlin/com/baeldung/generic/Reified.kt @@ -0,0 +1,6 @@ +inline fun Iterable<*>.filterIsInstance() = filter { it is T } + +fun main(args: Array) { + val set = setOf("1984", 2, 3, "Brave new world", 11) + println(set.filterIsInstance()) +} \ No newline at end of file diff --git a/core-kotlin/src/main/kotlin/com/baeldung/injekt/DelegateInjectionApplication.kt b/core-kotlin/src/main/kotlin/com/baeldung/injekt/DelegateInjectionApplication.kt new file mode 100644 index 0000000000..fb9beda621 --- /dev/null +++ b/core-kotlin/src/main/kotlin/com/baeldung/injekt/DelegateInjectionApplication.kt @@ -0,0 +1,60 @@ +package com.baeldung.injekt + +import org.slf4j.LoggerFactory +import uy.kohesive.injekt.* +import uy.kohesive.injekt.api.* +import java.util.* + +class DelegateInjectionApplication { + companion object : InjektMain() { + private val LOG = LoggerFactory.getLogger(DelegateInjectionApplication::class.java) + @JvmStatic fun main(args: Array) { + DelegateInjectionApplication().run() + } + + override fun InjektRegistrar.registerInjectables() { + addFactory { + val value = FactoryInstance("Factory" + UUID.randomUUID().toString()) + LOG.info("Constructing instance: {}", value) + value + } + + addSingletonFactory { + val value = SingletonInstance("Singleton" + UUID.randomUUID().toString()) + LOG.info("Constructing singleton instance: {}", value) + value + } + + addSingletonFactory { App() } + } + } + + data class FactoryInstance(val value: String) + data class SingletonInstance(val value: String) + + class App { + private val instance: FactoryInstance by injectValue() + private val lazyInstance: FactoryInstance by injectLazy() + private val singleton: SingletonInstance by injectValue() + private val lazySingleton: SingletonInstance by injectLazy() + + fun run() { + for (i in 1..5) { + LOG.info("Instance {}: {}", i, instance) + } + for (i in 1..5) { + LOG.info("Lazy Instance {}: {}", i, lazyInstance) + } + for (i in 1..5) { + LOG.info("Singleton {}: {}", i, singleton) + } + for (i in 1..5) { + LOG.info("Lazy Singleton {}: {}", i, lazySingleton) + } + } + } + + fun run() { + Injekt.get().run() + } +} diff --git a/core-kotlin/src/main/kotlin/com/baeldung/injekt/KeyedApplication.kt b/core-kotlin/src/main/kotlin/com/baeldung/injekt/KeyedApplication.kt new file mode 100644 index 0000000000..744459b7fe --- /dev/null +++ b/core-kotlin/src/main/kotlin/com/baeldung/injekt/KeyedApplication.kt @@ -0,0 +1,37 @@ +package com.baeldung.injekt + +import org.slf4j.LoggerFactory +import uy.kohesive.injekt.* +import uy.kohesive.injekt.api.* + +class KeyedApplication { + companion object : InjektMain() { + private val LOG = LoggerFactory.getLogger(KeyedApplication::class.java) + @JvmStatic fun main(args: Array) { + KeyedApplication().run() + } + + override fun InjektRegistrar.registerInjectables() { + val configs = mapOf( + "google" to Config("googleClientId", "googleClientSecret"), + "twitter" to Config("twitterClientId", "twitterClientSecret") + ) + addPerKeyFactory {key -> configs[key]!! } + + addSingletonFactory { App() } + } + } + + data class Config(val clientId: String, val clientSecret: String) + + class App { + fun run() { + LOG.info("Google config: {}", Injekt.get("google")) + LOG.info("Twitter config: {}", Injekt.get("twitter")) + } + } + + fun run() { + Injekt.get().run() + } +} diff --git a/core-kotlin/src/main/kotlin/com/baeldung/injekt/ModularApplication.kt b/core-kotlin/src/main/kotlin/com/baeldung/injekt/ModularApplication.kt new file mode 100644 index 0000000000..e802f3f6d5 --- /dev/null +++ b/core-kotlin/src/main/kotlin/com/baeldung/injekt/ModularApplication.kt @@ -0,0 +1,46 @@ +package com.baeldung.injekt + +import org.slf4j.LoggerFactory +import uy.kohesive.injekt.* +import uy.kohesive.injekt.api.* + +class ModularApplication { + class ConfigModule(private val port: Int) : InjektModule { + override fun InjektRegistrar.registerInjectables() { + addSingleton(Config(port)) + } + } + + object ServerModule : InjektModule { + override fun InjektRegistrar.registerInjectables() { + addSingletonFactory { Server(Injekt.get()) } + } + } + + companion object : InjektMain() { + private val LOG = LoggerFactory.getLogger(Server::class.java) + @JvmStatic fun main(args: Array) { + ModularApplication().run() + } + + override fun InjektRegistrar.registerInjectables() { + importModule(ConfigModule(12345)) + importModule(ServerModule) + } + } + + data class Config( + val port: Int + ) + + class Server(private val config: Config) { + + fun start() { + LOG.info("Starting server on ${config.port}") + } + } + + fun run() { + Injekt.get().start() + } +} diff --git a/core-kotlin/src/main/kotlin/com/baeldung/injekt/PerThreadApplication.kt b/core-kotlin/src/main/kotlin/com/baeldung/injekt/PerThreadApplication.kt new file mode 100644 index 0000000000..a42f314349 --- /dev/null +++ b/core-kotlin/src/main/kotlin/com/baeldung/injekt/PerThreadApplication.kt @@ -0,0 +1,48 @@ +package com.baeldung.injekt + +import org.slf4j.LoggerFactory +import uy.kohesive.injekt.* +import uy.kohesive.injekt.api.* +import java.util.* +import java.util.concurrent.Executors +import java.util.concurrent.TimeUnit + +class PerThreadApplication { + companion object : InjektMain() { + private val LOG = LoggerFactory.getLogger(PerThreadApplication::class.java) + @JvmStatic fun main(args: Array) { + PerThreadApplication().run() + } + + override fun InjektRegistrar.registerInjectables() { + addPerThreadFactory { + val value = FactoryInstance(UUID.randomUUID().toString()) + LOG.info("Constructing instance: {}", value) + value + } + + addSingletonFactory { App() } + } + } + + data class FactoryInstance(val value: String) + + class App { + fun run() { + val threadPool = Executors.newFixedThreadPool(5) + + for (i in 1..20) { + threadPool.submit { + val instance = Injekt.get() + LOG.info("Value for thread {}: {}", Thread.currentThread().id, instance) + TimeUnit.MILLISECONDS.sleep(100) + } + } + threadPool.awaitTermination(10, TimeUnit.SECONDS) + } + } + + fun run() { + Injekt.get().run() + } +} diff --git a/core-kotlin/src/main/kotlin/com/baeldung/injekt/SimpleApplication.kt b/core-kotlin/src/main/kotlin/com/baeldung/injekt/SimpleApplication.kt new file mode 100644 index 0000000000..2b07cd059f --- /dev/null +++ b/core-kotlin/src/main/kotlin/com/baeldung/injekt/SimpleApplication.kt @@ -0,0 +1,34 @@ +package com.baeldung.injekt + +import org.slf4j.LoggerFactory +import uy.kohesive.injekt.* +import uy.kohesive.injekt.api.* + +class SimpleApplication { + companion object : InjektMain() { + private val LOG = LoggerFactory.getLogger(Server::class.java) + @JvmStatic fun main(args: Array) { + SimpleApplication().run() + } + + override fun InjektRegistrar.registerInjectables() { + addSingleton(Config(12345)) + addSingletonFactory { Server(Injekt.get()) } + } + } + + data class Config( + val port: Int + ) + + class Server(private val config: Config) { + + fun start() { + LOG.info("Starting server on ${config.port}") + } + } + + fun run() { + Injekt.get().start() + } +} diff --git a/core-kotlin/src/main/kotlin/com/baeldung/interfaces/ConflictingInterfaces.kt b/core-kotlin/src/main/kotlin/com/baeldung/interfaces/ConflictingInterfaces.kt new file mode 100644 index 0000000000..630afbdae7 --- /dev/null +++ b/core-kotlin/src/main/kotlin/com/baeldung/interfaces/ConflictingInterfaces.kt @@ -0,0 +1,23 @@ +package com.baeldung.interfaces + +interface BaseInterface { + fun someMethod(): String +} + +interface FirstChildInterface : BaseInterface { + override fun someMethod(): String { + return("Hello, from someMethod in FirstChildInterface") + } +} + +interface SecondChildInterface : BaseInterface { + override fun someMethod(): String { + return("Hello, from someMethod in SecondChildInterface") + } +} + +class ChildClass : FirstChildInterface, SecondChildInterface { + override fun someMethod(): String { + return super.someMethod() + } +} \ No newline at end of file diff --git a/core-kotlin/src/main/kotlin/com/baeldung/interfaces/InterfaceDelegation.kt b/core-kotlin/src/main/kotlin/com/baeldung/interfaces/InterfaceDelegation.kt new file mode 100644 index 0000000000..591fde0689 --- /dev/null +++ b/core-kotlin/src/main/kotlin/com/baeldung/interfaces/InterfaceDelegation.kt @@ -0,0 +1,13 @@ +package com.baeldung.interfaces + +interface MyInterface { + fun someMethod(): String +} + +class MyClass() : MyInterface { + override fun someMethod(): String { + return("Hello, World!") + } +} + +class MyDerivedClass(myInterface: MyInterface) : MyInterface by myInterface \ No newline at end of file diff --git a/core-kotlin/src/main/kotlin/com/baeldung/interfaces/MultipleInterfaces.kt b/core-kotlin/src/main/kotlin/com/baeldung/interfaces/MultipleInterfaces.kt new file mode 100644 index 0000000000..105a85cbb3 --- /dev/null +++ b/core-kotlin/src/main/kotlin/com/baeldung/interfaces/MultipleInterfaces.kt @@ -0,0 +1,29 @@ +package com.baeldung.interfaces + +interface FirstInterface { + fun someMethod(): String + + fun anotherMethod(): String { + return("Hello, from anotherMethod in FirstInterface") + } +} + +interface SecondInterface { + fun someMethod(): String { + return("Hello, from someMethod in SecondInterface") + } + + fun anotherMethod(): String { + return("Hello, from anotherMethod in SecondInterface") + } +} + +class SomeClass: FirstInterface, SecondInterface { + override fun someMethod(): String { + return("Hello, from someMethod in SomeClass") + } + + override fun anotherMethod(): String { + return("Hello, from anotherMethod in SomeClass") + } +} \ No newline at end of file diff --git a/core-kotlin/src/main/kotlin/com/baeldung/interfaces/SimpleInterface.kt b/core-kotlin/src/main/kotlin/com/baeldung/interfaces/SimpleInterface.kt new file mode 100644 index 0000000000..0758549dde --- /dev/null +++ b/core-kotlin/src/main/kotlin/com/baeldung/interfaces/SimpleInterface.kt @@ -0,0 +1,24 @@ +package com.baeldung.interfaces + +interface SimpleInterface { + val firstProp: String + val secondProp: String + get() = "Second Property" + fun firstMethod(): String + fun secondMethod(): String { + println("Hello, from: " + secondProp) + return "" + } +} + +class SimpleClass: SimpleInterface { + override val firstProp: String = "First Property" + override val secondProp: String + get() = "Second Property, Overridden!" + override fun firstMethod(): String { + return("Hello, from: " + firstProp) + } + override fun secondMethod(): String { + return("Hello, from: " + secondProp + firstProp) + } +} \ No newline at end of file diff --git a/core-kotlin/src/main/kotlin/com/baeldung/operators/Money.kt b/core-kotlin/src/main/kotlin/com/baeldung/operators/Money.kt new file mode 100644 index 0000000000..93eb78c5b6 --- /dev/null +++ b/core-kotlin/src/main/kotlin/com/baeldung/operators/Money.kt @@ -0,0 +1,31 @@ +package com.baeldung.operators + +import java.math.BigDecimal + +enum class Currency { + DOLLARS, EURO +} + +class Money(val amount: BigDecimal, val currency: Currency) : Comparable { + + override fun compareTo(other: Money): Int = + convert(Currency.DOLLARS).compareTo(other.convert(Currency.DOLLARS)) + + fun convert(currency: Currency): BigDecimal = TODO() + + override fun equals(other: Any?): Boolean { + if (this === other) return true + if (other !is Money) return false + + if (amount != other.amount) return false + if (currency != other.currency) return false + + return true + } + + override fun hashCode(): Int { + var result = amount.hashCode() + result = 31 * result + currency.hashCode() + return result + } +} \ No newline at end of file diff --git a/core-kotlin/src/main/kotlin/com/baeldung/operators/Page.kt b/core-kotlin/src/main/kotlin/com/baeldung/operators/Page.kt new file mode 100644 index 0000000000..1077eb94f9 --- /dev/null +++ b/core-kotlin/src/main/kotlin/com/baeldung/operators/Page.kt @@ -0,0 +1,16 @@ +package com.baeldung.operators + +interface Page { + fun pageNumber(): Int + fun pageSize(): Int + fun elements(): MutableList +} + +operator fun Page.get(index: Int): T = elements()[index] +operator fun Page.get(start: Int, endExclusive: Int): List = elements().subList(start, endExclusive) +operator fun Page.set(index: Int, value: T) { + elements()[index] = value +} + +operator fun Page.contains(element: T): Boolean = element in elements() +operator fun Page.iterator() = elements().iterator() \ No newline at end of file diff --git a/core-kotlin/src/main/kotlin/com/baeldung/operators/Point.kt b/core-kotlin/src/main/kotlin/com/baeldung/operators/Point.kt new file mode 100644 index 0000000000..e3282e64cc --- /dev/null +++ b/core-kotlin/src/main/kotlin/com/baeldung/operators/Point.kt @@ -0,0 +1,31 @@ +package com.baeldung.operators + +data class Point(val x: Int, val y: Int) + +operator fun Point.unaryMinus() = Point(-x, -y) +operator fun Point.not() = Point(y, x) +operator fun Point.inc() = Point(x + 1, y + 1) +operator fun Point.dec() = Point(x - 1, y - 1) + +operator fun Point.plus(other: Point): Point = Point(x + other.x, y + other.y) +operator fun Point.minus(other: Point): Point = Point(x - other.x, y - other.y) +operator fun Point.times(other: Point): Point = Point(x * other.x, y * other.y) +operator fun Point.div(other: Point): Point = Point(x / other.x, y / other.y) +operator fun Point.rem(other: Point): Point = Point(x % other.x, y % other.y) +operator fun Point.times(factor: Int): Point = Point(x * factor, y * factor) +operator fun Int.times(point: Point): Point = Point(point.x * this, point.y * this) + +class Shape { + val points = mutableListOf() + + operator fun Point.unaryPlus() { + points.add(this) + } +} + +fun shape(init: Shape.() -> Unit): Shape { + val shape = Shape() + shape.init() + + return shape +} \ No newline at end of file diff --git a/core-kotlin/src/main/kotlin/com/baeldung/operators/Utils.kt b/core-kotlin/src/main/kotlin/com/baeldung/operators/Utils.kt new file mode 100644 index 0000000000..0f16544f38 --- /dev/null +++ b/core-kotlin/src/main/kotlin/com/baeldung/operators/Utils.kt @@ -0,0 +1,8 @@ +package com.baeldung.operators + +import java.math.BigInteger + +operator fun MutableCollection.plusAssign(element: T) { + add(element) +} +operator fun BigInteger.plus(other: Int): BigInteger = add(BigInteger("$other")) \ No newline at end of file diff --git a/core-kotlin/src/main/kotlin/com/baeldung/sorting/SortingExample.kt b/core-kotlin/src/main/kotlin/com/baeldung/sorting/SortingExample.kt new file mode 100644 index 0000000000..2309d23c36 --- /dev/null +++ b/core-kotlin/src/main/kotlin/com/baeldung/sorting/SortingExample.kt @@ -0,0 +1,44 @@ +package com.baeldung.sorting + +import kotlin.comparisons.* + +fun sortMethodUsage() { + val sortedValues = mutableListOf(1, 2, 7, 6, 5, 6) + sortedValues.sort() + println(sortedValues) +} + +fun sortByMethodUsage() { + val sortedValues = mutableListOf(1 to "a", 2 to "b", 7 to "c", 6 to "d", 5 to "c", 6 to "e") + sortedValues.sortBy { it.second } + println(sortedValues) +} + +fun sortWithMethodUsage() { + val sortedValues = mutableListOf(1 to "a", 2 to "b", 7 to "c", 6 to "d", 5 to "c", 6 to "e") + sortedValues.sortWith(compareBy({it.second}, {it.first})) + println(sortedValues) +} + +fun > getSimpleComparator() : Comparator { + val ascComparator = naturalOrder() + return ascComparator +} + +fun getComplexComparator() { + val complexComparator = compareBy>({it.first}, {it.second}) +} + +fun nullHandlingUsage() { + val sortedValues = mutableListOf(1 to "a", 2 to null, 7 to "c", 6 to "d", 5 to "c", 6 to "e") + sortedValues.sortWith(nullsLast(compareBy { it.second })) + println(sortedValues) +} + +fun extendedComparatorUsage() { + val students = mutableListOf(21 to "Helen", 21 to "Tom", 20 to "Jim") + + val ageComparator = compareBy> {it.first} + val ageAndNameComparator = ageComparator.thenByDescending {it.second} + println(students.sortedWith(ageAndNameComparator)) +} \ No newline at end of file diff --git a/core-kotlin/src/main/kotlin/com/baeldung/thread/SimpleRunnable.kt b/core-kotlin/src/main/kotlin/com/baeldung/thread/SimpleRunnable.kt new file mode 100644 index 0000000000..7bc0528d06 --- /dev/null +++ b/core-kotlin/src/main/kotlin/com/baeldung/thread/SimpleRunnable.kt @@ -0,0 +1,8 @@ +package com.baeldung.thread + +class SimpleRunnable: Runnable { + + override fun run() { + println("${Thread.currentThread()} has run.") + } +} \ No newline at end of file diff --git a/core-kotlin/src/main/kotlin/com/baeldung/thread/SimpleThread.kt b/core-kotlin/src/main/kotlin/com/baeldung/thread/SimpleThread.kt new file mode 100644 index 0000000000..2b2827ae02 --- /dev/null +++ b/core-kotlin/src/main/kotlin/com/baeldung/thread/SimpleThread.kt @@ -0,0 +1,8 @@ +package com.baeldung.thread + +class SimpleThread: Thread() { + + override fun run() { + println("${Thread.currentThread()} has run.") + } +} \ No newline at end of file diff --git a/core-kotlin/src/test/kotlin/com/baeldung/datamapping/UserTest.kt b/core-kotlin/src/test/kotlin/com/baeldung/datamapping/UserTest.kt new file mode 100644 index 0000000000..44d350ea38 --- /dev/null +++ b/core-kotlin/src/test/kotlin/com/baeldung/datamapping/UserTest.kt @@ -0,0 +1,43 @@ +package com.baeldung.datamapping + +import org.junit.jupiter.api.Test +import org.junit.jupiter.api.assertAll +import kotlin.test.assertEquals + +class UserTest { + + @Test + fun `maps User to UserResponse using extension function`() { + val p = buildUser() + val view = p.toUserView() + assertUserView(view) + } + + @Test + fun `maps User to UserResponse using reflection`() { + val p = buildUser() + val view = p.toUserViewReflection() + assertUserView(view) + } + + private fun buildUser(): User { + return User( + "Java", + "Duke", + "Javastreet", + "42", + "1234567", + 30, + "s3cr37" + ) + } + + private fun assertUserView(pr: UserView) { + assertAll( + { assertEquals("Java Duke", pr.name) }, + { assertEquals("Javastreet 42", pr.address) }, + { assertEquals("1234567", pr.telephone) }, + { assertEquals(30, pr.age) } + ) + } +} \ No newline at end of file diff --git a/core-kotlin/src/test/kotlin/com/baeldung/filter/SliceTest.kt b/core-kotlin/src/test/kotlin/com/baeldung/filter/SliceTest.kt index dca167928d..793fe68427 100644 --- a/core-kotlin/src/test/kotlin/com/baeldung/filter/SliceTest.kt +++ b/core-kotlin/src/test/kotlin/com/baeldung/filter/SliceTest.kt @@ -24,14 +24,15 @@ internal class SliceTest { assertIterableEquals(expected, actual) } - @Test - fun whenSlicingBeyondTheRangeOfTheArray_thenContainManyNulls() { - val original = arrayOf(12, 3, 34, 4) - val actual = original.slice(3..8) - val expected = listOf(4, null, null, null, null, null) - - assertIterableEquals(expected, actual) - } +// From the 1.3 version of Kotlin APIs, slice doesn't return array of nulls but throw IndexOutOfBoundsException +// @Test +// fun whenSlicingBeyondTheRangeOfTheArray_thenContainManyNulls() { +// val original = arrayOf(12, 3, 34, 4) +// val actual = original.slice(3..8) +// val expected = listOf(4, null, null, null, null, null) +// +// assertIterableEquals(expected, actual) +// } @Test fun whenSlicingBeyondRangeOfArrayWithStep_thenOutOfBoundsException() { diff --git a/core-kotlin/src/test/kotlin/com/baeldung/fuel/FuelHttpUnitTest.kt b/core-kotlin/src/test/kotlin/com/baeldung/fuel/FuelHttpUnitTest.kt index f0f9267618..b7993c5f43 100644 --- a/core-kotlin/src/test/kotlin/com/baeldung/fuel/FuelHttpUnitTest.kt +++ b/core-kotlin/src/test/kotlin/com/baeldung/fuel/FuelHttpUnitTest.kt @@ -1,16 +1,12 @@ package com.baeldung.fuel -import awaitObjectResult -import awaitStringResponse import com.github.kittinunf.fuel.Fuel import com.github.kittinunf.fuel.core.FuelManager -import com.github.kittinunf.fuel.core.Request import com.github.kittinunf.fuel.core.interceptors.cUrlLoggingRequestInterceptor import com.github.kittinunf.fuel.gson.responseObject import com.github.kittinunf.fuel.httpGet import com.github.kittinunf.fuel.rx.rx_object import com.google.gson.Gson -import kotlinx.coroutines.experimental.runBlocking import org.junit.jupiter.api.Assertions import org.junit.jupiter.api.Test import java.io.File @@ -226,32 +222,26 @@ internal class FuelHttpUnitTest { } - @Test - fun whenMakeGETRequestUsingCoroutines_thenResponseStatusCode200() { - runBlocking { - val (request, response, result) = Fuel.get("http://httpbin.org/get").awaitStringResponse() +// The new 1.3 coroutine APIs, aren't implemented yet in Fuel Library +// @Test +// fun whenMakeGETRequestUsingCoroutines_thenResponseStatusCode200() = runBlocking { +// val (request, response, result) = Fuel.get("http://httpbin.org/get").awaitStringResponse() +// +// result.fold({ data -> +// Assertions.assertEquals(200, response.statusCode) +// +// }, { error -> }) +// } - result.fold({ data -> - Assertions.assertEquals(200, response.statusCode) - - }, { error -> }) - } - - } - - @Test - fun whenMakeGETRequestUsingCoroutines_thenDeserializeResponse() { - - - runBlocking { - Fuel.get("https://jsonplaceholder.typicode.com/posts?id=1").awaitObjectResult(Post.Deserializer()) - .fold({ data -> - Assertions.assertEquals(1, data.get(0).userId) - }, { error -> }) - } - - } +// The new 1.3 coroutine APIs, aren't implemented yet in Fuel Library +// @Test +// fun whenMakeGETRequestUsingCoroutines_thenDeserializeResponse() = runBlocking { +// Fuel.get("https://jsonplaceholder.typicode.com/posts?id=1").awaitObjectResult(Post.Deserializer()) +// .fold({ data -> +// Assertions.assertEquals(1, data.get(0).userId) +// }, { error -> }) +// } @Test fun whenMakeGETPostRequestUsingRoutingAPI_thenDeserializeResponse() { diff --git a/core-kotlin/src/test/kotlin/com/baeldung/interfaces/InterfaceExamplesUnitTest.kt b/core-kotlin/src/test/kotlin/com/baeldung/interfaces/InterfaceExamplesUnitTest.kt new file mode 100644 index 0000000000..96b99948b7 --- /dev/null +++ b/core-kotlin/src/test/kotlin/com/baeldung/interfaces/InterfaceExamplesUnitTest.kt @@ -0,0 +1,32 @@ +package com.baeldung.interfaces + +import org.junit.Test +import kotlin.test.assertEquals + +class InterfaceExamplesUnitTest { + @Test + fun givenAnInterface_whenImplemented_thenBehavesAsOverridden() { + val simpleClass = SimpleClass() + assertEquals("Hello, from: First Property", simpleClass.firstMethod()) + assertEquals("Hello, from: Second Property, Overridden!First Property", simpleClass.secondMethod()) + } + + @Test + fun givenMultipleInterfaces_whenImplemented_thenBehavesAsOverridden() { + val someClass = SomeClass() + assertEquals("Hello, from someMethod in SomeClass", someClass.someMethod()) + assertEquals("Hello, from anotherMethod in SomeClass", someClass.anotherMethod()) + } + + @Test + fun givenConflictingInterfaces_whenImplemented_thenBehavesAsOverridden() { + val childClass = ChildClass() + assertEquals("Hello, from someMethod in SecondChildInterface", childClass.someMethod()) + } + + @Test + fun givenAnInterface_whenImplemented_thenBehavesAsDelegated() { + val myClass = MyClass() + assertEquals("Hello, World!", MyDerivedClass(myClass).someMethod()) + } +} \ No newline at end of file diff --git a/core-kotlin/src/test/kotlin/com/baeldung/kotlin/ArrayInitializationTest.kt b/core-kotlin/src/test/kotlin/com/baeldung/kotlin/ArrayInitializationTest.kt new file mode 100644 index 0000000000..ba3694c831 --- /dev/null +++ b/core-kotlin/src/test/kotlin/com/baeldung/kotlin/ArrayInitializationTest.kt @@ -0,0 +1,49 @@ +package com.baeldung.kotlin + +import org.junit.Test +import kotlin.test.assertEquals + +class ArrayInitializationTest { + + @Test + fun givenArrayOfStrings_thenValuesPopulated() { + val strings = arrayOf("January", "February", "March") + + assertEquals(3, strings.size) + assertEquals("March", strings[2]) + } + + @Test + fun givenArrayOfIntegers_thenValuesPopulated() { + val integers = intArrayOf(1, 2, 3, 4) + + assertEquals(4, integers.size) + assertEquals(1, integers[0]) + } + + @Test + fun givenArrayOfNulls_whenPopulated_thenValuesPresent() { + val array = arrayOfNulls(5) + + for (i in array.indices) { + array[i] = i * i + } + + assertEquals(16, array[4]) + } + + @Test + fun whenGeneratorUsed_thenValuesPresent() { + val generatedArray = IntArray(10) { i -> i * i } + + assertEquals(81, generatedArray[9]) + } + + @Test + fun whenStringGenerated_thenValuesPresent() { + val generatedStringArray = Array(10) { i -> "Number of index: $i" } + + assertEquals("Number of index: 0", generatedStringArray[0]) + } + +} \ No newline at end of file diff --git a/core-kotlin/src/test/kotlin/com/baeldung/kotlin/CoroutinesUnitTest.kt b/core-kotlin/src/test/kotlin/com/baeldung/kotlin/CoroutinesUnitTest.kt index d724933654..324cf1109b 100644 --- a/core-kotlin/src/test/kotlin/com/baeldung/kotlin/CoroutinesUnitTest.kt +++ b/core-kotlin/src/test/kotlin/com/baeldung/kotlin/CoroutinesUnitTest.kt @@ -1,9 +1,8 @@ package com.baeldung.kotlin -import kotlinx.coroutines.experimental.* +import kotlinx.coroutines.* import org.junit.Test import java.util.concurrent.atomic.AtomicInteger -import kotlin.coroutines.experimental.buildSequence import kotlin.system.measureTimeMillis import kotlin.test.assertEquals import kotlin.test.assertTrue @@ -14,7 +13,7 @@ class CoroutinesTest { @Test fun givenBuildSequence_whenTakeNElements_thenShouldReturnItInALazyWay() { //given - val fibonacciSeq = buildSequence { + val fibonacciSeq = sequence { var a = 0 var b = 1 @@ -39,7 +38,7 @@ class CoroutinesTest { @Test fun givenLazySeq_whenTakeNElements_thenShouldReturnAllElements() { //given - val lazySeq = buildSequence { + val lazySeq = sequence { print("START ") for (i in 1..5) { yield(i) @@ -60,8 +59,8 @@ class CoroutinesTest { val res = mutableListOf() //when - runBlocking { - val promise = launch(CommonPool) { expensiveComputation(res) } + runBlocking { + val promise = launch(Dispatchers.Default) { expensiveComputation(res) } res.add("Hello,") promise.join() } @@ -85,7 +84,7 @@ class CoroutinesTest { //when val jobs = List(numberOfCoroutines) { - launch(CommonPool) { + launch(Dispatchers.Default) { delay(1L) counter.incrementAndGet() } @@ -101,7 +100,7 @@ class CoroutinesTest { fun givenCancellableJob_whenRequestForCancel_thenShouldQuit() { runBlocking { //given - val job = launch(CommonPool) { + val job = launch(Dispatchers.Default) { while (isActive) { //println("is working") } @@ -135,8 +134,8 @@ class CoroutinesTest { val delay = 1000L val time = measureTimeMillis { //given - val one = async(CommonPool) { someExpensiveComputation(delay) } - val two = async(CommonPool) { someExpensiveComputation(delay) } + val one = async(Dispatchers.Default) { someExpensiveComputation(delay) } + val two = async(Dispatchers.Default) { someExpensiveComputation(delay) } //when runBlocking { @@ -156,8 +155,8 @@ class CoroutinesTest { val delay = 1000L val time = measureTimeMillis { //given - val one = async(CommonPool, CoroutineStart.LAZY) { someExpensiveComputation(delay) } - val two = async(CommonPool, CoroutineStart.LAZY) { someExpensiveComputation(delay) } + val one = async(Dispatchers.Default, CoroutineStart.LAZY) { someExpensiveComputation(delay) } + val two = async(Dispatchers.Default, CoroutineStart.LAZY) { someExpensiveComputation(delay) } //when runBlocking { diff --git a/core-kotlin/src/test/kotlin/com/baeldung/operators/PageTest.kt b/core-kotlin/src/test/kotlin/com/baeldung/operators/PageTest.kt new file mode 100644 index 0000000000..4217fc0c08 --- /dev/null +++ b/core-kotlin/src/test/kotlin/com/baeldung/operators/PageTest.kt @@ -0,0 +1,28 @@ +package com.baeldung.operators + +import org.junit.Test +import kotlin.test.assertEquals +import kotlin.test.assertTrue + +class PageTest { + + private val page = PageImpl(1, 10, "Java", "Kotlin", "Scala") + + @Test + fun `Get convention should work as expected`() { + assertEquals(page[1], "Kotlin") + assertEquals(page[1, 3], listOf("Kotlin", "Scala")) + } + + @Test + fun `In convention should work on a page as expected`() { + assertTrue("Kotlin" in page) + } + +} + +private class PageImpl(val page: Int, val size: Int, vararg val elements: T) : Page { + override fun pageNumber(): Int = page + override fun pageSize(): Int = size + override fun elements(): MutableList = mutableListOf(*elements) +} \ No newline at end of file diff --git a/core-kotlin/src/test/kotlin/com/baeldung/operators/PointTest.kt b/core-kotlin/src/test/kotlin/com/baeldung/operators/PointTest.kt new file mode 100644 index 0000000000..168ab6431d --- /dev/null +++ b/core-kotlin/src/test/kotlin/com/baeldung/operators/PointTest.kt @@ -0,0 +1,48 @@ +package com.baeldung.operators + +import org.junit.Test +import kotlin.test.assertEquals +import kotlin.test.assertTrue + +class PointTest { + + private val p1 = Point(1, 2) + private val p2 = Point(2, 3) + + @Test + fun `We should be able to add two points together using +`() { + assertEquals(p1 + p2, Point(3, 5)) + } + + @Test + fun `We shoud be able to subtract one point from another using -`() { + assertEquals(p1 - p2, Point(-1, -1)) + } + + @Test + fun `We should be able to multiply two points together with *`() { + assertEquals(p1 * p2, Point(2, 6)) + } + + @Test + fun `We should be able to divide one point by another`() { + assertEquals(p1 / p2, Point(0, 0)) + } + + @Test + fun `We should be able to scale a point by an integral factor`() { + assertEquals(p1 * 2, Point(2, 4)) + assertEquals(2 * p1, Point(2, 4)) + } + + @Test + fun `We should be able to add points to an empty shape`() { + val line = shape { + +Point(0, 0) + +Point(1, 3) + } + + assertTrue(Point(0, 0) in line.points) + assertTrue(Point(1, 3) in line.points) + } +} \ No newline at end of file diff --git a/core-kotlin/src/test/kotlin/com/baeldung/operators/UtilsTest.kt b/core-kotlin/src/test/kotlin/com/baeldung/operators/UtilsTest.kt new file mode 100644 index 0000000000..4abe962cb5 --- /dev/null +++ b/core-kotlin/src/test/kotlin/com/baeldung/operators/UtilsTest.kt @@ -0,0 +1,13 @@ +package com.baeldung.operators + +import java.math.BigInteger +import org.junit.Test +import kotlin.test.assertEquals + +class UtilsTest { + + @Test + fun `We should be able to add an int value to an existing BigInteger using +`() { + assertEquals(BigInteger.ZERO + 1, BigInteger.ONE) + } +} \ No newline at end of file diff --git a/core-kotlin/src/test/kotlin/com/baeldung/random/RandomStringUnitTest.kt b/core-kotlin/src/test/kotlin/com/baeldung/random/RandomStringUnitTest.kt new file mode 100644 index 0000000000..62e8dfe720 --- /dev/null +++ b/core-kotlin/src/test/kotlin/com/baeldung/random/RandomStringUnitTest.kt @@ -0,0 +1,62 @@ +import org.apache.commons.lang3.RandomStringUtils +import org.junit.Before +import org.junit.jupiter.api.BeforeAll +import org.junit.jupiter.api.BeforeEach +import org.junit.jupiter.api.Test +import java.security.SecureRandom +import java.util.concurrent.ThreadLocalRandom +import kotlin.experimental.and +import kotlin.streams.asSequence +import kotlin.test.assertEquals + +const val STRING_LENGTH = 10 +const val ALPHANUMERIC_REGEX = "[a-zA-Z0-9]+" + +class RandomStringUnitTest { + private val charPool : List = ('a'..'z') + ('A'..'Z') + ('0'..'9') + + @Test + fun givenAStringLength_whenUsingJava_thenReturnAlphanumericString() { + var randomString = ThreadLocalRandom.current() + .ints(STRING_LENGTH.toLong(), 0, charPool.size) + .asSequence() + .map(charPool::get) + .joinToString("") + + assert(randomString.matches(Regex(ALPHANUMERIC_REGEX))) + assertEquals(STRING_LENGTH, randomString.length) + } + + @Test + fun givenAStringLength_whenUsingKotlin_thenReturnAlphanumericString() { + var randomString = (1..STRING_LENGTH).map { i -> kotlin.random.Random.nextInt(0, charPool.size) } + .map(charPool::get) + .joinToString("") + + assert(randomString.matches(Regex(ALPHANUMERIC_REGEX))) + assertEquals(STRING_LENGTH, randomString.length) + } + + @Test + fun givenAStringLength_whenUsingApacheCommon_thenReturnAlphanumericString() { + var randomString = RandomStringUtils.randomAlphanumeric(STRING_LENGTH) + + assert(randomString.matches(Regex(ALPHANUMERIC_REGEX))) + assertEquals(STRING_LENGTH, randomString.length) + } + + @Test + fun givenAStringLength_whenUsingRandomForBytes_thenReturnAlphanumericString() { + val random = SecureRandom() + val bytes = ByteArray(STRING_LENGTH) + random.nextBytes(bytes) + + var randomString = (0..bytes.size - 1).map { i -> + charPool.get((bytes[i] and 0xFF.toByte() and (charPool.size-1).toByte()).toInt()) + }.joinToString("") + + assert(randomString.matches(Regex(ALPHANUMERIC_REGEX))) + assertEquals(STRING_LENGTH, randomString.length) + } + +} \ No newline at end of file diff --git a/core-kotlin/src/test/kotlin/com/baeldung/sorting/SortingExampleKtTest.kt b/core-kotlin/src/test/kotlin/com/baeldung/sorting/SortingExampleKtTest.kt new file mode 100644 index 0000000000..8a94e29c2f --- /dev/null +++ b/core-kotlin/src/test/kotlin/com/baeldung/sorting/SortingExampleKtTest.kt @@ -0,0 +1,14 @@ +package com.baeldung.sorting + +import org.junit.jupiter.api.Test + +import org.junit.jupiter.api.Assertions.* + +class SortingExampleKtTest { + + @Test + fun naturalOrderComparator_ShouldBeAscendingTest() { + val resultingList = listOf(1, 5, 6, 6, 2, 3, 4).sortedWith(getSimpleComparator()) + assertTrue(listOf(1, 2, 3, 4, 5, 6, 6) == resultingList) + } +} \ No newline at end of file diff --git a/core-kotlin/src/test/kotlin/com/baeldung/thread/CoroutineUnitTest.kt b/core-kotlin/src/test/kotlin/com/baeldung/thread/CoroutineUnitTest.kt new file mode 100644 index 0000000000..1f1609b06b --- /dev/null +++ b/core-kotlin/src/test/kotlin/com/baeldung/thread/CoroutineUnitTest.kt @@ -0,0 +1,52 @@ +package com.baeldung.thread + +import kotlinx.coroutines.* +import org.junit.jupiter.api.Test + +class CoroutineUnitTest { + + @Test + fun whenCreateCoroutineWithLaunchWithoutContext_thenRun() = runBlocking { + + val job = launch { + println("${Thread.currentThread()} has run.") + } + + } + + @Test + fun whenCreateCoroutineWithLaunchWithDefaultContext_thenRun() = runBlocking { + + val job = launch(Dispatchers.Default) { + println("${Thread.currentThread()} has run.") + } + } + + @Test + fun whenCreateCoroutineWithLaunchWithUnconfinedContext_thenRun() = runBlocking { + + val job = launch(Dispatchers.Unconfined) { + println("${Thread.currentThread()} has run.") + } + } + + @Test + fun whenCreateCoroutineWithLaunchWithDedicatedThread_thenRun() = runBlocking { + + val job = launch(newSingleThreadContext("dedicatedThread")) { + println("${Thread.currentThread()} has run.") + } + + } + + @Test + fun whenCreateAsyncCoroutine_thenRun() = runBlocking { + + val deferred = async(Dispatchers.IO) { + return@async "${Thread.currentThread()} has run." + } + + val result = deferred.await() + println(result) + } +} \ No newline at end of file diff --git a/core-kotlin/src/test/kotlin/com/baeldung/thread/ThreadUnitTest.kt b/core-kotlin/src/test/kotlin/com/baeldung/thread/ThreadUnitTest.kt new file mode 100644 index 0000000000..fa2f1edc36 --- /dev/null +++ b/core-kotlin/src/test/kotlin/com/baeldung/thread/ThreadUnitTest.kt @@ -0,0 +1,38 @@ +package com.baeldung.thread + +import org.junit.jupiter.api.Test +import kotlin.concurrent.thread + +class ThreadUnitTest { + + @Test + fun whenCreateThread_thenRun() { + + val thread = SimpleThread() + thread.start() + } + + @Test + fun whenCreateThreadWithRunnable_thenRun() { + + val threadWithRunnable = Thread(SimpleRunnable()) + threadWithRunnable.start() + } + + @Test + fun whenCreateThreadWithSAMConversions_thenRun() { + + val thread = Thread { + println("${Thread.currentThread()} has run.") + } + thread.start() + } + + @Test + fun whenCreateThreadWithMethodExtension_thenRun() { + + thread(start = true) { + println("${Thread.currentThread()} has run.") + } + } +} \ No newline at end of file diff --git a/core-scala/README.md b/core-scala/README.md new file mode 100644 index 0000000000..eed344193f --- /dev/null +++ b/core-scala/README.md @@ -0,0 +1,3 @@ +### Relevant Articles: + +- [Introduction to Scala](https://www.baeldung.com/scala-intro) diff --git a/core-scala/pom.xml b/core-scala/pom.xml new file mode 100644 index 0000000000..343f21484a --- /dev/null +++ b/core-scala/pom.xml @@ -0,0 +1,54 @@ + + + 4.0.0 + core-scala + 1.0-SNAPSHOT + core-scala + jar + + + com.baeldung + parent-modules + 1.0.0-SNAPSHOT + + + + + org.scala-lang + scala-library + ${scala.version} + + + + + src/main/scala + src/test/scala + + + net.alchim31.maven + scala-maven-plugin + 3.3.2 + + + + compile + testCompile + + + + -dependencyfile + ${project.build.directory}/.scala_dependencies + + + + + + + + + + 2.12.7 + + + diff --git a/core-scala/src/main/scala/com/baeldung/scala/ControlStructuresDemo.scala b/core-scala/src/main/scala/com/baeldung/scala/ControlStructuresDemo.scala new file mode 100644 index 0000000000..7c1281e573 --- /dev/null +++ b/core-scala/src/main/scala/com/baeldung/scala/ControlStructuresDemo.scala @@ -0,0 +1,44 @@ +package com.baeldung.scala + +/** + * Sample code demonstrating the various control structured. + * + * @author Chandra Prakash + * + */ +object ControlStructuresDemo { + def gcd(x : Int, y : Int) : Int = { + if (y == 0) x else gcd(y, x % y) + } + + def gcdIter(x : Int, y : Int) : Int = { + var a = x + var b = y + while (b > 0) { + a = a % b + val t = a + a = b + b = t + } + a + } + + def rangeSum(a : Int, b : Int) = { + var sum = 0; + for (i <- a to b) { + sum += i + } + sum + } + + def factorial(a : Int) : Int = { + var result = 1; + var i = 1; + do { + result *= i + i = i + 1 + } while (i <= a) + result + } + +} \ No newline at end of file diff --git a/core-scala/src/main/scala/com/baeldung/scala/Employee.scala b/core-scala/src/main/scala/com/baeldung/scala/Employee.scala new file mode 100644 index 0000000000..9291d958b3 --- /dev/null +++ b/core-scala/src/main/scala/com/baeldung/scala/Employee.scala @@ -0,0 +1,27 @@ +package com.baeldung.scala + +/** + * Sample Code demonstrating a class. + * + * @author Chandra Prakash + * + */ +class Employee(val name : String, + var salary : Int, + annualIncrement : Int = 20) { + + def incrementSalary() : Unit = { + salary += annualIncrement + } + + override def toString = + s"Employee(name=$name, salary=$salary)" +} + +/** + * A Trait which will make the toString return upper case value. + */ +trait UpperCasePrinter { + override def toString: String = super.toString toUpperCase +} + diff --git a/core-scala/src/main/scala/com/baeldung/scala/HelloWorld.scala b/core-scala/src/main/scala/com/baeldung/scala/HelloWorld.scala new file mode 100644 index 0000000000..b3f0ce09a5 --- /dev/null +++ b/core-scala/src/main/scala/com/baeldung/scala/HelloWorld.scala @@ -0,0 +1,6 @@ +package com.baeldung.scala + +object HelloWorld extends App { + println("Hello World!") + args foreach println +} diff --git a/core-scala/src/main/scala/com/baeldung/scala/HigherOrderFunctions.scala b/core-scala/src/main/scala/com/baeldung/scala/HigherOrderFunctions.scala new file mode 100644 index 0000000000..02c41a5f8c --- /dev/null +++ b/core-scala/src/main/scala/com/baeldung/scala/HigherOrderFunctions.scala @@ -0,0 +1,27 @@ +package com.baeldung.scala + +/** + * Sample higher order functions. + * + * @author Chandra Prakash + * + */ +object HigherOrderFunctions { + + def mapReduce(r : (Int, Int) => Int, + i : Int, + m : Int => Int, + a : Int, b : Int): Int = { + def iter(a : Int, result : Int) : Int = { + if (a > b) result + else iter(a + 1, r(m(a), result)) + } + iter(a, i) + } + + def whileLoop(condition : => Boolean)(body : => Unit) : Unit = + if (condition) { + body + whileLoop(condition)(body) + } +} \ No newline at end of file diff --git a/core-scala/src/main/scala/com/baeldung/scala/IntSet.scala b/core-scala/src/main/scala/com/baeldung/scala/IntSet.scala new file mode 100644 index 0000000000..f1a5722a4e --- /dev/null +++ b/core-scala/src/main/scala/com/baeldung/scala/IntSet.scala @@ -0,0 +1,34 @@ +package com.baeldung.scala + +/** + * An abstract class for set of integers and its implementation. + * + * @author Chandra Prakash + * + */ +abstract class IntSet { + // add an element to the set + def incl(x : Int) : IntSet + + // whether an element belongs to the set + def contains(x : Int) : Boolean +} + +class EmptyIntSet extends IntSet { + + def contains(x : Int) : Boolean = false + + def incl(x : Int) = + new NonEmptyIntSet(x, this) +} + +class NonEmptyIntSet(val head : Int, val tail : IntSet) + extends IntSet { + + def contains(x : Int) : Boolean = + head == x || (tail contains x) + + def incl(x : Int) : IntSet = + if (this contains x) this + else new NonEmptyIntSet(x, this) +} \ No newline at end of file diff --git a/core-scala/src/main/scala/com/baeldung/scala/Utils.scala b/core-scala/src/main/scala/com/baeldung/scala/Utils.scala new file mode 100644 index 0000000000..20bc413646 --- /dev/null +++ b/core-scala/src/main/scala/com/baeldung/scala/Utils.scala @@ -0,0 +1,33 @@ +package com.baeldung.scala + +/** + * Some utility methods. + * + * @author Chandra Prakash + * + */ +object Utils { + def average(x : Double, y : Double): Double = (x + y) / 2 + + def randomLessThan(d : Double): Double = { + var random = 0d + do { + random = Math.random() + } while (random >= d) + random + } + + def power(x : Int, y : Int) : Int = { + def powNested(i : Int, accumulator : Int) : Int = { + if (i <= 0) accumulator + else powNested(i - 1, x * accumulator) + } + powNested(y, 1) + } + + def fibonacci(n : Int) : Int = n match { + case 0 | 1 => 1 + case x if x > 1 => + fibonacci(x - 1) + fibonacci(x - 2) + } +} \ No newline at end of file diff --git a/core-scala/src/test/scala/com/baeldung/scala/ControlStructuresDemoUnitTest.scala b/core-scala/src/test/scala/com/baeldung/scala/ControlStructuresDemoUnitTest.scala new file mode 100644 index 0000000000..584038ee2c --- /dev/null +++ b/core-scala/src/test/scala/com/baeldung/scala/ControlStructuresDemoUnitTest.scala @@ -0,0 +1,33 @@ +package com.baeldung.scala + +import com.baeldung.scala.ControlStructuresDemo._ +import org.junit.Assert.assertEquals +import org.junit.Test + +class ControlStructuresDemoUnitTest { + @Test + def givenTwoIntegers_whenGcdCalled_thenCorrectValueReturned() = { + assertEquals(3, gcd(15, 27)) + } + + @Test + def givenTwoIntegers_whenGcdIterCalled_thenCorrectValueReturned() = { + assertEquals(3, gcdIter(15, 27)) + } + + @Test + def givenTwoIntegers_whenRangeSumcalled_thenCorrectValueReturned() = { + assertEquals(55, rangeSum(1, 10)) + } + + @Test + def givenPositiveInteger_whenFactorialInvoked_thenCorrectValueReturned() = { + assertEquals(720, factorial(6)) + } + + @Test + def whenFactorialOf0Invoked_then1Returned() = { + assertEquals(1, factorial(0)) + } + +} \ No newline at end of file diff --git a/core-scala/src/test/scala/com/baeldung/scala/EmployeeUnitTest.scala b/core-scala/src/test/scala/com/baeldung/scala/EmployeeUnitTest.scala new file mode 100644 index 0000000000..0828752a8a --- /dev/null +++ b/core-scala/src/test/scala/com/baeldung/scala/EmployeeUnitTest.scala @@ -0,0 +1,30 @@ +package com.baeldung.scala + +import org.junit.Assert.assertEquals +import org.junit.Test + +class EmployeeUnitTest { + + @Test + def whenEmployeeSalaryIncremented_thenCorrectSalary() = { + val employee = new Employee("John Doe", 1000) + employee.incrementSalary() + assertEquals(1020, employee.salary) + } + + @Test + def givenEmployee_whenToStringCalled_thenCorrectStringReturned() = { + val employee = new Employee("John Doe", 1000) + assertEquals("Employee(name=John Doe, salary=1000)", employee.toString) + } + + @Test + def givenEmployeeWithTrait_whenToStringCalled_thenCorrectStringReturned() = { + val employee = + new Employee("John Doe", 1000) with UpperCasePrinter + assertEquals("EMPLOYEE(NAME=JOHN DOE, SALARY=1000)", employee.toString) + } + +} + + diff --git a/core-scala/src/test/scala/com/baeldung/scala/HigherOrderFunctionsUnitTest.scala b/core-scala/src/test/scala/com/baeldung/scala/HigherOrderFunctionsUnitTest.scala new file mode 100644 index 0000000000..240c879d7f --- /dev/null +++ b/core-scala/src/test/scala/com/baeldung/scala/HigherOrderFunctionsUnitTest.scala @@ -0,0 +1,48 @@ +package com.baeldung.scala + +import com.baeldung.scala.HigherOrderFunctions.mapReduce +import org.junit.Assert.assertEquals +import org.junit.Test + +class HigherOrderFunctionsUnitTest { + + @Test + def whenCalledWithSumAndSquareFunctions_thenCorrectValueReturned() = { + def square(x : Int) = x * x + + def sum(x : Int, y : Int) = x + y + + def sumSquares(a : Int, b : Int) = + mapReduce(sum, 0, square, a, b) + + assertEquals(385, sumSquares(1, 10)) + } + + @Test + def whenComputingSumOfSquaresWithAnonymousFunctions_thenCorrectValueReturned() = { + def sumSquares(a : Int, b : Int) = + mapReduce((x, y) => x + y, 0, x => x * x, a, b) + + assertEquals(385, sumSquares(1, 10)) + } + + @Test + def givenCurriedFunctions_whenInvoked_thenCorrectValueReturned() = { + // a curried function + def sum(f : Int => Int)(a : Int, + b : Int) : Int = + if (a > b) 0 else f(a) + sum(f)(a + 1, b) + + // another curried function + def mod(n : Int)(x : Int) = x % n + + // application of a curried function + assertEquals(1, mod(5)(6)) + + // partial application of curried function + // trailing underscore is required to make function type explicit + val sumMod5 = sum(mod(5)) _ + + assertEquals(10, sumMod5(6, 10)) + } +} \ No newline at end of file diff --git a/core-scala/src/test/scala/com/baeldung/scala/IntSetUnitTest.scala b/core-scala/src/test/scala/com/baeldung/scala/IntSetUnitTest.scala new file mode 100644 index 0000000000..ac27389d70 --- /dev/null +++ b/core-scala/src/test/scala/com/baeldung/scala/IntSetUnitTest.scala @@ -0,0 +1,21 @@ +package com.baeldung.scala + +import org.junit.Assert.assertFalse +import org.junit.Test + +class IntSetUnitTest { + + @Test + def givenSetof1To10_whenContains11Called_thenFalse() = { + + // Set up a set containing integers 1 to 10. + val set1To10 = + Range(1, 10) + .foldLeft(new EmptyIntSet() : IntSet) { + (x, y) => x incl y + } + + assertFalse(set1To10 contains 11) + } + +} \ No newline at end of file diff --git a/core-scala/src/test/scala/com/baeldung/scala/UtilsUnitTest.scala b/core-scala/src/test/scala/com/baeldung/scala/UtilsUnitTest.scala new file mode 100644 index 0000000000..e4995201d8 --- /dev/null +++ b/core-scala/src/test/scala/com/baeldung/scala/UtilsUnitTest.scala @@ -0,0 +1,32 @@ +package com.baeldung.scala + +import com.baeldung.scala.Utils.{average, fibonacci, power, randomLessThan} +import org.junit.Assert.{assertEquals, assertTrue} +import org.junit.Test + +class UtilsUnitTest { + + @Test + def whenAverageCalled_thenCorrectValueReturned(): Unit = { + assertEquals(15.0, average(10, 20), 1e-5) + } + + @Test + def whenRandomLessThanInvokedWithANumber_thenARandomLessThanItReturned: Unit = { + val d = 0.1 + assertTrue(randomLessThan(d) < d) + } + + @Test + def whenPowerInvokedWith2And3_then8Returned: Unit = { + assertEquals(8, power(2, 3)) + } + + @Test + def whenFibonacciCalled_thenCorrectValueReturned: Unit = { + assertEquals(1, fibonacci(0)) + assertEquals(1, fibonacci(1)) + assertEquals(fibonacci(6), + fibonacci(4) + fibonacci(5)) + } +} \ No newline at end of file diff --git a/data-structures/pom.xml b/data-structures/pom.xml index c1a1f1d371..4958598234 100644 --- a/data-structures/pom.xml +++ b/data-structures/pom.xml @@ -1,9 +1,9 @@ 4.0.0 - com.baeldung data-structures 0.0.1-SNAPSHOT + data-structures com.baeldung diff --git a/ddd/README.md b/ddd/README.md new file mode 100644 index 0000000000..60f3a43086 --- /dev/null +++ b/ddd/README.md @@ -0,0 +1,3 @@ +### Relevant articles + +- [Persisting DDD Aggregates](https://www.baeldung.com/spring-persisting-ddd-aggregates) diff --git a/ddd/pom.xml b/ddd/pom.xml new file mode 100644 index 0000000000..a61ae24e92 --- /dev/null +++ b/ddd/pom.xml @@ -0,0 +1,91 @@ + + 4.0.0 + + + org.springframework.boot + spring-boot-starter-parent + 2.0.6.RELEASE + + + + com.baeldung.ddd + ddd + 0.0.1-SNAPSHOT + jar + ddd + DDD series examples + + + 1.0.1 + 2.22.0 + + + + + org.springframework.boot + spring-boot-starter-data-mongodb + + + org.junit.jupiter + junit-jupiter-api + test + + + org.junit.jupiter + junit-jupiter-engine + test + + + + + org.junit.platform + junit-platform-launcher + ${junit-platform.version} + test + + + org.joda + joda-money + ${joda-money.version} + + + org.springframework.boot + spring-boot-starter-data-jpa + + + com.h2database + h2 + runtime + + + mysql + mysql-connector-java + runtime + + + org.postgresql + postgresql + runtime + + + org.springframework.boot + spring-boot-devtools + true + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework.boot + spring-boot-starter-test + test + + + de.flapdoodle.embed + de.flapdoodle.embed.mongo + test + + + \ 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 new file mode 100644 index 0000000000..cd9be34278 --- /dev/null +++ b/ddd/src/main/java/com/baeldung/ddd/PersistingDddAggregatesApplication.java @@ -0,0 +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); + } +} diff --git a/ddd/src/main/java/com/baeldung/ddd/order/Order.java b/ddd/src/main/java/com/baeldung/ddd/order/Order.java new file mode 100644 index 0000000000..125bc5fe2d --- /dev/null +++ b/ddd/src/main/java/com/baeldung/ddd/order/Order.java @@ -0,0 +1,52 @@ +package com.baeldung.ddd.order; + +import java.util.ArrayList; +import java.util.List; + +import org.joda.money.Money; + +public class Order { + private final List orderLines; + private Money totalCost; + + public Order(List orderLines) { + checkNotNull(orderLines); + if (orderLines.isEmpty()) { + throw new IllegalArgumentException("Order must have at least one order line item"); + } + this.orderLines = new ArrayList<>(orderLines); + totalCost = calculateTotalCost(); + } + + public void addLineItem(OrderLine orderLine) { + checkNotNull(orderLine); + orderLines.add(orderLine); + totalCost = totalCost.plus(orderLine.cost()); + } + + public List getOrderLines() { + return new ArrayList<>(orderLines); + } + + public void removeLineItem(int line) { + OrderLine removedLine = orderLines.remove(line); + totalCost = totalCost.minus(removedLine.cost()); + } + + public Money totalCost() { + return totalCost; + } + + private Money calculateTotalCost() { + return orderLines.stream() + .map(OrderLine::cost) + .reduce(Money::plus) + .get(); + } + + private static void checkNotNull(Object par) { + if (par == null) { + throw new NullPointerException("Parameter cannot be null"); + } + } +} diff --git a/ddd/src/main/java/com/baeldung/ddd/order/OrderLine.java b/ddd/src/main/java/com/baeldung/ddd/order/OrderLine.java new file mode 100644 index 0000000000..000f55f2fb --- /dev/null +++ b/ddd/src/main/java/com/baeldung/ddd/order/OrderLine.java @@ -0,0 +1,67 @@ +package com.baeldung.ddd.order; + +import org.joda.money.Money; + +public class OrderLine { + private final Product product; + private final int quantity; + + public OrderLine(Product product, int quantity) { + super(); + this.product = product; + this.quantity = quantity; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (obj == null) { + return false; + } + if (getClass() != obj.getClass()) { + return false; + } + OrderLine other = (OrderLine) obj; + if (product == null) { + if (other.product != null) { + return false; + } + } else if (!product.equals(other.product)) { + return false; + } + if (quantity != other.quantity) { + return false; + } + return true; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((product == null) ? 0 : product.hashCode()); + result = prime * result + quantity; + return result; + } + + @Override + public String toString() { + return "OrderLine [product=" + product + ", quantity=" + quantity + "]"; + } + + Money cost() { + return product.getPrice() + .multipliedBy(quantity); + } + + Product getProduct() { + return product; + } + + int getQuantity() { + return quantity; + } + +} diff --git a/ddd/src/main/java/com/baeldung/ddd/order/Product.java b/ddd/src/main/java/com/baeldung/ddd/order/Product.java new file mode 100644 index 0000000000..0afcaa434f --- /dev/null +++ b/ddd/src/main/java/com/baeldung/ddd/order/Product.java @@ -0,0 +1,52 @@ +package com.baeldung.ddd.order; + +import org.joda.money.Money; + +public class Product { + private final Money price; + + public Product(Money price) { + super(); + this.price = price; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (obj == null) { + return false; + } + if (getClass() != obj.getClass()) { + return false; + } + Product other = (Product) obj; + if (price == null) { + if (other.price != null) { + return false; + } + } else if (!price.equals(other.price)) { + return false; + } + return true; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((price == null) ? 0 : price.hashCode()); + return result; + } + + @Override + public String toString() { + return "Product [price=" + price + "]"; + } + + Money getPrice() { + return price; + } + +} diff --git a/ddd/src/main/java/com/baeldung/ddd/order/jpa/JpaOrder.java b/ddd/src/main/java/com/baeldung/ddd/order/jpa/JpaOrder.java new file mode 100644 index 0000000000..ed11b0dca4 --- /dev/null +++ b/ddd/src/main/java/com/baeldung/ddd/order/jpa/JpaOrder.java @@ -0,0 +1,111 @@ +package com.baeldung.ddd.order.jpa; + +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.List; + +import javax.persistence.ElementCollection; +import javax.persistence.Entity; +import javax.persistence.FetchType; +import javax.persistence.GeneratedValue; +import javax.persistence.Id; +import javax.persistence.Table; + +@Entity +@Table(name = "order_table") +class JpaOrder { + private String currencyUnit; + @Id + @GeneratedValue + private Long id; + @ElementCollection(fetch = FetchType.EAGER) + private final List orderLines; + private BigDecimal totalCost; + + JpaOrder() { + totalCost = null; + orderLines = new ArrayList<>(); + } + + JpaOrder(List orderLines) { + checkNotNull(orderLines); + if (orderLines.isEmpty()) { + throw new IllegalArgumentException("Order must have at least one order line item"); + } + this.orderLines = new ArrayList<>(orderLines); + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (obj == null) { + return false; + } + if (getClass() != obj.getClass()) { + return false; + } + JpaOrder other = (JpaOrder) obj; + if (id == null) { + if (other.id != null) { + return false; + } + } else if (!id.equals(other.id)) { + return false; + } + return true; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((id == null) ? 0 : id.hashCode()); + return result; + } + + @Override + public String toString() { + return "JpaOrder [currencyUnit=" + currencyUnit + ", id=" + id + ", orderLines=" + orderLines + ", totalCost=" + totalCost + "]"; + } + + void addLineItem(JpaOrderLine orderLine) { + checkNotNull(orderLine); + orderLines.add(orderLine); + } + + String getCurrencyUnit() { + return currencyUnit; + } + + Long getId() { + return id; + } + + List getOrderLines() { + return new ArrayList<>(orderLines); + } + + BigDecimal getTotalCost() { + return totalCost; + } + + void removeLineItem(int line) { + JpaOrderLine removedLine = orderLines.remove(line); + } + + void setCurrencyUnit(String currencyUnit) { + this.currencyUnit = currencyUnit; + } + + void setTotalCost(BigDecimal totalCost) { + this.totalCost = totalCost; + } + + private static void checkNotNull(Object par) { + if (par == null) { + throw new NullPointerException("Parameter cannot be null"); + } + } +} diff --git a/ddd/src/main/java/com/baeldung/ddd/order/jpa/JpaOrderLine.java b/ddd/src/main/java/com/baeldung/ddd/order/jpa/JpaOrderLine.java new file mode 100644 index 0000000000..a3b50f0502 --- /dev/null +++ b/ddd/src/main/java/com/baeldung/ddd/order/jpa/JpaOrderLine.java @@ -0,0 +1,70 @@ +package com.baeldung.ddd.order.jpa; + +import javax.persistence.Embeddable; +import javax.persistence.Embedded; + +@Embeddable +class JpaOrderLine { + @Embedded + private final JpaProduct product; + private final int quantity; + + JpaOrderLine() { + quantity = 0; + product = null; + } + + JpaOrderLine(JpaProduct product, int quantity) { + super(); + this.product = product; + this.quantity = quantity; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (obj == null) { + return false; + } + if (getClass() != obj.getClass()) { + return false; + } + JpaOrderLine other = (JpaOrderLine) obj; + if (product == null) { + if (other.product != null) { + return false; + } + } else if (!product.equals(other.product)) { + return false; + } + if (quantity != other.quantity) { + return false; + } + return true; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((product == null) ? 0 : product.hashCode()); + result = prime * result + quantity; + return result; + } + + @Override + public String toString() { + return "JpaOrderLine [product=" + product + ", quantity=" + quantity + "]"; + } + + JpaProduct getProduct() { + return product; + } + + int getQuantity() { + return quantity; + } + +} diff --git a/ddd/src/main/java/com/baeldung/ddd/order/jpa/JpaOrderRepository.java b/ddd/src/main/java/com/baeldung/ddd/order/jpa/JpaOrderRepository.java new file mode 100644 index 0000000000..b6e08e8372 --- /dev/null +++ b/ddd/src/main/java/com/baeldung/ddd/order/jpa/JpaOrderRepository.java @@ -0,0 +1,7 @@ +package com.baeldung.ddd.order.jpa; + +import org.springframework.data.jpa.repository.JpaRepository; + +public interface JpaOrderRepository extends JpaRepository { + +} diff --git a/ddd/src/main/java/com/baeldung/ddd/order/jpa/JpaProduct.java b/ddd/src/main/java/com/baeldung/ddd/order/jpa/JpaProduct.java new file mode 100644 index 0000000000..61e67fa12a --- /dev/null +++ b/ddd/src/main/java/com/baeldung/ddd/order/jpa/JpaProduct.java @@ -0,0 +1,79 @@ +package com.baeldung.ddd.order.jpa; + +import java.math.BigDecimal; + +import javax.persistence.Embeddable; + +@Embeddable +class JpaProduct { + private String currencyUnit; + private BigDecimal price; + + public JpaProduct() { + } + + public JpaProduct(BigDecimal price, String currencyUnit) { + super(); + this.price = price; + currencyUnit = currencyUnit; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (obj == null) { + return false; + } + if (getClass() != obj.getClass()) { + return false; + } + JpaProduct other = (JpaProduct) obj; + if (currencyUnit == null) { + if (other.currencyUnit != null) { + return false; + } + } else if (!currencyUnit.equals(other.currencyUnit)) { + return false; + } + if (price == null) { + if (other.price != null) { + return false; + } + } else if (!price.equals(other.price)) { + return false; + } + return true; + } + + public String getCurrencyUnit() { + return currencyUnit; + } + + public BigDecimal getPrice() { + return price; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((currencyUnit == null) ? 0 : currencyUnit.hashCode()); + result = prime * result + ((price == null) ? 0 : price.hashCode()); + return result; + } + + public void setCurrencyUnit(String currencyUnit) { + this.currencyUnit = currencyUnit; + } + + public void setPrice(BigDecimal price) { + this.price = price; + } + + @Override + public String toString() { + return "JpaProduct [currencyUnit=" + currencyUnit + ", price=" + price + "]"; + } +} diff --git a/ddd/src/main/java/com/baeldung/ddd/order/mongo/OrderMongoRepository.java b/ddd/src/main/java/com/baeldung/ddd/order/mongo/OrderMongoRepository.java new file mode 100644 index 0000000000..79f9ec9f21 --- /dev/null +++ b/ddd/src/main/java/com/baeldung/ddd/order/mongo/OrderMongoRepository.java @@ -0,0 +1,9 @@ +package com.baeldung.ddd.order.mongo; + +import org.springframework.data.mongodb.repository.MongoRepository; + +import com.baeldung.ddd.order.Order; + +public interface OrderMongoRepository extends MongoRepository { + +} diff --git a/ddd/src/test/java/com/baeldung/ddd/order/OrderTest.java b/ddd/src/test/java/com/baeldung/ddd/order/OrderTest.java new file mode 100644 index 0000000000..431a6a5293 --- /dev/null +++ b/ddd/src/test/java/com/baeldung/ddd/order/OrderTest.java @@ -0,0 +1,70 @@ +package com.baeldung.ddd.order; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.catchThrowable; + +import java.util.ArrayList; +import java.util.Arrays; + +import org.joda.money.CurrencyUnit; +import org.joda.money.Money; +import org.junit.jupiter.api.DisplayName; +import org.junit.jupiter.api.Test; + +class OrderTest { + @DisplayName("given order with two items, when calculate total cost, then sum is returned") + @Test + void test0() throws Exception { + // given + OrderLine ol0 = new OrderLine(new Product(Money.of(CurrencyUnit.USD, 10.00)), 2); + OrderLine ol1 = new OrderLine(new Product(Money.of(CurrencyUnit.USD, 5.00)), 10); + Order order = new Order(Arrays.asList(ol0, ol1)); + + // when + Money totalCost = order.totalCost(); + + // then + assertThat(totalCost).isEqualTo(Money.of(CurrencyUnit.USD, 70.00)); + } + + @DisplayName("when create order without line items, then exception is thrown") + @Test + void test1() throws Exception { + // when + Throwable throwable = catchThrowable(() -> new Order(new ArrayList<>())); + + // then + assertThat(throwable).isInstanceOf(IllegalArgumentException.class); + } + + @DisplayName("given order with two line items, when add another line item, then total cost is updated") + @Test + void test2() throws Exception { + // given + OrderLine ol0 = new OrderLine(new Product(Money.of(CurrencyUnit.USD, 10.00)), 1); + OrderLine ol1 = new OrderLine(new Product(Money.of(CurrencyUnit.USD, 5.00)), 1); + Order order = new Order(Arrays.asList(ol0, ol1)); + + // when + order.addLineItem(new OrderLine(new Product(Money.of(CurrencyUnit.USD, 20.00)), 2)); + + // then + assertThat(order.totalCost()).isEqualTo(Money.of(CurrencyUnit.USD, 55)); + } + + @DisplayName("given order with three line items, when remove item, then total cost is updated") + @Test + void test3() throws Exception { + // given + OrderLine ol0 = new OrderLine(new Product(Money.of(CurrencyUnit.USD, 10.00)), 1); + OrderLine ol1 = new OrderLine(new Product(Money.of(CurrencyUnit.USD, 20.00)), 1); + OrderLine ol2 = new OrderLine(new Product(Money.of(CurrencyUnit.USD, 30.00)), 1); + Order order = new Order(Arrays.asList(ol0, ol1, ol2)); + + // when + order.removeLineItem(1); + + // then + assertThat(order.totalCost()).isEqualTo(Money.of(CurrencyUnit.USD, 40.00)); + } +} diff --git a/ddd/src/test/java/com/baeldung/ddd/order/jpa/PersistOrderIntegrationTest.java b/ddd/src/test/java/com/baeldung/ddd/order/jpa/PersistOrderIntegrationTest.java new file mode 100644 index 0000000000..c503c9960b --- /dev/null +++ b/ddd/src/test/java/com/baeldung/ddd/order/jpa/PersistOrderIntegrationTest.java @@ -0,0 +1,40 @@ +package com.baeldung.ddd.order.jpa; + +import static org.assertj.core.api.Assertions.assertThat; + +import java.math.BigDecimal; +import java.util.Arrays; + +import org.junit.jupiter.api.DisplayName; +import org.junit.jupiter.api.Test; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit.jupiter.SpringJUnitConfig; + +@SpringJUnitConfig +@SpringBootTest +public class PersistOrderIntegrationTest { + @Autowired + private JpaOrderRepository repository; + + @DisplayName("given order with two line items, when persist, then order is saved") + @Test + public void test() throws Exception { + // given + JpaOrder order = prepareTestOrderWithTwoLineItems(); + + // when + JpaOrder savedOrder = repository.save(order); + + // then + JpaOrder foundOrder = repository.findById(savedOrder.getId()) + .get(); + assertThat(foundOrder.getOrderLines()).hasSize(2); + } + + private JpaOrder prepareTestOrderWithTwoLineItems() { + JpaOrderLine ol0 = new JpaOrderLine(new JpaProduct(BigDecimal.valueOf(10.00), "USD"), 2); + JpaOrderLine ol1 = new JpaOrderLine(new JpaProduct(BigDecimal.valueOf(5.00), "USD"), 10); + return new JpaOrder(Arrays.asList(ol0, ol1)); + } +} diff --git a/ddd/src/test/java/com/baeldung/ddd/order/jpa/ViolateOrderBusinessRulesTest.java b/ddd/src/test/java/com/baeldung/ddd/order/jpa/ViolateOrderBusinessRulesTest.java new file mode 100644 index 0000000000..3eda9250f9 --- /dev/null +++ b/ddd/src/test/java/com/baeldung/ddd/order/jpa/ViolateOrderBusinessRulesTest.java @@ -0,0 +1,35 @@ +package com.baeldung.ddd.order.jpa; + +import static org.assertj.core.api.Assertions.assertThat; + +import java.math.BigDecimal; + +import org.junit.jupiter.api.DisplayName; +import org.junit.jupiter.api.Test; + +public class ViolateOrderBusinessRulesTest { + @DisplayName("given two non-zero order line items, when create an order with them, it's possible to set total cost to zero") + @Test + void test() throws Exception { + // given + // available products + JpaProduct lungChingTea = new JpaProduct(BigDecimal.valueOf(10.00), "USD"); + JpaProduct gyokuroMiyazakiTea = new JpaProduct(BigDecimal.valueOf(20.00), "USD"); + // Lung Ching tea order line + JpaOrderLine orderLine0 = new JpaOrderLine(lungChingTea, 2); + // Gyokuro Miyazaki tea order line + JpaOrderLine orderLine1 = new JpaOrderLine(gyokuroMiyazakiTea, 3); + + // when + // create the order + JpaOrder order = new JpaOrder(); + order.addLineItem(orderLine0); + order.addLineItem(orderLine1); + order.setTotalCost(BigDecimal.ZERO); + order.setCurrencyUnit("USD"); + + // then + // this doesn't look good... + assertThat(order.getTotalCost()).isEqualTo(BigDecimal.ZERO); + } +} diff --git a/ddd/src/test/java/com/baeldung/ddd/order/mongo/OrderMongoIntegrationTest.java b/ddd/src/test/java/com/baeldung/ddd/order/mongo/OrderMongoIntegrationTest.java new file mode 100644 index 0000000000..ca4315c416 --- /dev/null +++ b/ddd/src/test/java/com/baeldung/ddd/order/mongo/OrderMongoIntegrationTest.java @@ -0,0 +1,50 @@ +package com.baeldung.ddd.order.mongo; + +import static org.assertj.core.api.Assertions.assertThat; + +import java.util.Arrays; +import java.util.List; + +import org.joda.money.CurrencyUnit; +import org.joda.money.Money; +import org.junit.jupiter.api.DisplayName; +import org.junit.jupiter.api.Test; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit.jupiter.SpringJUnitConfig; + +import com.baeldung.ddd.order.Order; +import com.baeldung.ddd.order.OrderLine; +import com.baeldung.ddd.order.Product; + +@SpringJUnitConfig +@SpringBootTest +public class OrderMongoIntegrationTest { + @Autowired + private OrderMongoRepository repo; + + @DisplayName("given order with two line items, when persist using mongo repository, then order is saved") + @Test + void test() throws Exception { + // given + Order order = prepareTestOrderWithTwoLineItems(); + + // when + repo.save(order); + + // then + List foundOrders = repo.findAll(); + assertThat(foundOrders).hasSize(1); + List foundOrderLines = foundOrders.iterator() + .next() + .getOrderLines(); + assertThat(foundOrderLines).hasSize(2); + assertThat(foundOrderLines).containsOnlyElementsOf(order.getOrderLines()); + } + + private Order prepareTestOrderWithTwoLineItems() { + OrderLine ol0 = new OrderLine(new Product(Money.of(CurrencyUnit.USD, 10.00)), 2); + OrderLine ol1 = new OrderLine(new Product(Money.of(CurrencyUnit.USD, 5.00)), 10); + return new Order(Arrays.asList(ol0, ol1)); + } +} diff --git a/drools/pom.xml b/drools/pom.xml index 009ac8acec..b5cfc7d6dc 100644 --- a/drools/pom.xml +++ b/drools/pom.xml @@ -3,7 +3,8 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 drools - + drools + com.baeldung parent-spring-4 diff --git a/dubbo/pom.xml b/dubbo/pom.xml index 6f81ec5cff..9fe228bf89 100644 --- a/dubbo/pom.xml +++ b/dubbo/pom.xml @@ -2,6 +2,7 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 dubbo + dubbo parent-modules diff --git a/ejb/README.md b/ejb/README.md deleted file mode 100644 index f47277bf8f..0000000000 --- a/ejb/README.md +++ /dev/null @@ -1,6 +0,0 @@ -## Relevant articles: - -- [Guide to EJB Set-up](http://www.baeldung.com/ejb-intro) -- [Java EE Session Beans](http://www.baeldung.com/ejb-session-beans) -- [Introduction to EJB JNDI Lookup on WildFly Application Server](http://www.baeldung.com/wildfly-ejb-jndi) -- [A Guide to Message Driven Beans in EJB](http://www.baeldung.com/ejb-message-driven-beans) diff --git a/ejb/ejb-client/pom.xml b/ejb/ejb-client/pom.xml deleted file mode 100755 index 6231030cec..0000000000 --- a/ejb/ejb-client/pom.xml +++ /dev/null @@ -1,26 +0,0 @@ - - - 4.0.0 - ejb-client - EJB3 Client Maven - - - com.baeldung.ejb - ejb - 1.0-SNAPSHOT - - - - - org.wildfly - wildfly-ejb-client-bom - pom - - - com.baeldung.ejb - ejb-remote - ejb - - - \ No newline at end of file diff --git a/ejb/ejb-remote/src/main/resources/META-INF/ejb-jar.xml b/ejb/ejb-remote/src/main/resources/META-INF/ejb-jar.xml deleted file mode 100755 index d6c2200198..0000000000 --- a/ejb/ejb-remote/src/main/resources/META-INF/ejb-jar.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - remote - - diff --git a/ejb/ejb-session-beans/pom.xml b/ejb/ejb-session-beans/pom.xml deleted file mode 100644 index da76169729..0000000000 --- a/ejb/ejb-session-beans/pom.xml +++ /dev/null @@ -1,83 +0,0 @@ - - 4.0.0 - ejb-session-beans - - - com.baeldung.ejb - ejb - 1.0-SNAPSHOT - - - - - - org.jboss.arquillian - arquillian-bom - ${arquillian-bom.version} - import - pom - - - - - - - javax - javaee-api - provided - - - org.jboss.arquillian.junit - arquillian-junit-container - test - - - - - - arquillian-glassfish-embedded - - true - - - - org.jboss.arquillian.container - arquillian-glassfish-embedded-3.1 - ${arquillian-glassfish-embedded-3.1.version} - test - - - org.glassfish.main.extras - glassfish-embedded-all - ${glassfish-embedded-all.version} - test - - - - - - - - - maven-war-plugin - ${maven-war-plugin.version} - - false - - - - - - - UTF-8 - 1.1.13.Final - 2.2.6 - 1.1.12.Final - 1.0.0.Final - 4.12 - 7.0 - 1.0.0.CR4 - 3.1.2 - - - \ No newline at end of file diff --git a/ejb/pom.xml b/ejb/pom.xml deleted file mode 100755 index 4cb700d087..0000000000 --- a/ejb/pom.xml +++ /dev/null @@ -1,97 +0,0 @@ - - - 4.0.0 - com.baeldung.ejb - ejb - 1.0-SNAPSHOT - pom - ejb - EJB Tutorial - - - com.baeldung - parent-modules - 1.0.0-SNAPSHOT - - - - ejb-remote - ejb-session-beans - - - - - - com.baeldung.ejb - ejb-remote - ${ejb-remote.version} - ejb - - - com.baeldung.ejb - ejb-session-beans - ${ejb-session-beans.version} - ejb - - - javax - javaee-api - ${javaee-api.version} - provided - - - org.wildfly - wildfly-ejb-client-bom - ${wildfly-ejb-client-bom.version} - pom - import - - - - - - - - - maven-ejb-plugin - ${maven-ejb-plugin.version} - - ${ejbVersion} - - - - - - - - - jboss-public-repository-group - JBoss Public Maven Repository Group - http://repository.jboss.org/nexus/content/groups/public/ - default - - true - never - - - true - never - - - - - - 2.5.7 - 3.4.11 - 0.10 - 2.19.1 - 1.0-SNAPSHOT - 1.0-SNAPSHOT - 7.0 - 2.4 - 3.2 - 10.1.0.Final - - - \ No newline at end of file diff --git a/events/MessagesAggregate/0638124c-9a1b-4d25-8fce-cc223d472e77.events b/events/MessagesAggregate/0638124c-9a1b-4d25-8fce-cc223d472e77.events deleted file mode 100644 index d3ce8b9cea..0000000000 Binary files a/events/MessagesAggregate/0638124c-9a1b-4d25-8fce-cc223d472e77.events and /dev/null differ diff --git a/events/MessagesAggregate/d2ba9cbe-1a44-428e-a710-13b1bdc67c4b.events b/events/MessagesAggregate/d2ba9cbe-1a44-428e-a710-13b1bdc67c4b.events deleted file mode 100644 index 2ab0ec469f..0000000000 Binary files a/events/MessagesAggregate/d2ba9cbe-1a44-428e-a710-13b1bdc67c4b.events and /dev/null differ diff --git a/events/README.md b/events/README.md deleted file mode 100644 index ff12555376..0000000000 --- a/events/README.md +++ /dev/null @@ -1 +0,0 @@ -## Relevant articles: diff --git a/events/ToDoItem/bf420ffc-0c3b-403e-bb8c-66cf499c773e.events b/events/ToDoItem/bf420ffc-0c3b-403e-bb8c-66cf499c773e.events deleted file mode 100644 index d805fc253e..0000000000 Binary files a/events/ToDoItem/bf420ffc-0c3b-403e-bb8c-66cf499c773e.events and /dev/null differ diff --git a/events/ToDoItem/e72a057b-adea-4c69-83a0-0431318823e7.events b/events/ToDoItem/e72a057b-adea-4c69-83a0-0431318823e7.events deleted file mode 100644 index 3d67b74ced..0000000000 Binary files a/events/ToDoItem/e72a057b-adea-4c69-83a0-0431318823e7.events and /dev/null differ diff --git a/flyway-cdi-extension/pom.xml b/flyway-cdi-extension/pom.xml index c6ee26f783..dbb32f1e5a 100644 --- a/flyway-cdi-extension/pom.xml +++ b/flyway-cdi-extension/pom.xml @@ -3,10 +3,10 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 - com.baeldung flyway-cdi-extension 1.0-SNAPSHOT + flyway-cdi-extension 1.8 diff --git a/gradle/README.md b/gradle/README.md index 229466dfec..a1f5c74c57 100644 --- a/gradle/README.md +++ b/gradle/README.md @@ -4,3 +4,4 @@ - [Creating a Fat Jar in Gradle](http://www.baeldung.com/gradle-fat-jar) - [A Custom Task in Gradle](http://www.baeldung.com/gradle-custom-task) - [Kotlin Dependency Injection with Kodein](http://www.baeldung.com/kotlin-kodein-dependency-injection) +- [Using JUnit 5 with Gradle](https://www.baeldung.com/junit-5-gradle) diff --git a/grpc/pom.xml b/grpc/pom.xml index 949f26d376..725bec3e70 100644 --- a/grpc/pom.xml +++ b/grpc/pom.xml @@ -71,9 +71,8 @@ - 1.5.0 - 1.5.0.Final - 0.5.0 + 1.16.1 + 1.6.1 + 0.6.1 - diff --git a/grpc/src/main/java/org/baeldung/grpc/client/GrpcClient.java b/grpc/src/main/java/org/baeldung/grpc/client/GrpcClient.java index 1a1809387f..f653e17910 100644 --- a/grpc/src/main/java/org/baeldung/grpc/client/GrpcClient.java +++ b/grpc/src/main/java/org/baeldung/grpc/client/GrpcClient.java @@ -10,7 +10,7 @@ import io.grpc.ManagedChannelBuilder; public class GrpcClient { public static void main(String[] args) throws InterruptedException { ManagedChannel channel = ManagedChannelBuilder.forAddress("localhost", 8080) - .usePlaintext(true) + .usePlaintext() .build(); HelloServiceGrpc.HelloServiceBlockingStub stub diff --git a/gson/README.md b/gson/README.md index 4122b21431..e1eb155f43 100644 --- a/gson/README.md +++ b/gson/README.md @@ -8,3 +8,4 @@ - [Jackson vs Gson](http://www.baeldung.com/jackson-vs-gson) - [Exclude Fields from Serialization in Gson](http://www.baeldung.com/gson-exclude-fields-serialization) - [Save Data to a JSON File with Gson](https://www.baeldung.com/gson-save-file) +- [Convert JSON to a Map Using Gson](https://www.baeldung.com/gson-json-to-map) diff --git a/gson/src/main/java/org/baeldung/gson/serialization/HashMapDeserializer.java b/gson/src/main/java/org/baeldung/gson/serialization/MapDeserializer.java similarity index 62% rename from gson/src/main/java/org/baeldung/gson/serialization/HashMapDeserializer.java rename to gson/src/main/java/org/baeldung/gson/serialization/MapDeserializer.java index bb73e32559..cdeb2e23c8 100644 --- a/gson/src/main/java/org/baeldung/gson/serialization/HashMapDeserializer.java +++ b/gson/src/main/java/org/baeldung/gson/serialization/MapDeserializer.java @@ -4,28 +4,26 @@ 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.google.gson.*; -public class HashMapDeserializer implements JsonDeserializer> { +public class MapDeserializer implements JsonDeserializer> { @Override - public HashMap deserialize(JsonElement elem, Type type, JsonDeserializationContext context) throws JsonParseException { - HashMap map = new HashMap<>(); - for (Map.Entry entry : elem.getAsJsonObject().entrySet()) { - JsonElement jsonValue = entry.getValue(); - Object value = null; - if (jsonValue.isJsonPrimitive()) { - value = toPrimitive(jsonValue.getAsJsonPrimitive(), context); - } else { - value = context.deserialize(jsonValue, Employee.class); - } - map.put(entry.getKey(), value); - } - return map; + public Map deserialize(JsonElement elem, Type type, JsonDeserializationContext context) throws JsonParseException { + return elem.getAsJsonObject() + .entrySet() + .stream() + .collect(Collectors.toMap( + Map.Entry::getKey, + e -> e.getValue().isJsonPrimitive() ? + toPrimitive(e.getValue().getAsJsonPrimitive(), context) + : context.deserialize(e.getValue(), Employee.class) + )); } private Object toPrimitive(JsonPrimitive jsonValue, JsonDeserializationContext context) { diff --git a/gson/src/main/java/org/baeldung/gson/serialization/StringDateMapDeserializer.java b/gson/src/main/java/org/baeldung/gson/serialization/StringDateMapDeserializer.java new file mode 100644 index 0000000000..f18bdbc84f --- /dev/null +++ b/gson/src/main/java/org/baeldung/gson/serialization/StringDateMapDeserializer.java @@ -0,0 +1,44 @@ +package org.baeldung.gson.serialization; + +import java.lang.reflect.Type; +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.Map; +import java.util.stream.Collectors; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonParseException; + +public class StringDateMapDeserializer implements JsonDeserializer> { + + private static final Logger logger = LoggerFactory.getLogger(StringDateMapDeserializer.class); + + private SimpleDateFormat format = new SimpleDateFormat("yyyy/MM/dd"); + + @Override + public Map deserialize(JsonElement elem, Type type, JsonDeserializationContext jsonDeserializationContext) { + System.out.println("Deserializer called"); + logger.info("Deserializer called"); + return elem.getAsJsonObject() + .entrySet() + .stream() + .filter(e -> e.getValue().isJsonPrimitive()) + .filter(e -> e.getValue().getAsJsonPrimitive().isString()) + .collect(Collectors.toMap(Map.Entry::getKey, e -> formatDate(e.getValue()))); + } + + private Date formatDate(JsonElement value) { + try { + return format.parse(value.getAsString()); + } catch (ParseException ex) { + throw new JsonParseException(ex); + } + } + +} diff --git a/gson/src/test/java/org/baeldung/gson/deserialization/HashMapDeserializationUnitTest.java b/gson/src/test/java/org/baeldung/gson/deserialization/MapDeserializationUnitTest.java similarity index 58% rename from gson/src/test/java/org/baeldung/gson/deserialization/HashMapDeserializationUnitTest.java rename to gson/src/test/java/org/baeldung/gson/deserialization/MapDeserializationUnitTest.java index 6905ade0da..a5ae4194e8 100644 --- a/gson/src/test/java/org/baeldung/gson/deserialization/HashMapDeserializationUnitTest.java +++ b/gson/src/test/java/org/baeldung/gson/deserialization/MapDeserializationUnitTest.java @@ -1,10 +1,14 @@ package org.baeldung.gson.deserialization; import java.lang.reflect.Type; -import java.util.HashMap; +import java.text.ParseException; +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.HashMapDeserializer; +import org.baeldung.gson.serialization.MapDeserializer; +import org.baeldung.gson.serialization.StringDateMapDeserializer; import org.junit.Assert; import org.junit.Test; import org.slf4j.Logger; @@ -16,18 +20,18 @@ import com.google.gson.JsonSyntaxException; import com.google.gson.internal.LinkedTreeMap; import com.google.gson.reflect.TypeToken; -public class HashMapDeserializationUnitTest { +public class MapDeserializationUnitTest { - private static final Logger logger = LoggerFactory.getLogger(HashMapDeserializationUnitTest.class); + private static final Logger logger = LoggerFactory.getLogger(MapDeserializationUnitTest.class); @Test - public void whenUsingHashMapClass_thenShouldReturnMapWithDefaultClasses() { + public void whenUsingMapClass_thenShouldReturnMapWithDefaultClasses() { String jsonString = "{'employee.name':'Bob','employee.salary':10000, 'employee.active':true, " + "'employee':{'id':10, 'name': 'Bob Willis', 'address':'London'}}"; Gson gson = new Gson(); - HashMap map = gson.fromJson(jsonString, HashMap.class); + Map map = gson.fromJson(jsonString, Map.class); logger.info("The converted map: {}", map); Assert.assertEquals(4, map.size()); @@ -43,7 +47,7 @@ public class HashMapDeserializationUnitTest { + "'employee.active':true, " + "'employee':{'id':10, 'name': 'Bob Willis', 'address':'London'}}"; Gson gson = new Gson(); - HashMap map = gson.fromJson(jsonString, HashMap.class); + Map map = gson.fromJson(jsonString, Map.class); logger.info("The converted map: {}", map); } @@ -56,8 +60,8 @@ public class HashMapDeserializationUnitTest { + "'Steve':{'id':10, 'name': 'Steven Waugh', 'address':'Australia'}}"; Gson gson = new Gson(); - Type empMapType = new TypeToken>(){}.getType(); - HashMap nameEmployeeMap = gson.fromJson(jsonString, empMapType); + Type empMapType = new TypeToken>(){}.getType(); + Map nameEmployeeMap = gson.fromJson(jsonString, empMapType); logger.info("The converted map: {}", nameEmployeeMap); Assert.assertEquals(3, nameEmployeeMap.size()); @@ -70,11 +74,11 @@ public class HashMapDeserializationUnitTest { String jsonString = "{'employee.name':'Bob','employee.salary':10000, 'employee.active':true, " + "'employee':{'id':10, 'name': 'Bob Willis', 'address':'London'}}"; - Type type = new TypeToken>(){}.getType(); + Type type = new TypeToken>(){}.getType(); Gson gson = new GsonBuilder() - .registerTypeAdapter(type, new HashMapDeserializer()) + .registerTypeAdapter(type, new MapDeserializer()) .create(); - HashMap blendedMap = gson.fromJson(jsonString, type); + Map blendedMap = gson.fromJson(jsonString, type); logger.info("The converted map: {}", blendedMap); Assert.assertEquals(4, blendedMap.size()); @@ -83,4 +87,26 @@ public class HashMapDeserializationUnitTest { } + @Test + public void whenUsingCustomDateDeserializer_thenShouldReturnMapWithDate() { + String jsonString = "{'Bob': '2017/06/01', 'Jennie':'2015/01/03'}"; + Type type = new TypeToken>(){}.getType(); + Gson gson = new GsonBuilder() + .registerTypeAdapter(type, new StringDateMapDeserializer()) + .create(); + Map empJoiningDateMap = gson.fromJson(jsonString, type); + + logger.info("The converted map: {}", empJoiningDateMap); + logger.info("The map class {}", empJoiningDateMap.getClass()); + Assert.assertEquals(2, empJoiningDateMap.size()); + Assert.assertEquals(Date.class, empJoiningDateMap.get("Bob").getClass()); + Date dt = null; + try { + dt = DateUtils.parseDate("2017-06-01", "yyyy-MM-dd"); + Assert.assertEquals(dt, empJoiningDateMap.get("Bob")); + } catch (ParseException e) { + logger.error("Could not parse date", e); + } + } + } diff --git a/guava-collections/README.md b/guava-collections/README.md index eb1eb1d35c..fc9cf549c3 100644 --- a/guava-collections/README.md +++ b/guava-collections/README.md @@ -17,4 +17,7 @@ - [Guide to Guava RangeSet](http://www.baeldung.com/guava-rangeset) - [Guide to Guava RangeMap](http://www.baeldung.com/guava-rangemap) - [Guide to Guava MinMaxPriorityQueue and EvictingQueue](http://www.baeldung.com/guava-minmax-priority-queue-and-evicting-queue) -- [Initialize a HashMap in Java](https://www.baeldung.com/java-initialize-hashmap) \ No newline at end of file +- [Initialize a HashMap in Java](https://www.baeldung.com/java-initialize-hashmap) +- [Guava Set + Function = Map](http://www.baeldung.com/guava-set-function-map-tutorial) +- [Guide to Guava Table](http://www.baeldung.com/guava-table) +- [Guide to Guava ClassToInstanceMap](http://www.baeldung.com/guava-class-to-instance-map) \ No newline at end of file diff --git a/guava/src/test/java/org/baeldung/guava/ClassToInstanceMapUnitTest.java b/guava-collections/src/test/java/org/baeldung/guava/ClassToInstanceMapUnitTest.java similarity index 100% rename from guava/src/test/java/org/baeldung/guava/ClassToInstanceMapUnitTest.java rename to guava-collections/src/test/java/org/baeldung/guava/ClassToInstanceMapUnitTest.java diff --git a/guava-collections/src/test/java/org/baeldung/guava/GuavaRangeMapUnitTest.java b/guava-collections/src/test/java/org/baeldung/guava/GuavaRangeMapUnitTest.java index 81ba72373c..c0c5efea23 100644 --- a/guava-collections/src/test/java/org/baeldung/guava/GuavaRangeMapUnitTest.java +++ b/guava-collections/src/test/java/org/baeldung/guava/GuavaRangeMapUnitTest.java @@ -2,6 +2,9 @@ package org.baeldung.guava; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertTrue; + +import java.util.Arrays; import java.util.Map; import org.junit.Test; import com.google.common.collect.ImmutableRangeMap; @@ -98,8 +101,9 @@ public class GuavaRangeMapUnitTest { final RangeMap experiencedSubRangeDesignationMap = experienceRangeDesignationMap.subRangeMap(Range.closed(4, 14)); assertNull(experiencedSubRangeDesignationMap.get(3)); - assertEquals("Executive Director", experiencedSubRangeDesignationMap.get(14)); - assertEquals("Vice President", experiencedSubRangeDesignationMap.get(7)); + assertTrue(experiencedSubRangeDesignationMap.asMapOfRanges().values() + .containsAll(Arrays.asList("Executive Director", "Vice President", "Executive Director"))); + } @Test diff --git a/guava/src/test/java/org/baeldung/guava/GuavaTableUnitTest.java b/guava-collections/src/test/java/org/baeldung/guava/GuavaTableUnitTest.java similarity index 100% rename from guava/src/test/java/org/baeldung/guava/GuavaTableUnitTest.java rename to guava-collections/src/test/java/org/baeldung/guava/GuavaTableUnitTest.java diff --git a/guava-modules/guava-18/pom.xml b/guava-modules/guava-18/pom.xml index ce9395fbf4..d55aa9ce82 100644 --- a/guava-modules/guava-18/pom.xml +++ b/guava-modules/guava-18/pom.xml @@ -2,10 +2,10 @@ 4.0.0 - com.baeldung guava-18 0.1.0-SNAPSHOT - + guava-18 + com.baeldung parent-java diff --git a/guava-modules/guava-19/pom.xml b/guava-modules/guava-19/pom.xml index 5dfb4d2cec..0548bb0c1f 100644 --- a/guava-modules/guava-19/pom.xml +++ b/guava-modules/guava-19/pom.xml @@ -2,10 +2,10 @@ 4.0.0 - com.baeldung guava-19 0.1.0-SNAPSHOT - + guava-19 + com.baeldung parent-java diff --git a/guava-modules/guava-21/pom.xml b/guava-modules/guava-21/pom.xml index 945b7c27c1..bdb1058a48 100644 --- a/guava-modules/guava-21/pom.xml +++ b/guava-modules/guava-21/pom.xml @@ -4,7 +4,8 @@ 4.0.0 guava-21 1.0-SNAPSHOT - + guava-21 + com.baeldung parent-java diff --git a/guava/README.md b/guava/README.md index 7501bf08de..56e6aff50c 100644 --- a/guava/README.md +++ b/guava/README.md @@ -6,15 +6,12 @@ ### Relevant Articles: - [Guava Functional Cookbook](http://www.baeldung.com/guava-functions-predicates) - [Guava – Write to File, Read from File](http://www.baeldung.com/guava-write-to-file-read-from-file) -- [Guava Set + Function = Map](http://www.baeldung.com/guava-set-function-map-tutorial) - [Guide to Guava’s Ordering](http://www.baeldung.com/guava-ordering) - [Guide to Guava’s PreConditions](http://www.baeldung.com/guava-preconditions) - [Introduction to Guava CacheLoader](http://www.baeldung.com/guava-cacheloader) - [Introduction to Guava Memoizer](http://www.baeldung.com/guava-memoizer) - [Guide to Guava’s EventBus](http://www.baeldung.com/guava-eventbus) -- [Guide to Guava Table](http://www.baeldung.com/guava-table) - [Guide to Guava’s Reflection Utilities](http://www.baeldung.com/guava-reflection) -- [Guide to Guava ClassToInstanceMap](http://www.baeldung.com/guava-class-to-instance-map) - [Guide to Mathematical Utilities in Guava](http://www.baeldung.com/guava-math) - [Bloom Filter in Java using Guava](http://www.baeldung.com/guava-bloom-filter) - [Using Guava CountingOutputStream](http://www.baeldung.com/guava-counting-outputstream) diff --git a/guest/core-java-9/pom.xml b/guest/core-java-9/pom.xml index e9271b42ff..3847c19d16 100644 --- a/guest/core-java-9/pom.xml +++ b/guest/core-java-9/pom.xml @@ -4,7 +4,8 @@ com.stackify core-java-9 0.0.1-SNAPSHOT - + core-java-9 + com.baeldung parent-modules diff --git a/guest/core-java/pom.xml b/guest/core-java/pom.xml index 787dd764a1..5057f7eaed 100644 --- a/guest/core-java/pom.xml +++ b/guest/core-java/pom.xml @@ -4,6 +4,7 @@ com.stackify core-java 0.0.1-SNAPSHOT + core-java com.baeldung diff --git a/guest/core-kotlin/pom.xml b/guest/core-kotlin/pom.xml index 6b189143a4..a57dd28ffd 100644 --- a/guest/core-kotlin/pom.xml +++ b/guest/core-kotlin/pom.xml @@ -6,7 +6,8 @@ 1.0-SNAPSHOT com.stackify jar - + core-kotlin + jcenter diff --git a/guest/deep-jsf/pom.xml b/guest/deep-jsf/pom.xml index e09b5e0606..12426a8833 100644 --- a/guest/deep-jsf/pom.xml +++ b/guest/deep-jsf/pom.xml @@ -4,6 +4,7 @@ com.stackify deep-jsf 0.0.1-SNAPSHOT + deep-jsf war diff --git a/guest/junit5-example/pom.xml b/guest/junit5-example/pom.xml index 457fb1fcaa..7c0cc3e776 100644 --- a/guest/junit5-example/pom.xml +++ b/guest/junit5-example/pom.xml @@ -4,7 +4,8 @@ junit5-example junit5-example 0.0.1-SNAPSHOT - + junit5-example + com.baeldung parent-modules diff --git a/guest/log4j2-example/pom.xml b/guest/log4j2-example/pom.xml index f64869879f..ab55e0b60e 100644 --- a/guest/log4j2-example/pom.xml +++ b/guest/log4j2-example/pom.xml @@ -4,7 +4,8 @@ log4j2-example log4j2-example 0.0.1-SNAPSHOT - + log4j2-example + com.baeldung parent-modules diff --git a/guest/logback-example/pom.xml b/guest/logback-example/pom.xml index 04de6a00a2..6e9fe0ddea 100644 --- a/guest/logback-example/pom.xml +++ b/guest/logback-example/pom.xml @@ -4,6 +4,7 @@ com.stackify logback-example 0.0.1-SNAPSHOT + logback-example com.baeldung diff --git a/guest/memory-leaks/pom.xml b/guest/memory-leaks/pom.xml index 956ae9c408..f1d411acbc 100644 --- a/guest/memory-leaks/pom.xml +++ b/guest/memory-leaks/pom.xml @@ -1,10 +1,10 @@ 4.0.0 - com.baeldung memory-leaks 0.0.1-SNAPSHOT - + memory-leaks + com.baeldung parent-modules diff --git a/guest/remote-debugging/pom.xml b/guest/remote-debugging/pom.xml index 974421de97..07b9cc49d8 100644 --- a/guest/remote-debugging/pom.xml +++ b/guest/remote-debugging/pom.xml @@ -5,8 +5,8 @@ com.stackify remote-debugging 0.0.1-SNAPSHOT + remote-debugging war - remote-debugging org.springframework.boot diff --git a/guest/slf4j/guide/pom.xml b/guest/slf4j/guide/pom.xml new file mode 100644 index 0000000000..657ede73b6 --- /dev/null +++ b/guest/slf4j/guide/pom.xml @@ -0,0 +1,63 @@ + + + 4.0.0 + com.stackify.slf4j.guide + slf4j-parent-module + 1.0.0-SNAPSHOT + slf4j-parent-module + pom + + + org.springframework.boot + spring-boot-starter-parent + 2.0.6.RELEASE + + + + slf4j-logback + slf4j-log4j2 + slf4j-log4j + + + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework.boot + spring-boot-starter-test + test + + + org.powermock + powermock-module-junit4 + ${powermock.version} + test + + + org.powermock + powermock-api-mockito2 + ${powermock.version} + test + + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + + + + UTF-8 + UTF-8 + 1.8 + 2.0.0-beta.5 + + diff --git a/spring-boot-h2/spring-boot-h2-database/.gitignore b/guest/slf4j/guide/slf4j-log4j/.gitignore similarity index 100% rename from spring-boot-h2/spring-boot-h2-database/.gitignore rename to guest/slf4j/guide/slf4j-log4j/.gitignore diff --git a/spring-boot-logging-log4j2/spring-boot-logging-log4j2-app/pom.xml b/guest/slf4j/guide/slf4j-log4j/pom.xml similarity index 61% rename from spring-boot-logging-log4j2/spring-boot-logging-log4j2-app/pom.xml rename to guest/slf4j/guide/slf4j-log4j/pom.xml index 571794167e..bca5392f4d 100644 --- a/spring-boot-logging-log4j2/spring-boot-logging-log4j2-app/pom.xml +++ b/guest/slf4j/guide/slf4j-log4j/pom.xml @@ -2,15 +2,15 @@ 4.0.0 - - spring-boot-logging-log4j2-app + slf4j-log4j + 0.0.1-SNAPSHOT + slf4j-log4j jar - Demo project for Spring Boot Logging with Log4J2 - spring-boot-logging-log4j2 - com.baeldung - 0.0.1-SNAPSHOT + com.stackify.slf4j.guide + slf4j-parent-module + 1.0.0-SNAPSHOT .. @@ -25,9 +25,17 @@ + + org.slf4j + slf4j-log4j12 + org.springframework.boot - spring-boot-starter-log4j2 + spring-boot-starter-test + test + + 1.7.25 + diff --git a/guest/slf4j/guide/slf4j-log4j/src/main/java/com/stackify/slf4j/guide/Application.java b/guest/slf4j/guide/slf4j-log4j/src/main/java/com/stackify/slf4j/guide/Application.java new file mode 100644 index 0000000000..01ccf519b3 --- /dev/null +++ b/guest/slf4j/guide/slf4j-log4j/src/main/java/com/stackify/slf4j/guide/Application.java @@ -0,0 +1,12 @@ +package com.stackify.slf4j.guide; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication +public class Application { + + public static void main(String[] args) { + SpringApplication.run(Application.class, args); + } +} diff --git a/guest/slf4j/guide/slf4j-log4j/src/main/java/com/stackify/slf4j/guide/controllers/SimpleController.java b/guest/slf4j/guide/slf4j-log4j/src/main/java/com/stackify/slf4j/guide/controllers/SimpleController.java new file mode 100644 index 0000000000..14f4439545 --- /dev/null +++ b/guest/slf4j/guide/slf4j-log4j/src/main/java/com/stackify/slf4j/guide/controllers/SimpleController.java @@ -0,0 +1,42 @@ +package com.stackify.slf4j.guide.controllers; + +import java.util.List; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.slf4j.MDC; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestHeader; +import org.springframework.web.bind.annotation.RestController; + +@RestController +public class SimpleController { + + Logger logger = LoggerFactory.getLogger(SimpleController.class); + + @GetMapping("/slf4j-guide-request") + public String processList(List list) { + logger.info("Client requested process the following list: {}", list); + try { + logger.debug("Starting process"); + // ...processing list here... + Thread.sleep(500); + } catch (RuntimeException | InterruptedException e) { + logger.error("There was an issue processing the list.", e); + } finally { + logger.info("Finished processing"); + } + return "done"; + } + + @GetMapping("/slf4j-guide-mdc-request") + public String clientMDCRequest(@RequestHeader String clientId) throws InterruptedException { + MDC.put("clientId", clientId); + logger.info("Client {} has made a request", clientId); + logger.info("Starting request"); + Thread.sleep(500); + logger.info("Finished request"); + MDC.clear(); + return "finished"; + } +} diff --git a/flyway/src/main/resources/application.properties b/guest/slf4j/guide/slf4j-log4j/src/main/resources/application.properties similarity index 100% rename from flyway/src/main/resources/application.properties rename to guest/slf4j/guide/slf4j-log4j/src/main/resources/application.properties diff --git a/guest/slf4j/guide/slf4j-log4j/src/main/resources/log4j.xml b/guest/slf4j/guide/slf4j-log4j/src/main/resources/log4j.xml new file mode 100644 index 0000000000..ea432bff77 --- /dev/null +++ b/guest/slf4j/guide/slf4j-log4j/src/main/resources/log4j.xml @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/guest/slf4j/guide/slf4j-log4j/src/test/java/com/stackify/slf4j/guide/controllers/SimpleControllerIntegrationTest.java b/guest/slf4j/guide/slf4j-log4j/src/test/java/com/stackify/slf4j/guide/controllers/SimpleControllerIntegrationTest.java new file mode 100644 index 0000000000..991a1e2686 --- /dev/null +++ b/guest/slf4j/guide/slf4j-log4j/src/test/java/com/stackify/slf4j/guide/controllers/SimpleControllerIntegrationTest.java @@ -0,0 +1,80 @@ +package com.stackify.slf4j.guide.controllers; + +import static org.powermock.api.mockito.PowerMockito.doNothing; +import static org.powermock.api.mockito.PowerMockito.spy; + +import java.util.Collections; + +import org.apache.log4j.Level; +import org.apache.log4j.spi.LoggingEvent; +import org.assertj.core.api.Condition; +import org.assertj.core.api.SoftAssertions; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.powermock.core.classloader.annotations.PrepareForTest; +import org.powermock.modules.junit4.PowerMockRunner; +import org.slf4j.MDC; + +import com.stackify.slf4j.guide.utils.ListAppender; + +@RunWith(PowerMockRunner.class) +@PrepareForTest(MDC.class) +public class SimpleControllerIntegrationTest { + + private SimpleController controller = new SimpleController(); + + @Before + public void clearLogList() { + ListAppender.clearEventList(); + } + + @Test + public void whenSimpleRequestMade_thenAllRegularMessagesLogged() { + String output = controller.processList(Collections.emptyList()); + + SoftAssertions errorCollector = new SoftAssertions(); + errorCollector.assertThat(ListAppender.getEvents()) + .haveAtLeastOne(eventContains("Client requested process the following list: []", Level.INFO)) + .haveAtLeastOne(eventContains("Starting process", Level.DEBUG)) + .haveAtLeastOne(eventContains("Finished processing", Level.INFO)) + .haveExactly(0, eventOfLevel(Level.ERROR)); + errorCollector.assertThat(output) + .isEqualTo("done"); + errorCollector.assertAll(); + } + + @Test + public void givenClientId_whenMDCRequestMade_thenMessagesWithClientIdLogged() throws Exception { + // We avoid cleaning the context so tht we can check it afterwards + spy(MDC.class); + doNothing().when(MDC.class); + MDC.clear(); + String clientId = "id-1234"; + + String output = controller.clientMDCRequest(clientId); + + SoftAssertions errorCollector = new SoftAssertions(); + errorCollector.assertThat(ListAppender.getEvents()) + .allMatch(entry -> { + return clientId.equals(entry.getMDC("clientId")); + }) + .haveAtLeastOne(eventContains("Client id-1234 has made a request", Level.INFO)) + .haveAtLeastOne(eventContains("Starting request", Level.INFO)) + .haveAtLeastOne(eventContains("Finished request", Level.INFO)); + errorCollector.assertThat(output) + .isEqualTo("finished"); + errorCollector.assertAll(); + + } + + private Condition eventOfLevel(Level level) { + return eventContains(null, level); + } + + private Condition eventContains(String substring, Level level) { + + return new Condition(entry -> (substring == null || (entry.getRenderedMessage() != null && entry.getRenderedMessage() + .contains(substring))) && (level == null || level.equals(entry.getLevel())), String.format("entry with message '%s', level %s", substring, level)); + } +} diff --git a/guest/slf4j/guide/slf4j-log4j/src/test/java/com/stackify/slf4j/guide/utils/ListAppender.java b/guest/slf4j/guide/slf4j-log4j/src/test/java/com/stackify/slf4j/guide/utils/ListAppender.java new file mode 100644 index 0000000000..4ce9e73d6d --- /dev/null +++ b/guest/slf4j/guide/slf4j-log4j/src/test/java/com/stackify/slf4j/guide/utils/ListAppender.java @@ -0,0 +1,33 @@ +package com.stackify.slf4j.guide.utils; + +import java.util.ArrayList; +import java.util.List; + +import org.apache.log4j.AppenderSkeleton; +import org.apache.log4j.spi.LoggingEvent; + +public class ListAppender extends AppenderSkeleton { + public static List events = new ArrayList(); + + @Override + public void close() { + } + + @Override + public boolean requiresLayout() { + return false; + } + + @Override + protected void append(LoggingEvent event) { + events.add(event); + } + + public static List getEvents() { + return events; + } + + public static void clearEventList() { + events.clear(); + } +} diff --git a/guest/slf4j/guide/slf4j-log4j/src/test/resources/log4j.xml b/guest/slf4j/guide/slf4j-log4j/src/test/resources/log4j.xml new file mode 100644 index 0000000000..10443e5eab --- /dev/null +++ b/guest/slf4j/guide/slf4j-log4j/src/test/resources/log4j.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/guest/slf4j/guide/slf4j-log4j2/.gitignore b/guest/slf4j/guide/slf4j-log4j2/.gitignore new file mode 100644 index 0000000000..82eca336e3 --- /dev/null +++ b/guest/slf4j/guide/slf4j-log4j2/.gitignore @@ -0,0 +1,25 @@ +/target/ +!.mvn/wrapper/maven-wrapper.jar + +### STS ### +.apt_generated +.classpath +.factorypath +.project +.settings +.springBeans +.sts4-cache + +### IntelliJ IDEA ### +.idea +*.iws +*.iml +*.ipr + +### NetBeans ### +/nbproject/private/ +/build/ +/nbbuild/ +/dist/ +/nbdist/ +/.nb-gradle/ \ No newline at end of file diff --git a/guest/slf4j/guide/slf4j-log4j2/pom.xml b/guest/slf4j/guide/slf4j-log4j2/pom.xml new file mode 100644 index 0000000000..9473362cb8 --- /dev/null +++ b/guest/slf4j/guide/slf4j-log4j2/pom.xml @@ -0,0 +1,54 @@ + + + 4.0.0 + slf4j-log4j2 + 0.0.1-SNAPSHOT + slf4j-log4j2 + jar + + + com.stackify.slf4j.guide + slf4j-parent-module + 1.0.0-SNAPSHOT + .. + + + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework.boot + spring-boot-starter-logging + + + + + org.springframework.boot + spring-boot-starter-log4j2 + + + org.springframework.boot + spring-boot-starter-test + test + + + org.apache.logging.log4j + log4j-core + ${log4j.version} + test-jar + + + org.apache.logging.log4j + log4j-api + ${log4j.version} + test-jar + + + + + 2.11.0 + + diff --git a/guest/slf4j/guide/slf4j-log4j2/src/main/java/com/stackify/slf4j/guide/Application.java b/guest/slf4j/guide/slf4j-log4j2/src/main/java/com/stackify/slf4j/guide/Application.java new file mode 100644 index 0000000000..01ccf519b3 --- /dev/null +++ b/guest/slf4j/guide/slf4j-log4j2/src/main/java/com/stackify/slf4j/guide/Application.java @@ -0,0 +1,12 @@ +package com.stackify.slf4j.guide; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication +public class Application { + + public static void main(String[] args) { + SpringApplication.run(Application.class, args); + } +} diff --git a/guest/slf4j/guide/slf4j-log4j2/src/main/java/com/stackify/slf4j/guide/controllers/SimpleController.java b/guest/slf4j/guide/slf4j-log4j2/src/main/java/com/stackify/slf4j/guide/controllers/SimpleController.java new file mode 100644 index 0000000000..14f4439545 --- /dev/null +++ b/guest/slf4j/guide/slf4j-log4j2/src/main/java/com/stackify/slf4j/guide/controllers/SimpleController.java @@ -0,0 +1,42 @@ +package com.stackify.slf4j.guide.controllers; + +import java.util.List; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.slf4j.MDC; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestHeader; +import org.springframework.web.bind.annotation.RestController; + +@RestController +public class SimpleController { + + Logger logger = LoggerFactory.getLogger(SimpleController.class); + + @GetMapping("/slf4j-guide-request") + public String processList(List list) { + logger.info("Client requested process the following list: {}", list); + try { + logger.debug("Starting process"); + // ...processing list here... + Thread.sleep(500); + } catch (RuntimeException | InterruptedException e) { + logger.error("There was an issue processing the list.", e); + } finally { + logger.info("Finished processing"); + } + return "done"; + } + + @GetMapping("/slf4j-guide-mdc-request") + public String clientMDCRequest(@RequestHeader String clientId) throws InterruptedException { + MDC.put("clientId", clientId); + logger.info("Client {} has made a request", clientId); + logger.info("Starting request"); + Thread.sleep(500); + logger.info("Finished request"); + MDC.clear(); + return "finished"; + } +} diff --git a/spring-boot-logging-log4j2/spring-boot-logging-log4j2-app/src/main/resources/application.properties b/guest/slf4j/guide/slf4j-log4j2/src/main/resources/application.properties similarity index 100% rename from spring-boot-logging-log4j2/spring-boot-logging-log4j2-app/src/main/resources/application.properties rename to guest/slf4j/guide/slf4j-log4j2/src/main/resources/application.properties diff --git a/guest/slf4j/guide/slf4j-log4j2/src/main/resources/log4j2-spring.xml b/guest/slf4j/guide/slf4j-log4j2/src/main/resources/log4j2-spring.xml new file mode 100644 index 0000000000..7d1494c7a6 --- /dev/null +++ b/guest/slf4j/guide/slf4j-log4j2/src/main/resources/log4j2-spring.xml @@ -0,0 +1,28 @@ + + + ???? + %5p + yyyy-MM-dd HH:mm:ss.SSS + %clr{%d{${LOG_DATEFORMAT_PATTERN}}}{faint} %clr{${LOG_LEVEL_PATTERN}} %clr{${sys:PID}}{magenta} + %clr{---}{faint} %clr{%X{clientId}}{red}%clr{@%15.15t}{faint} %clr{%-40.40c{1.}}{cyan} %clr{:}{faint} %m%n + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/guest/slf4j/guide/slf4j-log4j2/src/test/java/com/stackify/slf4j/guide/controllers/SimpleControllerIntegrationTest.java b/guest/slf4j/guide/slf4j-log4j2/src/test/java/com/stackify/slf4j/guide/controllers/SimpleControllerIntegrationTest.java new file mode 100644 index 0000000000..f41c857533 --- /dev/null +++ b/guest/slf4j/guide/slf4j-log4j2/src/test/java/com/stackify/slf4j/guide/controllers/SimpleControllerIntegrationTest.java @@ -0,0 +1,81 @@ +package com.stackify.slf4j.guide.controllers; + +import java.util.Collections; + +import org.apache.logging.log4j.Level; +import org.apache.logging.log4j.core.LogEvent; +import org.apache.logging.log4j.junit.LoggerContextRule; +import org.apache.logging.log4j.test.appender.ListAppender; +import org.assertj.core.api.Condition; +import org.assertj.core.api.SoftAssertions; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.ClassRule; +import org.junit.Test; + +public class SimpleControllerIntegrationTest { + + private static ListAppender appender; + private SimpleController controller = new SimpleController(); + + @ClassRule + public static LoggerContextRule init = new LoggerContextRule("log4j2-test.xml"); + + @BeforeClass + public static void setupLogging() { + appender = init.getListAppender("ListAppender"); + } + + @Before + public void clearAppender() { + appender.clear(); + } + + @Test + public void whenSimpleRequestMade_thenAllRegularMessagesLogged() { + String output = controller.processList(Collections.emptyList()); + + SoftAssertions errorCollector = new SoftAssertions(); + errorCollector.assertThat(appender.getEvents()) + .haveAtLeastOne(eventContains("Client requested process the following list: []", Level.INFO)) + .haveAtLeastOne(eventContains("Starting process", Level.DEBUG)) + .haveAtLeastOne(eventContains("Finished processing", Level.INFO)) + .haveExactly(0, eventOfLevel(Level.ERROR)); + errorCollector.assertThat(output) + .isEqualTo("done"); + errorCollector.assertAll(); + } + + @Test + public void givenClientId_whenMDCRequestMade_thenMessagesWithClientIdLogged() throws Exception { + String clientId = "id-1234"; + + String output = controller.clientMDCRequest(clientId); + + SoftAssertions errorCollector = new SoftAssertions(); + errorCollector.assertThat(appender.getEvents()) + .allMatch(entry -> { + return clientId.equals(entry.getContextData() + .getValue("clientId")); + }) + .haveAtLeastOne(eventContains("Client id-1234 has made a request", Level.INFO)) + .haveAtLeastOne(eventContains("Starting request", Level.INFO)) + .haveAtLeastOne(eventContains("Finished request", Level.INFO)); + errorCollector.assertThat(output) + .isEqualTo("finished"); + errorCollector.assertAll(); + } + + private Condition eventOfLevel(Level level) { + return eventContains(null, level); + } + + private Condition eventContains(String substring, Level level) { + + return new Condition(entry -> (substring == null || (entry.getMessage() + .getFormattedMessage() != null && entry.getMessage() + .getFormattedMessage() + .contains(substring))) + && (level == null || level.equals(entry.getLevel())), String.format("entry with message '%s', level %s", substring, level)); + } +} diff --git a/guest/slf4j/guide/slf4j-log4j2/src/test/resources/log4j2-test.xml b/guest/slf4j/guide/slf4j-log4j2/src/test/resources/log4j2-test.xml new file mode 100644 index 0000000000..2ca386f7f6 --- /dev/null +++ b/guest/slf4j/guide/slf4j-log4j2/src/test/resources/log4j2-test.xml @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/guest/slf4j/guide/slf4j-logback/.gitignore b/guest/slf4j/guide/slf4j-logback/.gitignore new file mode 100644 index 0000000000..82eca336e3 --- /dev/null +++ b/guest/slf4j/guide/slf4j-logback/.gitignore @@ -0,0 +1,25 @@ +/target/ +!.mvn/wrapper/maven-wrapper.jar + +### STS ### +.apt_generated +.classpath +.factorypath +.project +.settings +.springBeans +.sts4-cache + +### IntelliJ IDEA ### +.idea +*.iws +*.iml +*.ipr + +### NetBeans ### +/nbproject/private/ +/build/ +/nbbuild/ +/dist/ +/nbdist/ +/.nb-gradle/ \ No newline at end of file diff --git a/guest/slf4j/guide/slf4j-logback/pom.xml b/guest/slf4j/guide/slf4j-logback/pom.xml new file mode 100644 index 0000000000..0327e79732 --- /dev/null +++ b/guest/slf4j/guide/slf4j-logback/pom.xml @@ -0,0 +1,32 @@ + + + 4.0.0 + slf4j-logback + 0.0.1-SNAPSHOT + slf4j-logback + jar + + + com.stackify.slf4j.guide + slf4j-parent-module + 1.0.0-SNAPSHOT + .. + + + + + org.slf4j + slf4j-ext + + + ch.qos.cal10n + cal10n-api + ${cal10n.version} + + + + + 0.8.1 + + diff --git a/guest/slf4j/guide/slf4j-logback/src/main/java/com/stackify/slf4j/guide/Application.java b/guest/slf4j/guide/slf4j-logback/src/main/java/com/stackify/slf4j/guide/Application.java new file mode 100644 index 0000000000..01ccf519b3 --- /dev/null +++ b/guest/slf4j/guide/slf4j-logback/src/main/java/com/stackify/slf4j/guide/Application.java @@ -0,0 +1,12 @@ +package com.stackify.slf4j.guide; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication +public class Application { + + public static void main(String[] args) { + SpringApplication.run(Application.class, args); + } +} diff --git a/guest/slf4j/guide/slf4j-logback/src/main/java/com/stackify/slf4j/guide/controllers/SimpleController.java b/guest/slf4j/guide/slf4j-logback/src/main/java/com/stackify/slf4j/guide/controllers/SimpleController.java new file mode 100644 index 0000000000..1fab675c94 --- /dev/null +++ b/guest/slf4j/guide/slf4j-logback/src/main/java/com/stackify/slf4j/guide/controllers/SimpleController.java @@ -0,0 +1,133 @@ +package com.stackify.slf4j.guide.controllers; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.Date; +import java.util.List; +import java.util.Locale; +import java.util.UUID; +import java.util.concurrent.ThreadLocalRandom; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.slf4j.MDC; +import org.slf4j.Marker; +import org.slf4j.MarkerFactory; +import org.slf4j.cal10n.LocLogger; +import org.slf4j.cal10n.LocLoggerFactory; +import org.slf4j.ext.EventData; +import org.slf4j.ext.EventLogger; +import org.slf4j.profiler.Profiler; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestHeader; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; + +import com.stackify.slf4j.guide.l10n.Messages; + +import ch.qos.cal10n.IMessageConveyor; +import ch.qos.cal10n.MessageConveyor; + +@RestController +public class SimpleController { + + Logger logger = LoggerFactory.getLogger(SimpleController.class); + + @GetMapping("/slf4j-guide-request") + public String processList(List list) { + logger.info("Client requested process the following list: {}", list); + try { + logger.debug("Starting process"); + // ...processing list here... + Thread.sleep(500); + } catch (RuntimeException | InterruptedException e) { + logger.error("There was an issue processing the list.", e); + } finally { + logger.info("Finished processing"); + } + return "done"; + } + + @GetMapping("/slf4j-guide-mdc-request") + public String clientMDCRequest(@RequestHeader String clientId) throws InterruptedException { + MDC.put("clientId", clientId); + logger.info("Client {} has made a request", clientId); + logger.info("Starting request"); + Thread.sleep(500); + logger.info("Finished request"); + MDC.clear(); + return "finished"; + } + + @GetMapping("/slf4j-guide-marker-request") + public String clientMarkerRequest() throws InterruptedException { + logger.info("client has made a request"); + Marker myMarker = MarkerFactory.getMarker("MYMARKER"); + logger.info(myMarker, "Starting request"); + Thread.sleep(500); + logger.debug(myMarker, "Finished request"); + return "finished"; + } + + @GetMapping("/slf4j-guide-profiler-request") + public String clientProfilerRequest() { + logger.info("client has made a request"); + Profiler myProfiler = new Profiler("MYPROFILER"); + // Associate the logger to handle the output( for testing purposes here) + myProfiler.setLogger(logger); + + myProfiler.start("List generation process"); + List list = generateList(); + + myProfiler.start("List sorting process"); + Collections.sort(list); + + // Use the log() method instead of print() to use the logger (for testing purposes here) + myProfiler.stop() + .log(); + return "finished"; + } + + private List generateList() { + List generated = new ArrayList<>(); + for (int i = 0; i < 5000; i++) { + generated.add(ThreadLocalRandom.current() + .nextInt(2000)); + } + return generated; + } + + @GetMapping("/slf4j-guide-event-request") + public String clientEventRequest(@RequestParam("sender") String sender, @RequestParam("receiver") String receiver) { + logger.info("sending from {} to {}", sender, receiver); + + // ...sending process... + + EventData data = new EventData(); + data.setEventDateTime(new Date()); + data.setEventType("sending"); + String confirm = UUID.randomUUID() + .toString(); + data.setEventId(confirm); + data.put("from", sender); + data.put("to", receiver); + EventLogger.logEvent(data); + + return "finished"; + } + + @GetMapping("/slf4j-guide-locale-request") + public String clientLocaleRequest(@RequestHeader("Accept-Language") String localeHeader) { + List list = Locale.LanguageRange.parse(localeHeader); + Locale locale = Locale.lookup(list, Arrays.asList(Locale.getAvailableLocales())); + IMessageConveyor messageConveyor = new MessageConveyor(locale); + LocLoggerFactory llFactory = new LocLoggerFactory(messageConveyor); + LocLogger locLogger = llFactory.getLocLogger(this.getClass()); + locLogger.info(Messages.CLIENT_REQUEST, "parametrizedClientId", localeHeader); + locLogger.debug(Messages.REQUEST_STARTED); + locLogger.info(Messages.REQUEST_FINISHED); + return "finished"; + } + +} diff --git a/guest/slf4j/guide/slf4j-logback/src/main/java/com/stackify/slf4j/guide/l10n/Messages.java b/guest/slf4j/guide/slf4j-logback/src/main/java/com/stackify/slf4j/guide/l10n/Messages.java new file mode 100644 index 0000000000..e4aacaf3be --- /dev/null +++ b/guest/slf4j/guide/slf4j-logback/src/main/java/com/stackify/slf4j/guide/l10n/Messages.java @@ -0,0 +1,11 @@ +package com.stackify.slf4j.guide.l10n; + +import ch.qos.cal10n.BaseName; +import ch.qos.cal10n.Locale; +import ch.qos.cal10n.LocaleData; + +@BaseName("messages") +@LocaleData({ @Locale("en_US"), @Locale("es_ES") }) +public enum Messages { + CLIENT_REQUEST, REQUEST_STARTED, REQUEST_FINISHED +} diff --git a/guest/slf4j/guide/slf4j-logback/src/main/java/com/stackify/slf4j/guide/xlogger/XLoggerController.java b/guest/slf4j/guide/slf4j-logback/src/main/java/com/stackify/slf4j/guide/xlogger/XLoggerController.java new file mode 100644 index 0000000000..8690c0ebc9 --- /dev/null +++ b/guest/slf4j/guide/slf4j-logback/src/main/java/com/stackify/slf4j/guide/xlogger/XLoggerController.java @@ -0,0 +1,28 @@ +package com.stackify.slf4j.guide.xlogger; + +import org.slf4j.ext.XLogger; +import org.slf4j.ext.XLoggerFactory; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; + +@RestController +public class XLoggerController { + + private XLogger logger = XLoggerFactory.getXLogger(XLoggerController.class); + + @GetMapping("/slf4j-guide-xlogger-request") + public Integer clientXLoggerRequest(@RequestParam("queryParam") Integer queryParam) { + logger.info("Starting process"); + logger.entry(queryParam); + Integer rest = 0; + try { + rest = queryParam % 3; + } catch (RuntimeException anyException) { + logger.catching(anyException); + } + logger.exit(rest); + return rest; + } + +} diff --git a/guest/slf4j/guide/slf4j-logback/src/main/resources/application.properties b/guest/slf4j/guide/slf4j-logback/src/main/resources/application.properties new file mode 100644 index 0000000000..e69de29bb2 diff --git a/guest/slf4j/guide/slf4j-logback/src/main/resources/logback-spring.xml b/guest/slf4j/guide/slf4j-logback/src/main/resources/logback-spring.xml new file mode 100644 index 0000000000..112e79c340 --- /dev/null +++ b/guest/slf4j/guide/slf4j-logback/src/main/resources/logback-spring.xml @@ -0,0 +1,11 @@ + + + + + %marker %d{yyyy-MM-dd HH:mm:ss.SSS} -%5p %X{clientId}@%15.15t %-40.40logger{39} : %m%n + + + + + + \ No newline at end of file diff --git a/guest/slf4j/guide/slf4j-logback/src/main/resources/messages_en_US.properties b/guest/slf4j/guide/slf4j-logback/src/main/resources/messages_en_US.properties new file mode 100644 index 0000000000..a35dd60da3 --- /dev/null +++ b/guest/slf4j/guide/slf4j-logback/src/main/resources/messages_en_US.properties @@ -0,0 +1,3 @@ +CLIENT_REQUEST=Client {0} has made a request using locale {1} +REQUEST_STARTED=Request started +REQUEST_FINISHED=Request finished \ No newline at end of file diff --git a/guest/slf4j/guide/slf4j-logback/src/main/resources/messages_es_ES.properties b/guest/slf4j/guide/slf4j-logback/src/main/resources/messages_es_ES.properties new file mode 100644 index 0000000000..6cdab09236 --- /dev/null +++ b/guest/slf4j/guide/slf4j-logback/src/main/resources/messages_es_ES.properties @@ -0,0 +1,3 @@ +CLIENT_REQUEST=El cliente {0} ha realizado una solicitud usando locale {1} +REQUEST_STARTED=Solicitud iniciada +REQUEST_FINISHED=Solicitud finalizada \ No newline at end of file diff --git a/guest/slf4j/guide/slf4j-logback/src/test/java/com/stackify/slf4j/guide/controllers/SimpleControllerIntegrationTest.java b/guest/slf4j/guide/slf4j-logback/src/test/java/com/stackify/slf4j/guide/controllers/SimpleControllerIntegrationTest.java new file mode 100644 index 0000000000..b870cc9ebd --- /dev/null +++ b/guest/slf4j/guide/slf4j-logback/src/test/java/com/stackify/slf4j/guide/controllers/SimpleControllerIntegrationTest.java @@ -0,0 +1,163 @@ +package com.stackify.slf4j.guide.controllers; + +import static org.powermock.api.mockito.PowerMockito.doNothing; +import static org.powermock.api.mockito.PowerMockito.spy; + +import java.util.Collections; + +import org.assertj.core.api.Condition; +import org.assertj.core.api.SoftAssertions; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.powermock.core.classloader.annotations.PrepareForTest; +import org.powermock.modules.junit4.PowerMockRunner; +import org.slf4j.MDC; + +import com.stackify.slf4j.guide.utils.ListAppender; + +import ch.qos.logback.classic.Level; +import ch.qos.logback.classic.spi.ILoggingEvent; + +@RunWith(PowerMockRunner.class) +@PrepareForTest(MDC.class) +public class SimpleControllerIntegrationTest { + + SimpleController controller = new SimpleController(); + + @Before + public void clearLogList() { + ListAppender.clearEventList(); + } + + @Test + public void whenSimpleRequestMade_thenAllRegularMessagesLogged() { + String output = controller.processList(Collections.emptyList()); + + SoftAssertions errorCollector = new SoftAssertions(); + errorCollector.assertThat(ListAppender.getEvents()) + .haveAtLeastOne(eventContains("Client requested process the following list: []", Level.INFO)) + .haveAtLeastOne(eventContains("Starting process", Level.DEBUG)) + .haveAtLeastOne(eventContains("Finished processing", Level.INFO)) + .haveExactly(0, eventOfLevel(Level.ERROR)); + errorCollector.assertThat(output) + .isEqualTo("done"); + errorCollector.assertAll(); + } + + @Test + public void givenClientId_whenMDCRequestMade_thenMessagesWithClientIdLogged() throws Exception { + // We avoid cleaning the context so tht we can check it afterwards + spy(MDC.class); + doNothing().when(MDC.class); + MDC.clear(); + String clientId = "id-1234"; + + String output = controller.clientMDCRequest(clientId); + + SoftAssertions errorCollector = new SoftAssertions(); + errorCollector.assertThat(ListAppender.getEvents()) + .allMatch(entry -> { + return clientId.equals(entry.getMDCPropertyMap() + .get("clientId")); + }) + .haveAtLeastOne(eventContains("Client id-1234 has made a request", Level.INFO)) + .haveAtLeastOne(eventContains("Starting request", Level.INFO)) + .haveAtLeastOne(eventContains("Finished request", Level.INFO)); + errorCollector.assertThat(output) + .isEqualTo("finished"); + errorCollector.assertAll(); + } + + @Test + public void whenMarkerRequestMade_thenMessagesWithMarkerLogged() throws Exception { + String output = controller.clientMarkerRequest(); + + SoftAssertions errorCollector = new SoftAssertions(); + errorCollector.assertThat(ListAppender.getEvents()) + .haveAtLeastOne(eventContains("client has made a request", Level.INFO)) + .haveAtLeastOne(eventContains("Starting request", Level.INFO, "MYMARKER")) + .haveAtLeastOne(eventContains("Finished request", Level.DEBUG, "MYMARKER")) + .haveExactly(2, eventContains(null, null, "MYMARKER")); + errorCollector.assertThat(output) + .isEqualTo("finished"); + errorCollector.assertAll(); + } + + @Test + public void whenProfilerRequestMade_thenMessagesWithPerformanceLogged() throws Exception { + String output = controller.clientProfilerRequest(); + + SoftAssertions errorCollector = new SoftAssertions(); + errorCollector.assertThat(ListAppender.getEvents()) + .haveAtLeastOne(eventContains("client has made a request", Level.INFO)) + .haveAtLeastOne(eventContains("Profiler [MYPROFILER]", Level.DEBUG)); + errorCollector.assertThat(output) + .isEqualTo("finished"); + errorCollector.assertAll(); + } + + @Test + public void whenEventRequestMade_thenMessagesWithEventLogged() throws Exception { + String sender = "sender"; + String receiver = "receiver"; + String output = controller.clientEventRequest(sender, receiver); + + SoftAssertions errorCollector = new SoftAssertions(); + errorCollector.assertThat(ListAppender.getEvents()) + .haveAtLeastOne(eventContains("sending from sender to receiver", Level.INFO)) + .haveAtLeastOne(eventContains("", Level.INFO)) + .haveAtLeastOne(eventContains("sender", Level.INFO)) + .haveAtLeastOne(eventContains("receiver", Level.INFO)); + errorCollector.assertThat(output) + .isEqualTo("finished"); + errorCollector.assertAll(); + } + + @Test + public void givenESLocale_whenLocaleRequestMade_thenMessagesWithEventLogged() throws Exception { + String locale = "es-ES"; + String output = controller.clientLocaleRequest(locale); + + SoftAssertions errorCollector = new SoftAssertions(); + errorCollector.assertThat(ListAppender.getEvents()) + .haveAtLeastOne(eventContains("El cliente parametrizedClientId ha realizado una solicitud usando locale es-ES", Level.INFO)) + .haveAtLeastOne(eventContains("Solicitud iniciada", Level.DEBUG)) + .haveAtLeastOne(eventContains("Solicitud finalizada", Level.INFO)); + errorCollector.assertThat(output) + .isEqualTo("finished"); + errorCollector.assertAll(); + } + + @Test + public void givenENLocale_whenLocaleRequestMade_thenMessagesWithEventLogged() throws Exception { + String locale = "en-US"; + String output = controller.clientLocaleRequest(locale); + + SoftAssertions errorCollector = new SoftAssertions(); + errorCollector.assertThat(ListAppender.getEvents()) + .haveAtLeastOne(eventContains("Client parametrizedClientId has made a request using locale en-US", Level.INFO)) + .haveAtLeastOne(eventContains("Request started", Level.DEBUG)) + .haveAtLeastOne(eventContains("Request finished", Level.INFO)); + errorCollector.assertThat(output) + .isEqualTo("finished"); + errorCollector.assertAll(); + } + + private Condition eventContains(String substring, Level level) { + return eventContains(substring, level, null); + } + + private Condition eventOfLevel(Level level) { + return eventContains(null, level, null); + } + + private Condition eventContains(String substring, Level level, String markerName) { + + return new Condition(entry -> (substring == null || (entry.getFormattedMessage() != null && entry.getFormattedMessage() + .contains(substring))) && (level == null || level.equals(entry.getLevel())) && (markerName == null || (entry.getMarker() != null + && markerName.equals(entry.getMarker() + .getName()))), + String.format("entry with message '%s', level %s and marker %s", substring, level, markerName)); + } +} diff --git a/guest/slf4j/guide/slf4j-logback/src/test/java/com/stackify/slf4j/guide/utils/ListAppender.java b/guest/slf4j/guide/slf4j-logback/src/test/java/com/stackify/slf4j/guide/utils/ListAppender.java new file mode 100644 index 0000000000..e6d4e47fb2 --- /dev/null +++ b/guest/slf4j/guide/slf4j-logback/src/test/java/com/stackify/slf4j/guide/utils/ListAppender.java @@ -0,0 +1,25 @@ +package com.stackify.slf4j.guide.utils; + +import java.util.ArrayList; +import java.util.List; + +import ch.qos.logback.classic.spi.ILoggingEvent; +import ch.qos.logback.core.AppenderBase; + +public class ListAppender extends AppenderBase { + + static private List events = new ArrayList<>(); + + @Override + protected void append(ILoggingEvent eventObject) { + events.add(eventObject); + } + + public static List getEvents() { + return events; + } + + public static void clearEventList() { + events.clear(); + } +} diff --git a/guest/slf4j/guide/slf4j-logback/src/test/resources/logback-test.xml b/guest/slf4j/guide/slf4j-logback/src/test/resources/logback-test.xml new file mode 100644 index 0000000000..90168a0fea --- /dev/null +++ b/guest/slf4j/guide/slf4j-logback/src/test/resources/logback-test.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/guest/spring-boot-app/pom.xml b/guest/spring-boot-app/pom.xml index 7daa8f668e..423dadbb99 100644 --- a/guest/spring-boot-app/pom.xml +++ b/guest/spring-boot-app/pom.xml @@ -4,6 +4,7 @@ spring-boot-app spring-boot-app 0.0.1-SNAPSHOT + spring-boot-app war diff --git a/guest/spring-mvc/pom.xml b/guest/spring-mvc/pom.xml index c0ef451605..3bffb1530d 100644 --- a/guest/spring-mvc/pom.xml +++ b/guest/spring-mvc/pom.xml @@ -5,8 +5,8 @@ com.stackify.guest spring-mvc 0.0.1-SNAPSHOT - jar spring-mvc + jar Spring MVC sample project diff --git a/guest/thread-pools/pom.xml b/guest/thread-pools/pom.xml index db9a5ac89f..2591cb2746 100644 --- a/guest/thread-pools/pom.xml +++ b/guest/thread-pools/pom.xml @@ -4,7 +4,8 @@ com.stackify thread-pools 0.0.1-SNAPSHOT - + thread-pools + com.baeldung parent-modules diff --git a/guest/tomcat-app/pom.xml b/guest/tomcat-app/pom.xml index 7fd27e869b..9ce77c758a 100644 --- a/guest/tomcat-app/pom.xml +++ b/guest/tomcat-app/pom.xml @@ -4,6 +4,7 @@ com.stackify tomcat-app 0.0.1-SNAPSHOT + tomcat-app war diff --git a/guest/webservices/rest-client/pom.xml b/guest/webservices/rest-client/pom.xml index 5e52b7161c..8508186e86 100644 --- a/guest/webservices/rest-client/pom.xml +++ b/guest/webservices/rest-client/pom.xml @@ -3,6 +3,7 @@ com.stackify rest-client 0.0.1-SNAPSHOT + rest-client war diff --git a/guest/webservices/rest-server/pom.xml b/guest/webservices/rest-server/pom.xml index 4b3d241293..c576924215 100644 --- a/guest/webservices/rest-server/pom.xml +++ b/guest/webservices/rest-server/pom.xml @@ -4,6 +4,7 @@ com.stackify rest-server 0.0.1-SNAPSHOT + rest-server war diff --git a/guest/webservices/spring-rest-service/pom.xml b/guest/webservices/spring-rest-service/pom.xml index 49d35766e8..fcec8a3e12 100644 --- a/guest/webservices/spring-rest-service/pom.xml +++ b/guest/webservices/spring-rest-service/pom.xml @@ -4,6 +4,7 @@ com.stackify spring-rest-service 0.0.1-SNAPSHOT + spring-rest-service war diff --git a/helidon/README.md b/helidon/README.md new file mode 100644 index 0000000000..a092faf9f2 --- /dev/null +++ b/helidon/README.md @@ -0,0 +1,3 @@ +### Relevant articles + +- [Microservices with Oracle Helidon](https://www.baeldung.com/microservices-oracle-helidon) diff --git a/helidon/helidon-mp/pom.xml b/helidon/helidon-mp/pom.xml new file mode 100644 index 0000000000..1f39431886 --- /dev/null +++ b/helidon/helidon-mp/pom.xml @@ -0,0 +1,27 @@ + + + 4.0.0 + helidon-mp + helidon-mp + + + com.baeldung.helidon + helidon + 1.0.0-SNAPSHOT + + + + + io.helidon.microprofile.bundles + helidon-microprofile-1.2 + 0.10.4 + + + org.glassfish.jersey.media + jersey-media-json-binding + 2.26 + + + + diff --git a/helidon/helidon-mp/src/main/java/com/baeldung/microprofile/LibraryApplication.java b/helidon/helidon-mp/src/main/java/com/baeldung/microprofile/LibraryApplication.java new file mode 100644 index 0000000000..58913c8b39 --- /dev/null +++ b/helidon/helidon-mp/src/main/java/com/baeldung/microprofile/LibraryApplication.java @@ -0,0 +1,26 @@ +package com.baeldung.microprofile; + +import com.baeldung.microprofile.web.BookEndpoint; +import io.helidon.common.CollectionsHelper; +import io.helidon.microprofile.server.Server; + +import javax.ws.rs.ApplicationPath; +import javax.ws.rs.core.Application; +import java.util.Set; + +@ApplicationPath("/library") +public class LibraryApplication extends Application { + + @Override + public Set> getClasses() { + return CollectionsHelper.setOf(BookEndpoint.class); + } + + public static void main(String... args) { + Server server = Server.builder() + .addApplication(LibraryApplication.class) + .port(9080) + .build(); + server.start(); + } +} diff --git a/helidon/helidon-mp/src/main/java/com/baeldung/microprofile/model/Book.java b/helidon/helidon-mp/src/main/java/com/baeldung/microprofile/model/Book.java new file mode 100644 index 0000000000..44b7f5428d --- /dev/null +++ b/helidon/helidon-mp/src/main/java/com/baeldung/microprofile/model/Book.java @@ -0,0 +1,50 @@ +package com.baeldung.microprofile.model; + +public class Book { + + private String id; + private String isbn; + private String name; + private String author; + private Integer pages; + + 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 getIsbn() { + return isbn; + } + + public void setIsbn(String isbn) { + this.isbn = isbn; + } + + public String getAuthor() { + return author; + } + + public void setAuthor(String author) { + this.author = author; + } + + public Integer getPages() { + return pages; + } + + public void setPages(Integer pages) { + this.pages = pages; + } +} diff --git a/helidon/helidon-mp/src/main/java/com/baeldung/microprofile/providers/BookListMessageBodyWriter.java b/helidon/helidon-mp/src/main/java/com/baeldung/microprofile/providers/BookListMessageBodyWriter.java new file mode 100644 index 0000000000..f7d0bfc5f7 --- /dev/null +++ b/helidon/helidon-mp/src/main/java/com/baeldung/microprofile/providers/BookListMessageBodyWriter.java @@ -0,0 +1,42 @@ +package com.baeldung.microprofile.providers; + +import com.baeldung.microprofile.model.Book; +import com.baeldung.microprofile.util.BookMapper; + +import javax.json.Json; +import javax.json.JsonArray; +import javax.json.JsonWriter; +import javax.ws.rs.Produces; +import javax.ws.rs.WebApplicationException; +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.MultivaluedMap; +import javax.ws.rs.ext.MessageBodyWriter; +import javax.ws.rs.ext.Provider; +import java.io.IOException; +import java.io.OutputStream; +import java.lang.annotation.Annotation; +import java.lang.reflect.Type; +import java.util.List; + +@Provider +@Produces(MediaType.APPLICATION_JSON) +public class BookListMessageBodyWriter implements MessageBodyWriter> { + + @Override + public boolean isWriteable(Class clazz, Type genericType, Annotation[] annotations, MediaType mediaType) { + return true; + } + + @Override + public long getSize(List books, Class type, Type genericType, Annotation[] annotations, MediaType mediaType) { + return 0; + } + + @Override + public void writeTo(List books, Class type, Type genericType, Annotation[] annotations, MediaType mediaType, MultivaluedMap httpHeaders, OutputStream entityStream) throws IOException, WebApplicationException { + JsonWriter jsonWriter = Json.createWriter(entityStream); + JsonArray jsonArray = BookMapper.map(books); + jsonWriter.writeArray(jsonArray); + jsonWriter.close(); + } +} diff --git a/helidon/helidon-mp/src/main/java/com/baeldung/microprofile/providers/BookMessageBodyReader.java b/helidon/helidon-mp/src/main/java/com/baeldung/microprofile/providers/BookMessageBodyReader.java new file mode 100644 index 0000000000..26ce4c1b64 --- /dev/null +++ b/helidon/helidon-mp/src/main/java/com/baeldung/microprofile/providers/BookMessageBodyReader.java @@ -0,0 +1,30 @@ +package com.baeldung.microprofile.providers; + +import com.baeldung.microprofile.model.Book; +import com.baeldung.microprofile.util.BookMapper; + +import javax.ws.rs.Consumes; +import javax.ws.rs.WebApplicationException; +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.MultivaluedMap; +import javax.ws.rs.ext.MessageBodyReader; +import javax.ws.rs.ext.Provider; +import java.io.IOException; +import java.io.InputStream; +import java.lang.annotation.Annotation; +import java.lang.reflect.Type; + +@Provider +@Consumes(MediaType.APPLICATION_JSON) +public class BookMessageBodyReader implements MessageBodyReader { + + @Override + public boolean isReadable(Class type, Type genericType, Annotation[] annotations, MediaType mediaType) { + return type.equals(Book.class); + } + + @Override + public Book readFrom(Class type, Type genericType, Annotation[] annotations, MediaType mediaType, MultivaluedMap httpHeaders, InputStream entityStream) throws IOException, WebApplicationException { + return BookMapper.map(entityStream); + } +} \ No newline at end of file diff --git a/helidon/helidon-mp/src/main/java/com/baeldung/microprofile/providers/BookMessageBodyWriter.java b/helidon/helidon-mp/src/main/java/com/baeldung/microprofile/providers/BookMessageBodyWriter.java new file mode 100644 index 0000000000..9bc6e89958 --- /dev/null +++ b/helidon/helidon-mp/src/main/java/com/baeldung/microprofile/providers/BookMessageBodyWriter.java @@ -0,0 +1,57 @@ +package com.baeldung.microprofile.providers; + +import com.baeldung.microprofile.model.Book; +import com.baeldung.microprofile.util.BookMapper; + +import javax.json.Json; +import javax.json.JsonObject; +import javax.json.JsonWriter; +import javax.ws.rs.Produces; +import javax.ws.rs.WebApplicationException; +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.MultivaluedMap; +import javax.ws.rs.ext.MessageBodyWriter; +import javax.ws.rs.ext.Provider; +import java.io.IOException; +import java.io.OutputStream; +import java.lang.annotation.Annotation; +import java.lang.reflect.Type; + +@Provider +@Produces(MediaType.APPLICATION_JSON) +public class BookMessageBodyWriter implements MessageBodyWriter { + @Override + public boolean isWriteable(Class type, Type genericType, Annotation[] annotations, MediaType mediaType) { + return type.equals(Book.class); + } + + /* + Deprecated in JAX RS 2.0 + */ + @Override + public long getSize(Book book, Class type, Type genericType, Annotation[] annotations, MediaType mediaType) { + return 0; + } + + /** + * Marsahl Book to OutputStream + * + * @param book + * @param type + * @param genericType + * @param annotations + * @param mediaType + * @param httpHeaders + * @param entityStream + * @throws IOException + * @throws WebApplicationException + */ + @Override + public void writeTo(Book book, Class type, Type genericType, Annotation[] annotations, MediaType mediaType, MultivaluedMap httpHeaders, OutputStream entityStream) throws IOException, WebApplicationException { + JsonWriter jsonWriter = Json.createWriter(entityStream); + JsonObject jsonObject = BookMapper.map(book); + jsonWriter.writeObject(jsonObject); + jsonWriter.close(); + } + +} diff --git a/helidon/helidon-mp/src/main/java/com/baeldung/microprofile/repo/BookManager.java b/helidon/helidon-mp/src/main/java/com/baeldung/microprofile/repo/BookManager.java new file mode 100644 index 0000000000..924cf0ce71 --- /dev/null +++ b/helidon/helidon-mp/src/main/java/com/baeldung/microprofile/repo/BookManager.java @@ -0,0 +1,53 @@ +package com.baeldung.microprofile.repo; + +import com.baeldung.microprofile.model.Book; + +import javax.enterprise.context.ApplicationScoped; +import java.time.LocalDate; +import java.time.format.DateTimeFormatter; +import java.util.ArrayList; +import java.util.List; +import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.ConcurrentMap; +import java.util.concurrent.atomic.AtomicInteger; + +@ApplicationScoped +public class BookManager { + + private DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyyMM"); + private AtomicInteger bookIdGenerator = new AtomicInteger(0); + + private ConcurrentMap inMemoryStore = new ConcurrentHashMap<>(); + + public BookManager() { + Book book = new Book(); + book.setId(getNextId()); + book.setName("Building Microservice With Eclipse MicroProfile"); + book.setIsbn("1"); + book.setAuthor("baeldung"); + book.setPages(420); + inMemoryStore.put(book.getId(), book); + } + + private String getNextId() { + String date = LocalDate.now().format(formatter); + return String.format("%04d-%s", bookIdGenerator.incrementAndGet(), date); + } + + public String add(Book book) { + String id = getNextId(); + book.setId(id); + inMemoryStore.put(id, book); + return id; + } + + public Book get(String id) { + return inMemoryStore.get(id); + } + + public List getAll() { + List books = new ArrayList<>(); + books.addAll(inMemoryStore.values()); + return books; + } +} diff --git a/helidon/helidon-mp/src/main/java/com/baeldung/microprofile/util/BookMapper.java b/helidon/helidon-mp/src/main/java/com/baeldung/microprofile/util/BookMapper.java new file mode 100644 index 0000000000..861b172299 --- /dev/null +++ b/helidon/helidon-mp/src/main/java/com/baeldung/microprofile/util/BookMapper.java @@ -0,0 +1,72 @@ +package com.baeldung.microprofile.util; + +import com.baeldung.microprofile.model.Book; + +import javax.json.*; +import java.io.InputStream; +import java.util.List; + +public class BookMapper { + + public static JsonObject map(Book book) { + JsonObjectBuilder builder = Json.createObjectBuilder(); + addValue(builder, "id", book.getId()); + addValue(builder, "isbn", book.getIsbn()); + addValue(builder, "name", book.getName()); + addValue(builder, "author", book.getAuthor()); + addValue(builder, "pages", book.getPages()); + return builder.build(); + } + + private static void addValue(JsonObjectBuilder builder, String key, Object value) { + if (value != null) { + builder.add(key, value.toString()); + } else { + builder.addNull(key); + } + } + + public static JsonArray map(List books) { + final JsonArrayBuilder arrayBuilder = Json.createArrayBuilder(); + books.forEach(book -> { + JsonObject jsonObject = map(book); + arrayBuilder.add(jsonObject); + }); + return arrayBuilder.build(); + } + + public static Book map(InputStream is) { + try(JsonReader jsonReader = Json.createReader(is)) { + JsonObject jsonObject = jsonReader.readObject(); + Book book = new Book(); + book.setId(getStringFromJson("id", jsonObject)); + book.setIsbn(getStringFromJson("isbn", jsonObject)); + book.setName(getStringFromJson("name", jsonObject)); + book.setAuthor(getStringFromJson("author", jsonObject)); + book.setPages(getIntFromJson("pages",jsonObject)); + return book; + } + } + + private static String getStringFromJson(String key, JsonObject json) { + String returnedString = null; + if (json.containsKey(key)) { + JsonString value = json.getJsonString(key); + if (value != null) { + returnedString = value.getString(); + } + } + return returnedString; + } + + private static Integer getIntFromJson(String key, JsonObject json) { + Integer returnedValue = null; + if (json.containsKey(key)) { + JsonNumber value = json.getJsonNumber(key); + if (value != null) { + returnedValue = value.intValue(); + } + } + return returnedValue; + } +} diff --git a/helidon/helidon-mp/src/main/java/com/baeldung/microprofile/web/BookEndpoint.java b/helidon/helidon-mp/src/main/java/com/baeldung/microprofile/web/BookEndpoint.java new file mode 100644 index 0000000000..13143a5644 --- /dev/null +++ b/helidon/helidon-mp/src/main/java/com/baeldung/microprofile/web/BookEndpoint.java @@ -0,0 +1,42 @@ +package com.baeldung.microprofile.web; + +import com.baeldung.microprofile.model.Book; +import com.baeldung.microprofile.repo.BookManager; + +import javax.enterprise.context.RequestScoped; +import javax.inject.Inject; +import javax.ws.rs.*; +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.Response; +import javax.ws.rs.core.UriBuilder; + +@Path("books") +@RequestScoped +public class BookEndpoint { + + @Inject + private BookManager bookManager; + + @GET + @Path("{id}") + @Produces(MediaType.APPLICATION_JSON) + public Response getBook(@PathParam("id") String id) { + Book book = bookManager.get(id); + return Response.ok(book).build(); + } + + @GET + @Produces(MediaType.APPLICATION_JSON) + public Response getAllBooks() { + return Response.ok(bookManager.getAll()).build(); + } + + @POST + @Consumes(MediaType.APPLICATION_JSON) + public Response add(Book book) { + String bookId = bookManager.add(book); + return Response.created( + UriBuilder.fromResource(this.getClass()).path(bookId).build()) + .build(); + } +} diff --git a/helidon/helidon-mp/src/main/resources/META-INF/beans.xml b/helidon/helidon-mp/src/main/resources/META-INF/beans.xml new file mode 100644 index 0000000000..faae50dfc2 --- /dev/null +++ b/helidon/helidon-mp/src/main/resources/META-INF/beans.xml @@ -0,0 +1,7 @@ + + diff --git a/deltaspike/src/main/resources/logback.xml b/helidon/helidon-mp/src/main/resources/logback.xml similarity index 100% rename from deltaspike/src/main/resources/logback.xml rename to helidon/helidon-mp/src/main/resources/logback.xml diff --git a/helidon/helidon-se/pom.xml b/helidon/helidon-se/pom.xml new file mode 100644 index 0000000000..8982bf048e --- /dev/null +++ b/helidon/helidon-se/pom.xml @@ -0,0 +1,64 @@ + + + 4.0.0 + helidon-se + helidon-se + + + com.baeldung.helidon + helidon + 1.0.0-SNAPSHOT + + + + 0.10.4 + + + + + + io.helidon.config + helidon-config-yaml + ${helidon.version} + + + + + io.helidon.webserver + helidon-webserver + ${helidon.version} + + + io.helidon.webserver + helidon-webserver-netty + ${helidon.version} + runtime + + + io.helidon.webserver + helidon-webserver-json + ${helidon.version} + + + + + io.helidon.security + helidon-security + ${helidon.version} + + + io.helidon.security + helidon-security-provider-http-auth + ${helidon.version} + + + io.helidon.security + helidon-security-integration-webserver + ${helidon.version} + + + + + \ No newline at end of file diff --git a/helidon/helidon-se/src/main/java/com/baeldung/helidon/se/config/ConfigApplication.java b/helidon/helidon-se/src/main/java/com/baeldung/helidon/se/config/ConfigApplication.java new file mode 100644 index 0000000000..acfcdb2373 --- /dev/null +++ b/helidon/helidon-se/src/main/java/com/baeldung/helidon/se/config/ConfigApplication.java @@ -0,0 +1,29 @@ +package com.baeldung.helidon.se.config; + +import io.helidon.config.Config; +import io.helidon.config.ConfigSources; +import io.helidon.config.spi.ConfigSource; + +public class ConfigApplication { + + public static void main(String... args) throws Exception { + + ConfigSource configSource = ConfigSources.classpath("application.yaml").build(); + Config config = Config.builder() + .disableSystemPropertiesSource() + .disableEnvironmentVariablesSource() + .sources(configSource) + .build(); + + int port = config.get("server.port").asInt(); + int pageSize = config.get("web.page-size").asInt(); + boolean debug = config.get("web.debug").asBoolean(); + String userHome = config.get("user.home").asString(); + + System.out.println("port: " + port); + System.out.println("pageSize: " + pageSize); + System.out.println("debug: " + debug); + System.out.println("userHome: " + userHome); + } + +} diff --git a/helidon/helidon-se/src/main/java/com/baeldung/helidon/se/routing/Book.java b/helidon/helidon-se/src/main/java/com/baeldung/helidon/se/routing/Book.java new file mode 100644 index 0000000000..9a591bcc73 --- /dev/null +++ b/helidon/helidon-se/src/main/java/com/baeldung/helidon/se/routing/Book.java @@ -0,0 +1,49 @@ +package com.baeldung.helidon.se.routing; + +public class Book { + private String id; + private String isbn; + private String name; + private String author; + private Integer pages; + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getIsbn() { + return isbn; + } + + public void setIsbn(String isbn) { + this.isbn = isbn; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getAuthor() { + return author; + } + + public void setAuthor(String author) { + this.author = author; + } + + public Integer getPages() { + return pages; + } + + public void setPages(Integer pages) { + this.pages = pages; + } +} \ No newline at end of file diff --git a/helidon/helidon-se/src/main/java/com/baeldung/helidon/se/routing/BookManager.java b/helidon/helidon-se/src/main/java/com/baeldung/helidon/se/routing/BookManager.java new file mode 100644 index 0000000000..2e6e694041 --- /dev/null +++ b/helidon/helidon-se/src/main/java/com/baeldung/helidon/se/routing/BookManager.java @@ -0,0 +1,49 @@ +package com.baeldung.helidon.se.routing; + +import java.time.LocalDate; +import java.time.format.DateTimeFormatter; +import java.util.ArrayList; +import java.util.List; +import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.ConcurrentMap; +import java.util.concurrent.atomic.AtomicInteger; + +public class BookManager { + + private DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyyMM"); + private AtomicInteger bookIdGenerator = new AtomicInteger(0); + + private ConcurrentMap inMemoryStore = new ConcurrentHashMap<>(); + + public BookManager() { + Book book = new Book(); + book.setId(getNextId()); + book.setName("Building Microservice With Oracle Helidon"); + book.setIsbn("11223344"); + book.setAuthor("baeldung"); + book.setPages(560); + inMemoryStore.put(book.getId(), book); + } + + private String getNextId() { + String date = LocalDate.now().format(formatter); + return String.format("%04d-%s", bookIdGenerator.incrementAndGet(), date); + } + + public String add(Book book) { + String id = getNextId(); + book.setId(id); + inMemoryStore.put(id, book); + return id; + } + + public Book get(String id) { + return inMemoryStore.get(id); + } + + public List getAll() { + List books = new ArrayList<>(); + books.addAll(inMemoryStore.values()); + return books; + } +} \ No newline at end of file diff --git a/helidon/helidon-se/src/main/java/com/baeldung/helidon/se/routing/BookResource.java b/helidon/helidon-se/src/main/java/com/baeldung/helidon/se/routing/BookResource.java new file mode 100644 index 0000000000..0648930841 --- /dev/null +++ b/helidon/helidon-se/src/main/java/com/baeldung/helidon/se/routing/BookResource.java @@ -0,0 +1,58 @@ +package com.baeldung.helidon.se.routing; + +import io.helidon.webserver.Routing; +import io.helidon.webserver.ServerRequest; +import io.helidon.webserver.ServerResponse; +import io.helidon.webserver.Service; + +import javax.json.Json; +import javax.json.JsonArray; +import javax.json.JsonArrayBuilder; +import javax.json.JsonObject; +import java.util.List; + +public class BookResource implements Service { + + private BookManager bookManager = new BookManager(); + + @Override + public void update(Routing.Rules rules) { + rules + .get("/", this::books) + .get("/{id}", this::bookById); + } + + private void bookById(ServerRequest serverRequest, ServerResponse serverResponse) { + //get the book with the given id + String id = serverRequest.path().param("id"); + Book book = bookManager.get(id); + JsonObject jsonObject = from(book); + serverResponse.send(jsonObject); + } + + private void books(ServerRequest serverRequest, ServerResponse serverResponse) { + //get all books + List books = bookManager.getAll(); + JsonArray jsonArray = from(books); + serverResponse.send(jsonArray); + } + + private JsonObject from(Book book) { + JsonObject jsonObject = Json.createObjectBuilder() + .add("id", book.getId()) + .add("isbn", book.getIsbn()) + .add("name", book.getName()) + .add("author", book.getAuthor()) + .add("pages", book.getPages()) + .build(); + return jsonObject; + } + + private JsonArray from(List books) { + JsonArrayBuilder jsonArrayBuilder = Json.createArrayBuilder(); + books.forEach(book -> { + jsonArrayBuilder.add(from(book)); + }); + return jsonArrayBuilder.build(); + } +} diff --git a/helidon/helidon-se/src/main/java/com/baeldung/helidon/se/routing/WebApplicationRouting.java b/helidon/helidon-se/src/main/java/com/baeldung/helidon/se/routing/WebApplicationRouting.java new file mode 100644 index 0000000000..1f32d3c528 --- /dev/null +++ b/helidon/helidon-se/src/main/java/com/baeldung/helidon/se/routing/WebApplicationRouting.java @@ -0,0 +1,29 @@ +package com.baeldung.helidon.se.routing; + +import io.helidon.webserver.Routing; +import io.helidon.webserver.ServerConfiguration; +import io.helidon.webserver.WebServer; +import io.helidon.webserver.json.JsonSupport; + +public class WebApplicationRouting { + + public static void main(String... args) throws Exception { + + ServerConfiguration serverConfig = ServerConfiguration.builder() + .port(9080) + .build(); + + Routing routing = Routing.builder() + .register(JsonSupport.get()) + .register("/books", new BookResource()) + .get("/greet", (request, response) -> response.send("Hello World !")) + .build(); + + WebServer.create(serverConfig, routing) + .start() + .thenAccept(ws -> + System.out.println("Server started at: http://localhost:" + ws.port()) + ); + } + +} diff --git a/helidon/helidon-se/src/main/java/com/baeldung/helidon/se/security/MyUser.java b/helidon/helidon-se/src/main/java/com/baeldung/helidon/se/security/MyUser.java new file mode 100644 index 0000000000..e8009a98ad --- /dev/null +++ b/helidon/helidon-se/src/main/java/com/baeldung/helidon/se/security/MyUser.java @@ -0,0 +1,33 @@ +package com.baeldung.helidon.se.security; + +import io.helidon.security.provider.httpauth.UserStore; + +import java.util.Collection; + +public class MyUser implements UserStore.User { + + private String login; + private char[] password; + private Collection roles; + + public MyUser(String login, char[] password, Collection roles) { + this.login = login; + this.password = password; + this.roles = roles; + } + + @Override + public String getLogin() { + return login; + } + + @Override + public char[] getPassword() { + return password; + } + + @Override + public Collection getRoles() { + return roles; + } +} diff --git a/helidon/helidon-se/src/main/java/com/baeldung/helidon/se/security/WebApplicationSecurity.java b/helidon/helidon-se/src/main/java/com/baeldung/helidon/se/security/WebApplicationSecurity.java new file mode 100644 index 0000000000..9a67f3d716 --- /dev/null +++ b/helidon/helidon-se/src/main/java/com/baeldung/helidon/se/security/WebApplicationSecurity.java @@ -0,0 +1,61 @@ +package com.baeldung.helidon.se.security; + +import io.helidon.config.Config; +import io.helidon.security.Security; +import io.helidon.security.SubjectType; +import io.helidon.security.provider.httpauth.HttpBasicAuthProvider; +import io.helidon.security.provider.httpauth.UserStore; +import io.helidon.security.webserver.WebSecurity; +import io.helidon.webserver.Routing; +import io.helidon.webserver.ServerConfiguration; +import io.helidon.webserver.WebServer; + +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import java.util.Optional; + +public class WebApplicationSecurity { + + public static void main(String... args) throws Exception { + + Config config = Config.create(); + ServerConfiguration serverConfig = + ServerConfiguration.fromConfig(config.get("server")); + + Map users = new HashMap<>(); + users.put("user", new MyUser("user", "user".toCharArray(), Arrays.asList("ROLE_USER"))); + users.put("admin", new MyUser("admin", "admin".toCharArray(), Arrays.asList("ROLE_USER", "ROLE_ADMIN"))); + UserStore store = user -> Optional.ofNullable(users.get(user)); + + HttpBasicAuthProvider httpBasicAuthProvider = HttpBasicAuthProvider.builder() + .realm("myRealm") + .subjectType(SubjectType.USER) + .userStore(store) + .build(); + + //1. Using Builder Pattern or Config Pattern + Security security = Security.builder() + .addAuthenticationProvider(httpBasicAuthProvider) + .build(); + //Security security = Security.fromConfig(config); + + //2. WebSecurity from Security or from Config + // WebSecurity webSecurity = WebSecurity.from(security) + // .securityDefaults(WebSecurity.authenticate()); + + WebSecurity webSecurity = WebSecurity.from(config); + + Routing routing = Routing.builder() + .register(webSecurity) + .get("/user", (request, response) -> response.send("Hello, I'm a Helidon SE user with ROLE_USER")) + .get("/admin", (request, response) -> response.send("Hello, I'm a Helidon SE user with ROLE_ADMIN")) + .build(); + + WebServer webServer = WebServer.create(serverConfig, routing); + + webServer.start().thenAccept(ws -> + System.out.println("Server started at: http://localhost:" + ws.port()) + ); + } +} diff --git a/helidon/helidon-se/src/main/java/com/baeldung/helidon/se/webserver/SimpleWebApplication.java b/helidon/helidon-se/src/main/java/com/baeldung/helidon/se/webserver/SimpleWebApplication.java new file mode 100644 index 0000000000..0a603a5123 --- /dev/null +++ b/helidon/helidon-se/src/main/java/com/baeldung/helidon/se/webserver/SimpleWebApplication.java @@ -0,0 +1,26 @@ +package com.baeldung.helidon.se.webserver; + +import io.helidon.webserver.Routing; +import io.helidon.webserver.ServerConfiguration; +import io.helidon.webserver.WebServer; + +public class SimpleWebApplication { + + public static void main(String... args) throws Exception { + + ServerConfiguration serverConfig = ServerConfiguration.builder() + .port(9001) + .build(); + + Routing routing = Routing.builder() + .get("/greet", (request, response) -> response.send("Hello World !")) + .build(); + + WebServer.create(serverConfig, routing) + .start() + .thenAccept(ws -> + System.out.println("Server started at: http://localhost:" + ws.port()) + ); + } + +} diff --git a/helidon/helidon-se/src/main/resources/application.json b/helidon/helidon-se/src/main/resources/application.json new file mode 100644 index 0000000000..9e26dfeeb6 --- /dev/null +++ b/helidon/helidon-se/src/main/resources/application.json @@ -0,0 +1 @@ +{} \ No newline at end of file diff --git a/helidon/helidon-se/src/main/resources/application.properties b/helidon/helidon-se/src/main/resources/application.properties new file mode 100644 index 0000000000..062047de4a --- /dev/null +++ b/helidon/helidon-se/src/main/resources/application.properties @@ -0,0 +1,4 @@ +server.port=9080 +web.debug=true +web.page-size=15 +user.home=C:/Users/app \ No newline at end of file diff --git a/helidon/helidon-se/src/main/resources/application.yaml b/helidon/helidon-se/src/main/resources/application.yaml new file mode 100644 index 0000000000..b6dd6cec22 --- /dev/null +++ b/helidon/helidon-se/src/main/resources/application.yaml @@ -0,0 +1,33 @@ +server: + port: 9080 +web: + debug: true + page-size: 15 +user: + home: C:/Users/app + +#Config 4 Security ==> Mapped to Security Object +security: + providers: + - http-basic-auth: + realm: "myRealm" + principal-type: USER # Can be USER or SERVICE, default is USER + users: + - login: "user" + password: "user" + roles: ["ROLE_USER"] + - login: "admin" + password: "admin" + roles: ["ROLE_USER", "ROLE_ADMIN"] + + #Config 4 Security Web Server Integration ==> Mapped to WebSecurity Object + web-server: + securityDefaults: + authenticate: true + paths: + - path: "/user" + methods: ["get"] + roles-allowed: ["ROLE_USER", "ROLE_ADMIN"] + - path: "/admin" + methods: ["get"] + roles-allowed: ["ROLE_ADMIN"] \ No newline at end of file diff --git a/helidon/pom.xml b/helidon/pom.xml new file mode 100644 index 0000000000..85bab4db42 --- /dev/null +++ b/helidon/pom.xml @@ -0,0 +1,21 @@ + + + 4.0.0 + com.baeldung.helidon + helidon + helidon + pom + + + com.baeldung + parent-modules + 1.0.0-SNAPSHOT + + + + helidon-se + helidon-mp + + + diff --git a/hibernate5/src/main/java/com/baeldung/hibernate/entities/DeptEmployee.java b/hibernate5/src/main/java/com/baeldung/hibernate/entities/DeptEmployee.java deleted file mode 100644 index 7a51009b62..0000000000 --- a/hibernate5/src/main/java/com/baeldung/hibernate/entities/DeptEmployee.java +++ /dev/null @@ -1,65 +0,0 @@ -package com.baeldung.hibernate.entities; - -import javax.persistence.*; - -@Entity -public class DeptEmployee { - @Id - @GeneratedValue(strategy = GenerationType.SEQUENCE) - private long id; - - private String employeeNumber; - - private String designation; - - private String name; - - @ManyToOne - private Department department; - - public DeptEmployee(String name, String employeeNumber, Department department) { - this.name = name; - this.employeeNumber = employeeNumber; - this.department = department; - } - - 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 Department getDepartment() { - return department; - } - - public void setDepartment(Department department) { - this.department = department; - } - - public String getDesignation() { - return designation; - } - - public void setDesignation(String designation) { - this.designation = designation; - } -} diff --git a/image-processing/pom.xml b/image-processing/pom.xml index fe8001ae3a..ce75145dc7 100644 --- a/image-processing/pom.xml +++ b/image-processing/pom.xml @@ -2,10 +2,10 @@ 4.0.0 - com.baeldung image-processing 1.0-SNAPSHOT - + image-processing + com.baeldung parent-modules diff --git a/immutables/pom.xml b/immutables/pom.xml index 17510690b0..efb21e584a 100644 --- a/immutables/pom.xml +++ b/immutables/pom.xml @@ -3,8 +3,8 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 immutables - 1.0.0-SNAPSHOT - + immutables + com.baeldung parent-modules diff --git a/jackson/README.md b/jackson/README.md index a05c95de94..04e88d0ea1 100644 --- a/jackson/README.md +++ b/jackson/README.md @@ -36,3 +36,4 @@ The "REST With Spring" Classes: http://bit.ly/restwithspring - [Jackson – Change Name of Field](http://www.baeldung.com/jackson-name-of-property) - [Serialize Only Fields that meet a Custom Criteria with Jackson](http://www.baeldung.com/jackson-serialize-field-custom-criteria) - [Mapping Nested Values with Jackson](http://www.baeldung.com/jackson-nested-values) +- [Convert XML to JSON Using Jackson](https://www.baeldung.com/jackson-convert-xml-json) diff --git a/jackson/src/test/java/com/baeldung/jackson/xmlToJson/XmlToJsonUnitTest.java b/jackson/src/test/java/com/baeldung/jackson/xmlToJson/XmlToJsonUnitTest.java index 295bb9d6e8..6329a8ed2f 100644 --- a/jackson/src/test/java/com/baeldung/jackson/xmlToJson/XmlToJsonUnitTest.java +++ b/jackson/src/test/java/com/baeldung/jackson/xmlToJson/XmlToJsonUnitTest.java @@ -1,7 +1,5 @@ package com.baeldung.jackson.xmlToJson; - -import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.dataformat.xml.XmlMapper; @@ -14,43 +12,32 @@ import java.io.IOException; public class XmlToJsonUnitTest { @Test - public void givenAnXML_whenUseDataBidingToConvertToJSON_thenReturnDataOK() { + public void givenAnXML_whenUseDataBidingToConvertToJSON_thenReturnDataOK() throws IOException{ String flowerXML = "PoppyRED9"; - try { - XmlMapper xmlMapper = new XmlMapper(); - Flower poppy = xmlMapper.readValue(flowerXML, Flower.class); + XmlMapper xmlMapper = new XmlMapper(); + Flower poppy = xmlMapper.readValue(flowerXML, Flower.class); - assertEquals(poppy.getName(), "Poppy"); - assertEquals(poppy.getColor(), Color.RED); - assertEquals(poppy.getPetals(), new Integer(9)); + assertEquals(poppy.getName(), "Poppy"); + assertEquals(poppy.getColor(), Color.RED); + assertEquals(poppy.getPetals(), new Integer(9)); - ObjectMapper mapper = new ObjectMapper(); - String json = mapper.writeValueAsString(poppy); + ObjectMapper mapper = new ObjectMapper(); + String json = mapper.writeValueAsString(poppy); - assertEquals(json, "{\"name\":\"Poppy\",\"color\":\"RED\",\"petals\":9}"); - System.out.println(json); - } catch(IOException e) { - e.printStackTrace(); - } + assertEquals(json, "{\"name\":\"Poppy\",\"color\":\"RED\",\"petals\":9}"); } @Test - public void givenAnXML_whenUseATreeConvertToJSON_thenReturnDataOK() { + public void givenAnXML_whenUseATreeConvertToJSON_thenReturnDataOK() throws IOException { String flowerXML = "PoppyRED9"; - try { - XmlMapper xmlMapper = new XmlMapper(); - JsonNode node = xmlMapper.readTree(flowerXML.getBytes()); + XmlMapper xmlMapper = new XmlMapper(); + JsonNode node = xmlMapper.readTree(flowerXML.getBytes()); - ObjectMapper jsonMapper = new ObjectMapper(); - String json = jsonMapper.writeValueAsString(node); + ObjectMapper jsonMapper = new ObjectMapper(); + String json = jsonMapper.writeValueAsString(node); - System.out.println(json); - - assertEquals(json, "{\"name\":\"Poppy\",\"color\":\"RED\",\"petals\":\"9\"}"); - } catch(IOException e) { - e.printStackTrace(); - } + assertEquals(json, "{\"name\":\"Poppy\",\"color\":\"RED\",\"petals\":\"9\"}"); } } diff --git a/java-collections-conversions/README.md b/java-collections-conversions/README.md new file mode 100644 index 0000000000..0f89e07d63 --- /dev/null +++ b/java-collections-conversions/README.md @@ -0,0 +1,12 @@ +========= + +## Java Collections Cookbooks and Examples + +### Relevant Articles: +- [Converting between an Array and a List in Java](http://www.baeldung.com/convert-array-to-list-and-list-to-array) +- [Converting between an Array and a Set in Java](http://www.baeldung.com/convert-array-to-set-and-set-to-array) +- [Converting between a List and a Set in Java](http://www.baeldung.com/convert-list-to-set-and-set-to-list) +- [Convert a Map to an Array, List or Set in Java](http://www.baeldung.com/convert-map-values-to-array-list-set) +- [Converting a List to String in Java](http://www.baeldung.com/java-list-to-string) +- [How to Convert List to Map in Java](http://www.baeldung.com/java-list-to-map) +- [Array to String Conversions](https://www.baeldung.com/java-array-to-string) diff --git a/java-collections-conversions/pom.xml b/java-collections-conversions/pom.xml new file mode 100644 index 0000000000..9b54652001 --- /dev/null +++ b/java-collections-conversions/pom.xml @@ -0,0 +1,40 @@ + + 4.0.0 + java-collections-conversions + 0.1.0-SNAPSHOT + jar + java-collections-conversions + + + com.baeldung + parent-java + 0.0.1-SNAPSHOT + ../parent-java + + + + + org.apache.commons + commons-collections4 + ${commons-collections4.version} + + + org.apache.commons + commons-lang3 + ${commons-lang3.version} + + + org.assertj + assertj-core + ${assertj.version} + test + + + + + 3.5 + 4.1 + 3.6.1 + + diff --git a/core-java-collections/src/main/java/com/baeldung/convertcollectiontoarraylist/Foo.java b/java-collections-conversions/src/main/java/com/baeldung/convertcollectiontoarraylist/Foo.java similarity index 100% rename from core-java-collections/src/main/java/com/baeldung/convertcollectiontoarraylist/Foo.java rename to java-collections-conversions/src/main/java/com/baeldung/convertcollectiontoarraylist/Foo.java diff --git a/core-java-collections/src/main/java/com/baeldung/convertlisttomap/Animal.java b/java-collections-conversions/src/main/java/com/baeldung/convertlisttomap/Animal.java similarity index 100% rename from core-java-collections/src/main/java/com/baeldung/convertlisttomap/Animal.java rename to java-collections-conversions/src/main/java/com/baeldung/convertlisttomap/Animal.java diff --git a/core-java-collections/src/main/java/com/baeldung/convertlisttomap/ConvertListToMapService.java b/java-collections-conversions/src/main/java/com/baeldung/convertlisttomap/ConvertListToMapService.java similarity index 100% rename from core-java-collections/src/main/java/com/baeldung/convertlisttomap/ConvertListToMapService.java rename to java-collections-conversions/src/main/java/com/baeldung/convertlisttomap/ConvertListToMapService.java diff --git a/ejb/ejb-client/src/main/resources/logback.xml b/java-collections-conversions/src/main/resources/logback.xml similarity index 100% rename from ejb/ejb-client/src/main/resources/logback.xml rename to java-collections-conversions/src/main/resources/logback.xml diff --git a/core-java-collections/src/test/java/com/baeldung/convertcollectiontoarraylist/FooUnitTest.java b/java-collections-conversions/src/test/java/com/baeldung/convertcollectiontoarraylist/FooUnitTest.java similarity index 100% rename from core-java-collections/src/test/java/com/baeldung/convertcollectiontoarraylist/FooUnitTest.java rename to java-collections-conversions/src/test/java/com/baeldung/convertcollectiontoarraylist/FooUnitTest.java diff --git a/core-java-collections/src/test/java/com/baeldung/convertlisttomap/ConvertListToMapServiceUnitTest.java b/java-collections-conversions/src/test/java/com/baeldung/convertlisttomap/ConvertListToMapServiceUnitTest.java similarity index 100% rename from core-java-collections/src/test/java/com/baeldung/convertlisttomap/ConvertListToMapServiceUnitTest.java rename to java-collections-conversions/src/test/java/com/baeldung/convertlisttomap/ConvertListToMapServiceUnitTest.java diff --git a/core-java-collections/src/test/java/com/baeldung/convertlisttomap/ConvertListWithDiplicatedIdToMapServiceUnitTest.java b/java-collections-conversions/src/test/java/com/baeldung/convertlisttomap/ConvertListWithDiplicatedIdToMapServiceUnitTest.java similarity index 100% rename from core-java-collections/src/test/java/com/baeldung/convertlisttomap/ConvertListWithDiplicatedIdToMapServiceUnitTest.java rename to java-collections-conversions/src/test/java/com/baeldung/convertlisttomap/ConvertListWithDiplicatedIdToMapServiceUnitTest.java diff --git a/java-collections-conversions/src/test/java/org/baeldung/convertarraytostring/ArrayToStringUnitTest.java b/java-collections-conversions/src/test/java/org/baeldung/convertarraytostring/ArrayToStringUnitTest.java new file mode 100644 index 0000000000..b563475997 --- /dev/null +++ b/java-collections-conversions/src/test/java/org/baeldung/convertarraytostring/ArrayToStringUnitTest.java @@ -0,0 +1,136 @@ +package org.baeldung.convertarraytostring; + +import java.util.Arrays; +import java.util.List; +import java.util.stream.Collectors; + +import org.apache.commons.lang3.StringUtils; +import org.junit.Test; + +import com.google.common.base.Joiner; +import com.google.common.base.Splitter; + +import static org.hamcrest.CoreMatchers.instanceOf; +import static org.hamcrest.MatcherAssert.assertThat; +import static org.junit.Assert.assertEquals; + +public class ArrayToStringUnitTest { + + // convert with Java + + @Test + public void givenAStringArray_whenConvertBeforeJava8_thenReturnString() { + + String[] strArray = { "Convert", "Array", "With", "Java" }; + StringBuilder stringBuilder = new StringBuilder(); + + for (int i = 0; i < strArray.length; i++) { + stringBuilder.append(strArray[i]); + } + String joinedString = stringBuilder.toString(); + + assertThat(joinedString, instanceOf(String.class)); + assertEquals("ConvertArrayWithJava", joinedString); + } + + @Test + public void givenAString_whenConvertBeforeJava8_thenReturnStringArray() { + + String input = "lorem ipsum dolor sit amet"; + String[] strArray = input.split(" "); + + assertThat(strArray, instanceOf(String[].class)); + assertEquals(5, strArray.length); + + input = "loremipsum"; + strArray = input.split(""); + assertThat(strArray, instanceOf(String[].class)); + assertEquals(10, strArray.length); + } + + @Test + public void givenAnIntArray_whenConvertBeforeJava8_thenReturnString() { + + int[] strArray = { 1, 2, 3, 4, 5 }; + StringBuilder stringBuilder = new StringBuilder(); + + for (int i = 0; i < strArray.length; i++) { + stringBuilder.append(Integer.valueOf(strArray[i])); + } + String joinedString = stringBuilder.toString(); + + assertThat(joinedString, instanceOf(String.class)); + assertEquals("12345", joinedString); + } + + // convert with Java Stream API + + @Test + public void givenAStringArray_whenConvertWithJavaStream_thenReturnString() { + + String[] strArray = { "Convert", "With", "Java", "Streams" }; + String joinedString = Arrays.stream(strArray) + .collect(Collectors.joining()); + assertThat(joinedString, instanceOf(String.class)); + assertEquals("ConvertWithJavaStreams", joinedString); + + joinedString = Arrays.stream(strArray) + .collect(Collectors.joining(",")); + assertThat(joinedString, instanceOf(String.class)); + assertEquals("Convert,With,Java,Streams", joinedString); + } + + + // convert with Apache Commons + + @Test + public void givenAStringArray_whenConvertWithApacheCommons_thenReturnString() { + + String[] strArray = { "Convert", "With", "Apache", "Commons" }; + String joinedString = StringUtils.join(strArray); + + assertThat(joinedString, instanceOf(String.class)); + assertEquals("ConvertWithApacheCommons", joinedString); + } + + @Test + public void givenAString_whenConvertWithApacheCommons_thenReturnStringArray() { + + String input = "lorem ipsum dolor sit amet"; + String[] strArray = StringUtils.split(input, " "); + + assertThat(strArray, instanceOf(String[].class)); + assertEquals(5, strArray.length); + } + + + // convert with Guava + + @Test + public void givenAStringArray_whenConvertWithGuava_thenReturnString() { + + String[] strArray = { "Convert", "With", "Guava", null }; + String joinedString = Joiner.on("") + .skipNulls() + .join(strArray); + + assertThat(joinedString, instanceOf(String.class)); + assertEquals("ConvertWithGuava", joinedString); + } + + + @Test + public void givenAString_whenConvertWithGuava_thenReturnStringArray() { + + String input = "lorem ipsum dolor sit amet"; + + List resultList = Splitter.on(' ') + .trimResults() + .omitEmptyStrings() + .splitToList(input); + String[] strArray = resultList.toArray(new String[0]); + + assertThat(strArray, instanceOf(String[].class)); + assertEquals(5, strArray.length); + } +} diff --git a/core-java-collections/src/test/java/org/baeldung/java/collections/JavaCollectionConversionUnitTest.java b/java-collections-conversions/src/test/java/org/baeldung/java/collections/JavaCollectionConversionUnitTest.java similarity index 100% rename from core-java-collections/src/test/java/org/baeldung/java/collections/JavaCollectionConversionUnitTest.java rename to java-collections-conversions/src/test/java/org/baeldung/java/collections/JavaCollectionConversionUnitTest.java diff --git a/core-java-collections/src/test/java/org/baeldung/java/lists/ListToSTring.java b/java-collections-conversions/src/test/java/org/baeldung/java/lists/ListToSTring.java similarity index 100% rename from core-java-collections/src/test/java/org/baeldung/java/lists/ListToSTring.java rename to java-collections-conversions/src/test/java/org/baeldung/java/lists/ListToSTring.java diff --git a/java-collections-maps/README.md b/java-collections-maps/README.md new file mode 100644 index 0000000000..a6037a3c57 --- /dev/null +++ b/java-collections-maps/README.md @@ -0,0 +1,19 @@ +========= + +## Java Collections Cookbooks and Examples + +### Relevant Articles: +- [Guide to WeakHashMap in Java](http://www.baeldung.com/java-weakhashmap) +- [Guide to the Guava BiMap](http://www.baeldung.com/guava-bimap) +- [The Java HashMap Under the Hood](http://www.baeldung.com/java-hashmap) +- [A Guide to LinkedHashMap in Java](http://www.baeldung.com/java-linked-hashmap) +- [A Guide to TreeMap in Java](http://www.baeldung.com/java-treemap) +- [Iterate over a Map in Java](http://www.baeldung.com/java-iterate-map) +- [Java TreeMap vs HashMap](http://www.baeldung.com/java-treemap-vs-hashmap) +- [How to Store Duplicate Keys in a Map in Java?](http://www.baeldung.com/java-map-duplicate-keys) +- [Initialize a HashMap in Java](https://www.baeldung.com/java-initialize-hashmap) +- [Get the Key for a Value from a Java Map](https://www.baeldung.com/java-map-key-from-value) +- [Sort a HashMap in Java](https://www.baeldung.com/java-hashmap-sort) +- [Finding the Highest Value in a Java Map](https://www.baeldung.com/java-find-map-max) +- [Merging Two Maps with Java 8](https://www.baeldung.com/java-merge-maps) +- [How to Check If a Key Exists in a Map](https://www.baeldung.com/java-map-key-exists) diff --git a/java-collections-maps/pom.xml b/java-collections-maps/pom.xml new file mode 100644 index 0000000000..0803866c51 --- /dev/null +++ b/java-collections-maps/pom.xml @@ -0,0 +1,54 @@ + + 4.0.0 + java-collections-maps + 0.1.0-SNAPSHOT + jar + java-collections-maps + + + com.baeldung + parent-java + 0.0.1-SNAPSHOT + ../parent-java + + + + + org.apache.commons + commons-collections4 + ${commons-collections4.version} + + + com.jayway.awaitility + awaitility + ${avaitility.version} + test + + + org.apache.commons + commons-lang3 + ${commons-lang3.version} + + + org.assertj + assertj-core + ${assertj.version} + test + + + one.util + streamex + 0.6.5 + + + + + 3.5 + 4.1 + 4.01 + 1.7.0 + 3.6.1 + 7.1.0 + + diff --git a/core-java-collections/src/main/java/com/baeldung/java/map/MapUtil.java b/java-collections-maps/src/main/java/com/baeldung/java/map/MapUtil.java similarity index 100% rename from core-java-collections/src/main/java/com/baeldung/java/map/MapUtil.java rename to java-collections-maps/src/main/java/com/baeldung/java/map/MapUtil.java diff --git a/core-java-collections/src/main/java/com/baeldung/java/map/MyKey.java b/java-collections-maps/src/main/java/com/baeldung/java/map/MyKey.java similarity index 100% rename from core-java-collections/src/main/java/com/baeldung/java/map/MyKey.java rename to java-collections-maps/src/main/java/com/baeldung/java/map/MyKey.java diff --git a/core-java-collections/src/main/java/com/baeldung/java/map/MyLinkedHashMap.java b/java-collections-maps/src/main/java/com/baeldung/java/map/MyLinkedHashMap.java similarity index 100% rename from core-java-collections/src/main/java/com/baeldung/java/map/MyLinkedHashMap.java rename to java-collections-maps/src/main/java/com/baeldung/java/map/MyLinkedHashMap.java diff --git a/core-java-collections/src/main/java/com/baeldung/java/map/initialize/MapInitializer.java b/java-collections-maps/src/main/java/com/baeldung/java/map/initialize/MapInitializer.java similarity index 100% rename from core-java-collections/src/main/java/com/baeldung/java/map/initialize/MapInitializer.java rename to java-collections-maps/src/main/java/com/baeldung/java/map/initialize/MapInitializer.java diff --git a/core-java-collections/src/main/java/com/baeldung/map/iteration/MapIteration.java b/java-collections-maps/src/main/java/com/baeldung/map/iteration/MapIteration.java similarity index 100% rename from core-java-collections/src/main/java/com/baeldung/map/iteration/MapIteration.java rename to java-collections-maps/src/main/java/com/baeldung/map/iteration/MapIteration.java diff --git a/core-java-collections/src/main/java/com/baeldung/map/java_8/MergeMaps.java b/java-collections-maps/src/main/java/com/baeldung/map/java_8/MergeMaps.java similarity index 100% rename from core-java-collections/src/main/java/com/baeldung/map/java_8/MergeMaps.java rename to java-collections-maps/src/main/java/com/baeldung/map/java_8/MergeMaps.java diff --git a/core-java-collections/src/main/java/com/baeldung/map/util/MapMax.java b/java-collections-maps/src/main/java/com/baeldung/map/util/MapMax.java similarity index 100% rename from core-java-collections/src/main/java/com/baeldung/map/util/MapMax.java rename to java-collections-maps/src/main/java/com/baeldung/map/util/MapMax.java diff --git a/core-java-collections/src/main/java/com/baeldung/sort/Employee.java b/java-collections-maps/src/main/java/com/baeldung/sort/Employee.java similarity index 100% rename from core-java-collections/src/main/java/com/baeldung/sort/Employee.java rename to java-collections-maps/src/main/java/com/baeldung/sort/Employee.java diff --git a/core-java-collections/src/main/java/com/baeldung/sort/SortHashMap.java b/java-collections-maps/src/main/java/com/baeldung/sort/SortHashMap.java similarity index 100% rename from core-java-collections/src/main/java/com/baeldung/sort/SortHashMap.java rename to java-collections-maps/src/main/java/com/baeldung/sort/SortHashMap.java diff --git a/ejb/ejb-remote/src/main/resources/logback.xml b/java-collections-maps/src/main/resources/logback.xml similarity index 100% rename from ejb/ejb-remote/src/main/resources/logback.xml rename to java-collections-maps/src/main/resources/logback.xml diff --git a/core-java-collections/src/test/java/com/baeldung/collection/WhenComparingTreeMapVsHashMap.java b/java-collections-maps/src/test/java/com/baeldung/collection/WhenComparingTreeMapVsHashMap.java similarity index 100% rename from core-java-collections/src/test/java/com/baeldung/collection/WhenComparingTreeMapVsHashMap.java rename to java-collections-maps/src/test/java/com/baeldung/collection/WhenComparingTreeMapVsHashMap.java diff --git a/core-java/src/test/java/com/baeldung/guava/GuavaBiMapUnitTest.java b/java-collections-maps/src/test/java/com/baeldung/guava/GuavaBiMapUnitTest.java similarity index 100% rename from core-java/src/test/java/com/baeldung/guava/GuavaBiMapUnitTest.java rename to java-collections-maps/src/test/java/com/baeldung/guava/GuavaBiMapUnitTest.java diff --git a/java-collections-maps/src/test/java/com/baeldung/java/map/ImmutableMapUnitTest.java b/java-collections-maps/src/test/java/com/baeldung/java/map/ImmutableMapUnitTest.java new file mode 100644 index 0000000000..b239ae07d8 --- /dev/null +++ b/java-collections-maps/src/test/java/com/baeldung/java/map/ImmutableMapUnitTest.java @@ -0,0 +1,87 @@ +package com.baeldung.java.map; + +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertThrows; +import static org.junit.jupiter.api.Assertions.assertTrue; + +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; + +import org.junit.jupiter.api.Test; + +import com.google.common.collect.ImmutableMap; + + +public class ImmutableMapUnitTest { + + @Test + public void whenCollectionsUnModifiableMapMethod_thenOriginalCollectionChangesReflectInUnmodifiableMap() { + + Map mutableMap = new HashMap<>(); + mutableMap.put("USA", "North America"); + + Map unmodifiableMap = Collections.unmodifiableMap(mutableMap); + assertThrows(UnsupportedOperationException.class, () -> unmodifiableMap.put("Canada", "North America")); + + mutableMap.remove("USA"); + assertFalse(unmodifiableMap.containsKey("USA")); + + mutableMap.put("Mexico", "North America"); + assertTrue(unmodifiableMap.containsKey("Mexico")); + } + + @Test + @SuppressWarnings("deprecation") + public void whenGuavaImmutableMapFromCopyOfMethod_thenOriginalCollectionChangesDoNotReflectInImmutableMap() { + + Map mutableMap = new HashMap<>(); + mutableMap.put("USA", "North America"); + + ImmutableMap immutableMap = ImmutableMap.copyOf(mutableMap); + assertTrue(immutableMap.containsKey("USA")); + + assertThrows(UnsupportedOperationException.class, () -> immutableMap.put("Canada", "North America")); + + mutableMap.remove("USA"); + assertTrue(immutableMap.containsKey("USA")); + + mutableMap.put("Mexico", "North America"); + assertFalse(immutableMap.containsKey("Mexico")); + } + + @Test + @SuppressWarnings("deprecation") + public void whenGuavaImmutableMapFromBuilderMethod_thenOriginalCollectionChangesDoNotReflectInImmutableMap() { + + Map mutableMap = new HashMap<>(); + mutableMap.put("USA", "North America"); + + ImmutableMap immutableMap = ImmutableMap.builder() + .putAll(mutableMap) + .put("Costa Rica", "North America") + .build(); + assertTrue(immutableMap.containsKey("USA")); + assertTrue(immutableMap.containsKey("Costa Rica")); + + assertThrows(UnsupportedOperationException.class, () -> immutableMap.put("Canada", "North America")); + + mutableMap.remove("USA"); + assertTrue(immutableMap.containsKey("USA")); + + mutableMap.put("Mexico", "North America"); + assertFalse(immutableMap.containsKey("Mexico")); + } + + @Test + @SuppressWarnings("deprecation") + public void whenGuavaImmutableMapFromOfMethod_thenOriginalCollectionChangesDoNotReflectInImmutableMap() { + + ImmutableMap immutableMap = ImmutableMap.of("USA", "North America", "Costa Rica", "North America"); + assertTrue(immutableMap.containsKey("USA")); + assertTrue(immutableMap.containsKey("Costa Rica")); + + assertThrows(UnsupportedOperationException.class, () -> immutableMap.put("Canada", "North America")); + } + +} diff --git a/core-java-collections/src/test/java/com/baeldung/java/map/KeyCheckUnitTest.java b/java-collections-maps/src/test/java/com/baeldung/java/map/KeyCheckUnitTest.java similarity index 100% rename from core-java-collections/src/test/java/com/baeldung/java/map/KeyCheckUnitTest.java rename to java-collections-maps/src/test/java/com/baeldung/java/map/KeyCheckUnitTest.java diff --git a/core-java-collections/src/test/java/com/baeldung/java/map/MapMultipleValuesUnitTest.java b/java-collections-maps/src/test/java/com/baeldung/java/map/MapMultipleValuesUnitTest.java similarity index 100% rename from core-java-collections/src/test/java/com/baeldung/java/map/MapMultipleValuesUnitTest.java rename to java-collections-maps/src/test/java/com/baeldung/java/map/MapMultipleValuesUnitTest.java diff --git a/core-java-collections/src/test/java/com/baeldung/java/map/MapUnitTest.java b/java-collections-maps/src/test/java/com/baeldung/java/map/MapUnitTest.java similarity index 100% rename from core-java-collections/src/test/java/com/baeldung/java/map/MapUnitTest.java rename to java-collections-maps/src/test/java/com/baeldung/java/map/MapUnitTest.java diff --git a/core-java-collections/src/test/java/com/baeldung/java/map/MapUtilUnitTest.java b/java-collections-maps/src/test/java/com/baeldung/java/map/MapUtilUnitTest.java similarity index 100% rename from core-java-collections/src/test/java/com/baeldung/java/map/MapUtilUnitTest.java rename to java-collections-maps/src/test/java/com/baeldung/java/map/MapUtilUnitTest.java diff --git a/java-collections-maps/src/test/java/com/baeldung/java/map/compare/HashMapComparisonUnitTest.java b/java-collections-maps/src/test/java/com/baeldung/java/map/compare/HashMapComparisonUnitTest.java new file mode 100644 index 0000000000..e8aa12d4bd --- /dev/null +++ b/java-collections-maps/src/test/java/com/baeldung/java/map/compare/HashMapComparisonUnitTest.java @@ -0,0 +1,228 @@ +package com.baeldung.java.map.compare; + +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.collection.IsMapContaining.hasEntry; +import static org.hamcrest.collection.IsMapContaining.hasKey; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import java.util.stream.Collectors; + +import org.junit.Before; +import org.junit.Test; + +import com.google.common.base.Equivalence; +import com.google.common.collect.MapDifference; +import com.google.common.collect.MapDifference.ValueDifference; +import com.google.common.collect.Maps; + +public class HashMapComparisonUnitTest { + + Map asiaCapital1; + Map asiaCapital2; + Map asiaCapital3; + + Map asiaCity1; + Map asiaCity2; + Map asiaCity3; + + @Before + public void setup(){ + asiaCapital1 = new HashMap(); + asiaCapital1.put("Japan", "Tokyo"); + asiaCapital1.put("South Korea", "Seoul"); + + asiaCapital2 = new HashMap(); + asiaCapital2.put("South Korea", "Seoul"); + asiaCapital2.put("Japan", "Tokyo"); + + asiaCapital3 = new HashMap(); + asiaCapital3.put("Japan", "Tokyo"); + asiaCapital3.put("China", "Beijing"); + + asiaCity1 = new HashMap(); + asiaCity1.put("Japan", new String[] { "Tokyo", "Osaka" }); + asiaCity1.put("South Korea", new String[] { "Seoul", "Busan" }); + + asiaCity2 = new HashMap(); + asiaCity2.put("South Korea", new String[] { "Seoul", "Busan" }); + asiaCity2.put("Japan", new String[] { "Tokyo", "Osaka" }); + + asiaCity3 = new HashMap(); + asiaCity3.put("Japan", new String[] { "Tokyo", "Osaka" }); + asiaCity3.put("China", new String[] { "Beijing", "Hong Kong" }); + } + + @Test + public void whenCompareTwoHashMapsUsingEquals_thenSuccess() { + assertTrue(asiaCapital1.equals(asiaCapital2)); + assertFalse(asiaCapital1.equals(asiaCapital3)); + } + + @Test + public void whenCompareTwoHashMapsWithArrayValuesUsingEquals_thenFail() { + assertFalse(asiaCity1.equals(asiaCity2)); + } + + @Test + public void whenCompareTwoHashMapsUsingStreamAPI_thenSuccess() { + assertTrue(areEqual(asiaCapital1, asiaCapital2)); + assertFalse(areEqual(asiaCapital1, asiaCapital3)); + } + + @Test + public void whenCompareTwoHashMapsWithArrayValuesUsingStreamAPI_thenSuccess() { + assertTrue(areEqualWithArrayValue(asiaCity1, asiaCity2)); + assertFalse(areEqualWithArrayValue(asiaCity1, asiaCity3)); + } + + @Test + public void whenCompareTwoHashMapKeys_thenSuccess() { + assertTrue(asiaCapital1.keySet().equals(asiaCapital2.keySet())); + assertFalse(asiaCapital1.keySet().equals(asiaCapital3.keySet())); + } + + @Test + public void whenCompareTwoHashMapKeyValuesUsingStreamAPI_thenSuccess() { + Map asiaCapital3 = new HashMap(); + asiaCapital3.put("Japan", "Tokyo"); + asiaCapital3.put("South Korea", "Seoul"); + asiaCapital3.put("China", "Beijing"); + + Map asiaCapital4 = new HashMap(); + asiaCapital4.put("South Korea", "Seoul"); + asiaCapital4.put("Japan", "Osaka"); + asiaCapital4.put("China", "Beijing"); + + Map result = areEqualKeyValues(asiaCapital3, asiaCapital4); + + assertEquals(3, result.size()); + assertThat(result, hasEntry("Japan", false)); + assertThat(result, hasEntry("South Korea", true)); + assertThat(result, hasEntry("China", true)); + } + + @Test + public void givenDifferentMaps_whenGetDiffUsingGuava_thenSuccess() { + Map asia1 = new HashMap(); + asia1.put("Japan", "Tokyo"); + asia1.put("South Korea", "Seoul"); + asia1.put("India", "New Delhi"); + + Map asia2 = new HashMap(); + asia2.put("Japan", "Tokyo"); + asia2.put("China", "Beijing"); + asia2.put("India", "Delhi"); + + MapDifference diff = Maps.difference(asia1, asia2); + Map> entriesDiffering = diff.entriesDiffering(); + + assertFalse(diff.areEqual()); + assertEquals(1, entriesDiffering.size()); + assertThat(entriesDiffering, hasKey("India")); + assertEquals("New Delhi", entriesDiffering.get("India").leftValue()); + assertEquals("Delhi", entriesDiffering.get("India").rightValue()); + } + + @Test + public void givenDifferentMaps_whenGetEntriesOnOneSideUsingGuava_thenSuccess() { + Map asia1 = new HashMap(); + asia1.put("Japan", "Tokyo"); + asia1.put("South Korea", "Seoul"); + asia1.put("India", "New Delhi"); + + Map asia2 = new HashMap(); + asia2.put("Japan", "Tokyo"); + asia2.put("China", "Beijing"); + asia2.put("India", "Delhi"); + + MapDifference diff = Maps.difference(asia1, asia2); + Map entriesOnlyOnRight = diff.entriesOnlyOnRight(); + Map entriesOnlyOnLeft = diff.entriesOnlyOnLeft(); + + assertEquals(1, entriesOnlyOnRight.size()); + assertThat(entriesOnlyOnRight, hasEntry("China", "Beijing")); + assertEquals(1, entriesOnlyOnLeft.size()); + assertThat(entriesOnlyOnLeft, hasEntry("South Korea", "Seoul")); + } + + @Test + public void givenDifferentMaps_whenGetCommonEntriesUsingGuava_thenSuccess() { + Map asia1 = new HashMap(); + asia1.put("Japan", "Tokyo"); + asia1.put("South Korea", "Seoul"); + asia1.put("India", "New Delhi"); + + Map asia2 = new HashMap(); + asia2.put("Japan", "Tokyo"); + asia2.put("China", "Beijing"); + asia2.put("India", "Delhi"); + + MapDifference diff = Maps.difference(asia1, asia2); + Map entriesInCommon = diff.entriesInCommon(); + + assertEquals(1, entriesInCommon.size()); + assertThat(entriesInCommon, hasEntry("Japan", "Tokyo")); + } + + @Test + public void givenSimilarMapsWithArrayValue_whenCompareUsingGuava_thenFail() { + MapDifference diff = Maps.difference(asiaCity1, asiaCity2); + assertFalse(diff.areEqual()); + } + + @Test + public void givenSimilarMapsWithArrayValue_whenCompareUsingGuavaEquivalence_thenSuccess() { + Equivalence eq = new Equivalence() { + @Override + protected boolean doEquivalent(String[] a, String[] b) { + return Arrays.equals(a, b); + } + + @Override + protected int doHash(String[] value) { + return value.hashCode(); + } + }; + + MapDifference diff = Maps.difference(asiaCity1, asiaCity2, eq); + assertTrue(diff.areEqual()); + + diff = Maps.difference(asiaCity1, asiaCity3, eq); + assertFalse(diff.areEqual()); + } + + // =========================================================================== + + private boolean areEqual(Map first, Map second) { + if (first.size() != second.size()) { + return false; + } + + return first.entrySet() + .stream() + .allMatch(e -> e.getValue() + .equals(second.get(e.getKey()))); + } + + private boolean areEqualWithArrayValue(Map first, Map second) { + if (first.size() != second.size()) { + return false; + } + + return first.entrySet() + .stream() + .allMatch(e -> Arrays.equals(e.getValue(), second.get(e.getKey()))); + } + + private Map areEqualKeyValues(Map first, Map second) { + return first.entrySet() + .stream() + .collect(Collectors.toMap(e -> e.getKey(), e -> e.getValue().equals(second.get(e.getKey())))); + } + +} diff --git a/core-java-collections/src/test/java/com/baeldung/java/map/initialize/MapInitializerUnitTest.java b/java-collections-maps/src/test/java/com/baeldung/java/map/initialize/MapInitializerUnitTest.java similarity index 100% rename from core-java-collections/src/test/java/com/baeldung/java/map/initialize/MapInitializerUnitTest.java rename to java-collections-maps/src/test/java/com/baeldung/java/map/initialize/MapInitializerUnitTest.java diff --git a/core-java-collections/src/test/java/com/baeldung/map/util/MapMaxUnitTest.java b/java-collections-maps/src/test/java/com/baeldung/map/util/MapMaxUnitTest.java similarity index 100% rename from core-java-collections/src/test/java/com/baeldung/map/util/MapMaxUnitTest.java rename to java-collections-maps/src/test/java/com/baeldung/map/util/MapMaxUnitTest.java diff --git a/core-java-collections/src/test/java/com/baeldung/weakhashmap/WeakHashMapUnitTest.java b/java-collections-maps/src/test/java/com/baeldung/weakhashmap/WeakHashMapUnitTest.java similarity index 100% rename from core-java-collections/src/test/java/com/baeldung/weakhashmap/WeakHashMapUnitTest.java rename to java-collections-maps/src/test/java/com/baeldung/weakhashmap/WeakHashMapUnitTest.java diff --git a/java-dates/README.md b/java-dates/README.md index 54843f90ee..21e54082f4 100644 --- a/java-dates/README.md +++ b/java-dates/README.md @@ -21,4 +21,8 @@ - [How to Get the Start and the End of a Day using Java](http://www.baeldung.com/java-day-start-end) - [Calculate Age in Java](http://www.baeldung.com/java-get-age) - [Increment Date in Java](http://www.baeldung.com/java-increment-date) -- [Add Hours To a Date In Java](http://www.baeldung.com/java-add-hours-date) \ No newline at end of file +- [Add Hours To a Date In Java](http://www.baeldung.com/java-add-hours-date) +- [Guide to DateTimeFormatter](https://www.baeldung.com/java-datetimeformatter) +- [Format ZonedDateTime to String](https://www.baeldung.com/java-format-zoned-datetime-string) +- [Convert Between java.time.Instant and java.sql.Timestamp](https://www.baeldung.com/java-time-instant-to-java-sql-timestamp) +- [Convert between String and Timestamp](https://www.baeldung.com/java-string-to-timestamp) diff --git a/java-dates/src/test/java/com/baeldung/datetime/ConvertInstantToTimestampUnitTest.java b/java-dates/src/test/java/com/baeldung/datetime/ConvertInstantToTimestampUnitTest.java new file mode 100644 index 0000000000..3ba01a591a --- /dev/null +++ b/java-dates/src/test/java/com/baeldung/datetime/ConvertInstantToTimestampUnitTest.java @@ -0,0 +1,30 @@ +package com.baeldung.datetime; + +import static org.assertj.core.api.Assertions.assertThat; + +import java.sql.Timestamp; +import java.text.DateFormat; +import java.text.SimpleDateFormat; +import java.time.Instant; +import java.time.ZoneId; +import java.util.TimeZone; + +import org.junit.Test; + +public class ConvertInstantToTimestampUnitTest { + + @Test + public void givenInstant_whenConvertedToTimestamp_thenGetTimestampWithSamePointOnTimeline() { + Instant instant = Instant.now(); + Timestamp timestamp = Timestamp.from(instant); // same point on the time-line as Instant + assertThat(instant.toEpochMilli()).isEqualTo(timestamp.getTime()); + + instant = timestamp.toInstant(); + assertThat(instant.toEpochMilli()).isEqualTo(timestamp.getTime()); + + DateFormat df = DateFormat.getDateTimeInstance(); + df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SS'Z'"); + df.setTimeZone(TimeZone.getTimeZone("UTC")); + assertThat(instant.toString()).isEqualTo(df.format(timestamp).toString()); + } +} diff --git a/java-dates/src/test/java/com/baeldung/timestamp/StringToTimestampConverterUnitTest.java b/java-dates/src/test/java/com/baeldung/timestamp/StringToTimestampConverterUnitTest.java new file mode 100644 index 0000000000..2be646eb51 --- /dev/null +++ b/java-dates/src/test/java/com/baeldung/timestamp/StringToTimestampConverterUnitTest.java @@ -0,0 +1,22 @@ +package com.baeldung.timestamp; + +import org.junit.Assert; +import org.junit.Test; + +import java.sql.Timestamp; +import java.time.LocalDateTime; +import java.time.format.DateTimeFormatter; + +public class StringToTimestampConverterUnitTest { + + @Test + public void givenDatePattern_whenParsing_thenTimestampIsCorrect() { + String pattern = "MMM dd, yyyy HH:mm:ss.SSSSSSSS"; + String timestampAsString = "Nov 12, 2018 13:02:56.12345678"; + DateTimeFormatter formatter = DateTimeFormatter.ofPattern(pattern); + LocalDateTime localDateTime = LocalDateTime.from(formatter.parse(timestampAsString)); + + Timestamp timestamp = Timestamp.valueOf(localDateTime); + Assert.assertEquals("2018-11-12 13:02:56.12345678", timestamp.toString()); + } +} \ No newline at end of file diff --git a/java-dates/src/test/java/com/baeldung/timestamp/TimestampToStringConverterTest.java b/java-dates/src/test/java/com/baeldung/timestamp/TimestampToStringConverterTest.java new file mode 100644 index 0000000000..b25ff2edb3 --- /dev/null +++ b/java-dates/src/test/java/com/baeldung/timestamp/TimestampToStringConverterTest.java @@ -0,0 +1,19 @@ +package com.baeldung.timestamp; + +import org.junit.Assert; +import org.junit.jupiter.api.Test; + +import java.sql.Timestamp; +import java.time.format.DateTimeFormatter; + +public class TimestampToStringConverterTest { + + @Test + public void givenDatePattern_whenFormatting_thenResultingStringIsCorrect() { + Timestamp timestamp = Timestamp.valueOf("2018-12-12 01:02:03.123456789"); + DateTimeFormatter formatter = DateTimeFormatter.ISO_LOCAL_DATE_TIME; + + String timestampAsString = formatter.format(timestamp.toLocalDateTime()); + Assert.assertEquals("2018-12-12T01:02:03.123456789", timestampAsString); + } +} \ No newline at end of file diff --git a/java-dates/src/test/java/com/baeldung/zoneddatetime/ZonedDateTimeUnitTest.java b/java-dates/src/test/java/com/baeldung/zoneddatetime/ZonedDateTimeUnitTest.java index 355fef35c6..65f63bc787 100644 --- a/java-dates/src/test/java/com/baeldung/zoneddatetime/ZonedDateTimeUnitTest.java +++ b/java-dates/src/test/java/com/baeldung/zoneddatetime/ZonedDateTimeUnitTest.java @@ -1,19 +1,22 @@ package com.baeldung.zoneddatetime; +import static org.junit.jupiter.api.Assertions.assertThrows; + import java.time.LocalDateTime; import java.time.ZoneId; import java.time.ZonedDateTime; import java.time.format.DateTimeFormatter; +import java.time.format.DateTimeParseException; import java.util.logging.Logger; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class ZonedDateTimeUnitTest { private static final Logger log = Logger.getLogger(ZonedDateTimeUnitTest.class.getName()); @Test - public void testZonedDateTimeToString() { + public void givenZonedDateTime_whenConvertToString_thenOk() { ZonedDateTime zonedDateTimeNow = ZonedDateTime.now(ZoneId.of("UTC")); ZonedDateTime zonedDateTimeOf = ZonedDateTime.of(2018, 01, 01, 0, 0, 0, 0, ZoneId.of("UTC")); @@ -21,10 +24,10 @@ public class ZonedDateTimeUnitTest { LocalDateTime localDateTime = LocalDateTime.now(); ZonedDateTime zonedDateTime = ZonedDateTime.of(localDateTime, ZoneId.of("UTC")); - DateTimeFormatter formatter = DateTimeFormatter.ofPattern("MM/dd/yyyy - hh:mm:ss Z"); + DateTimeFormatter formatter = DateTimeFormatter.ofPattern("MM/dd/yyyy - HH:mm:ss Z"); String formattedString = zonedDateTime.format(formatter); - DateTimeFormatter formatter2 = DateTimeFormatter.ofPattern("MM/dd/yyyy - hh:mm:ss z"); + DateTimeFormatter formatter2 = DateTimeFormatter.ofPattern("MM/dd/yyyy - HH:mm:ss z"); String formattedString2 = zonedDateTime.format(formatter2); log.info(formattedString); @@ -33,9 +36,21 @@ public class ZonedDateTimeUnitTest { } @Test - public void testZonedDateTimeFromString() { + public void givenString_whenParseZonedDateTime_thenOk() { + ZonedDateTime zonedDateTime = ZonedDateTime.parse("2011-12-03T10:15:30+01:00"); - ZonedDateTime zonedDateTime = ZonedDateTime.parse("2011-12-03T10:15:30+01:00", DateTimeFormatter.ISO_ZONED_DATE_TIME); + log.info(zonedDateTime.format(DateTimeFormatter.ISO_ZONED_DATE_TIME)); + } + + @Test + public void givenString_whenParseZonedDateTimeWithoutZone_thenException() { + assertThrows(DateTimeParseException.class, () -> ZonedDateTime.parse("2011-12-03T10:15:30", DateTimeFormatter.ISO_DATE_TIME)); + } + + @Test + public void givenString_whenParseLocalDateTimeAtZone_thenOk() { + ZoneId timeZone = ZoneId.systemDefault(); + ZonedDateTime zonedDateTime = LocalDateTime.parse("2011-12-03T10:15:30", DateTimeFormatter.ISO_DATE_TIME).atZone(timeZone); log.info(zonedDateTime.format(DateTimeFormatter.ISO_ZONED_DATE_TIME)); } 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 6ecc9f7e80..cf92fe2ecd 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 @@ -2,8 +2,8 @@ 4.0.0 - app-auth-basic-store-db + app-auth-basic-store-db war 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 bf5315e993..43809f1cd5 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 @@ -2,8 +2,8 @@ 4.0.0 - app-auth-custom-form-store-custom + app-auth-custom-form-store-custom war 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 c05c0f19be..f9d63f8623 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 @@ -2,8 +2,8 @@ 4.0.0 - app-auth-custom-no-store + app-auth-custom-no-store war 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 570b36add5..6a7b97b2d7 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 @@ -3,8 +3,8 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 - app-auth-form-store-ldap + app-auth-form-store-ldap war diff --git a/java-ee-8-security-api/pom.xml b/java-ee-8-security-api/pom.xml index 3d235e10a8..ad33c74ad3 100644 --- a/java-ee-8-security-api/pom.xml +++ b/java-ee-8-security-api/pom.xml @@ -5,6 +5,7 @@ 4.0.0 java-ee-8-security-api 1.0-SNAPSHOT + java-ee-8-security-api pom @@ -41,7 +42,7 @@ - https://public.dhe.ibm.com/ibmdl/export/pub/software/openliberty/runtime/nightly/2018-05-25_1422/openliberty-all-20180525-1300.zip + https://public.dhe.ibm.com/ibmdl/export/pub/software/openliberty/runtime/release/2018-09-05_2337/openliberty-18.0.0.3.zip true diff --git a/java-lite/pom.xml b/java-lite/pom.xml index 5111cd2e7f..03f4e29f4e 100644 --- a/java-lite/pom.xml +++ b/java-lite/pom.xml @@ -5,6 +5,7 @@ org.baeldung java-lite 1.0-SNAPSHOT + java-lite war diff --git a/java-numbers/README.md b/java-numbers/README.md index 6d6a279cc9..1138d9a74c 100644 --- a/java-numbers/README.md +++ b/java-numbers/README.md @@ -12,3 +12,4 @@ - [BigDecimal and BigInteger in Java](http://www.baeldung.com/java-bigdecimal-biginteger) - [Find All Pairs of Numbers in an Array That Add Up to a Given Sum](http://www.baeldung.com/java-algorithm-number-pairs-sum) - [Java – Random Long, Float, Integer and Double](http://www.baeldung.com/java-generate-random-long-float-integer-double) +- [Using Math.sin with Degrees](https://www.baeldung.com/java-math-sin-degrees) diff --git a/java-numbers/src/test/java/com/baeldung/maths/MathSinUnitTest.java b/java-numbers/src/test/java/com/baeldung/maths/MathSinUnitTest.java index 111b2f4465..03d200bb6b 100644 --- a/java-numbers/src/test/java/com/baeldung/maths/MathSinUnitTest.java +++ b/java-numbers/src/test/java/com/baeldung/maths/MathSinUnitTest.java @@ -1,6 +1,7 @@ package com.baeldung.maths; -import static org.junit.Assert.assertTrue; +import static org.hamcrest.CoreMatchers.is; +import static org.junit.Assert.assertThat; import org.junit.jupiter.api.Test; @@ -11,10 +12,10 @@ public class MathSinUnitTest { double angleInDegrees = 30; double sinForDegrees = Math.sin(Math.toRadians(angleInDegrees)); // 0.5 - double thirtyDegreesInRadians = 1/6 * Math.PI; + double thirtyDegreesInRadians = (double) 1 / 6 * Math.PI; double sinForRadians = Math.sin(thirtyDegreesInRadians); // 0.5 - assertTrue(sinForDegrees == sinForRadians); + assertThat(sinForDegrees, is(sinForRadians)); } } diff --git a/java-rmi/pom.xml b/java-rmi/pom.xml index 33931baedf..ad413b66ab 100644 --- a/java-rmi/pom.xml +++ b/java-rmi/pom.xml @@ -4,6 +4,7 @@ com.baeldung.rmi java-rmi 1.0-SNAPSHOT + java-rmi jar diff --git a/java-spi/exchange-rate-api/pom.xml b/java-spi/exchange-rate-api/pom.xml index b626916b56..fd3a7ae0a7 100644 --- a/java-spi/exchange-rate-api/pom.xml +++ b/java-spi/exchange-rate-api/pom.xml @@ -2,6 +2,7 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 exchange-rate-api + exchange-rate-api jar diff --git a/java-spi/exchange-rate-app/pom.xml b/java-spi/exchange-rate-app/pom.xml index a42a30ceda..7a076d560c 100644 --- a/java-spi/exchange-rate-app/pom.xml +++ b/java-spi/exchange-rate-app/pom.xml @@ -2,6 +2,7 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 exchange-rate-app + exchange-rate-app jar diff --git a/java-spi/exchange-rate-impl/pom.xml b/java-spi/exchange-rate-impl/pom.xml index 41c874c659..8a77b51793 100644 --- a/java-spi/exchange-rate-impl/pom.xml +++ b/java-spi/exchange-rate-impl/pom.xml @@ -2,6 +2,7 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 exchange-rate-impl + exchange-rate-impl jar diff --git a/java-spi/pom.xml b/java-spi/pom.xml index 9ac87bf960..97a22024bd 100644 --- a/java-spi/pom.xml +++ b/java-spi/pom.xml @@ -2,6 +2,7 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 java-spi + java-spi pom diff --git a/java-streams/src/test/java/com/baeldung/protonpack/ProtonpackUnitTest.java b/java-streams/src/test/java/com/baeldung/protonpack/ProtonpackUnitTest.java index 1b64c8924a..371ac3a9bb 100644 --- a/java-streams/src/test/java/com/baeldung/protonpack/ProtonpackUnitTest.java +++ b/java-streams/src/test/java/com/baeldung/protonpack/ProtonpackUnitTest.java @@ -4,10 +4,9 @@ import com.codepoetics.protonpack.Indexed; import com.codepoetics.protonpack.StreamUtils; import com.codepoetics.protonpack.collectors.CollectorUtils; import com.codepoetics.protonpack.collectors.NonUniqueValueException; -import com.codepoetics.protonpack.selectors.Selector; +import com.codepoetics.protonpack.selectors.Selectors; import org.junit.Test; -import java.util.Arrays; import java.util.List; import java.util.Optional; import java.util.Set; @@ -21,7 +20,6 @@ import static java.util.Arrays.stream; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatExceptionOfType; -@SuppressWarnings("unchecked") public class ProtonpackUnitTest { @Test public void whenTakeWhile_thenTakenWhile() { @@ -39,17 +37,18 @@ public class ProtonpackUnitTest { @Test public void givenMultipleStream_whenZipped_thenZipped() { - String[] clubs = { "Juventus", "Barcelona", "Liverpool", "PSG" }; - String[] players = { "Ronaldo", "Messi", "Salah" }; - Set zippedFrom2Sources = StreamUtils.zip(stream(clubs), stream(players), (club, player) -> club + " " + player) - .collect(Collectors.toSet()); + String[] clubs = {"Juventus", "Barcelona", "Liverpool", "PSG"}; + String[] players = {"Ronaldo", "Messi", "Salah"}; + Set zippedFrom2Sources = StreamUtils + .zip(stream(clubs), stream(players), (club, player) -> club + " " + player) + .collect(Collectors.toSet()); assertThat(zippedFrom2Sources).contains("Juventus Ronaldo", "Barcelona Messi", "Liverpool Salah"); - String[] leagues = { "Serie A", "La Liga", "Premier League" }; + String[] leagues = {"Serie A", "La Liga", "Premier League"}; Set zippedFrom3Sources = StreamUtils.zip(stream(clubs), stream(players), stream(leagues), - (club, player, league) -> club + " " + player + " " + league).collect(Collectors.toSet()); + (club, player, league) -> club + " " + player + " " + league).collect(Collectors.toSet()); assertThat(zippedFrom3Sources).contains("Juventus Ronaldo Serie A", "Barcelona Messi La Liga", - "Liverpool Salah Premier League"); + "Liverpool Salah Premier League"); } @Test @@ -57,7 +56,7 @@ public class ProtonpackUnitTest { Stream streamOfClubs = Stream.of("Juventus", "Barcelona", "Liverpool"); Set> zipsWithIndex = StreamUtils.zipWithIndex(streamOfClubs).collect(Collectors.toSet()); assertThat(zipsWithIndex).contains(Indexed.index(0, "Juventus"), Indexed.index(1, "Barcelona"), - Indexed.index(2, "Liverpool")); + Indexed.index(2, "Liverpool")); } @Test @@ -67,9 +66,10 @@ public class ProtonpackUnitTest { Stream streamOfLeagues = Stream.of("Serie A", "La Liga", "Premier League"); Set merged = StreamUtils.merge(() -> "", (valOne, valTwo) -> valOne + " " + valTwo, streamOfClubs, - streamOfPlayers, streamOfLeagues).collect(Collectors.toSet()); + streamOfPlayers, streamOfLeagues).collect(Collectors.toSet()); - assertThat(merged).contains(" Juventus Ronaldo Serie A", " Barcelona Messi La Liga", " Liverpool Salah Premier League", + assertThat(merged) + .contains(" Juventus Ronaldo Serie A", " Barcelona Messi La Liga", " Liverpool Salah Premier League", " PSG"); } @@ -79,7 +79,7 @@ public class ProtonpackUnitTest { Stream streamOfPlayers = Stream.of("Ronaldo", "Messi"); List> mergedListOfList = StreamUtils.mergeToList(streamOfClubs, streamOfPlayers) - .collect(Collectors.toList()); + .collect(Collectors.toList()); assertThat(mergedListOfList.get(0)).isInstanceOf(List.class); assertThat(mergedListOfList.get(0)).containsExactly("Juventus", "Ronaldo"); assertThat(mergedListOfList.get(1)).containsExactly("Barcelona", "Messi"); @@ -92,72 +92,67 @@ public class ProtonpackUnitTest { Stream streamOfPlayers = Stream.of("Ronaldo", "Messi"); Stream streamOfLeagues = Stream.of("Serie A", "La Liga"); - AtomicInteger counter = new AtomicInteger(0); - Selector roundRobinSelector = (o) -> { - Object[] vals = (Object[]) o; - while (counter.get() >= vals.length || vals[counter.get()] == null) { - if (counter.incrementAndGet() >= vals.length) - counter.set(0); - } - return counter.getAndIncrement(); - }; - Stream interleavedStream = StreamUtils.interleave(roundRobinSelector, streamOfClubs, streamOfPlayers, - streamOfLeagues); - List interleavedList = interleavedStream.collect(Collectors.toList()); - assertThat(interleavedList).containsExactly("Juventus", "Ronaldo", "Serie A", "Barcelona", "Messi", "La Liga", - "Liverpool"); + List interleavedList = StreamUtils + .interleave(Selectors.roundRobin(), streamOfClubs, streamOfPlayers, streamOfLeagues) + .collect(Collectors.toList()); + + assertThat(interleavedList) + .hasSize(7) + .containsExactly("Juventus", "Ronaldo", "Serie A", "Barcelona", "Messi", "La Liga", "Liverpool"); } @Test public void whenSkippedUntil_thenSkippedUntil() { - Integer[] numbers = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }; - List skippedUntilGreaterThan5 = StreamUtils.skipUntil(stream(numbers), i -> i > 5).collect(Collectors.toList()); + Integer[] numbers = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}; + List skippedUntilGreaterThan5 = StreamUtils.skipUntil(stream(numbers), i -> i > 5) + .collect(Collectors.toList()); assertThat(skippedUntilGreaterThan5).containsExactly(6, 7, 8, 9, 10); List skippedUntilLessThanEquals5 = StreamUtils.skipUntil(stream(numbers), i -> i <= 5) - .collect(Collectors.toList()); + .collect(Collectors.toList()); assertThat(skippedUntilLessThanEquals5).containsExactly(1, 2, 3, 4, 5, 6, 7, 8, 9, 10); } @Test public void whenSkippedWhile_thenSkippedWhile() { - Integer[] numbers = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }; + Integer[] numbers = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}; List skippedWhileLessThanEquals5 = StreamUtils.skipWhile(stream(numbers), i -> i <= 5) - .collect(Collectors.toList()); + .collect(Collectors.toList()); assertThat(skippedWhileLessThanEquals5).containsExactly(6, 7, 8, 9, 10); - List skippedWhileGreaterThan5 = StreamUtils.skipWhile(stream(numbers), i -> i > 5).collect(Collectors.toList()); + List skippedWhileGreaterThan5 = StreamUtils.skipWhile(stream(numbers), i -> i > 5) + .collect(Collectors.toList()); assertThat(skippedWhileGreaterThan5).containsExactly(1, 2, 3, 4, 5, 6, 7, 8, 9, 10); } @Test public void givenFibonacciGenerator_whenUnfolded_thenUnfolded() { - AtomicInteger lastValue = new AtomicInteger(0); - Function> fibonacciGenerator = (i) -> (i < 10) ? - Optional.of(i + lastValue.getAndSet(i)) : - Optional.empty(); + Stream unfolded = StreamUtils.unfold(2, i -> (i < 100) ? Optional.of(i * i) : Optional.empty()); - List fib = StreamUtils.unfold(1, fibonacciGenerator).collect(Collectors.toList()); - assertThat(fib).containsExactly(1, 1, 2, 3, 5, 8, 13); + assertThat(unfolded.collect(Collectors.toList())).containsExactly(2, 4, 16, 256); } @Test public void whenWindowed_thenWindowed() { - Integer[] numbers = { 1, 2, 3, 4, 5, 6, 7 }; + Integer[] numbers = {1, 2, 3, 4, 5, 6, 7}; - List> windowedWithSkip1 = StreamUtils.windowed(stream(numbers), 3, 1).collect(Collectors.toList()); - assertThat(windowedWithSkip1).containsExactly(asList(1, 2, 3), asList(2, 3, 4), asList(3, 4, 5), asList(4, 5, 6), + List> windowedWithSkip1 = StreamUtils.windowed(stream(numbers), 3, 1) + .collect(Collectors.toList()); + assertThat(windowedWithSkip1) + .containsExactly(asList(1, 2, 3), asList(2, 3, 4), asList(3, 4, 5), asList(4, 5, 6), asList(5, 6, 7)); - List> windowedWithSkip2 = StreamUtils.windowed(stream(numbers), 3, 2).collect(Collectors.toList()); + List> windowedWithSkip2 = StreamUtils.windowed(stream(numbers), 3, 2) + .collect(Collectors.toList()); assertThat(windowedWithSkip2).containsExactly(asList(1, 2, 3), asList(3, 4, 5), asList(5, 6, 7)); } @Test public void whenAggregated_thenAggregated() { - Integer[] numbers = { 1, 2, 2, 3, 4, 4, 4, 5 }; - List> aggregated = StreamUtils.aggregate(stream(numbers), (int1, int2) -> int1.compareTo(int2) == 0) - .collect(Collectors.toList()); + Integer[] numbers = {1, 2, 2, 3, 4, 4, 4, 5}; + List> aggregated = StreamUtils + .aggregate(stream(numbers), (int1, int2) -> int1.compareTo(int2) == 0) + .collect(Collectors.toList()); assertThat(aggregated).containsExactly(asList(1), asList(2, 2), asList(3), asList(4, 4, 4), asList(5)); List> aggregatedFixSize = StreamUtils.aggregate(stream(numbers), 5).collect(Collectors.toList()); @@ -166,20 +161,20 @@ public class ProtonpackUnitTest { @Test public void whenGroupedRun_thenGroupedRun() { - Integer[] numbers = { 1, 1, 2, 3, 4, 4, 5 }; + Integer[] numbers = {1, 1, 2, 3, 4, 4, 5}; List> grouped = StreamUtils.groupRuns(stream(numbers)).collect(Collectors.toList()); assertThat(grouped).containsExactly(asList(1, 1), asList(2), asList(3), asList(4, 4), asList(5)); - Integer[] numbers2 = { 1, 2, 3, 1 }; + Integer[] numbers2 = {1, 2, 3, 1}; List> grouped2 = StreamUtils.groupRuns(stream(numbers2)).collect(Collectors.toList()); assertThat(grouped2).containsExactly(asList(1), asList(2), asList(3), asList(1)); } @Test public void whenAggregatedOnListCondition_thenAggregatedOnListCondition() { - Integer[] numbers = { 1, 1, 2, 3, 4, 4, 5 }; + Integer[] numbers = {1, 1, 2, 3, 4, 4, 5}; Stream> aggregated = StreamUtils.aggregateOnListCondition(stream(numbers), - (currentList, nextInt) -> currentList.stream().mapToInt(Integer::intValue).sum() + nextInt <= 5); + (currentList, nextInt) -> currentList.stream().mapToInt(Integer::intValue).sum() + nextInt <= 5); assertThat(aggregated).containsExactly(asList(1, 1, 2), asList(3), asList(4), asList(4), asList(5)); } @@ -187,15 +182,14 @@ public class ProtonpackUnitTest { public void givenProjectionFunction_whenMaxedBy_thenMaxedBy() { Stream clubs = Stream.of("Juventus", "Barcelona", "PSG"); Optional longestName = clubs.collect(CollectorUtils.maxBy(String::length)); - assertThat(longestName.get()).isEqualTo("Barcelona"); + assertThat(longestName).contains("Barcelona"); } @Test public void givenStreamOfMultipleElem_whenUniqueCollector_thenValueReturned() { Stream singleElement = Stream.of(1); Optional unique = singleElement.collect(CollectorUtils.unique()); - assertThat(unique.get()).isEqualTo(1); - + assertThat(unique).contains(1); } @Test @@ -205,5 +199,4 @@ public class ProtonpackUnitTest { multipleElement.collect(CollectorUtils.unique()); }); } - } diff --git a/java-strings/README.md b/java-strings/README.md index ff833a5cda..240acd663b 100644 --- a/java-strings/README.md +++ b/java-strings/README.md @@ -27,9 +27,19 @@ - [Compact Strings in Java 9](http://www.baeldung.com/java-9-compact-string) - [Java Check a String for Lowercase/Uppercase Letter, Special Character and Digit](https://www.baeldung.com/java-lowercase-uppercase-special-character-digit-regex) - [Convert java.util.Date to String](https://www.baeldung.com/java-util-date-to-string) +- [String Not Empty Test Assertions in Java](https://www.baeldung.com/java-assert-string-not-empty) - [Get Substring from String in Java](https://www.baeldung.com/java-substring) - [Converting a Stack Trace to a String in Java](https://www.baeldung.com/java-stacktrace-to-string) - [Sorting a String Alphabetically in Java](https://www.baeldung.com/java-sort-string-alphabetically) - [Remove Emojis from a Java String](https://www.baeldung.com/java-string-remove-emojis) - [String Not Empty Test Assertions in Java](https://www.baeldung.com/java-assert-string-not-empty) - [String Performance Hints](https://www.baeldung.com/java-string-performance) +- [Using indexOf to Find All Occurrences of a Word in a String](https://www.baeldung.com/java-indexOf-find-string-occurrences) +- [Java Base64 Encoding and Decoding](https://www.baeldung.com/java-base64-encode-and-decode) +- [Generate a Secure Random Password in Java](https://www.baeldung.com/java-generate-secure-password) +- [Removing Repeated Characters from a String](https://www.baeldung.com/java-remove-repeated-char) +- [Join Array of Primitives with Separator in Java](https://www.baeldung.com/java-join-primitive-array) +- [Convert String to Byte Array and Reverse in Java](https://www.baeldung.com/java-string-to-byte-array) +- [Pad a String with Zeros or Spaces in Java](https://www.baeldung.com/java-pad-string) +- [Adding a Newline Character to a String in Java](https://www.baeldung.com/java-string-newline) +- [Remove or Replace part of a String in Java](https://www.baeldung.com/java-remove-replace-string-part) diff --git a/java-strings/pom.xml b/java-strings/pom.xml old mode 100644 new mode 100755 index b1ba49b33a..f4fb1c0865 --- a/java-strings/pom.xml +++ b/java-strings/pom.xml @@ -68,7 +68,33 @@ emoji-java 4.0.0 - + + + org.junit.jupiter + junit-jupiter-api + 5.3.1 + test + + + + org.hamcrest + hamcrest-library + 1.3 + test + + + + + org.passay + passay + 1.3.1 + + + org.apache.commons + commons-text + 1.4 + + @@ -96,13 +122,13 @@ - 3.5 + 3.8.1 1.10 3.6.1 1.19 61.1 - 26.0-jre + 27.0.1-jre - \ No newline at end of file + diff --git a/java-strings/src/main/java/com/baeldung/string/AddingNewLineToString.java b/java-strings/src/main/java/com/baeldung/string/AddingNewLineToString.java new file mode 100644 index 0000000000..b522f7337b --- /dev/null +++ b/java-strings/src/main/java/com/baeldung/string/AddingNewLineToString.java @@ -0,0 +1,69 @@ +package com.baeldung.string; + +public class AddingNewLineToString { + + public static void main(String[] args) { + String line1 = "Humpty Dumpty sat on a wall."; + String line2 = "Humpty Dumpty had a great fall."; + String rhyme = ""; + + System.out.println("***New Line in a String in Java***"); + //1. Using "\n" + System.out.println("1. Using \\n"); + rhyme = line1 + "\n" + line2; + System.out.println(rhyme); + + //2. Using "\r\n" + System.out.println("2. Using \\r\\n"); + rhyme = line1 + "\r\n" + line2; + System.out.println(rhyme); + + //3. Using "\r" + System.out.println("3. Using \\r"); + rhyme = line1 + "\r" + line2; + System.out.println(rhyme); + + //4. Using "\n\r" Note that this is not same as "\r\n" + // Using "\n\r" is equivalent to adding two lines + System.out.println("4. Using \\n\\r"); + rhyme = line1 + "\n\r" + line2; + System.out.println(rhyme); + + //5. Using System.lineSeparator() + System.out.println("5. Using System.lineSeparator()"); + rhyme = line1 + System.lineSeparator() + line2; + System.out.println(rhyme); + + //6. Using System.getProperty("line.separator") + System.out.println("6. Using System.getProperty(\"line.separator\")"); + rhyme = line1 + System.getProperty("line.separator") + line2; + System.out.println(rhyme); + + System.out.println("***HTML to rendered in a browser***"); + //1. Line break for HTML using
+ System.out.println("1. Line break for HTML using
"); + rhyme = line1 + "
" + line2; + System.out.println(rhyme); + + //2. Line break for HTML using “ ” + System.out.println("2. Line break for HTML using "); + rhyme = line1 + " " + line2; + System.out.println(rhyme); + + //3. Line break for HTML using “ ” + System.out.println("3. Line break for HTML using "); + rhyme = line1 + " " + line2; + System.out.println(rhyme); + + //4. Line break for HTML using “ ;” + System.out.println("4. Line break for HTML using "); + rhyme = line1 + " " + line2; + System.out.println(rhyme); + + //5. Line break for HTML using \n” + System.out.println("5. Line break for HTML using \\n"); + rhyme = line1 + "\n" + line2; + System.out.println(rhyme); + } + +} \ No newline at end of file diff --git a/java-strings/src/main/java/com/baeldung/string/SubstringPalindrome.java b/java-strings/src/main/java/com/baeldung/string/SubstringPalindrome.java new file mode 100644 index 0000000000..688bf43b3c --- /dev/null +++ b/java-strings/src/main/java/com/baeldung/string/SubstringPalindrome.java @@ -0,0 +1,90 @@ +package com.baeldung.string; + +import java.util.HashSet; +import java.util.Set; + +public class SubstringPalindrome { + + public Set findAllPalindromesUsingCenter(String input) { + final Set palindromes = new HashSet<>(); + if (input == null || input.isEmpty()) { + return palindromes; + } + if (input.length() == 1) { + palindromes.add(input); + return palindromes; + } + for (int i = 0; i < input.length(); i++) { + palindromes.addAll(findPalindromes(input, i, i + 1)); + palindromes.addAll(findPalindromes(input, i, i)); + } + return palindromes; + } + + private Set findPalindromes(String input, int low, int high) { + Set result = new HashSet<>(); + while (low >= 0 && high < input.length() && input.charAt(low) == input.charAt(high)) { + result.add(input.substring(low, high + 1)); + low--; + high++; + } + return result; + } + + public Set findAllPalindromesUsingBruteForceApproach(String input) { + Set palindromes = new HashSet<>(); + if (input == null || input.isEmpty()) { + return palindromes; + } + if (input.length() == 1) { + palindromes.add(input); + return palindromes; + } + for (int i = 0; i < input.length(); i++) { + for (int j = i + 1; j <= input.length(); j++) + if (isPalindrome(input.substring(i, j))) { + palindromes.add(input.substring(i, j)); + } + } + return palindromes; + } + + private boolean isPalindrome(String input) { + StringBuilder plain = new StringBuilder(input); + StringBuilder reverse = plain.reverse(); + return (reverse.toString()).equals(input); + } + + public Set findAllPalindromesUsingManachersAlgorithm(String input) { + Set palindromes = new HashSet<>(); + String formattedInput = "@" + input + "#"; + char inputCharArr[] = formattedInput.toCharArray(); + int max; + int radius[][] = new int[2][input.length() + 1]; + for (int j = 0; j <= 1; j++) { + radius[j][0] = max = 0; + int i = 1; + while (i <= input.length()) { + palindromes.add(Character.toString(inputCharArr[i])); + while (inputCharArr[i - max - 1] == inputCharArr[i + j + max]) + max++; + radius[j][i] = max; + int k = 1; + while ((radius[j][i - k] != max - k) && (k < max)) { + radius[j][i + k] = Math.min(radius[j][i - k], max - k); + k++; + } + max = Math.max(max - k, 0); + i += k; + } + } + for (int i = 1; i <= input.length(); i++) { + for (int j = 0; j <= 1; j++) { + for (max = radius[j][i]; max > 0; max--) { + palindromes.add(input.substring(i - max - 1, max + j + i - 1)); + } + } + } + return palindromes; + } +} diff --git a/java-strings/src/main/java/com/baeldung/string/checkinputs/CheckIntegerInput.java b/java-strings/src/main/java/com/baeldung/string/checkinputs/CheckIntegerInput.java new file mode 100644 index 0000000000..9462244bbb --- /dev/null +++ b/java-strings/src/main/java/com/baeldung/string/checkinputs/CheckIntegerInput.java @@ -0,0 +1,19 @@ +package com.baeldung.string.checkinputs; + +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/java-strings/src/main/java/com/baeldung/string/padding/StringPaddingUtil.java b/java-strings/src/main/java/com/baeldung/string/padding/StringPaddingUtil.java new file mode 100644 index 0000000000..80d05bb42a --- /dev/null +++ b/java-strings/src/main/java/com/baeldung/string/padding/StringPaddingUtil.java @@ -0,0 +1,34 @@ +package com.baeldung.string.padding; + +public class StringPaddingUtil { + + public static String padLeftSpaces(String inputString, int length) { + if (inputString.length() >= length) { + return inputString; + } + StringBuilder sb = new StringBuilder(); + while (sb.length() < length - inputString.length()) { + sb.append(' '); + } + sb.append(inputString); + + return sb.toString(); + } + + public static String padLeft(String inputString, int length) { + if (inputString.length() >= length) { + return inputString; + } + StringBuilder sb = new StringBuilder(); + for (int i = 0; i < length; i++) { + sb.append(' '); + } + return sb.substring(inputString.length()) + inputString; + } + + public static String padLeftZeros(String inputString, int length) { + return String + .format("%1$" + length + "s", inputString) + .replace(' ', '0'); + } +} diff --git a/java-strings/src/main/java/com/baeldung/string/password/RandomPasswordGenerator.java b/java-strings/src/main/java/com/baeldung/string/password/RandomPasswordGenerator.java new file mode 100644 index 0000000000..46af4d7c51 --- /dev/null +++ b/java-strings/src/main/java/com/baeldung/string/password/RandomPasswordGenerator.java @@ -0,0 +1,152 @@ +package com.baeldung.string.password; + +import java.security.SecureRandom; +import java.util.Collections; +import java.util.List; +import java.util.Random; +import java.util.stream.Collectors; +import java.util.stream.IntStream; +import java.util.stream.Stream; + +import org.apache.commons.lang3.RandomStringUtils; +import org.apache.commons.text.RandomStringGenerator; +import org.passay.CharacterData; +import org.passay.CharacterRule; +import org.passay.EnglishCharacterData; +import org.passay.PasswordGenerator; + +public class RandomPasswordGenerator { + + /** + * Special characters allowed in password. + */ + public static final String ALLOWED_SPL_CHARACTERS = "!@#$%^&*()_+"; + + public static final String ERROR_CODE = "ERRONEOUS_SPECIAL_CHARS"; + + Random random = new SecureRandom(); + + public String generatePassayPassword() { + PasswordGenerator gen = new PasswordGenerator(); + CharacterData lowerCaseChars = EnglishCharacterData.LowerCase; + CharacterRule lowerCaseRule = new CharacterRule(lowerCaseChars); + lowerCaseRule.setNumberOfCharacters(2); + CharacterData upperCaseChars = EnglishCharacterData.UpperCase; + CharacterRule upperCaseRule = new CharacterRule(upperCaseChars); + upperCaseRule.setNumberOfCharacters(2); + CharacterData digitChars = EnglishCharacterData.Digit; + CharacterRule digitRule = new CharacterRule(digitChars); + digitRule.setNumberOfCharacters(2); + CharacterData specialChars = new CharacterData() { + public String getErrorCode() { + return ERROR_CODE; + } + + public String getCharacters() { + return ALLOWED_SPL_CHARACTERS; + } + }; + CharacterRule splCharRule = new CharacterRule(specialChars); + splCharRule.setNumberOfCharacters(2); + String password = gen.generatePassword(10, splCharRule, lowerCaseRule, upperCaseRule, digitRule); + return password; + } + + public String generateCommonTextPassword() { + String pwString = generateRandomSpecialCharacters(2).concat(generateRandomNumbers(2)) + .concat(generateRandomAlphabet(2, true)) + .concat(generateRandomAlphabet(2, false)) + .concat(generateRandomCharacters(2)); + List pwChars = pwString.chars() + .mapToObj(data -> (char) data) + .collect(Collectors.toList()); + Collections.shuffle(pwChars); + String password = pwChars.stream() + .collect(StringBuilder::new, StringBuilder::append, StringBuilder::append) + .toString(); + return password; + } + + public String generateCommonsLang3Password() { + String upperCaseLetters = RandomStringUtils.random(2, 65, 90, true, true); + String lowerCaseLetters = RandomStringUtils.random(2, 97, 122, true, true); + String numbers = RandomStringUtils.randomNumeric(2); + String specialChar = RandomStringUtils.random(2, 33, 47, false, false); + String totalChars = RandomStringUtils.randomAlphanumeric(2); + String combinedChars = upperCaseLetters.concat(lowerCaseLetters) + .concat(numbers) + .concat(specialChar) + .concat(totalChars); + List pwdChars = combinedChars.chars() + .mapToObj(c -> (char) c) + .collect(Collectors.toList()); + Collections.shuffle(pwdChars); + String password = pwdChars.stream() + .collect(StringBuilder::new, StringBuilder::append, StringBuilder::append) + .toString(); + return password; + } + + public String generateSecureRandomPassword() { + Stream pwdStream = Stream.concat(getRandomNumbers(2), Stream.concat(getRandomSpecialChars(2), Stream.concat(getRandomAlphabets(2, true), getRandomAlphabets(4, false)))); + List charList = pwdStream.collect(Collectors.toList()); + Collections.shuffle(charList); + String password = charList.stream() + .collect(StringBuilder::new, StringBuilder::append, StringBuilder::append) + .toString(); + return password; + } + + public String generateRandomSpecialCharacters(int length) { + RandomStringGenerator pwdGenerator = new RandomStringGenerator.Builder().withinRange(33, 45) + .build(); + return pwdGenerator.generate(length); + } + + public String generateRandomNumbers(int length) { + RandomStringGenerator pwdGenerator = new RandomStringGenerator.Builder().withinRange(48, 57) + .build(); + return pwdGenerator.generate(length); + } + + public String generateRandomCharacters(int length) { + RandomStringGenerator pwdGenerator = new RandomStringGenerator.Builder().withinRange(48, 57) + .build(); + return pwdGenerator.generate(length); + } + + public String generateRandomAlphabet(int length, boolean lowerCase) { + int low; + int hi; + if (lowerCase) { + low = 97; + hi = 122; + } else { + low = 65; + hi = 90; + } + RandomStringGenerator pwdGenerator = new RandomStringGenerator.Builder().withinRange(low, hi) + .build(); + return pwdGenerator.generate(length); + } + + public Stream getRandomAlphabets(int count, boolean upperCase) { + IntStream characters = null; + if (upperCase) { + characters = random.ints(count, 65, 90); + } else { + characters = random.ints(count, 97, 122); + } + return characters.mapToObj(data -> (char) data); + } + + public Stream getRandomNumbers(int count) { + IntStream numbers = random.ints(count, 48, 57); + return numbers.mapToObj(data -> (char) data); + } + + public Stream getRandomSpecialChars(int count) { + IntStream specialChars = random.ints(count, 33, 45); + return specialChars.mapToObj(data -> (char) data); + } +} diff --git a/java-strings/src/main/java/com/baeldung/string/removeleadingtrailingchar/RemoveLeadingAndTrailingZeroes.java b/java-strings/src/main/java/com/baeldung/string/removeleadingtrailingchar/RemoveLeadingAndTrailingZeroes.java new file mode 100644 index 0000000000..c9d748e897 --- /dev/null +++ b/java-strings/src/main/java/com/baeldung/string/removeleadingtrailingchar/RemoveLeadingAndTrailingZeroes.java @@ -0,0 +1,103 @@ +package com.baeldung.string.removeleadingtrailingchar; + + +import org.apache.commons.lang3.StringUtils; + +import com.google.common.base.CharMatcher; + +public class RemoveLeadingAndTrailingZeroes { + + public static String removeLeadingZeroesWithStringBuilder(String s) { + StringBuilder sb = new StringBuilder(s); + + while (sb.length() > 1 && sb.charAt(0) == '0') { + sb.deleteCharAt(0); + } + + return sb.toString(); + } + + public static String removeTrailingZeroesWithStringBuilder(String s) { + StringBuilder sb = new StringBuilder(s); + + while (sb.length() > 1 && sb.charAt(sb.length() - 1) == '0') { + sb.setLength(sb.length() - 1); + } + + return sb.toString(); + } + + public static String removeLeadingZeroesWithSubstring(String s) { + int index = 0; + + for (; index < s.length() - 1; index++) { + if (s.charAt(index) != '0') { + break; + } + } + + return s.substring(index); + } + + public static String removeTrailingZeroesWithSubstring(String s) { + int index = s.length() - 1; + + for (; index > 0; index--) { + if (s.charAt(index) != '0') { + break; + } + } + + return s.substring(0, index + 1); + } + + public static String removeLeadingZeroesWithApacheCommonsStripStart(String s) { + String stripped = StringUtils.stripStart(s, "0"); + + if (stripped.isEmpty() && !s.isEmpty()) { + return "0"; + } + + return stripped; + } + + public static String removeTrailingZeroesWithApacheCommonsStripEnd(String s) { + String stripped = StringUtils.stripEnd(s, "0"); + + if (stripped.isEmpty() && !s.isEmpty()) { + return "0"; + } + + return stripped; + } + + public static String removeLeadingZeroesWithGuavaTrimLeadingFrom(String s) { + String stripped = CharMatcher.is('0') + .trimLeadingFrom(s); + + if (stripped.isEmpty() && !s.isEmpty()) { + return "0"; + } + + return stripped; + } + + public static String removeTrailingZeroesWithGuavaTrimTrailingFrom(String s) { + String stripped = CharMatcher.is('0') + .trimTrailingFrom(s); + + if (stripped.isEmpty() && !s.isEmpty()) { + return "0"; + } + + return stripped; + } + + public static String removeLeadingZeroesWithRegex(String s) { + return s.replaceAll("^0+(?!$)", ""); + } + + public static String removeTrailingZeroesWithRegex(String s) { + return s.replaceAll("(?!^)0+$", ""); + } +} diff --git a/java-strings/src/main/java/com/baeldung/string/searching/WordIndexer.java b/java-strings/src/main/java/com/baeldung/string/searching/WordIndexer.java new file mode 100644 index 0000000000..1bcad6dd32 --- /dev/null +++ b/java-strings/src/main/java/com/baeldung/string/searching/WordIndexer.java @@ -0,0 +1,45 @@ +package com.baeldung.string.searching; + +import java.util.ArrayList; +import java.util.List; + +public class WordIndexer { + + public List findWord(String textString, String word) { + int index = 0; + List indexes = new ArrayList(); + String lowerCaseTextString = textString.toLowerCase(); + String lowerCaseWord = word.toLowerCase(); + + while(index != -1) { + index = lowerCaseTextString.indexOf(lowerCaseWord, index); + if (index == -1) { + break; + } + + indexes.add(index); + index++; + } + return indexes; + } + + + + public List findWordUpgrade(String textString, String word) { + int index = 0; + List indexes = new ArrayList(); + StringBuilder output = new StringBuilder(); + String lowerCaseTextString = textString.toLowerCase(); + String lowerCaseWord = word.toLowerCase(); + int wordLength = 0; + + while(index != -1){ + index = lowerCaseTextString.indexOf(lowerCaseWord, index + wordLength); // Slight improvement + if (index != -1) { + indexes.add(index); + } + wordLength = word.length(); + } + return indexes; + } +} diff --git a/java-strings/src/main/java/com/baeldung/stringduplicates/RemoveDuplicateFromString.java b/java-strings/src/main/java/com/baeldung/stringduplicates/RemoveDuplicateFromString.java new file mode 100644 index 0000000000..d8fd9c4b14 --- /dev/null +++ b/java-strings/src/main/java/com/baeldung/stringduplicates/RemoveDuplicateFromString.java @@ -0,0 +1,102 @@ +package com.baeldung.stringduplicates; + +import java.util.Arrays; +import java.util.HashSet; +import java.util.LinkedHashSet; +import java.util.Set; + +public class RemoveDuplicateFromString { + + + String removeDuplicatesUsingCharArray(String str) { + + char[] chars = str.toCharArray(); + StringBuilder sb = new StringBuilder(); + int repeatedCtr; + for (int i = 0; i < chars.length; i++) { + repeatedCtr = 0; + for (int j = i + 1; j < chars.length; j++) { + if (chars[i] == chars[j]) { + repeatedCtr++; + } + } + if (repeatedCtr == 0) { + sb.append(chars[i]); + } + } + return sb.toString(); + } + + String removeDuplicatesUsinglinkedHashSet(String str) { + + StringBuilder sb = new StringBuilder(); + Set linkedHashSet = new LinkedHashSet<>(); + + for (int i = 0; i < str.length(); i++) { + linkedHashSet.add(str.charAt(i)); + } + + for (Character c : linkedHashSet) { + sb.append(c); + } + + return sb.toString(); + } + + String removeDuplicatesUsingSorting(String str) { + StringBuilder sb = new StringBuilder(); + if(!str.isEmpty()) { + char[] chars = str.toCharArray(); + Arrays.sort(chars); + + sb.append(chars[0]); + for (int i = 1; i < chars.length; i++) { + if (chars[i] != chars[i - 1]) { + sb.append(chars[i]); + } + } + } + + return sb.toString(); + } + + String removeDuplicatesUsingHashSet(String str) { + + StringBuilder sb = new StringBuilder(); + Set hashSet = new HashSet<>(); + + for (int i = 0; i < str.length(); i++) { + hashSet.add(str.charAt(i)); + } + + for (Character c : hashSet) { + sb.append(c); + } + + return sb.toString(); + } + + String removeDuplicatesUsingIndexOf(String str) { + + StringBuilder sb = new StringBuilder(); + int idx; + for (int i = 0; i < str.length(); i++) { + char c = str.charAt(i); + idx = str.indexOf(c, i + 1); + if (idx == -1) { + sb.append(c); + } + } + return sb.toString(); + } + + + String removeDuplicatesUsingDistinct(String str) { + StringBuilder sb = new StringBuilder(); + str.chars().distinct().forEach(c -> sb.append((char) c)); + return sb.toString(); + } + +} + + diff --git a/java-strings/src/test/java/com/baeldung/java8/base64/StringToByteArrayUnitTest.java b/java-strings/src/test/java/com/baeldung/java8/base64/StringToByteArrayUnitTest.java new file mode 100644 index 0000000000..c5f7051c25 --- /dev/null +++ b/java-strings/src/test/java/com/baeldung/java8/base64/StringToByteArrayUnitTest.java @@ -0,0 +1,59 @@ +package com.baeldung.java8.base64; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + +import java.io.UnsupportedEncodingException; +import java.nio.charset.StandardCharsets; +import java.util.Arrays; +import java.util.Base64; + +import javax.xml.bind.DatatypeConverter; + +import org.junit.Test; + +public class StringToByteArrayUnitTest { + + @Test + public void whenConvertStringToByteArrayUsingStringClass_thenOk() { + final String originalInput = "test input"; + byte[] result = originalInput.getBytes(); + System.out.println(Arrays.toString(result)); + + assertEquals(originalInput.length(), result.length); + } + + @Test + public void givenCharset_whenConvertStringToByteArrayUsingStringClass_thenOk() throws UnsupportedEncodingException { + final String originalInput = "test input"; + byte[] result = originalInput.getBytes(StandardCharsets.UTF_16); + System.out.println(Arrays.toString(result)); + + assertTrue(originalInput.length() < result.length); + } + + @Test + public void whenConvertStringToByteArrayUsingBase64Decoder_thenOk() { + final String originalInput = "dGVzdCBpbnB1dA=="; + byte[] result = Base64.getDecoder().decode(originalInput); + + assertEquals("test input", new String(result)); + } + + @Test + public void whenConvertStringToByteArrayUsingDatatypeConverter_thenOk() { + final String originalInput = "dGVzdCBpbnB1dA=="; + byte[] result = DatatypeConverter.parseBase64Binary(originalInput); + + assertEquals("test input", new String(result)); + } + + @Test + public void whenConvertStringToByteArray_thenOk(){ + String originalInput = "7465737420696E707574"; + byte[] result = DatatypeConverter.parseHexBinary(originalInput); + System.out.println(Arrays.toString(result)); + + assertEquals("test input", new String(result)); + } +} diff --git a/java-strings/src/test/java/com/baeldung/string/StringFromPrimitiveArrayUnitTest.java b/java-strings/src/test/java/com/baeldung/string/StringFromPrimitiveArrayUnitTest.java new file mode 100644 index 0000000000..c93089e543 --- /dev/null +++ b/java-strings/src/test/java/com/baeldung/string/StringFromPrimitiveArrayUnitTest.java @@ -0,0 +1,129 @@ +package com.baeldung.string; + +import com.google.common.base.Joiner; +import com.google.common.primitives.Chars; +import com.google.common.primitives.Ints; +import org.apache.commons.lang3.ArrayUtils; +import org.apache.commons.lang3.StringUtils; +import org.junit.Test; + +import java.nio.CharBuffer; +import java.util.Arrays; +import java.util.StringJoiner; +import java.util.stream.Collectors; + +import static org.assertj.core.api.Assertions.assertThat; + + +public class StringFromPrimitiveArrayUnitTest { + + private int[] intArray = {1, 2, 3, 4, 5, 6, 7, 8, 9}; + + private char[] charArray = {'a', 'b', 'c', 'd', 'e', 'f'}; + + private char separatorChar = '-'; + + private String separator = String.valueOf(separatorChar); + + private String expectedIntString = "1-2-3-4-5-6-7-8-9"; + + private String expectedCharString = "a-b-c-d-e-f"; + + @Test + public void givenIntArray_whenJoinBySeparator_thenReturnsString_through_Java8CollectorsJoining() { + assertThat(Arrays.stream(intArray) + .mapToObj(String::valueOf) + .collect(Collectors.joining(separator))) + .isEqualTo(expectedIntString); + } + + @Test + public void givenCharArray_whenJoinBySeparator_thenReturnsString_through_Java8CollectorsJoining() { + assertThat(CharBuffer.wrap(charArray).chars() + .mapToObj(intChar -> String.valueOf((char) intChar)) + .collect(Collectors.joining(separator))) + .isEqualTo(expectedCharString); + } + + + @Test + public void giveIntArray_whenJoinBySeparator_thenReturnsString_through_Java8StringJoiner() { + StringJoiner intStringJoiner = new StringJoiner(separator); + + Arrays.stream(intArray) + .mapToObj(String::valueOf) + .forEach(intStringJoiner::add); + + assertThat(intStringJoiner.toString()).isEqualTo(expectedIntString); + } + + @Test + public void givenCharArray_whenJoinBySeparator_thenReturnsString_through_Java8StringJoiner() { + StringJoiner charStringJoiner = new StringJoiner(separator); + + CharBuffer.wrap(charArray).chars() + .mapToObj(intChar -> String.valueOf((char) intChar)) + .forEach(charStringJoiner::add); + + assertThat(charStringJoiner.toString()).isEqualTo(expectedCharString); + } + + @Test + public void givenIntArray_whenJoinBySeparator_thenReturnsString_through_CommonsLang() { + assertThat(StringUtils.join(intArray, separatorChar)).isEqualTo(expectedIntString); + assertThat(StringUtils.join(ArrayUtils.toObject(intArray), separator)).isEqualTo(expectedIntString); + } + + @Test + public void givenCharArray_whenJoinBySeparator_thenReturnsString_through_CommonsLang() { + assertThat(StringUtils.join(charArray, separatorChar)).isEqualTo(expectedCharString); + assertThat(StringUtils.join(ArrayUtils.toObject(charArray), separator)).isEqualTo(expectedCharString); + } + + @Test + public void givenIntArray_whenJoinBySeparator_thenReturnsString_through_GuavaJoiner() { + assertThat(Joiner.on(separator).join(Ints.asList(intArray))).isEqualTo(expectedIntString); + } + + @Test + public void givenCharArray_whenJoinBySeparator_thenReturnsString_through_GuavaJoiner() { + assertThat(Joiner.on(separator).join(Chars.asList(charArray))).isEqualTo(expectedCharString); + } + + @Test + public void givenIntArray_whenJoinBySeparator_thenReturnsString_through_Java7StringBuilder() { + assertThat(joinIntArrayWithStringBuilder(intArray, separator)).isEqualTo(expectedIntString); + } + + @Test + public void givenCharArray_whenJoinBySeparator_thenReturnsString_through_Java7StringBuilder() { + assertThat(joinCharArrayWithStringBuilder(charArray, separator)).isEqualTo(expectedCharString); + } + + private String joinIntArrayWithStringBuilder(int[] array, String separator) { + if (array.length == 0) { + return ""; + } + StringBuilder stringBuilder = new StringBuilder(); + for (int i = 0; i < array.length - 1; i++) { + stringBuilder.append(array[i]); + stringBuilder.append(separator); + } + stringBuilder.append(array[array.length - 1]); + return stringBuilder.toString(); + } + + private String joinCharArrayWithStringBuilder(char[] array, String separator) { + if (array.length == 0) { + return ""; + } + StringBuilder stringBuilder = new StringBuilder(); + for (int i = 0; i < array.length - 1; i++) { + stringBuilder.append(array[i]); + stringBuilder.append(separator); + } + stringBuilder.append(array[array.length - 1]); + return stringBuilder.toString(); + } + +} diff --git a/java-strings/src/test/java/com/baeldung/string/StringReplaceAndRemoveUnitTest.java b/java-strings/src/test/java/com/baeldung/string/StringReplaceAndRemoveUnitTest.java new file mode 100644 index 0000000000..d952d2383b --- /dev/null +++ b/java-strings/src/test/java/com/baeldung/string/StringReplaceAndRemoveUnitTest.java @@ -0,0 +1,83 @@ +package com.baeldung.string; + + +import org.apache.commons.lang3.StringUtils; +import org.junit.Test; + +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + +public class StringReplaceAndRemoveUnitTest { + + + @Test + public void givenTestStrings_whenReplace_thenProcessedString() { + + String master = "Hello World Baeldung!"; + String target = "Baeldung"; + String replacement = "Java"; + String processed = master.replace(target, replacement); + assertTrue(processed.contains(replacement)); + assertFalse(processed.contains(target)); + + } + + @Test + public void givenTestStrings_whenReplaceAll_thenProcessedString() { + + String master2 = "Welcome to Baeldung, Hello World Baeldung"; + String regexTarget= "(Baeldung)$"; + String replacement = "Java"; + String processed2 = master2.replaceAll(regexTarget, replacement); + assertTrue(processed2.endsWith("Java")); + + } + + @Test + public void givenTestStrings_whenStringBuilderMethods_thenProcessedString() { + + String master = "Hello World Baeldung!"; + String target = "Baeldung"; + String replacement = "Java"; + + int startIndex = master.indexOf(target); + int stopIndex = startIndex + target.length(); + + StringBuilder builder = new StringBuilder(master); + + + builder.delete(startIndex, stopIndex); + assertFalse(builder.toString().contains(target)); + + + builder.replace(startIndex, stopIndex, replacement); + assertTrue(builder.toString().contains(replacement)); + + + } + + + @Test + public void givenTestStrings_whenStringUtilsMethods_thenProcessedStrings() { + + String master = "Hello World Baeldung!"; + String target = "Baeldung"; + String replacement = "Java"; + + String processed = StringUtils.replace(master, target, replacement); + assertTrue(processed.contains(replacement)); + + String master2 = "Hello World Baeldung!"; + String target2 = "baeldung"; + String processed2 = StringUtils.replaceIgnoreCase(master2, target2, replacement); + assertFalse(processed2.contains(target)); + + } + + + + + + + +} diff --git a/java-strings/src/test/java/com/baeldung/string/SubstringPalindromeUnitTest.java b/java-strings/src/test/java/com/baeldung/string/SubstringPalindromeUnitTest.java new file mode 100644 index 0000000000..b18a8d4a5f --- /dev/null +++ b/java-strings/src/test/java/com/baeldung/string/SubstringPalindromeUnitTest.java @@ -0,0 +1,83 @@ +package com.baeldung.string; + +import static org.junit.Assert.assertEquals; +import java.util.HashSet; +import java.util.Set; +import org.junit.Test; + +public class SubstringPalindromeUnitTest { + + private static final String INPUT_BUBBLE = "bubble"; + private static final String INPUT_CIVIC = "civic"; + private static final String INPUT_INDEED = "indeed"; + private static final String INPUT_ABABAC = "ababac"; + + Set EXPECTED_PALINDROME_BUBBLE = new HashSet() { + { + add("b"); + add("u"); + add("l"); + add("e"); + add("bb"); + add("bub"); + } + }; + + Set EXPECTED_PALINDROME_CIVIC = new HashSet() { + { + add("civic"); + add("ivi"); + add("i"); + add("c"); + add("v"); + } + }; + + Set EXPECTED_PALINDROME_INDEED = new HashSet() { + { + add("i"); + add("n"); + add("d"); + add("e"); + add("ee"); + add("deed"); + } + }; + + Set EXPECTED_PALINDROME_ABABAC = new HashSet() { + { + add("a"); + add("b"); + add("c"); + add("aba"); + add("bab"); + add("ababa"); + } + }; + + private SubstringPalindrome palindrome = new SubstringPalindrome(); + + @Test + public void whenUsingManachersAlgorithm_thenFindsAllPalindromes() { + assertEquals(EXPECTED_PALINDROME_BUBBLE, palindrome.findAllPalindromesUsingManachersAlgorithm(INPUT_BUBBLE)); + assertEquals(EXPECTED_PALINDROME_INDEED, palindrome.findAllPalindromesUsingManachersAlgorithm(INPUT_INDEED)); + assertEquals(EXPECTED_PALINDROME_CIVIC, palindrome.findAllPalindromesUsingManachersAlgorithm(INPUT_CIVIC)); + assertEquals(EXPECTED_PALINDROME_ABABAC, palindrome.findAllPalindromesUsingManachersAlgorithm(INPUT_ABABAC)); + } + + @Test + public void whenUsingCenterApproach_thenFindsAllPalindromes() { + assertEquals(EXPECTED_PALINDROME_BUBBLE, palindrome.findAllPalindromesUsingCenter(INPUT_BUBBLE)); + assertEquals(EXPECTED_PALINDROME_INDEED, palindrome.findAllPalindromesUsingCenter(INPUT_INDEED)); + assertEquals(EXPECTED_PALINDROME_CIVIC, palindrome.findAllPalindromesUsingCenter(INPUT_CIVIC)); + assertEquals(EXPECTED_PALINDROME_ABABAC, palindrome.findAllPalindromesUsingCenter(INPUT_ABABAC)); + } + + @Test + public void whenUsingBruteForceApproach_thenFindsAllPalindromes() { + assertEquals(EXPECTED_PALINDROME_BUBBLE, palindrome.findAllPalindromesUsingBruteForceApproach(INPUT_BUBBLE)); + assertEquals(EXPECTED_PALINDROME_INDEED, palindrome.findAllPalindromesUsingBruteForceApproach(INPUT_INDEED)); + assertEquals(EXPECTED_PALINDROME_CIVIC, palindrome.findAllPalindromesUsingBruteForceApproach(INPUT_CIVIC)); + assertEquals(EXPECTED_PALINDROME_ABABAC, palindrome.findAllPalindromesUsingBruteForceApproach(INPUT_ABABAC)); + } +} diff --git a/java-strings/src/test/java/com/baeldung/string/SubstringUnitTest.java b/java-strings/src/test/java/com/baeldung/string/SubstringUnitTest.java index 3a4e231828..eb397f2a3f 100644 --- a/java-strings/src/test/java/com/baeldung/string/SubstringUnitTest.java +++ b/java-strings/src/test/java/com/baeldung/string/SubstringUnitTest.java @@ -59,4 +59,14 @@ public class SubstringUnitTest { Assert.assertEquals("United States of America", text.substring(text.indexOf('(') + 1, text.indexOf(')'))); } + @Test + public void givenAString_whenUsedSubstringWithLastIndexOf_ShouldReturnProperSubstring() { + Assert.assertEquals("1984", text.substring(text.lastIndexOf('-') + 1, text.indexOf('.'))); + } + + @Test + public void givenAString_whenUsedSubstringWithIndexOfAString_ShouldReturnProperSubstring() { + Assert.assertEquals("USA (United States of America)", text.substring(text.indexOf("USA"), text.indexOf(')') + 1)); + } + } diff --git a/java-strings/src/test/java/com/baeldung/string/padding/StringPaddingUtilUnitTest.java b/java-strings/src/test/java/com/baeldung/string/padding/StringPaddingUtilUnitTest.java new file mode 100644 index 0000000000..f6a077a88e --- /dev/null +++ b/java-strings/src/test/java/com/baeldung/string/padding/StringPaddingUtilUnitTest.java @@ -0,0 +1,50 @@ +package com.baeldung.string.padding; + +import com.google.common.base.Strings; +import org.apache.commons.lang3.StringUtils; +import org.junit.Test; + +import static org.junit.Assert.assertEquals; + +public class StringPaddingUtilUnitTest { + + String inputString = "123456"; + String expectedPaddedStringSpaces = " 123456"; + String expectedPaddedStringZeros = "0000123456"; + int minPaddedStringLength = 10; + + @Test + public void givenString_whenPaddingWithSpaces_thenStringPaddedMatches() { + assertEquals(expectedPaddedStringSpaces, StringPaddingUtil.padLeftSpaces(inputString, minPaddedStringLength)); + } + + @Test + public void givenString_whenPaddingWithSpacesUsingSubstring_thenStringPaddedMatches() { + assertEquals(expectedPaddedStringSpaces, StringPaddingUtil.padLeft(inputString, minPaddedStringLength)); + } + + @Test + public void givenString_whenPaddingWithZeros_thenStringPaddedMatches() { + assertEquals(expectedPaddedStringZeros, StringPaddingUtil.padLeftZeros(inputString, minPaddedStringLength)); + } + + @Test + public void givenString_whenPaddingWithSpacesUsingStringUtils_thenStringPaddedMatches() { + assertEquals(expectedPaddedStringSpaces, StringUtils.leftPad(inputString, minPaddedStringLength)); + } + + @Test + public void givenString_whenPaddingWithZerosUsingStringUtils_thenStringPaddedMatches() { + assertEquals(expectedPaddedStringZeros, StringUtils.leftPad(inputString, minPaddedStringLength, "0")); + } + + @Test + public void givenString_whenPaddingWithSpacesUsingGuavaStrings_thenStringPaddedMatches() { + assertEquals(expectedPaddedStringSpaces, Strings.padStart(inputString, minPaddedStringLength, ' ')); + } + + @Test + public void givenString_whenPaddingWithZerosUsingGuavaStrings_thenStringPaddedMatches() { + assertEquals(expectedPaddedStringZeros, Strings.padStart(inputString, minPaddedStringLength, '0')); + } +} diff --git a/java-strings/src/test/java/com/baeldung/string/password/StringPasswordUnitTest.java b/java-strings/src/test/java/com/baeldung/string/password/StringPasswordUnitTest.java new file mode 100644 index 0000000000..bfd4b0fe8e --- /dev/null +++ b/java-strings/src/test/java/com/baeldung/string/password/StringPasswordUnitTest.java @@ -0,0 +1,64 @@ +package com.baeldung.string.password; + +import static org.junit.Assert.assertTrue; + +import org.junit.Test; + +/** + * Examples of passwords conforming to various specifications, using different libraries. + * + */ +public class StringPasswordUnitTest { + + RandomPasswordGenerator passGen = new RandomPasswordGenerator(); + + @Test + public void whenPasswordGeneratedUsingPassay_thenSuccessful() { + String password = passGen.generatePassayPassword(); + int specialCharCount = 0; + for (char c : password.toCharArray()) { + if (c >= 33 || c <= 47) { + specialCharCount++; + } + } + assertTrue("Password validation failed in Passay", specialCharCount >= 2); + } + + @Test + public void whenPasswordGeneratedUsingCommonsText_thenSuccessful() { + RandomPasswordGenerator passGen = new RandomPasswordGenerator(); + String password = passGen.generateCommonTextPassword(); + int lowerCaseCount = 0; + for (char c : password.toCharArray()) { + if (c >= 97 || c <= 122) { + lowerCaseCount++; + } + } + assertTrue("Password validation failed in commons-text ", lowerCaseCount >= 2); + } + + @Test + public void whenPasswordGeneratedUsingCommonsLang3_thenSuccessful() { + String password = passGen.generateCommonsLang3Password(); + int numCount = 0; + for (char c : password.toCharArray()) { + if (c >= 48 || c <= 57) { + numCount++; + } + } + assertTrue("Password validation failed in commons-lang3", numCount >= 2); + } + + @Test + public void whenPasswordGeneratedUsingSecureRandom_thenSuccessful() { + String password = passGen.generateSecureRandomPassword(); + int specialCharCount = 0; + for (char c : password.toCharArray()) { + if (c >= 33 || c <= 47) { + specialCharCount++; + } + } + assertTrue("Password validation failed in Secure Random", specialCharCount >= 2); + } + +} diff --git a/java-strings/src/test/java/com/baeldung/string/removeleadingtrailingchar/RemoveLeadingAndTrailingZeroesUnitTest.java b/java-strings/src/test/java/com/baeldung/string/removeleadingtrailingchar/RemoveLeadingAndTrailingZeroesUnitTest.java new file mode 100644 index 0000000000..55f932fea1 --- /dev/null +++ b/java-strings/src/test/java/com/baeldung/string/removeleadingtrailingchar/RemoveLeadingAndTrailingZeroesUnitTest.java @@ -0,0 +1,143 @@ +package com.baeldung.string.removeleadingtrailingchar; + +import static org.assertj.core.api.Assertions.assertThat; + +import java.util.stream.Stream; + +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.Arguments; +import org.junit.jupiter.params.provider.MethodSource; + +public class RemoveLeadingAndTrailingZeroesUnitTest { + + public static Stream leadingZeroTestProvider() { + return Stream.of(Arguments.of("", ""), Arguments.of("abc", "abc"), Arguments.of("123", "123"), Arguments.of("0abc", "abc"), Arguments.of("0123", "123"), Arguments.of("0000123", "123"), Arguments.of("1230", "1230"), Arguments.of("01230", "1230"), Arguments.of("01", "1"), + Arguments.of("0001", "1"), Arguments.of("0", "0"), Arguments.of("00", "0"), Arguments.of("0000", "0"), Arguments.of("12034", "12034"), Arguments.of("1200034", "1200034"), Arguments.of("0012034", "12034"), Arguments.of("1203400", "1203400")); + } + + public static Stream trailingZeroTestProvider() { + return Stream.of(Arguments.of("", ""), Arguments.of("abc", "abc"), Arguments.of("123", "123"), Arguments.of("abc0", "abc"), Arguments.of("1230", "123"), Arguments.of("1230000", "123"), Arguments.of("0123", "0123"), Arguments.of("01230", "0123"), Arguments.of("10", "1"), + Arguments.of("1000", "1"), Arguments.of("0", "0"), Arguments.of("00", "0"), Arguments.of("0000", "0"), Arguments.of("12034", "12034"), Arguments.of("1200034", "1200034"), Arguments.of("0012034", "0012034"), Arguments.of("1203400", "12034")); + } + + @ParameterizedTest + @MethodSource("leadingZeroTestProvider") + public void givenTestStrings_whenRemoveLeadingZeroesWithStringBuilder_thenReturnWithoutLeadingZeroes(String input, String expected) { + // given + + // when + String result = RemoveLeadingAndTrailingZeroes.removeLeadingZeroesWithStringBuilder(input); + + // then + assertThat(result).isEqualTo(expected); + } + + @ParameterizedTest + @MethodSource("trailingZeroTestProvider") + public void givenTestStrings_whenRemoveTrailingZeroesWithStringBuilder_thenReturnWithoutTrailingZeroes(String input, String expected) { + // given + + // when + String result = RemoveLeadingAndTrailingZeroes.removeTrailingZeroesWithStringBuilder(input); + + // then + assertThat(result).isEqualTo(expected); + } + + @ParameterizedTest + @MethodSource("leadingZeroTestProvider") + public void givenTestStrings_whenRemoveLeadingZeroesWithSubstring_thenReturnWithoutLeadingZeroes(String input, String expected) { + // given + + // when + String result = RemoveLeadingAndTrailingZeroes.removeLeadingZeroesWithSubstring(input); + + // then + assertThat(result).isEqualTo(expected); + } + + @ParameterizedTest + @MethodSource("trailingZeroTestProvider") + public void givenTestStrings_whenRemoveTrailingZeroesWithSubstring_thenReturnWithoutTrailingZeroes(String input, String expected) { + // given + + // when + String result = RemoveLeadingAndTrailingZeroes.removeTrailingZeroesWithSubstring(input); + + // then + assertThat(result).isEqualTo(expected); + } + + @ParameterizedTest + @MethodSource("leadingZeroTestProvider") + public void givenTestStrings_whenRemoveLeadingZeroesWithApacheCommonsStripStart_thenReturnWithoutLeadingZeroes(String input, String expected) { + // given + + // when + String result = RemoveLeadingAndTrailingZeroes.removeLeadingZeroesWithApacheCommonsStripStart(input); + + // then + assertThat(result).isEqualTo(expected); + } + + @ParameterizedTest + @MethodSource("trailingZeroTestProvider") + public void givenTestStrings_whenRemoveTrailingZeroesWithApacheCommonsStripEnd_thenReturnWithoutTrailingZeroes(String input, String expected) { + // given + + // when + String result = RemoveLeadingAndTrailingZeroes.removeTrailingZeroesWithApacheCommonsStripEnd(input); + + // then + assertThat(result).isEqualTo(expected); + } + + @ParameterizedTest + @MethodSource("leadingZeroTestProvider") + public void givenTestStrings_whenRemoveLeadingZeroesWithGuavaTrimLeadingFrom_thenReturnWithoutLeadingZeroes(String input, String expected) { + // given + + // when + String result = RemoveLeadingAndTrailingZeroes.removeLeadingZeroesWithGuavaTrimLeadingFrom(input); + + // then + assertThat(result).isEqualTo(expected); + } + + @ParameterizedTest + @MethodSource("trailingZeroTestProvider") + public void givenTestStrings_whenRemoveTrailingZeroesWithGuavaTrimTrailingFrom_thenReturnWithoutTrailingZeroes(String input, String expected) { + // given + + // when + String result = RemoveLeadingAndTrailingZeroes.removeTrailingZeroesWithGuavaTrimTrailingFrom(input); + + // then + assertThat(result).isEqualTo(expected); + } + + @ParameterizedTest + @MethodSource("leadingZeroTestProvider") + public void givenTestStrings_whenRemoveLeadingZeroesWithRegex_thenReturnWithoutLeadingZeroes(String input, String expected) { + // given + + // when + String result = RemoveLeadingAndTrailingZeroes.removeLeadingZeroesWithRegex(input); + + // then + assertThat(result).isEqualTo(expected); + } + + @ParameterizedTest + @MethodSource("trailingZeroTestProvider") + public void givenTestStrings_whenRemoveTrailingZeroesWithRegex_thenReturnWithoutTrailingZeroes(String input, String expected) { + // given + + // when + String result = RemoveLeadingAndTrailingZeroes.removeTrailingZeroesWithRegex(input); + + // then + assertThat(result).isEqualTo(expected); + } + +} diff --git a/java-strings/src/test/java/com/baeldung/string/searching/WordIndexerUnitTest.java b/java-strings/src/test/java/com/baeldung/string/searching/WordIndexerUnitTest.java new file mode 100644 index 0000000000..f3f76db01f --- /dev/null +++ b/java-strings/src/test/java/com/baeldung/string/searching/WordIndexerUnitTest.java @@ -0,0 +1,62 @@ +package com.baeldung.string.searching; + +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + +import java.util.Arrays; +import java.util.List; + +import static org.junit.jupiter.api.Assertions.assertEquals; + + +public class WordIndexerUnitTest { + + String theString; + WordIndexer wordIndexer; + + @BeforeEach + public void setUp() throws Exception { + wordIndexer = new WordIndexer(); + + theString = "To be, or not to be: that is the question: " + + "Whether 'tis nobler in the mind to suffer " + + "The slings and arrows of outrageous fortune, " + + "Or to take arms against a sea of troubles, " + + "And by opposing end them? To die: to sleep; " + + "No more; and by a sleep to say we end " + + "The heart-ache and the thousand natural shocks " + + "That flesh is heir to, 'tis a consummation " + + "Devoutly to be wish'd. To die, to sleep; " + + "To sleep: perchance to dream: ay, there's the rub: " + + "For in that sleep of death what dreams may come,"; + } + + @Test + + public void givenWord_whenSearching_thenFindAllIndexedLocations() { + List expectedResult = Arrays.asList(7, 122, 130, 221, 438); + + List actualResult = wordIndexer.findWord(theString, "or"); + + assertEquals(expectedResult, actualResult); + } + + @Test + public void givenWordWithNoRepeatCharacters_whenImprovedSearching_thenFindAllIndexedLocations() { + List expectedResult = Arrays.asList(7, 122, 130, 221, 438); + + List actualResult = wordIndexer.findWordUpgrade(theString, "or"); + + assertEquals(expectedResult, actualResult); + } + + + @Test + public void givenWord_whenSearching_thenFindAtEndOfString() { + List expectedResult = Arrays.asList(480); + + List actualResult = wordIndexer.findWordUpgrade(theString, "come,"); + + assertEquals(expectedResult, actualResult); + } +} diff --git a/java-strings/src/test/java/com/baeldung/stringduplicates/RemoveDuplicateFromStringUnitTest.java b/java-strings/src/test/java/com/baeldung/stringduplicates/RemoveDuplicateFromStringUnitTest.java new file mode 100644 index 0000000000..895ecc4a3b --- /dev/null +++ b/java-strings/src/test/java/com/baeldung/stringduplicates/RemoveDuplicateFromStringUnitTest.java @@ -0,0 +1,82 @@ +package com.baeldung.stringduplicates; + +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; + +public class RemoveDuplicateFromStringUnitTest { + + private final static String STR1 = "racecar"; + private final static String STR2 = "J2ee programming"; + private final static String STR_EMPTY = ""; + + private RemoveDuplicateFromString removeDuplicateFromString; + + @Before + public void executedBeforeEach() { + removeDuplicateFromString = new RemoveDuplicateFromString(); + } + + + @Test + public void whenUsingCharArray_DuplicatesShouldBeRemovedWithoutKeepingStringOrder() { + String str1 = removeDuplicateFromString.removeDuplicatesUsingCharArray(STR1); + String str2 = removeDuplicateFromString.removeDuplicatesUsingCharArray(STR2); + String strEmpty = removeDuplicateFromString.removeDuplicatesUsingCharArray(STR_EMPTY); + Assert.assertEquals("", strEmpty); + Assert.assertEquals("ecar", str1); + Assert.assertEquals("J2e poraming", str2); + } + + @Test + public void whenUsingLinkedHashSet_DuplicatesShouldBeRemovedAndItKeepStringOrder() { + String str1 = removeDuplicateFromString.removeDuplicatesUsinglinkedHashSet(STR1); + String str2 = removeDuplicateFromString.removeDuplicatesUsinglinkedHashSet(STR2); + + String strEmpty = removeDuplicateFromString.removeDuplicatesUsinglinkedHashSet(STR_EMPTY); + Assert.assertEquals("", strEmpty); + Assert.assertEquals("race", str1); + Assert.assertEquals("J2e progamin", str2); + } + + @Test + public void whenUsingSorting_DuplicatesShouldBeRemovedWithoutKeepingStringOrder() { + String str1 = removeDuplicateFromString.removeDuplicatesUsingSorting(STR1); + String str2 = removeDuplicateFromString.removeDuplicatesUsingSorting(STR2); + + String strEmpty = removeDuplicateFromString.removeDuplicatesUsingSorting(STR_EMPTY); + Assert.assertEquals("", strEmpty); + Assert.assertEquals("acer", str1); + Assert.assertEquals(" 2Jaegimnopr", str2); + } + + @Test + public void whenUsingHashSet_DuplicatesShouldBeRemovedWithoutKeepingStringOrder() { + String str1 = removeDuplicateFromString.removeDuplicatesUsingHashSet(STR1); + String str2 = removeDuplicateFromString.removeDuplicatesUsingHashSet(STR2); + String strEmpty = removeDuplicateFromString.removeDuplicatesUsingHashSet(STR_EMPTY); + Assert.assertEquals("", strEmpty); + Assert.assertEquals("arce", str1); + Assert.assertEquals(" pa2regiJmno", str2); + } + + @Test + public void whenUsingIndexOf_DuplicatesShouldBeRemovedWithoutKeepingStringOrder() { + String str1 = removeDuplicateFromString.removeDuplicatesUsingIndexOf(STR1); + String str2 = removeDuplicateFromString.removeDuplicatesUsingIndexOf(STR2); + String strEmpty = removeDuplicateFromString.removeDuplicatesUsingIndexOf(STR_EMPTY); + Assert.assertEquals("", strEmpty); + Assert.assertEquals("ecar", str1); + Assert.assertEquals("J2e poraming", str2); + } + + @Test + public void whenUsingJava8_DuplicatesShouldBeRemovedAndItKeepStringOrder() { + String str1 = removeDuplicateFromString.removeDuplicatesUsingDistinct(STR1); + String str2 = removeDuplicateFromString.removeDuplicatesUsingDistinct(STR2); + String strEmpty = removeDuplicateFromString.removeDuplicatesUsingDistinct(STR_EMPTY); + Assert.assertEquals("", strEmpty); + Assert.assertEquals("race", str1); + Assert.assertEquals("J2e progamin", str2); + } +} diff --git a/java-vavr-stream/pom.xml b/java-vavr-stream/pom.xml index 395d2c81ba..c92f3c8742 100644 --- a/java-vavr-stream/pom.xml +++ b/java-vavr-stream/pom.xml @@ -5,6 +5,7 @@ com.baeldung.samples java-vavr-stream 1.0 + java-vavr-stream jar diff --git a/java-websocket/pom.xml b/java-websocket/pom.xml index e8ff8dfc36..7ba3ca61d0 100644 --- a/java-websocket/pom.xml +++ b/java-websocket/pom.xml @@ -1,10 +1,10 @@ 4.0.0 - com.baeldung java-websocket - war 0.0.1-SNAPSHOT + java-websocket + war com.baeldung diff --git a/javafx/pom.xml b/javafx/pom.xml index c9c5bc294e..44e6f7e8da 100644 --- a/javafx/pom.xml +++ b/javafx/pom.xml @@ -3,7 +3,8 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 javafx - + javafx + parent-modules com.baeldung diff --git a/javax-servlets/pom.xml b/javax-servlets/pom.xml index 7b4eecd880..f00dd0ebe8 100644 --- a/javax-servlets/pom.xml +++ b/javax-servlets/pom.xml @@ -5,6 +5,7 @@ com.baeldung.javax-servlets javax-servlets 1.0-SNAPSHOT + javax-servlets war diff --git a/javaxval/pom.xml b/javaxval/pom.xml index 0263fb68af..5f2690b5b4 100644 --- a/javaxval/pom.xml +++ b/javaxval/pom.xml @@ -1,10 +1,10 @@ 4.0.0 - com.baeldung javaxval 0.1-SNAPSHOT - + javaxval + com.baeldung parent-modules @@ -22,16 +22,6 @@ hibernate-validator ${hibernate-validator.version} - - org.hibernate - hibernate-validator-annotation-processor - ${hibernate-validator.version} - - - javax.el - javax.el-api - ${javax.el-api.version} - org.glassfish javax.el @@ -60,13 +50,11 @@ test - 2.0.1.Final 6.0.13.Final - 3.0.0 3.0.0 - 5.0.2.RELEASE + 5.0.2.RELEASE 4.12 3.11.1 diff --git a/jee-7/pom.xml b/jee-7/pom.xml index 4f6e6a20fb..97ed2cc51d 100644 --- a/jee-7/pom.xml +++ b/jee-7/pom.xml @@ -1,430 +1,538 @@ - - 4.0.0 - jee-7 - 1.0-SNAPSHOT - war - JavaEE 7 Arquillian Archetype Sample + + 4.0.0 + jee-7 + 1.0-SNAPSHOT + jee-7 + war + JavaEE 7 Arquillian Archetype Sample - - com.baeldung - parent-modules - 1.0.0-SNAPSHOT - + + com.baeldung + parent-modules + 1.0.0-SNAPSHOT + - - - javax - javaee-api - ${javaee_api.version} - provided - + + + javax + javaee-api + ${javaee_api.version} + provided + - - org.jboss.arquillian.junit - arquillian-junit-container - test - - - org.jboss.arquillian.graphene - graphene-webdriver - ${graphene-webdriver.version} - pom - test - - - com.jayway.awaitility - awaitility - ${awaitility.version} - test - + + org.jboss.arquillian.junit + arquillian-junit-container + test + + + org.jboss.arquillian.graphene + graphene-webdriver + ${graphene-webdriver.version} + pom + test + + + com.jayway.awaitility + awaitility + ${awaitility.version} + test + - - org.jboss.shrinkwrap.resolver - shrinkwrap-resolver-impl-maven - test - jar - + + org.jboss.shrinkwrap.resolver + shrinkwrap-resolver-impl-maven + test + jar + - - org.jboss.shrinkwrap.resolver - shrinkwrap-resolver-impl-maven-archive - test - - - org.apache.httpcomponents - httpclient - ${httpclient.version} - - - commons-io - commons-io - ${commons-io.version} - - - com.sun.faces - jsf-api - ${com.sun.faces.jsf.version} - - - com.sun.faces - jsf-impl - ${com.sun.faces.jsf.version} - - - javax.servlet - jstl - ${jstl.version} - - - javax.servlet - javax.servlet-api - ${javax.servlet-api.version} - - - javax.servlet.jsp - jsp-api - ${jsp-api.version} - provided - - - taglibs - standard - ${taglibs.standard.version} - + + org.jboss.shrinkwrap.resolver + shrinkwrap-resolver-impl-maven-archive + test + + + org.apache.httpcomponents + httpclient + ${httpclient.version} + + + commons-io + commons-io + ${commons-io.version} + + + com.sun.faces + jsf-api + ${com.sun.faces.jsf.version} + + + com.sun.faces + jsf-impl + ${com.sun.faces.jsf.version} + + + javax.servlet + jstl + ${jstl.version} + + + javax.servlet + javax.servlet-api + ${javax.servlet-api.version} + + + javax.servlet.jsp + jsp-api + ${jsp-api.version} + provided + + + taglibs + standard + ${taglibs.standard.version} + - - javax.mvc - javax.mvc-api - 20160715 - - - org.glassfish.ozark - ozark - ${ozark.version} - + + javax.mvc + javax.mvc-api + 20160715 + + + org.glassfish.ozark + ozark + ${ozark.version} + - - org.springframework.security - spring-security-web - ${org.springframework.security.version} - + + org.springframework.security + spring-security-web + ${org.springframework.security.version} + - - org.springframework.security - spring-security-config - ${org.springframework.security.version} - - - org.springframework.security - spring-security-taglibs - ${org.springframework.security.version} - - + + org.springframework.security + spring-security-config + ${org.springframework.security.version} + + + org.springframework.security + spring-security-taglibs + ${org.springframework.security.version} + + - - - - org.apache.maven.plugins - maven-war-plugin - ${maven-war-plugin.version} - - src/main/webapp - false - - - - + + org.jboss.spec.javax.batch + jboss-batch-api_1.0_spec + 1.0.0.Final + + + org.jberet + jberet-core + 1.0.2.Final + + + org.jberet + jberet-support + 1.0.2.Final + + + org.jboss.spec.javax.transaction + jboss-transaction-api_1.2_spec + 1.0.0.Final + + + org.jboss.marshalling + jboss-marshalling + 1.4.2.Final + + + org.jboss.weld + weld-core + 2.1.1.Final + + + org.jboss.weld.se + weld-se + 2.1.1.Final + + + org.jberet + jberet-se + 1.0.2.Final + + + com.h2database + h2 + 1.4.178 + + + org.glassfish.jersey.containers + jersey-container-jetty-servlet + 2.22.1 + + - - - - org.jboss.arquillian - arquillian-bom - ${arquillian_core.version} - import - pom - - - org.jboss.arquillian.extension - arquillian-drone-bom - ${arquillian-drone-bom.version} - pom - import - - - + + + + org.apache.maven.plugins + maven-war-plugin + ${maven-war-plugin.version} + + src/main/webapp + false + + + + + + + + org.eclipse.m2e + lifecycle-mapping + 1.0.0 + + + + + + + org.apache.maven.plugins + + + maven-pmd-plugin + + + [3.8,) + + + check + + + + + + + + + + + + + - - - wildfly-managed-arquillian - - true - - - standalone-full.xml - ${project.build.directory}/wildfly-${version.wildfly} - - - - io.undertow - undertow-websockets-jsr - ${undertow-websockets-jsr.version} - test - - - org.jboss.resteasy - resteasy-client - ${resteasy.version} - test - - - org.jboss.resteasy - resteasy-jaxb-provider - ${resteasy.version} - test - - - org.jboss.resteasy - resteasy-json-p-provider - ${resteasy.version} - test - - - org.wildfly - wildfly-arquillian-container-managed - ${wildfly.version} - test - - + + + + org.jboss.arquillian + arquillian-bom + ${arquillian_core.version} + import + pom + + + org.jboss.arquillian.extension + arquillian-drone-bom + ${arquillian-drone-bom.version} + pom + import + + + - - - - - maven-dependency-plugin - ${maven-dependency-plugin.version} - - ${maven.test.skip} - - - - unpack - process-test-classes - - unpack - - - - - org.wildfly - wildfly-dist - ${wildfly.version} - zip - false - ${project.build.directory} - - - - - - - - maven-surefire-plugin - ${maven-surefire-plugin.version} - - - ${project.build.directory}/wildfly-${wildfly.version} - - - - - - - - - wildfly-remote-arquillian - - - io.undertow - undertow-websockets-jsr - ${undertow-websockets-jsr.version} - test - - - org.jboss.resteasy - resteasy-client - ${resteasy.version} - test - - - org.jboss.resteasy - resteasy-jaxb-provider - ${resteasy.version} - test - - - org.jboss.resteasy - resteasy-json-p-provider - ${resteasy.version} - test - - - org.wildfly - wildfly-arquillian-container-remote - ${wildfly.version} - test - - - - - glassfish-embedded-arquillian - - - org.glassfish.main.extras - glassfish-embedded-all - ${glassfish-embedded-all.version} - test - - - org.glassfish - javax.json - ${javax.json.version} - test - - - org.glassfish.tyrus - tyrus-client - ${tyrus.version} - test - - - org.glassfish.tyrus - tyrus-container-grizzly-client - ${tyrus.version} - test - - - org.glassfish.jersey.core - jersey-client - ${jersey.version} - test - - - org.jboss.arquillian.container - arquillian-glassfish-embedded-3.1 - ${arquillian-glassfish.version} - test - - - - - glassfish-remote-arquillian - - - org.glassfish - javax.json - ${javax.json.version} - test - - - org.glassfish.tyrus - tyrus-client - ${tyrus.version} - test - - - org.glassfish.tyrus - tyrus-container-grizzly-client - ${tyrus.version} - test - - - org.glassfish.jersey.core - jersey-client - ${jersey.version} - test - - - org.glassfish.jersey.media - jersey-media-json-jackson - ${jersey.version} - test - - - org.glassfish.jersey.media - jersey-media-json-processing - ${jersey.version} - test - - - org.jboss.arquillian.container - arquillian-glassfish-remote-3.1 - ${arquillian-glassfish.version} - test - - - - - webdriver-chrome - - true - - - chrome - - - - webdriver-firefox - - firefox - - - + + + wildfly-managed-arquillian + + true + + + standalone-full.xml + ${project.build.directory}/wildfly-${version.wildfly} + + + + io.undertow + undertow-websockets-jsr + ${undertow-websockets-jsr.version} + test + + + org.jboss.resteasy + resteasy-client + ${resteasy.version} + test + + + org.jboss.resteasy + resteasy-jaxb-provider + ${resteasy.version} + test + + + org.jboss.resteasy + resteasy-json-p-provider + ${resteasy.version} + test + + + org.wildfly + wildfly-arquillian-container-managed + ${wildfly.version} + test + + + sun.jdk + jconsole + + + + - - - bintray-mvc-spec-maven - bintray - http://dl.bintray.com/mvc-spec/maven - - true - - - false - - - + + + + + maven-dependency-plugin + ${maven-dependency-plugin.version} + + ${maven.test.skip} + + + + unpack + process-test-classes + + unpack + + + + + org.wildfly + wildfly-dist + ${wildfly.version} + zip + false + ${project.build.directory} + + + sun.jdk + jconsole + + + + + + + + + + maven-surefire-plugin + ${maven-surefire-plugin.version} + + + ${project.build.directory}/wildfly-${wildfly.version} + + + + + + + + + wildfly-remote-arquillian + + + io.undertow + undertow-websockets-jsr + ${undertow-websockets-jsr.version} + test + + + org.jboss.resteasy + resteasy-client + ${resteasy.version} + test + + + org.jboss.resteasy + resteasy-jaxb-provider + ${resteasy.version} + test + + + org.jboss.resteasy + resteasy-json-p-provider + ${resteasy.version} + test + + + org.wildfly + wildfly-arquillian-container-remote + ${wildfly.version} + test + + + sun.jdk + jconsole + + + + + + + glassfish-embedded-arquillian + + + org.glassfish.main.extras + glassfish-embedded-all + ${glassfish-embedded-all.version} + test + + + org.glassfish + javax.json + ${javax.json.version} + test + + + org.glassfish.tyrus + tyrus-client + ${tyrus.version} + test + + + org.glassfish.tyrus + tyrus-container-grizzly-client + ${tyrus.version} + test + + + org.glassfish.jersey.core + jersey-client + ${jersey.version} + test + + + org.jboss.arquillian.container + arquillian-glassfish-embedded-3.1 + ${arquillian-glassfish.version} + test + + + + + glassfish-remote-arquillian + + + org.glassfish + javax.json + ${javax.json.version} + test + + + org.glassfish.tyrus + tyrus-client + ${tyrus.version} + test + + + org.glassfish.tyrus + tyrus-container-grizzly-client + ${tyrus.version} + test + + + org.glassfish.jersey.core + jersey-client + ${jersey.version} + test + + + org.glassfish.jersey.media + jersey-media-json-jackson + ${jersey.version} + test + + + org.glassfish.jersey.media + jersey-media-json-processing + ${jersey.version} + test + + + org.jboss.arquillian.container + arquillian-glassfish-remote-3.1 + ${arquillian-glassfish.version} + test + + + + + webdriver-chrome + + true + + + chrome + + + + webdriver-firefox + + firefox + + + - - 1.8 - 3.0.0 - 7.0 - 1.1.11.Final - 8.2.1.Final - 1.7.0 - 1.4.6.Final - 3.0.19.Final - 4.1.1 - 1.0.4 - 1.13 - 2.25 - 1.0.0.Final - 2.6 - 4.2.3.RELEASE - 2.21.0 - 1.1.2 - 2.4 - 2.2.14 - 4.5 - 2.0.1.Final - 3.1.0 - 2.1.0.Final - 2.8 - 1.2 - 2.2 - 20160715 - + + + bintray-mvc-spec-maven + bintray + http://dl.bintray.com/mvc-spec/maven + + true + + + false + + + - + + 1.8 + 3.0.0 + 7.0 + 1.1.11.Final + 8.2.1.Final + 1.7.0 + 1.4.6.Final + 3.0.19.Final + 4.1.1 + 1.0.4 + 1.13 + 2.25 + 1.0.0.Final + 2.6 + 4.2.3.RELEASE + 2.21.0 + 1.1.2 + 2.4 + 2.2.14 + 4.5 + 2.0.1.Final + 3.1.0 + 2.1.0.Final + 2.8 + 1.2 + 2.2 + 20160715 + + + \ No newline at end of file diff --git a/jee-7/src/main/java/com/baeldung/batch/understanding/ChunkExceptionSkipReadListener.java b/jee-7/src/main/java/com/baeldung/batch/understanding/ChunkExceptionSkipReadListener.java new file mode 100644 index 0000000000..ce47de66af --- /dev/null +++ b/jee-7/src/main/java/com/baeldung/batch/understanding/ChunkExceptionSkipReadListener.java @@ -0,0 +1,11 @@ +package com.baeldung.batch.understanding; + +import javax.batch.api.chunk.listener.SkipReadListener; +import javax.inject.Named; + +@Named +public class ChunkExceptionSkipReadListener implements SkipReadListener { + @Override + public void onSkipReadItem(Exception e) throws Exception { + } +} \ No newline at end of file diff --git a/jee-7/src/main/java/com/baeldung/batch/understanding/CustomCheckPoint.java b/jee-7/src/main/java/com/baeldung/batch/understanding/CustomCheckPoint.java new file mode 100644 index 0000000000..fe6759b365 --- /dev/null +++ b/jee-7/src/main/java/com/baeldung/batch/understanding/CustomCheckPoint.java @@ -0,0 +1,12 @@ +package com.baeldung.batch.understanding; + +import javax.batch.api.chunk.AbstractCheckpointAlgorithm; +import javax.inject.Named; + +@Named +public class CustomCheckPoint extends AbstractCheckpointAlgorithm { + @Override + public boolean isReadyToCheckpoint() throws Exception { + return SimpleChunkItemReader.COUNT % 5 == 0; + } +} diff --git a/jee-7/src/main/java/com/baeldung/batch/understanding/DeciderJobSequence.java b/jee-7/src/main/java/com/baeldung/batch/understanding/DeciderJobSequence.java new file mode 100644 index 0000000000..6cc2012f23 --- /dev/null +++ b/jee-7/src/main/java/com/baeldung/batch/understanding/DeciderJobSequence.java @@ -0,0 +1,14 @@ +package com.baeldung.batch.understanding; + +import javax.batch.api.Decider; +import javax.batch.runtime.StepExecution; +import javax.inject.Named; + +@Named +public class DeciderJobSequence implements Decider { + @Override + public String decide(StepExecution[] ses) throws Exception { + return "nothing"; + } + +} \ No newline at end of file diff --git a/jee-7/src/main/java/com/baeldung/batch/understanding/InjectSimpleBatchLet.java b/jee-7/src/main/java/com/baeldung/batch/understanding/InjectSimpleBatchLet.java new file mode 100644 index 0000000000..93eb20708d --- /dev/null +++ b/jee-7/src/main/java/com/baeldung/batch/understanding/InjectSimpleBatchLet.java @@ -0,0 +1,20 @@ +package com.baeldung.batch.understanding; + +import javax.batch.api.AbstractBatchlet; +import javax.batch.api.BatchProperty; +import javax.batch.runtime.BatchStatus; +import javax.inject.Inject; +import javax.inject.Named; + +@Named +public class InjectSimpleBatchLet extends AbstractBatchlet { + @Inject + @BatchProperty(name = "name") + private String nameString; + + @Override + public String process() throws Exception { + System.out.println("Value passed in = " + nameString); + return BatchStatus.COMPLETED.toString(); + } +} diff --git a/jee-7/src/main/java/com/baeldung/batch/understanding/SimpleBatchLet.java b/jee-7/src/main/java/com/baeldung/batch/understanding/SimpleBatchLet.java new file mode 100644 index 0000000000..6a367b064b --- /dev/null +++ b/jee-7/src/main/java/com/baeldung/batch/understanding/SimpleBatchLet.java @@ -0,0 +1,13 @@ +package com.baeldung.batch.understanding; + +import javax.batch.api.AbstractBatchlet; +import javax.batch.runtime.BatchStatus; +import javax.inject.Named; + +@Named +public class SimpleBatchLet extends AbstractBatchlet { + @Override + public String process() throws Exception { + return BatchStatus.FAILED.toString(); + } +} diff --git a/jee-7/src/main/java/com/baeldung/batch/understanding/SimpleChunkItemProcessor.java b/jee-7/src/main/java/com/baeldung/batch/understanding/SimpleChunkItemProcessor.java new file mode 100644 index 0000000000..3f8166b6d8 --- /dev/null +++ b/jee-7/src/main/java/com/baeldung/batch/understanding/SimpleChunkItemProcessor.java @@ -0,0 +1,12 @@ +package com.baeldung.batch.understanding; + +import javax.batch.api.chunk.ItemProcessor; +import javax.inject.Named; + +@Named +public class SimpleChunkItemProcessor implements ItemProcessor { + @Override + public Integer processItem(Object t) { + return ((Integer) t).intValue() % 2 == 0 ? null : ((Integer) t).intValue(); + } +} diff --git a/jee-7/src/main/java/com/baeldung/batch/understanding/SimpleChunkItemReader.java b/jee-7/src/main/java/com/baeldung/batch/understanding/SimpleChunkItemReader.java new file mode 100644 index 0000000000..10f81d95d0 --- /dev/null +++ b/jee-7/src/main/java/com/baeldung/batch/understanding/SimpleChunkItemReader.java @@ -0,0 +1,27 @@ +package com.baeldung.batch.understanding; + +import java.io.Serializable; +import java.util.StringTokenizer; +import javax.batch.api.chunk.AbstractItemReader; +import javax.inject.Named; + +@Named +public class SimpleChunkItemReader extends AbstractItemReader { + private StringTokenizer tokens; + public static int COUNT = 0; + + @Override + public Integer readItem() throws Exception { + if (tokens.hasMoreTokens()) { + COUNT++; + String tempTokenize = tokens.nextToken(); + return Integer.valueOf(tempTokenize); + } + return null; + } + + @Override + public void open(Serializable checkpoint) throws Exception { + tokens = new StringTokenizer("1,2,3,4,5,6,7,8,9,10", ","); + } +} diff --git a/jee-7/src/main/java/com/baeldung/batch/understanding/SimpleChunkItemReaderError.java b/jee-7/src/main/java/com/baeldung/batch/understanding/SimpleChunkItemReaderError.java new file mode 100644 index 0000000000..92096d0571 --- /dev/null +++ b/jee-7/src/main/java/com/baeldung/batch/understanding/SimpleChunkItemReaderError.java @@ -0,0 +1,31 @@ +package com.baeldung.batch.understanding; + +import java.io.Serializable; +import java.util.StringTokenizer; + +import javax.batch.api.chunk.AbstractItemReader; +import javax.inject.Named; + +@Named +public class SimpleChunkItemReaderError extends AbstractItemReader { + private StringTokenizer tokens; + public static int COUNT = 0; + + @Override + public Integer readItem() throws Exception { + if (tokens.hasMoreTokens()) { + COUNT++; + int token = Integer.valueOf(tokens.nextToken()); + if (token == 3) { + throw new RuntimeException("Something happened"); + } + return Integer.valueOf(token); + } + return null; + } + + @Override + public void open(Serializable checkpoint) throws Exception { + tokens = new StringTokenizer("1,2,3,4,5,6,7,8,9,10", ","); + } +} \ No newline at end of file diff --git a/jee-7/src/main/java/com/baeldung/batch/understanding/SimpleChunkWriter.java b/jee-7/src/main/java/com/baeldung/batch/understanding/SimpleChunkWriter.java new file mode 100644 index 0000000000..909596766d --- /dev/null +++ b/jee-7/src/main/java/com/baeldung/batch/understanding/SimpleChunkWriter.java @@ -0,0 +1,13 @@ +package com.baeldung.batch.understanding; + +import java.util.List; + +import javax.batch.api.chunk.AbstractItemWriter; +import javax.inject.Named; + +@Named +public class SimpleChunkWriter extends AbstractItemWriter { + @Override + public void writeItems(List items) throws Exception { + } +} diff --git a/jee-7/src/main/java/com/baeldung/batch/understanding/exception/MyInputRecord.java b/jee-7/src/main/java/com/baeldung/batch/understanding/exception/MyInputRecord.java new file mode 100644 index 0000000000..e813a699c2 --- /dev/null +++ b/jee-7/src/main/java/com/baeldung/batch/understanding/exception/MyInputRecord.java @@ -0,0 +1,41 @@ +package com.baeldung.batch.understanding.exception; + +import java.io.Serializable; + +public class MyInputRecord implements Serializable { + private int id; + + public MyInputRecord(int id) { + this.id = id; + } + + public int getId() { + return id; + } + + public void setId(int id) { + this.id = id; + } + + @Override + public boolean equals(Object o) { + if (this == o) + return true; + if (o == null || getClass() != o.getClass()) + return false; + + MyInputRecord that = (MyInputRecord) o; + + return id == that.id; + } + + @Override + public int hashCode() { + return id; + } + + @Override + public String toString() { + return "MyInputRecord: " + id; + } +} diff --git a/jee-7/src/main/java/com/baeldung/batch/understanding/exception/MyItemProcessor.java b/jee-7/src/main/java/com/baeldung/batch/understanding/exception/MyItemProcessor.java new file mode 100644 index 0000000000..4427a1f548 --- /dev/null +++ b/jee-7/src/main/java/com/baeldung/batch/understanding/exception/MyItemProcessor.java @@ -0,0 +1,15 @@ +package com.baeldung.batch.understanding.exception; + +import javax.batch.api.chunk.ItemProcessor; +import javax.inject.Named; + +@Named +public class MyItemProcessor implements ItemProcessor { + @Override + public Object processItem(Object t) { + if (((MyInputRecord) t).getId() == 6) { + throw new NullPointerException(); + } + return new MyOutputRecord(((MyInputRecord) t).getId()); + } +} diff --git a/jee-7/src/main/java/com/baeldung/batch/understanding/exception/MyItemReader.java b/jee-7/src/main/java/com/baeldung/batch/understanding/exception/MyItemReader.java new file mode 100644 index 0000000000..dd1876ab7d --- /dev/null +++ b/jee-7/src/main/java/com/baeldung/batch/understanding/exception/MyItemReader.java @@ -0,0 +1,42 @@ +package com.baeldung.batch.understanding.exception; + +import javax.batch.api.chunk.AbstractItemReader; +import javax.inject.Named; +import java.io.Serializable; +import java.util.StringTokenizer; + +@Named +public class MyItemReader extends AbstractItemReader { + private StringTokenizer tokens; + private MyInputRecord lastElement; + private boolean alreadyFailed; + + @Override + public void open(Serializable checkpoint) { + tokens = new StringTokenizer("1,2,3,4,5,6,7,8,9,10", ","); + if (checkpoint != null) { + while (!Integer.valueOf(tokens.nextToken()) + .equals(((MyInputRecord) checkpoint).getId())) { + } + } + } + + @Override + public Object readItem() { + if (tokens.hasMoreTokens()) { + int token = Integer.valueOf(tokens.nextToken()); + if (token == 5 && !alreadyFailed) { + alreadyFailed = true; + throw new IllegalArgumentException("Could not read record"); + } + lastElement = new MyInputRecord(token); + return lastElement; + } + return null; + } + + @Override + public Serializable checkpointInfo() throws Exception { + return lastElement; + } +} diff --git a/jee-7/src/main/java/com/baeldung/batch/understanding/exception/MyItemWriter.java b/jee-7/src/main/java/com/baeldung/batch/understanding/exception/MyItemWriter.java new file mode 100644 index 0000000000..4e80d86d44 --- /dev/null +++ b/jee-7/src/main/java/com/baeldung/batch/understanding/exception/MyItemWriter.java @@ -0,0 +1,19 @@ + +package com.baeldung.batch.understanding.exception; + +import javax.batch.api.chunk.AbstractItemWriter; +import javax.inject.Named; +import java.util.List; + +@Named +public class MyItemWriter extends AbstractItemWriter { + private static int retries = 0; + + @Override + public void writeItems(List list) { + if (retries <= 3 && list.contains(new MyOutputRecord(8))) { + retries++; + throw new UnsupportedOperationException(); + } + } +} diff --git a/jee-7/src/main/java/com/baeldung/batch/understanding/exception/MyOutputRecord.java b/jee-7/src/main/java/com/baeldung/batch/understanding/exception/MyOutputRecord.java new file mode 100644 index 0000000000..8f18fca7ba --- /dev/null +++ b/jee-7/src/main/java/com/baeldung/batch/understanding/exception/MyOutputRecord.java @@ -0,0 +1,39 @@ +package com.baeldung.batch.understanding.exception; + +import java.io.Serializable; + +public class MyOutputRecord implements Serializable { + private int id; + + public MyOutputRecord(int id) { + this.id = id; + } + + public int getId() { + return id; + } + + public void setId(int id) { + this.id = id; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + + MyOutputRecord that = (MyOutputRecord) o; + + return id == that.id; + } + + @Override + public int hashCode() { + return id; + } + + @Override + public String toString() { + return "MyOutputRecord: " + id; + } +} diff --git a/jee-7/src/main/java/com/baeldung/batch/understanding/exception/MyRetryProcessorListener.java b/jee-7/src/main/java/com/baeldung/batch/understanding/exception/MyRetryProcessorListener.java new file mode 100644 index 0000000000..3bd35820c3 --- /dev/null +++ b/jee-7/src/main/java/com/baeldung/batch/understanding/exception/MyRetryProcessorListener.java @@ -0,0 +1,11 @@ +package com.baeldung.batch.understanding.exception; + +import javax.batch.api.chunk.listener.RetryProcessListener; +import javax.inject.Named; + +@Named +public class MyRetryProcessorListener implements RetryProcessListener { + @Override + public void onRetryProcessException(Object item, Exception ex) throws Exception { + } +} diff --git a/jee-7/src/main/java/com/baeldung/batch/understanding/exception/MyRetryReadListener.java b/jee-7/src/main/java/com/baeldung/batch/understanding/exception/MyRetryReadListener.java new file mode 100644 index 0000000000..5c4f56b75d --- /dev/null +++ b/jee-7/src/main/java/com/baeldung/batch/understanding/exception/MyRetryReadListener.java @@ -0,0 +1,11 @@ +package com.baeldung.batch.understanding.exception; + +import javax.batch.api.chunk.listener.RetryReadListener; +import javax.inject.Named; + +@Named +public class MyRetryReadListener implements RetryReadListener { + @Override + public void onRetryReadException(Exception ex) throws Exception { + } +} diff --git a/jee-7/src/main/java/com/baeldung/batch/understanding/exception/MyRetryWriteListener.java b/jee-7/src/main/java/com/baeldung/batch/understanding/exception/MyRetryWriteListener.java new file mode 100644 index 0000000000..a8683d86a9 --- /dev/null +++ b/jee-7/src/main/java/com/baeldung/batch/understanding/exception/MyRetryWriteListener.java @@ -0,0 +1,12 @@ +package com.baeldung.batch.understanding.exception; + +import javax.batch.api.chunk.listener.RetryWriteListener; +import javax.inject.Named; +import java.util.List; + +@Named +public class MyRetryWriteListener implements RetryWriteListener { + @Override + public void onRetryWriteException(List items, Exception ex) throws Exception { + } +} diff --git a/jee-7/src/main/java/com/baeldung/batch/understanding/exception/MySkipProcessorListener.java b/jee-7/src/main/java/com/baeldung/batch/understanding/exception/MySkipProcessorListener.java new file mode 100644 index 0000000000..74f7565cf7 --- /dev/null +++ b/jee-7/src/main/java/com/baeldung/batch/understanding/exception/MySkipProcessorListener.java @@ -0,0 +1,11 @@ +package com.baeldung.batch.understanding.exception; + +import javax.batch.api.chunk.listener.SkipProcessListener; +import javax.inject.Named; + +@Named +public class MySkipProcessorListener implements SkipProcessListener { + @Override + public void onSkipProcessItem(Object t, Exception e) throws Exception { + } +} diff --git a/jee-7/src/main/java/com/baeldung/batch/understanding/exception/MySkipReadListener.java b/jee-7/src/main/java/com/baeldung/batch/understanding/exception/MySkipReadListener.java new file mode 100644 index 0000000000..aecaf93e75 --- /dev/null +++ b/jee-7/src/main/java/com/baeldung/batch/understanding/exception/MySkipReadListener.java @@ -0,0 +1,11 @@ +package com.baeldung.batch.understanding.exception; + +import javax.batch.api.chunk.listener.SkipReadListener; +import javax.inject.Named; + +@Named +public class MySkipReadListener implements SkipReadListener { + @Override + public void onSkipReadItem(Exception e) throws Exception { + } +} diff --git a/jee-7/src/main/java/com/baeldung/batch/understanding/exception/MySkipWriteListener.java b/jee-7/src/main/java/com/baeldung/batch/understanding/exception/MySkipWriteListener.java new file mode 100644 index 0000000000..928773b61d --- /dev/null +++ b/jee-7/src/main/java/com/baeldung/batch/understanding/exception/MySkipWriteListener.java @@ -0,0 +1,13 @@ +package com.baeldung.batch.understanding.exception; + +import javax.batch.api.chunk.listener.SkipWriteListener; +import javax.inject.Named; +import java.util.List; + +@Named +public class MySkipWriteListener implements SkipWriteListener { + @Override + public void onSkipWriteItem(List list, Exception e) throws Exception { + list.remove(new MyOutputRecord(2)); + } +} diff --git a/jee-7/src/main/resources/META-INF/batch-jobs/customCheckPoint.xml b/jee-7/src/main/resources/META-INF/batch-jobs/customCheckPoint.xml new file mode 100644 index 0000000000..b0f327dd39 --- /dev/null +++ b/jee-7/src/main/resources/META-INF/batch-jobs/customCheckPoint.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/jee-7/src/main/resources/META-INF/batch-jobs/decideJobSequence.xml b/jee-7/src/main/resources/META-INF/batch-jobs/decideJobSequence.xml new file mode 100644 index 0000000000..4905586fb9 --- /dev/null +++ b/jee-7/src/main/resources/META-INF/batch-jobs/decideJobSequence.xml @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/jee-7/src/main/resources/META-INF/batch-jobs/flowJobSequence.xml b/jee-7/src/main/resources/META-INF/batch-jobs/flowJobSequence.xml new file mode 100644 index 0000000000..207a9242b1 --- /dev/null +++ b/jee-7/src/main/resources/META-INF/batch-jobs/flowJobSequence.xml @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/jee-7/src/main/resources/META-INF/batch-jobs/injectionSimpleBatchLet.xml b/jee-7/src/main/resources/META-INF/batch-jobs/injectionSimpleBatchLet.xml new file mode 100644 index 0000000000..d152f063f6 --- /dev/null +++ b/jee-7/src/main/resources/META-INF/batch-jobs/injectionSimpleBatchLet.xml @@ -0,0 +1,13 @@ + + + + + + + + + + \ No newline at end of file diff --git a/jee-7/src/main/resources/META-INF/batch-jobs/partitionSimpleBatchLet.xml b/jee-7/src/main/resources/META-INF/batch-jobs/partitionSimpleBatchLet.xml new file mode 100644 index 0000000000..76c64ee899 --- /dev/null +++ b/jee-7/src/main/resources/META-INF/batch-jobs/partitionSimpleBatchLet.xml @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/jee-7/src/main/resources/META-INF/batch-jobs/simpleBatchLet.xml b/jee-7/src/main/resources/META-INF/batch-jobs/simpleBatchLet.xml new file mode 100644 index 0000000000..9c707de8a4 --- /dev/null +++ b/jee-7/src/main/resources/META-INF/batch-jobs/simpleBatchLet.xml @@ -0,0 +1,9 @@ + + + + + + \ No newline at end of file diff --git a/jee-7/src/main/resources/META-INF/batch-jobs/simpleChunk.xml b/jee-7/src/main/resources/META-INF/batch-jobs/simpleChunk.xml new file mode 100644 index 0000000000..b2b15b7bd9 --- /dev/null +++ b/jee-7/src/main/resources/META-INF/batch-jobs/simpleChunk.xml @@ -0,0 +1,11 @@ + + + + + + + + + + \ No newline at end of file diff --git a/jee-7/src/main/resources/META-INF/batch-jobs/simpleErrorChunk.xml b/jee-7/src/main/resources/META-INF/batch-jobs/simpleErrorChunk.xml new file mode 100644 index 0000000000..743fcafd65 --- /dev/null +++ b/jee-7/src/main/resources/META-INF/batch-jobs/simpleErrorChunk.xml @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/jee-7/src/main/resources/META-INF/batch-jobs/simpleErrorSkipChunk.xml b/jee-7/src/main/resources/META-INF/batch-jobs/simpleErrorSkipChunk.xml new file mode 100644 index 0000000000..2fafb83cc7 --- /dev/null +++ b/jee-7/src/main/resources/META-INF/batch-jobs/simpleErrorSkipChunk.xml @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/jee-7/src/main/resources/META-INF/batch-jobs/simpleJobSequence.xml b/jee-7/src/main/resources/META-INF/batch-jobs/simpleJobSequence.xml new file mode 100644 index 0000000000..7110db7f23 --- /dev/null +++ b/jee-7/src/main/resources/META-INF/batch-jobs/simpleJobSequence.xml @@ -0,0 +1,17 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/jee-7/src/main/resources/META-INF/batch-jobs/splitJobSequence.xml b/jee-7/src/main/resources/META-INF/batch-jobs/splitJobSequence.xml new file mode 100644 index 0000000000..0a9ea97dc7 --- /dev/null +++ b/jee-7/src/main/resources/META-INF/batch-jobs/splitJobSequence.xml @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/jee-7/src/main/resources/META-INF/beans.xml b/jee-7/src/main/resources/META-INF/beans.xml new file mode 100644 index 0000000000..ae0f4bf2ee --- /dev/null +++ b/jee-7/src/main/resources/META-INF/beans.xml @@ -0,0 +1,8 @@ + + + \ No newline at end of file diff --git a/jee-7/src/test/java/com/baeldung/batch/understanding/BatchTestHelper.java b/jee-7/src/test/java/com/baeldung/batch/understanding/BatchTestHelper.java new file mode 100644 index 0000000000..5060bd9b91 --- /dev/null +++ b/jee-7/src/test/java/com/baeldung/batch/understanding/BatchTestHelper.java @@ -0,0 +1,79 @@ +package com.baeldung.batch.understanding; + +import java.util.HashMap; +import java.util.Map; + +import javax.batch.runtime.BatchRuntime; +import javax.batch.runtime.BatchStatus; +import javax.batch.runtime.JobExecution; +import javax.batch.runtime.Metric; + +public class BatchTestHelper { + private static final int MAX_TRIES = 40; + private static final int THREAD_SLEEP = 1000; + + private BatchTestHelper() { + throw new UnsupportedOperationException(); + } + + public static JobExecution keepTestAlive(JobExecution jobExecution) throws InterruptedException { + int maxTries = 0; + while (!jobExecution.getBatchStatus() + .equals(BatchStatus.COMPLETED)) { + if (maxTries < MAX_TRIES) { + maxTries++; + Thread.sleep(THREAD_SLEEP); + jobExecution = BatchRuntime.getJobOperator() + .getJobExecution(jobExecution.getExecutionId()); + } else { + break; + } + } + Thread.sleep(THREAD_SLEEP); + return jobExecution; + } + + public static JobExecution keepTestFailed(JobExecution jobExecution) throws InterruptedException { + int maxTries = 0; + while (!jobExecution.getBatchStatus() + .equals(BatchStatus.FAILED)) { + if (maxTries < MAX_TRIES) { + maxTries++; + Thread.sleep(THREAD_SLEEP); + jobExecution = BatchRuntime.getJobOperator() + .getJobExecution(jobExecution.getExecutionId()); + } else { + break; + } + } + Thread.sleep(THREAD_SLEEP); + + return jobExecution; + } + + public static JobExecution keepTestStopped(JobExecution jobExecution) throws InterruptedException { + int maxTries = 0; + while (!jobExecution.getBatchStatus() + .equals(BatchStatus.STOPPED)) { + if (maxTries < MAX_TRIES) { + maxTries++; + Thread.sleep(THREAD_SLEEP); + jobExecution = BatchRuntime.getJobOperator() + .getJobExecution(jobExecution.getExecutionId()); + } else { + break; + } + } + Thread.sleep(THREAD_SLEEP); + return jobExecution; + } + + public static Map getMetricsMap(Metric[] metrics) { + Map metricsMap = new HashMap<>(); + for (Metric metric : metrics) { + metricsMap.put(metric.getType(), metric.getValue()); + } + return metricsMap; + } + +} diff --git a/jee-7/src/test/java/com/baeldung/batch/understanding/CustomCheckPointUnitTest.java b/jee-7/src/test/java/com/baeldung/batch/understanding/CustomCheckPointUnitTest.java new file mode 100644 index 0000000000..a9488c5c03 --- /dev/null +++ b/jee-7/src/test/java/com/baeldung/batch/understanding/CustomCheckPointUnitTest.java @@ -0,0 +1,33 @@ +package com.baeldung.batch.understanding; + +import static org.junit.jupiter.api.Assertions.*; +import java.util.Map; +import java.util.Properties; +import javax.batch.operations.JobOperator; +import javax.batch.runtime.BatchRuntime; +import javax.batch.runtime.BatchStatus; +import javax.batch.runtime.JobExecution; +import javax.batch.runtime.Metric; +import javax.batch.runtime.StepExecution; +import com.baeldung.batch.understanding.BatchTestHelper; + +import org.junit.jupiter.api.Test; + +class CustomCheckPointUnitTest { + @Test + public void givenChunk_whenCustomCheckPoint_thenCommitCount_3() throws Exception { + JobOperator jobOperator = BatchRuntime.getJobOperator(); + Long executionId = jobOperator.start("customCheckPoint", new Properties()); + JobExecution jobExecution = jobOperator.getJobExecution(executionId); + jobExecution = BatchTestHelper.keepTestAlive(jobExecution); + for (StepExecution stepExecution : jobOperator.getStepExecutions(executionId)) { + if (stepExecution.getStepName() + .equals("firstChunkStep")) { + Map metricsMap = BatchTestHelper.getMetricsMap(stepExecution.getMetrics()); + assertEquals(3L, metricsMap.get(Metric.MetricType.COMMIT_COUNT) + .longValue()); + } + } + assertEquals(jobExecution.getBatchStatus(), BatchStatus.COMPLETED); + } +} diff --git a/jee-7/src/test/java/com/baeldung/batch/understanding/JobSequenceUnitTest.java b/jee-7/src/test/java/com/baeldung/batch/understanding/JobSequenceUnitTest.java new file mode 100644 index 0000000000..7c5e8d0b78 --- /dev/null +++ b/jee-7/src/test/java/com/baeldung/batch/understanding/JobSequenceUnitTest.java @@ -0,0 +1,74 @@ +package com.baeldung.batch.understanding; + +import static org.junit.jupiter.api.Assertions.*; + +import java.util.ArrayList; +import java.util.List; +import java.util.Properties; + +import javax.batch.operations.JobOperator; +import javax.batch.runtime.BatchRuntime; +import javax.batch.runtime.BatchStatus; +import javax.batch.runtime.JobExecution; +import javax.batch.runtime.StepExecution; + +import org.junit.jupiter.api.Test; + +class JobSequenceUnitTest { + @Test + public void givenTwoSteps_thenBatch_CompleteWithSuccess() throws Exception { + JobOperator jobOperator = BatchRuntime.getJobOperator(); + Long executionId = jobOperator.start("simpleJobSequence", new Properties()); + JobExecution jobExecution = jobOperator.getJobExecution(executionId); + jobExecution = BatchTestHelper.keepTestAlive(jobExecution); + assertEquals(2 , jobOperator.getStepExecutions(executionId).size()); + assertEquals(jobExecution.getBatchStatus(), BatchStatus.COMPLETED); + } + + @Test + public void givenFlow_thenBatch_CompleteWithSuccess() throws Exception { + JobOperator jobOperator = BatchRuntime.getJobOperator(); + Long executionId = jobOperator.start("flowJobSequence", new Properties()); + JobExecution jobExecution = jobOperator.getJobExecution(executionId); + jobExecution = BatchTestHelper.keepTestAlive(jobExecution); + assertEquals(3 , jobOperator.getStepExecutions(executionId).size()); + assertEquals(jobExecution.getBatchStatus(), BatchStatus.COMPLETED); + } + + @Test + public void givenDecider_thenBatch_CompleteWithSuccess() throws Exception { + JobOperator jobOperator = BatchRuntime.getJobOperator(); + Long executionId = jobOperator.start("decideJobSequence", new Properties()); + JobExecution jobExecution = jobOperator.getJobExecution(executionId); + jobExecution = BatchTestHelper.keepTestAlive(jobExecution); + List stepExecutions = jobOperator.getStepExecutions(executionId); + List executedSteps = new ArrayList<>(); + for (StepExecution stepExecution : stepExecutions) { + executedSteps.add(stepExecution.getStepName()); + } + assertEquals(2, jobOperator.getStepExecutions(executionId).size()); + assertArrayEquals(new String[] { "firstBatchStepStep1", "firstBatchStepStep3" }, executedSteps.toArray()); + assertEquals(jobExecution.getBatchStatus(), BatchStatus.COMPLETED); + } + + @Test + public void givenSplit_thenBatch_CompletesWithSuccess() throws Exception { + JobOperator jobOperator = BatchRuntime.getJobOperator(); + Long executionId = jobOperator.start("splitJobSequence", new Properties()); + JobExecution jobExecution = jobOperator.getJobExecution(executionId); + jobExecution = BatchTestHelper.keepTestAlive(jobExecution); + List stepExecutions = jobOperator.getStepExecutions(executionId); + List executedSteps = new ArrayList<>(); + for (StepExecution stepExecution : stepExecutions) { + executedSteps.add(stepExecution.getStepName()); + } + assertEquals(3, stepExecutions.size()); + assertTrue(executedSteps.contains("splitJobSequenceStep1")); + assertTrue(executedSteps.contains("splitJobSequenceStep2")); + assertTrue(executedSteps.contains("splitJobSequenceStep3")); + assertTrue(executedSteps.get(0).equals("splitJobSequenceStep1") || executedSteps.get(0).equals("splitJobSequenceStep2")); + assertTrue(executedSteps.get(1).equals("splitJobSequenceStep1") || executedSteps.get(1).equals("splitJobSequenceStep2")); + assertTrue(executedSteps.get(2).equals("splitJobSequenceStep3")); + assertEquals(jobExecution.getBatchStatus(), BatchStatus.COMPLETED); + } +} diff --git a/jee-7/src/test/java/com/baeldung/batch/understanding/SimpleBatchLetUnitTest.java b/jee-7/src/test/java/com/baeldung/batch/understanding/SimpleBatchLetUnitTest.java new file mode 100644 index 0000000000..485c997cc6 --- /dev/null +++ b/jee-7/src/test/java/com/baeldung/batch/understanding/SimpleBatchLetUnitTest.java @@ -0,0 +1,68 @@ +package com.baeldung.batch.understanding; + +import static org.junit.jupiter.api.Assertions.*; + +import java.util.List; +import java.util.Map; +import java.util.Properties; + +import javax.batch.operations.JobOperator; +import javax.batch.runtime.BatchRuntime; +import javax.batch.runtime.BatchStatus; +import javax.batch.runtime.JobExecution; +import javax.batch.runtime.Metric; +import javax.batch.runtime.StepExecution; + +import org.junit.jupiter.api.Test; + +class SimpleBatchLetUnitTest { + @Test + public void givenBatchLet_thenBatch_CompleteWithSuccess() throws Exception { + JobOperator jobOperator = BatchRuntime.getJobOperator(); + Long executionId = jobOperator.start("simpleBatchLet", new Properties()); + JobExecution jobExecution = jobOperator.getJobExecution(executionId); + jobExecution = BatchTestHelper.keepTestAlive(jobExecution); + assertEquals(jobExecution.getBatchStatus(), BatchStatus.COMPLETED); + } + + @Test + public void givenBatchLetProperty_thenBatch_CompleteWithSuccess() throws Exception { + JobOperator jobOperator = BatchRuntime.getJobOperator(); + Long executionId = jobOperator.start("injectionSimpleBatchLet", new Properties()); + JobExecution jobExecution = jobOperator.getJobExecution(executionId); + jobExecution = BatchTestHelper.keepTestAlive(jobExecution); + assertEquals(jobExecution.getBatchStatus(), BatchStatus.COMPLETED); + } + + @Test + public void givenBatchLetPartition_thenBatch_CompleteWithSuccess() throws Exception { + JobOperator jobOperator = BatchRuntime.getJobOperator(); + Long executionId = jobOperator.start("partitionSimpleBatchLet", new Properties()); + JobExecution jobExecution = jobOperator.getJobExecution(executionId); + jobExecution = BatchTestHelper.keepTestAlive(jobExecution); + assertEquals(jobExecution.getBatchStatus(), BatchStatus.COMPLETED); + } + + @Test + public void givenBatchLetStarted_whenStopped_thenBatchStopped() throws Exception { + JobOperator jobOperator = BatchRuntime.getJobOperator(); + Long executionId = jobOperator.start("simpleBatchLet", new Properties()); + JobExecution jobExecution = jobOperator.getJobExecution(executionId); + jobOperator.stop(executionId); + jobExecution = BatchTestHelper.keepTestStopped(jobExecution); + assertEquals(jobExecution.getBatchStatus(), BatchStatus.STOPPED); + } + + @Test + public void givenBatchLetStopped_whenRestarted_thenBatchCompletesSuccess() throws Exception { + JobOperator jobOperator = BatchRuntime.getJobOperator(); + Long executionId = jobOperator.start("simpleBatchLet", new Properties()); + JobExecution jobExecution = jobOperator.getJobExecution(executionId); + jobOperator.stop(executionId); + jobExecution = BatchTestHelper.keepTestStopped(jobExecution); + assertEquals(jobExecution.getBatchStatus(), BatchStatus.STOPPED); + executionId = jobOperator.restart(jobExecution.getExecutionId(), new Properties()); + jobExecution = BatchTestHelper.keepTestAlive(jobOperator.getJobExecution(executionId)); + assertEquals(jobExecution.getBatchStatus(), BatchStatus.COMPLETED); + } +} diff --git a/jee-7/src/test/java/com/baeldung/batch/understanding/SimpleChunkUnitTest.java b/jee-7/src/test/java/com/baeldung/batch/understanding/SimpleChunkUnitTest.java new file mode 100644 index 0000000000..57c794ba00 --- /dev/null +++ b/jee-7/src/test/java/com/baeldung/batch/understanding/SimpleChunkUnitTest.java @@ -0,0 +1,67 @@ +package com.baeldung.batch.understanding; + +import static org.junit.jupiter.api.Assertions.*; + +import java.util.List; +import java.util.Map; +import java.util.Properties; + +import javax.batch.operations.JobOperator; +import javax.batch.runtime.BatchRuntime; +import javax.batch.runtime.BatchStatus; +import javax.batch.runtime.JobExecution; +import javax.batch.runtime.Metric; +import javax.batch.runtime.StepExecution; + +import org.junit.jupiter.api.Test; + +class SimpleChunkUnitTest { + @Test + public void givenChunk_thenBatch_CompletesWithSucess() throws Exception { + JobOperator jobOperator = BatchRuntime.getJobOperator(); + Long executionId = jobOperator.start("simpleChunk", new Properties()); + JobExecution jobExecution = jobOperator.getJobExecution(executionId); + jobExecution = BatchTestHelper.keepTestAlive(jobExecution); + List stepExecutions = jobOperator.getStepExecutions(executionId); + for (StepExecution stepExecution : stepExecutions) { + if (stepExecution.getStepName() + .equals("firstChunkStep")) { + Map metricsMap = BatchTestHelper.getMetricsMap(stepExecution.getMetrics()); + assertEquals(10L, metricsMap.get(Metric.MetricType.READ_COUNT) + .longValue()); + assertEquals(10L / 2L, metricsMap.get(Metric.MetricType.WRITE_COUNT) + .longValue()); + assertEquals(10L / 3 + (10L % 3 > 0 ? 1 : 0), metricsMap.get(Metric.MetricType.COMMIT_COUNT) + .longValue()); + } + } + assertEquals(jobExecution.getBatchStatus(), BatchStatus.COMPLETED); + } + + @Test + public void givenChunk__thenBatch_fetchInformation() throws Exception { + JobOperator jobOperator = BatchRuntime.getJobOperator(); + Long executionId = jobOperator.start("simpleChunk", new Properties()); + JobExecution jobExecution = jobOperator.getJobExecution(executionId); + jobExecution = BatchTestHelper.keepTestAlive(jobExecution); + // job name contains simpleBatchLet which is the name of the file + assertTrue(jobOperator.getJobNames().contains("simpleChunk")); + // job parameters are empty + assertTrue(jobOperator.getParameters(executionId).isEmpty()); + // step execution information + List stepExecutions = jobOperator.getStepExecutions(executionId); + assertEquals("firstChunkStep", stepExecutions.get(0).getStepName()); + // finding out batch status + assertEquals(BatchStatus.COMPLETED, stepExecutions.get(0).getBatchStatus()); + Map metricTest = BatchTestHelper.getMetricsMap(stepExecutions.get(0).getMetrics()); + assertEquals(10L, metricTest.get(Metric.MetricType.READ_COUNT).longValue()); + assertEquals(5L, metricTest.get(Metric.MetricType.FILTER_COUNT).longValue()); + assertEquals(4L, metricTest.get(Metric.MetricType.COMMIT_COUNT).longValue()); + assertEquals(5L, metricTest.get(Metric.MetricType.WRITE_COUNT).longValue()); + assertEquals(0L, metricTest.get(Metric.MetricType.READ_SKIP_COUNT).longValue()); + assertEquals(0L, metricTest.get(Metric.MetricType.WRITE_SKIP_COUNT).longValue()); + assertEquals(0L, metricTest.get(Metric.MetricType.PROCESS_SKIP_COUNT).longValue()); + assertEquals(0L, metricTest.get(Metric.MetricType.ROLLBACK_COUNT).longValue()); + assertEquals(jobExecution.getBatchStatus(), BatchStatus.COMPLETED); + } +} diff --git a/jee-7/src/test/java/com/baeldung/batch/understanding/SimpleErrorChunkUnitTest.java b/jee-7/src/test/java/com/baeldung/batch/understanding/SimpleErrorChunkUnitTest.java new file mode 100644 index 0000000000..0f6d068888 --- /dev/null +++ b/jee-7/src/test/java/com/baeldung/batch/understanding/SimpleErrorChunkUnitTest.java @@ -0,0 +1,48 @@ +package com.baeldung.batch.understanding; + +import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.*; + +import java.util.List; +import java.util.Map; +import java.util.Properties; +import javax.batch.operations.JobOperator; +import javax.batch.runtime.BatchRuntime; +import javax.batch.runtime.BatchStatus; +import javax.batch.runtime.JobExecution; +import javax.batch.runtime.Metric.MetricType; +import javax.batch.runtime.StepExecution; + +import org.junit.jupiter.api.Test; + +class SimpleErrorChunkUnitTest { + + @Test + public void givenChunkError_thenBatch_CompletesWithFailed() throws Exception { + JobOperator jobOperator = BatchRuntime.getJobOperator(); + Long executionId = jobOperator.start("simpleErrorChunk", new Properties()); + JobExecution jobExecution = jobOperator.getJobExecution(executionId); + jobExecution = BatchTestHelper.keepTestFailed(jobExecution); + System.out.println(jobExecution.getBatchStatus()); + assertEquals(jobExecution.getBatchStatus(), BatchStatus.FAILED); + } + + @Test + public void givenChunkError_thenErrorSkipped_CompletesWithSuccess() throws Exception { + JobOperator jobOperator = BatchRuntime.getJobOperator(); + Long executionId = jobOperator.start("simpleErrorSkipChunk", new Properties()); + JobExecution jobExecution = jobOperator.getJobExecution(executionId); + jobExecution = BatchTestHelper.keepTestAlive(jobExecution); + List stepExecutions = jobOperator.getStepExecutions(executionId); + for (StepExecution stepExecution : stepExecutions) { + if (stepExecution.getStepName() + .equals("errorStep")) { + Map metricsMap = BatchTestHelper.getMetricsMap(stepExecution.getMetrics()); + long skipCount = metricsMap.get(MetricType.PROCESS_SKIP_COUNT) + .longValue(); + assertTrue("Skip count=" + skipCount, skipCount == 1l || skipCount == 2l); + } + } + assertEquals(jobExecution.getBatchStatus(), BatchStatus.COMPLETED); + } +} diff --git a/jenkins/hello-world/pom.xml b/jenkins/hello-world/pom.xml index fb2154c7ad..f00a551173 100644 --- a/jenkins/hello-world/pom.xml +++ b/jenkins/hello-world/pom.xml @@ -2,10 +2,10 @@ 4.0.0 - jenkins-hello-world + hello-world 1.0-SNAPSHOT + hello-world hpi - Hello World Plugin A sample Jenkins Hello World plugin diff --git a/jersey/README.md b/jersey/README.md index c548a79c6d..1dd871b3e8 100644 --- a/jersey/README.md +++ b/jersey/README.md @@ -2,3 +2,4 @@ - [Jersey MVC Support](https://www.baeldung.com/jersey-mvc) - [Bean Validation in Jersey](https://www.baeldung.com/jersey-bean-validation) - [Set a Response Body in JAX-RS](https://www.baeldung.com/jax-rs-response) +- [Exploring the Jersey Test Framework](https://www.baeldung.com/jersey-test) diff --git a/jersey/pom.xml b/jersey/pom.xml index b55bdc5330..a3adb4cf5a 100644 --- a/jersey/pom.xml +++ b/jersey/pom.xml @@ -2,9 +2,9 @@ 4.0.0 - com.baeldung jersey 0.0.1-SNAPSHOT + jersey war diff --git a/jhipster/jhipster-microservice/pom.xml b/jhipster/jhipster-microservice/pom.xml index 4a60e47f87..051d5f70b7 100644 --- a/jhipster/jhipster-microservice/pom.xml +++ b/jhipster/jhipster-microservice/pom.xml @@ -3,9 +3,9 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 jhipster-microservice + jhipster-microservice pom - JHipster Microservice - + jhipster com.baeldung.jhipster diff --git a/jhipster/jhipster-monolithic/pom.xml b/jhipster/jhipster-monolithic/pom.xml index e242668759..12dead99df 100644 --- a/jhipster/jhipster-monolithic/pom.xml +++ b/jhipster/jhipster-monolithic/pom.xml @@ -3,6 +3,7 @@ 4.0.0 jhipster-monolithic war + jhipster-monolithic JHipster Monolithic Application diff --git a/jhipster/jhipster-uaa/gateway/.editorconfig b/jhipster/jhipster-uaa/gateway/.editorconfig new file mode 100644 index 0000000000..a03599dd04 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/.editorconfig @@ -0,0 +1,24 @@ +# EditorConfig helps developers define and maintain consistent +# coding styles between different editors and IDEs +# editorconfig.org + +root = true + +[*] + +# Change these settings to your own preference +indent_style = space +indent_size = 4 + +# We recommend you to keep these unchanged +end_of_line = lf +charset = utf-8 +trim_trailing_whitespace = true +insert_final_newline = true + +[*.md] +trim_trailing_whitespace = false + +[{package,bower}.json] +indent_style = space +indent_size = 2 diff --git a/jhipster/jhipster-uaa/gateway/.gitattributes b/jhipster/jhipster-uaa/gateway/.gitattributes new file mode 100644 index 0000000000..8ab72fe637 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/.gitattributes @@ -0,0 +1,149 @@ +# This file is inspired by https://github.com/alexkaratarakis/gitattributes +# +# Auto detect text files and perform LF normalization +# http://davidlaing.com/2012/09/19/customise-your-gitattributes-to-become-a-git-ninja/ +* text=auto + +# The above will handle all files NOT found below +# These files are text and should be normalized (Convert crlf => lf) + +*.bat text eol=crlf +*.coffee text +*.css text +*.cql text +*.df text +*.ejs text +*.html text +*.java text +*.js text +*.json text +*.less text +*.properties text +*.sass text +*.scss text +*.sh text eol=lf +*.sql text +*.txt text +*.ts text +*.xml text +*.yaml text +*.yml text + +# Documents +*.doc diff=astextplain +*.DOC diff=astextplain +*.docx diff=astextplain +*.DOCX diff=astextplain +*.dot diff=astextplain +*.DOT diff=astextplain +*.pdf diff=astextplain +*.PDF diff=astextplain +*.rtf diff=astextplain +*.RTF diff=astextplain +*.markdown text +*.md text +*.adoc text +*.textile text +*.mustache text +*.csv text +*.tab text +*.tsv text +*.txt text +AUTHORS text +CHANGELOG text +CHANGES text +CONTRIBUTING text +COPYING text +copyright text +*COPYRIGHT* text +INSTALL text +license text +LICENSE text +NEWS text +readme text +*README* text +TODO text + +# Graphics +*.png binary +*.jpg binary +*.jpeg binary +*.gif binary +*.tif binary +*.tiff binary +*.ico binary +# SVG treated as an asset (binary) by default. If you want to treat it as text, +# comment-out the following line and uncomment the line after. +*.svg binary +#*.svg text +*.eps binary + +# These files are binary and should be left untouched +# (binary is a macro for -text -diff) +*.class binary +*.jar binary +*.war binary + +## LINTERS +.csslintrc text +.eslintrc text +.jscsrc text +.jshintrc text +.jshintignore text +.stylelintrc text + +## CONFIGS +*.bowerrc text +*.conf text +*.config text +.editorconfig text +.gitattributes text +.gitconfig text +.gitignore text +.htaccess text +*.npmignore text + +## HEROKU +Procfile text +.slugignore text + +## AUDIO +*.kar binary +*.m4a binary +*.mid binary +*.midi binary +*.mp3 binary +*.ogg binary +*.ra binary + +## VIDEO +*.3gpp binary +*.3gp binary +*.as binary +*.asf binary +*.asx binary +*.fla binary +*.flv binary +*.m4v binary +*.mng binary +*.mov binary +*.mp4 binary +*.mpeg binary +*.mpg binary +*.swc binary +*.swf binary +*.webm binary + +## ARCHIVES +*.7z binary +*.gz binary +*.rar binary +*.tar binary +*.zip binary + +## FONTS +*.ttf binary +*.eot binary +*.otf binary +*.woff binary +*.woff2 binary diff --git a/jhipster/jhipster-uaa/gateway/.gitignore b/jhipster/jhipster-uaa/gateway/.gitignore new file mode 100644 index 0000000000..f1f6845d33 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/.gitignore @@ -0,0 +1,145 @@ +###################### +# Project Specific +###################### +/src/main/webapp/content/css/main.css +/target/www/** +/src/test/javascript/coverage/ + +###################### +# Node +###################### +/node/ +node_tmp/ +node_modules/ +npm-debug.log.* +/.awcache/* +/.cache-loader/* + +###################### +# SASS +###################### +.sass-cache/ + +###################### +# Eclipse +###################### +*.pydevproject +.project +.metadata +tmp/ +tmp/**/* +*.tmp +*.bak +*.swp +*~.nib +local.properties +.classpath +.settings/ +.loadpath +.factorypath +/src/main/resources/rebel.xml + +# External tool builders +.externalToolBuilders/** + +# Locally stored "Eclipse launch configurations" +*.launch + +# CDT-specific +.cproject + +# PDT-specific +.buildpath + +###################### +# Intellij +###################### +.idea/ +*.iml +*.iws +*.ipr +*.ids +*.orig +classes/ +out/ + +###################### +# Visual Studio Code +###################### +.vscode/ + +###################### +# Maven +###################### +/log/ +/target/ + +###################### +# Gradle +###################### +.gradle/ +/build/ + +###################### +# Package Files +###################### +*.jar +*.war +*.ear +*.db + +###################### +# Windows +###################### +# Windows image file caches +Thumbs.db + +# Folder config file +Desktop.ini + +###################### +# Mac OSX +###################### +.DS_Store +.svn + +# Thumbnails +._* + +# Files that might appear on external disk +.Spotlight-V100 +.Trashes + +###################### +# Directories +###################### +/bin/ +/deploy/ + +###################### +# Logs +###################### +*.log* + +###################### +# Others +###################### +*.class +*.*~ +*~ +.merge_file* + +###################### +# Gradle Wrapper +###################### +!gradle/wrapper/gradle-wrapper.jar + +###################### +# Maven Wrapper +###################### +!.mvn/wrapper/maven-wrapper.jar + +###################### +# ESLint +###################### +.eslintcache diff --git a/jhipster/jhipster-uaa/gateway/.huskyrc b/jhipster/jhipster-uaa/gateway/.huskyrc new file mode 100644 index 0000000000..9e18d87674 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/.huskyrc @@ -0,0 +1,5 @@ +{ + "hooks": { + "pre-commit": "lint-staged" + } +} diff --git a/jhipster/jhipster-uaa/gateway/.jhipster/Quote.json b/jhipster/jhipster-uaa/gateway/.jhipster/Quote.json new file mode 100644 index 0000000000..af06567fff --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/.jhipster/Quote.json @@ -0,0 +1,38 @@ +{ + "name": "Quote", + "fields": [ + { + "fieldName": "symbol", + "fieldType": "String", + "fieldValidateRules": [ + "required", + "unique" + ] + }, + { + "fieldName": "price", + "fieldType": "BigDecimal", + "fieldValidateRules": [ + "required" + ] + }, + { + "fieldName": "lastTrade", + "fieldType": "ZonedDateTime", + "fieldValidateRules": [ + "required" + ] + } + ], + "relationships": [], + "changelogDate": "20181020145525", + "entityTableName": "quote", + "dto": "mapstruct", + "pagination": "pagination", + "service": "serviceImpl", + "jpaMetamodelFiltering": true, + "fluentMethods": true, + "clientRootFolder": "quotes", + "applications": "*", + "microserviceName": "quotes" +} \ No newline at end of file diff --git a/jhipster/jhipster-uaa/gateway/.mvn/wrapper/MavenWrapperDownloader.java b/jhipster/jhipster-uaa/gateway/.mvn/wrapper/MavenWrapperDownloader.java new file mode 100644 index 0000000000..fa4f7b499f --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/.mvn/wrapper/MavenWrapperDownloader.java @@ -0,0 +1,110 @@ +/* +Licensed to the Apache Software Foundation (ASF) under one +or more contributor license agreements. See the NOTICE file +distributed with this work for additional information +regarding copyright ownership. The ASF licenses this file +to you under the Apache License, Version 2.0 (the +"License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, +software distributed under the License is distributed on an +"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, either express or implied. See the License for the +specific language governing permissions and limitations +under the License. +*/ + +import java.net.*; +import java.io.*; +import java.nio.channels.*; +import java.util.Properties; + +public class MavenWrapperDownloader { + + /** + * Default URL to download the maven-wrapper.jar from, if no 'downloadUrl' is provided. + */ + private static final String DEFAULT_DOWNLOAD_URL = + "https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.4.2/maven-wrapper-0.4.2.jar"; + + /** + * Path to the maven-wrapper.properties file, which might contain a downloadUrl property to + * use instead of the default one. + */ + private static final String MAVEN_WRAPPER_PROPERTIES_PATH = + ".mvn/wrapper/maven-wrapper.properties"; + + /** + * Path where the maven-wrapper.jar will be saved to. + */ + private static final String MAVEN_WRAPPER_JAR_PATH = + ".mvn/wrapper/maven-wrapper.jar"; + + /** + * Name of the property which should be used to override the default download url for the wrapper. + */ + private static final String PROPERTY_NAME_WRAPPER_URL = "wrapperUrl"; + + public static void main(String args[]) { + System.out.println("- Downloader started"); + File baseDirectory = new File(args[0]); + System.out.println("- Using base directory: " + baseDirectory.getAbsolutePath()); + + // If the maven-wrapper.properties exists, read it and check if it contains a custom + // wrapperUrl parameter. + File mavenWrapperPropertyFile = new File(baseDirectory, MAVEN_WRAPPER_PROPERTIES_PATH); + String url = DEFAULT_DOWNLOAD_URL; + if(mavenWrapperPropertyFile.exists()) { + FileInputStream mavenWrapperPropertyFileInputStream = null; + try { + mavenWrapperPropertyFileInputStream = new FileInputStream(mavenWrapperPropertyFile); + Properties mavenWrapperProperties = new Properties(); + mavenWrapperProperties.load(mavenWrapperPropertyFileInputStream); + url = mavenWrapperProperties.getProperty(PROPERTY_NAME_WRAPPER_URL, url); + } catch (IOException e) { + System.out.println("- ERROR loading '" + MAVEN_WRAPPER_PROPERTIES_PATH + "'"); + } finally { + try { + if(mavenWrapperPropertyFileInputStream != null) { + mavenWrapperPropertyFileInputStream.close(); + } + } catch (IOException e) { + // Ignore ... + } + } + } + System.out.println("- Downloading from: : " + url); + + File outputFile = new File(baseDirectory.getAbsolutePath(), MAVEN_WRAPPER_JAR_PATH); + if(!outputFile.getParentFile().exists()) { + if(!outputFile.getParentFile().mkdirs()) { + System.out.println( + "- ERROR creating output direcrory '" + outputFile.getParentFile().getAbsolutePath() + "'"); + } + } + System.out.println("- Downloading to: " + outputFile.getAbsolutePath()); + try { + downloadFileFromURL(url, outputFile); + System.out.println("Done"); + System.exit(0); + } catch (Throwable e) { + System.out.println("- Error downloading"); + e.printStackTrace(); + System.exit(1); + } + } + + private static void downloadFileFromURL(String urlString, File destination) throws Exception { + URL website = new URL(urlString); + ReadableByteChannel rbc; + rbc = Channels.newChannel(website.openStream()); + FileOutputStream fos = new FileOutputStream(destination); + fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE); + fos.close(); + rbc.close(); + } + +} diff --git a/jhipster/jhipster-uaa/gateway/.mvn/wrapper/maven-wrapper.jar b/jhipster/jhipster-uaa/gateway/.mvn/wrapper/maven-wrapper.jar new file mode 100644 index 0000000000..01e6799737 Binary files /dev/null and b/jhipster/jhipster-uaa/gateway/.mvn/wrapper/maven-wrapper.jar differ diff --git a/jhipster/jhipster-uaa/gateway/.mvn/wrapper/maven-wrapper.properties b/jhipster/jhipster-uaa/gateway/.mvn/wrapper/maven-wrapper.properties new file mode 100644 index 0000000000..00d32aab1d --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/.mvn/wrapper/maven-wrapper.properties @@ -0,0 +1 @@ +distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.5.4/apache-maven-3.5.4-bin.zip \ No newline at end of file diff --git a/jhipster/jhipster-uaa/gateway/.prettierignore b/jhipster/jhipster-uaa/gateway/.prettierignore new file mode 100644 index 0000000000..2c085d1d2f --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/.prettierignore @@ -0,0 +1,2 @@ +node_modules +target diff --git a/jhipster/jhipster-uaa/gateway/.prettierrc b/jhipster/jhipster-uaa/gateway/.prettierrc new file mode 100644 index 0000000000..6fd4aa1267 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/.prettierrc @@ -0,0 +1,12 @@ +# Prettier configuration + +printWidth: 140 +singleQuote: true +tabWidth: 4 +useTabs: false + +# js and ts rules: +arrowParens: avoid + +# jsx and tsx rules: +jsxBracketSameLine: false diff --git a/jhipster/jhipster-uaa/gateway/.yo-rc.json b/jhipster/jhipster-uaa/gateway/.yo-rc.json new file mode 100644 index 0000000000..4e950cd7b9 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/.yo-rc.json @@ -0,0 +1,39 @@ +{ + "generator-jhipster": { + "promptValues": { + "packageName": "com.baeldung.jhipster.gateway", + "nativeLanguage": "en" + }, + "jhipsterVersion": "5.4.2", + "applicationType": "gateway", + "baseName": "gateway", + "packageName": "com.baeldung.jhipster.gateway", + "packageFolder": "com/baeldung/jhipster/gateway", + "serverPort": "8080", + "authenticationType": "uaa", + "uaaBaseName": "uaa", + "cacheProvider": "hazelcast", + "enableHibernateCache": true, + "websocket": false, + "databaseType": "sql", + "devDatabaseType": "h2Disk", + "prodDatabaseType": "mysql", + "searchEngine": false, + "messageBroker": false, + "serviceDiscoveryType": "eureka", + "buildTool": "maven", + "enableSwaggerCodegen": false, + "clientFramework": "angularX", + "useSass": true, + "clientPackageManager": "npm", + "testFrameworks": [], + "jhiPrefix": "jhi", + "enableTranslation": true, + "nativeLanguage": "en", + "languages": [ + "en", + "fr", + "pt-br" + ] + } +} \ No newline at end of file diff --git a/jhipster/jhipster-uaa/gateway/README.md b/jhipster/jhipster-uaa/gateway/README.md new file mode 100644 index 0000000000..781f3a9e88 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/README.md @@ -0,0 +1,186 @@ +# gateway +This application was generated using JHipster 5.4.2, you can find documentation and help at [https://www.jhipster.tech/documentation-archive/v5.4.2](https://www.jhipster.tech/documentation-archive/v5.4.2). + +This is a "gateway" application intended to be part of a microservice architecture, please refer to the [Doing microservices with JHipster][] page of the documentation for more information. + +This application is configured for Service Discovery and Configuration with the JHipster-Registry. On launch, it will refuse to start if it is not able to connect to the JHipster-Registry at [http://localhost:8761](http://localhost:8761). For more information, read our documentation on [Service Discovery and Configuration with the JHipster-Registry][]. + +## Development + +Before you can build this project, you must install and configure the following dependencies on your machine: + +1. [Node.js][]: We use Node to run a development web server and build the project. + Depending on your system, you can install Node either from source or as a pre-packaged bundle. + +After installing Node, you should be able to run the following command to install development tools. +You will only need to run this command when dependencies change in [package.json](package.json). + + npm install + +We use npm scripts and [Webpack][] as our build system. + +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. + + ./mvnw + npm start + +Npm is also used to manage CSS and JavaScript dependencies used in this application. You can upgrade dependencies by +specifying a newer version in [package.json](package.json). You can also run `npm update` and `npm install` to manage dependencies. +Add the `help` flag on any command to see how you can use it. For example, `npm help update`. + +The `npm run` command will list all of the scripts available to run for this project. + +### Service workers + +Service workers are commented by default, to enable them please uncomment the following code. + +* The service worker registering script in index.html + +```html + +``` + +Note: workbox creates the respective service worker and dynamically generate the `service-worker.js` + +### Managing dependencies + +For example, to add [Leaflet][] library as a runtime dependency of your application, you would run following command: + + npm install --save --save-exact leaflet + +To benefit from TypeScript type definitions from [DefinitelyTyped][] repository in development, you would run following command: + + npm install --save-dev --save-exact @types/leaflet + +Then you would import the JS and CSS files specified in library's installation instructions so that [Webpack][] knows about them: +Edit [src/main/webapp/app/vendor.ts](src/main/webapp/app/vendor.ts) file: +~~~ +import 'leaflet/dist/leaflet.js'; +~~~ + +Edit [src/main/webapp/content/css/vendor.css](src/main/webapp/content/css/vendor.css) file: +~~~ +@import '~leaflet/dist/leaflet.css'; +~~~ +Note: there are still few other things remaining to do for Leaflet that we won't detail here. + +For further instructions on how to develop with JHipster, have a look at [Using JHipster in development][]. + +### Using angular-cli + +You can also use [Angular CLI][] to generate some custom client code. + +For example, the following command: + + ng generate component my-component + +will generate few files: + + create src/main/webapp/app/my-component/my-component.component.html + create src/main/webapp/app/my-component/my-component.component.ts + update src/main/webapp/app/app.module.ts + + +## Building for production + +To optimize the gateway application for production, run: + + ./mvnw -Pprod clean package + +This will concatenate and minify the client CSS and JavaScript files. It will also modify `index.html` so it references these new files. +To ensure everything worked, run: + + java -jar target/*.war + +Then navigate to [http://localhost:8080](http://localhost:8080) in your browser. + +Refer to [Using JHipster in production][] for more details. + +## Testing + +To launch your application's tests, run: + + ./mvnw clean test + +### Client tests + +Unit tests are run by [Jest][] and written with [Jasmine][]. They're located in [src/test/javascript/](src/test/javascript/) and can be run with: + + npm test + + + +For more information, refer to the [Running tests page][]. + +### Code quality + +Sonar is used to analyse code quality. You can start a local Sonar server (accessible on http://localhost:9001) with: + +``` +docker-compose -f src/main/docker/sonar.yml up -d +``` + +Then, run a Sonar analysis: + +``` +./mvnw -Pprod clean test sonar:sonar +``` + +For more information, refer to the [Code quality page][]. + +## Using Docker to simplify development (optional) + +You can use Docker to improve your JHipster development experience. A number of docker-compose configuration are available in the [src/main/docker](src/main/docker) folder to launch required third party services. + +For example, to start a mysql database in a docker container, run: + + docker-compose -f src/main/docker/mysql.yml up -d + +To stop it and remove the container, run: + + docker-compose -f src/main/docker/mysql.yml down + +You can also fully dockerize your application and all the services that it depends on. +To achieve this, first build a docker image of your app by running: + + ./mvnw package -Pprod jib:dockerBuild + +Then run: + + docker-compose -f src/main/docker/app.yml up -d + +For more information refer to [Using Docker and Docker-Compose][], this page also contains information on the docker-compose sub-generator (`jhipster docker-compose`), which is able to generate docker configurations for one or several JHipster applications. + +## Continuous Integration (optional) + +To configure CI for your project, run the ci-cd sub-generator (`jhipster ci-cd`), this will let you generate configuration files for a number of Continuous Integration systems. Consult the [Setting up Continuous Integration][] page for more information. + +[JHipster Homepage and latest documentation]: https://www.jhipster.tech +[JHipster 5.4.2 archive]: https://www.jhipster.tech/documentation-archive/v5.4.2 +[Doing microservices with JHipster]: https://www.jhipster.tech/documentation-archive/v5.4.2/microservices-architecture/ +[Using JHipster in development]: https://www.jhipster.tech/documentation-archive/v5.4.2/development/ +[Service Discovery and Configuration with the JHipster-Registry]: https://www.jhipster.tech/documentation-archive/v5.4.2/microservices-architecture/#jhipster-registry +[Using Docker and Docker-Compose]: https://www.jhipster.tech/documentation-archive/v5.4.2/docker-compose +[Using JHipster in production]: https://www.jhipster.tech/documentation-archive/v5.4.2/production/ +[Running tests page]: https://www.jhipster.tech/documentation-archive/v5.4.2/running-tests/ +[Code quality page]: https://www.jhipster.tech/documentation-archive/v5.4.2/code-quality/ +[Setting up Continuous Integration]: https://www.jhipster.tech/documentation-archive/v5.4.2/setting-up-ci/ + + +[Node.js]: https://nodejs.org/ +[Yarn]: https://yarnpkg.org/ +[Webpack]: https://webpack.github.io/ +[Angular CLI]: https://cli.angular.io/ +[BrowserSync]: http://www.browsersync.io/ +[Jest]: https://facebook.github.io/jest/ +[Jasmine]: http://jasmine.github.io/2.0/introduction.html +[Protractor]: https://angular.github.io/protractor/ +[Leaflet]: http://leafletjs.com/ +[DefinitelyTyped]: http://definitelytyped.org/ diff --git a/jhipster/jhipster-uaa/gateway/angular.json b/jhipster/jhipster-uaa/gateway/angular.json new file mode 100644 index 0000000000..b7f32a8949 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/angular.json @@ -0,0 +1,39 @@ +{ + "$schema": "./node_modules/@angular/cli/lib/config/schema.json", + "version": 1, + "newProjectRoot": "projects", + "projects": { + "gateway": { + "root": "", + "sourceRoot": "src/main/webapp", + "projectType": "application", + "architect": {} + } + }, + "defaultProject": "gateway", + "cli": { + "packageManager": "yarn" + }, + "schematics": { + "@schematics/angular:component": { + "inlineStyle": true, + "inlineTemplate": false, + "spec": false, + "prefix": "jhi", + "styleExt": "scss" + }, + "@schematics/angular:directive": { + "spec": false, + "prefix": "jhi" + }, + "@schematics/angular:guard": { + "spec": false + }, + "@schematics/angular:pipe": { + "spec": false + }, + "@schematics/angular:service": { + "spec": false + } + } +} diff --git a/jhipster/jhipster-uaa/gateway/mvnw b/jhipster/jhipster-uaa/gateway/mvnw new file mode 100644 index 0000000000..5551fde8e7 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/mvnw @@ -0,0 +1,286 @@ +#!/bin/sh +# ---------------------------------------------------------------------------- +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# ---------------------------------------------------------------------------- + +# ---------------------------------------------------------------------------- +# Maven2 Start Up Batch script +# +# Required ENV vars: +# ------------------ +# JAVA_HOME - location of a JDK home dir +# +# Optional ENV vars +# ----------------- +# M2_HOME - location of maven2's installed home dir +# MAVEN_OPTS - parameters passed to the Java VM when running Maven +# e.g. to debug Maven itself, use +# set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 +# MAVEN_SKIP_RC - flag to disable loading of mavenrc files +# ---------------------------------------------------------------------------- + +if [ -z "$MAVEN_SKIP_RC" ] ; then + + if [ -f /etc/mavenrc ] ; then + . /etc/mavenrc + fi + + if [ -f "$HOME/.mavenrc" ] ; then + . "$HOME/.mavenrc" + fi + +fi + +# OS specific support. $var _must_ be set to either true or false. +cygwin=false; +darwin=false; +mingw=false +case "`uname`" in + CYGWIN*) cygwin=true ;; + MINGW*) mingw=true;; + Darwin*) darwin=true + # Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home + # See https://developer.apple.com/library/mac/qa/qa1170/_index.html + if [ -z "$JAVA_HOME" ]; then + if [ -x "/usr/libexec/java_home" ]; then + export JAVA_HOME="`/usr/libexec/java_home`" + else + export JAVA_HOME="/Library/Java/Home" + fi + fi + ;; +esac + +if [ -z "$JAVA_HOME" ] ; then + if [ -r /etc/gentoo-release ] ; then + JAVA_HOME=`java-config --jre-home` + fi +fi + +if [ -z "$M2_HOME" ] ; then + ## resolve links - $0 may be a link to maven's home + PRG="$0" + + # need this for relative symlinks + while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG="`dirname "$PRG"`/$link" + fi + done + + saveddir=`pwd` + + M2_HOME=`dirname "$PRG"`/.. + + # make it fully qualified + M2_HOME=`cd "$M2_HOME" && pwd` + + cd "$saveddir" + # echo Using m2 at $M2_HOME +fi + +# For Cygwin, ensure paths are in UNIX format before anything is touched +if $cygwin ; then + [ -n "$M2_HOME" ] && + M2_HOME=`cygpath --unix "$M2_HOME"` + [ -n "$JAVA_HOME" ] && + JAVA_HOME=`cygpath --unix "$JAVA_HOME"` + [ -n "$CLASSPATH" ] && + CLASSPATH=`cygpath --path --unix "$CLASSPATH"` +fi + +# For Mingw, ensure paths are in UNIX format before anything is touched +if $mingw ; then + [ -n "$M2_HOME" ] && + M2_HOME="`(cd "$M2_HOME"; pwd)`" + [ -n "$JAVA_HOME" ] && + JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`" + # TODO classpath? +fi + +if [ -z "$JAVA_HOME" ]; then + javaExecutable="`which javac`" + if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then + # readlink(1) is not available as standard on Solaris 10. + readLink=`which readlink` + if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then + if $darwin ; then + javaHome="`dirname \"$javaExecutable\"`" + javaExecutable="`cd \"$javaHome\" && pwd -P`/javac" + else + javaExecutable="`readlink -f \"$javaExecutable\"`" + fi + javaHome="`dirname \"$javaExecutable\"`" + javaHome=`expr "$javaHome" : '\(.*\)/bin'` + JAVA_HOME="$javaHome" + export JAVA_HOME + fi + fi +fi + +if [ -z "$JAVACMD" ] ; then + if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + else + JAVACMD="`which java`" + fi +fi + +if [ ! -x "$JAVACMD" ] ; then + echo "Error: JAVA_HOME is not defined correctly." >&2 + echo " We cannot execute $JAVACMD" >&2 + exit 1 +fi + +if [ -z "$JAVA_HOME" ] ; then + echo "Warning: JAVA_HOME environment variable is not set." +fi + +CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher + +# traverses directory structure from process work directory to filesystem root +# first directory with .mvn subdirectory is considered project base directory +find_maven_basedir() { + + if [ -z "$1" ] + then + echo "Path not specified to find_maven_basedir" + return 1 + fi + + basedir="$1" + wdir="$1" + while [ "$wdir" != '/' ] ; do + if [ -d "$wdir"/.mvn ] ; then + basedir=$wdir + break + fi + # workaround for JBEAP-8937 (on Solaris 10/Sparc) + if [ -d "${wdir}" ]; then + wdir=`cd "$wdir/.."; pwd` + fi + # end of workaround + done + echo "${basedir}" +} + +# concatenates all lines of a file +concat_lines() { + if [ -f "$1" ]; then + echo "$(tr -s '\n' ' ' < "$1")" + fi +} + +BASE_DIR=`find_maven_basedir "$(pwd)"` +if [ -z "$BASE_DIR" ]; then + exit 1; +fi + +########################################################################################## +# Extension to allow automatically downloading the maven-wrapper.jar from Maven-central +# This allows using the maven wrapper in projects that prohibit checking in binary data. +########################################################################################## +if [ -r "$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" ]; then + if [ "$MVNW_VERBOSE" = true ]; then + echo "Found .mvn/wrapper/maven-wrapper.jar" + fi +else + if [ "$MVNW_VERBOSE" = true ]; then + echo "Couldn't find .mvn/wrapper/maven-wrapper.jar, downloading it ..." + fi + jarUrl="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.4.2/maven-wrapper-0.4.2.jar" + while IFS="=" read key value; do + case "$key" in (wrapperUrl) jarUrl="$value"; break ;; + esac + done < "$BASE_DIR/.mvn/wrapper/maven-wrapper.properties" + if [ "$MVNW_VERBOSE" = true ]; then + echo "Downloading from: $jarUrl" + fi + wrapperJarPath="$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" + + if command -v wget > /dev/null; then + if [ "$MVNW_VERBOSE" = true ]; then + echo "Found wget ... using wget" + fi + wget "$jarUrl" -O "$wrapperJarPath" + elif command -v curl > /dev/null; then + if [ "$MVNW_VERBOSE" = true ]; then + echo "Found curl ... using curl" + fi + curl -o "$wrapperJarPath" "$jarUrl" + else + if [ "$MVNW_VERBOSE" = true ]; then + echo "Falling back to using Java to download" + fi + javaClass="$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.java" + if [ -e "$javaClass" ]; then + if [ ! -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then + if [ "$MVNW_VERBOSE" = true ]; then + echo " - Compiling MavenWrapperDownloader.java ..." + fi + # Compiling the Java class + ("$JAVA_HOME/bin/javac" "$javaClass") + fi + if [ -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then + # Running the downloader + if [ "$MVNW_VERBOSE" = true ]; then + echo " - Running MavenWrapperDownloader.java ..." + fi + ("$JAVA_HOME/bin/java" -cp .mvn/wrapper MavenWrapperDownloader "$MAVEN_PROJECTBASEDIR") + fi + fi + fi +fi +########################################################################################## +# End of extension +########################################################################################## + +export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"} +if [ "$MVNW_VERBOSE" = true ]; then + echo $MAVEN_PROJECTBASEDIR +fi +MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS" + +# For Cygwin, switch paths to Windows format before running java +if $cygwin; then + [ -n "$M2_HOME" ] && + M2_HOME=`cygpath --path --windows "$M2_HOME"` + [ -n "$JAVA_HOME" ] && + JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"` + [ -n "$CLASSPATH" ] && + CLASSPATH=`cygpath --path --windows "$CLASSPATH"` + [ -n "$MAVEN_PROJECTBASEDIR" ] && + MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"` +fi + +WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain + +exec "$JAVACMD" \ + $MAVEN_OPTS \ + -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \ + "-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \ + ${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@" diff --git a/jhipster/jhipster-uaa/gateway/mvnw.cmd b/jhipster/jhipster-uaa/gateway/mvnw.cmd new file mode 100644 index 0000000000..e5cfb0ae9e --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/mvnw.cmd @@ -0,0 +1,161 @@ +@REM ---------------------------------------------------------------------------- +@REM Licensed to the Apache Software Foundation (ASF) under one +@REM or more contributor license agreements. See the NOTICE file +@REM distributed with this work for additional information +@REM regarding copyright ownership. The ASF licenses this file +@REM to you under the Apache License, Version 2.0 (the +@REM "License"); you may not use this file except in compliance +@REM with the License. You may obtain a copy of the License at +@REM +@REM http://www.apache.org/licenses/LICENSE-2.0 +@REM +@REM Unless required by applicable law or agreed to in writing, +@REM software distributed under the License is distributed on an +@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +@REM KIND, either express or implied. See the License for the +@REM specific language governing permissions and limitations +@REM under the License. +@REM ---------------------------------------------------------------------------- + +@REM ---------------------------------------------------------------------------- +@REM Maven2 Start Up Batch script +@REM +@REM Required ENV vars: +@REM JAVA_HOME - location of a JDK home dir +@REM +@REM Optional ENV vars +@REM M2_HOME - location of maven2's installed home dir +@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands +@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a key stroke before ending +@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven +@REM e.g. to debug Maven itself, use +@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 +@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files +@REM ---------------------------------------------------------------------------- + +@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on' +@echo off +@REM set title of command window +title %0 +@REM enable echoing my setting MAVEN_BATCH_ECHO to 'on' +@if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO% + +@REM set %HOME% to equivalent of $HOME +if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%") + +@REM Execute a user defined script before this one +if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre +@REM check for pre script, once with legacy .bat ending and once with .cmd ending +if exist "%HOME%\mavenrc_pre.bat" call "%HOME%\mavenrc_pre.bat" +if exist "%HOME%\mavenrc_pre.cmd" call "%HOME%\mavenrc_pre.cmd" +:skipRcPre + +@setlocal + +set ERROR_CODE=0 + +@REM To isolate internal variables from possible post scripts, we use another setlocal +@setlocal + +@REM ==== START VALIDATION ==== +if not "%JAVA_HOME%" == "" goto OkJHome + +echo. +echo Error: JAVA_HOME not found in your environment. >&2 +echo Please set the JAVA_HOME variable in your environment to match the >&2 +echo location of your Java installation. >&2 +echo. +goto error + +:OkJHome +if exist "%JAVA_HOME%\bin\java.exe" goto init + +echo. +echo Error: JAVA_HOME is set to an invalid directory. >&2 +echo JAVA_HOME = "%JAVA_HOME%" >&2 +echo Please set the JAVA_HOME variable in your environment to match the >&2 +echo location of your Java installation. >&2 +echo. +goto error + +@REM ==== END VALIDATION ==== + +:init + +@REM Find the project base dir, i.e. the directory that contains the folder ".mvn". +@REM Fallback to current working directory if not found. + +set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR% +IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir + +set EXEC_DIR=%CD% +set WDIR=%EXEC_DIR% +:findBaseDir +IF EXIST "%WDIR%"\.mvn goto baseDirFound +cd .. +IF "%WDIR%"=="%CD%" goto baseDirNotFound +set WDIR=%CD% +goto findBaseDir + +:baseDirFound +set MAVEN_PROJECTBASEDIR=%WDIR% +cd "%EXEC_DIR%" +goto endDetectBaseDir + +:baseDirNotFound +set MAVEN_PROJECTBASEDIR=%EXEC_DIR% +cd "%EXEC_DIR%" + +:endDetectBaseDir + +IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig + +@setlocal EnableExtensions EnableDelayedExpansion +for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a +@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS% + +:endReadAdditionalConfig + +SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe" +set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar" +set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain + +set DOWNLOAD_URL="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.4.2/maven-wrapper-0.4.2.jar" +FOR /F "tokens=1,2 delims==" %%A IN (%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties) DO ( + IF "%%A"=="wrapperUrl" SET DOWNLOAD_URL=%%B +) + +@REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central +@REM This allows using the maven wrapper in projects that prohibit checking in binary data. +if exist %WRAPPER_JAR% ( + echo Found %WRAPPER_JAR% +) else ( + echo Couldn't find %WRAPPER_JAR%, downloading it ... + echo Downloading from: %DOWNLOAD_URL% + powershell -Command "(New-Object Net.WebClient).DownloadFile('%DOWNLOAD_URL%', '%WRAPPER_JAR%')" + echo Finished downloading %WRAPPER_JAR% +) +@REM End of extension + +%MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %* +if ERRORLEVEL 1 goto error +goto end + +:error +set ERROR_CODE=1 + +:end +@endlocal & set ERROR_CODE=%ERROR_CODE% + +if not "%MAVEN_SKIP_RC%" == "" goto skipRcPost +@REM check for post script, once with legacy .bat ending and once with .cmd ending +if exist "%HOME%\mavenrc_post.bat" call "%HOME%\mavenrc_post.bat" +if exist "%HOME%\mavenrc_post.cmd" call "%HOME%\mavenrc_post.cmd" +:skipRcPost + +@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on' +if "%MAVEN_BATCH_PAUSE%" == "on" pause + +if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE% + +exit /B %ERROR_CODE% diff --git a/jhipster/jhipster-uaa/gateway/package-lock.json b/jhipster/jhipster-uaa/gateway/package-lock.json new file mode 100644 index 0000000000..9c5b3935f4 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/package-lock.json @@ -0,0 +1,20609 @@ +{ + "name": "gateway", + "version": "0.0.0", + "lockfileVersion": 1, + "requires": true, + "dependencies": { + "@angular-devkit/architect": { + "version": "0.7.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/@angular-devkit/architect/-/architect-0.7.2.tgz", + "integrity": "sha512-p7e4wE+a1AxlfCJQL1IIBltblV9VqFSMlUuPW3PUp0fguo0yaTv9paY5WlFwrj0YhypBj3zHcjSdIruHrgbErg==", + "dev": true, + "requires": { + "@angular-devkit/core": "0.7.2", + "rxjs": "^6.0.0" + } + }, + "@angular-devkit/core": { + "version": "0.7.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/@angular-devkit/core/-/core-0.7.2.tgz", + "integrity": "sha512-1Es9oNpabOukutBe+0txXUHyhI6ypuc7WrxTutZH7Lr3n3+CTG6oEv42rOcot1aXi1n97wNqcdY3lrENFu9vhQ==", + "dev": true, + "requires": { + "ajv": "~6.4.0", + "chokidar": "^2.0.3", + "rxjs": "^6.0.0", + "source-map": "^0.5.6" + } + }, + "@angular-devkit/schematics": { + "version": "0.7.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/@angular-devkit/schematics/-/schematics-0.7.2.tgz", + "integrity": "sha512-4mhLhXc4Tyu07sGXWOHV9zXZ8uthbUo5zr63lj0Z9gv5f/vrJj5fyEoTnHONBFzVPdElMYS2vhiEtwnN0hKQDA==", + "dev": true, + "requires": { + "@angular-devkit/core": "0.7.2", + "rxjs": "^6.0.0" + } + }, + "@angular/cli": { + "version": "6.1.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/@angular/cli/-/cli-6.1.2.tgz", + "integrity": "sha512-uY1/rFWqmi7MibUz4bwhkiM95PmDZn0OCaMxGafZlriZgu+81on7/7biWNHgIRAd+QV1qBJlstWT2J0K8r1vLA==", + "dev": true, + "requires": { + "@angular-devkit/architect": "0.7.2", + "@angular-devkit/core": "0.7.2", + "@angular-devkit/schematics": "0.7.2", + "@schematics/angular": "0.7.2", + "@schematics/update": "0.7.2", + "opn": "^5.3.0", + "rxjs": "^6.0.0", + "semver": "^5.1.0", + "symbol-observable": "^1.2.0", + "yargs-parser": "^10.0.0" + } + }, + "@angular/common": { + "version": "6.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/@angular/common/-/common-6.1.0.tgz", + "integrity": "sha512-uxdjxbuTYiCsOcrfO9EumGrfXo+7nB7HlS9F4wraKcnR22oJYNUh36meFKZwpoj5pDIBLnZQu75boI16o3W+SQ==", + "requires": { + "tslib": "^1.9.0" + } + }, + "@angular/compiler": { + "version": "6.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/@angular/compiler/-/compiler-6.1.0.tgz", + "integrity": "sha512-5c8ZYCFv0xccy0F12zBRIJX0pJd9BgCThJuhVJAuaRFFOqPZl8FKEO3SFqKJNywT0UktZD9JpYFKxhUVxuSHDg==", + "requires": { + "tslib": "^1.9.0" + } + }, + "@angular/compiler-cli": { + "version": "6.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/@angular/compiler-cli/-/compiler-cli-6.1.0.tgz", + "integrity": "sha512-g4fXQwAYnxtr08BK3CiodJsUXz3fIBCVfZaWIcLMdOlyarFDEvB3TA9qfPkQtlndm87WpXjZ6Xd9OAkmG8t8dw==", + "dev": true, + "requires": { + "chokidar": "^1.4.2", + "minimist": "^1.2.0", + "reflect-metadata": "^0.1.2", + "tsickle": "^0.30.0" + }, + "dependencies": { + "anymatch": { + "version": "1.3.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/anymatch/-/anymatch-1.3.2.tgz", + "integrity": "sha512-0XNayC8lTHQ2OI8aljNCN3sSx6hsr/1+rlcDAotXJR7C1oZZHCNsfpbKwMjRA3Uqb5tF1Rae2oloTr4xpq+WjA==", + "dev": true, + "requires": { + "micromatch": "^2.1.5", + "normalize-path": "^2.0.0" + } + }, + "arr-diff": { + "version": "2.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/arr-diff/-/arr-diff-2.0.0.tgz", + "integrity": "sha1-jzuCf5Vai9ZpaX5KQlasPOrjVs8=", + "dev": true, + "requires": { + "arr-flatten": "^1.0.1" + } + }, + "array-unique": { + "version": "0.2.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/array-unique/-/array-unique-0.2.1.tgz", + "integrity": "sha1-odl8yvy8JiXMcPrc6zalDFiwGlM=", + "dev": true + }, + "braces": { + "version": "1.8.5", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/braces/-/braces-1.8.5.tgz", + "integrity": "sha1-uneWLhLf+WnWt2cR6RS3N4V79qc=", + "dev": true, + "requires": { + "expand-range": "^1.8.1", + "preserve": "^0.2.0", + "repeat-element": "^1.1.2" + } + }, + "chokidar": { + "version": "1.7.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/chokidar/-/chokidar-1.7.0.tgz", + "integrity": "sha1-eY5ol3gVHIB2tLNg5e3SjNortGg=", + "dev": true, + "requires": { + "anymatch": "^1.3.0", + "async-each": "^1.0.0", + "fsevents": "^1.0.0", + "glob-parent": "^2.0.0", + "inherits": "^2.0.1", + "is-binary-path": "^1.0.0", + "is-glob": "^2.0.0", + "path-is-absolute": "^1.0.0", + "readdirp": "^2.0.0" + } + }, + "expand-brackets": { + "version": "0.1.5", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/expand-brackets/-/expand-brackets-0.1.5.tgz", + "integrity": "sha1-3wcoTjQqgHzXM6xa9yQR5YHRF3s=", + "dev": true, + "requires": { + "is-posix-bracket": "^0.1.0" + } + }, + "extglob": { + "version": "0.3.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/extglob/-/extglob-0.3.2.tgz", + "integrity": "sha1-Lhj/PS9JqydlzskCPwEdqo2DSaE=", + "dev": true, + "requires": { + "is-extglob": "^1.0.0" + } + }, + "glob-parent": { + "version": "2.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/glob-parent/-/glob-parent-2.0.0.tgz", + "integrity": "sha1-gTg9ctsFT8zPUzbaqQLxgvbtuyg=", + "dev": true, + "requires": { + "is-glob": "^2.0.0" + } + }, + "is-extglob": { + "version": "1.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/is-extglob/-/is-extglob-1.0.0.tgz", + "integrity": "sha1-rEaBd8SUNAWgkvyPKXYMb/xiBsA=", + "dev": true + }, + "is-glob": { + "version": "2.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/is-glob/-/is-glob-2.0.1.tgz", + "integrity": "sha1-0Jb5JqPe1WAPP9/ZEZjLCIjC2GM=", + "dev": true, + "requires": { + "is-extglob": "^1.0.0" + } + }, + "kind-of": { + "version": "3.2.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true, + "requires": { + "is-buffer": "^1.1.5" + } + }, + "micromatch": { + "version": "2.3.11", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/micromatch/-/micromatch-2.3.11.tgz", + "integrity": "sha1-hmd8l9FyCzY0MdBNDRUpO9OMFWU=", + "dev": true, + "requires": { + "arr-diff": "^2.0.0", + "array-unique": "^0.2.1", + "braces": "^1.8.2", + "expand-brackets": "^0.1.4", + "extglob": "^0.3.1", + "filename-regex": "^2.0.0", + "is-extglob": "^1.0.0", + "is-glob": "^2.0.1", + "kind-of": "^3.0.2", + "normalize-path": "^2.0.1", + "object.omit": "^2.0.0", + "parse-glob": "^3.0.4", + "regex-cache": "^0.4.2" + } + } + } + }, + "@angular/core": { + "version": "6.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/@angular/core/-/core-6.1.0.tgz", + "integrity": "sha512-gWu9Q7q2+fhFC5dl/BvGW7Ha7NUJtK9wQLYQlfIMim4lKTOiM1/S0MYBVMrEq58ldMr9DnA35f5jGno3x6/v+g==", + "requires": { + "tslib": "^1.9.0" + } + }, + "@angular/forms": { + "version": "6.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/@angular/forms/-/forms-6.1.0.tgz", + "integrity": "sha512-6InfsKWEL9w2RvTXjy5R3F8GRjENT9d444o95aSvf+ZK7KsYOeIwcYgN2pw+LjfNu2O3EbAqps8APQ6oD/Fn3A==", + "requires": { + "tslib": "^1.9.0" + } + }, + "@angular/platform-browser": { + "version": "6.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/@angular/platform-browser/-/platform-browser-6.1.0.tgz", + "integrity": "sha512-LcpcHLpy+fjN+gKcnTkWuTTuF+uYT350mje1kNr4Advoco76tXYBjAda/EehG+vmQmDTd5E+uxJhKJr/1POVEw==", + "requires": { + "tslib": "^1.9.0" + } + }, + "@angular/platform-browser-dynamic": { + "version": "6.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/@angular/platform-browser-dynamic/-/platform-browser-dynamic-6.1.0.tgz", + "integrity": "sha512-gjOJ38ciuIgdAuG8bEs/sdJmkfm/oICLrCcQexz+EUCZAiqbKDb0HvFTDaKaLtR7iDbTXVMQhoYMOyTY40FwLQ==", + "requires": { + "tslib": "^1.9.0" + } + }, + "@angular/router": { + "version": "6.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/@angular/router/-/router-6.1.0.tgz", + "integrity": "sha512-tIcHLuat19cnoQBbOfe/8zAHVqf/9S17YgwSO6VUPTuXLRe9ZBgYT50BzqRhcm8ODOqVmLBQYlzP7zRcNRkHDA==", + "requires": { + "tslib": "^1.9.0" + } + }, + "@babel/code-frame": { + "version": "7.0.0-beta.46", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/@babel/code-frame/-/code-frame-7.0.0-beta.46.tgz", + "integrity": "sha512-7BKRkmYaPZm3Yff5HGZJKCz7RqZ5jUjknsXT6Gz5YKG23J3uq9hAj0epncCB0rlqmnZ8Q+UUpQB2tCR5mT37vw==", + "dev": true, + "requires": { + "@babel/highlight": "7.0.0-beta.46" + } + }, + "@babel/highlight": { + "version": "7.0.0-beta.46", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/@babel/highlight/-/highlight-7.0.0-beta.46.tgz", + "integrity": "sha512-r4snW6Q8ICL3Y8hGzYJRvyG/+sc+kvkewXNedG9tQjoHmUFMwMSv/o45GWQUQswevGnWghiGkpRPivFfOuMsOA==", + "dev": true, + "requires": { + "chalk": "^2.0.0", + "esutils": "^2.0.2", + "js-tokens": "^3.0.0" + }, + "dependencies": { + "ansi-styles": { + "version": "3.2.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, + "requires": { + "color-convert": "^1.9.0" + } + }, + "chalk": { + "version": "2.4.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/chalk/-/chalk-2.4.1.tgz", + "integrity": "sha512-ObN6h1v2fTJSmUXoS3nMQ92LbDK9be4TV+6G+omQlGJFdcUX5heKi1LZ1YnRMIgwTLEj3E24bT6tYni50rlCfQ==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + } + }, + "has-flag": { + "version": "3.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", + "dev": true + }, + "supports-color": { + "version": "5.5.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } + } + } + }, + "@fortawesome/angular-fontawesome": { + "version": "0.2.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/@fortawesome/angular-fontawesome/-/angular-fontawesome-0.2.0.tgz", + "integrity": "sha512-iBaH3ulJh+WjaNHqDxoKR6D4udgY+C7FChVSFOv0u7rjdT8wd0ap5YS1QHA82K0dfkUAvlEA4l5wtDtUpG679A==", + "requires": { + "tslib": "^1.9.0" + } + }, + "@fortawesome/fontawesome-common-types": { + "version": "0.2.4", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/@fortawesome/fontawesome-common-types/-/fontawesome-common-types-0.2.4.tgz", + "integrity": "sha512-0qbIVm+MzkxMwKDx8V0C7w/6Nk+ZfBseOn2R1YK0f2DQP5pBcOQbu9NmaVaLzbJK6VJb1TuyTf0ZF97rc6iWJQ==" + }, + "@fortawesome/fontawesome-svg-core": { + "version": "1.2.4", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/@fortawesome/fontawesome-svg-core/-/fontawesome-svg-core-1.2.4.tgz", + "integrity": "sha512-oGtnwcdhJomoDxbJcy6S0JxK6ItDhJLNOujm+qILPqajJ2a0P/YRomzBbixFjAPquCoyPUlA9g9ejA22P7TKNA==", + "requires": { + "@fortawesome/fontawesome-common-types": "^0.2.4" + } + }, + "@fortawesome/free-solid-svg-icons": { + "version": "5.3.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/@fortawesome/free-solid-svg-icons/-/free-solid-svg-icons-5.3.1.tgz", + "integrity": "sha512-NkiLBFoiHtJ89cPJdM+W6cLvTVKkLh3j9t3MxkXyip0ncdD3lhCunSuzvFcrTHWeETEyoClGd8ZIWrr3HFZ3BA==", + "requires": { + "@fortawesome/fontawesome-common-types": "^0.2.4" + } + }, + "@mrmlnc/readdir-enhanced": { + "version": "2.2.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/@mrmlnc/readdir-enhanced/-/readdir-enhanced-2.2.1.tgz", + "integrity": "sha512-bPHp6Ji8b41szTOcaP63VlnbbO5Ny6dwAATtY6JTjh5N2OLrb5Qk/Th5cRkRQhkWCt+EJsYrNB0MiL+Gpn6e3g==", + "dev": true, + "requires": { + "call-me-maybe": "^1.0.1", + "glob-to-regexp": "^0.3.0" + } + }, + "@ng-bootstrap/ng-bootstrap": { + "version": "3.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/@ng-bootstrap/ng-bootstrap/-/ng-bootstrap-3.0.0.tgz", + "integrity": "sha512-yYfqUORHc363ElX6C38hR4g9lFSOCXBVv3LTDNCyEz5go5kqSW8Tl5LDUlCxpswj02Wn14O1MunrnznZoSfYZA==", + "requires": { + "tslib": "^1.9.0" + } + }, + "@ngtools/webpack": { + "version": "6.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/@ngtools/webpack/-/webpack-6.0.0.tgz", + "integrity": "sha512-ULZnn1sFmVZ4o8LRWRk8BVnJzSpfjvpjTC2lsC/5DavPwpYLbMEdecwE5OIZhkXUr6QLZebPHEjlazesWHwqrA==", + "dev": true, + "requires": { + "@angular-devkit/core": "0.6.0", + "tree-kill": "^1.0.0", + "webpack-sources": "^1.1.0" + }, + "dependencies": { + "@angular-devkit/core": { + "version": "0.6.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/@angular-devkit/core/-/core-0.6.0.tgz", + "integrity": "sha512-hM1AOSF/+XZpv350pODPgoO/2QL61tfRlCXf3u4zHxkXdcboFKGCIi7VEu7TYMWSQzujcTFJciVBrgf/IfQ3cA==", + "dev": true, + "requires": { + "ajv": "~6.4.0", + "chokidar": "^2.0.3", + "rxjs": "^6.0.0", + "source-map": "^0.5.6" + } + } + } + }, + "@ngx-translate/core": { + "version": "10.0.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/@ngx-translate/core/-/core-10.0.2.tgz", + "integrity": "sha512-7nM3DrJaqKswwtJlbu2kuKNl+hE8Isr18sKsKvGGpSxQk+G0gO0reDlx2PhUNus7TJTkA1C59vU/JoN8hIvZ4g==", + "requires": { + "tslib": "^1.9.0" + } + }, + "@ngx-translate/http-loader": { + "version": "3.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/@ngx-translate/http-loader/-/http-loader-3.0.1.tgz", + "integrity": "sha1-ILD5i8bCUyESnT4zAqs8xInApCo=", + "requires": { + "tslib": "^1.9.0" + } + }, + "@nodelib/fs.stat": { + "version": "1.1.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/@nodelib/fs.stat/-/fs.stat-1.1.2.tgz", + "integrity": "sha512-yprFYuno9FtNsSHVlSWd+nRlmGoAbqbeCwOryP6sC/zoCjhpArcRMYp19EvpSUSizJAlsXEwJv+wcWS9XaXdMw==", + "dev": true + }, + "@samverschueren/stream-to-observable": { + "version": "0.3.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/@samverschueren/stream-to-observable/-/stream-to-observable-0.3.0.tgz", + "integrity": "sha512-MI4Xx6LHs4Webyvi6EbspgyAb4D2Q2VtnCQ1blOJcoLS6mVa8lNN2rkIy1CVxfTUpoyIbCTkXES1rLXztFD1lg==", + "dev": true, + "requires": { + "any-observable": "^0.3.0" + } + }, + "@schematics/angular": { + "version": "0.7.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/@schematics/angular/-/angular-0.7.2.tgz", + "integrity": "sha512-u92urZDC9qk/4gQliajrzxgrEz3ucvOtQ0eCzbRKU86AGWrz215hQJRmLRSDAdVy0frfc8Gg8IhdHSA2nZLgVw==", + "dev": true, + "requires": { + "@angular-devkit/core": "0.7.2", + "@angular-devkit/schematics": "0.7.2", + "typescript": ">=2.6.2 <2.8" + } + }, + "@schematics/update": { + "version": "0.7.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/@schematics/update/-/update-0.7.2.tgz", + "integrity": "sha512-YOnQhhYAAGjhWGCs7RUPKQD2G9Qg5gby4Dxa43vGP31xUcYFeYZCbU9MchnaxLPFi1NH4UEztkRFT4T3bn2d1A==", + "dev": true, + "requires": { + "@angular-devkit/core": "0.7.2", + "@angular-devkit/schematics": "0.7.2", + "npm-registry-client": "^8.5.1", + "rxjs": "^6.0.0", + "semver": "^5.3.0", + "semver-intersect": "^1.1.2" + } + }, + "@sindresorhus/is": { + "version": "0.7.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/@sindresorhus/is/-/is-0.7.0.tgz", + "integrity": "sha512-ONhaKPIufzzrlNbqtWFFd+jlnemX6lJAgq9ZeiZtS7I1PIf/la7CW4m83rTXRnVnsMbW2k56pGYu7AUFJD9Pow==", + "dev": true + }, + "@types/jest": { + "version": "22.2.3", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/@types/jest/-/jest-22.2.3.tgz", + "integrity": "sha512-e74sM9W/4qqWB6D4TWV9FQk0WoHtX1X4FJpbjxucMSVJHtFjbQOH3H6yp+xno4br0AKG0wz/kPtaN599GUOvAg==", + "dev": true + }, + "@types/node": { + "version": "9.4.7", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/@types/node/-/node-9.4.7.tgz", + "integrity": "sha512-4Ba90mWNx8ddbafuyGGwjkZMigi+AWfYLSDCpovwsE63ia8w93r3oJ8PIAQc3y8U+XHcnMOHPIzNe3o438Ywcw==", + "dev": true + }, + "@webassemblyjs/ast": { + "version": "1.3.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/@webassemblyjs/ast/-/ast-1.3.0.tgz", + "integrity": "sha512-IXMtAT2u6SEAHe8iZW+CdtC7K3xkBhvMp6RY3GQILXeXq9pLsgCwnVLEAO/pMkDCsoX/y83K12quA/CxGbuHew==", + "dev": true, + "requires": { + "@webassemblyjs/helper-wasm-bytecode": "1.3.0", + "@webassemblyjs/wast-parser": "1.3.0", + "webassemblyjs": "1.3.0" + } + }, + "@webassemblyjs/floating-point-hex-parser": { + "version": "1.3.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/@webassemblyjs/floating-point-hex-parser/-/floating-point-hex-parser-1.3.0.tgz", + "integrity": "sha512-Y746aq0AmT5cU8/tGEYAioVn7h8GGgVuQYRsXCB38u/rnE/TZhG38z+oXp+HaakubmXyXQ5IU+suZ7qnqANQgQ==", + "dev": true + }, + "@webassemblyjs/helper-buffer": { + "version": "1.3.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/@webassemblyjs/helper-buffer/-/helper-buffer-1.3.0.tgz", + "integrity": "sha512-3o+srBMOSS3VHQlxGONEBnw10rWPo7Mcbc4waq8bPZRy26JBw0fFHlBICIySWcvvO0K9rvGD6d2rJV6VzDp/Gg==", + "dev": true + }, + "@webassemblyjs/helper-code-frame": { + "version": "1.3.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/@webassemblyjs/helper-code-frame/-/helper-code-frame-1.3.0.tgz", + "integrity": "sha512-Sn5EhpGFtavLOgvOGQn9HMRiLxkgPHksTGbNcGuZbHvyx20DNO1VHGZYnvupavBqJPtjceS2YjQT2vN3piZwng==", + "dev": true, + "requires": { + "@webassemblyjs/wast-printer": "1.3.0" + } + }, + "@webassemblyjs/helper-fsm": { + "version": "1.3.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/@webassemblyjs/helper-fsm/-/helper-fsm-1.3.0.tgz", + "integrity": "sha512-Q5uchhiRmlZUFKOBcI+8+ri0eyAWyFPTwcVu9bDep3FsxkgugI5i+V52r1rZrgNjB3QFcYgAwLEeJQgBciW9dA==", + "dev": true + }, + "@webassemblyjs/helper-wasm-bytecode": { + "version": "1.3.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/@webassemblyjs/helper-wasm-bytecode/-/helper-wasm-bytecode-1.3.0.tgz", + "integrity": "sha512-DYJPE3OeHXi72Bc5eXqGhOPIo0usevsZltSsrrhlejw8F6c86tOeMJjBiVR4stiP4M3utnaXuTj+JuaXgeQo8g==", + "dev": true + }, + "@webassemblyjs/helper-wasm-section": { + "version": "1.3.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/@webassemblyjs/helper-wasm-section/-/helper-wasm-section-1.3.0.tgz", + "integrity": "sha512-1Vt839EyU7YLy40EXF19b9vaYdSeNDFWQHsY2BEOVePatbRaz2ytbVFP3lSjZDTBmOml3nbEdUzHC+XtObBKXg==", + "dev": true, + "requires": { + "@webassemblyjs/ast": "1.3.0", + "@webassemblyjs/helper-buffer": "1.3.0", + "@webassemblyjs/helper-wasm-bytecode": "1.3.0", + "@webassemblyjs/wasm-gen": "1.3.0" + } + }, + "@webassemblyjs/leb128": { + "version": "1.3.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/@webassemblyjs/leb128/-/leb128-1.3.0.tgz", + "integrity": "sha512-oR6WdUiw4Kpjt12swFy5A7Hy5PF33ojdsZbgScRuXSZEfgXVSIhFj5ZKD0UY4v22SJN/Q1ESpAuHnlGzQcljTg==", + "dev": true, + "requires": { + "leb": "^0.3.0" + } + }, + "@webassemblyjs/validation": { + "version": "1.3.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/@webassemblyjs/validation/-/validation-1.3.0.tgz", + "integrity": "sha512-CuBmcwCL6Th8oJBnfQfSvLWyIFcSYc2qyj68SeBtU1Zikg5rbuobLEqIRALfzLjJSJUO3SQtJ5GsjidRM0ezWQ==", + "dev": true, + "requires": { + "@webassemblyjs/ast": "1.3.0" + } + }, + "@webassemblyjs/wasm-edit": { + "version": "1.3.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/@webassemblyjs/wasm-edit/-/wasm-edit-1.3.0.tgz", + "integrity": "sha512-xfrnmh7WTxbc55FJmpJCqOvdctG1xZeetdasYLEbPfUP8AgoDovjkhpMRBJcQk6z6AOuldt93rkxbjt9fA+bjw==", + "dev": true, + "requires": { + "@webassemblyjs/ast": "1.3.0", + "@webassemblyjs/helper-buffer": "1.3.0", + "@webassemblyjs/helper-wasm-bytecode": "1.3.0", + "@webassemblyjs/helper-wasm-section": "1.3.0", + "@webassemblyjs/wasm-gen": "1.3.0", + "@webassemblyjs/wasm-opt": "1.3.0", + "@webassemblyjs/wasm-parser": "1.3.0", + "@webassemblyjs/wast-printer": "1.3.0", + "debug": "^3.1.0" + }, + "dependencies": { + "debug": { + "version": "3.2.6", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/debug/-/debug-3.2.6.tgz", + "integrity": "sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ==", + "dev": true, + "requires": { + "ms": "^2.1.1" + } + }, + "ms": { + "version": "2.1.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/ms/-/ms-2.1.1.tgz", + "integrity": "sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg==", + "dev": true + } + } + }, + "@webassemblyjs/wasm-gen": { + "version": "1.3.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/@webassemblyjs/wasm-gen/-/wasm-gen-1.3.0.tgz", + "integrity": "sha512-vvyJdznx82hqdjGVvQjQ1JMtD8Aokiu9OqaQRt62ywNyeBXNZH+Di3axq8725RFOtEYWuiMun6knfTVitVuTzg==", + "dev": true, + "requires": { + "@webassemblyjs/ast": "1.3.0", + "@webassemblyjs/helper-wasm-bytecode": "1.3.0", + "@webassemblyjs/leb128": "1.3.0" + } + }, + "@webassemblyjs/wasm-opt": { + "version": "1.3.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/@webassemblyjs/wasm-opt/-/wasm-opt-1.3.0.tgz", + "integrity": "sha512-uWtbbEDzsrv+jPbk8jzHyrmCcDMT8J3VmifEsLuD5bov6Q40GJwj/GMAtbH2kB28dvqWU0lIA+D5dUlJHMgAzQ==", + "dev": true, + "requires": { + "@webassemblyjs/ast": "1.3.0", + "@webassemblyjs/helper-buffer": "1.3.0", + "@webassemblyjs/wasm-gen": "1.3.0", + "@webassemblyjs/wasm-parser": "1.3.0" + } + }, + "@webassemblyjs/wasm-parser": { + "version": "1.3.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/@webassemblyjs/wasm-parser/-/wasm-parser-1.3.0.tgz", + "integrity": "sha512-eQxCJa2Ks0lZc/JwG0A0uzvOmbjklsVKtKI+M1qp73xbOgpotHFBioeskk9J8AlpNwB5Ofeslw98O5k4Wi8scg==", + "dev": true, + "requires": { + "@webassemblyjs/ast": "1.3.0", + "@webassemblyjs/helper-wasm-bytecode": "1.3.0", + "@webassemblyjs/leb128": "1.3.0", + "@webassemblyjs/wasm-parser": "1.3.0", + "webassemblyjs": "1.3.0" + } + }, + "@webassemblyjs/wast-parser": { + "version": "1.3.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/@webassemblyjs/wast-parser/-/wast-parser-1.3.0.tgz", + "integrity": "sha512-NJOsD4PKBCQXzKhX7zqoF6Bgmq4cbODKwusOsFw18dccHggTNEjx71WRKL1fplnECQp9s7ukxn4uadsDtY0q2g==", + "dev": true, + "requires": { + "@webassemblyjs/ast": "1.3.0", + "@webassemblyjs/floating-point-hex-parser": "1.3.0", + "@webassemblyjs/helper-code-frame": "1.3.0", + "@webassemblyjs/helper-fsm": "1.3.0", + "long": "^3.2.0", + "webassemblyjs": "1.3.0" + } + }, + "@webassemblyjs/wast-printer": { + "version": "1.3.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/@webassemblyjs/wast-printer/-/wast-printer-1.3.0.tgz", + "integrity": "sha512-K7iOU1PY2fPviDwZU7f0i/75r2baXlJR3VYXEpwQp608tQiYJY6/4Uji9kJ7FKsf+gqZSop2umCK0nhuDrU7/w==", + "dev": true, + "requires": { + "@webassemblyjs/ast": "1.3.0", + "@webassemblyjs/wast-parser": "1.3.0", + "long": "^3.2.0" + } + }, + "@webpack-contrib/schema-utils": { + "version": "1.0.0-beta.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/@webpack-contrib/schema-utils/-/schema-utils-1.0.0-beta.0.tgz", + "integrity": "sha512-LonryJP+FxQQHsjGBi6W786TQB1Oym+agTpY0c+Kj8alnIw+DLUJb6SI8Y1GHGhLCH1yPRrucjObUmxNICQ1pg==", + "dev": true, + "requires": { + "ajv": "^6.1.0", + "ajv-keywords": "^3.1.0", + "chalk": "^2.3.2", + "strip-ansi": "^4.0.0", + "text-table": "^0.2.0", + "webpack-log": "^1.1.2" + }, + "dependencies": { + "ansi-regex": { + "version": "3.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/ansi-regex/-/ansi-regex-3.0.0.tgz", + "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", + "dev": true + }, + "ansi-styles": { + "version": "3.2.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, + "requires": { + "color-convert": "^1.9.0" + } + }, + "chalk": { + "version": "2.4.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/chalk/-/chalk-2.4.1.tgz", + "integrity": "sha512-ObN6h1v2fTJSmUXoS3nMQ92LbDK9be4TV+6G+omQlGJFdcUX5heKi1LZ1YnRMIgwTLEj3E24bT6tYni50rlCfQ==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + } + }, + "has-flag": { + "version": "3.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", + "dev": true + }, + "strip-ansi": { + "version": "4.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/strip-ansi/-/strip-ansi-4.0.0.tgz", + "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", + "dev": true, + "requires": { + "ansi-regex": "^3.0.0" + } + }, + "supports-color": { + "version": "5.5.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } + } + } + }, + "abab": { + "version": "1.0.4", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/abab/-/abab-1.0.4.tgz", + "integrity": "sha1-X6rZwsB/YN12dw9xzwJbYqY8/U4=", + "dev": true + }, + "accepts": { + "version": "1.3.5", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/accepts/-/accepts-1.3.5.tgz", + "integrity": "sha1-63d99gEXI6OxTopywIBcjoZ0a9I=", + "dev": true, + "requires": { + "mime-types": "~2.1.18", + "negotiator": "0.6.1" + } + }, + "acorn": { + "version": "5.7.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/acorn/-/acorn-5.7.1.tgz", + "integrity": "sha512-d+nbxBUGKg7Arpsvbnlq61mc12ek3EY8EQldM3GPAhWJ1UVxC6TDGbIvUMNU6obBX3i1+ptCIzV4vq0gFPEGVQ==", + "dev": true + }, + "acorn-dynamic-import": { + "version": "3.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/acorn-dynamic-import/-/acorn-dynamic-import-3.0.0.tgz", + "integrity": "sha512-zVWV8Z8lislJoOKKqdNMOB+s6+XV5WERty8MnKBeFgwA+19XJjJHs2RP5dzM57FftIs+jQnRToLiWazKr6sSWg==", + "dev": true, + "requires": { + "acorn": "^5.0.0" + } + }, + "acorn-globals": { + "version": "4.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/acorn-globals/-/acorn-globals-4.1.0.tgz", + "integrity": "sha512-KjZwU26uG3u6eZcfGbTULzFcsoz6pegNKtHPksZPOUsiKo5bUmiBPa38FuHZ/Eun+XYh/JCCkS9AS3Lu4McQOQ==", + "dev": true, + "requires": { + "acorn": "^5.0.0" + } + }, + "after": { + "version": "0.8.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/after/-/after-0.8.2.tgz", + "integrity": "sha1-/ts5T58OAqqXaOcCvaI7UF+ufh8=", + "dev": true + }, + "ajv": { + "version": "6.4.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/ajv/-/ajv-6.4.0.tgz", + "integrity": "sha1-06/3jpJ3VJdx2vAWTP9ISCt1T8Y=", + "dev": true, + "requires": { + "fast-deep-equal": "^1.0.0", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.3.0", + "uri-js": "^3.0.2" + } + }, + "ajv-errors": { + "version": "1.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/ajv-errors/-/ajv-errors-1.0.0.tgz", + "integrity": "sha1-7PAh+hCP0X37Xms4Py3SM+Mf/Fk=", + "dev": true + }, + "ajv-keywords": { + "version": "3.2.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/ajv-keywords/-/ajv-keywords-3.2.0.tgz", + "integrity": "sha1-6GuBnGAs+IIa1jdBNpjx3sAhhHo=", + "dev": true + }, + "align-text": { + "version": "0.1.4", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/align-text/-/align-text-0.1.4.tgz", + "integrity": "sha1-DNkKVhCT810KmSVsIrcGlDP60Rc=", + "dev": true, + "requires": { + "kind-of": "^3.0.2", + "longest": "^1.0.1", + "repeat-string": "^1.5.2" + }, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true, + "requires": { + "is-buffer": "^1.1.5" + } + } + } + }, + "alphanum-sort": { + "version": "1.0.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/alphanum-sort/-/alphanum-sort-1.0.2.tgz", + "integrity": "sha1-l6ERlkmyEa0zaR2fn0hqjsn74KM=", + "dev": true + }, + "amdefine": { + "version": "1.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/amdefine/-/amdefine-1.0.1.tgz", + "integrity": "sha1-SlKCrBZHKek2Gbz9OtFR+BfOkfU=", + "dev": true + }, + "angular-router-loader": { + "version": "0.8.5", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/angular-router-loader/-/angular-router-loader-0.8.5.tgz", + "integrity": "sha512-8wggCTKGgzB1o8co3Wvj+p9pKN7T7q3C477lEz3NLjvPVzUti8rv9i45Di+4aO/k+HvzGh3s8QdNlXU2Bl4avQ==", + "dev": true, + "requires": { + "loader-utils": "^1.0.2" + } + }, + "angular2-template-loader": { + "version": "0.6.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/angular2-template-loader/-/angular2-template-loader-0.6.2.tgz", + "integrity": "sha1-wNROkP/w+sleiyPwQ6zaf9HFHXw=", + "dev": true, + "requires": { + "loader-utils": "^0.2.15" + }, + "dependencies": { + "loader-utils": { + "version": "0.2.17", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/loader-utils/-/loader-utils-0.2.17.tgz", + "integrity": "sha1-+G5jdNQyBabmxg6RlvF8Apm/s0g=", + "dev": true, + "requires": { + "big.js": "^3.1.3", + "emojis-list": "^2.0.0", + "json5": "^0.5.0", + "object-assign": "^4.0.1" + } + } + } + }, + "ansi": { + "version": "0.3.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/ansi/-/ansi-0.3.1.tgz", + "integrity": "sha1-DELU+xcWDVqa8eSEus4cZpIsGyE=", + "dev": true + }, + "ansi-cyan": { + "version": "0.1.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/ansi-cyan/-/ansi-cyan-0.1.1.tgz", + "integrity": "sha1-U4rlKK+JgvKK4w2G8vF0VtJgmHM=", + "dev": true, + "requires": { + "ansi-wrap": "0.1.0" + } + }, + "ansi-escapes": { + "version": "3.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/ansi-escapes/-/ansi-escapes-3.1.0.tgz", + "integrity": "sha512-UgAb8H9D41AQnu/PbWlCofQVcnV4Gs2bBJi9eZPxfU/hgglFh3SMDMENRIqdr7H6XFnXdoknctFByVsCOotTVw==", + "dev": true + }, + "ansi-html": { + "version": "0.0.7", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/ansi-html/-/ansi-html-0.0.7.tgz", + "integrity": "sha1-gTWEAhliqenm/QOflA0S9WynhZ4=", + "dev": true + }, + "ansi-red": { + "version": "0.1.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/ansi-red/-/ansi-red-0.1.1.tgz", + "integrity": "sha1-jGOPnRCAgAo1PJwoyKgcpHBdlGw=", + "dev": true, + "requires": { + "ansi-wrap": "0.1.0" + } + }, + "ansi-regex": { + "version": "2.1.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/ansi-regex/-/ansi-regex-2.1.1.tgz", + "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=", + "dev": true + }, + "ansi-styles": { + "version": "2.2.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/ansi-styles/-/ansi-styles-2.2.1.tgz", + "integrity": "sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4=", + "dev": true + }, + "ansi-wrap": { + "version": "0.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/ansi-wrap/-/ansi-wrap-0.1.0.tgz", + "integrity": "sha1-qCJQ3bABXponyoLoLqYDu/pF768=", + "dev": true + }, + "any-observable": { + "version": "0.3.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/any-observable/-/any-observable-0.3.0.tgz", + "integrity": "sha512-/FQM1EDkTsf63Ub2C6O7GuYFDsSXUwsaZDurV0np41ocwq0jthUAYCmhBX9f+KwlaCgIuWyr/4WlUQUBfKfZog==", + "dev": true + }, + "anymatch": { + "version": "2.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/anymatch/-/anymatch-2.0.0.tgz", + "integrity": "sha512-5teOsQWABXHHBFP9y3skS5P3d/WfWXpv3FUpy+LorMrNYaT9pI4oLMQX7jzQ2KklNpGpWHzdCXTDT2Y3XGlZBw==", + "dev": true, + "requires": { + "micromatch": "^3.1.4", + "normalize-path": "^2.1.1" + } + }, + "app-root-path": { + "version": "2.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/app-root-path/-/app-root-path-2.0.1.tgz", + "integrity": "sha1-zWLc+OT9WkF+/GZNLlsQZTxlG0Y=", + "dev": true + }, + "append-transform": { + "version": "1.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/append-transform/-/append-transform-1.0.0.tgz", + "integrity": "sha512-P009oYkeHyU742iSZJzZZywj4QRJdnTWffaKuJQLablCZ1uz6/cW4yaRgcDaoQ+uwOxxnt0gRUcwfsNP2ri0gw==", + "dev": true, + "requires": { + "default-require-extensions": "^2.0.0" + } + }, + "aproba": { + "version": "1.2.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/aproba/-/aproba-1.2.0.tgz", + "integrity": "sha512-Y9J6ZjXtoYh8RnXVCMOU/ttDmk1aBjunq9vO0ta5x85WDQiQfUF9sIPBITdbiiIVcBo03Hi3jMxigBtsddlXRw==", + "dev": true + }, + "are-we-there-yet": { + "version": "1.1.5", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/are-we-there-yet/-/are-we-there-yet-1.1.5.tgz", + "integrity": "sha512-5hYdAkZlcG8tOLujVDTgCT+uPX0VnpAH28gWsLfzpXYm7wP6mp5Q/gYyR7YQ0cKVJcXJnl3j2kpBan13PtQf6w==", + "dev": true, + "requires": { + "delegates": "^1.0.0", + "readable-stream": "^2.0.6" + } + }, + "argparse": { + "version": "1.0.10", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/argparse/-/argparse-1.0.10.tgz", + "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", + "dev": true, + "requires": { + "sprintf-js": "~1.0.2" + }, + "dependencies": { + "sprintf-js": { + "version": "1.0.3", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/sprintf-js/-/sprintf-js-1.0.3.tgz", + "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=", + "dev": true + } + } + }, + "arr-diff": { + "version": "4.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/arr-diff/-/arr-diff-4.0.0.tgz", + "integrity": "sha1-1kYQdP6/7HHn4VI1dhoyml3HxSA=", + "dev": true + }, + "arr-flatten": { + "version": "1.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/arr-flatten/-/arr-flatten-1.1.0.tgz", + "integrity": "sha512-L3hKV5R/p5o81R7O02IGnwpDmkp6E982XhtbuwSe3O4qOtMMMtodicASA1Cny2U+aCXcNpml+m4dPsvsJ3jatg==", + "dev": true + }, + "arr-union": { + "version": "3.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/arr-union/-/arr-union-3.1.0.tgz", + "integrity": "sha1-45sJrqne+Gao8gbiiK9jkZuuOcQ=", + "dev": true + }, + "array-differ": { + "version": "1.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/array-differ/-/array-differ-1.0.0.tgz", + "integrity": "sha1-7/UuN1gknTO+QCuLuOVkuytdQDE=", + "dev": true + }, + "array-equal": { + "version": "1.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/array-equal/-/array-equal-1.0.0.tgz", + "integrity": "sha1-jCpe8kcv2ep0KwTHenUJO6J1fJM=", + "dev": true + }, + "array-filter": { + "version": "0.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/array-filter/-/array-filter-0.0.1.tgz", + "integrity": "sha1-fajPLiZijtcygDWB/SH2fKzS7uw=", + "dev": true + }, + "array-find-index": { + "version": "1.0.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/array-find-index/-/array-find-index-1.0.2.tgz", + "integrity": "sha1-3wEKoSh+Fku9pvlyOwqWoexBh6E=", + "dev": true + }, + "array-flatten": { + "version": "2.1.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/array-flatten/-/array-flatten-2.1.1.tgz", + "integrity": "sha1-Qmu52oQJDBg42BLIFQryCoMx4pY=", + "dev": true + }, + "array-includes": { + "version": "3.0.3", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/array-includes/-/array-includes-3.0.3.tgz", + "integrity": "sha1-GEtI9i2S10UrsxsyMWXH+L0CJm0=", + "dev": true, + "requires": { + "define-properties": "^1.1.2", + "es-abstract": "^1.7.0" + } + }, + "array-map": { + "version": "0.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/array-map/-/array-map-0.0.0.tgz", + "integrity": "sha1-iKK6tz0c97zVwbEYoAP2b2ZfpmI=", + "dev": true + }, + "array-reduce": { + "version": "0.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/array-reduce/-/array-reduce-0.0.0.tgz", + "integrity": "sha1-FziZ0//Rx9k4PkR5Ul2+J4yrXys=", + "dev": true + }, + "array-slice": { + "version": "0.2.3", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/array-slice/-/array-slice-0.2.3.tgz", + "integrity": "sha1-3Tz7gO15c6dRF82sabC5nshhhvU=", + "dev": true + }, + "array-union": { + "version": "1.0.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/array-union/-/array-union-1.0.2.tgz", + "integrity": "sha1-mjRBDk9OPaI96jdb5b5w8kd47Dk=", + "dev": true, + "requires": { + "array-uniq": "^1.0.1" + } + }, + "array-uniq": { + "version": "1.0.3", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/array-uniq/-/array-uniq-1.0.3.tgz", + "integrity": "sha1-r2rId6Jcx/dOBYiUdThY39sk/bY=", + "dev": true + }, + "array-unique": { + "version": "0.3.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/array-unique/-/array-unique-0.3.2.tgz", + "integrity": "sha1-qJS3XUvE9s1nnvMkSp/Y9Gri1Cg=", + "dev": true + }, + "arraybuffer.slice": { + "version": "0.0.7", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/arraybuffer.slice/-/arraybuffer.slice-0.0.7.tgz", + "integrity": "sha512-wGUIVQXuehL5TCqQun8OW81jGzAWycqzFF8lFp+GOM5BXLYj3bKNsYC4daB7n6XjCqxQA/qgTJ+8ANR3acjrog==", + "dev": true + }, + "arrify": { + "version": "1.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/arrify/-/arrify-1.0.1.tgz", + "integrity": "sha1-iYUI2iIm84DfkEcoRWhJwVAaSw0=", + "dev": true + }, + "asap": { + "version": "2.0.6", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/asap/-/asap-2.0.6.tgz", + "integrity": "sha1-5QNHYR1+aQlDIIu9r+vLwvuGbUY=", + "dev": true + }, + "asn1": { + "version": "0.2.4", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/asn1/-/asn1-0.2.4.tgz", + "integrity": "sha512-jxwzQpLQjSmWXgwaCZE9Nz+glAG01yF1QnWgbhGwHI5A6FRIEY6IVqtHhIepHqI7/kyEyQEagBC5mBEFlIYvdg==", + "dev": true, + "requires": { + "safer-buffer": "~2.1.0" + } + }, + "asn1.js": { + "version": "4.10.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/asn1.js/-/asn1.js-4.10.1.tgz", + "integrity": "sha512-p32cOF5q0Zqs9uBiONKYLm6BClCoBCM5O9JfeUSlnQLBTxYdTK+pW+nXflm8UkKd2UYlEbYz5qEi0JuZR9ckSw==", + "dev": true, + "requires": { + "bn.js": "^4.0.0", + "inherits": "^2.0.1", + "minimalistic-assert": "^1.0.0" + } + }, + "assert": { + "version": "1.4.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/assert/-/assert-1.4.1.tgz", + "integrity": "sha1-mZEtWRg2tab1s0XA8H7vwI/GXZE=", + "dev": true, + "requires": { + "util": "0.10.3" + }, + "dependencies": { + "inherits": { + "version": "2.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/inherits/-/inherits-2.0.1.tgz", + "integrity": "sha1-sX0I0ya0Qj5Wjv9xn5GwscvfafE=", + "dev": true + }, + "util": { + "version": "0.10.3", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/util/-/util-0.10.3.tgz", + "integrity": "sha1-evsa/lCAUkZInj23/g7TeTNqwPk=", + "dev": true, + "requires": { + "inherits": "2.0.1" + } + } + } + }, + "assert-plus": { + "version": "1.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/assert-plus/-/assert-plus-1.0.0.tgz", + "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=", + "dev": true + }, + "assign-symbols": { + "version": "1.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/assign-symbols/-/assign-symbols-1.0.0.tgz", + "integrity": "sha1-WWZ/QfrdTyDMvCu5a41Pf3jsA2c=", + "dev": true + }, + "ast-types": { + "version": "0.9.6", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/ast-types/-/ast-types-0.9.6.tgz", + "integrity": "sha1-ECyenpAF0+fjgpvwxPok7oYu6bk=", + "dev": true + }, + "astral-regex": { + "version": "1.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/astral-regex/-/astral-regex-1.0.0.tgz", + "integrity": "sha512-+Ryf6g3BKoRc7jfp7ad8tM4TtMiaWvbF/1/sQcZPkkS7ag3D5nMBCe2UfOTONtAkaG0tO0ij3C5Lwmf1EiyjHg==", + "dev": true + }, + "async": { + "version": "1.5.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/async/-/async-1.5.2.tgz", + "integrity": "sha1-7GphrlZIDAw8skHJVhjiCJL5Zyo=", + "dev": true + }, + "async-each": { + "version": "1.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/async-each/-/async-each-1.0.1.tgz", + "integrity": "sha1-GdOGodntxufByF04iu28xW0zYC0=", + "dev": true + }, + "async-each-series": { + "version": "0.1.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/async-each-series/-/async-each-series-0.1.1.tgz", + "integrity": "sha1-dhfBkXQB/Yykooqtzj266Yr+tDI=", + "dev": true + }, + "async-limiter": { + "version": "1.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/async-limiter/-/async-limiter-1.0.0.tgz", + "integrity": "sha512-jp/uFnooOiO+L211eZOoSyzpOITMXx1rBITauYykG3BRYPu8h0UcxsPNB04RR5vo4Tyz3+ay17tR6JVf9qzYWg==", + "dev": true + }, + "asynckit": { + "version": "0.4.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/asynckit/-/asynckit-0.4.0.tgz", + "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=", + "dev": true + }, + "atob": { + "version": "2.1.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/atob/-/atob-2.1.2.tgz", + "integrity": "sha512-Wm6ukoaOGJi/73p/cl2GvLjTI5JM1k/O14isD73YML8StrH/7/lRFgmg8nICZgD3bZZvjwCGxtMOD3wWNAu8cg==", + "dev": true + }, + "autoprefixer": { + "version": "6.7.7", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/autoprefixer/-/autoprefixer-6.7.7.tgz", + "integrity": "sha1-Hb0cg1ZY41zj+ZhAmdsAWFx4IBQ=", + "dev": true, + "requires": { + "browserslist": "^1.7.6", + "caniuse-db": "^1.0.30000634", + "normalize-range": "^0.1.2", + "num2fraction": "^1.2.2", + "postcss": "^5.2.16", + "postcss-value-parser": "^3.2.3" + } + }, + "aws-sign2": { + "version": "0.7.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/aws-sign2/-/aws-sign2-0.7.0.tgz", + "integrity": "sha1-tG6JCTSpWR8tL2+G1+ap8bP+dqg=", + "dev": true + }, + "aws4": { + "version": "1.8.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/aws4/-/aws4-1.8.0.tgz", + "integrity": "sha512-ReZxvNHIOv88FlT7rxcXIIC0fPt4KZqZbOlivyWtXLt8ESx84zd3kMC6iK5jVeS2qt+g7ftS7ye4fi06X5rtRQ==", + "dev": true + }, + "axios": { + "version": "0.17.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/axios/-/axios-0.17.1.tgz", + "integrity": "sha1-LY4+XQvb1zJ/kbyBT1xXZg+Bgk0=", + "dev": true, + "requires": { + "follow-redirects": "^1.2.5", + "is-buffer": "^1.1.5" + } + }, + "babel-code-frame": { + "version": "6.26.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/babel-code-frame/-/babel-code-frame-6.26.0.tgz", + "integrity": "sha1-Y/1D99weO7fONZR9uP42mj9Yx0s=", + "dev": true, + "requires": { + "chalk": "^1.1.3", + "esutils": "^2.0.2", + "js-tokens": "^3.0.2" + } + }, + "babel-core": { + "version": "6.26.3", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/babel-core/-/babel-core-6.26.3.tgz", + "integrity": "sha512-6jyFLuDmeidKmUEb3NM+/yawG0M2bDZ9Z1qbZP59cyHLz8kYGKYwpJP0UwUKKUiTRNvxfLesJnTedqczP7cTDA==", + "dev": true, + "requires": { + "babel-code-frame": "^6.26.0", + "babel-generator": "^6.26.0", + "babel-helpers": "^6.24.1", + "babel-messages": "^6.23.0", + "babel-register": "^6.26.0", + "babel-runtime": "^6.26.0", + "babel-template": "^6.26.0", + "babel-traverse": "^6.26.0", + "babel-types": "^6.26.0", + "babylon": "^6.18.0", + "convert-source-map": "^1.5.1", + "debug": "^2.6.9", + "json5": "^0.5.1", + "lodash": "^4.17.4", + "minimatch": "^3.0.4", + "path-is-absolute": "^1.0.1", + "private": "^0.1.8", + "slash": "^1.0.0", + "source-map": "^0.5.7" + }, + "dependencies": { + "lodash": { + "version": "4.17.11", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/lodash/-/lodash-4.17.11.tgz", + "integrity": "sha512-cQKh8igo5QUhZ7lg38DYWAxMvjSAKG0A8wGSVimP07SIUEK2UO+arSRKbRZWtelMtN5V0Hkwh5ryOto/SshYIg==", + "dev": true + } + } + }, + "babel-extract-comments": { + "version": "1.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/babel-extract-comments/-/babel-extract-comments-1.0.0.tgz", + "integrity": "sha512-qWWzi4TlddohA91bFwgt6zO/J0X+io7Qp184Fw0m2JYRSTZnJbFR8+07KmzudHCZgOiKRCrjhylwv9Xd8gfhVQ==", + "dev": true, + "requires": { + "babylon": "^6.18.0" + } + }, + "babel-generator": { + "version": "6.26.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/babel-generator/-/babel-generator-6.26.1.tgz", + "integrity": "sha512-HyfwY6ApZj7BYTcJURpM5tznulaBvyio7/0d4zFOeMPUmfxkCjHocCuoLa2SAGzBI8AREcH3eP3758F672DppA==", + "dev": true, + "requires": { + "babel-messages": "^6.23.0", + "babel-runtime": "^6.26.0", + "babel-types": "^6.26.0", + "detect-indent": "^4.0.0", + "jsesc": "^1.3.0", + "lodash": "^4.17.4", + "source-map": "^0.5.7", + "trim-right": "^1.0.1" + }, + "dependencies": { + "jsesc": { + "version": "1.3.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/jsesc/-/jsesc-1.3.0.tgz", + "integrity": "sha1-RsP+yMGJKxKwgz25vHYiF226s0s=", + "dev": true + }, + "lodash": { + "version": "4.17.11", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/lodash/-/lodash-4.17.11.tgz", + "integrity": "sha512-cQKh8igo5QUhZ7lg38DYWAxMvjSAKG0A8wGSVimP07SIUEK2UO+arSRKbRZWtelMtN5V0Hkwh5ryOto/SshYIg==", + "dev": true + } + } + }, + "babel-helper-bindify-decorators": { + "version": "6.24.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/babel-helper-bindify-decorators/-/babel-helper-bindify-decorators-6.24.1.tgz", + "integrity": "sha1-FMGeXxQte0fxmlJDHlKxzLxAozA=", + "dev": true, + "requires": { + "babel-runtime": "^6.22.0", + "babel-traverse": "^6.24.1", + "babel-types": "^6.24.1" + } + }, + "babel-helper-builder-binary-assignment-operator-visitor": { + "version": "6.24.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/babel-helper-builder-binary-assignment-operator-visitor/-/babel-helper-builder-binary-assignment-operator-visitor-6.24.1.tgz", + "integrity": "sha1-zORReto1b0IgvK6KAsKzRvmlZmQ=", + "dev": true, + "requires": { + "babel-helper-explode-assignable-expression": "^6.24.1", + "babel-runtime": "^6.22.0", + "babel-types": "^6.24.1" + } + }, + "babel-helper-call-delegate": { + "version": "6.24.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/babel-helper-call-delegate/-/babel-helper-call-delegate-6.24.1.tgz", + "integrity": "sha1-7Oaqzdx25Bw0YfiL/Fdb0Nqi340=", + "dev": true, + "requires": { + "babel-helper-hoist-variables": "^6.24.1", + "babel-runtime": "^6.22.0", + "babel-traverse": "^6.24.1", + "babel-types": "^6.24.1" + } + }, + "babel-helper-define-map": { + "version": "6.26.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/babel-helper-define-map/-/babel-helper-define-map-6.26.0.tgz", + "integrity": "sha1-pfVtq0GiX5fstJjH66ypgZ+Vvl8=", + "dev": true, + "requires": { + "babel-helper-function-name": "^6.24.1", + "babel-runtime": "^6.26.0", + "babel-types": "^6.26.0", + "lodash": "^4.17.4" + }, + "dependencies": { + "lodash": { + "version": "4.17.11", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/lodash/-/lodash-4.17.11.tgz", + "integrity": "sha512-cQKh8igo5QUhZ7lg38DYWAxMvjSAKG0A8wGSVimP07SIUEK2UO+arSRKbRZWtelMtN5V0Hkwh5ryOto/SshYIg==", + "dev": true + } + } + }, + "babel-helper-explode-assignable-expression": { + "version": "6.24.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/babel-helper-explode-assignable-expression/-/babel-helper-explode-assignable-expression-6.24.1.tgz", + "integrity": "sha1-8luCz33BBDPFX3BZLVdGQArCLKo=", + "dev": true, + "requires": { + "babel-runtime": "^6.22.0", + "babel-traverse": "^6.24.1", + "babel-types": "^6.24.1" + } + }, + "babel-helper-explode-class": { + "version": "6.24.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/babel-helper-explode-class/-/babel-helper-explode-class-6.24.1.tgz", + "integrity": "sha1-fcKjkQ3uAHBW4eMdZAztPVTqqes=", + "dev": true, + "requires": { + "babel-helper-bindify-decorators": "^6.24.1", + "babel-runtime": "^6.22.0", + "babel-traverse": "^6.24.1", + "babel-types": "^6.24.1" + } + }, + "babel-helper-function-name": { + "version": "6.24.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/babel-helper-function-name/-/babel-helper-function-name-6.24.1.tgz", + "integrity": "sha1-00dbjAPtmCQqJbSDUasYOZ01gKk=", + "dev": true, + "requires": { + "babel-helper-get-function-arity": "^6.24.1", + "babel-runtime": "^6.22.0", + "babel-template": "^6.24.1", + "babel-traverse": "^6.24.1", + "babel-types": "^6.24.1" + } + }, + "babel-helper-get-function-arity": { + "version": "6.24.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/babel-helper-get-function-arity/-/babel-helper-get-function-arity-6.24.1.tgz", + "integrity": "sha1-j3eCqpNAfEHTqlCQj4mwMbG2hT0=", + "dev": true, + "requires": { + "babel-runtime": "^6.22.0", + "babel-types": "^6.24.1" + } + }, + "babel-helper-hoist-variables": { + "version": "6.24.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/babel-helper-hoist-variables/-/babel-helper-hoist-variables-6.24.1.tgz", + "integrity": "sha1-HssnaJydJVE+rbyZFKc/VAi+enY=", + "dev": true, + "requires": { + "babel-runtime": "^6.22.0", + "babel-types": "^6.24.1" + } + }, + "babel-helper-optimise-call-expression": { + "version": "6.24.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/babel-helper-optimise-call-expression/-/babel-helper-optimise-call-expression-6.24.1.tgz", + "integrity": "sha1-96E0J7qfc/j0+pk8VKl4gtEkQlc=", + "dev": true, + "requires": { + "babel-runtime": "^6.22.0", + "babel-types": "^6.24.1" + } + }, + "babel-helper-regex": { + "version": "6.26.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/babel-helper-regex/-/babel-helper-regex-6.26.0.tgz", + "integrity": "sha1-MlxZ+QL4LyS3T6zu0DY5VPZJXnI=", + "dev": true, + "requires": { + "babel-runtime": "^6.26.0", + "babel-types": "^6.26.0", + "lodash": "^4.17.4" + }, + "dependencies": { + "lodash": { + "version": "4.17.11", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/lodash/-/lodash-4.17.11.tgz", + "integrity": "sha512-cQKh8igo5QUhZ7lg38DYWAxMvjSAKG0A8wGSVimP07SIUEK2UO+arSRKbRZWtelMtN5V0Hkwh5ryOto/SshYIg==", + "dev": true + } + } + }, + "babel-helper-remap-async-to-generator": { + "version": "6.24.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/babel-helper-remap-async-to-generator/-/babel-helper-remap-async-to-generator-6.24.1.tgz", + "integrity": "sha1-XsWBgnrXI/7N04HxySg5BnbkVRs=", + "dev": true, + "requires": { + "babel-helper-function-name": "^6.24.1", + "babel-runtime": "^6.22.0", + "babel-template": "^6.24.1", + "babel-traverse": "^6.24.1", + "babel-types": "^6.24.1" + } + }, + "babel-helper-replace-supers": { + "version": "6.24.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/babel-helper-replace-supers/-/babel-helper-replace-supers-6.24.1.tgz", + "integrity": "sha1-v22/5Dk40XNpohPKiov3S2qQqxo=", + "dev": true, + "requires": { + "babel-helper-optimise-call-expression": "^6.24.1", + "babel-messages": "^6.23.0", + "babel-runtime": "^6.22.0", + "babel-template": "^6.24.1", + "babel-traverse": "^6.24.1", + "babel-types": "^6.24.1" + } + }, + "babel-helpers": { + "version": "6.24.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/babel-helpers/-/babel-helpers-6.24.1.tgz", + "integrity": "sha1-NHHenK7DiOXIUOWX5Yom3fN2ArI=", + "dev": true, + "requires": { + "babel-runtime": "^6.22.0", + "babel-template": "^6.24.1" + } + }, + "babel-jest": { + "version": "22.4.3", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/babel-jest/-/babel-jest-22.4.3.tgz", + "integrity": "sha512-BgSjmtl3mW3i+VeVHEr9d2zFSAT66G++pJcHQiUjd00pkW+voYXFctIm/indcqOWWXw5a1nUpR1XWszD9fJ1qg==", + "dev": true, + "requires": { + "babel-plugin-istanbul": "^4.1.5", + "babel-preset-jest": "^22.4.3" + } + }, + "babel-messages": { + "version": "6.23.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/babel-messages/-/babel-messages-6.23.0.tgz", + "integrity": "sha1-8830cDhYA1sqKVHG7F7fbGLyYw4=", + "dev": true, + "requires": { + "babel-runtime": "^6.22.0" + } + }, + "babel-plugin-check-es2015-constants": { + "version": "6.22.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/babel-plugin-check-es2015-constants/-/babel-plugin-check-es2015-constants-6.22.0.tgz", + "integrity": "sha1-NRV7EBQm/S/9PaP3XH0ekYNbv4o=", + "dev": true, + "requires": { + "babel-runtime": "^6.22.0" + } + }, + "babel-plugin-istanbul": { + "version": "4.1.6", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/babel-plugin-istanbul/-/babel-plugin-istanbul-4.1.6.tgz", + "integrity": "sha512-PWP9FQ1AhZhS01T/4qLSKoHGY/xvkZdVBGlKM/HuxxS3+sC66HhTNR7+MpbO/so/cz/wY94MeSWJuP1hXIPfwQ==", + "dev": true, + "requires": { + "babel-plugin-syntax-object-rest-spread": "^6.13.0", + "find-up": "^2.1.0", + "istanbul-lib-instrument": "^1.10.1", + "test-exclude": "^4.2.1" + }, + "dependencies": { + "find-up": { + "version": "2.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/find-up/-/find-up-2.1.0.tgz", + "integrity": "sha1-RdG35QbHF93UgndaK3eSCjwMV6c=", + "dev": true, + "requires": { + "locate-path": "^2.0.0" + } + } + } + }, + "babel-plugin-jest-hoist": { + "version": "22.4.3", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/babel-plugin-jest-hoist/-/babel-plugin-jest-hoist-22.4.3.tgz", + "integrity": "sha512-zhvv4f6OTWy2bYevcJftwGCWXMFe7pqoz41IhMi4xna7xNsX5NygdagsrE0y6kkfuXq8UalwvPwKTyAxME2E/g==", + "dev": true + }, + "babel-plugin-syntax-async-functions": { + "version": "6.13.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/babel-plugin-syntax-async-functions/-/babel-plugin-syntax-async-functions-6.13.0.tgz", + "integrity": "sha1-ytnK0RkbWtY0vzCuCHI5HgZHvpU=", + "dev": true + }, + "babel-plugin-syntax-async-generators": { + "version": "6.13.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/babel-plugin-syntax-async-generators/-/babel-plugin-syntax-async-generators-6.13.0.tgz", + "integrity": "sha1-a8lj67FuzLrmuStZbrfzXDQqi5o=", + "dev": true + }, + "babel-plugin-syntax-class-constructor-call": { + "version": "6.18.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/babel-plugin-syntax-class-constructor-call/-/babel-plugin-syntax-class-constructor-call-6.18.0.tgz", + "integrity": "sha1-nLnTn+Q8hgC+yBRkVt3L1OGnZBY=", + "dev": true + }, + "babel-plugin-syntax-class-properties": { + "version": "6.13.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/babel-plugin-syntax-class-properties/-/babel-plugin-syntax-class-properties-6.13.0.tgz", + "integrity": "sha1-1+sjt5oxf4VDlixQW4J8fWysJ94=", + "dev": true + }, + "babel-plugin-syntax-decorators": { + "version": "6.13.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/babel-plugin-syntax-decorators/-/babel-plugin-syntax-decorators-6.13.0.tgz", + "integrity": "sha1-MSVjtNvePMgGzuPkFszurd0RrAs=", + "dev": true + }, + "babel-plugin-syntax-dynamic-import": { + "version": "6.18.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/babel-plugin-syntax-dynamic-import/-/babel-plugin-syntax-dynamic-import-6.18.0.tgz", + "integrity": "sha1-jWomIpyDdFqZgqRBBRVyyqF5sdo=", + "dev": true + }, + "babel-plugin-syntax-exponentiation-operator": { + "version": "6.13.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/babel-plugin-syntax-exponentiation-operator/-/babel-plugin-syntax-exponentiation-operator-6.13.0.tgz", + "integrity": "sha1-nufoM3KQ2pUoggGmpX9BcDF4MN4=", + "dev": true + }, + "babel-plugin-syntax-export-extensions": { + "version": "6.13.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/babel-plugin-syntax-export-extensions/-/babel-plugin-syntax-export-extensions-6.13.0.tgz", + "integrity": "sha1-cKFITw+QiaToStRLrDU8lbmxJyE=", + "dev": true + }, + "babel-plugin-syntax-flow": { + "version": "6.18.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/babel-plugin-syntax-flow/-/babel-plugin-syntax-flow-6.18.0.tgz", + "integrity": "sha1-TDqyCiryaqIM0lmVw5jE63AxDI0=", + "dev": true + }, + "babel-plugin-syntax-object-rest-spread": { + "version": "6.13.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/babel-plugin-syntax-object-rest-spread/-/babel-plugin-syntax-object-rest-spread-6.13.0.tgz", + "integrity": "sha1-/WU28rzhODb/o6VFjEkDpZe7O/U=", + "dev": true + }, + "babel-plugin-syntax-trailing-function-commas": { + "version": "6.22.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/babel-plugin-syntax-trailing-function-commas/-/babel-plugin-syntax-trailing-function-commas-6.22.0.tgz", + "integrity": "sha1-ugNgk3+NBuQBgKQ/4NVhb/9TLPM=", + "dev": true + }, + "babel-plugin-transform-async-generator-functions": { + "version": "6.24.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/babel-plugin-transform-async-generator-functions/-/babel-plugin-transform-async-generator-functions-6.24.1.tgz", + "integrity": "sha1-8FiQAUX9PpkHpt3yjaWfIVJYpds=", + "dev": true, + "requires": { + "babel-helper-remap-async-to-generator": "^6.24.1", + "babel-plugin-syntax-async-generators": "^6.5.0", + "babel-runtime": "^6.22.0" + } + }, + "babel-plugin-transform-async-to-generator": { + "version": "6.24.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/babel-plugin-transform-async-to-generator/-/babel-plugin-transform-async-to-generator-6.24.1.tgz", + "integrity": "sha1-ZTbjeK/2yx1VF6wOQOs+n8jQh2E=", + "dev": true, + "requires": { + "babel-helper-remap-async-to-generator": "^6.24.1", + "babel-plugin-syntax-async-functions": "^6.8.0", + "babel-runtime": "^6.22.0" + } + }, + "babel-plugin-transform-class-constructor-call": { + "version": "6.24.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/babel-plugin-transform-class-constructor-call/-/babel-plugin-transform-class-constructor-call-6.24.1.tgz", + "integrity": "sha1-gNwoVQWsBn3LjWxl4vbxGrd2Xvk=", + "dev": true, + "requires": { + "babel-plugin-syntax-class-constructor-call": "^6.18.0", + "babel-runtime": "^6.22.0", + "babel-template": "^6.24.1" + } + }, + "babel-plugin-transform-class-properties": { + "version": "6.24.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/babel-plugin-transform-class-properties/-/babel-plugin-transform-class-properties-6.24.1.tgz", + "integrity": "sha1-anl2PqYdM9NvN7YRqp3vgagbRqw=", + "dev": true, + "requires": { + "babel-helper-function-name": "^6.24.1", + "babel-plugin-syntax-class-properties": "^6.8.0", + "babel-runtime": "^6.22.0", + "babel-template": "^6.24.1" + } + }, + "babel-plugin-transform-decorators": { + "version": "6.24.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/babel-plugin-transform-decorators/-/babel-plugin-transform-decorators-6.24.1.tgz", + "integrity": "sha1-eIAT2PjGtSIr33s0Q5Df13Vp4k0=", + "dev": true, + "requires": { + "babel-helper-explode-class": "^6.24.1", + "babel-plugin-syntax-decorators": "^6.13.0", + "babel-runtime": "^6.22.0", + "babel-template": "^6.24.1", + "babel-types": "^6.24.1" + } + }, + "babel-plugin-transform-es2015-arrow-functions": { + "version": "6.22.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/babel-plugin-transform-es2015-arrow-functions/-/babel-plugin-transform-es2015-arrow-functions-6.22.0.tgz", + "integrity": "sha1-RSaSy3EdX3ncf4XkQM5BufJE0iE=", + "dev": true, + "requires": { + "babel-runtime": "^6.22.0" + } + }, + "babel-plugin-transform-es2015-block-scoped-functions": { + "version": "6.22.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/babel-plugin-transform-es2015-block-scoped-functions/-/babel-plugin-transform-es2015-block-scoped-functions-6.22.0.tgz", + "integrity": "sha1-u8UbSflk1wy42OC5ToICRs46YUE=", + "dev": true, + "requires": { + "babel-runtime": "^6.22.0" + } + }, + "babel-plugin-transform-es2015-block-scoping": { + "version": "6.26.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/babel-plugin-transform-es2015-block-scoping/-/babel-plugin-transform-es2015-block-scoping-6.26.0.tgz", + "integrity": "sha1-1w9SmcEwjQXBL0Y4E7CgnnOxiV8=", + "dev": true, + "requires": { + "babel-runtime": "^6.26.0", + "babel-template": "^6.26.0", + "babel-traverse": "^6.26.0", + "babel-types": "^6.26.0", + "lodash": "^4.17.4" + }, + "dependencies": { + "lodash": { + "version": "4.17.11", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/lodash/-/lodash-4.17.11.tgz", + "integrity": "sha512-cQKh8igo5QUhZ7lg38DYWAxMvjSAKG0A8wGSVimP07SIUEK2UO+arSRKbRZWtelMtN5V0Hkwh5ryOto/SshYIg==", + "dev": true + } + } + }, + "babel-plugin-transform-es2015-classes": { + "version": "6.24.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/babel-plugin-transform-es2015-classes/-/babel-plugin-transform-es2015-classes-6.24.1.tgz", + "integrity": "sha1-WkxYpQyclGHlZLSyo7+ryXolhNs=", + "dev": true, + "requires": { + "babel-helper-define-map": "^6.24.1", + "babel-helper-function-name": "^6.24.1", + "babel-helper-optimise-call-expression": "^6.24.1", + "babel-helper-replace-supers": "^6.24.1", + "babel-messages": "^6.23.0", + "babel-runtime": "^6.22.0", + "babel-template": "^6.24.1", + "babel-traverse": "^6.24.1", + "babel-types": "^6.24.1" + } + }, + "babel-plugin-transform-es2015-computed-properties": { + "version": "6.24.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/babel-plugin-transform-es2015-computed-properties/-/babel-plugin-transform-es2015-computed-properties-6.24.1.tgz", + "integrity": "sha1-b+Ko0WiV1WNPTNmZttNICjCBWbM=", + "dev": true, + "requires": { + "babel-runtime": "^6.22.0", + "babel-template": "^6.24.1" + } + }, + "babel-plugin-transform-es2015-destructuring": { + "version": "6.23.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/babel-plugin-transform-es2015-destructuring/-/babel-plugin-transform-es2015-destructuring-6.23.0.tgz", + "integrity": "sha1-mXux8auWf2gtKwh2/jWNYOdlxW0=", + "dev": true, + "requires": { + "babel-runtime": "^6.22.0" + } + }, + "babel-plugin-transform-es2015-duplicate-keys": { + "version": "6.24.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/babel-plugin-transform-es2015-duplicate-keys/-/babel-plugin-transform-es2015-duplicate-keys-6.24.1.tgz", + "integrity": "sha1-c+s9MQypaePvnskcU3QabxV2Qj4=", + "dev": true, + "requires": { + "babel-runtime": "^6.22.0", + "babel-types": "^6.24.1" + } + }, + "babel-plugin-transform-es2015-for-of": { + "version": "6.23.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/babel-plugin-transform-es2015-for-of/-/babel-plugin-transform-es2015-for-of-6.23.0.tgz", + "integrity": "sha1-9HyVsrYT3x0+zC/bdXNiPHUkhpE=", + "dev": true, + "requires": { + "babel-runtime": "^6.22.0" + } + }, + "babel-plugin-transform-es2015-function-name": { + "version": "6.24.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/babel-plugin-transform-es2015-function-name/-/babel-plugin-transform-es2015-function-name-6.24.1.tgz", + "integrity": "sha1-g0yJhTvDaxrw86TF26qU/Y6sqos=", + "dev": true, + "requires": { + "babel-helper-function-name": "^6.24.1", + "babel-runtime": "^6.22.0", + "babel-types": "^6.24.1" + } + }, + "babel-plugin-transform-es2015-literals": { + "version": "6.22.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/babel-plugin-transform-es2015-literals/-/babel-plugin-transform-es2015-literals-6.22.0.tgz", + "integrity": "sha1-T1SgLWzWbPkVKAAZox0xklN3yi4=", + "dev": true, + "requires": { + "babel-runtime": "^6.22.0" + } + }, + "babel-plugin-transform-es2015-modules-amd": { + "version": "6.24.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/babel-plugin-transform-es2015-modules-amd/-/babel-plugin-transform-es2015-modules-amd-6.24.1.tgz", + "integrity": "sha1-Oz5UAXI5hC1tGcMBHEvS8AoA0VQ=", + "dev": true, + "requires": { + "babel-plugin-transform-es2015-modules-commonjs": "^6.24.1", + "babel-runtime": "^6.22.0", + "babel-template": "^6.24.1" + } + }, + "babel-plugin-transform-es2015-modules-commonjs": { + "version": "6.26.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/babel-plugin-transform-es2015-modules-commonjs/-/babel-plugin-transform-es2015-modules-commonjs-6.26.2.tgz", + "integrity": "sha512-CV9ROOHEdrjcwhIaJNBGMBCodN+1cfkwtM1SbUHmvyy35KGT7fohbpOxkE2uLz1o6odKK2Ck/tz47z+VqQfi9Q==", + "dev": true, + "requires": { + "babel-plugin-transform-strict-mode": "^6.24.1", + "babel-runtime": "^6.26.0", + "babel-template": "^6.26.0", + "babel-types": "^6.26.0" + } + }, + "babel-plugin-transform-es2015-modules-systemjs": { + "version": "6.24.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/babel-plugin-transform-es2015-modules-systemjs/-/babel-plugin-transform-es2015-modules-systemjs-6.24.1.tgz", + "integrity": "sha1-/4mhQrkRmpBhlfXxBuzzBdlAfSM=", + "dev": true, + "requires": { + "babel-helper-hoist-variables": "^6.24.1", + "babel-runtime": "^6.22.0", + "babel-template": "^6.24.1" + } + }, + "babel-plugin-transform-es2015-modules-umd": { + "version": "6.24.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/babel-plugin-transform-es2015-modules-umd/-/babel-plugin-transform-es2015-modules-umd-6.24.1.tgz", + "integrity": "sha1-rJl+YoXNGO1hdq22B9YCNErThGg=", + "dev": true, + "requires": { + "babel-plugin-transform-es2015-modules-amd": "^6.24.1", + "babel-runtime": "^6.22.0", + "babel-template": "^6.24.1" + } + }, + "babel-plugin-transform-es2015-object-super": { + "version": "6.24.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/babel-plugin-transform-es2015-object-super/-/babel-plugin-transform-es2015-object-super-6.24.1.tgz", + "integrity": "sha1-JM72muIcuDp/hgPa0CH1cusnj40=", + "dev": true, + "requires": { + "babel-helper-replace-supers": "^6.24.1", + "babel-runtime": "^6.22.0" + } + }, + "babel-plugin-transform-es2015-parameters": { + "version": "6.24.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/babel-plugin-transform-es2015-parameters/-/babel-plugin-transform-es2015-parameters-6.24.1.tgz", + "integrity": "sha1-V6w1GrScrxSpfNE7CfZv3wpiXys=", + "dev": true, + "requires": { + "babel-helper-call-delegate": "^6.24.1", + "babel-helper-get-function-arity": "^6.24.1", + "babel-runtime": "^6.22.0", + "babel-template": "^6.24.1", + "babel-traverse": "^6.24.1", + "babel-types": "^6.24.1" + } + }, + "babel-plugin-transform-es2015-shorthand-properties": { + "version": "6.24.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/babel-plugin-transform-es2015-shorthand-properties/-/babel-plugin-transform-es2015-shorthand-properties-6.24.1.tgz", + "integrity": "sha1-JPh11nIch2YbvZmkYi5R8U3jiqA=", + "dev": true, + "requires": { + "babel-runtime": "^6.22.0", + "babel-types": "^6.24.1" + } + }, + "babel-plugin-transform-es2015-spread": { + "version": "6.22.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/babel-plugin-transform-es2015-spread/-/babel-plugin-transform-es2015-spread-6.22.0.tgz", + "integrity": "sha1-1taKmfia7cRTbIGlQujdnxdG+NE=", + "dev": true, + "requires": { + "babel-runtime": "^6.22.0" + } + }, + "babel-plugin-transform-es2015-sticky-regex": { + "version": "6.24.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/babel-plugin-transform-es2015-sticky-regex/-/babel-plugin-transform-es2015-sticky-regex-6.24.1.tgz", + "integrity": "sha1-AMHNsaynERLN8M9hJsLta0V8zbw=", + "dev": true, + "requires": { + "babel-helper-regex": "^6.24.1", + "babel-runtime": "^6.22.0", + "babel-types": "^6.24.1" + } + }, + "babel-plugin-transform-es2015-template-literals": { + "version": "6.22.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/babel-plugin-transform-es2015-template-literals/-/babel-plugin-transform-es2015-template-literals-6.22.0.tgz", + "integrity": "sha1-qEs0UPfp+PH2g51taH2oS7EjbY0=", + "dev": true, + "requires": { + "babel-runtime": "^6.22.0" + } + }, + "babel-plugin-transform-es2015-typeof-symbol": { + "version": "6.23.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/babel-plugin-transform-es2015-typeof-symbol/-/babel-plugin-transform-es2015-typeof-symbol-6.23.0.tgz", + "integrity": "sha1-3sCfHN3/lLUqxz1QXITfWdzOs3I=", + "dev": true, + "requires": { + "babel-runtime": "^6.22.0" + } + }, + "babel-plugin-transform-es2015-unicode-regex": { + "version": "6.24.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/babel-plugin-transform-es2015-unicode-regex/-/babel-plugin-transform-es2015-unicode-regex-6.24.1.tgz", + "integrity": "sha1-04sS9C6nMj9yk4fxinxa4frrNek=", + "dev": true, + "requires": { + "babel-helper-regex": "^6.24.1", + "babel-runtime": "^6.22.0", + "regexpu-core": "^2.0.0" + }, + "dependencies": { + "regexpu-core": { + "version": "2.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/regexpu-core/-/regexpu-core-2.0.0.tgz", + "integrity": "sha1-SdA4g3uNz4v6W5pCE5k45uoq4kA=", + "dev": true, + "requires": { + "regenerate": "^1.2.1", + "regjsgen": "^0.2.0", + "regjsparser": "^0.1.4" + } + } + } + }, + "babel-plugin-transform-exponentiation-operator": { + "version": "6.24.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/babel-plugin-transform-exponentiation-operator/-/babel-plugin-transform-exponentiation-operator-6.24.1.tgz", + "integrity": "sha1-KrDJx/MJj6SJB3cruBP+QejeOg4=", + "dev": true, + "requires": { + "babel-helper-builder-binary-assignment-operator-visitor": "^6.24.1", + "babel-plugin-syntax-exponentiation-operator": "^6.8.0", + "babel-runtime": "^6.22.0" + } + }, + "babel-plugin-transform-export-extensions": { + "version": "6.22.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/babel-plugin-transform-export-extensions/-/babel-plugin-transform-export-extensions-6.22.0.tgz", + "integrity": "sha1-U3OLR+deghhYnuqUbLvTkQm75lM=", + "dev": true, + "requires": { + "babel-plugin-syntax-export-extensions": "^6.8.0", + "babel-runtime": "^6.22.0" + } + }, + "babel-plugin-transform-flow-strip-types": { + "version": "6.22.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/babel-plugin-transform-flow-strip-types/-/babel-plugin-transform-flow-strip-types-6.22.0.tgz", + "integrity": "sha1-hMtnKTXUNxT9wyvOhFaNh0Qc988=", + "dev": true, + "requires": { + "babel-plugin-syntax-flow": "^6.18.0", + "babel-runtime": "^6.22.0" + } + }, + "babel-plugin-transform-object-rest-spread": { + "version": "6.26.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/babel-plugin-transform-object-rest-spread/-/babel-plugin-transform-object-rest-spread-6.26.0.tgz", + "integrity": "sha1-DzZpLVD+9rfi1LOsFHgTepY7ewY=", + "dev": true, + "requires": { + "babel-plugin-syntax-object-rest-spread": "^6.8.0", + "babel-runtime": "^6.26.0" + } + }, + "babel-plugin-transform-regenerator": { + "version": "6.26.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/babel-plugin-transform-regenerator/-/babel-plugin-transform-regenerator-6.26.0.tgz", + "integrity": "sha1-4HA2lvveJ/Cj78rPi03KL3s6jy8=", + "dev": true, + "requires": { + "regenerator-transform": "^0.10.0" + } + }, + "babel-plugin-transform-strict-mode": { + "version": "6.24.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/babel-plugin-transform-strict-mode/-/babel-plugin-transform-strict-mode-6.24.1.tgz", + "integrity": "sha1-1fr3qleKZbvlkc9e2uBKDGcCB1g=", + "dev": true, + "requires": { + "babel-runtime": "^6.22.0", + "babel-types": "^6.24.1" + } + }, + "babel-preset-es2015": { + "version": "6.24.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/babel-preset-es2015/-/babel-preset-es2015-6.24.1.tgz", + "integrity": "sha1-1EBQ1rwsn+6nAqrzjXJ6AhBTiTk=", + "dev": true, + "requires": { + "babel-plugin-check-es2015-constants": "^6.22.0", + "babel-plugin-transform-es2015-arrow-functions": "^6.22.0", + "babel-plugin-transform-es2015-block-scoped-functions": "^6.22.0", + "babel-plugin-transform-es2015-block-scoping": "^6.24.1", + "babel-plugin-transform-es2015-classes": "^6.24.1", + "babel-plugin-transform-es2015-computed-properties": "^6.24.1", + "babel-plugin-transform-es2015-destructuring": "^6.22.0", + "babel-plugin-transform-es2015-duplicate-keys": "^6.24.1", + "babel-plugin-transform-es2015-for-of": "^6.22.0", + "babel-plugin-transform-es2015-function-name": "^6.24.1", + "babel-plugin-transform-es2015-literals": "^6.22.0", + "babel-plugin-transform-es2015-modules-amd": "^6.24.1", + "babel-plugin-transform-es2015-modules-commonjs": "^6.24.1", + "babel-plugin-transform-es2015-modules-systemjs": "^6.24.1", + "babel-plugin-transform-es2015-modules-umd": "^6.24.1", + "babel-plugin-transform-es2015-object-super": "^6.24.1", + "babel-plugin-transform-es2015-parameters": "^6.24.1", + "babel-plugin-transform-es2015-shorthand-properties": "^6.24.1", + "babel-plugin-transform-es2015-spread": "^6.22.0", + "babel-plugin-transform-es2015-sticky-regex": "^6.24.1", + "babel-plugin-transform-es2015-template-literals": "^6.22.0", + "babel-plugin-transform-es2015-typeof-symbol": "^6.22.0", + "babel-plugin-transform-es2015-unicode-regex": "^6.24.1", + "babel-plugin-transform-regenerator": "^6.24.1" + } + }, + "babel-preset-jest": { + "version": "22.4.3", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/babel-preset-jest/-/babel-preset-jest-22.4.3.tgz", + "integrity": "sha512-a+M3LTEXTq3gxv0uBN9Qm6ahUl7a8pj923nFbCUdqFUSsf3YrX8Uc+C3MEwji5Af3LiQjSC7w4ooYewlz8HRTA==", + "dev": true, + "requires": { + "babel-plugin-jest-hoist": "^22.4.3", + "babel-plugin-syntax-object-rest-spread": "^6.13.0" + } + }, + "babel-preset-stage-1": { + "version": "6.24.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/babel-preset-stage-1/-/babel-preset-stage-1-6.24.1.tgz", + "integrity": "sha1-dpLNfc1oSZB+auSgqFWJz7niv7A=", + "dev": true, + "requires": { + "babel-plugin-transform-class-constructor-call": "^6.24.1", + "babel-plugin-transform-export-extensions": "^6.22.0", + "babel-preset-stage-2": "^6.24.1" + } + }, + "babel-preset-stage-2": { + "version": "6.24.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/babel-preset-stage-2/-/babel-preset-stage-2-6.24.1.tgz", + "integrity": "sha1-2eKWD7PXEYfw5k7sYrwHdnIZvcE=", + "dev": true, + "requires": { + "babel-plugin-syntax-dynamic-import": "^6.18.0", + "babel-plugin-transform-class-properties": "^6.24.1", + "babel-plugin-transform-decorators": "^6.24.1", + "babel-preset-stage-3": "^6.24.1" + } + }, + "babel-preset-stage-3": { + "version": "6.24.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/babel-preset-stage-3/-/babel-preset-stage-3-6.24.1.tgz", + "integrity": "sha1-g2raCp56f6N8sTj7kyb4eTSkg5U=", + "dev": true, + "requires": { + "babel-plugin-syntax-trailing-function-commas": "^6.22.0", + "babel-plugin-transform-async-generator-functions": "^6.24.1", + "babel-plugin-transform-async-to-generator": "^6.24.1", + "babel-plugin-transform-exponentiation-operator": "^6.24.1", + "babel-plugin-transform-object-rest-spread": "^6.22.0" + } + }, + "babel-register": { + "version": "6.26.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/babel-register/-/babel-register-6.26.0.tgz", + "integrity": "sha1-btAhFz4vy0htestFxgCahW9kcHE=", + "dev": true, + "requires": { + "babel-core": "^6.26.0", + "babel-runtime": "^6.26.0", + "core-js": "^2.5.0", + "home-or-tmp": "^2.0.0", + "lodash": "^4.17.4", + "mkdirp": "^0.5.1", + "source-map-support": "^0.4.15" + }, + "dependencies": { + "lodash": { + "version": "4.17.11", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/lodash/-/lodash-4.17.11.tgz", + "integrity": "sha512-cQKh8igo5QUhZ7lg38DYWAxMvjSAKG0A8wGSVimP07SIUEK2UO+arSRKbRZWtelMtN5V0Hkwh5ryOto/SshYIg==", + "dev": true + }, + "source-map-support": { + "version": "0.4.18", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/source-map-support/-/source-map-support-0.4.18.tgz", + "integrity": "sha512-try0/JqxPLF9nOjvSta7tVondkP5dwgyLDjVoyMDlmjugT2lRZ1OfsrYTkCd2hkDnJTKRbO/Rl3orm8vlsUzbA==", + "dev": true, + "requires": { + "source-map": "^0.5.6" + } + } + } + }, + "babel-runtime": { + "version": "6.26.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/babel-runtime/-/babel-runtime-6.26.0.tgz", + "integrity": "sha1-llxwWGaOgrVde/4E/yM3vItWR/4=", + "dev": true, + "requires": { + "core-js": "^2.4.0", + "regenerator-runtime": "^0.11.0" + } + }, + "babel-template": { + "version": "6.26.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/babel-template/-/babel-template-6.26.0.tgz", + "integrity": "sha1-3gPi0WOWsGn0bdn/+FIfsaDjXgI=", + "dev": true, + "requires": { + "babel-runtime": "^6.26.0", + "babel-traverse": "^6.26.0", + "babel-types": "^6.26.0", + "babylon": "^6.18.0", + "lodash": "^4.17.4" + }, + "dependencies": { + "lodash": { + "version": "4.17.11", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/lodash/-/lodash-4.17.11.tgz", + "integrity": "sha512-cQKh8igo5QUhZ7lg38DYWAxMvjSAKG0A8wGSVimP07SIUEK2UO+arSRKbRZWtelMtN5V0Hkwh5ryOto/SshYIg==", + "dev": true + } + } + }, + "babel-traverse": { + "version": "6.26.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/babel-traverse/-/babel-traverse-6.26.0.tgz", + "integrity": "sha1-RqnL1+3MYsjlwGTi0tjQ9ANXZu4=", + "dev": true, + "requires": { + "babel-code-frame": "^6.26.0", + "babel-messages": "^6.23.0", + "babel-runtime": "^6.26.0", + "babel-types": "^6.26.0", + "babylon": "^6.18.0", + "debug": "^2.6.8", + "globals": "^9.18.0", + "invariant": "^2.2.2", + "lodash": "^4.17.4" + }, + "dependencies": { + "lodash": { + "version": "4.17.11", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/lodash/-/lodash-4.17.11.tgz", + "integrity": "sha512-cQKh8igo5QUhZ7lg38DYWAxMvjSAKG0A8wGSVimP07SIUEK2UO+arSRKbRZWtelMtN5V0Hkwh5ryOto/SshYIg==", + "dev": true + } + } + }, + "babel-types": { + "version": "6.26.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/babel-types/-/babel-types-6.26.0.tgz", + "integrity": "sha1-o7Bz+Uq0nrb6Vc1lInozQ4BjJJc=", + "dev": true, + "requires": { + "babel-runtime": "^6.26.0", + "esutils": "^2.0.2", + "lodash": "^4.17.4", + "to-fast-properties": "^1.0.3" + }, + "dependencies": { + "lodash": { + "version": "4.17.11", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/lodash/-/lodash-4.17.11.tgz", + "integrity": "sha512-cQKh8igo5QUhZ7lg38DYWAxMvjSAKG0A8wGSVimP07SIUEK2UO+arSRKbRZWtelMtN5V0Hkwh5ryOto/SshYIg==", + "dev": true + } + } + }, + "babylon": { + "version": "6.18.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/babylon/-/babylon-6.18.0.tgz", + "integrity": "sha512-q/UEjfGJ2Cm3oKV71DJz9d25TPnq5rhBVL2Q4fA5wcC3jcrdn7+SssEybFIxwAvvP+YCsCYNKughoF33GxgycQ==", + "dev": true + }, + "backo2": { + "version": "1.0.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/backo2/-/backo2-1.0.2.tgz", + "integrity": "sha1-MasayLEpNjRj41s+u2n038+6eUc=", + "dev": true + }, + "balanced-match": { + "version": "1.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/balanced-match/-/balanced-match-1.0.0.tgz", + "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=", + "dev": true + }, + "base": { + "version": "0.11.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/base/-/base-0.11.2.tgz", + "integrity": "sha512-5T6P4xPgpp0YDFvSWwEZ4NoE3aM4QBQXDzmVbraCkFj8zHM+mba8SyqB5DbZWyR7mYHo6Y7BdQo3MoA4m0TeQg==", + "dev": true, + "requires": { + "cache-base": "^1.0.1", + "class-utils": "^0.3.5", + "component-emitter": "^1.2.1", + "define-property": "^1.0.0", + "isobject": "^3.0.1", + "mixin-deep": "^1.2.0", + "pascalcase": "^0.1.1" + }, + "dependencies": { + "define-property": { + "version": "1.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/define-property/-/define-property-1.0.0.tgz", + "integrity": "sha1-dp66rz9KY6rTr56NMEybvnm/sOY=", + "dev": true, + "requires": { + "is-descriptor": "^1.0.0" + } + }, + "is-accessor-descriptor": { + "version": "1.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz", + "integrity": "sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ==", + "dev": true, + "requires": { + "kind-of": "^6.0.0" + } + }, + "is-data-descriptor": { + "version": "1.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz", + "integrity": "sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ==", + "dev": true, + "requires": { + "kind-of": "^6.0.0" + } + }, + "is-descriptor": { + "version": "1.0.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/is-descriptor/-/is-descriptor-1.0.2.tgz", + "integrity": "sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg==", + "dev": true, + "requires": { + "is-accessor-descriptor": "^1.0.0", + "is-data-descriptor": "^1.0.0", + "kind-of": "^6.0.2" + } + } + } + }, + "base62": { + "version": "1.2.8", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/base62/-/base62-1.2.8.tgz", + "integrity": "sha512-V6YHUbjLxN1ymqNLb1DPHoU1CpfdL7d2YTIp5W3U4hhoG4hhxNmsFDs66M9EXxBiSEke5Bt5dwdfMwwZF70iLA==", + "dev": true + }, + "base64-arraybuffer": { + "version": "0.1.5", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/base64-arraybuffer/-/base64-arraybuffer-0.1.5.tgz", + "integrity": "sha1-c5JncZI7Whl0etZmqlzUv5xunOg=", + "dev": true + }, + "base64-js": { + "version": "1.3.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/base64-js/-/base64-js-1.3.0.tgz", + "integrity": "sha512-ccav/yGvoa80BQDljCxsmmQ3Xvx60/UpBIij5QN21W3wBi/hhIC9OoO+KLpu9IJTS9j4DRVJ3aDDF9cMSoa2lw==", + "dev": true + }, + "base64id": { + "version": "1.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/base64id/-/base64id-1.0.0.tgz", + "integrity": "sha1-R2iMuZu2gE8OBtPnY7HDLlfY5rY=", + "dev": true + }, + "batch": { + "version": "0.6.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/batch/-/batch-0.6.1.tgz", + "integrity": "sha1-3DQxT05nkxgJP8dgJyUl+UvyXBY=", + "dev": true + }, + "bcrypt-pbkdf": { + "version": "1.0.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz", + "integrity": "sha1-pDAdOJtqQ/m2f/PKEaP2Y342Dp4=", + "dev": true, + "requires": { + "tweetnacl": "^0.14.3" + } + }, + "better-assert": { + "version": "1.0.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/better-assert/-/better-assert-1.0.2.tgz", + "integrity": "sha1-QIZrnhueC1W0gYlDEeaPr/rrxSI=", + "dev": true, + "requires": { + "callsite": "1.0.0" + } + }, + "big.js": { + "version": "3.2.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/big.js/-/big.js-3.2.0.tgz", + "integrity": "sha512-+hN/Zh2D08Mx65pZ/4g5bsmNiZUuChDiQfTUQ7qJr4/kuopCr88xZsAXv6mBoZEsUI4OuGHlX59qE94K2mMW8Q==", + "dev": true + }, + "binary-extensions": { + "version": "1.11.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/binary-extensions/-/binary-extensions-1.11.0.tgz", + "integrity": "sha1-RqoXUftqL5PuXmibsQh9SxTGwgU=", + "dev": true + }, + "binaryextensions": { + "version": "2.1.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/binaryextensions/-/binaryextensions-2.1.1.tgz", + "integrity": "sha512-XBaoWE9RW8pPdPQNibZsW2zh8TW6gcarXp1FZPwT8Uop8ScSNldJEWf2k9l3HeTqdrEwsOsFcq74RiJECW34yA==", + "dev": true + }, + "blob": { + "version": "0.0.4", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/blob/-/blob-0.0.4.tgz", + "integrity": "sha1-vPEwUspURj8w+fx+lbmkdjCpSSE=", + "dev": true + }, + "bluebird": { + "version": "3.5.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/bluebird/-/bluebird-3.5.1.tgz", + "integrity": "sha512-MKiLiV+I1AA596t9w1sQJ8jkiSr5+ZKi0WKrYGUn6d1Fx+Ij4tIj+m2WMQSGczs5jZVxV339chE8iwk6F64wjA==", + "dev": true + }, + "bn.js": { + "version": "4.11.8", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/bn.js/-/bn.js-4.11.8.tgz", + "integrity": "sha512-ItfYfPLkWHUjckQCk8xC+LwxgK8NYcXywGigJgSwOP8Y2iyWT4f2vsZnoOXTTbo+o5yXmIUJ4gn5538SO5S3gA==", + "dev": true + }, + "body-parser": { + "version": "1.18.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/body-parser/-/body-parser-1.18.2.tgz", + "integrity": "sha1-h2eKGdhLR9hZuDGZvVm84iKxBFQ=", + "dev": true, + "requires": { + "bytes": "3.0.0", + "content-type": "~1.0.4", + "debug": "2.6.9", + "depd": "~1.1.1", + "http-errors": "~1.6.2", + "iconv-lite": "0.4.19", + "on-finished": "~2.3.0", + "qs": "6.5.1", + "raw-body": "2.3.2", + "type-is": "~1.6.15" + }, + "dependencies": { + "iconv-lite": { + "version": "0.4.19", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/iconv-lite/-/iconv-lite-0.4.19.tgz", + "integrity": "sha512-oTZqweIP51xaGPI4uPa56/Pri/480R+mo7SeU+YETByQNhDG55ycFyNLIgta9vXhILrxXDmF7ZGhqZIcuN0gJQ==", + "dev": true + }, + "qs": { + "version": "6.5.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/qs/-/qs-6.5.1.tgz", + "integrity": "sha512-eRzhrN1WSINYCDCbrz796z37LOe3m5tmW7RQf6oBntukAG1nmovJvhnwHHRMAfeoItc1m2Hk02WER2aQ/iqs+A==", + "dev": true + }, + "raw-body": { + "version": "2.3.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/raw-body/-/raw-body-2.3.2.tgz", + "integrity": "sha1-vNYMd9Prk83gBQKVw/N5OJvIj4k=", + "dev": true, + "requires": { + "bytes": "3.0.0", + "http-errors": "1.6.2", + "iconv-lite": "0.4.19", + "unpipe": "1.0.0" + }, + "dependencies": { + "depd": { + "version": "1.1.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/depd/-/depd-1.1.1.tgz", + "integrity": "sha1-V4O04cRZ8G+lyif5kfPQbnoxA1k=", + "dev": true + }, + "http-errors": { + "version": "1.6.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/http-errors/-/http-errors-1.6.2.tgz", + "integrity": "sha1-CgAsyFcHGSp+eUbO7cERVfYOxzY=", + "dev": true, + "requires": { + "depd": "1.1.1", + "inherits": "2.0.3", + "setprototypeof": "1.0.3", + "statuses": ">= 1.3.1 < 2" + } + } + } + }, + "setprototypeof": { + "version": "1.0.3", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/setprototypeof/-/setprototypeof-1.0.3.tgz", + "integrity": "sha1-ZlZ+NwQ+608E2RvWWMDL77VbjgQ=", + "dev": true + } + } + }, + "bonjour": { + "version": "3.5.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/bonjour/-/bonjour-3.5.0.tgz", + "integrity": "sha1-jokKGD2O6aI5OzhExpGkK897yfU=", + "dev": true, + "requires": { + "array-flatten": "^2.1.0", + "deep-equal": "^1.0.1", + "dns-equal": "^1.0.0", + "dns-txt": "^2.0.2", + "multicast-dns": "^6.0.1", + "multicast-dns-service-types": "^1.1.0" + } + }, + "boolbase": { + "version": "1.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/boolbase/-/boolbase-1.0.0.tgz", + "integrity": "sha1-aN/1++YMUes3cl6p4+0xDcwed24=", + "dev": true + }, + "bootstrap": { + "version": "4.1.3", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/bootstrap/-/bootstrap-4.1.3.tgz", + "integrity": "sha512-rDFIzgXcof0jDyjNosjv4Sno77X4KuPeFxG2XZZv1/Kc8DRVGVADdoQyyOVDwPqL36DDmtCQbrpMCqvpPLJQ0w==" + }, + "brace-expansion": { + "version": "1.1.11", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dev": true, + "requires": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "braces": { + "version": "2.3.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/braces/-/braces-2.3.2.tgz", + "integrity": "sha512-aNdbnj9P8PjdXU4ybaWLK2IF3jc/EoDYbC7AazW6to3TRsfXxscC9UXOB5iDiEQrkyIbWp2SLQda4+QAa7nc3w==", + "dev": true, + "requires": { + "arr-flatten": "^1.1.0", + "array-unique": "^0.3.2", + "extend-shallow": "^2.0.1", + "fill-range": "^4.0.0", + "isobject": "^3.0.1", + "repeat-element": "^1.1.2", + "snapdragon": "^0.8.1", + "snapdragon-node": "^2.0.1", + "split-string": "^3.0.2", + "to-regex": "^3.0.1" + }, + "dependencies": { + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "dev": true, + "requires": { + "is-extendable": "^0.1.0" + } + } + } + }, + "brorand": { + "version": "1.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/brorand/-/brorand-1.1.0.tgz", + "integrity": "sha1-EsJe/kCkXjwyPrhnWgoM5XsiNx8=", + "dev": true + }, + "browser-process-hrtime": { + "version": "0.1.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/browser-process-hrtime/-/browser-process-hrtime-0.1.2.tgz", + "integrity": "sha1-Ql1opY00R/AqBKqJQYf86K+Le44=", + "dev": true + }, + "browser-resolve": { + "version": "1.11.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/browser-resolve/-/browser-resolve-1.11.2.tgz", + "integrity": "sha1-j/CbCixCFxihBRwmCzLkj0QpOM4=", + "dev": true, + "requires": { + "resolve": "1.1.7" + }, + "dependencies": { + "resolve": { + "version": "1.1.7", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/resolve/-/resolve-1.1.7.tgz", + "integrity": "sha1-IDEU2CrSxe2ejgQRs5ModeiJ6Xs=", + "dev": true + } + } + }, + "browser-sync": { + "version": "2.24.6", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/browser-sync/-/browser-sync-2.24.6.tgz", + "integrity": "sha512-3cVW8Ft3sPQ1t9gqZXBDZhTyRce8NW4wf5KzpCYcg6fWjPbyt+vZLvEo+sTq7c7eNQhi8lInQWbjIFEpoM2f7Q==", + "dev": true, + "requires": { + "browser-sync-ui": "v1.0.1", + "bs-recipes": "1.3.4", + "chokidar": "1.7.0", + "connect": "3.6.6", + "connect-history-api-fallback": "^1.5.0", + "dev-ip": "^1.0.1", + "easy-extender": "2.3.2", + "eazy-logger": "3.0.2", + "etag": "^1.8.1", + "fresh": "^0.5.2", + "fs-extra": "3.0.1", + "http-proxy": "1.15.2", + "immutable": "3.8.2", + "localtunnel": "1.9.0", + "micromatch": "2.3.11", + "opn": "4.0.2", + "portscanner": "2.1.1", + "qs": "6.2.3", + "raw-body": "^2.3.2", + "resp-modifier": "6.0.2", + "rx": "4.1.0", + "serve-index": "1.9.1", + "serve-static": "1.13.2", + "server-destroy": "1.0.1", + "socket.io": "2.1.1", + "ua-parser-js": "0.7.17", + "yargs": "6.4.0" + }, + "dependencies": { + "anymatch": { + "version": "1.3.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/anymatch/-/anymatch-1.3.2.tgz", + "integrity": "sha512-0XNayC8lTHQ2OI8aljNCN3sSx6hsr/1+rlcDAotXJR7C1oZZHCNsfpbKwMjRA3Uqb5tF1Rae2oloTr4xpq+WjA==", + "dev": true, + "requires": { + "micromatch": "^2.1.5", + "normalize-path": "^2.0.0" + } + }, + "arr-diff": { + "version": "2.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/arr-diff/-/arr-diff-2.0.0.tgz", + "integrity": "sha1-jzuCf5Vai9ZpaX5KQlasPOrjVs8=", + "dev": true, + "requires": { + "arr-flatten": "^1.0.1" + } + }, + "array-unique": { + "version": "0.2.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/array-unique/-/array-unique-0.2.1.tgz", + "integrity": "sha1-odl8yvy8JiXMcPrc6zalDFiwGlM=", + "dev": true + }, + "braces": { + "version": "1.8.5", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/braces/-/braces-1.8.5.tgz", + "integrity": "sha1-uneWLhLf+WnWt2cR6RS3N4V79qc=", + "dev": true, + "requires": { + "expand-range": "^1.8.1", + "preserve": "^0.2.0", + "repeat-element": "^1.1.2" + } + }, + "chokidar": { + "version": "1.7.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/chokidar/-/chokidar-1.7.0.tgz", + "integrity": "sha1-eY5ol3gVHIB2tLNg5e3SjNortGg=", + "dev": true, + "requires": { + "anymatch": "^1.3.0", + "async-each": "^1.0.0", + "fsevents": "^1.0.0", + "glob-parent": "^2.0.0", + "inherits": "^2.0.1", + "is-binary-path": "^1.0.0", + "is-glob": "^2.0.0", + "path-is-absolute": "^1.0.0", + "readdirp": "^2.0.0" + } + }, + "expand-brackets": { + "version": "0.1.5", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/expand-brackets/-/expand-brackets-0.1.5.tgz", + "integrity": "sha1-3wcoTjQqgHzXM6xa9yQR5YHRF3s=", + "dev": true, + "requires": { + "is-posix-bracket": "^0.1.0" + } + }, + "extglob": { + "version": "0.3.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/extglob/-/extglob-0.3.2.tgz", + "integrity": "sha1-Lhj/PS9JqydlzskCPwEdqo2DSaE=", + "dev": true, + "requires": { + "is-extglob": "^1.0.0" + } + }, + "glob-parent": { + "version": "2.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/glob-parent/-/glob-parent-2.0.0.tgz", + "integrity": "sha1-gTg9ctsFT8zPUzbaqQLxgvbtuyg=", + "dev": true, + "requires": { + "is-glob": "^2.0.0" + } + }, + "is-extglob": { + "version": "1.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/is-extglob/-/is-extglob-1.0.0.tgz", + "integrity": "sha1-rEaBd8SUNAWgkvyPKXYMb/xiBsA=", + "dev": true + }, + "is-glob": { + "version": "2.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/is-glob/-/is-glob-2.0.1.tgz", + "integrity": "sha1-0Jb5JqPe1WAPP9/ZEZjLCIjC2GM=", + "dev": true, + "requires": { + "is-extglob": "^1.0.0" + } + }, + "kind-of": { + "version": "3.2.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true, + "requires": { + "is-buffer": "^1.1.5" + } + }, + "micromatch": { + "version": "2.3.11", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/micromatch/-/micromatch-2.3.11.tgz", + "integrity": "sha1-hmd8l9FyCzY0MdBNDRUpO9OMFWU=", + "dev": true, + "requires": { + "arr-diff": "^2.0.0", + "array-unique": "^0.2.1", + "braces": "^1.8.2", + "expand-brackets": "^0.1.4", + "extglob": "^0.3.1", + "filename-regex": "^2.0.0", + "is-extglob": "^1.0.0", + "is-glob": "^2.0.1", + "kind-of": "^3.0.2", + "normalize-path": "^2.0.1", + "object.omit": "^2.0.0", + "parse-glob": "^3.0.4", + "regex-cache": "^0.4.2" + } + }, + "opn": { + "version": "4.0.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/opn/-/opn-4.0.2.tgz", + "integrity": "sha1-erwi5kTf9jsKltWrfyeQwPAavJU=", + "dev": true, + "requires": { + "object-assign": "^4.0.1", + "pinkie-promise": "^2.0.0" + } + }, + "qs": { + "version": "6.2.3", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/qs/-/qs-6.2.3.tgz", + "integrity": "sha1-HPyyXBCpsrSDBT/zn138kjOQjP4=", + "dev": true + } + } + }, + "browser-sync-ui": { + "version": "1.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/browser-sync-ui/-/browser-sync-ui-1.0.1.tgz", + "integrity": "sha512-RIxmwVVcUFhRd1zxp7m2FfLnXHf59x4Gtj8HFwTA//3VgYI3AKkaQAuDL8KDJnE59XqCshxZa13JYuIWtZlKQg==", + "dev": true, + "requires": { + "async-each-series": "0.1.1", + "connect-history-api-fallback": "^1.1.0", + "immutable": "^3.7.6", + "server-destroy": "1.0.1", + "socket.io-client": "2.0.4", + "stream-throttle": "^0.1.3" + } + }, + "browser-sync-webpack-plugin": { + "version": "2.2.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/browser-sync-webpack-plugin/-/browser-sync-webpack-plugin-2.2.2.tgz", + "integrity": "sha512-x92kl8LdBi4dp6YVXYqrSoDkOCOLCeBOrYSY0h9Sk1VcCDSoZC1Vc62eae6TfC2ljN4/L+aYlkzE46kirHzbgA==", + "dev": true, + "requires": { + "lodash": "^4" + }, + "dependencies": { + "lodash": { + "version": "4.17.11", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/lodash/-/lodash-4.17.11.tgz", + "integrity": "sha512-cQKh8igo5QUhZ7lg38DYWAxMvjSAKG0A8wGSVimP07SIUEK2UO+arSRKbRZWtelMtN5V0Hkwh5ryOto/SshYIg==", + "dev": true + } + } + }, + "browserify-aes": { + "version": "1.2.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/browserify-aes/-/browserify-aes-1.2.0.tgz", + "integrity": "sha512-+7CHXqGuspUn/Sl5aO7Ea0xWGAtETPXNSAjHo48JfLdPWcMng33Xe4znFvQweqc/uzk5zSOI3H52CYnjCfb5hA==", + "dev": true, + "requires": { + "buffer-xor": "^1.0.3", + "cipher-base": "^1.0.0", + "create-hash": "^1.1.0", + "evp_bytestokey": "^1.0.3", + "inherits": "^2.0.1", + "safe-buffer": "^5.0.1" + } + }, + "browserify-cipher": { + "version": "1.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/browserify-cipher/-/browserify-cipher-1.0.1.tgz", + "integrity": "sha512-sPhkz0ARKbf4rRQt2hTpAHqn47X3llLkUGn+xEJzLjwY8LRs2p0v7ljvI5EyoRO/mexrNunNECisZs+gw2zz1w==", + "dev": true, + "requires": { + "browserify-aes": "^1.0.4", + "browserify-des": "^1.0.0", + "evp_bytestokey": "^1.0.0" + } + }, + "browserify-des": { + "version": "1.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/browserify-des/-/browserify-des-1.0.1.tgz", + "integrity": "sha512-zy0Cobe3hhgpiOM32Tj7KQ3Vl91m0njwsjzZQK1L+JDf11dzP9qIvjreVinsvXrgfjhStXwUWAEpB9D7Gwmayw==", + "dev": true, + "requires": { + "cipher-base": "^1.0.1", + "des.js": "^1.0.0", + "inherits": "^2.0.1" + } + }, + "browserify-rsa": { + "version": "4.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/browserify-rsa/-/browserify-rsa-4.0.1.tgz", + "integrity": "sha1-IeCr+vbyApzy+vsTNWenAdQTVSQ=", + "dev": true, + "requires": { + "bn.js": "^4.1.0", + "randombytes": "^2.0.1" + } + }, + "browserify-sign": { + "version": "4.0.4", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/browserify-sign/-/browserify-sign-4.0.4.tgz", + "integrity": "sha1-qk62jl17ZYuqa/alfmMMvXqT0pg=", + "dev": true, + "requires": { + "bn.js": "^4.1.1", + "browserify-rsa": "^4.0.0", + "create-hash": "^1.1.0", + "create-hmac": "^1.1.2", + "elliptic": "^6.0.0", + "inherits": "^2.0.1", + "parse-asn1": "^5.0.0" + } + }, + "browserify-zlib": { + "version": "0.2.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/browserify-zlib/-/browserify-zlib-0.2.0.tgz", + "integrity": "sha512-Z942RysHXmJrhqk88FmKBVq/v5tqmSkDz7p54G/MGyjMnCFFnC79XWNbg+Vta8W6Wb2qtSZTSxIGkJrRpCFEiA==", + "dev": true, + "requires": { + "pako": "~1.0.5" + } + }, + "browserslist": { + "version": "1.7.7", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/browserslist/-/browserslist-1.7.7.tgz", + "integrity": "sha1-C9dnBCWL6CmyOYu1Dkti0aFmsLk=", + "dev": true, + "requires": { + "caniuse-db": "^1.0.30000639", + "electron-to-chromium": "^1.2.7" + } + }, + "bs-recipes": { + "version": "1.3.4", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/bs-recipes/-/bs-recipes-1.3.4.tgz", + "integrity": "sha1-DS1NSKcYyMBEdp/cT4lZLci2lYU=", + "dev": true + }, + "bser": { + "version": "2.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/bser/-/bser-2.0.0.tgz", + "integrity": "sha1-mseNPtXZFYBP2HrLFYvHlxR6Fxk=", + "dev": true, + "requires": { + "node-int64": "^0.4.0" + } + }, + "buffer": { + "version": "4.9.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/buffer/-/buffer-4.9.1.tgz", + "integrity": "sha1-bRu2AbB6TvztlwlBMgkwJ8lbwpg=", + "dev": true, + "requires": { + "base64-js": "^1.0.2", + "ieee754": "^1.1.4", + "isarray": "^1.0.0" + } + }, + "buffer-alloc": { + "version": "1.2.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/buffer-alloc/-/buffer-alloc-1.2.0.tgz", + "integrity": "sha512-CFsHQgjtW1UChdXgbyJGtnm+O/uLQeZdtbDo8mfUgYXCHSM1wgrVxXm6bSyrUuErEb+4sYVGCzASBRot7zyrow==", + "dev": true, + "requires": { + "buffer-alloc-unsafe": "^1.1.0", + "buffer-fill": "^1.0.0" + } + }, + "buffer-alloc-unsafe": { + "version": "1.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/buffer-alloc-unsafe/-/buffer-alloc-unsafe-1.1.0.tgz", + "integrity": "sha512-TEM2iMIEQdJ2yjPJoSIsldnleVaAk1oW3DBVUykyOLsEsFmEc9kn+SFFPz+gl54KQNxlDnAwCXosOS9Okx2xAg==", + "dev": true + }, + "buffer-fill": { + "version": "1.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/buffer-fill/-/buffer-fill-1.0.0.tgz", + "integrity": "sha1-+PeLdniYiO858gXNY39o5wISKyw=", + "dev": true + }, + "buffer-from": { + "version": "1.1.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/buffer-from/-/buffer-from-1.1.1.tgz", + "integrity": "sha512-MQcXEUbCKtEo7bhqEs6560Hyd4XaovZlO/k9V3hjVUF/zwW7KBVdSK4gIt/bzwS9MbR5qob+F5jusZsb0YQK2A==", + "dev": true + }, + "buffer-indexof": { + "version": "1.1.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/buffer-indexof/-/buffer-indexof-1.1.1.tgz", + "integrity": "sha512-4/rOEg86jivtPTeOUUT61jJO1Ya1TrR/OkqCSZDyq84WJh3LuuiphBYJN+fm5xufIk4XAFcEwte/8WzC8If/1g==", + "dev": true + }, + "buffer-xor": { + "version": "1.0.3", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/buffer-xor/-/buffer-xor-1.0.3.tgz", + "integrity": "sha1-JuYe0UIvtw3ULm42cp7VHYVf6Nk=", + "dev": true + }, + "builtin-modules": { + "version": "1.1.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/builtin-modules/-/builtin-modules-1.1.1.tgz", + "integrity": "sha1-Jw8HbFpywC9bZaR9+Uxf46J4iS8=", + "dev": true + }, + "builtin-status-codes": { + "version": "3.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/builtin-status-codes/-/builtin-status-codes-3.0.0.tgz", + "integrity": "sha1-hZgoeOIbmOHGZCXgPQF0eI9Wnug=", + "dev": true + }, + "builtins": { + "version": "1.0.3", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/builtins/-/builtins-1.0.3.tgz", + "integrity": "sha1-y5T662HIaWRR2zZTThQi+U8K7og=", + "dev": true + }, + "bytes": { + "version": "3.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/bytes/-/bytes-3.0.0.tgz", + "integrity": "sha1-0ygVQE1olpn4Wk6k+odV3ROpYEg=", + "dev": true + }, + "cacache": { + "version": "10.0.4", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/cacache/-/cacache-10.0.4.tgz", + "integrity": "sha512-Dph0MzuH+rTQzGPNT9fAnrPmMmjKfST6trxJeK7NQuHRaVw24VzPRWTmg9MpcwOVQZO0E1FBICUlFeNaKPIfHA==", + "dev": true, + "requires": { + "bluebird": "^3.5.1", + "chownr": "^1.0.1", + "glob": "^7.1.2", + "graceful-fs": "^4.1.11", + "lru-cache": "^4.1.1", + "mississippi": "^2.0.0", + "mkdirp": "^0.5.1", + "move-concurrently": "^1.0.1", + "promise-inflight": "^1.0.1", + "rimraf": "^2.6.2", + "ssri": "^5.2.4", + "unique-filename": "^1.1.0", + "y18n": "^4.0.0" + }, + "dependencies": { + "rimraf": { + "version": "2.6.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/rimraf/-/rimraf-2.6.2.tgz", + "integrity": "sha512-lreewLK/BlghmxtfH36YYVg1i8IAce4TI7oao75I1g245+6BctqTVQiBP3YUJ9C6DQOXJmkYR9X9fCLtCOJc5w==", + "dev": true, + "requires": { + "glob": "^7.0.5" + } + }, + "y18n": { + "version": "4.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/y18n/-/y18n-4.0.0.tgz", + "integrity": "sha512-r9S/ZyXu/Xu9q1tYlpsLIsa3EeLXXk0VwlxqTcFRfg9EhMW+17kbt9G0NrgCmhGb5vT2hyhJZLfDGx+7+5Uj/w==", + "dev": true + } + } + }, + "cache-base": { + "version": "1.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/cache-base/-/cache-base-1.0.1.tgz", + "integrity": "sha512-AKcdTnFSWATd5/GCPRxr2ChwIJ85CeyrEyjRHlKxQ56d4XJMGym0uAiKn0xbLOGOl3+yRpOTi484dVCEc5AUzQ==", + "dev": true, + "requires": { + "collection-visit": "^1.0.0", + "component-emitter": "^1.2.1", + "get-value": "^2.0.6", + "has-value": "^1.0.0", + "isobject": "^3.0.1", + "set-value": "^2.0.0", + "to-object-path": "^0.3.0", + "union-value": "^1.0.0", + "unset-value": "^1.0.0" + } + }, + "cache-loader": { + "version": "1.2.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/cache-loader/-/cache-loader-1.2.2.tgz", + "integrity": "sha512-rsGh4SIYyB9glU+d0OcHwiXHXBoUgDhHZaQ1KAbiXqfz1CDPxtTboh1gPbJ0q2qdO8a9lfcjgC5CJ2Ms32y5bw==", + "dev": true, + "requires": { + "loader-utils": "^1.1.0", + "mkdirp": "^0.5.1", + "neo-async": "^2.5.0", + "schema-utils": "^0.4.2" + } + }, + "cacheable-request": { + "version": "2.1.4", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/cacheable-request/-/cacheable-request-2.1.4.tgz", + "integrity": "sha1-DYCIAbY0KtM8kd+dC0TcCbkeXD0=", + "dev": true, + "requires": { + "clone-response": "1.0.2", + "get-stream": "3.0.0", + "http-cache-semantics": "3.8.1", + "keyv": "3.0.0", + "lowercase-keys": "1.0.0", + "normalize-url": "2.0.1", + "responselike": "1.0.2" + }, + "dependencies": { + "lowercase-keys": { + "version": "1.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/lowercase-keys/-/lowercase-keys-1.0.0.tgz", + "integrity": "sha1-TjNms55/VFfjXxMkvfb4jQv8cwY=", + "dev": true + }, + "normalize-url": { + "version": "2.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/normalize-url/-/normalize-url-2.0.1.tgz", + "integrity": "sha512-D6MUW4K/VzoJ4rJ01JFKxDrtY1v9wrgzCX5f2qj/lzH1m/lW6MhUZFKerVsnyjOhOsYzI9Kqqak+10l4LvLpMw==", + "dev": true, + "requires": { + "prepend-http": "^2.0.0", + "query-string": "^5.0.1", + "sort-keys": "^2.0.0" + } + }, + "prepend-http": { + "version": "2.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/prepend-http/-/prepend-http-2.0.0.tgz", + "integrity": "sha1-6SQ0v6XqjBn0HN/UAddBo8gZ2Jc=", + "dev": true + }, + "query-string": { + "version": "5.1.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/query-string/-/query-string-5.1.1.tgz", + "integrity": "sha512-gjWOsm2SoGlgLEdAGt7a6slVOk9mGiXmPFMqrEhLQ68rhQuBnpfs3+EmlvqKyxnCo9/PPlF+9MtY02S1aFg+Jw==", + "dev": true, + "requires": { + "decode-uri-component": "^0.2.0", + "object-assign": "^4.1.0", + "strict-uri-encode": "^1.0.0" + } + }, + "sort-keys": { + "version": "2.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/sort-keys/-/sort-keys-2.0.0.tgz", + "integrity": "sha1-ZYU1WEhh7JfXMNbPQYIuH1ZoQSg=", + "dev": true, + "requires": { + "is-plain-obj": "^1.0.0" + } + } + } + }, + "call-me-maybe": { + "version": "1.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/call-me-maybe/-/call-me-maybe-1.0.1.tgz", + "integrity": "sha1-JtII6onje1y95gJQoV8DHBak1ms=", + "dev": true + }, + "callsite": { + "version": "1.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/callsite/-/callsite-1.0.0.tgz", + "integrity": "sha1-KAOY5dZkvXQDi28JBRU+borxvCA=", + "dev": true + }, + "callsites": { + "version": "2.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/callsites/-/callsites-2.0.0.tgz", + "integrity": "sha1-BuuE8A7qQT2oav/vrL/7Ngk7PFA=", + "dev": true + }, + "camel-case": { + "version": "3.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/camel-case/-/camel-case-3.0.0.tgz", + "integrity": "sha1-yjw2iKTpzzpM2nd9xNy8cTJJz3M=", + "dev": true, + "requires": { + "no-case": "^2.2.0", + "upper-case": "^1.1.1" + } + }, + "camelcase": { + "version": "4.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/camelcase/-/camelcase-4.1.0.tgz", + "integrity": "sha1-1UVjW+HjPFQmScaRc+Xeas+uNN0=", + "dev": true + }, + "camelcase-keys": { + "version": "4.2.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/camelcase-keys/-/camelcase-keys-4.2.0.tgz", + "integrity": "sha1-oqpfsa9oh1glnDLBQUJteJI7m3c=", + "dev": true, + "requires": { + "camelcase": "^4.1.0", + "map-obj": "^2.0.0", + "quick-lru": "^1.0.0" + } + }, + "caniuse-api": { + "version": "1.6.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/caniuse-api/-/caniuse-api-1.6.1.tgz", + "integrity": "sha1-tTTnxzTE+B7F++isoq0kNUuWLGw=", + "dev": true, + "requires": { + "browserslist": "^1.3.6", + "caniuse-db": "^1.0.30000529", + "lodash.memoize": "^4.1.2", + "lodash.uniq": "^4.5.0" + } + }, + "caniuse-db": { + "version": "1.0.30000835", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/caniuse-db/-/caniuse-db-1.0.30000835.tgz", + "integrity": "sha1-ZVaTHN8DWQPYZV1jA/lQG1kV++k=", + "dev": true + }, + "caniuse-lite": { + "version": "1.0.30000885", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/caniuse-lite/-/caniuse-lite-1.0.30000885.tgz", + "integrity": "sha512-cXKbYwpxBLd7qHyej16JazPoUacqoVuDhvR61U7Fr5vSxMUiodzcYa1rQYRYfZ5GexV03vGZHd722vNPLjPJGQ==", + "dev": true + }, + "caseless": { + "version": "0.12.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/caseless/-/caseless-0.12.0.tgz", + "integrity": "sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw=", + "dev": true + }, + "center-align": { + "version": "0.1.3", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/center-align/-/center-align-0.1.3.tgz", + "integrity": "sha1-qg0yYptu6XIgBBHL1EYckHvCt60=", + "dev": true, + "optional": true, + "requires": { + "align-text": "^0.1.3", + "lazy-cache": "^1.0.3" + } + }, + "chalk": { + "version": "1.1.3", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/chalk/-/chalk-1.1.3.tgz", + "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", + "dev": true, + "requires": { + "ansi-styles": "^2.2.1", + "escape-string-regexp": "^1.0.2", + "has-ansi": "^2.0.0", + "strip-ansi": "^3.0.0", + "supports-color": "^2.0.0" + } + }, + "chardet": { + "version": "0.4.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/chardet/-/chardet-0.4.2.tgz", + "integrity": "sha1-tUc7M9yXxCTl2Y3IfVXU2KKci/I=", + "dev": true + }, + "chevrotain": { + "version": "4.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/chevrotain/-/chevrotain-4.1.0.tgz", + "integrity": "sha512-iwuK4FOV+vZlvKonoXVw6G+rXJm4jWk17aJFkm6FloVYcVSrAaJLdCdQo+IIyX98jm0WJVcdK9cllRZQpNBnBg==", + "dev": true, + "requires": { + "regexp-to-ast": "0.3.5" + } + }, + "chokidar": { + "version": "2.0.4", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/chokidar/-/chokidar-2.0.4.tgz", + "integrity": "sha512-z9n7yt9rOvIJrMhvDtDictKrkFHeihkNl6uWMmZlmL6tJtX9Cs+87oK+teBx+JIgzvbX3yZHT3eF8vpbDxHJXQ==", + "dev": true, + "requires": { + "anymatch": "^2.0.0", + "async-each": "^1.0.0", + "braces": "^2.3.0", + "fsevents": "^1.2.2", + "glob-parent": "^3.1.0", + "inherits": "^2.0.1", + "is-binary-path": "^1.0.0", + "is-glob": "^4.0.0", + "lodash.debounce": "^4.0.8", + "normalize-path": "^2.1.1", + "path-is-absolute": "^1.0.0", + "readdirp": "^2.0.0", + "upath": "^1.0.5" + } + }, + "chownr": { + "version": "1.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/chownr/-/chownr-1.0.1.tgz", + "integrity": "sha1-4qdQQqlVGQi+vSW4Uj1fl2nXkYE=", + "dev": true + }, + "chrome-trace-event": { + "version": "0.1.3", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/chrome-trace-event/-/chrome-trace-event-0.1.3.tgz", + "integrity": "sha512-sjndyZHrrWiu4RY7AkHgjn80GfAM2ZSzUkZLV/Js59Ldmh6JDThf0SUmOHU53rFu2rVxxfCzJ30Ukcfch3Gb/A==", + "dev": true + }, + "ci-info": { + "version": "1.6.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/ci-info/-/ci-info-1.6.0.tgz", + "integrity": "sha512-vsGdkwSCDpWmP80ncATX7iea5DWQemg1UgCW5J8tqjU3lYw4FBYuj89J0CTVomA7BEfvSZd84GmHko+MxFQU2A==", + "dev": true + }, + "cipher-base": { + "version": "1.0.4", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/cipher-base/-/cipher-base-1.0.4.tgz", + "integrity": "sha512-Kkht5ye6ZGmwv40uUDZztayT2ThLQGfnj/T71N/XzeZeo3nf8foyW7zGTsPYkEya3m5f3cAypH+qe7YOrM1U2Q==", + "dev": true, + "requires": { + "inherits": "^2.0.1", + "safe-buffer": "^5.0.1" + } + }, + "clap": { + "version": "1.2.3", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/clap/-/clap-1.2.3.tgz", + "integrity": "sha512-4CoL/A3hf90V3VIEjeuhSvlGFEHKzOz+Wfc2IVZc+FaUgU0ZQafJTP49fvnULipOPcAfqhyI2duwQyns6xqjYA==", + "dev": true, + "requires": { + "chalk": "^1.1.3" + } + }, + "class-utils": { + "version": "0.3.6", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/class-utils/-/class-utils-0.3.6.tgz", + "integrity": "sha512-qOhPa/Fj7s6TY8H8esGu5QNpMMQxz79h+urzrNYN6mn+9BnxlDGf5QZ+XeCDsxSjPqsSR56XOZOJmpeurnLMeg==", + "dev": true, + "requires": { + "arr-union": "^3.1.0", + "define-property": "^0.2.5", + "isobject": "^3.0.0", + "static-extend": "^0.1.1" + }, + "dependencies": { + "define-property": { + "version": "0.2.5", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/define-property/-/define-property-0.2.5.tgz", + "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", + "dev": true, + "requires": { + "is-descriptor": "^0.1.0" + } + } + } + }, + "clean-css": { + "version": "4.1.11", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/clean-css/-/clean-css-4.1.11.tgz", + "integrity": "sha1-Ls3xRaujj1R0DybO/Q/z4D4SXWo=", + "dev": true, + "requires": { + "source-map": "0.5.x" + } + }, + "cli-cursor": { + "version": "2.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/cli-cursor/-/cli-cursor-2.1.0.tgz", + "integrity": "sha1-s12sN2R5+sw+lHR9QdDQ9SOP/LU=", + "dev": true, + "requires": { + "restore-cursor": "^2.0.0" + } + }, + "cli-spinners": { + "version": "0.1.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/cli-spinners/-/cli-spinners-0.1.2.tgz", + "integrity": "sha1-u3ZNiOGF+54eaiofGXcjGPYF4xw=", + "dev": true + }, + "cli-table": { + "version": "0.3.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/cli-table/-/cli-table-0.3.1.tgz", + "integrity": "sha1-9TsFJmqLGguTSz0IIebi3FkUriM=", + "dev": true, + "requires": { + "colors": "1.0.3" + }, + "dependencies": { + "colors": { + "version": "1.0.3", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/colors/-/colors-1.0.3.tgz", + "integrity": "sha1-BDP0TYCWgP3rYO0mDxsMJi6CpAs=", + "dev": true + } + } + }, + "cli-truncate": { + "version": "0.2.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/cli-truncate/-/cli-truncate-0.2.1.tgz", + "integrity": "sha1-nxXPuwcFAFNpIWxiasfQWrkN1XQ=", + "dev": true, + "requires": { + "slice-ansi": "0.0.4", + "string-width": "^1.0.1" + } + }, + "cli-width": { + "version": "2.2.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/cli-width/-/cli-width-2.2.0.tgz", + "integrity": "sha1-/xnt6Kml5XkyQUewwR8PvLq+1jk=", + "dev": true + }, + "cliui": { + "version": "3.2.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/cliui/-/cliui-3.2.0.tgz", + "integrity": "sha1-EgYBU3qRbSmUD5NNo7SNWFo5IT0=", + "dev": true, + "requires": { + "string-width": "^1.0.1", + "strip-ansi": "^3.0.1", + "wrap-ansi": "^2.0.0" + } + }, + "clone": { + "version": "1.0.4", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/clone/-/clone-1.0.4.tgz", + "integrity": "sha1-2jCcwmPfFZlMaIypAheco8fNfH4=", + "dev": true + }, + "clone-buffer": { + "version": "1.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/clone-buffer/-/clone-buffer-1.0.0.tgz", + "integrity": "sha1-4+JbIHrE5wGvch4staFnksrD3Fg=", + "dev": true + }, + "clone-deep": { + "version": "2.0.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/clone-deep/-/clone-deep-2.0.2.tgz", + "integrity": "sha512-SZegPTKjCgpQH63E+eN6mVEEPdQBOUzjyJm5Pora4lrwWRFS8I0QAxV/KD6vV/i0WuijHZWQC1fMsPEdxfdVCQ==", + "dev": true, + "requires": { + "for-own": "^1.0.0", + "is-plain-object": "^2.0.4", + "kind-of": "^6.0.0", + "shallow-clone": "^1.0.0" + }, + "dependencies": { + "for-own": { + "version": "1.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/for-own/-/for-own-1.0.0.tgz", + "integrity": "sha1-xjMy9BXO3EsE2/5wz4NklMU8tEs=", + "dev": true, + "requires": { + "for-in": "^1.0.1" + } + } + } + }, + "clone-response": { + "version": "1.0.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/clone-response/-/clone-response-1.0.2.tgz", + "integrity": "sha1-0dyXOSAxTfZ/vrlCI7TuNQI56Ws=", + "dev": true, + "requires": { + "mimic-response": "^1.0.0" + } + }, + "clone-stats": { + "version": "0.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/clone-stats/-/clone-stats-0.0.1.tgz", + "integrity": "sha1-uI+UqCzzi4eR1YBG6kAprYjKmdE=", + "dev": true + }, + "cloneable-readable": { + "version": "1.1.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/cloneable-readable/-/cloneable-readable-1.1.2.tgz", + "integrity": "sha512-Bq6+4t+lbM8vhTs/Bef5c5AdEMtapp/iFb6+s4/Hh9MVTt8OLKH7ZOOZSCT+Ys7hsHvqv0GuMPJ1lnQJVHvxpg==", + "dev": true, + "requires": { + "inherits": "^2.0.1", + "process-nextick-args": "^2.0.0", + "readable-stream": "^2.3.5" + } + }, + "co": { + "version": "4.6.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/co/-/co-4.6.0.tgz", + "integrity": "sha1-bqa989hTrlTMuOR7+gvz+QMfsYQ=", + "dev": true + }, + "coa": { + "version": "1.0.4", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/coa/-/coa-1.0.4.tgz", + "integrity": "sha1-qe8VNmDWqGqL3sAomlxoTSF0Mv0=", + "dev": true, + "requires": { + "q": "^1.1.2" + } + }, + "code-point-at": { + "version": "1.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/code-point-at/-/code-point-at-1.1.0.tgz", + "integrity": "sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c=", + "dev": true + }, + "codelyzer": { + "version": "4.2.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/codelyzer/-/codelyzer-4.2.1.tgz", + "integrity": "sha512-CKwfgpfkqi9dyzy4s6ELaxJ54QgJ6A8iTSsM4bzHbLuTpbKncvNc3DUlCvpnkHBhK47gEf4qFsWoYqLrJPhy6g==", + "dev": true, + "requires": { + "app-root-path": "^2.0.1", + "css-selector-tokenizer": "^0.7.0", + "cssauron": "^1.4.0", + "semver-dsl": "^1.0.1", + "source-map": "^0.5.6", + "sprintf-js": "^1.0.3" + } + }, + "collection-visit": { + "version": "1.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/collection-visit/-/collection-visit-1.0.0.tgz", + "integrity": "sha1-S8A3PBZLwykbTTaMgpzxqApZ3KA=", + "dev": true, + "requires": { + "map-visit": "^1.0.0", + "object-visit": "^1.0.0" + } + }, + "color": { + "version": "0.11.4", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/color/-/color-0.11.4.tgz", + "integrity": "sha1-bXtcdPtl6EHNSHkq0e1eB7kE12Q=", + "dev": true, + "requires": { + "clone": "^1.0.2", + "color-convert": "^1.3.0", + "color-string": "^0.3.0" + } + }, + "color-convert": { + "version": "1.9.3", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/color-convert/-/color-convert-1.9.3.tgz", + "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", + "dev": true, + "requires": { + "color-name": "1.1.3" + } + }, + "color-name": { + "version": "1.1.3", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/color-name/-/color-name-1.1.3.tgz", + "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=", + "dev": true + }, + "color-string": { + "version": "0.3.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/color-string/-/color-string-0.3.0.tgz", + "integrity": "sha1-J9RvtnAlxcL6JZk7+/V55HhBuZE=", + "dev": true, + "requires": { + "color-name": "^1.0.0" + } + }, + "colormin": { + "version": "1.1.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/colormin/-/colormin-1.1.2.tgz", + "integrity": "sha1-6i90IKcrlogaOKrlnsEkpvcpgTM=", + "dev": true, + "requires": { + "color": "^0.11.0", + "css-color-names": "0.0.4", + "has": "^1.0.1" + } + }, + "colornames": { + "version": "1.1.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/colornames/-/colornames-1.1.1.tgz", + "integrity": "sha1-+IiQMGhcfE/54qVZ9Qd+t2qBb5Y=", + "dev": true + }, + "colors": { + "version": "1.1.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/colors/-/colors-1.1.2.tgz", + "integrity": "sha1-FopHAXVran9RoSzgyXv6KMCE7WM=", + "dev": true + }, + "colorspace": { + "version": "1.1.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/colorspace/-/colorspace-1.1.1.tgz", + "integrity": "sha512-pI3btWyiuz7Ken0BWh9Elzsmv2bM9AhA7psXib4anUXy/orfZ/E0MbQwhSOG/9L8hLlalqrU0UhOuqxW1YjmVw==", + "dev": true, + "requires": { + "color": "3.0.x", + "text-hex": "1.0.x" + }, + "dependencies": { + "color": { + "version": "3.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/color/-/color-3.0.0.tgz", + "integrity": "sha512-jCpd5+s0s0t7p3pHQKpnJ0TpQKKdleP71LWcA0aqiljpiuAkOSUFN/dyH8ZwF0hRmFlrIuRhufds1QyEP9EB+w==", + "dev": true, + "requires": { + "color-convert": "^1.9.1", + "color-string": "^1.5.2" + } + }, + "color-string": { + "version": "1.5.3", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/color-string/-/color-string-1.5.3.tgz", + "integrity": "sha512-dC2C5qeWoYkxki5UAXapdjqO672AM4vZuPGRQfO8b5HKuKGBbKWpITyDYN7TOFKvRW7kOgAn3746clDBMDJyQw==", + "dev": true, + "requires": { + "color-name": "^1.0.0", + "simple-swizzle": "^0.2.2" + } + } + } + }, + "combined-stream": { + "version": "1.0.7", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/combined-stream/-/combined-stream-1.0.7.tgz", + "integrity": "sha512-brWl9y6vOB1xYPZcpZde3N9zDByXTosAeMDo4p1wzo6UMOX4vumB+TP1RZ76sfE6Md68Q0NJSrE/gbezd4Ul+w==", + "dev": true, + "requires": { + "delayed-stream": "~1.0.0" + } + }, + "commander": { + "version": "2.19.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/commander/-/commander-2.19.0.tgz", + "integrity": "sha512-6tvAOO+D6OENvRAh524Dh9jcfKTYDQAqvqezbCW82xj5X0pSrcpxtvRKHLG0yBY6SD7PSDrJaj+0AiOcKVd1Xg==", + "dev": true + }, + "common-tags": { + "version": "1.8.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/common-tags/-/common-tags-1.8.0.tgz", + "integrity": "sha512-6P6g0uetGpW/sdyUy/iQQCbFF0kWVMSIVSyYz7Zgjcgh8mgw8PQzDNZeyZ5DQ2gM7LBoZPHmnjz8rUthkBG5tw==", + "dev": true + }, + "commondir": { + "version": "1.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/commondir/-/commondir-1.0.1.tgz", + "integrity": "sha1-3dgA2gxmEnOTzKWVDqloo6rxJTs=", + "dev": true + }, + "commoner": { + "version": "0.10.8", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/commoner/-/commoner-0.10.8.tgz", + "integrity": "sha1-NPw2cs0kOT6LtH5wyqApOBH08sU=", + "dev": true, + "requires": { + "commander": "^2.5.0", + "detective": "^4.3.1", + "glob": "^5.0.15", + "graceful-fs": "^4.1.2", + "iconv-lite": "^0.4.5", + "mkdirp": "^0.5.0", + "private": "^0.1.6", + "q": "^1.1.2", + "recast": "^0.11.17" + }, + "dependencies": { + "glob": { + "version": "5.0.15", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/glob/-/glob-5.0.15.tgz", + "integrity": "sha1-G8k2ueAvSmA/zCIuz3Yz0wuLk7E=", + "dev": true, + "requires": { + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "2 || 3", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + } + } + } + }, + "compare-versions": { + "version": "3.3.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/compare-versions/-/compare-versions-3.3.0.tgz", + "integrity": "sha512-MAAAIOdi2s4Gl6rZ76PNcUa9IOYB+5ICdT41o5uMRf09aEu/F9RK+qhe8RjXNPwcTjGV7KU7h2P/fljThFVqyQ==", + "dev": true + }, + "component-bind": { + "version": "1.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/component-bind/-/component-bind-1.0.0.tgz", + "integrity": "sha1-AMYIq33Nk4l8AAllGx06jh5zu9E=", + "dev": true + }, + "component-emitter": { + "version": "1.2.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/component-emitter/-/component-emitter-1.2.1.tgz", + "integrity": "sha1-E3kY1teCg/ffemt8WmPhQOaUJeY=", + "dev": true + }, + "component-inherit": { + "version": "0.0.3", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/component-inherit/-/component-inherit-0.0.3.tgz", + "integrity": "sha1-ZF/ErfWLcrZJ1crmUTVhnbJv8UM=", + "dev": true + }, + "compressible": { + "version": "2.0.14", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/compressible/-/compressible-2.0.14.tgz", + "integrity": "sha1-MmxfUH+7BV9UEWeCuWmoG2einac=", + "dev": true, + "requires": { + "mime-db": ">= 1.34.0 < 2" + } + }, + "compression": { + "version": "1.7.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/compression/-/compression-1.7.2.tgz", + "integrity": "sha1-qv+81qr4VLROuygDU9WtFlH1mmk=", + "dev": true, + "requires": { + "accepts": "~1.3.4", + "bytes": "3.0.0", + "compressible": "~2.0.13", + "debug": "2.6.9", + "on-headers": "~1.0.1", + "safe-buffer": "5.1.1", + "vary": "~1.1.2" + }, + "dependencies": { + "safe-buffer": { + "version": "5.1.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/safe-buffer/-/safe-buffer-5.1.1.tgz", + "integrity": "sha512-kKvNJn6Mm93gAczWVJg7wH+wGYWNrDHdWvpUmHyEsgCtIwwo3bqPtV4tR5tuPaUhTOo/kvhVwd8XwwOllGYkbg==", + "dev": true + } + } + }, + "concat-map": { + "version": "0.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", + "dev": true + }, + "concat-stream": { + "version": "1.6.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/concat-stream/-/concat-stream-1.6.2.tgz", + "integrity": "sha512-27HBghJxjiZtIk3Ycvn/4kbJk/1uZuJFfuPEns6LaEvpvG1f0hTea8lilrouyo9mVc2GWdcEZ8OLoGmSADlrCw==", + "dev": true, + "requires": { + "buffer-from": "^1.0.0", + "inherits": "^2.0.3", + "readable-stream": "^2.2.2", + "typedarray": "^0.0.6" + } + }, + "conf": { + "version": "2.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/conf/-/conf-2.0.0.tgz", + "integrity": "sha512-iCLzBsGFi8S73EANsEJZz0JnJ/e5VZef/kSaxydYZLAvw0rFNAUx5R7K5leC/CXXR2mZfXWhUvcZOO/dM2D5xg==", + "dev": true, + "requires": { + "dot-prop": "^4.1.0", + "env-paths": "^1.0.0", + "make-dir": "^1.0.0", + "pkg-up": "^2.0.0", + "write-file-atomic": "^2.3.0" + } + }, + "connect": { + "version": "3.6.6", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/connect/-/connect-3.6.6.tgz", + "integrity": "sha1-Ce/2xVr3I24TcTWnJXSFi2eG9SQ=", + "dev": true, + "requires": { + "debug": "2.6.9", + "finalhandler": "1.1.0", + "parseurl": "~1.3.2", + "utils-merge": "1.0.1" + } + }, + "connect-history-api-fallback": { + "version": "1.5.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/connect-history-api-fallback/-/connect-history-api-fallback-1.5.0.tgz", + "integrity": "sha1-sGhzk0vF40T+9hGhlqb6rgruAVo=", + "dev": true + }, + "console-browserify": { + "version": "1.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/console-browserify/-/console-browserify-1.1.0.tgz", + "integrity": "sha1-8CQcRXMKn8YyOyBtvzjtx0HQuxA=", + "dev": true, + "requires": { + "date-now": "^0.1.4" + } + }, + "console-control-strings": { + "version": "1.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/console-control-strings/-/console-control-strings-1.1.0.tgz", + "integrity": "sha1-PXz0Rk22RG6mRL9LOVB/mFEAjo4=", + "dev": true + }, + "constants-browserify": { + "version": "1.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/constants-browserify/-/constants-browserify-1.0.0.tgz", + "integrity": "sha1-wguW2MYXdIqvHBYCF2DNJ/y4y3U=", + "dev": true + }, + "content-disposition": { + "version": "0.5.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/content-disposition/-/content-disposition-0.5.2.tgz", + "integrity": "sha1-DPaLud318r55YcOoUXjLhdunjLQ=", + "dev": true + }, + "content-type": { + "version": "1.0.4", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/content-type/-/content-type-1.0.4.tgz", + "integrity": "sha512-hIP3EEPs8tB9AT1L+NUqtwOAps4mk2Zob89MWXMHjHWg9milF/j4osnnQLXBCBFBk/tvIG/tUc9mOUJiPBhPXA==", + "dev": true + }, + "convert-source-map": { + "version": "1.5.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/convert-source-map/-/convert-source-map-1.5.1.tgz", + "integrity": "sha1-uCeAl7m8IpNl3lxiz1/K7YtVmeU=", + "dev": true + }, + "cookie": { + "version": "0.3.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/cookie/-/cookie-0.3.1.tgz", + "integrity": "sha1-5+Ch+e9DtMi6klxcWpboBtFoc7s=", + "dev": true + }, + "cookie-signature": { + "version": "1.0.6", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/cookie-signature/-/cookie-signature-1.0.6.tgz", + "integrity": "sha1-4wOogrNCzD7oylE6eZmXNNqzriw=", + "dev": true + }, + "copy-concurrently": { + "version": "1.0.5", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/copy-concurrently/-/copy-concurrently-1.0.5.tgz", + "integrity": "sha512-f2domd9fsVDFtaFcbaRZuYXwtdmnzqbADSwhSWYxYB/Q8zsdUUFMXVRwXGDMWmbEzAn1kdRrtI1T/KTFOL4X2A==", + "dev": true, + "requires": { + "aproba": "^1.1.1", + "fs-write-stream-atomic": "^1.0.8", + "iferr": "^0.1.5", + "mkdirp": "^0.5.1", + "rimraf": "^2.5.4", + "run-queue": "^1.0.0" + } + }, + "copy-descriptor": { + "version": "0.1.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/copy-descriptor/-/copy-descriptor-0.1.1.tgz", + "integrity": "sha1-Z29us8OZl8LuGsOpJP1hJHSPV40=", + "dev": true + }, + "copy-webpack-plugin": { + "version": "4.5.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/copy-webpack-plugin/-/copy-webpack-plugin-4.5.1.tgz", + "integrity": "sha512-OlTo6DYg0XfTKOF8eLf79wcHm4Ut10xU2cRBRPMW/NA5F9VMjZGTfRHWDIYC3s+1kObGYrBLshXWU1K0hILkNQ==", + "dev": true, + "requires": { + "cacache": "^10.0.4", + "find-cache-dir": "^1.0.0", + "globby": "^7.1.1", + "is-glob": "^4.0.0", + "loader-utils": "^1.1.0", + "minimatch": "^3.0.4", + "p-limit": "^1.0.0", + "serialize-javascript": "^1.4.0" + } + }, + "core-js": { + "version": "2.5.7", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/core-js/-/core-js-2.5.7.tgz", + "integrity": "sha512-RszJCAxg/PP6uzXVXL6BsxSXx/B05oJAQ2vkJRjyjrEcNVycaqOmNb5OTxZPE3xa5gwZduqza6L9JOCenh/Ecw==" + }, + "core-util-is": { + "version": "1.0.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/core-util-is/-/core-util-is-1.0.2.tgz", + "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=", + "dev": true + }, + "cosmiconfig": { + "version": "5.0.6", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/cosmiconfig/-/cosmiconfig-5.0.6.tgz", + "integrity": "sha512-6DWfizHriCrFWURP1/qyhsiFvYdlJzbCzmtFWh744+KyWsJo5+kPzUZZaMRSSItoYc0pxFX7gEO7ZC1/gN/7AQ==", + "dev": true, + "requires": { + "is-directory": "^0.3.1", + "js-yaml": "^3.9.0", + "parse-json": "^4.0.0" + }, + "dependencies": { + "esprima": { + "version": "4.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/esprima/-/esprima-4.0.1.tgz", + "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==", + "dev": true + }, + "js-yaml": { + "version": "3.12.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/js-yaml/-/js-yaml-3.12.0.tgz", + "integrity": "sha512-PIt2cnwmPfL4hKNwqeiuz4bKfnzHTBv6HyVgjahA6mPLwPDzjDWrplJBMjHUFxku/N3FlmrbyPclad+I+4mJ3A==", + "dev": true, + "requires": { + "argparse": "^1.0.7", + "esprima": "^4.0.0" + } + }, + "parse-json": { + "version": "4.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/parse-json/-/parse-json-4.0.0.tgz", + "integrity": "sha1-vjX1Qlvh9/bHRxhPmKeIy5lHfuA=", + "dev": true, + "requires": { + "error-ex": "^1.3.1", + "json-parse-better-errors": "^1.0.1" + } + } + } + }, + "cpx": { + "version": "1.5.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/cpx/-/cpx-1.5.0.tgz", + "integrity": "sha1-GFvgGFEdhycN7czCkxceN2VauI8=", + "dev": true, + "requires": { + "babel-runtime": "^6.9.2", + "chokidar": "^1.6.0", + "duplexer": "^0.1.1", + "glob": "^7.0.5", + "glob2base": "^0.0.12", + "minimatch": "^3.0.2", + "mkdirp": "^0.5.1", + "resolve": "^1.1.7", + "safe-buffer": "^5.0.1", + "shell-quote": "^1.6.1", + "subarg": "^1.0.0" + }, + "dependencies": { + "anymatch": { + "version": "1.3.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/anymatch/-/anymatch-1.3.2.tgz", + "integrity": "sha512-0XNayC8lTHQ2OI8aljNCN3sSx6hsr/1+rlcDAotXJR7C1oZZHCNsfpbKwMjRA3Uqb5tF1Rae2oloTr4xpq+WjA==", + "dev": true, + "requires": { + "micromatch": "^2.1.5", + "normalize-path": "^2.0.0" + } + }, + "arr-diff": { + "version": "2.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/arr-diff/-/arr-diff-2.0.0.tgz", + "integrity": "sha1-jzuCf5Vai9ZpaX5KQlasPOrjVs8=", + "dev": true, + "requires": { + "arr-flatten": "^1.0.1" + } + }, + "array-unique": { + "version": "0.2.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/array-unique/-/array-unique-0.2.1.tgz", + "integrity": "sha1-odl8yvy8JiXMcPrc6zalDFiwGlM=", + "dev": true + }, + "braces": { + "version": "1.8.5", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/braces/-/braces-1.8.5.tgz", + "integrity": "sha1-uneWLhLf+WnWt2cR6RS3N4V79qc=", + "dev": true, + "requires": { + "expand-range": "^1.8.1", + "preserve": "^0.2.0", + "repeat-element": "^1.1.2" + } + }, + "chokidar": { + "version": "1.7.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/chokidar/-/chokidar-1.7.0.tgz", + "integrity": "sha1-eY5ol3gVHIB2tLNg5e3SjNortGg=", + "dev": true, + "requires": { + "anymatch": "^1.3.0", + "async-each": "^1.0.0", + "fsevents": "^1.0.0", + "glob-parent": "^2.0.0", + "inherits": "^2.0.1", + "is-binary-path": "^1.0.0", + "is-glob": "^2.0.0", + "path-is-absolute": "^1.0.0", + "readdirp": "^2.0.0" + } + }, + "expand-brackets": { + "version": "0.1.5", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/expand-brackets/-/expand-brackets-0.1.5.tgz", + "integrity": "sha1-3wcoTjQqgHzXM6xa9yQR5YHRF3s=", + "dev": true, + "requires": { + "is-posix-bracket": "^0.1.0" + } + }, + "extglob": { + "version": "0.3.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/extglob/-/extglob-0.3.2.tgz", + "integrity": "sha1-Lhj/PS9JqydlzskCPwEdqo2DSaE=", + "dev": true, + "requires": { + "is-extglob": "^1.0.0" + } + }, + "glob-parent": { + "version": "2.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/glob-parent/-/glob-parent-2.0.0.tgz", + "integrity": "sha1-gTg9ctsFT8zPUzbaqQLxgvbtuyg=", + "dev": true, + "requires": { + "is-glob": "^2.0.0" + } + }, + "is-extglob": { + "version": "1.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/is-extglob/-/is-extglob-1.0.0.tgz", + "integrity": "sha1-rEaBd8SUNAWgkvyPKXYMb/xiBsA=", + "dev": true + }, + "is-glob": { + "version": "2.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/is-glob/-/is-glob-2.0.1.tgz", + "integrity": "sha1-0Jb5JqPe1WAPP9/ZEZjLCIjC2GM=", + "dev": true, + "requires": { + "is-extglob": "^1.0.0" + } + }, + "kind-of": { + "version": "3.2.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true, + "requires": { + "is-buffer": "^1.1.5" + } + }, + "micromatch": { + "version": "2.3.11", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/micromatch/-/micromatch-2.3.11.tgz", + "integrity": "sha1-hmd8l9FyCzY0MdBNDRUpO9OMFWU=", + "dev": true, + "requires": { + "arr-diff": "^2.0.0", + "array-unique": "^0.2.1", + "braces": "^1.8.2", + "expand-brackets": "^0.1.4", + "extglob": "^0.3.1", + "filename-regex": "^2.0.0", + "is-extglob": "^1.0.0", + "is-glob": "^2.0.1", + "kind-of": "^3.0.2", + "normalize-path": "^2.0.1", + "object.omit": "^2.0.0", + "parse-glob": "^3.0.4", + "regex-cache": "^0.4.2" + } + } + } + }, + "create-ecdh": { + "version": "4.0.3", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/create-ecdh/-/create-ecdh-4.0.3.tgz", + "integrity": "sha512-GbEHQPMOswGpKXM9kCWVrremUcBmjteUaQ01T9rkKCPDXfUHX0IoP9LpHYo2NPFampa4e+/pFDc3jQdxrxQLaw==", + "dev": true, + "requires": { + "bn.js": "^4.1.0", + "elliptic": "^6.0.0" + } + }, + "create-hash": { + "version": "1.2.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/create-hash/-/create-hash-1.2.0.tgz", + "integrity": "sha512-z00bCGNHDG8mHAkP7CtT1qVu+bFQUPjYq/4Iv3C3kWjTFV10zIjfSoeqXo9Asws8gwSHDGj/hl2u4OGIjapeCg==", + "dev": true, + "requires": { + "cipher-base": "^1.0.1", + "inherits": "^2.0.1", + "md5.js": "^1.3.4", + "ripemd160": "^2.0.1", + "sha.js": "^2.4.0" + } + }, + "create-hmac": { + "version": "1.1.7", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/create-hmac/-/create-hmac-1.1.7.tgz", + "integrity": "sha512-MJG9liiZ+ogc4TzUwuvbER1JRdgvUFSB5+VR/g5h82fGaIRWMWddtKBHi7/sVhfjQZ6SehlyhvQYrcYkaUIpLg==", + "dev": true, + "requires": { + "cipher-base": "^1.0.3", + "create-hash": "^1.1.0", + "inherits": "^2.0.1", + "ripemd160": "^2.0.0", + "safe-buffer": "^5.0.1", + "sha.js": "^2.4.8" + } + }, + "cross-spawn": { + "version": "5.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/cross-spawn/-/cross-spawn-5.1.0.tgz", + "integrity": "sha1-6L0O/uWPz/b4+UUQoKVUu/ojVEk=", + "dev": true, + "requires": { + "lru-cache": "^4.0.1", + "shebang-command": "^1.2.0", + "which": "^1.2.9" + } + }, + "crypto-browserify": { + "version": "3.12.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/crypto-browserify/-/crypto-browserify-3.12.0.tgz", + "integrity": "sha512-fz4spIh+znjO2VjL+IdhEpRJ3YN6sMzITSBijk6FK2UvTqruSQW+/cCZTSNsMiZNvUeq0CqurF+dAbyiGOY6Wg==", + "dev": true, + "requires": { + "browserify-cipher": "^1.0.0", + "browserify-sign": "^4.0.0", + "create-ecdh": "^4.0.0", + "create-hash": "^1.1.0", + "create-hmac": "^1.1.0", + "diffie-hellman": "^5.0.0", + "inherits": "^2.0.1", + "pbkdf2": "^3.0.3", + "public-encrypt": "^4.0.0", + "randombytes": "^2.0.0", + "randomfill": "^1.0.3" + } + }, + "css-color-names": { + "version": "0.0.4", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/css-color-names/-/css-color-names-0.0.4.tgz", + "integrity": "sha1-gIrcLnnPhHOAabZGyyDsJ762KeA=", + "dev": true + }, + "css-declaration-sorter": { + "version": "3.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/css-declaration-sorter/-/css-declaration-sorter-3.0.1.tgz", + "integrity": "sha512-jH4024SHZ3e0M7ann9VxpFpH3moplRXNz9ZBqvFMZqi09Yo5ARbs2wdPH8GqN9iRTlQynrbGbraNbBxBLei85Q==", + "dev": true, + "requires": { + "postcss": "^6.0.0", + "timsort": "^0.3.0" + }, + "dependencies": { + "ansi-styles": { + "version": "3.2.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, + "requires": { + "color-convert": "^1.9.0" + } + }, + "chalk": { + "version": "2.4.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/chalk/-/chalk-2.4.1.tgz", + "integrity": "sha512-ObN6h1v2fTJSmUXoS3nMQ92LbDK9be4TV+6G+omQlGJFdcUX5heKi1LZ1YnRMIgwTLEj3E24bT6tYni50rlCfQ==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + } + }, + "has-flag": { + "version": "3.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", + "dev": true + }, + "postcss": { + "version": "6.0.23", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/postcss/-/postcss-6.0.23.tgz", + "integrity": "sha512-soOk1h6J3VMTZtVeVpv15/Hpdl2cBLX3CAw4TAbkpTJiNPk9YP/zWcD1ND+xEtvyuuvKzbxliTOIyvkSeSJ6ag==", + "dev": true, + "requires": { + "chalk": "^2.4.1", + "source-map": "^0.6.1", + "supports-color": "^5.4.0" + } + }, + "source-map": { + "version": "0.6.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "dev": true + }, + "supports-color": { + "version": "5.5.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } + } + } + }, + "css-loader": { + "version": "0.28.10", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/css-loader/-/css-loader-0.28.10.tgz", + "integrity": "sha512-X1IJteKnW9Llmrd+lJ0f7QZHh9Arf+11S7iRcoT2+riig3BK0QaCaOtubAulMK6Itbo08W6d3l8sW21r+Jhp5Q==", + "dev": true, + "requires": { + "babel-code-frame": "^6.26.0", + "css-selector-tokenizer": "^0.7.0", + "cssnano": "^3.10.0", + "icss-utils": "^2.1.0", + "loader-utils": "^1.0.2", + "lodash.camelcase": "^4.3.0", + "object-assign": "^4.1.1", + "postcss": "^5.0.6", + "postcss-modules-extract-imports": "^1.2.0", + "postcss-modules-local-by-default": "^1.2.0", + "postcss-modules-scope": "^1.1.0", + "postcss-modules-values": "^1.3.0", + "postcss-value-parser": "^3.3.0", + "source-list-map": "^2.0.0" + } + }, + "css-select": { + "version": "1.2.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/css-select/-/css-select-1.2.0.tgz", + "integrity": "sha1-KzoRBTnFNV8c2NMUYj6HCxIeyFg=", + "dev": true, + "requires": { + "boolbase": "~1.0.0", + "css-what": "2.1", + "domutils": "1.5.1", + "nth-check": "~1.0.1" + } + }, + "css-select-base-adapter": { + "version": "0.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/css-select-base-adapter/-/css-select-base-adapter-0.1.0.tgz", + "integrity": "sha1-AQKz0UYw34bD65+p9UVicBBs+ZA=", + "dev": true + }, + "css-selector-tokenizer": { + "version": "0.7.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/css-selector-tokenizer/-/css-selector-tokenizer-0.7.0.tgz", + "integrity": "sha1-5piEdK6MlTR3v15+/s/OzNnPTIY=", + "dev": true, + "requires": { + "cssesc": "^0.1.0", + "fastparse": "^1.1.1", + "regexpu-core": "^1.0.0" + } + }, + "css-tree": { + "version": "1.0.0-alpha25", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/css-tree/-/css-tree-1.0.0-alpha25.tgz", + "integrity": "sha512-XC6xLW/JqIGirnZuUWHXCHRaAjje2b3OIB0Vj5RIJo6mIi/AdJo30quQl5LxUl0gkXDIrTrFGbMlcZjyFplz1A==", + "dev": true, + "requires": { + "mdn-data": "^1.0.0", + "source-map": "^0.5.3" + } + }, + "css-unit-converter": { + "version": "1.1.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/css-unit-converter/-/css-unit-converter-1.1.1.tgz", + "integrity": "sha1-2bkoGtz9jO2TW9urqDeGiX9k6ZY=", + "dev": true + }, + "css-url-regex": { + "version": "1.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/css-url-regex/-/css-url-regex-1.1.0.tgz", + "integrity": "sha1-g4NCMMyfdMRX3lnuvRVD/uuDt+w=", + "dev": true + }, + "css-what": { + "version": "2.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/css-what/-/css-what-2.1.0.tgz", + "integrity": "sha1-lGfQMsOM+u+58teVASUwYvh/ob0=", + "dev": true + }, + "cssauron": { + "version": "1.4.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/cssauron/-/cssauron-1.4.0.tgz", + "integrity": "sha1-pmAt/34EqDBtwNuaVR6S6LVmKtg=", + "dev": true, + "requires": { + "through": "X.X.X" + } + }, + "cssesc": { + "version": "0.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/cssesc/-/cssesc-0.1.0.tgz", + "integrity": "sha1-yBSQPkViM3GgR3tAEJqq++6t27Q=", + "dev": true + }, + "cssnano": { + "version": "3.10.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/cssnano/-/cssnano-3.10.0.tgz", + "integrity": "sha1-Tzj2zqK5sX+gFJDyPx3GjqZcHDg=", + "dev": true, + "requires": { + "autoprefixer": "^6.3.1", + "decamelize": "^1.1.2", + "defined": "^1.0.0", + "has": "^1.0.1", + "object-assign": "^4.0.1", + "postcss": "^5.0.14", + "postcss-calc": "^5.2.0", + "postcss-colormin": "^2.1.8", + "postcss-convert-values": "^2.3.4", + "postcss-discard-comments": "^2.0.4", + "postcss-discard-duplicates": "^2.0.1", + "postcss-discard-empty": "^2.0.1", + "postcss-discard-overridden": "^0.1.1", + "postcss-discard-unused": "^2.2.1", + "postcss-filter-plugins": "^2.0.0", + "postcss-merge-idents": "^2.1.5", + "postcss-merge-longhand": "^2.0.1", + "postcss-merge-rules": "^2.0.3", + "postcss-minify-font-values": "^1.0.2", + "postcss-minify-gradients": "^1.0.1", + "postcss-minify-params": "^1.0.4", + "postcss-minify-selectors": "^2.0.4", + "postcss-normalize-charset": "^1.1.0", + "postcss-normalize-url": "^3.0.7", + "postcss-ordered-values": "^2.1.0", + "postcss-reduce-idents": "^2.2.2", + "postcss-reduce-initial": "^1.0.0", + "postcss-reduce-transforms": "^1.0.3", + "postcss-svgo": "^2.1.1", + "postcss-unique-selectors": "^2.0.2", + "postcss-value-parser": "^3.2.3", + "postcss-zindex": "^2.0.1" + } + }, + "cssnano-preset-default": { + "version": "4.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/cssnano-preset-default/-/cssnano-preset-default-4.0.0.tgz", + "integrity": "sha1-wzQoe099SfstFwqS+SFGVXiOO2s=", + "dev": true, + "requires": { + "css-declaration-sorter": "^3.0.0", + "cssnano-util-raw-cache": "^4.0.0", + "postcss": "^6.0.0", + "postcss-calc": "^6.0.0", + "postcss-colormin": "^4.0.0", + "postcss-convert-values": "^4.0.0", + "postcss-discard-comments": "^4.0.0", + "postcss-discard-duplicates": "^4.0.0", + "postcss-discard-empty": "^4.0.0", + "postcss-discard-overridden": "^4.0.0", + "postcss-merge-longhand": "^4.0.0", + "postcss-merge-rules": "^4.0.0", + "postcss-minify-font-values": "^4.0.0", + "postcss-minify-gradients": "^4.0.0", + "postcss-minify-params": "^4.0.0", + "postcss-minify-selectors": "^4.0.0", + "postcss-normalize-charset": "^4.0.0", + "postcss-normalize-display-values": "^4.0.0", + "postcss-normalize-positions": "^4.0.0", + "postcss-normalize-repeat-style": "^4.0.0", + "postcss-normalize-string": "^4.0.0", + "postcss-normalize-timing-functions": "^4.0.0", + "postcss-normalize-unicode": "^4.0.0", + "postcss-normalize-url": "^4.0.0", + "postcss-normalize-whitespace": "^4.0.0", + "postcss-ordered-values": "^4.0.0", + "postcss-reduce-initial": "^4.0.0", + "postcss-reduce-transforms": "^4.0.0", + "postcss-svgo": "^4.0.0", + "postcss-unique-selectors": "^4.0.0" + }, + "dependencies": { + "ansi-styles": { + "version": "3.2.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, + "requires": { + "color-convert": "^1.9.0" + } + }, + "browserslist": { + "version": "4.1.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/browserslist/-/browserslist-4.1.1.tgz", + "integrity": "sha512-VBorw+tgpOtZ1BYhrVSVTzTt/3+vSE3eFUh0N2GCFK1HffceOaf32YS/bs6WiFhjDAblAFrx85jMy3BG9fBK2Q==", + "dev": true, + "requires": { + "caniuse-lite": "^1.0.30000884", + "electron-to-chromium": "^1.3.62", + "node-releases": "^1.0.0-alpha.11" + } + }, + "caniuse-api": { + "version": "3.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/caniuse-api/-/caniuse-api-3.0.0.tgz", + "integrity": "sha512-bsTwuIg/BZZK/vreVTYYbSWoe2F+71P7K5QGEX+pT250DZbfU1MQ5prOKpPR+LL6uWKK3KMwMCAS74QB3Um1uw==", + "dev": true, + "requires": { + "browserslist": "^4.0.0", + "caniuse-lite": "^1.0.0", + "lodash.memoize": "^4.1.2", + "lodash.uniq": "^4.5.0" + } + }, + "chalk": { + "version": "2.4.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/chalk/-/chalk-2.4.1.tgz", + "integrity": "sha512-ObN6h1v2fTJSmUXoS3nMQ92LbDK9be4TV+6G+omQlGJFdcUX5heKi1LZ1YnRMIgwTLEj3E24bT6tYni50rlCfQ==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + } + }, + "coa": { + "version": "2.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/coa/-/coa-2.0.1.tgz", + "integrity": "sha512-5wfTTO8E2/ja4jFSxePXlG5nRu5bBtL/r1HCIpJW/lzT6yDtKl0u0Z4o/Vpz32IpKmBn7HerheEZQgA9N2DarQ==", + "dev": true, + "requires": { + "q": "^1.1.2" + } + }, + "color": { + "version": "3.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/color/-/color-3.1.0.tgz", + "integrity": "sha512-CwyopLkuRYO5ei2EpzpIh6LqJMt6Mt+jZhO5VI5f/wJLZriXQE32/SSqzmrh+QB+AZT81Cj8yv+7zwToW8ahZg==", + "dev": true, + "requires": { + "color-convert": "^1.9.1", + "color-string": "^1.5.2" + } + }, + "color-string": { + "version": "1.5.3", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/color-string/-/color-string-1.5.3.tgz", + "integrity": "sha512-dC2C5qeWoYkxki5UAXapdjqO672AM4vZuPGRQfO8b5HKuKGBbKWpITyDYN7TOFKvRW7kOgAn3746clDBMDJyQw==", + "dev": true, + "requires": { + "color-name": "^1.0.0", + "simple-swizzle": "^0.2.2" + } + }, + "css-select": { + "version": "1.3.0-rc0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/css-select/-/css-select-1.3.0-rc0.tgz", + "integrity": "sha1-b5MZaqrnN2ZuoQNqjLFKj8t6kjE=", + "dev": true, + "requires": { + "boolbase": "^1.0.0", + "css-what": "2.1", + "domutils": "1.5.1", + "nth-check": "^1.0.1" + } + }, + "csso": { + "version": "3.5.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/csso/-/csso-3.5.0.tgz", + "integrity": "sha512-WtJjFP3ZsSdWhiZr4/k1B9uHPgYjFYnDxfbaJxk1hz5PDLIJ5BCRWkJqaztZ0DbP8d2ZIVwUPIJb2YmCwkPaMw==", + "dev": true, + "requires": { + "css-tree": "1.0.0-alpha.27" + }, + "dependencies": { + "css-tree": { + "version": "1.0.0-alpha.27", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/css-tree/-/css-tree-1.0.0-alpha.27.tgz", + "integrity": "sha512-BAYp9FyN4jLXjfvRpTDchBllDptqlK9I7OsagXCG9Am5C+5jc8eRZHgqb9x500W2OKS14MMlpQc/nmh/aA7TEQ==", + "dev": true, + "requires": { + "mdn-data": "^1.0.0", + "source-map": "^0.5.3" + } + }, + "source-map": { + "version": "0.5.7", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/source-map/-/source-map-0.5.7.tgz", + "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=", + "dev": true + } + } + }, + "esprima": { + "version": "4.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/esprima/-/esprima-4.0.1.tgz", + "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==", + "dev": true + }, + "has-flag": { + "version": "3.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", + "dev": true + }, + "is-svg": { + "version": "3.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/is-svg/-/is-svg-3.0.0.tgz", + "integrity": "sha512-gi4iHK53LR2ujhLVVj+37Ykh9GLqYHX6JOVXbLAucaG/Cqw9xwdFOjDM2qeifLs1sF1npXXFvDu0r5HNgCMrzQ==", + "dev": true, + "requires": { + "html-comment-regex": "^1.1.0" + } + }, + "js-yaml": { + "version": "3.10.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/js-yaml/-/js-yaml-3.10.0.tgz", + "integrity": "sha512-O2v52ffjLa9VeM43J4XocZE//WT9N0IiwDa3KSHH7Tu8CtH+1qM8SIZvnsTh6v+4yFy5KUY3BHUVwjpfAWsjIA==", + "dev": true, + "requires": { + "argparse": "^1.0.7", + "esprima": "^4.0.0" + } + }, + "normalize-url": { + "version": "3.3.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/normalize-url/-/normalize-url-3.3.0.tgz", + "integrity": "sha512-U+JJi7duF1o+u2pynbp2zXDW2/PADgC30f0GsHZtRh+HOcXHnw137TrNlyxxRvWW5fjKd3bcLHPxofWuCjaeZg==", + "dev": true + }, + "postcss": { + "version": "6.0.23", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/postcss/-/postcss-6.0.23.tgz", + "integrity": "sha512-soOk1h6J3VMTZtVeVpv15/Hpdl2cBLX3CAw4TAbkpTJiNPk9YP/zWcD1ND+xEtvyuuvKzbxliTOIyvkSeSJ6ag==", + "dev": true, + "requires": { + "chalk": "^2.4.1", + "source-map": "^0.6.1", + "supports-color": "^5.4.0" + } + }, + "postcss-calc": { + "version": "6.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/postcss-calc/-/postcss-calc-6.0.1.tgz", + "integrity": "sha1-PSQXG79udinUIqQ26/5t2VEfQzA=", + "dev": true, + "requires": { + "css-unit-converter": "^1.1.1", + "postcss": "^6.0.0", + "postcss-selector-parser": "^2.2.2", + "reduce-css-calc": "^2.0.0" + } + }, + "postcss-colormin": { + "version": "4.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/postcss-colormin/-/postcss-colormin-4.0.1.tgz", + "integrity": "sha1-bxwYoBVbxpYT8v8ThD4uSuj/C74=", + "dev": true, + "requires": { + "browserslist": "^4.0.0", + "color": "^3.0.0", + "has": "^1.0.0", + "postcss": "^6.0.0", + "postcss-value-parser": "^3.0.0" + } + }, + "postcss-convert-values": { + "version": "4.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/postcss-convert-values/-/postcss-convert-values-4.0.0.tgz", + "integrity": "sha1-d9d9mu0dxOaVbmUcw0nVMwWHb2I=", + "dev": true, + "requires": { + "postcss": "^6.0.0", + "postcss-value-parser": "^3.0.0" + } + }, + "postcss-discard-comments": { + "version": "4.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/postcss-discard-comments/-/postcss-discard-comments-4.0.0.tgz", + "integrity": "sha1-loSimedrPpMmPvj9KtvxocCP2I0=", + "dev": true, + "requires": { + "postcss": "^6.0.0" + } + }, + "postcss-discard-duplicates": { + "version": "4.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/postcss-discard-duplicates/-/postcss-discard-duplicates-4.0.0.tgz", + "integrity": "sha1-QvPCZ/hfqQngQsNXZ+z9Zcsr1yw=", + "dev": true, + "requires": { + "postcss": "^6.0.0" + } + }, + "postcss-discard-empty": { + "version": "4.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/postcss-discard-empty/-/postcss-discard-empty-4.0.0.tgz", + "integrity": "sha1-VeGKWcdBKOOMfSgEvPpAVmEfuX8=", + "dev": true, + "requires": { + "postcss": "^6.0.0" + } + }, + "postcss-discard-overridden": { + "version": "4.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/postcss-discard-overridden/-/postcss-discard-overridden-4.0.0.tgz", + "integrity": "sha1-Sgv4WXh4TPH4HtLBwf2dlkodofo=", + "dev": true, + "requires": { + "postcss": "^6.0.0" + } + }, + "postcss-merge-longhand": { + "version": "4.0.5", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/postcss-merge-longhand/-/postcss-merge-longhand-4.0.5.tgz", + "integrity": "sha512-tw2obF6I2VhXhPMObQc1QpQO850m3arhqP3PcBAU7Tx70v73QF6brs9uK0XKMNuC7BPo6DW+fh07cGhrLL57HA==", + "dev": true, + "requires": { + "css-color-names": "0.0.4", + "postcss": "^6.0.0", + "postcss-value-parser": "^3.0.0", + "stylehacks": "^4.0.0" + } + }, + "postcss-merge-rules": { + "version": "4.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/postcss-merge-rules/-/postcss-merge-rules-4.0.1.tgz", + "integrity": "sha1-Qw/Vmz8u0uivzQsxJ47aOYVKuxA=", + "dev": true, + "requires": { + "browserslist": "^4.0.0", + "caniuse-api": "^3.0.0", + "cssnano-util-same-parent": "^4.0.0", + "postcss": "^6.0.0", + "postcss-selector-parser": "^3.0.0", + "vendors": "^1.0.0" + }, + "dependencies": { + "postcss-selector-parser": { + "version": "3.1.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/postcss-selector-parser/-/postcss-selector-parser-3.1.1.tgz", + "integrity": "sha1-T4dfSvsMllc9XPTXQBGu4lCn6GU=", + "dev": true, + "requires": { + "dot-prop": "^4.1.1", + "indexes-of": "^1.0.1", + "uniq": "^1.0.1" + } + } + } + }, + "postcss-minify-font-values": { + "version": "4.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/postcss-minify-font-values/-/postcss-minify-font-values-4.0.0.tgz", + "integrity": "sha1-TMM9KD1qgXWQNudX75gdksvYW+0=", + "dev": true, + "requires": { + "postcss": "^6.0.0", + "postcss-value-parser": "^3.0.0" + } + }, + "postcss-minify-gradients": { + "version": "4.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/postcss-minify-gradients/-/postcss-minify-gradients-4.0.0.tgz", + "integrity": "sha1-P8ORZDnSepu4Bm23za2AFlDrCQ4=", + "dev": true, + "requires": { + "cssnano-util-get-arguments": "^4.0.0", + "is-color-stop": "^1.0.0", + "postcss": "^6.0.0", + "postcss-value-parser": "^3.0.0" + } + }, + "postcss-minify-params": { + "version": "4.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/postcss-minify-params/-/postcss-minify-params-4.0.0.tgz", + "integrity": "sha1-BekWbuSMBa9lGYnOhNOcG015BnQ=", + "dev": true, + "requires": { + "alphanum-sort": "^1.0.0", + "cssnano-util-get-arguments": "^4.0.0", + "postcss": "^6.0.0", + "postcss-value-parser": "^3.0.0", + "uniqs": "^2.0.0" + } + }, + "postcss-minify-selectors": { + "version": "4.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/postcss-minify-selectors/-/postcss-minify-selectors-4.0.0.tgz", + "integrity": "sha1-sen2xGNBbT/Nyybnt4XZX2FXiq0=", + "dev": true, + "requires": { + "alphanum-sort": "^1.0.0", + "has": "^1.0.0", + "postcss": "^6.0.0", + "postcss-selector-parser": "^3.0.0" + }, + "dependencies": { + "postcss-selector-parser": { + "version": "3.1.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/postcss-selector-parser/-/postcss-selector-parser-3.1.1.tgz", + "integrity": "sha1-T4dfSvsMllc9XPTXQBGu4lCn6GU=", + "dev": true, + "requires": { + "dot-prop": "^4.1.1", + "indexes-of": "^1.0.1", + "uniq": "^1.0.1" + } + } + } + }, + "postcss-normalize-charset": { + "version": "4.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/postcss-normalize-charset/-/postcss-normalize-charset-4.0.0.tgz", + "integrity": "sha1-JFJyknAtXoEp6vo9HeSe1RpqtzA=", + "dev": true, + "requires": { + "postcss": "^6.0.0" + } + }, + "postcss-normalize-url": { + "version": "4.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/postcss-normalize-url/-/postcss-normalize-url-4.0.0.tgz", + "integrity": "sha1-t6nIrSbPJmlMFG6y1ovQz0mVbw0=", + "dev": true, + "requires": { + "is-absolute-url": "^2.0.0", + "normalize-url": "^3.0.0", + "postcss": "^6.0.0", + "postcss-value-parser": "^3.0.0" + } + }, + "postcss-ordered-values": { + "version": "4.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/postcss-ordered-values/-/postcss-ordered-values-4.1.0.tgz", + "integrity": "sha512-gbqbEiONKKJgoOKhtzBjFqmHSzviPL4rv0ACVcFS7wxWXBY07agFXRQ7Y3eMGV0ZORzQXp2NGnj0c+imJG0NcA==", + "dev": true, + "requires": { + "cssnano-util-get-arguments": "^4.0.0", + "postcss": "^6.0.0", + "postcss-value-parser": "^3.0.0" + } + }, + "postcss-reduce-initial": { + "version": "4.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/postcss-reduce-initial/-/postcss-reduce-initial-4.0.1.tgz", + "integrity": "sha1-8tWPUM6isMXcEnjW6l7Q/1gpwpM=", + "dev": true, + "requires": { + "browserslist": "^4.0.0", + "caniuse-api": "^3.0.0", + "has": "^1.0.0", + "postcss": "^6.0.0" + } + }, + "postcss-reduce-transforms": { + "version": "4.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/postcss-reduce-transforms/-/postcss-reduce-transforms-4.0.0.tgz", + "integrity": "sha1-9kX8dEDDUnT0DegQThStcWPt8Yg=", + "dev": true, + "requires": { + "cssnano-util-get-match": "^4.0.0", + "has": "^1.0.0", + "postcss": "^6.0.0", + "postcss-value-parser": "^3.0.0" + } + }, + "postcss-svgo": { + "version": "4.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/postcss-svgo/-/postcss-svgo-4.0.0.tgz", + "integrity": "sha1-wLutAlIPxjbJ14sOhAPi5RXDIoU=", + "dev": true, + "requires": { + "is-svg": "^3.0.0", + "postcss": "^6.0.0", + "postcss-value-parser": "^3.0.0", + "svgo": "^1.0.0" + } + }, + "postcss-unique-selectors": { + "version": "4.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/postcss-unique-selectors/-/postcss-unique-selectors-4.0.0.tgz", + "integrity": "sha1-BMHpdkx1h0JhMDQCxB8Ol2n8VQE=", + "dev": true, + "requires": { + "alphanum-sort": "^1.0.0", + "postcss": "^6.0.0", + "uniqs": "^2.0.0" + } + }, + "reduce-css-calc": { + "version": "2.1.4", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/reduce-css-calc/-/reduce-css-calc-2.1.4.tgz", + "integrity": "sha512-i/vWQbyd3aJRmip9OVSN9V6nIjLf/gg/ctxb0CpvHWtcRysFl/ngDBQD+rqavxdw/doScA3GMBXhzkHQ4GCzFQ==", + "dev": true, + "requires": { + "css-unit-converter": "^1.1.1", + "postcss-value-parser": "^3.3.0" + } + }, + "source-map": { + "version": "0.6.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "dev": true + }, + "supports-color": { + "version": "5.5.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } + }, + "svgo": { + "version": "1.0.5", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/svgo/-/svgo-1.0.5.tgz", + "integrity": "sha512-nYrifviB77aNKDNKKyuay3M9aYiK6Hv5gJVDdjj2ZXTQmI8WZc8+UPLR5IpVlktJfSu3co/4XcWgrgI6seGBPg==", + "dev": true, + "requires": { + "coa": "~2.0.1", + "colors": "~1.1.2", + "css-select": "~1.3.0-rc0", + "css-select-base-adapter": "~0.1.0", + "css-tree": "1.0.0-alpha25", + "css-url-regex": "^1.1.0", + "csso": "^3.5.0", + "js-yaml": "~3.10.0", + "mkdirp": "~0.5.1", + "object.values": "^1.0.4", + "sax": "~1.2.4", + "stable": "~0.1.6", + "unquote": "~1.1.1", + "util.promisify": "~1.0.0" + } + } + } + }, + "cssnano-util-get-arguments": { + "version": "4.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/cssnano-util-get-arguments/-/cssnano-util-get-arguments-4.0.0.tgz", + "integrity": "sha1-7ToIKZ8h11dBsg87gfGU7UnMFQ8=", + "dev": true + }, + "cssnano-util-get-match": { + "version": "4.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/cssnano-util-get-match/-/cssnano-util-get-match-4.0.0.tgz", + "integrity": "sha1-wOTKB/U4a7F+xeUiULT1lhNlFW0=", + "dev": true + }, + "cssnano-util-raw-cache": { + "version": "4.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/cssnano-util-raw-cache/-/cssnano-util-raw-cache-4.0.0.tgz", + "integrity": "sha1-vgooVuJfGF9feivMBiTii38Xmp8=", + "dev": true, + "requires": { + "postcss": "^6.0.0" + }, + "dependencies": { + "ansi-styles": { + "version": "3.2.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, + "requires": { + "color-convert": "^1.9.0" + } + }, + "chalk": { + "version": "2.4.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/chalk/-/chalk-2.4.1.tgz", + "integrity": "sha512-ObN6h1v2fTJSmUXoS3nMQ92LbDK9be4TV+6G+omQlGJFdcUX5heKi1LZ1YnRMIgwTLEj3E24bT6tYni50rlCfQ==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + } + }, + "has-flag": { + "version": "3.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", + "dev": true + }, + "postcss": { + "version": "6.0.23", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/postcss/-/postcss-6.0.23.tgz", + "integrity": "sha512-soOk1h6J3VMTZtVeVpv15/Hpdl2cBLX3CAw4TAbkpTJiNPk9YP/zWcD1ND+xEtvyuuvKzbxliTOIyvkSeSJ6ag==", + "dev": true, + "requires": { + "chalk": "^2.4.1", + "source-map": "^0.6.1", + "supports-color": "^5.4.0" + } + }, + "source-map": { + "version": "0.6.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "dev": true + }, + "supports-color": { + "version": "5.5.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } + } + } + }, + "cssnano-util-same-parent": { + "version": "4.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/cssnano-util-same-parent/-/cssnano-util-same-parent-4.0.0.tgz", + "integrity": "sha1-0qPeEDmqmLxOwlAB+gUDMMKhbaw=", + "dev": true + }, + "csso": { + "version": "2.3.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/csso/-/csso-2.3.2.tgz", + "integrity": "sha1-3dUsWHAz9J6Utx/FVWnyUuj/X4U=", + "dev": true, + "requires": { + "clap": "^1.0.9", + "source-map": "^0.5.3" + } + }, + "cssom": { + "version": "0.3.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/cssom/-/cssom-0.3.2.tgz", + "integrity": "sha1-uANhcMefB6kP8vFuIihAJ6JDhIs=", + "dev": true + }, + "cssstyle": { + "version": "0.2.37", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/cssstyle/-/cssstyle-0.2.37.tgz", + "integrity": "sha1-VBCXI0yyUTyDzu06zdwn/yeYfVQ=", + "dev": true, + "requires": { + "cssom": "0.3.x" + } + }, + "currently-unhandled": { + "version": "0.4.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/currently-unhandled/-/currently-unhandled-0.4.1.tgz", + "integrity": "sha1-mI3zP+qxke95mmE2nddsF635V+o=", + "dev": true, + "requires": { + "array-find-index": "^1.0.1" + } + }, + "cyclist": { + "version": "0.2.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/cyclist/-/cyclist-0.2.2.tgz", + "integrity": "sha1-GzN5LhHpFKL9bW7WRHRkRE5fpkA=", + "dev": true + }, + "d": { + "version": "1.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/d/-/d-1.0.0.tgz", + "integrity": "sha1-dUu1v+VUUdpppYuU1F9MWwRi1Y8=", + "dev": true, + "requires": { + "es5-ext": "^0.10.9" + } + }, + "d3": { + "version": "3.5.17", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/d3/-/d3-3.5.17.tgz", + "integrity": "sha1-vEZ0gAQ3iyGjYMn8fPUjF5B2L7g=", + "dev": true + }, + "dargs": { + "version": "6.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/dargs/-/dargs-6.0.0.tgz", + "integrity": "sha512-6lJauzNaI7MiM8EHQWmGj+s3rP5/i1nYs8GAvKrLAx/9dpc9xS/4seFb1ioR39A+kcfu4v3jnEa/EE5qWYnitQ==", + "dev": true + }, + "dashdash": { + "version": "1.14.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/dashdash/-/dashdash-1.14.1.tgz", + "integrity": "sha1-hTz6D3y+L+1d4gMmuN1YEDX24vA=", + "dev": true, + "requires": { + "assert-plus": "^1.0.0" + } + }, + "data-urls": { + "version": "1.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/data-urls/-/data-urls-1.0.0.tgz", + "integrity": "sha512-ai40PPQR0Fn1lD2PPie79CibnlMN2AYiDhwFX/rZHVsxbs5kNJSjegqXIprhouGXlRdEnfybva7kqRGnB6mypA==", + "dev": true, + "requires": { + "abab": "^1.0.4", + "whatwg-mimetype": "^2.0.0", + "whatwg-url": "^6.4.0" + } + }, + "date-fns": { + "version": "1.29.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/date-fns/-/date-fns-1.29.0.tgz", + "integrity": "sha512-lbTXWZ6M20cWH8N9S6afb0SBm6tMk+uUg6z3MqHPKE9atmsY3kJkTm8vKe93izJ2B2+q5MV990sM2CHgtAZaOw==", + "dev": true + }, + "date-now": { + "version": "0.1.4", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/date-now/-/date-now-0.1.4.tgz", + "integrity": "sha1-6vQ5/U1ISK105cx9vvIAZyueNFs=", + "dev": true + }, + "dateformat": { + "version": "3.0.3", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/dateformat/-/dateformat-3.0.3.tgz", + "integrity": "sha512-jyCETtSl3VMZMWeRo7iY1FL19ges1t55hMo5yaam4Jrsm5EPL89UQkoQRyiI+Yf4k8r2ZpdngkV8hr1lIdjb3Q==", + "dev": true + }, + "debug": { + "version": "2.6.9", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "dev": true, + "requires": { + "ms": "2.0.0" + } + }, + "decamelize": { + "version": "1.2.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/decamelize/-/decamelize-1.2.0.tgz", + "integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=", + "dev": true + }, + "decamelize-keys": { + "version": "1.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/decamelize-keys/-/decamelize-keys-1.1.0.tgz", + "integrity": "sha1-0XGoeTMlKAfrPLYdwcFEXQeN8tk=", + "dev": true, + "requires": { + "decamelize": "^1.1.0", + "map-obj": "^1.0.0" + }, + "dependencies": { + "map-obj": { + "version": "1.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/map-obj/-/map-obj-1.0.1.tgz", + "integrity": "sha1-2TPOuSBdgr3PSIb2dCvcK03qFG0=", + "dev": true + } + } + }, + "decode-uri-component": { + "version": "0.2.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/decode-uri-component/-/decode-uri-component-0.2.0.tgz", + "integrity": "sha1-6zkTMzRYd1y4TNGh+uBiEGu4dUU=", + "dev": true + }, + "decompress-response": { + "version": "3.3.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/decompress-response/-/decompress-response-3.3.0.tgz", + "integrity": "sha1-gKTdMjdIOEv6JICDYirt7Jgq3/M=", + "dev": true, + "requires": { + "mimic-response": "^1.0.0" + } + }, + "dedent": { + "version": "0.7.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/dedent/-/dedent-0.7.0.tgz", + "integrity": "sha1-JJXduvbrh0q7Dhvp3yLS5aVEMmw=", + "dev": true + }, + "deep-equal": { + "version": "1.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/deep-equal/-/deep-equal-1.0.1.tgz", + "integrity": "sha1-9dJgKStmDghO/0zbyfCK0yR0SLU=", + "dev": true + }, + "deep-extend": { + "version": "0.6.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/deep-extend/-/deep-extend-0.6.0.tgz", + "integrity": "sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA==", + "dev": true + }, + "deep-is": { + "version": "0.1.3", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/deep-is/-/deep-is-0.1.3.tgz", + "integrity": "sha1-s2nW+128E+7PUk+RsHD+7cNXzzQ=", + "dev": true + }, + "default-require-extensions": { + "version": "2.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/default-require-extensions/-/default-require-extensions-2.0.0.tgz", + "integrity": "sha1-9fj7sYp9bVCyH2QfZJ67Uiz+JPc=", + "dev": true, + "requires": { + "strip-bom": "^3.0.0" + }, + "dependencies": { + "strip-bom": { + "version": "3.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/strip-bom/-/strip-bom-3.0.0.tgz", + "integrity": "sha1-IzTBjpx1n3vdVv3vfprj1YjmjtM=", + "dev": true + } + } + }, + "define-properties": { + "version": "1.1.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/define-properties/-/define-properties-1.1.2.tgz", + "integrity": "sha1-g6c/L+pWmJj7c3GTyPhzyvbUXJQ=", + "dev": true, + "requires": { + "foreach": "^2.0.5", + "object-keys": "^1.0.8" + } + }, + "define-property": { + "version": "2.0.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/define-property/-/define-property-2.0.2.tgz", + "integrity": "sha512-jwK2UV4cnPpbcG7+VRARKTZPUWowwXA8bzH5NP6ud0oeAxyYPuGZUAC7hMugpCdz4BeSZl2Dl9k66CHJ/46ZYQ==", + "dev": true, + "requires": { + "is-descriptor": "^1.0.2", + "isobject": "^3.0.1" + }, + "dependencies": { + "is-accessor-descriptor": { + "version": "1.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz", + "integrity": "sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ==", + "dev": true, + "requires": { + "kind-of": "^6.0.0" + } + }, + "is-data-descriptor": { + "version": "1.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz", + "integrity": "sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ==", + "dev": true, + "requires": { + "kind-of": "^6.0.0" + } + }, + "is-descriptor": { + "version": "1.0.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/is-descriptor/-/is-descriptor-1.0.2.tgz", + "integrity": "sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg==", + "dev": true, + "requires": { + "is-accessor-descriptor": "^1.0.0", + "is-data-descriptor": "^1.0.0", + "kind-of": "^6.0.2" + } + } + } + }, + "defined": { + "version": "1.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/defined/-/defined-1.0.0.tgz", + "integrity": "sha1-yY2bzvdWdBiOEQlpFRGZ45sfppM=", + "dev": true + }, + "del": { + "version": "3.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/del/-/del-3.0.0.tgz", + "integrity": "sha1-U+z2mf/LyzljdpGrE7rxYIGXZuU=", + "dev": true, + "requires": { + "globby": "^6.1.0", + "is-path-cwd": "^1.0.0", + "is-path-in-cwd": "^1.0.0", + "p-map": "^1.1.1", + "pify": "^3.0.0", + "rimraf": "^2.2.8" + }, + "dependencies": { + "globby": { + "version": "6.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/globby/-/globby-6.1.0.tgz", + "integrity": "sha1-9abXDoOV4hyFj7BInWTfAkJNUGw=", + "dev": true, + "requires": { + "array-union": "^1.0.1", + "glob": "^7.0.3", + "object-assign": "^4.0.1", + "pify": "^2.0.0", + "pinkie-promise": "^2.0.0" + }, + "dependencies": { + "pify": { + "version": "2.3.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/pify/-/pify-2.3.0.tgz", + "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=", + "dev": true + } + } + }, + "pify": { + "version": "3.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/pify/-/pify-3.0.0.tgz", + "integrity": "sha1-5aSs0sEB/fPZpNB/DbxNtJ3SgXY=", + "dev": true + } + } + }, + "delayed-stream": { + "version": "1.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/delayed-stream/-/delayed-stream-1.0.0.tgz", + "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=", + "dev": true + }, + "delegates": { + "version": "1.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/delegates/-/delegates-1.0.0.tgz", + "integrity": "sha1-hMbhWbgZBP3KWaDvRM2HDTElD5o=", + "dev": true + }, + "depd": { + "version": "1.1.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/depd/-/depd-1.1.2.tgz", + "integrity": "sha1-m81S4UwJd2PnSbJ0xDRu0uVgtak=", + "dev": true + }, + "des.js": { + "version": "1.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/des.js/-/des.js-1.0.0.tgz", + "integrity": "sha1-wHTS4qpqipoH29YfmhXCzYPsjsw=", + "dev": true, + "requires": { + "inherits": "^2.0.1", + "minimalistic-assert": "^1.0.0" + } + }, + "destroy": { + "version": "1.0.4", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/destroy/-/destroy-1.0.4.tgz", + "integrity": "sha1-l4hXRCxEdJ5CBmE+N5RiBYJqvYA=", + "dev": true + }, + "detect-conflict": { + "version": "1.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/detect-conflict/-/detect-conflict-1.0.1.tgz", + "integrity": "sha1-CIZXpmqWHAUBnbfEIwiDsca0F24=", + "dev": true + }, + "detect-indent": { + "version": "4.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/detect-indent/-/detect-indent-4.0.0.tgz", + "integrity": "sha1-920GQ1LN9Docts5hnE7jqUdd4gg=", + "dev": true, + "requires": { + "repeating": "^2.0.0" + } + }, + "detect-newline": { + "version": "2.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/detect-newline/-/detect-newline-2.1.0.tgz", + "integrity": "sha1-9B8cEL5LAOh7XxPaaAdZ8sW/0+I=", + "dev": true + }, + "detect-node": { + "version": "2.0.3", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/detect-node/-/detect-node-2.0.3.tgz", + "integrity": "sha1-ogM8CcyOFY03dI+951B4Mr1s4Sc=", + "dev": true + }, + "detective": { + "version": "4.7.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/detective/-/detective-4.7.1.tgz", + "integrity": "sha512-H6PmeeUcZloWtdt4DAkFyzFL94arpHr3NOwwmVILFiy+9Qd4JTxxXrzfyGk/lmct2qVGBwTSwSXagqu2BxmWig==", + "dev": true, + "requires": { + "acorn": "^5.2.1", + "defined": "^1.0.0" + } + }, + "dev-ip": { + "version": "1.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/dev-ip/-/dev-ip-1.0.1.tgz", + "integrity": "sha1-p2o+0YVb56ASu4rBbLgPPADcKPA=", + "dev": true + }, + "diagnostics": { + "version": "1.1.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/diagnostics/-/diagnostics-1.1.1.tgz", + "integrity": "sha512-8wn1PmdunLJ9Tqbx+Fx/ZEuHfJf4NKSN2ZBj7SJC/OWRWha843+WsTjqMe1B5E3p28jqBlp+mJ2fPVxPyNgYKQ==", + "dev": true, + "requires": { + "colorspace": "1.1.x", + "enabled": "1.0.x", + "kuler": "1.0.x" + } + }, + "didyoumean": { + "version": "1.2.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/didyoumean/-/didyoumean-1.2.1.tgz", + "integrity": "sha1-6S7f2tplN9SE1zwBcv0eugxJdv8=", + "dev": true + }, + "diff": { + "version": "3.5.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/diff/-/diff-3.5.0.tgz", + "integrity": "sha512-A46qtFgd+g7pDZinpnwiRJtxbC1hpgf0uzP3iG89scHk0AUC7A1TGxf5OiiOUv/JMZR8GOt8hL900hV0bOy5xA==", + "dev": true + }, + "diffie-hellman": { + "version": "5.0.3", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/diffie-hellman/-/diffie-hellman-5.0.3.tgz", + "integrity": "sha512-kqag/Nl+f3GwyK25fhUMYj81BUOrZ9IuJsjIcDE5icNM9FJHAVm3VcUDxdLPoQtTuUylWm6ZIknYJwwaPxsUzg==", + "dev": true, + "requires": { + "bn.js": "^4.1.0", + "miller-rabin": "^4.0.0", + "randombytes": "^2.0.0" + } + }, + "dir-glob": { + "version": "2.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/dir-glob/-/dir-glob-2.0.0.tgz", + "integrity": "sha512-37qirFDz8cA5fimp9feo43fSuRo2gHwaIn6dXL8Ber1dGwUosDrGZeCCXq57WnIqE4aQ+u3eQZzsk1yOzhdwag==", + "dev": true, + "requires": { + "arrify": "^1.0.1", + "path-type": "^3.0.0" + }, + "dependencies": { + "path-type": { + "version": "3.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/path-type/-/path-type-3.0.0.tgz", + "integrity": "sha512-T2ZUsdZFHgA3u4e5PfPbjd7HDDpxPnQb5jN0SrDsjNSuVXHJqtwTnWqG0B1jZrgmJ/7lj1EmVIByWt1gxGkWvg==", + "dev": true, + "requires": { + "pify": "^3.0.0" + } + }, + "pify": { + "version": "3.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/pify/-/pify-3.0.0.tgz", + "integrity": "sha1-5aSs0sEB/fPZpNB/DbxNtJ3SgXY=", + "dev": true + } + } + }, + "dns-equal": { + "version": "1.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/dns-equal/-/dns-equal-1.0.0.tgz", + "integrity": "sha1-s55/HabrCnW6nBcySzR1PEfgZU0=", + "dev": true + }, + "dns-packet": { + "version": "1.3.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/dns-packet/-/dns-packet-1.3.1.tgz", + "integrity": "sha512-0UxfQkMhYAUaZI+xrNZOz/as5KgDU0M/fQ9b6SpkyLbk3GEswDi6PADJVaYJradtRVsRIlF1zLyOodbcTCDzUg==", + "dev": true, + "requires": { + "ip": "^1.1.0", + "safe-buffer": "^5.0.1" + } + }, + "dns-txt": { + "version": "2.0.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/dns-txt/-/dns-txt-2.0.2.tgz", + "integrity": "sha1-uR2Ab10nGI5Ks+fRB9iBocxGQrY=", + "dev": true, + "requires": { + "buffer-indexof": "^1.0.0" + } + }, + "dom-converter": { + "version": "0.1.4", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/dom-converter/-/dom-converter-0.1.4.tgz", + "integrity": "sha1-pF71cnuJDJv/5tfIduexnLDhfzs=", + "dev": true, + "requires": { + "utila": "~0.3" + }, + "dependencies": { + "utila": { + "version": "0.3.3", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/utila/-/utila-0.3.3.tgz", + "integrity": "sha1-1+jn1+MJEHCSsF+NloiCTWM6QiY=", + "dev": true + } + } + }, + "dom-serializer": { + "version": "0.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/dom-serializer/-/dom-serializer-0.1.0.tgz", + "integrity": "sha1-BzxpdUbOB4DOI75KKOKT5AvDDII=", + "dev": true, + "requires": { + "domelementtype": "~1.1.1", + "entities": "~1.1.1" + }, + "dependencies": { + "domelementtype": { + "version": "1.1.3", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/domelementtype/-/domelementtype-1.1.3.tgz", + "integrity": "sha1-vSh3PiZCiBrsUVRJJCmcXNgiGFs=", + "dev": true + } + } + }, + "domain-browser": { + "version": "1.2.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/domain-browser/-/domain-browser-1.2.0.tgz", + "integrity": "sha512-jnjyiM6eRyZl2H+W8Q/zLMA481hzi0eszAaBUzIVnmYVDBbnLxVNnfu1HgEBvCbL+71FrxMl3E6lpKH7Ge3OXA==", + "dev": true + }, + "domelementtype": { + "version": "1.3.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/domelementtype/-/domelementtype-1.3.0.tgz", + "integrity": "sha1-sXrtguirWeUt2cGbF1bg/BhyBMI=", + "dev": true + }, + "domexception": { + "version": "1.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/domexception/-/domexception-1.0.1.tgz", + "integrity": "sha512-raigMkn7CJNNo6Ihro1fzG7wr3fHuYVytzquZKX5n0yizGsTcYgzdIUwj1X9pK0VvjeihV+XiclP+DjwbsSKug==", + "dev": true, + "requires": { + "webidl-conversions": "^4.0.2" + } + }, + "domhandler": { + "version": "2.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/domhandler/-/domhandler-2.1.0.tgz", + "integrity": "sha1-0mRvXlf2w7qxHPbLBdPArPdBJZQ=", + "dev": true, + "requires": { + "domelementtype": "1" + } + }, + "domutils": { + "version": "1.5.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/domutils/-/domutils-1.5.1.tgz", + "integrity": "sha1-3NhIiib1Y9YQeeSMn3t+Mjc2gs8=", + "dev": true, + "requires": { + "dom-serializer": "0", + "domelementtype": "1" + } + }, + "dot-prop": { + "version": "4.2.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/dot-prop/-/dot-prop-4.2.0.tgz", + "integrity": "sha512-tUMXrxlExSW6U2EXiiKGSBVdYgtV8qlHL+C10TsW4PURY/ic+eaysnSkwB4kA/mBlCyy/IKDJ+Lc3wbWeaXtuQ==", + "dev": true, + "requires": { + "is-obj": "^1.0.0" + } + }, + "drange": { + "version": "1.1.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/drange/-/drange-1.1.1.tgz", + "integrity": "sha512-pYxfDYpued//QpnLIm4Avk7rsNtAtQkUES2cwAYSvD/wd2pKD71gN2Ebj3e7klzXwjocvE8c5vx/1fxwpqmSxA==", + "dev": true + }, + "duplexer": { + "version": "0.1.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/duplexer/-/duplexer-0.1.1.tgz", + "integrity": "sha1-rOb/gIwc5mtX0ev5eXessCM0z8E=", + "dev": true + }, + "duplexer3": { + "version": "0.1.4", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/duplexer3/-/duplexer3-0.1.4.tgz", + "integrity": "sha1-7gHdHKwO08vH/b6jfcCo8c4ALOI=", + "dev": true + }, + "duplexify": { + "version": "3.6.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/duplexify/-/duplexify-3.6.0.tgz", + "integrity": "sha512-fO3Di4tBKJpYTFHAxTU00BcfWMY9w24r/x21a6rZRbsD/ToUgGxsMbiGRmB7uVAXeGKXD9MwiLZa5E97EVgIRQ==", + "dev": true, + "requires": { + "end-of-stream": "^1.0.0", + "inherits": "^2.0.1", + "readable-stream": "^2.0.0", + "stream-shift": "^1.0.0" + } + }, + "easy-extender": { + "version": "2.3.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/easy-extender/-/easy-extender-2.3.2.tgz", + "integrity": "sha1-PTJI/r4rFZYHMW2PnPSRwWZIIh0=", + "dev": true, + "requires": { + "lodash": "^3.10.1" + } + }, + "eazy-logger": { + "version": "3.0.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/eazy-logger/-/eazy-logger-3.0.2.tgz", + "integrity": "sha1-oyWqXlPROiIliJsqxBE7K5Y29Pw=", + "dev": true, + "requires": { + "tfunk": "^3.0.1" + } + }, + "ecc-jsbn": { + "version": "0.1.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz", + "integrity": "sha1-OoOpBOVDUyh4dMVkt1SThoSamMk=", + "dev": true, + "requires": { + "jsbn": "~0.1.0", + "safer-buffer": "^2.1.0" + } + }, + "editions": { + "version": "1.3.4", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/editions/-/editions-1.3.4.tgz", + "integrity": "sha512-gzao+mxnYDzIysXKMQi/+M1mjy/rjestjg6OPoYTtI+3Izp23oiGZitsl9lPDPiTGXbcSIk1iJWhliSaglxnUg==", + "dev": true + }, + "ee-first": { + "version": "1.1.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/ee-first/-/ee-first-1.1.1.tgz", + "integrity": "sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0=", + "dev": true + }, + "ejs": { + "version": "2.6.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/ejs/-/ejs-2.6.1.tgz", + "integrity": "sha512-0xy4A/twfrRCnkhfk8ErDi5DqdAsAqeGxht4xkCUrsvhhbQNs7E+4jV0CN7+NKIY0aHE72+XvqtBIXzD31ZbXQ==", + "dev": true + }, + "electron-to-chromium": { + "version": "1.3.70", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/electron-to-chromium/-/electron-to-chromium-1.3.70.tgz", + "integrity": "sha512-WYMjqCnPVS5JA+XvwEnpwucJpVi2+q9cdCFpbhxgWGsCtforFBEkuP9+nCyy/wnU/0SyLcLRIeZct9ayMGcXoQ==", + "dev": true + }, + "elegant-spinner": { + "version": "1.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/elegant-spinner/-/elegant-spinner-1.0.1.tgz", + "integrity": "sha1-2wQ1IcldfjA/2PNFvtwzSc+wcp4=", + "dev": true + }, + "elliptic": { + "version": "6.4.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/elliptic/-/elliptic-6.4.0.tgz", + "integrity": "sha1-ysmvh2LIWDYYcAPI3+GT5eLq5d8=", + "dev": true, + "requires": { + "bn.js": "^4.4.0", + "brorand": "^1.0.1", + "hash.js": "^1.0.0", + "hmac-drbg": "^1.0.0", + "inherits": "^2.0.1", + "minimalistic-assert": "^1.0.0", + "minimalistic-crypto-utils": "^1.0.0" + } + }, + "emojis-list": { + "version": "2.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/emojis-list/-/emojis-list-2.1.0.tgz", + "integrity": "sha1-TapNnbAPmBmIDHn6RXrlsJof04k=", + "dev": true + }, + "enabled": { + "version": "1.0.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/enabled/-/enabled-1.0.2.tgz", + "integrity": "sha1-ll9lE9LC0cX0ZStkouM5ZGf8L5M=", + "dev": true, + "requires": { + "env-variable": "0.0.x" + } + }, + "encodeurl": { + "version": "1.0.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/encodeurl/-/encodeurl-1.0.2.tgz", + "integrity": "sha1-rT/0yG7C0CkyL1oCw6mmBslbP1k=", + "dev": true + }, + "end-of-stream": { + "version": "1.4.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/end-of-stream/-/end-of-stream-1.4.1.tgz", + "integrity": "sha512-1MkrZNvWTKCaigbn+W15elq2BB/L22nqrSY5DKlo3X6+vclJm8Bb5djXJBmEX6fS3+zCh/F4VBK5Z2KxJt4s2Q==", + "dev": true, + "requires": { + "once": "^1.4.0" + } + }, + "engine.io": { + "version": "3.2.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/engine.io/-/engine.io-3.2.0.tgz", + "integrity": "sha512-mRbgmAtQ4GAlKwuPnnAvXXwdPhEx+jkc0OBCLrXuD/CRvwNK3AxRSnqK4FSqmAMRRHryVJP8TopOvmEaA64fKw==", + "dev": true, + "requires": { + "accepts": "~1.3.4", + "base64id": "1.0.0", + "cookie": "0.3.1", + "debug": "~3.1.0", + "engine.io-parser": "~2.1.0", + "ws": "~3.3.1" + }, + "dependencies": { + "debug": { + "version": "3.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/debug/-/debug-3.1.0.tgz", + "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", + "dev": true, + "requires": { + "ms": "2.0.0" + } + } + } + }, + "engine.io-client": { + "version": "3.1.6", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/engine.io-client/-/engine.io-client-3.1.6.tgz", + "integrity": "sha512-hnuHsFluXnsKOndS4Hv6SvUrgdYx1pk2NqfaDMW+GWdgfU3+/V25Cj7I8a0x92idSpa5PIhJRKxPvp9mnoLsfg==", + "dev": true, + "requires": { + "component-emitter": "1.2.1", + "component-inherit": "0.0.3", + "debug": "~3.1.0", + "engine.io-parser": "~2.1.1", + "has-cors": "1.1.0", + "indexof": "0.0.1", + "parseqs": "0.0.5", + "parseuri": "0.0.5", + "ws": "~3.3.1", + "xmlhttprequest-ssl": "~1.5.4", + "yeast": "0.1.2" + }, + "dependencies": { + "debug": { + "version": "3.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/debug/-/debug-3.1.0.tgz", + "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", + "dev": true, + "requires": { + "ms": "2.0.0" + } + } + } + }, + "engine.io-parser": { + "version": "2.1.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/engine.io-parser/-/engine.io-parser-2.1.2.tgz", + "integrity": "sha512-dInLFzr80RijZ1rGpx1+56/uFoH7/7InhH3kZt+Ms6hT8tNx3NGW/WNSA/f8As1WkOfkuyb3tnRyuXGxusclMw==", + "dev": true, + "requires": { + "after": "0.8.2", + "arraybuffer.slice": "~0.0.7", + "base64-arraybuffer": "0.1.5", + "blob": "0.0.4", + "has-binary2": "~1.0.2" + } + }, + "enhanced-resolve": { + "version": "4.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/enhanced-resolve/-/enhanced-resolve-4.0.0.tgz", + "integrity": "sha512-jox/62b2GofV1qTUQTMPEJSDIGycS43evqYzD/KVtEb9OCoki9cnacUPxCrZa7JfPzZSYOCZhu9O9luaMxAX8g==", + "dev": true, + "requires": { + "graceful-fs": "^4.1.2", + "memory-fs": "^0.4.0", + "tapable": "^1.0.0" + } + }, + "entities": { + "version": "1.1.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/entities/-/entities-1.1.1.tgz", + "integrity": "sha1-blwtClYhtdra7O+AuQ7ftc13cvA=", + "dev": true + }, + "env-paths": { + "version": "1.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/env-paths/-/env-paths-1.0.0.tgz", + "integrity": "sha1-QWgTO0K7BcOKNbGuQ5fIKYqzaeA=", + "dev": true + }, + "env-variable": { + "version": "0.0.5", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/env-variable/-/env-variable-0.0.5.tgz", + "integrity": "sha512-zoB603vQReOFvTg5xMl9I1P2PnHsHQQKTEowsKKD7nseUfJq6UWzK+4YtlWUO1nhiQUxe6XMkk+JleSZD1NZFA==", + "dev": true + }, + "envify": { + "version": "3.4.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/envify/-/envify-3.4.1.tgz", + "integrity": "sha1-1xIjKejfFoi6dxsSUBkXyc5cvOg=", + "dev": true, + "requires": { + "jstransform": "^11.0.3", + "through": "~2.3.4" + } + }, + "envinfo": { + "version": "4.4.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/envinfo/-/envinfo-4.4.2.tgz", + "integrity": "sha512-5rfRs+m+6pwoKRCFqpsA5+qsLngFms1aWPrxfKbrObCzQaPc3M3yPloZx+BL9UE3dK58cxw36XVQbFRSCCfGSQ==", + "dev": true + }, + "errno": { + "version": "0.1.7", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/errno/-/errno-0.1.7.tgz", + "integrity": "sha512-MfrRBDWzIWifgq6tJj60gkAwtLNb6sQPlcFrSOflcP1aFmmruKQ2wRnze/8V6kgyz7H3FF8Npzv78mZ7XLLflg==", + "dev": true, + "requires": { + "prr": "~1.0.1" + } + }, + "error": { + "version": "7.0.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/error/-/error-7.0.2.tgz", + "integrity": "sha1-pfdf/02ZJhJt2sDqXcOOaJFTywI=", + "dev": true, + "requires": { + "string-template": "~0.2.1", + "xtend": "~4.0.0" + } + }, + "error-ex": { + "version": "1.3.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/error-ex/-/error-ex-1.3.2.tgz", + "integrity": "sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g==", + "dev": true, + "requires": { + "is-arrayish": "^0.2.1" + } + }, + "error-stack-parser": { + "version": "2.0.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/error-stack-parser/-/error-stack-parser-2.0.2.tgz", + "integrity": "sha512-E1fPutRDdIj/hohG0UpT5mayXNCxXP9d+snxFsPU9X0XgccOumKraa3juDMwTUyi7+Bu5+mCGagjg4IYeNbOdw==", + "dev": true, + "requires": { + "stackframe": "^1.0.4" + } + }, + "es-abstract": { + "version": "1.12.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/es-abstract/-/es-abstract-1.12.0.tgz", + "integrity": "sha512-C8Fx/0jFmV5IPoMOFPA9P9G5NtqW+4cOPit3MIuvR2t7Ag2K15EJTpxnHAYTzL+aYQJIESYeXZmDBfOBE1HcpA==", + "dev": true, + "requires": { + "es-to-primitive": "^1.1.1", + "function-bind": "^1.1.1", + "has": "^1.0.1", + "is-callable": "^1.1.3", + "is-regex": "^1.0.4" + } + }, + "es-to-primitive": { + "version": "1.1.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/es-to-primitive/-/es-to-primitive-1.1.1.tgz", + "integrity": "sha1-RTVSSKiJeQNLZ5Lhm7gfK3l13Q0=", + "dev": true, + "requires": { + "is-callable": "^1.1.1", + "is-date-object": "^1.0.1", + "is-symbol": "^1.0.1" + } + }, + "es5-ext": { + "version": "0.10.45", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/es5-ext/-/es5-ext-0.10.45.tgz", + "integrity": "sha512-FkfM6Vxxfmztilbxxz5UKSD4ICMf5tSpRFtDNtkAhOxZ0EKtX6qwmXNyH/sFyIbX2P/nU5AMiA9jilWsUGJzCQ==", + "dev": true, + "requires": { + "es6-iterator": "~2.0.3", + "es6-symbol": "~3.1.1", + "next-tick": "1" + } + }, + "es6-iterator": { + "version": "2.0.3", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/es6-iterator/-/es6-iterator-2.0.3.tgz", + "integrity": "sha1-p96IkUGgWpSwhUQDstCg+/qY87c=", + "dev": true, + "requires": { + "d": "1", + "es5-ext": "^0.10.35", + "es6-symbol": "^3.1.1" + } + }, + "es6-promise": { + "version": "4.0.5", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/es6-promise/-/es6-promise-4.0.5.tgz", + "integrity": "sha1-eILzCt3lskDM+n99eMVIMwlRrkI=", + "dev": true + }, + "es6-symbol": { + "version": "3.1.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/es6-symbol/-/es6-symbol-3.1.1.tgz", + "integrity": "sha1-vwDvT9q2uhtG7Le2KbTH7VcVzHc=", + "dev": true, + "requires": { + "d": "1", + "es5-ext": "~0.10.14" + } + }, + "es6-templates": { + "version": "0.2.3", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/es6-templates/-/es6-templates-0.2.3.tgz", + "integrity": "sha1-XLmsn7He1usSOTQrgdeSu7QHjuQ=", + "dev": true, + "requires": { + "recast": "~0.11.12", + "through": "~2.3.6" + } + }, + "escape-html": { + "version": "1.0.3", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/escape-html/-/escape-html-1.0.3.tgz", + "integrity": "sha1-Aljq5NPQwJdN4cFpGI7wBR0dGYg=", + "dev": true + }, + "escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=", + "dev": true + }, + "escodegen": { + "version": "1.10.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/escodegen/-/escodegen-1.10.0.tgz", + "integrity": "sha512-fjUOf8johsv23WuIKdNQU4P9t9jhQ4Qzx6pC2uW890OloK3Zs1ZAoCNpg/2larNF501jLl3UNy0kIRcF6VI22g==", + "dev": true, + "requires": { + "esprima": "^3.1.3", + "estraverse": "^4.2.0", + "esutils": "^2.0.2", + "optionator": "^0.8.1", + "source-map": "~0.6.1" + }, + "dependencies": { + "esprima": { + "version": "3.1.3", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/esprima/-/esprima-3.1.3.tgz", + "integrity": "sha1-/cpRzuYTOJXjyI1TXOSdv/YqRjM=", + "dev": true + }, + "source-map": { + "version": "0.6.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "dev": true, + "optional": true + } + } + }, + "eslint-scope": { + "version": "3.7.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/eslint-scope/-/eslint-scope-3.7.1.tgz", + "integrity": "sha1-PWPD7f2gLgbgGkUq2IyqzHzctug=", + "dev": true, + "requires": { + "esrecurse": "^4.1.0", + "estraverse": "^4.1.1" + } + }, + "esprima": { + "version": "2.7.3", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/esprima/-/esprima-2.7.3.tgz", + "integrity": "sha1-luO3DVd59q1JzQMmc9HDEnZ7pYE=", + "dev": true + }, + "esrecurse": { + "version": "4.2.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/esrecurse/-/esrecurse-4.2.1.tgz", + "integrity": "sha512-64RBB++fIOAXPw3P9cy89qfMlvZEXZkqqJkjqqXIvzP5ezRZjW+lPWjw35UX/3EhUPFYbg5ER4JYgDw4007/DQ==", + "dev": true, + "requires": { + "estraverse": "^4.1.0" + } + }, + "estraverse": { + "version": "4.2.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/estraverse/-/estraverse-4.2.0.tgz", + "integrity": "sha1-De4/7TH81GlhjOc0IJn8GvoL2xM=", + "dev": true + }, + "esutils": { + "version": "2.0.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/esutils/-/esutils-2.0.2.tgz", + "integrity": "sha1-Cr9PHKpbyx96nYrMbepPqqBLrJs=", + "dev": true + }, + "etag": { + "version": "1.8.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/etag/-/etag-1.8.1.tgz", + "integrity": "sha1-Qa4u62XvpiJorr/qg6x9eSmbCIc=", + "dev": true + }, + "eventemitter3": { + "version": "1.2.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/eventemitter3/-/eventemitter3-1.2.0.tgz", + "integrity": "sha1-HIaZHYFq0eUEdQ5zh0Ik7PO+xQg=", + "dev": true + }, + "events": { + "version": "1.1.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/events/-/events-1.1.1.tgz", + "integrity": "sha1-nr23Y1rQmccNzEwqH1AEKI6L2SQ=", + "dev": true + }, + "eventsource": { + "version": "0.1.6", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/eventsource/-/eventsource-0.1.6.tgz", + "integrity": "sha1-Cs7ehJ7X3RzMMsgRuxG5RNTykjI=", + "dev": true, + "requires": { + "original": ">=0.0.5" + } + }, + "evp_bytestokey": { + "version": "1.0.3", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/evp_bytestokey/-/evp_bytestokey-1.0.3.tgz", + "integrity": "sha512-/f2Go4TognH/KvCISP7OUsHn85hT9nUkxxA9BEWxFn+Oj9o8ZNLm/40hdlgSLyuOimsrTKLUMEorQexp/aPQeA==", + "dev": true, + "requires": { + "md5.js": "^1.3.4", + "safe-buffer": "^5.1.1" + } + }, + "exec-sh": { + "version": "0.2.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/exec-sh/-/exec-sh-0.2.1.tgz", + "integrity": "sha512-aLt95pexaugVtQerpmE51+4QfWrNc304uez7jvj6fWnN8GeEHpttB8F36n8N7uVhUMbH/1enbxQ9HImZ4w/9qg==", + "dev": true, + "requires": { + "merge": "^1.1.3" + } + }, + "execa": { + "version": "0.7.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/execa/-/execa-0.7.0.tgz", + "integrity": "sha1-lEvs00zEHuMqY6n68nrVpl/Fl3c=", + "dev": true, + "requires": { + "cross-spawn": "^5.0.1", + "get-stream": "^3.0.0", + "is-stream": "^1.1.0", + "npm-run-path": "^2.0.0", + "p-finally": "^1.0.0", + "signal-exit": "^3.0.0", + "strip-eof": "^1.0.0" + } + }, + "exit": { + "version": "0.1.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/exit/-/exit-0.1.2.tgz", + "integrity": "sha1-BjJjj42HfMghB9MKD/8aF8uhzQw=", + "dev": true + }, + "exit-hook": { + "version": "1.1.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/exit-hook/-/exit-hook-1.1.1.tgz", + "integrity": "sha1-8FyiM7SMBdVP/wd2XfhQfpXAL/g=", + "dev": true + }, + "expand-brackets": { + "version": "2.1.4", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/expand-brackets/-/expand-brackets-2.1.4.tgz", + "integrity": "sha1-t3c14xXOMPa27/D4OwQVGiJEliI=", + "dev": true, + "requires": { + "debug": "^2.3.3", + "define-property": "^0.2.5", + "extend-shallow": "^2.0.1", + "posix-character-classes": "^0.1.0", + "regex-not": "^1.0.0", + "snapdragon": "^0.8.1", + "to-regex": "^3.0.1" + }, + "dependencies": { + "define-property": { + "version": "0.2.5", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/define-property/-/define-property-0.2.5.tgz", + "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", + "dev": true, + "requires": { + "is-descriptor": "^0.1.0" + } + }, + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "dev": true, + "requires": { + "is-extendable": "^0.1.0" + } + } + } + }, + "expand-range": { + "version": "1.8.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/expand-range/-/expand-range-1.8.2.tgz", + "integrity": "sha1-opnv/TNf4nIeuujiV+x5ZE/IUzc=", + "dev": true, + "requires": { + "fill-range": "^2.1.0" + }, + "dependencies": { + "fill-range": { + "version": "2.2.4", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/fill-range/-/fill-range-2.2.4.tgz", + "integrity": "sha512-cnrcCbj01+j2gTG921VZPnHbjmdAf8oQV/iGeV2kZxGSyfYjjTyY79ErsK1WJWMpw6DaApEX72binqJE+/d+5Q==", + "dev": true, + "requires": { + "is-number": "^2.1.0", + "isobject": "^2.0.0", + "randomatic": "^3.0.0", + "repeat-element": "^1.1.2", + "repeat-string": "^1.5.2" + } + }, + "is-number": { + "version": "2.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/is-number/-/is-number-2.1.0.tgz", + "integrity": "sha1-Afy7s5NGOlSPL0ZszhbezknbkI8=", + "dev": true, + "requires": { + "kind-of": "^3.0.2" + } + }, + "isobject": { + "version": "2.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/isobject/-/isobject-2.1.0.tgz", + "integrity": "sha1-8GVWEJaj8dou9GJy+BXIQNh+DIk=", + "dev": true, + "requires": { + "isarray": "1.0.0" + } + }, + "kind-of": { + "version": "3.2.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true, + "requires": { + "is-buffer": "^1.1.5" + } + } + } + }, + "expand-tilde": { + "version": "2.0.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/expand-tilde/-/expand-tilde-2.0.2.tgz", + "integrity": "sha1-l+gBqgUt8CRU3kawK/YhZCzchQI=", + "dev": true, + "requires": { + "homedir-polyfill": "^1.0.1" + } + }, + "expect": { + "version": "22.4.3", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/expect/-/expect-22.4.3.tgz", + "integrity": "sha512-XcNXEPehqn8b/jm8FYotdX0YrXn36qp4HWlrVT4ktwQas1l1LPxiVWncYnnL2eyMtKAmVIaG0XAp0QlrqJaxaA==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.0", + "jest-diff": "^22.4.3", + "jest-get-type": "^22.4.3", + "jest-matcher-utils": "^22.4.3", + "jest-message-util": "^22.4.3", + "jest-regex-util": "^22.4.3" + }, + "dependencies": { + "ansi-styles": { + "version": "3.2.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, + "requires": { + "color-convert": "^1.9.0" + } + } + } + }, + "exports-loader": { + "version": "0.7.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/exports-loader/-/exports-loader-0.7.0.tgz", + "integrity": "sha512-RKwCrO4A6IiKm0pG3c9V46JxIHcDplwwGJn6+JJ1RcVnh/WSGJa0xkmk5cRVtgOPzCAtTMGj2F7nluh9L0vpSA==", + "dev": true, + "requires": { + "loader-utils": "^1.1.0", + "source-map": "0.5.0" + }, + "dependencies": { + "source-map": { + "version": "0.5.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/source-map/-/source-map-0.5.0.tgz", + "integrity": "sha1-D+llA6yGpa213mP05BKuSHLNvoY=", + "dev": true + } + } + }, + "express": { + "version": "4.16.3", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/express/-/express-4.16.3.tgz", + "integrity": "sha1-avilAjUNsyRuzEvs9rWjTSL37VM=", + "dev": true, + "requires": { + "accepts": "~1.3.5", + "array-flatten": "1.1.1", + "body-parser": "1.18.2", + "content-disposition": "0.5.2", + "content-type": "~1.0.4", + "cookie": "0.3.1", + "cookie-signature": "1.0.6", + "debug": "2.6.9", + "depd": "~1.1.2", + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "etag": "~1.8.1", + "finalhandler": "1.1.1", + "fresh": "0.5.2", + "merge-descriptors": "1.0.1", + "methods": "~1.1.2", + "on-finished": "~2.3.0", + "parseurl": "~1.3.2", + "path-to-regexp": "0.1.7", + "proxy-addr": "~2.0.3", + "qs": "6.5.1", + "range-parser": "~1.2.0", + "safe-buffer": "5.1.1", + "send": "0.16.2", + "serve-static": "1.13.2", + "setprototypeof": "1.1.0", + "statuses": "~1.4.0", + "type-is": "~1.6.16", + "utils-merge": "1.0.1", + "vary": "~1.1.2" + }, + "dependencies": { + "array-flatten": { + "version": "1.1.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/array-flatten/-/array-flatten-1.1.1.tgz", + "integrity": "sha1-ml9pkFGx5wczKPKgCJaLZOopVdI=", + "dev": true + }, + "finalhandler": { + "version": "1.1.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/finalhandler/-/finalhandler-1.1.1.tgz", + "integrity": "sha512-Y1GUDo39ez4aHAw7MysnUD5JzYX+WaIj8I57kO3aEPT1fFRL4sr7mjei97FgnwhAyyzRYmQZaTHb2+9uZ1dPtg==", + "dev": true, + "requires": { + "debug": "2.6.9", + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "on-finished": "~2.3.0", + "parseurl": "~1.3.2", + "statuses": "~1.4.0", + "unpipe": "~1.0.0" + } + }, + "qs": { + "version": "6.5.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/qs/-/qs-6.5.1.tgz", + "integrity": "sha512-eRzhrN1WSINYCDCbrz796z37LOe3m5tmW7RQf6oBntukAG1nmovJvhnwHHRMAfeoItc1m2Hk02WER2aQ/iqs+A==", + "dev": true + }, + "safe-buffer": { + "version": "5.1.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/safe-buffer/-/safe-buffer-5.1.1.tgz", + "integrity": "sha512-kKvNJn6Mm93gAczWVJg7wH+wGYWNrDHdWvpUmHyEsgCtIwwo3bqPtV4tR5tuPaUhTOo/kvhVwd8XwwOllGYkbg==", + "dev": true + }, + "statuses": { + "version": "1.4.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/statuses/-/statuses-1.4.0.tgz", + "integrity": "sha512-zhSCtt8v2NDrRlPQpCNtw/heZLtfUDqxBM1udqikb/Hbk52LK4nQSwr10u77iopCW5LsyHpuXS0GnEc48mLeew==", + "dev": true + } + } + }, + "extend": { + "version": "3.0.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/extend/-/extend-3.0.2.tgz", + "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==", + "dev": true + }, + "extend-shallow": { + "version": "3.0.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/extend-shallow/-/extend-shallow-3.0.2.tgz", + "integrity": "sha1-Jqcarwc7OfshJxcnRhMcJwQCjbg=", + "dev": true, + "requires": { + "assign-symbols": "^1.0.0", + "is-extendable": "^1.0.1" + }, + "dependencies": { + "is-extendable": { + "version": "1.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/is-extendable/-/is-extendable-1.0.1.tgz", + "integrity": "sha512-arnXMxT1hhoKo9k1LZdmlNyJdDDfy2v0fXjFlmok4+i8ul/6WlbVge9bhM74OpNPQPMGUToDtz+KXa1PneJxOA==", + "dev": true, + "requires": { + "is-plain-object": "^2.0.4" + } + } + } + }, + "external-editor": { + "version": "2.2.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/external-editor/-/external-editor-2.2.0.tgz", + "integrity": "sha512-bSn6gvGxKt+b7+6TKEv1ZycHleA7aHhRHyAqJyp5pbUFuYYNIzpZnQDk7AsYckyWdEnTeAnay0aCy2aV6iTk9A==", + "dev": true, + "requires": { + "chardet": "^0.4.0", + "iconv-lite": "^0.4.17", + "tmp": "^0.0.33" + } + }, + "extglob": { + "version": "2.0.4", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/extglob/-/extglob-2.0.4.tgz", + "integrity": "sha512-Nmb6QXkELsuBr24CJSkilo6UHHgbekK5UiZgfE6UHD3Eb27YC6oD+bhcT+tJ6cl8dmsgdQxnWlcry8ksBIBLpw==", + "dev": true, + "requires": { + "array-unique": "^0.3.2", + "define-property": "^1.0.0", + "expand-brackets": "^2.1.4", + "extend-shallow": "^2.0.1", + "fragment-cache": "^0.2.1", + "regex-not": "^1.0.0", + "snapdragon": "^0.8.1", + "to-regex": "^3.0.1" + }, + "dependencies": { + "define-property": { + "version": "1.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/define-property/-/define-property-1.0.0.tgz", + "integrity": "sha1-dp66rz9KY6rTr56NMEybvnm/sOY=", + "dev": true, + "requires": { + "is-descriptor": "^1.0.0" + } + }, + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "dev": true, + "requires": { + "is-extendable": "^0.1.0" + } + }, + "is-accessor-descriptor": { + "version": "1.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz", + "integrity": "sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ==", + "dev": true, + "requires": { + "kind-of": "^6.0.0" + } + }, + "is-data-descriptor": { + "version": "1.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz", + "integrity": "sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ==", + "dev": true, + "requires": { + "kind-of": "^6.0.0" + } + }, + "is-descriptor": { + "version": "1.0.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/is-descriptor/-/is-descriptor-1.0.2.tgz", + "integrity": "sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg==", + "dev": true, + "requires": { + "is-accessor-descriptor": "^1.0.0", + "is-data-descriptor": "^1.0.0", + "kind-of": "^6.0.2" + } + } + } + }, + "extsprintf": { + "version": "1.3.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/extsprintf/-/extsprintf-1.3.0.tgz", + "integrity": "sha1-lpGEQOMEGnpBT4xS48V06zw+HgU=", + "dev": true + }, + "fast-deep-equal": { + "version": "1.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/fast-deep-equal/-/fast-deep-equal-1.1.0.tgz", + "integrity": "sha1-wFNHeBfIa1HaqFPIHgWbcz0CNhQ=", + "dev": true + }, + "fast-glob": { + "version": "2.2.3", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/fast-glob/-/fast-glob-2.2.3.tgz", + "integrity": "sha512-NiX+JXjnx43RzvVFwRWfPKo4U+1BrK5pJPsHQdKMlLoFHrrGktXglQhHliSihWAq+m1z6fHk3uwGHrtRbS9vLA==", + "dev": true, + "requires": { + "@mrmlnc/readdir-enhanced": "^2.2.1", + "@nodelib/fs.stat": "^1.0.1", + "glob-parent": "^3.1.0", + "is-glob": "^4.0.0", + "merge2": "^1.2.1", + "micromatch": "^3.1.10" + } + }, + "fast-json-stable-stringify": { + "version": "2.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz", + "integrity": "sha1-1RQsDK7msRifh9OnYREGT4bIu/I=", + "dev": true + }, + "fast-levenshtein": { + "version": "2.0.6", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz", + "integrity": "sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc=", + "dev": true + }, + "fast-safe-stringify": { + "version": "2.0.6", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/fast-safe-stringify/-/fast-safe-stringify-2.0.6.tgz", + "integrity": "sha512-q8BZ89jjc+mz08rSxROs8VsrBBcn1SIw1kq9NjolL509tkABRk9io01RAjSaEv1Xb2uFLt8VtRiZbGp5H8iDtg==", + "dev": true + }, + "fastparse": { + "version": "1.1.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/fastparse/-/fastparse-1.1.1.tgz", + "integrity": "sha1-0eJkOzipTXWDtHkGDmxK/8lAcfg=", + "dev": true + }, + "faye-websocket": { + "version": "0.10.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/faye-websocket/-/faye-websocket-0.10.0.tgz", + "integrity": "sha1-TkkvjQTftviQA1B/btvy1QHnxvQ=", + "dev": true, + "requires": { + "websocket-driver": ">=0.5.1" + } + }, + "fb-watchman": { + "version": "2.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/fb-watchman/-/fb-watchman-2.0.0.tgz", + "integrity": "sha1-VOmr99+i8mzZsWNsWIwa/AXeXVg=", + "dev": true, + "requires": { + "bser": "^2.0.0" + } + }, + "fbjs": { + "version": "0.6.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/fbjs/-/fbjs-0.6.1.tgz", + "integrity": "sha1-lja3cF9bqWhNRLcveDISVK/IYPc=", + "dev": true, + "requires": { + "core-js": "^1.0.0", + "loose-envify": "^1.0.0", + "promise": "^7.0.3", + "ua-parser-js": "^0.7.9", + "whatwg-fetch": "^0.9.0" + }, + "dependencies": { + "core-js": { + "version": "1.2.7", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/core-js/-/core-js-1.2.7.tgz", + "integrity": "sha1-ZSKUwUZR2yj6k70tX/KYOk8IxjY=", + "dev": true + } + } + }, + "fecha": { + "version": "2.3.3", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/fecha/-/fecha-2.3.3.tgz", + "integrity": "sha512-lUGBnIamTAwk4znq5BcqsDaxSmZ9nDVJaij6NvRt/Tg4R69gERA+otPKbS86ROw9nxVMw2/mp1fnaiWqbs6Sdg==", + "dev": true + }, + "figgy-pudding": { + "version": "3.5.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/figgy-pudding/-/figgy-pudding-3.5.1.tgz", + "integrity": "sha512-vNKxJHTEKNThjfrdJwHc7brvM6eVevuO5nTj6ez8ZQ1qbXTvGthucRF7S4vf2cr71QVnT70V34v0S1DyQsti0w==", + "dev": true + }, + "figures": { + "version": "2.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/figures/-/figures-2.0.0.tgz", + "integrity": "sha1-OrGi0qYsi/tDGgyUy3l6L84nyWI=", + "dev": true, + "requires": { + "escape-string-regexp": "^1.0.5" + } + }, + "file-loader": { + "version": "1.1.11", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/file-loader/-/file-loader-1.1.11.tgz", + "integrity": "sha512-TGR4HU7HUsGg6GCOPJnFk06RhWgEWFLAGWiT6rcD+GRC2keU3s9RGJ+b3Z6/U73jwwNb2gKLJ7YCrp+jvU4ALg==", + "dev": true, + "requires": { + "loader-utils": "^1.0.2", + "schema-utils": "^0.4.5" + } + }, + "filename-regex": { + "version": "2.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/filename-regex/-/filename-regex-2.0.1.tgz", + "integrity": "sha1-wcS5vuPglyXdsQa3XB4wH+LxiyY=", + "dev": true + }, + "fileset": { + "version": "2.0.3", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/fileset/-/fileset-2.0.3.tgz", + "integrity": "sha1-jnVIqW08wjJ+5eZ0FocjozO7oqA=", + "dev": true, + "requires": { + "glob": "^7.0.3", + "minimatch": "^3.0.3" + } + }, + "filesize": { + "version": "3.6.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/filesize/-/filesize-3.6.1.tgz", + "integrity": "sha512-7KjR1vv6qnicaPMi1iiTcI85CyYwRO/PSFCu6SvqL8jN2Wjt/NIYQTFtFs7fSDCYOstUkEWIQGFUg5YZQfjlcg==", + "dev": true + }, + "fill-range": { + "version": "4.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/fill-range/-/fill-range-4.0.0.tgz", + "integrity": "sha1-1USBHUKPmOsGpj3EAtJAPDKMOPc=", + "dev": true, + "requires": { + "extend-shallow": "^2.0.1", + "is-number": "^3.0.0", + "repeat-string": "^1.6.1", + "to-regex-range": "^2.1.0" + }, + "dependencies": { + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "dev": true, + "requires": { + "is-extendable": "^0.1.0" + } + } + } + }, + "finalhandler": { + "version": "1.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/finalhandler/-/finalhandler-1.1.0.tgz", + "integrity": "sha1-zgtoVbRYU+eRsvzGgARtiCU91/U=", + "dev": true, + "requires": { + "debug": "2.6.9", + "encodeurl": "~1.0.1", + "escape-html": "~1.0.3", + "on-finished": "~2.3.0", + "parseurl": "~1.3.2", + "statuses": "~1.3.1", + "unpipe": "~1.0.0" + } + }, + "find-cache-dir": { + "version": "1.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/find-cache-dir/-/find-cache-dir-1.0.0.tgz", + "integrity": "sha1-kojj6ePMN0hxfTnq3hfPcfww7m8=", + "dev": true, + "requires": { + "commondir": "^1.0.1", + "make-dir": "^1.0.0", + "pkg-dir": "^2.0.0" + } + }, + "find-index": { + "version": "0.1.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/find-index/-/find-index-0.1.1.tgz", + "integrity": "sha1-Z101iyyjiS15Whq0cjL4tuLg3eQ=", + "dev": true + }, + "find-parent-dir": { + "version": "0.3.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/find-parent-dir/-/find-parent-dir-0.3.0.tgz", + "integrity": "sha1-M8RLQpqysvBkYpnF+fcY83b/jVQ=", + "dev": true + }, + "find-up": { + "version": "1.1.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/find-up/-/find-up-1.1.2.tgz", + "integrity": "sha1-ay6YIrGizgpgq2TWEOzK1TyyTQ8=", + "dev": true, + "requires": { + "path-exists": "^2.0.0", + "pinkie-promise": "^2.0.0" + } + }, + "first-chunk-stream": { + "version": "2.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/first-chunk-stream/-/first-chunk-stream-2.0.0.tgz", + "integrity": "sha1-G97NuOCDwGZLkZRVgVd6Q6nzHXA=", + "dev": true, + "requires": { + "readable-stream": "^2.0.2" + } + }, + "flatten": { + "version": "1.0.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/flatten/-/flatten-1.0.2.tgz", + "integrity": "sha1-2uRqnXj74lKSJYzB54CkHZXAN4I=", + "dev": true + }, + "flow-parser": { + "version": "0.71.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/flow-parser/-/flow-parser-0.71.0.tgz", + "integrity": "sha512-rXSvqSBLf8aRI6T3P99jMcUYvZoO1KZcKDkzGJmXvYdNAgRKu7sfGNtxEsn3cX4TgungBuJpX+K8aHRC9/B5MA==", + "dev": true + }, + "flush-write-stream": { + "version": "1.0.3", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/flush-write-stream/-/flush-write-stream-1.0.3.tgz", + "integrity": "sha512-calZMC10u0FMUqoiunI2AiGIIUtUIvifNwkHhNupZH4cbNnW1Itkoh/Nf5HFYmDrwWPjrUxpkZT0KhuCq0jmGw==", + "dev": true, + "requires": { + "inherits": "^2.0.1", + "readable-stream": "^2.0.4" + } + }, + "follow-redirects": { + "version": "1.5.9", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/follow-redirects/-/follow-redirects-1.5.9.tgz", + "integrity": "sha512-Bh65EZI/RU8nx0wbYF9shkFZlqLP+6WT/5FnA3cE/djNSuKNHJEinGGZgu/cQEkeeb2GdFOgenAmn8qaqYke2w==", + "dev": true, + "requires": { + "debug": "=3.1.0" + }, + "dependencies": { + "debug": { + "version": "3.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/debug/-/debug-3.1.0.tgz", + "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", + "dev": true, + "requires": { + "ms": "2.0.0" + } + } + } + }, + "for-in": { + "version": "1.0.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/for-in/-/for-in-1.0.2.tgz", + "integrity": "sha1-gQaNKVqBQuwKxybG4iAMMPttXoA=", + "dev": true + }, + "for-own": { + "version": "0.1.5", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/for-own/-/for-own-0.1.5.tgz", + "integrity": "sha1-UmXGgaTylNq78XyVCbZ2OqhFEM4=", + "dev": true, + "requires": { + "for-in": "^1.0.1" + } + }, + "foreach": { + "version": "2.0.5", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/foreach/-/foreach-2.0.5.tgz", + "integrity": "sha1-C+4AUBiusmDQo6865ljdATbsG5k=", + "dev": true + }, + "forever-agent": { + "version": "0.6.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/forever-agent/-/forever-agent-0.6.1.tgz", + "integrity": "sha1-+8cfDEGt6zf5bFd60e1C2P2sypE=", + "dev": true + }, + "fork-ts-checker-webpack-plugin": { + "version": "0.4.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/fork-ts-checker-webpack-plugin/-/fork-ts-checker-webpack-plugin-0.4.1.tgz", + "integrity": "sha512-UckdUYL51F5t9t/2Uqk0xatxz8Cf75a1THNIrDYajjcAcg2Q64SXNP7BTQPxXm0bU1chzjR3brXIaianbFqI3Q==", + "dev": true, + "requires": { + "babel-code-frame": "^6.22.0", + "chalk": "^1.1.3", + "chokidar": "^1.7.0", + "lodash.endswith": "^4.2.1", + "lodash.isfunction": "^3.0.8", + "lodash.isstring": "^4.0.1", + "lodash.startswith": "^4.2.1", + "minimatch": "^3.0.4", + "resolve": "^1.5.0", + "tapable": "^1.0.0", + "vue-parser": "^1.1.5" + }, + "dependencies": { + "anymatch": { + "version": "1.3.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/anymatch/-/anymatch-1.3.2.tgz", + "integrity": "sha512-0XNayC8lTHQ2OI8aljNCN3sSx6hsr/1+rlcDAotXJR7C1oZZHCNsfpbKwMjRA3Uqb5tF1Rae2oloTr4xpq+WjA==", + "dev": true, + "requires": { + "micromatch": "^2.1.5", + "normalize-path": "^2.0.0" + } + }, + "arr-diff": { + "version": "2.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/arr-diff/-/arr-diff-2.0.0.tgz", + "integrity": "sha1-jzuCf5Vai9ZpaX5KQlasPOrjVs8=", + "dev": true, + "requires": { + "arr-flatten": "^1.0.1" + } + }, + "array-unique": { + "version": "0.2.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/array-unique/-/array-unique-0.2.1.tgz", + "integrity": "sha1-odl8yvy8JiXMcPrc6zalDFiwGlM=", + "dev": true + }, + "braces": { + "version": "1.8.5", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/braces/-/braces-1.8.5.tgz", + "integrity": "sha1-uneWLhLf+WnWt2cR6RS3N4V79qc=", + "dev": true, + "requires": { + "expand-range": "^1.8.1", + "preserve": "^0.2.0", + "repeat-element": "^1.1.2" + } + }, + "chokidar": { + "version": "1.7.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/chokidar/-/chokidar-1.7.0.tgz", + "integrity": "sha1-eY5ol3gVHIB2tLNg5e3SjNortGg=", + "dev": true, + "requires": { + "anymatch": "^1.3.0", + "async-each": "^1.0.0", + "fsevents": "^1.0.0", + "glob-parent": "^2.0.0", + "inherits": "^2.0.1", + "is-binary-path": "^1.0.0", + "is-glob": "^2.0.0", + "path-is-absolute": "^1.0.0", + "readdirp": "^2.0.0" + } + }, + "expand-brackets": { + "version": "0.1.5", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/expand-brackets/-/expand-brackets-0.1.5.tgz", + "integrity": "sha1-3wcoTjQqgHzXM6xa9yQR5YHRF3s=", + "dev": true, + "requires": { + "is-posix-bracket": "^0.1.0" + } + }, + "extglob": { + "version": "0.3.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/extglob/-/extglob-0.3.2.tgz", + "integrity": "sha1-Lhj/PS9JqydlzskCPwEdqo2DSaE=", + "dev": true, + "requires": { + "is-extglob": "^1.0.0" + } + }, + "glob-parent": { + "version": "2.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/glob-parent/-/glob-parent-2.0.0.tgz", + "integrity": "sha1-gTg9ctsFT8zPUzbaqQLxgvbtuyg=", + "dev": true, + "requires": { + "is-glob": "^2.0.0" + } + }, + "is-extglob": { + "version": "1.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/is-extglob/-/is-extglob-1.0.0.tgz", + "integrity": "sha1-rEaBd8SUNAWgkvyPKXYMb/xiBsA=", + "dev": true + }, + "is-glob": { + "version": "2.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/is-glob/-/is-glob-2.0.1.tgz", + "integrity": "sha1-0Jb5JqPe1WAPP9/ZEZjLCIjC2GM=", + "dev": true, + "requires": { + "is-extglob": "^1.0.0" + } + }, + "kind-of": { + "version": "3.2.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true, + "requires": { + "is-buffer": "^1.1.5" + } + }, + "micromatch": { + "version": "2.3.11", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/micromatch/-/micromatch-2.3.11.tgz", + "integrity": "sha1-hmd8l9FyCzY0MdBNDRUpO9OMFWU=", + "dev": true, + "requires": { + "arr-diff": "^2.0.0", + "array-unique": "^0.2.1", + "braces": "^1.8.2", + "expand-brackets": "^0.1.4", + "extglob": "^0.3.1", + "filename-regex": "^2.0.0", + "is-extglob": "^1.0.0", + "is-glob": "^2.0.1", + "kind-of": "^3.0.2", + "normalize-path": "^2.0.1", + "object.omit": "^2.0.0", + "parse-glob": "^3.0.4", + "regex-cache": "^0.4.2" + } + } + } + }, + "form-data": { + "version": "2.3.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/form-data/-/form-data-2.3.2.tgz", + "integrity": "sha1-SXBJi+YEwgwAXU9cI67NIda0kJk=", + "dev": true, + "requires": { + "asynckit": "^0.4.0", + "combined-stream": "1.0.6", + "mime-types": "^2.1.12" + }, + "dependencies": { + "combined-stream": { + "version": "1.0.6", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/combined-stream/-/combined-stream-1.0.6.tgz", + "integrity": "sha1-cj599ugBrFYTETp+RFqbactjKBg=", + "dev": true, + "requires": { + "delayed-stream": "~1.0.0" + } + } + } + }, + "forwarded": { + "version": "0.1.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/forwarded/-/forwarded-0.1.2.tgz", + "integrity": "sha1-mMI9qxF1ZXuMBXPozszZGw/xjIQ=", + "dev": true + }, + "fragment-cache": { + "version": "0.2.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/fragment-cache/-/fragment-cache-0.2.1.tgz", + "integrity": "sha1-QpD60n8T6Jvn8zeZxrxaCr//DRk=", + "dev": true, + "requires": { + "map-cache": "^0.2.2" + } + }, + "fresh": { + "version": "0.5.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/fresh/-/fresh-0.5.2.tgz", + "integrity": "sha1-PYyt2Q2XZWn6g1qx+OSyOhBWBac=", + "dev": true + }, + "friendly-errors-webpack-plugin": { + "version": "1.7.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/friendly-errors-webpack-plugin/-/friendly-errors-webpack-plugin-1.7.0.tgz", + "integrity": "sha512-K27M3VK30wVoOarP651zDmb93R9zF28usW4ocaK3mfQeIEI5BPht/EzZs5E8QLLwbLRJQMwscAjDxYPb1FuNiw==", + "dev": true, + "requires": { + "chalk": "^1.1.3", + "error-stack-parser": "^2.0.0", + "string-width": "^2.0.0" + }, + "dependencies": { + "ansi-regex": { + "version": "3.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/ansi-regex/-/ansi-regex-3.0.0.tgz", + "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", + "dev": true + }, + "is-fullwidth-code-point": { + "version": "2.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", + "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", + "dev": true + }, + "string-width": { + "version": "2.1.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/string-width/-/string-width-2.1.1.tgz", + "integrity": "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==", + "dev": true, + "requires": { + "is-fullwidth-code-point": "^2.0.0", + "strip-ansi": "^4.0.0" + } + }, + "strip-ansi": { + "version": "4.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/strip-ansi/-/strip-ansi-4.0.0.tgz", + "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", + "dev": true, + "requires": { + "ansi-regex": "^3.0.0" + } + } + } + }, + "from2": { + "version": "2.3.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/from2/-/from2-2.3.0.tgz", + "integrity": "sha1-i/tVAr3kpNNs/e6gB/zKIdfjgq8=", + "dev": true, + "requires": { + "inherits": "^2.0.1", + "readable-stream": "^2.0.0" + } + }, + "fs-extra": { + "version": "3.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/fs-extra/-/fs-extra-3.0.1.tgz", + "integrity": "sha1-N5TzeMWLNC6n27sjCVEJxLO2IpE=", + "dev": true, + "requires": { + "graceful-fs": "^4.1.2", + "jsonfile": "^3.0.0", + "universalify": "^0.1.0" + } + }, + "fs-write-stream-atomic": { + "version": "1.0.10", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/fs-write-stream-atomic/-/fs-write-stream-atomic-1.0.10.tgz", + "integrity": "sha1-tH31NJPvkR33VzHnCp3tAYnbQMk=", + "dev": true, + "requires": { + "graceful-fs": "^4.1.2", + "iferr": "^0.1.5", + "imurmurhash": "^0.1.4", + "readable-stream": "1 || 2" + } + }, + "fs.realpath": { + "version": "1.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", + "dev": true + }, + "fsevents": { + "version": "1.2.4", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/fsevents/-/fsevents-1.2.4.tgz", + "integrity": "sha512-z8H8/diyk76B7q5wg+Ud0+CqzcAF3mBBI/bA5ne5zrRUUIvNkJY//D3BqyH571KuAC4Nr7Rw7CjWX4r0y9DvNg==", + "dev": true, + "optional": true, + "requires": { + "nan": "^2.9.2", + "node-pre-gyp": "^0.10.0" + }, + "dependencies": { + "abbrev": { + "version": "1.1.1", + "bundled": true, + "dev": true, + "optional": true + }, + "ansi-regex": { + "version": "2.1.1", + "bundled": true, + "dev": true + }, + "aproba": { + "version": "1.2.0", + "bundled": true, + "dev": true, + "optional": true + }, + "are-we-there-yet": { + "version": "1.1.4", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "delegates": "^1.0.0", + "readable-stream": "^2.0.6" + } + }, + "balanced-match": { + "version": "1.0.0", + "bundled": true, + "dev": true + }, + "brace-expansion": { + "version": "1.1.11", + "bundled": true, + "dev": true, + "requires": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "chownr": { + "version": "1.0.1", + "bundled": true, + "dev": true, + "optional": true + }, + "code-point-at": { + "version": "1.1.0", + "bundled": true, + "dev": true + }, + "concat-map": { + "version": "0.0.1", + "bundled": true, + "dev": true + }, + "console-control-strings": { + "version": "1.1.0", + "bundled": true, + "dev": true + }, + "core-util-is": { + "version": "1.0.2", + "bundled": true, + "dev": true, + "optional": true + }, + "debug": { + "version": "2.6.9", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "ms": "2.0.0" + } + }, + "deep-extend": { + "version": "0.5.1", + "bundled": true, + "dev": true, + "optional": true + }, + "delegates": { + "version": "1.0.0", + "bundled": true, + "dev": true, + "optional": true + }, + "detect-libc": { + "version": "1.0.3", + "bundled": true, + "dev": true, + "optional": true + }, + "fs-minipass": { + "version": "1.2.5", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "minipass": "^2.2.1" + } + }, + "fs.realpath": { + "version": "1.0.0", + "bundled": true, + "dev": true, + "optional": true + }, + "gauge": { + "version": "2.7.4", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "aproba": "^1.0.3", + "console-control-strings": "^1.0.0", + "has-unicode": "^2.0.0", + "object-assign": "^4.1.0", + "signal-exit": "^3.0.0", + "string-width": "^1.0.1", + "strip-ansi": "^3.0.1", + "wide-align": "^1.1.0" + } + }, + "glob": { + "version": "7.1.2", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + } + }, + "has-unicode": { + "version": "2.0.1", + "bundled": true, + "dev": true, + "optional": true + }, + "iconv-lite": { + "version": "0.4.21", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "safer-buffer": "^2.1.0" + } + }, + "ignore-walk": { + "version": "3.0.1", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "minimatch": "^3.0.4" + } + }, + "inflight": { + "version": "1.0.6", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "once": "^1.3.0", + "wrappy": "1" + } + }, + "inherits": { + "version": "2.0.3", + "bundled": true, + "dev": true + }, + "ini": { + "version": "1.3.5", + "bundled": true, + "dev": true, + "optional": true + }, + "is-fullwidth-code-point": { + "version": "1.0.0", + "bundled": true, + "dev": true, + "requires": { + "number-is-nan": "^1.0.0" + } + }, + "isarray": { + "version": "1.0.0", + "bundled": true, + "dev": true, + "optional": true + }, + "minimatch": { + "version": "3.0.4", + "bundled": true, + "dev": true, + "requires": { + "brace-expansion": "^1.1.7" + } + }, + "minimist": { + "version": "0.0.8", + "bundled": true, + "dev": true + }, + "minipass": { + "version": "2.2.4", + "bundled": true, + "dev": true, + "requires": { + "safe-buffer": "^5.1.1", + "yallist": "^3.0.0" + } + }, + "minizlib": { + "version": "1.1.0", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "minipass": "^2.2.1" + } + }, + "mkdirp": { + "version": "0.5.1", + "bundled": true, + "dev": true, + "requires": { + "minimist": "0.0.8" + } + }, + "ms": { + "version": "2.0.0", + "bundled": true, + "dev": true, + "optional": true + }, + "needle": { + "version": "2.2.0", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "debug": "^2.1.2", + "iconv-lite": "^0.4.4", + "sax": "^1.2.4" + } + }, + "node-pre-gyp": { + "version": "0.10.0", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "detect-libc": "^1.0.2", + "mkdirp": "^0.5.1", + "needle": "^2.2.0", + "nopt": "^4.0.1", + "npm-packlist": "^1.1.6", + "npmlog": "^4.0.2", + "rc": "^1.1.7", + "rimraf": "^2.6.1", + "semver": "^5.3.0", + "tar": "^4" + } + }, + "nopt": { + "version": "4.0.1", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "abbrev": "1", + "osenv": "^0.1.4" + } + }, + "npm-bundled": { + "version": "1.0.3", + "bundled": true, + "dev": true, + "optional": true + }, + "npm-packlist": { + "version": "1.1.10", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "ignore-walk": "^3.0.1", + "npm-bundled": "^1.0.1" + } + }, + "npmlog": { + "version": "4.1.2", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "are-we-there-yet": "~1.1.2", + "console-control-strings": "~1.1.0", + "gauge": "~2.7.3", + "set-blocking": "~2.0.0" + } + }, + "number-is-nan": { + "version": "1.0.1", + "bundled": true, + "dev": true + }, + "object-assign": { + "version": "4.1.1", + "bundled": true, + "dev": true, + "optional": true + }, + "once": { + "version": "1.4.0", + "bundled": true, + "dev": true, + "requires": { + "wrappy": "1" + } + }, + "os-homedir": { + "version": "1.0.2", + "bundled": true, + "dev": true, + "optional": true + }, + "os-tmpdir": { + "version": "1.0.2", + "bundled": true, + "dev": true, + "optional": true + }, + "osenv": { + "version": "0.1.5", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "os-homedir": "^1.0.0", + "os-tmpdir": "^1.0.0" + } + }, + "path-is-absolute": { + "version": "1.0.1", + "bundled": true, + "dev": true, + "optional": true + }, + "process-nextick-args": { + "version": "2.0.0", + "bundled": true, + "dev": true, + "optional": true + }, + "rc": { + "version": "1.2.7", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "deep-extend": "^0.5.1", + "ini": "~1.3.0", + "minimist": "^1.2.0", + "strip-json-comments": "~2.0.1" + }, + "dependencies": { + "minimist": { + "version": "1.2.0", + "bundled": true, + "dev": true, + "optional": true + } + } + }, + "readable-stream": { + "version": "2.3.6", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" + } + }, + "rimraf": { + "version": "2.6.2", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "glob": "^7.0.5" + } + }, + "safe-buffer": { + "version": "5.1.1", + "bundled": true, + "dev": true + }, + "safer-buffer": { + "version": "2.1.2", + "bundled": true, + "dev": true, + "optional": true + }, + "sax": { + "version": "1.2.4", + "bundled": true, + "dev": true, + "optional": true + }, + "semver": { + "version": "5.5.0", + "bundled": true, + "dev": true, + "optional": true + }, + "set-blocking": { + "version": "2.0.0", + "bundled": true, + "dev": true, + "optional": true + }, + "signal-exit": { + "version": "3.0.2", + "bundled": true, + "dev": true, + "optional": true + }, + "string-width": { + "version": "1.0.2", + "bundled": true, + "dev": true, + "requires": { + "code-point-at": "^1.0.0", + "is-fullwidth-code-point": "^1.0.0", + "strip-ansi": "^3.0.0" + } + }, + "string_decoder": { + "version": "1.1.1", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "safe-buffer": "~5.1.0" + } + }, + "strip-ansi": { + "version": "3.0.1", + "bundled": true, + "dev": true, + "requires": { + "ansi-regex": "^2.0.0" + } + }, + "strip-json-comments": { + "version": "2.0.1", + "bundled": true, + "dev": true, + "optional": true + }, + "tar": { + "version": "4.4.1", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "chownr": "^1.0.1", + "fs-minipass": "^1.2.5", + "minipass": "^2.2.4", + "minizlib": "^1.1.0", + "mkdirp": "^0.5.0", + "safe-buffer": "^5.1.1", + "yallist": "^3.0.2" + } + }, + "util-deprecate": { + "version": "1.0.2", + "bundled": true, + "dev": true, + "optional": true + }, + "wide-align": { + "version": "1.1.2", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "string-width": "^1.0.2" + } + }, + "wrappy": { + "version": "1.0.2", + "bundled": true, + "dev": true + }, + "yallist": { + "version": "3.0.2", + "bundled": true, + "dev": true + } + } + }, + "function-bind": { + "version": "1.1.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/function-bind/-/function-bind-1.1.1.tgz", + "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==", + "dev": true + }, + "gauge": { + "version": "2.7.4", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/gauge/-/gauge-2.7.4.tgz", + "integrity": "sha1-LANAXHU4w51+s3sxcCLjJfsBi/c=", + "dev": true, + "optional": true, + "requires": { + "aproba": "^1.0.3", + "console-control-strings": "^1.0.0", + "has-unicode": "^2.0.0", + "object-assign": "^4.1.0", + "signal-exit": "^3.0.0", + "string-width": "^1.0.1", + "strip-ansi": "^3.0.1", + "wide-align": "^1.1.0" + } + }, + "generator-jhipster": { + "version": "5.4.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/generator-jhipster/-/generator-jhipster-5.4.2.tgz", + "integrity": "sha512-iuTZGPonlMFWrabTC7x27UnCa8sckWFKD7HiwMp2JOYLlLU+BPt0WJWlQ9hJv5JHHx+pe0pUxwEHbi0fSu0Ljw==", + "dev": true, + "requires": { + "axios": "0.18.0", + "chalk": "2.4.1", + "commander": "2.16.0", + "conf": "2.0.0", + "didyoumean": "1.2.1", + "ejs": "2.6.1", + "glob": "7.1.2", + "gulp-filter": "5.1.0", + "insight": "0.10.1", + "jhipster-core": "3.4.0", + "js-object-pretty-print": "0.3.0", + "js-yaml": "3.12.0", + "lodash": "4.17.10", + "meow": "5.0.0", + "mkdirp": "0.5.1", + "os-locale": "2.1.0", + "parse-gitignore": "1.0.1", + "pluralize": "7.0.0", + "prettier": "1.13.7", + "randexp": "0.4.9", + "semver": "5.5.0", + "shelljs": "0.8.2", + "tabtab": "2.2.2", + "through2": "2.0.3", + "uuid": "3.3.2", + "yeoman-environment": "2.3.0", + "yeoman-generator": "3.0.0" + }, + "dependencies": { + "ansi-styles": { + "version": "3.2.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, + "requires": { + "color-convert": "^1.9.0" + } + }, + "axios": { + "version": "0.18.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/axios/-/axios-0.18.0.tgz", + "integrity": "sha1-MtU+SFHv3AoRmTts0AB4nXDAUQI=", + "dev": true, + "requires": { + "follow-redirects": "^1.3.0", + "is-buffer": "^1.1.5" + } + }, + "chalk": { + "version": "2.4.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/chalk/-/chalk-2.4.1.tgz", + "integrity": "sha512-ObN6h1v2fTJSmUXoS3nMQ92LbDK9be4TV+6G+omQlGJFdcUX5heKi1LZ1YnRMIgwTLEj3E24bT6tYni50rlCfQ==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + } + }, + "commander": { + "version": "2.16.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/commander/-/commander-2.16.0.tgz", + "integrity": "sha512-sVXqklSaotK9at437sFlFpyOcJonxe0yST/AG9DkQKUdIE6IqGIMv4SfAQSKaJbSdVEJYItASCrBiVQHq1HQew==", + "dev": true + }, + "esprima": { + "version": "4.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/esprima/-/esprima-4.0.1.tgz", + "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==", + "dev": true + }, + "glob": { + "version": "7.1.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/glob/-/glob-7.1.2.tgz", + "integrity": "sha512-MJTUg1kjuLeQCJ+ccE4Vpa6kKVXkPYJ2mOCQyUuKLcLQsdrMCpBPUi8qVE6+YuaJkozeA9NusTAw3hLr8Xe5EQ==", + "dev": true, + "requires": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + } + }, + "has-flag": { + "version": "3.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", + "dev": true + }, + "js-yaml": { + "version": "3.12.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/js-yaml/-/js-yaml-3.12.0.tgz", + "integrity": "sha512-PIt2cnwmPfL4hKNwqeiuz4bKfnzHTBv6HyVgjahA6mPLwPDzjDWrplJBMjHUFxku/N3FlmrbyPclad+I+4mJ3A==", + "dev": true, + "requires": { + "argparse": "^1.0.7", + "esprima": "^4.0.0" + } + }, + "lodash": { + "version": "4.17.10", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/lodash/-/lodash-4.17.10.tgz", + "integrity": "sha512-UejweD1pDoXu+AD825lWwp4ZGtSwgnpZxb3JDViD7StjQz+Nb/6l093lx4OQ0foGWNRoc19mWy7BzL+UAK2iVg==", + "dev": true + }, + "os-locale": { + "version": "2.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/os-locale/-/os-locale-2.1.0.tgz", + "integrity": "sha512-3sslG3zJbEYcaC4YVAvDorjGxc7tv6KVATnLPZONiljsUncvihe9BQoVCEs0RZ1kmf4Hk9OBqlZfJZWI4GanKA==", + "dev": true, + "requires": { + "execa": "^0.7.0", + "lcid": "^1.0.0", + "mem": "^1.1.0" + } + }, + "prettier": { + "version": "1.13.7", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/prettier/-/prettier-1.13.7.tgz", + "integrity": "sha512-KIU72UmYPGk4MujZGYMFwinB7lOf2LsDNGSOC8ufevsrPLISrZbNJlWstRi3m0AMuszbH+EFSQ/r6w56RSPK6w==", + "dev": true + }, + "semver": { + "version": "5.5.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/semver/-/semver-5.5.0.tgz", + "integrity": "sha512-4SJ3dm0WAwWy/NVeioZh5AntkdJoWKxHxcmyP622fOkgHa4z3R0TdBJICINyaSDE6uNwVc8gZr+ZinwZAH4xIA==", + "dev": true + }, + "supports-color": { + "version": "5.5.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } + } + } + }, + "get-caller-file": { + "version": "1.0.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/get-caller-file/-/get-caller-file-1.0.2.tgz", + "integrity": "sha1-9wLmMSfn4jHBYKgMFVSstw1QR+U=", + "dev": true + }, + "get-own-enumerable-property-symbols": { + "version": "2.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/get-own-enumerable-property-symbols/-/get-own-enumerable-property-symbols-2.0.1.tgz", + "integrity": "sha512-TtY/sbOemiMKPRUDDanGCSgBYe7Mf0vbRsWnBZ+9yghpZ1MvcpSpuZFjHdEeY/LZjZy0vdLjS77L6HosisFiug==", + "dev": true + }, + "get-stdin": { + "version": "6.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/get-stdin/-/get-stdin-6.0.0.tgz", + "integrity": "sha512-jp4tHawyV7+fkkSKyvjuLZswblUtz+SQKzSWnBbii16BuZksJlU1wuBYXY75r+duh/llF1ur6oNwi+2ZzjKZ7g==", + "dev": true + }, + "get-stream": { + "version": "3.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/get-stream/-/get-stream-3.0.0.tgz", + "integrity": "sha1-jpQ9E1jcN1VQVOy+LtsFqhdO3hQ=", + "dev": true + }, + "get-value": { + "version": "2.0.6", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/get-value/-/get-value-2.0.6.tgz", + "integrity": "sha1-3BXKHGcjh8p2vTesCjlbogQqLCg=", + "dev": true + }, + "getpass": { + "version": "0.1.7", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/getpass/-/getpass-0.1.7.tgz", + "integrity": "sha1-Xv+OPmhNVprkyysSgmBOi6YhSfo=", + "dev": true, + "requires": { + "assert-plus": "^1.0.0" + } + }, + "gh-got": { + "version": "6.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/gh-got/-/gh-got-6.0.0.tgz", + "integrity": "sha512-F/mS+fsWQMo1zfgG9MD8KWvTWPPzzhuVwY++fhQ5Ggd+0P+CAMHtzMZhNxG+TqGfHDChJKsbh6otfMGqO2AKBw==", + "dev": true, + "requires": { + "got": "^7.0.0", + "is-plain-obj": "^1.1.0" + } + }, + "github-username": { + "version": "4.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/github-username/-/github-username-4.1.0.tgz", + "integrity": "sha1-y+KABBiDIG2kISrp5LXxacML9Bc=", + "dev": true, + "requires": { + "gh-got": "^6.0.0" + } + }, + "glob": { + "version": "7.1.3", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/glob/-/glob-7.1.3.tgz", + "integrity": "sha512-vcfuiIxogLV4DlGBHIUOwI0IbrJ8HWPc4MU7HzviGeNho/UJDfi6B5p3sHeWIQ0KGIU0Jpxi5ZHxemQfLkkAwQ==", + "dev": true, + "requires": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + } + }, + "glob-all": { + "version": "3.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/glob-all/-/glob-all-3.1.0.tgz", + "integrity": "sha1-iRPd+17hrHgSZWJBsD1SF8ZLAqs=", + "dev": true, + "requires": { + "glob": "^7.0.5", + "yargs": "~1.2.6" + }, + "dependencies": { + "minimist": { + "version": "0.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/minimist/-/minimist-0.1.0.tgz", + "integrity": "sha1-md9lelJXTCHJBXSX33QnkLK0wN4=", + "dev": true + }, + "yargs": { + "version": "1.2.6", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/yargs/-/yargs-1.2.6.tgz", + "integrity": "sha1-nHtKgv1dWVsr8Xq23MQxNUMv40s=", + "dev": true, + "requires": { + "minimist": "^0.1.0" + } + } + } + }, + "glob-base": { + "version": "0.3.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/glob-base/-/glob-base-0.3.0.tgz", + "integrity": "sha1-27Fk9iIbHAscz4Kuoyi0l98Oo8Q=", + "dev": true, + "requires": { + "glob-parent": "^2.0.0", + "is-glob": "^2.0.0" + }, + "dependencies": { + "glob-parent": { + "version": "2.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/glob-parent/-/glob-parent-2.0.0.tgz", + "integrity": "sha1-gTg9ctsFT8zPUzbaqQLxgvbtuyg=", + "dev": true, + "requires": { + "is-glob": "^2.0.0" + } + }, + "is-extglob": { + "version": "1.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/is-extglob/-/is-extglob-1.0.0.tgz", + "integrity": "sha1-rEaBd8SUNAWgkvyPKXYMb/xiBsA=", + "dev": true + }, + "is-glob": { + "version": "2.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/is-glob/-/is-glob-2.0.1.tgz", + "integrity": "sha1-0Jb5JqPe1WAPP9/ZEZjLCIjC2GM=", + "dev": true, + "requires": { + "is-extglob": "^1.0.0" + } + } + } + }, + "glob-parent": { + "version": "3.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/glob-parent/-/glob-parent-3.1.0.tgz", + "integrity": "sha1-nmr2KZ2NO9K9QEMIMr0RPfkGxa4=", + "dev": true, + "requires": { + "is-glob": "^3.1.0", + "path-dirname": "^1.0.0" + }, + "dependencies": { + "is-glob": { + "version": "3.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/is-glob/-/is-glob-3.1.0.tgz", + "integrity": "sha1-e6WuJCF4BKxwcHuWkiVnSGzD6Eo=", + "dev": true, + "requires": { + "is-extglob": "^2.1.0" + } + } + } + }, + "glob-to-regexp": { + "version": "0.3.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/glob-to-regexp/-/glob-to-regexp-0.3.0.tgz", + "integrity": "sha1-jFoUlNIGbFcMw7/kSWF1rMTVAqs=", + "dev": true + }, + "glob2base": { + "version": "0.0.12", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/glob2base/-/glob2base-0.0.12.tgz", + "integrity": "sha1-nUGbPijxLoOjYhZKJ3BVkiycDVY=", + "dev": true, + "requires": { + "find-index": "^0.1.1" + } + }, + "global-modules": { + "version": "1.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/global-modules/-/global-modules-1.0.0.tgz", + "integrity": "sha512-sKzpEkf11GpOFuw0Zzjzmt4B4UZwjOcG757PPvrfhxcLFbq0wpsgpOqxpxtxFiCG4DtG93M6XRVbF2oGdev7bg==", + "dev": true, + "requires": { + "global-prefix": "^1.0.1", + "is-windows": "^1.0.1", + "resolve-dir": "^1.0.0" + } + }, + "global-prefix": { + "version": "1.0.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/global-prefix/-/global-prefix-1.0.2.tgz", + "integrity": "sha1-2/dDxsFJklk8ZVVoy2btMsASLr4=", + "dev": true, + "requires": { + "expand-tilde": "^2.0.2", + "homedir-polyfill": "^1.0.1", + "ini": "^1.3.4", + "is-windows": "^1.0.1", + "which": "^1.2.14" + } + }, + "globals": { + "version": "9.18.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/globals/-/globals-9.18.0.tgz", + "integrity": "sha512-S0nG3CLEQiY/ILxqtztTWH/3iRRdyBLw6KMDxnKMchrtbj2OFmehVh0WUCfW3DUrIgx/qFrJPICrq4Z4sTR9UQ==", + "dev": true + }, + "globby": { + "version": "7.1.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/globby/-/globby-7.1.1.tgz", + "integrity": "sha1-+yzP+UAfhgCUXfral0QMypcrhoA=", + "dev": true, + "requires": { + "array-union": "^1.0.1", + "dir-glob": "^2.0.0", + "glob": "^7.1.2", + "ignore": "^3.3.5", + "pify": "^3.0.0", + "slash": "^1.0.0" + }, + "dependencies": { + "pify": { + "version": "3.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/pify/-/pify-3.0.0.tgz", + "integrity": "sha1-5aSs0sEB/fPZpNB/DbxNtJ3SgXY=", + "dev": true + } + } + }, + "got": { + "version": "7.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/got/-/got-7.1.0.tgz", + "integrity": "sha512-Y5WMo7xKKq1muPsxD+KmrR8DH5auG7fBdDVueZwETwV6VytKyU9OX/ddpq2/1hp1vIPvVb4T81dKQz3BivkNLw==", + "dev": true, + "requires": { + "decompress-response": "^3.2.0", + "duplexer3": "^0.1.4", + "get-stream": "^3.0.0", + "is-plain-obj": "^1.1.0", + "is-retry-allowed": "^1.0.0", + "is-stream": "^1.0.0", + "isurl": "^1.0.0-alpha5", + "lowercase-keys": "^1.0.0", + "p-cancelable": "^0.3.0", + "p-timeout": "^1.1.1", + "safe-buffer": "^5.0.1", + "timed-out": "^4.0.0", + "url-parse-lax": "^1.0.0", + "url-to-options": "^1.0.1" + } + }, + "graceful-fs": { + "version": "4.1.11", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/graceful-fs/-/graceful-fs-4.1.11.tgz", + "integrity": "sha1-Dovf5NHduIVNZOBOp8AOKgJuVlg=", + "dev": true + }, + "grouped-queue": { + "version": "0.3.3", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/grouped-queue/-/grouped-queue-0.3.3.tgz", + "integrity": "sha1-wWfSpTGcWg4JZO9qJbfC34mWyFw=", + "dev": true, + "requires": { + "lodash": "^4.17.2" + }, + "dependencies": { + "lodash": { + "version": "4.17.11", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/lodash/-/lodash-4.17.11.tgz", + "integrity": "sha512-cQKh8igo5QUhZ7lg38DYWAxMvjSAKG0A8wGSVimP07SIUEK2UO+arSRKbRZWtelMtN5V0Hkwh5ryOto/SshYIg==", + "dev": true + } + } + }, + "growly": { + "version": "1.3.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/growly/-/growly-1.3.0.tgz", + "integrity": "sha1-8QdIy+dq+WS3yWyTxrzCivEgwIE=", + "dev": true + }, + "gulp-filter": { + "version": "5.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/gulp-filter/-/gulp-filter-5.1.0.tgz", + "integrity": "sha1-oF4Rr/sHz33PQafeHLe2OsN4PnM=", + "dev": true, + "requires": { + "multimatch": "^2.0.0", + "plugin-error": "^0.1.2", + "streamfilter": "^1.0.5" + } + }, + "handle-thing": { + "version": "1.2.5", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/handle-thing/-/handle-thing-1.2.5.tgz", + "integrity": "sha1-/Xqtcmvxpf0W38KbL3pmAdJxOcQ=", + "dev": true + }, + "handlebars": { + "version": "4.0.11", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/handlebars/-/handlebars-4.0.11.tgz", + "integrity": "sha1-Ywo13+ApS8KB7a5v/F0yn8eYLcw=", + "dev": true, + "requires": { + "async": "^1.4.0", + "optimist": "^0.6.1", + "source-map": "^0.4.4", + "uglify-js": "^2.6" + }, + "dependencies": { + "camelcase": { + "version": "1.2.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/camelcase/-/camelcase-1.2.1.tgz", + "integrity": "sha1-m7UwTS4LVmmLLHWLCKPqqdqlijk=", + "dev": true, + "optional": true + }, + "cliui": { + "version": "2.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/cliui/-/cliui-2.1.0.tgz", + "integrity": "sha1-S0dXYP+AJkx2LDoXGQMukcf+oNE=", + "dev": true, + "optional": true, + "requires": { + "center-align": "^0.1.1", + "right-align": "^0.1.1", + "wordwrap": "0.0.2" + } + }, + "source-map": { + "version": "0.4.4", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/source-map/-/source-map-0.4.4.tgz", + "integrity": "sha1-66T12pwNyZneaAMti092FzZSA2s=", + "dev": true, + "requires": { + "amdefine": ">=0.0.4" + } + }, + "uglify-js": { + "version": "2.8.29", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/uglify-js/-/uglify-js-2.8.29.tgz", + "integrity": "sha1-KcVzMUgFe7Th913zW3qcty5qWd0=", + "dev": true, + "optional": true, + "requires": { + "source-map": "~0.5.1", + "uglify-to-browserify": "~1.0.0", + "yargs": "~3.10.0" + }, + "dependencies": { + "source-map": { + "version": "0.5.7", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/source-map/-/source-map-0.5.7.tgz", + "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=", + "dev": true, + "optional": true + } + } + }, + "window-size": { + "version": "0.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/window-size/-/window-size-0.1.0.tgz", + "integrity": "sha1-VDjNLqk7IC76Ohn+iIeu58lPnJ0=", + "dev": true, + "optional": true + }, + "wordwrap": { + "version": "0.0.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/wordwrap/-/wordwrap-0.0.2.tgz", + "integrity": "sha1-t5Zpu0LstAn4PVg8rVLKF+qhZD8=", + "dev": true, + "optional": true + }, + "yargs": { + "version": "3.10.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/yargs/-/yargs-3.10.0.tgz", + "integrity": "sha1-9+572FfdfB0tOMDnTvvWgdFDH9E=", + "dev": true, + "optional": true, + "requires": { + "camelcase": "^1.0.2", + "cliui": "^2.1.0", + "decamelize": "^1.0.0", + "window-size": "0.1.0" + } + } + } + }, + "har-schema": { + "version": "2.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/har-schema/-/har-schema-2.0.0.tgz", + "integrity": "sha1-qUwiJOvKwEeCoNkDVSHyRzW37JI=", + "dev": true + }, + "har-validator": { + "version": "5.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/har-validator/-/har-validator-5.1.0.tgz", + "integrity": "sha512-+qnmNjI4OfH2ipQ9VQOw23bBd/ibtfbVdK2fYbY4acTDqKTW/YDp9McimZdDbG8iV9fZizUqQMD5xvriB146TA==", + "dev": true, + "requires": { + "ajv": "^5.3.0", + "har-schema": "^2.0.0" + }, + "dependencies": { + "ajv": { + "version": "5.5.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/ajv/-/ajv-5.5.2.tgz", + "integrity": "sha1-c7Xuyj+rZT49P5Qis0GtQiBdyWU=", + "dev": true, + "requires": { + "co": "^4.6.0", + "fast-deep-equal": "^1.0.0", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.3.0" + } + } + } + }, + "has": { + "version": "1.0.3", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/has/-/has-1.0.3.tgz", + "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", + "dev": true, + "requires": { + "function-bind": "^1.1.1" + } + }, + "has-ansi": { + "version": "2.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/has-ansi/-/has-ansi-2.0.0.tgz", + "integrity": "sha1-NPUEnOHs3ysGSa8+8k5F7TVBbZE=", + "dev": true, + "requires": { + "ansi-regex": "^2.0.0" + } + }, + "has-binary2": { + "version": "1.0.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/has-binary2/-/has-binary2-1.0.2.tgz", + "integrity": "sha1-6D26SfC5vk0CbSc2U1DZ8D9Uvpg=", + "dev": true, + "requires": { + "isarray": "2.0.1" + }, + "dependencies": { + "isarray": { + "version": "2.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/isarray/-/isarray-2.0.1.tgz", + "integrity": "sha1-o32U7ZzaLVmGXJ92/llu4fM4dB4=", + "dev": true + } + } + }, + "has-color": { + "version": "0.1.7", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/has-color/-/has-color-0.1.7.tgz", + "integrity": "sha1-ZxRKUmDDT8PMpnfQQdr1L+e3iy8=", + "dev": true + }, + "has-cors": { + "version": "1.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/has-cors/-/has-cors-1.1.0.tgz", + "integrity": "sha1-XkdHk/fqmEPRu5nCPu9J/xJv/zk=", + "dev": true + }, + "has-flag": { + "version": "1.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/has-flag/-/has-flag-1.0.0.tgz", + "integrity": "sha1-nZ55MWXOAXoA8AQYxD+UKnsdEfo=", + "dev": true + }, + "has-symbol-support-x": { + "version": "1.4.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/has-symbol-support-x/-/has-symbol-support-x-1.4.2.tgz", + "integrity": "sha512-3ToOva++HaW+eCpgqZrCfN51IPB+7bJNVT6CUATzueB5Heb8o6Nam0V3HG5dlDvZU1Gn5QLcbahiKw/XVk5JJw==", + "dev": true + }, + "has-symbols": { + "version": "1.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/has-symbols/-/has-symbols-1.0.0.tgz", + "integrity": "sha1-uhqPGvKg/DllD1yFA2dwQSIGO0Q=", + "dev": true + }, + "has-to-string-tag-x": { + "version": "1.4.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/has-to-string-tag-x/-/has-to-string-tag-x-1.4.1.tgz", + "integrity": "sha512-vdbKfmw+3LoOYVr+mtxHaX5a96+0f3DljYd8JOqvOLsf5mw2Otda2qCDT9qRqLAhrjyQ0h7ual5nOiASpsGNFw==", + "dev": true, + "requires": { + "has-symbol-support-x": "^1.4.1" + } + }, + "has-unicode": { + "version": "2.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/has-unicode/-/has-unicode-2.0.1.tgz", + "integrity": "sha1-4Ob+aijPUROIVeCG0Wkedx3iqLk=", + "dev": true + }, + "has-value": { + "version": "1.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/has-value/-/has-value-1.0.0.tgz", + "integrity": "sha1-GLKB2lhbHFxR3vJMkw7SmgvmsXc=", + "dev": true, + "requires": { + "get-value": "^2.0.6", + "has-values": "^1.0.0", + "isobject": "^3.0.0" + } + }, + "has-values": { + "version": "1.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/has-values/-/has-values-1.0.0.tgz", + "integrity": "sha1-lbC2P+whRmGab+V/51Yo1aOe/k8=", + "dev": true, + "requires": { + "is-number": "^3.0.0", + "kind-of": "^4.0.0" + }, + "dependencies": { + "kind-of": { + "version": "4.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/kind-of/-/kind-of-4.0.0.tgz", + "integrity": "sha1-IIE989cSkosgc3hpGkUGb65y3Vc=", + "dev": true, + "requires": { + "is-buffer": "^1.1.5" + } + } + } + }, + "hash-base": { + "version": "3.0.4", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/hash-base/-/hash-base-3.0.4.tgz", + "integrity": "sha1-X8hoaEfs1zSZQDMZprCj8/auSRg=", + "dev": true, + "requires": { + "inherits": "^2.0.1", + "safe-buffer": "^5.0.1" + } + }, + "hash.js": { + "version": "1.1.4", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/hash.js/-/hash.js-1.1.4.tgz", + "integrity": "sha512-A6RlQvvZEtFS5fLU43IDu0QUmBy+fDO9VMdTXvufKwIkt/rFfvICAViCax5fbDO4zdNzaC3/27ZhKUok5bAJyw==", + "dev": true, + "requires": { + "inherits": "^2.0.3", + "minimalistic-assert": "^1.0.0" + } + }, + "he": { + "version": "1.1.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/he/-/he-1.1.1.tgz", + "integrity": "sha1-k0EP0hsAlzUVH4howvJx80J+I/0=", + "dev": true + }, + "hex-color-regex": { + "version": "1.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/hex-color-regex/-/hex-color-regex-1.1.0.tgz", + "integrity": "sha512-l9sfDFsuqtOqKDsQdqrMRk0U85RZc0RtOR9yPI7mRVOa4FsR/BVnZ0shmQRM96Ji99kYZP/7hn1cedc1+ApsTQ==", + "dev": true + }, + "hmac-drbg": { + "version": "1.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/hmac-drbg/-/hmac-drbg-1.0.1.tgz", + "integrity": "sha1-0nRXAQJabHdabFRXk+1QL8DGSaE=", + "dev": true, + "requires": { + "hash.js": "^1.0.3", + "minimalistic-assert": "^1.0.0", + "minimalistic-crypto-utils": "^1.0.1" + } + }, + "hoek": { + "version": "4.2.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/hoek/-/hoek-4.2.1.tgz", + "integrity": "sha512-QLg82fGkfnJ/4iy1xZ81/9SIJiq1NGFUMGs6ParyjBZr6jW2Ufj/snDqTHixNlHdPNwN2RLVD0Pi3igeK9+JfA==", + "dev": true + }, + "home-or-tmp": { + "version": "2.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/home-or-tmp/-/home-or-tmp-2.0.0.tgz", + "integrity": "sha1-42w/LSyufXRqhX440Y1fMqeILbg=", + "dev": true, + "requires": { + "os-homedir": "^1.0.0", + "os-tmpdir": "^1.0.1" + } + }, + "homedir-polyfill": { + "version": "1.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/homedir-polyfill/-/homedir-polyfill-1.0.1.tgz", + "integrity": "sha1-TCu8inWJmP7r9e1oWA921GdotLw=", + "dev": true, + "requires": { + "parse-passwd": "^1.0.0" + } + }, + "hosted-git-info": { + "version": "2.7.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/hosted-git-info/-/hosted-git-info-2.7.1.tgz", + "integrity": "sha512-7T/BxH19zbcCTa8XkMlbK5lTo1WtgkFi3GvdWEyNuc4Vex7/9Dqbnpsf4JMydcfj9HCg4zUWFTL3Za6lapg5/w==", + "dev": true + }, + "hpack.js": { + "version": "2.1.6", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/hpack.js/-/hpack.js-2.1.6.tgz", + "integrity": "sha1-h3dMCUnlE/QuhFdbPEVoH63ioLI=", + "dev": true, + "requires": { + "inherits": "^2.0.1", + "obuf": "^1.0.0", + "readable-stream": "^2.0.1", + "wbuf": "^1.1.0" + } + }, + "hsl-regex": { + "version": "1.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/hsl-regex/-/hsl-regex-1.0.0.tgz", + "integrity": "sha1-1JMwx4ntgZ4nakwNJy3/owsY/m4=", + "dev": true + }, + "hsla-regex": { + "version": "1.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/hsla-regex/-/hsla-regex-1.0.0.tgz", + "integrity": "sha1-wc56MWjIxmFAM6S194d/OyJfnDg=", + "dev": true + }, + "html-comment-regex": { + "version": "1.1.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/html-comment-regex/-/html-comment-regex-1.1.1.tgz", + "integrity": "sha1-ZouTd26q5V696POtRkswekljYl4=", + "dev": true + }, + "html-encoding-sniffer": { + "version": "1.0.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/html-encoding-sniffer/-/html-encoding-sniffer-1.0.2.tgz", + "integrity": "sha512-71lZziiDnsuabfdYiUeWdCVyKuqwWi23L8YeIgV9jSSZHCtb6wB1BKWooH7L3tn4/FuZJMVWyNaIDr4RGmaSYw==", + "dev": true, + "requires": { + "whatwg-encoding": "^1.0.1" + } + }, + "html-entities": { + "version": "1.2.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/html-entities/-/html-entities-1.2.1.tgz", + "integrity": "sha1-DfKTUfByEWNRXfueVUPl9u7VFi8=", + "dev": true + }, + "html-loader": { + "version": "0.5.5", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/html-loader/-/html-loader-0.5.5.tgz", + "integrity": "sha512-7hIW7YinOYUpo//kSYcPB6dCKoceKLmOwjEMmhIobHuWGDVl0Nwe4l68mdG/Ru0wcUxQjVMEoZpkalZ/SE7zog==", + "dev": true, + "requires": { + "es6-templates": "^0.2.3", + "fastparse": "^1.1.1", + "html-minifier": "^3.5.8", + "loader-utils": "^1.1.0", + "object-assign": "^4.1.1" + } + }, + "html-minifier": { + "version": "3.5.16", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/html-minifier/-/html-minifier-3.5.16.tgz", + "integrity": "sha512-zP5EfLSpiLRp0aAgud4CQXPQZm9kXwWjR/cF0PfdOj+jjWnOaCgeZcll4kYXSvIBPeUMmyaSc7mM4IDtA+kboA==", + "dev": true, + "requires": { + "camel-case": "3.0.x", + "clean-css": "4.1.x", + "commander": "2.15.x", + "he": "1.1.x", + "param-case": "2.1.x", + "relateurl": "0.2.x", + "uglify-js": "3.3.x" + }, + "dependencies": { + "commander": { + "version": "2.15.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/commander/-/commander-2.15.1.tgz", + "integrity": "sha512-VlfT9F3V0v+jr4yxPc5gg9s62/fIVWsd2Bk2iD435um1NlGMYdVCq+MjcXnhYq2icNOizHr1kK+5TI6H0Hy0ag==", + "dev": true + } + } + }, + "html-webpack-plugin": { + "version": "3.2.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/html-webpack-plugin/-/html-webpack-plugin-3.2.0.tgz", + "integrity": "sha1-sBq71yOsqqeze2r0SS69oD2d03s=", + "dev": true, + "requires": { + "html-minifier": "^3.2.3", + "loader-utils": "^0.2.16", + "lodash": "^4.17.3", + "pretty-error": "^2.0.2", + "tapable": "^1.0.0", + "toposort": "^1.0.0", + "util.promisify": "1.0.0" + }, + "dependencies": { + "loader-utils": { + "version": "0.2.17", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/loader-utils/-/loader-utils-0.2.17.tgz", + "integrity": "sha1-+G5jdNQyBabmxg6RlvF8Apm/s0g=", + "dev": true, + "requires": { + "big.js": "^3.1.3", + "emojis-list": "^2.0.0", + "json5": "^0.5.0", + "object-assign": "^4.0.1" + } + }, + "lodash": { + "version": "4.17.11", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/lodash/-/lodash-4.17.11.tgz", + "integrity": "sha512-cQKh8igo5QUhZ7lg38DYWAxMvjSAKG0A8wGSVimP07SIUEK2UO+arSRKbRZWtelMtN5V0Hkwh5ryOto/SshYIg==", + "dev": true + } + } + }, + "htmlparser2": { + "version": "3.3.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/htmlparser2/-/htmlparser2-3.3.0.tgz", + "integrity": "sha1-zHDQWln2VC5D8OaFyYLhTJJKnv4=", + "dev": true, + "requires": { + "domelementtype": "1", + "domhandler": "2.1", + "domutils": "1.1", + "readable-stream": "1.0" + }, + "dependencies": { + "domutils": { + "version": "1.1.6", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/domutils/-/domutils-1.1.6.tgz", + "integrity": "sha1-vdw94Jm5ou+sxRxiPyj0FuzFdIU=", + "dev": true, + "requires": { + "domelementtype": "1" + } + }, + "isarray": { + "version": "0.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/isarray/-/isarray-0.0.1.tgz", + "integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8=", + "dev": true + }, + "readable-stream": { + "version": "1.0.34", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/readable-stream/-/readable-stream-1.0.34.tgz", + "integrity": "sha1-Elgg40vIQtLyqq+v5MKRbuMsFXw=", + "dev": true, + "requires": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.1", + "isarray": "0.0.1", + "string_decoder": "~0.10.x" + } + }, + "string_decoder": { + "version": "0.10.31", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/string_decoder/-/string_decoder-0.10.31.tgz", + "integrity": "sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ=", + "dev": true + } + } + }, + "http-cache-semantics": { + "version": "3.8.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/http-cache-semantics/-/http-cache-semantics-3.8.1.tgz", + "integrity": "sha512-5ai2iksyV8ZXmnZhHH4rWPoxxistEexSi5936zIQ1bnNTW5VnA85B6P/VpXiRM017IgRvb2kKo1a//y+0wSp3w==", + "dev": true + }, + "http-deceiver": { + "version": "1.2.7", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/http-deceiver/-/http-deceiver-1.2.7.tgz", + "integrity": "sha1-+nFolEq5pRnTN8sL7HKE3D5yPYc=", + "dev": true + }, + "http-errors": { + "version": "1.6.3", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/http-errors/-/http-errors-1.6.3.tgz", + "integrity": "sha1-i1VoC7S+KDoLW/TqLjhYC+HZMg0=", + "dev": true, + "requires": { + "depd": "~1.1.2", + "inherits": "2.0.3", + "setprototypeof": "1.1.0", + "statuses": ">= 1.4.0 < 2" + }, + "dependencies": { + "statuses": { + "version": "1.5.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/statuses/-/statuses-1.5.0.tgz", + "integrity": "sha1-Fhx9rBd2Wf2YEfQ3cfqZOBR4Yow=", + "dev": true + } + } + }, + "http-parser-js": { + "version": "0.4.13", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/http-parser-js/-/http-parser-js-0.4.13.tgz", + "integrity": "sha1-O9bW/ebjFyyTNMOzO2wZPYD+ETc=", + "dev": true + }, + "http-proxy": { + "version": "1.15.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/http-proxy/-/http-proxy-1.15.2.tgz", + "integrity": "sha1-ZC/cr/5S00SNK9o7AHnpQJBk2jE=", + "dev": true, + "requires": { + "eventemitter3": "1.x.x", + "requires-port": "1.x.x" + } + }, + "http-proxy-middleware": { + "version": "0.18.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/http-proxy-middleware/-/http-proxy-middleware-0.18.0.tgz", + "integrity": "sha512-Fs25KVMPAIIcgjMZkVHJoKg9VcXcC1C8yb9JUgeDvVXY0S/zgVIhMb+qVswDIgtJe2DfckMSY2d6TuTEutlk6Q==", + "dev": true, + "requires": { + "http-proxy": "^1.16.2", + "is-glob": "^4.0.0", + "lodash": "^4.17.5", + "micromatch": "^3.1.9" + }, + "dependencies": { + "eventemitter3": { + "version": "3.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/eventemitter3/-/eventemitter3-3.1.0.tgz", + "integrity": "sha512-ivIvhpq/Y0uSjcHDcOIccjmYjGLcP09MFGE7ysAwkAvkXfpZlC985pH2/ui64DKazbTW/4kN3yqozUxlXzI6cA==", + "dev": true + }, + "http-proxy": { + "version": "1.17.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/http-proxy/-/http-proxy-1.17.0.tgz", + "integrity": "sha512-Taqn+3nNvYRfJ3bGvKfBSRwy1v6eePlm3oc/aWVxZp57DQr5Eq3xhKJi7Z4hZpS8PC3H4qI+Yly5EmFacGuA/g==", + "dev": true, + "requires": { + "eventemitter3": "^3.0.0", + "follow-redirects": "^1.0.0", + "requires-port": "^1.0.0" + } + }, + "lodash": { + "version": "4.17.11", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/lodash/-/lodash-4.17.11.tgz", + "integrity": "sha512-cQKh8igo5QUhZ7lg38DYWAxMvjSAKG0A8wGSVimP07SIUEK2UO+arSRKbRZWtelMtN5V0Hkwh5ryOto/SshYIg==", + "dev": true + } + } + }, + "http-signature": { + "version": "1.2.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/http-signature/-/http-signature-1.2.0.tgz", + "integrity": "sha1-muzZJRFHcvPZW2WmCruPfBj7rOE=", + "dev": true, + "requires": { + "assert-plus": "^1.0.0", + "jsprim": "^1.2.2", + "sshpk": "^1.7.0" + } + }, + "https-browserify": { + "version": "1.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/https-browserify/-/https-browserify-1.0.0.tgz", + "integrity": "sha1-7AbBDgo0wPL68Zn3/X/Hj//QPHM=", + "dev": true + }, + "husky": { + "version": "1.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/husky/-/husky-1.1.0.tgz", + "integrity": "sha512-jnUD0PK3xGLB5Jc3f3UEwl8qOZeLd0WiWABhVyHPS5R298HOccGZJMOMBSk3gFksAa1BeK9FQYYEfPNlqkfBxg==", + "dev": true, + "requires": { + "cosmiconfig": "^5.0.6", + "execa": "^0.9.0", + "find-up": "^3.0.0", + "get-stdin": "^6.0.0", + "is-ci": "^1.2.1", + "pkg-dir": "^3.0.0", + "please-upgrade-node": "^3.1.1", + "read-pkg": "^4.0.1", + "run-node": "^1.0.0", + "slash": "^2.0.0" + }, + "dependencies": { + "execa": { + "version": "0.9.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/execa/-/execa-0.9.0.tgz", + "integrity": "sha512-BbUMBiX4hqiHZUA5+JujIjNb6TyAlp2D5KLheMjMluwOuzcnylDL4AxZYLLn1n2AGB49eSWwyKvvEQoRpnAtmA==", + "dev": true, + "requires": { + "cross-spawn": "^5.0.1", + "get-stream": "^3.0.0", + "is-stream": "^1.1.0", + "npm-run-path": "^2.0.0", + "p-finally": "^1.0.0", + "signal-exit": "^3.0.0", + "strip-eof": "^1.0.0" + } + }, + "find-up": { + "version": "3.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/find-up/-/find-up-3.0.0.tgz", + "integrity": "sha512-1yD6RmLI1XBfxugvORwlck6f75tYL+iR0jqwsOrOxMZyGYqUuDhJ0l4AXdO1iX/FTs9cBAMEk1gWSEx1kSbylg==", + "dev": true, + "requires": { + "locate-path": "^3.0.0" + } + }, + "locate-path": { + "version": "3.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/locate-path/-/locate-path-3.0.0.tgz", + "integrity": "sha512-7AO748wWnIhNqAuaty2ZWHkQHRSNfPVIsPIfwEOWO22AmaoVrWavlOcMR5nzTLNYvp36X220/maaRsrec1G65A==", + "dev": true, + "requires": { + "p-locate": "^3.0.0", + "path-exists": "^3.0.0" + } + }, + "p-limit": { + "version": "2.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/p-limit/-/p-limit-2.0.0.tgz", + "integrity": "sha512-fl5s52lI5ahKCernzzIyAP0QAZbGIovtVHGwpcu1Jr/EpzLVDI2myISHwGqK7m8uQFugVWSrbxH7XnhGtvEc+A==", + "dev": true, + "requires": { + "p-try": "^2.0.0" + } + }, + "p-locate": { + "version": "3.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/p-locate/-/p-locate-3.0.0.tgz", + "integrity": "sha512-x+12w/To+4GFfgJhBEpiDcLozRJGegY+Ei7/z0tSLkMmxGZNybVMSfWj9aJn8Z5Fc7dBUNJOOVgPv2H7IwulSQ==", + "dev": true, + "requires": { + "p-limit": "^2.0.0" + } + }, + "p-try": { + "version": "2.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/p-try/-/p-try-2.0.0.tgz", + "integrity": "sha512-hMp0onDKIajHfIkdRk3P4CdCmErkYAxxDtP3Wx/4nZ3aGlau2VKh3mZpcuFkH27WQkL/3WBCPOktzA9ZOAnMQQ==", + "dev": true + }, + "parse-json": { + "version": "4.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/parse-json/-/parse-json-4.0.0.tgz", + "integrity": "sha1-vjX1Qlvh9/bHRxhPmKeIy5lHfuA=", + "dev": true, + "requires": { + "error-ex": "^1.3.1", + "json-parse-better-errors": "^1.0.1" + } + }, + "path-exists": { + "version": "3.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/path-exists/-/path-exists-3.0.0.tgz", + "integrity": "sha1-zg6+ql94yxiSXqfYENe1mwEP1RU=", + "dev": true + }, + "pify": { + "version": "3.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/pify/-/pify-3.0.0.tgz", + "integrity": "sha1-5aSs0sEB/fPZpNB/DbxNtJ3SgXY=", + "dev": true + }, + "pkg-dir": { + "version": "3.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/pkg-dir/-/pkg-dir-3.0.0.tgz", + "integrity": "sha512-/E57AYkoeQ25qkxMj5PBOVgF8Kiu/h7cYS30Z5+R7WaiCCBfLq58ZI/dSeaEKb9WVJV5n/03QwrN3IeWIFllvw==", + "dev": true, + "requires": { + "find-up": "^3.0.0" + } + }, + "read-pkg": { + "version": "4.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/read-pkg/-/read-pkg-4.0.1.tgz", + "integrity": "sha1-ljYlN48+HE1IyFhytabsfV0JMjc=", + "dev": true, + "requires": { + "normalize-package-data": "^2.3.2", + "parse-json": "^4.0.0", + "pify": "^3.0.0" + } + }, + "slash": { + "version": "2.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/slash/-/slash-2.0.0.tgz", + "integrity": "sha512-ZYKh3Wh2z1PpEXWr0MpSBZ0V6mZHAQfYevttO11c51CaWjGTaadiKZ+wVt1PbMlDV5qhMFslpZCemhwOK7C89A==", + "dev": true + } + } + }, + "iconv-lite": { + "version": "0.4.23", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/iconv-lite/-/iconv-lite-0.4.23.tgz", + "integrity": "sha512-neyTUVFtahjf0mB3dZT77u+8O0QB89jFdnBkd5P1JgYPbPaia3gXXOVL2fq8VyU2gMMD7SaN7QukTB/pmXYvDA==", + "dev": true, + "requires": { + "safer-buffer": ">= 2.1.2 < 3" + } + }, + "icss-replace-symbols": { + "version": "1.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/icss-replace-symbols/-/icss-replace-symbols-1.1.0.tgz", + "integrity": "sha1-Bupvg2ead0njhs/h/oEq5dsiPe0=", + "dev": true + }, + "icss-utils": { + "version": "2.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/icss-utils/-/icss-utils-2.1.0.tgz", + "integrity": "sha1-g/Cg7DeL8yRheLbCrZE28TWxyWI=", + "dev": true, + "requires": { + "postcss": "^6.0.1" + }, + "dependencies": { + "ansi-styles": { + "version": "3.2.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, + "requires": { + "color-convert": "^1.9.0" + } + }, + "chalk": { + "version": "2.4.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/chalk/-/chalk-2.4.1.tgz", + "integrity": "sha512-ObN6h1v2fTJSmUXoS3nMQ92LbDK9be4TV+6G+omQlGJFdcUX5heKi1LZ1YnRMIgwTLEj3E24bT6tYni50rlCfQ==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + } + }, + "has-flag": { + "version": "3.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", + "dev": true + }, + "postcss": { + "version": "6.0.23", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/postcss/-/postcss-6.0.23.tgz", + "integrity": "sha512-soOk1h6J3VMTZtVeVpv15/Hpdl2cBLX3CAw4TAbkpTJiNPk9YP/zWcD1ND+xEtvyuuvKzbxliTOIyvkSeSJ6ag==", + "dev": true, + "requires": { + "chalk": "^2.4.1", + "source-map": "^0.6.1", + "supports-color": "^5.4.0" + } + }, + "source-map": { + "version": "0.6.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "dev": true + }, + "supports-color": { + "version": "5.5.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } + } + } + }, + "ieee754": { + "version": "1.1.12", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/ieee754/-/ieee754-1.1.12.tgz", + "integrity": "sha512-GguP+DRY+pJ3soyIiGPTvdiVXjZ+DbXOxGpXn3eMvNW4x4irjqXm4wHKscC+TfxSJ0yw/S1F24tqdMNsMZTiLA==", + "dev": true + }, + "iferr": { + "version": "0.1.5", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/iferr/-/iferr-0.1.5.tgz", + "integrity": "sha1-xg7taebY/bazEEofy8ocGS3FtQE=", + "dev": true + }, + "ignore": { + "version": "3.3.10", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/ignore/-/ignore-3.3.10.tgz", + "integrity": "sha512-Pgs951kaMm5GXP7MOvxERINe3gsaVjUWFm+UZPSq9xYriQAksyhg0csnS0KXSNRD5NmNdapXEpjxG49+AKh/ug==", + "dev": true + }, + "immutable": { + "version": "3.8.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/immutable/-/immutable-3.8.2.tgz", + "integrity": "sha1-wkOZUUVbs5kT2vKBN28VMOEErfM=", + "dev": true + }, + "import-local": { + "version": "1.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/import-local/-/import-local-1.0.0.tgz", + "integrity": "sha512-vAaZHieK9qjGo58agRBg+bhHX3hoTZU/Oa3GESWLz7t1U62fk63aHuDJJEteXoDeTCcPmUT+z38gkHPZkkmpmQ==", + "dev": true, + "requires": { + "pkg-dir": "^2.0.0", + "resolve-cwd": "^2.0.0" + } + }, + "imurmurhash": { + "version": "0.1.4", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/imurmurhash/-/imurmurhash-0.1.4.tgz", + "integrity": "sha1-khi5srkoojixPcT7a21XbyMUU+o=", + "dev": true + }, + "indent-string": { + "version": "3.2.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/indent-string/-/indent-string-3.2.0.tgz", + "integrity": "sha1-Sl/W0nzDMvN+VBmlBNu4NxBckok=", + "dev": true + }, + "indexes-of": { + "version": "1.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/indexes-of/-/indexes-of-1.0.1.tgz", + "integrity": "sha1-8w9xbI4r00bHtn0985FVZqfAVgc=", + "dev": true + }, + "indexof": { + "version": "0.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/indexof/-/indexof-0.0.1.tgz", + "integrity": "sha1-gtwzbSMrkGIXnQWrMpOmYFn9Q10=", + "dev": true + }, + "inflight": { + "version": "1.0.6", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", + "dev": true, + "requires": { + "once": "^1.3.0", + "wrappy": "1" + } + }, + "inherits": { + "version": "2.0.3", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/inherits/-/inherits-2.0.3.tgz", + "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=", + "dev": true + }, + "ini": { + "version": "1.3.5", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/ini/-/ini-1.3.5.tgz", + "integrity": "sha512-RZY5huIKCMRWDUqZlEi72f/lmXKMvuszcMBduliQ3nnWbx9X/ZBQO7DijMEYS9EhHBb2qacRUMtC7svLwe0lcw==", + "dev": true + }, + "inquirer": { + "version": "5.2.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/inquirer/-/inquirer-5.2.0.tgz", + "integrity": "sha512-E9BmnJbAKLPGonz0HeWHtbKf+EeSP93paWO3ZYoUpq/aowXvYGjjCSuashhXPpzbArIjBbji39THkxTz9ZeEUQ==", + "dev": true, + "requires": { + "ansi-escapes": "^3.0.0", + "chalk": "^2.0.0", + "cli-cursor": "^2.1.0", + "cli-width": "^2.0.0", + "external-editor": "^2.1.0", + "figures": "^2.0.0", + "lodash": "^4.3.0", + "mute-stream": "0.0.7", + "run-async": "^2.2.0", + "rxjs": "^5.5.2", + "string-width": "^2.1.0", + "strip-ansi": "^4.0.0", + "through": "^2.3.6" + }, + "dependencies": { + "ansi-regex": { + "version": "3.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/ansi-regex/-/ansi-regex-3.0.0.tgz", + "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", + "dev": true + }, + "ansi-styles": { + "version": "3.2.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, + "requires": { + "color-convert": "^1.9.0" + } + }, + "chalk": { + "version": "2.4.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/chalk/-/chalk-2.4.1.tgz", + "integrity": "sha512-ObN6h1v2fTJSmUXoS3nMQ92LbDK9be4TV+6G+omQlGJFdcUX5heKi1LZ1YnRMIgwTLEj3E24bT6tYni50rlCfQ==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + } + }, + "has-flag": { + "version": "3.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", + "dev": true + }, + "is-fullwidth-code-point": { + "version": "2.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", + "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", + "dev": true + }, + "lodash": { + "version": "4.17.11", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/lodash/-/lodash-4.17.11.tgz", + "integrity": "sha512-cQKh8igo5QUhZ7lg38DYWAxMvjSAKG0A8wGSVimP07SIUEK2UO+arSRKbRZWtelMtN5V0Hkwh5ryOto/SshYIg==", + "dev": true + }, + "rxjs": { + "version": "5.5.12", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/rxjs/-/rxjs-5.5.12.tgz", + "integrity": "sha512-xx2itnL5sBbqeeiVgNPVuQQ1nC8Jp2WfNJhXWHmElW9YmrpS9UVnNzhP3EH3HFqexO5Tlp8GhYY+WEcqcVMvGw==", + "dev": true, + "requires": { + "symbol-observable": "1.0.1" + } + }, + "string-width": { + "version": "2.1.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/string-width/-/string-width-2.1.1.tgz", + "integrity": "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==", + "dev": true, + "requires": { + "is-fullwidth-code-point": "^2.0.0", + "strip-ansi": "^4.0.0" + } + }, + "strip-ansi": { + "version": "4.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/strip-ansi/-/strip-ansi-4.0.0.tgz", + "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", + "dev": true, + "requires": { + "ansi-regex": "^3.0.0" + } + }, + "supports-color": { + "version": "5.5.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } + }, + "symbol-observable": { + "version": "1.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/symbol-observable/-/symbol-observable-1.0.1.tgz", + "integrity": "sha1-g0D8RwLDEi310iKI+IKD9RPT/dQ=", + "dev": true + } + } + }, + "insight": { + "version": "0.10.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/insight/-/insight-0.10.1.tgz", + "integrity": "sha512-kLGeYQkh18f8KuC68QKdi0iwUcIaayJVB/STpX7x452/7pAUm1yfG4giJwcxbrTh0zNYtc8kBR+6maLMOzglOQ==", + "dev": true, + "requires": { + "async": "^2.1.4", + "chalk": "^2.3.0", + "conf": "^1.3.1", + "inquirer": "^5.0.0", + "lodash.debounce": "^4.0.8", + "os-name": "^2.0.1", + "request": "^2.74.0", + "tough-cookie": "^2.0.0", + "uuid": "^3.0.0" + }, + "dependencies": { + "ansi-styles": { + "version": "3.2.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, + "requires": { + "color-convert": "^1.9.0" + } + }, + "async": { + "version": "2.6.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/async/-/async-2.6.1.tgz", + "integrity": "sha512-fNEiL2+AZt6AlAw/29Cr0UDe4sRAHCpEHh54WMz+Bb7QfNcFw4h3loofyJpLeQs4Yx7yuqu/2dLgM5hKOs6HlQ==", + "dev": true, + "requires": { + "lodash": "^4.17.10" + } + }, + "chalk": { + "version": "2.4.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/chalk/-/chalk-2.4.1.tgz", + "integrity": "sha512-ObN6h1v2fTJSmUXoS3nMQ92LbDK9be4TV+6G+omQlGJFdcUX5heKi1LZ1YnRMIgwTLEj3E24bT6tYni50rlCfQ==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + } + }, + "conf": { + "version": "1.4.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/conf/-/conf-1.4.0.tgz", + "integrity": "sha512-bzlVWS2THbMetHqXKB8ypsXN4DQ/1qopGwNJi1eYbpwesJcd86FBjFciCQX/YwAhp9bM7NVnPFqZ5LpV7gP0Dg==", + "dev": true, + "requires": { + "dot-prop": "^4.1.0", + "env-paths": "^1.0.0", + "make-dir": "^1.0.0", + "pkg-up": "^2.0.0", + "write-file-atomic": "^2.3.0" + } + }, + "has-flag": { + "version": "3.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", + "dev": true + }, + "lodash": { + "version": "4.17.11", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/lodash/-/lodash-4.17.11.tgz", + "integrity": "sha512-cQKh8igo5QUhZ7lg38DYWAxMvjSAKG0A8wGSVimP07SIUEK2UO+arSRKbRZWtelMtN5V0Hkwh5ryOto/SshYIg==", + "dev": true + }, + "supports-color": { + "version": "5.5.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } + } + } + }, + "internal-ip": { + "version": "1.2.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/internal-ip/-/internal-ip-1.2.0.tgz", + "integrity": "sha1-rp+/k7mEh4eF1QqN4bNWlWBYz1w=", + "dev": true, + "requires": { + "meow": "^3.3.0" + }, + "dependencies": { + "camelcase": { + "version": "2.1.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/camelcase/-/camelcase-2.1.1.tgz", + "integrity": "sha1-fB0W1nmhu+WcoCys7PsBHiAfWh8=", + "dev": true + }, + "camelcase-keys": { + "version": "2.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/camelcase-keys/-/camelcase-keys-2.1.0.tgz", + "integrity": "sha1-MIvur/3ygRkFHvodkyITyRuPkuc=", + "dev": true, + "requires": { + "camelcase": "^2.0.0", + "map-obj": "^1.0.0" + } + }, + "get-stdin": { + "version": "4.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/get-stdin/-/get-stdin-4.0.1.tgz", + "integrity": "sha1-uWjGsKBDhDJJAui/Gl3zJXmkUP4=", + "dev": true + }, + "indent-string": { + "version": "2.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/indent-string/-/indent-string-2.1.0.tgz", + "integrity": "sha1-ji1INIdCEhtKghi3oTfppSBJ3IA=", + "dev": true, + "requires": { + "repeating": "^2.0.0" + } + }, + "map-obj": { + "version": "1.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/map-obj/-/map-obj-1.0.1.tgz", + "integrity": "sha1-2TPOuSBdgr3PSIb2dCvcK03qFG0=", + "dev": true + }, + "meow": { + "version": "3.7.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/meow/-/meow-3.7.0.tgz", + "integrity": "sha1-cstmi0JSKCkKu/qFaJJYcwioAfs=", + "dev": true, + "requires": { + "camelcase-keys": "^2.0.0", + "decamelize": "^1.1.2", + "loud-rejection": "^1.0.0", + "map-obj": "^1.0.1", + "minimist": "^1.1.3", + "normalize-package-data": "^2.3.4", + "object-assign": "^4.0.1", + "read-pkg-up": "^1.0.1", + "redent": "^1.0.0", + "trim-newlines": "^1.0.0" + } + }, + "redent": { + "version": "1.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/redent/-/redent-1.0.0.tgz", + "integrity": "sha1-z5Fqsf1fHxbfsggi3W7H9zDCr94=", + "dev": true, + "requires": { + "indent-string": "^2.1.0", + "strip-indent": "^1.0.1" + } + }, + "strip-indent": { + "version": "1.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/strip-indent/-/strip-indent-1.0.1.tgz", + "integrity": "sha1-DHlipq3vp7vUrDZkYKY4VSrhoKI=", + "dev": true, + "requires": { + "get-stdin": "^4.0.1" + } + }, + "trim-newlines": { + "version": "1.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/trim-newlines/-/trim-newlines-1.0.0.tgz", + "integrity": "sha1-WIeWa7WCpFA6QetST301ARgVphM=", + "dev": true + } + } + }, + "interpret": { + "version": "1.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/interpret/-/interpret-1.1.0.tgz", + "integrity": "sha1-ftGxQQxqDg94z5XTuEQMY/eLhhQ=", + "dev": true + }, + "into-stream": { + "version": "3.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/into-stream/-/into-stream-3.1.0.tgz", + "integrity": "sha1-lvsKk2wSur1v8XUqF9BWFqvQlMY=", + "dev": true, + "requires": { + "from2": "^2.1.1", + "p-is-promise": "^1.1.0" + } + }, + "invariant": { + "version": "2.2.4", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/invariant/-/invariant-2.2.4.tgz", + "integrity": "sha512-phJfQVBuaJM5raOpJjSfkiD6BpbCE4Ns//LaXl6wGYtUBY83nWS6Rf9tXm2e8VaK60JEjYldbPif/A2B1C2gNA==", + "dev": true, + "requires": { + "loose-envify": "^1.0.0" + } + }, + "invert-kv": { + "version": "1.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/invert-kv/-/invert-kv-1.0.0.tgz", + "integrity": "sha1-EEqOSqym09jNFXqO+L+rLXo//bY=", + "dev": true + }, + "ip": { + "version": "1.1.5", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/ip/-/ip-1.1.5.tgz", + "integrity": "sha1-vd7XARQpCCjAoDnnLvJfWq7ENUo=", + "dev": true + }, + "ipaddr.js": { + "version": "1.6.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/ipaddr.js/-/ipaddr.js-1.6.0.tgz", + "integrity": "sha1-4/o1e3c9phnybpXwSdBVxyeW+Gs=", + "dev": true + }, + "is-absolute-url": { + "version": "2.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/is-absolute-url/-/is-absolute-url-2.1.0.tgz", + "integrity": "sha1-UFMN+4T8yap9vnhS6Do3uTufKqY=", + "dev": true + }, + "is-accessor-descriptor": { + "version": "0.1.6", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/is-accessor-descriptor/-/is-accessor-descriptor-0.1.6.tgz", + "integrity": "sha1-qeEss66Nh2cn7u84Q/igiXtcmNY=", + "dev": true, + "requires": { + "kind-of": "^3.0.2" + }, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true, + "requires": { + "is-buffer": "^1.1.5" + } + } + } + }, + "is-arrayish": { + "version": "0.2.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/is-arrayish/-/is-arrayish-0.2.1.tgz", + "integrity": "sha1-d8mYQFJ6qOyxqLppe4BkWnqSap0=", + "dev": true + }, + "is-binary-path": { + "version": "1.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/is-binary-path/-/is-binary-path-1.0.1.tgz", + "integrity": "sha1-dfFmQrSA8YenEcgUFh/TpKdlWJg=", + "dev": true, + "requires": { + "binary-extensions": "^1.0.0" + } + }, + "is-buffer": { + "version": "1.1.6", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/is-buffer/-/is-buffer-1.1.6.tgz", + "integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==", + "dev": true + }, + "is-builtin-module": { + "version": "1.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/is-builtin-module/-/is-builtin-module-1.0.0.tgz", + "integrity": "sha1-VAVy0096wxGfj3bDDLwbHgN6/74=", + "dev": true, + "requires": { + "builtin-modules": "^1.0.0" + } + }, + "is-callable": { + "version": "1.1.3", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/is-callable/-/is-callable-1.1.3.tgz", + "integrity": "sha1-hut1OSgF3cM69xySoO7fdO52BLI=", + "dev": true + }, + "is-ci": { + "version": "1.2.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/is-ci/-/is-ci-1.2.1.tgz", + "integrity": "sha512-s6tfsaQaQi3JNciBH6shVqEDvhGut0SUXr31ag8Pd8BBbVVlcGfWhpPmEOoM6RJ5TFhbypvf5yyRw/VXW1IiWg==", + "dev": true, + "requires": { + "ci-info": "^1.5.0" + } + }, + "is-color-stop": { + "version": "1.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/is-color-stop/-/is-color-stop-1.1.0.tgz", + "integrity": "sha1-z/9HGu5N1cnhWFmPvhKWe1za00U=", + "dev": true, + "requires": { + "css-color-names": "^0.0.4", + "hex-color-regex": "^1.1.0", + "hsl-regex": "^1.0.0", + "hsla-regex": "^1.0.0", + "rgb-regex": "^1.0.1", + "rgba-regex": "^1.0.0" + } + }, + "is-data-descriptor": { + "version": "0.1.4", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/is-data-descriptor/-/is-data-descriptor-0.1.4.tgz", + "integrity": "sha1-C17mSDiOLIYCgueT8YVv7D8wG1Y=", + "dev": true, + "requires": { + "kind-of": "^3.0.2" + }, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true, + "requires": { + "is-buffer": "^1.1.5" + } + } + } + }, + "is-date-object": { + "version": "1.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/is-date-object/-/is-date-object-1.0.1.tgz", + "integrity": "sha1-mqIOtq7rv/d/vTPnTKAbM1gdOhY=", + "dev": true + }, + "is-descriptor": { + "version": "0.1.6", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/is-descriptor/-/is-descriptor-0.1.6.tgz", + "integrity": "sha512-avDYr0SB3DwO9zsMov0gKCESFYqCnE4hq/4z3TdUlukEy5t9C0YRq7HLrsN52NAcqXKaepeCD0n+B0arnVG3Hg==", + "dev": true, + "requires": { + "is-accessor-descriptor": "^0.1.6", + "is-data-descriptor": "^0.1.4", + "kind-of": "^5.0.0" + }, + "dependencies": { + "kind-of": { + "version": "5.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/kind-of/-/kind-of-5.1.0.tgz", + "integrity": "sha512-NGEErnH6F2vUuXDh+OlbcKW7/wOcfdRHaZ7VWtqCztfHri/++YKmP51OdWeGPuqCOba6kk2OTe5d02VmTB80Pw==", + "dev": true + } + } + }, + "is-directory": { + "version": "0.3.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/is-directory/-/is-directory-0.3.1.tgz", + "integrity": "sha1-YTObbyR1/Hcv2cnYP1yFddwVSuE=", + "dev": true + }, + "is-dotfile": { + "version": "1.0.3", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/is-dotfile/-/is-dotfile-1.0.3.tgz", + "integrity": "sha1-pqLzL/0t+wT1yiXs0Pa4PPeYoeE=", + "dev": true + }, + "is-equal-shallow": { + "version": "0.1.3", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/is-equal-shallow/-/is-equal-shallow-0.1.3.tgz", + "integrity": "sha1-IjgJj8Ih3gvPpdnqxMRdY4qhxTQ=", + "dev": true, + "requires": { + "is-primitive": "^2.0.0" + } + }, + "is-extendable": { + "version": "0.1.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/is-extendable/-/is-extendable-0.1.1.tgz", + "integrity": "sha1-YrEQ4omkcUGOPsNqYX1HLjAd/Ik=", + "dev": true + }, + "is-extglob": { + "version": "2.1.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/is-extglob/-/is-extglob-2.1.1.tgz", + "integrity": "sha1-qIwCU1eR8C7TfHahueqXc8gz+MI=", + "dev": true + }, + "is-finite": { + "version": "1.0.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/is-finite/-/is-finite-1.0.2.tgz", + "integrity": "sha1-zGZ3aVYCvlUO8R6LSqYwU0K20Ko=", + "dev": true, + "requires": { + "number-is-nan": "^1.0.0" + } + }, + "is-fullwidth-code-point": { + "version": "1.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz", + "integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=", + "dev": true, + "requires": { + "number-is-nan": "^1.0.0" + } + }, + "is-generator-fn": { + "version": "1.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/is-generator-fn/-/is-generator-fn-1.0.0.tgz", + "integrity": "sha1-lp1J4bszKfa7fwkIm+JleLLd1Go=", + "dev": true + }, + "is-glob": { + "version": "4.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/is-glob/-/is-glob-4.0.0.tgz", + "integrity": "sha1-lSHHaEXMJhCoUgPd8ICpWML/q8A=", + "dev": true, + "requires": { + "is-extglob": "^2.1.1" + } + }, + "is-number": { + "version": "3.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/is-number/-/is-number-3.0.0.tgz", + "integrity": "sha1-JP1iAaR4LPUFYcgQJ2r8fRLXEZU=", + "dev": true, + "requires": { + "kind-of": "^3.0.2" + }, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true, + "requires": { + "is-buffer": "^1.1.5" + } + } + } + }, + "is-number-like": { + "version": "1.0.8", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/is-number-like/-/is-number-like-1.0.8.tgz", + "integrity": "sha512-6rZi3ezCyFcn5L71ywzz2bS5b2Igl1En3eTlZlvKjpz1n3IZLAYMbKYAIQgFmEu0GENg92ziU/faEOA/aixjbA==", + "dev": true, + "requires": { + "lodash.isfinite": "^3.3.2" + } + }, + "is-obj": { + "version": "1.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/is-obj/-/is-obj-1.0.1.tgz", + "integrity": "sha1-PkcprB9f3gJc19g6iW2rn09n2w8=", + "dev": true + }, + "is-object": { + "version": "1.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/is-object/-/is-object-1.0.1.tgz", + "integrity": "sha1-iVJojF7C/9awPsyF52ngKQMINHA=", + "dev": true + }, + "is-observable": { + "version": "1.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/is-observable/-/is-observable-1.1.0.tgz", + "integrity": "sha512-NqCa4Sa2d+u7BWc6CukaObG3Fh+CU9bvixbpcXYhy2VvYS7vVGIdAgnIS5Ks3A/cqk4rebLJ9s8zBstT2aKnIA==", + "dev": true, + "requires": { + "symbol-observable": "^1.1.0" + } + }, + "is-path-cwd": { + "version": "1.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/is-path-cwd/-/is-path-cwd-1.0.0.tgz", + "integrity": "sha1-0iXsIxMuie3Tj9p2dHLmLmXxEG0=", + "dev": true + }, + "is-path-in-cwd": { + "version": "1.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/is-path-in-cwd/-/is-path-in-cwd-1.0.1.tgz", + "integrity": "sha512-FjV1RTW48E7CWM7eE/J2NJvAEEVektecDBVBE5Hh3nM1Jd0kvhHtX68Pr3xsDf857xt3Y4AkwVULK1Vku62aaQ==", + "dev": true, + "requires": { + "is-path-inside": "^1.0.0" + } + }, + "is-path-inside": { + "version": "1.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/is-path-inside/-/is-path-inside-1.0.1.tgz", + "integrity": "sha1-jvW33lBDej/cprToZe96pVy0gDY=", + "dev": true, + "requires": { + "path-is-inside": "^1.0.1" + } + }, + "is-plain-obj": { + "version": "1.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/is-plain-obj/-/is-plain-obj-1.1.0.tgz", + "integrity": "sha1-caUMhCnfync8kqOQpKA7OfzVHT4=", + "dev": true + }, + "is-plain-object": { + "version": "2.0.4", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/is-plain-object/-/is-plain-object-2.0.4.tgz", + "integrity": "sha512-h5PpgXkWitc38BBMYawTYMWJHFZJVnBquFE57xFpjB8pJFiF6gZ+bU+WyI/yqXiFR5mdLsgYNaPe8uao6Uv9Og==", + "dev": true, + "requires": { + "isobject": "^3.0.1" + } + }, + "is-posix-bracket": { + "version": "0.1.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/is-posix-bracket/-/is-posix-bracket-0.1.1.tgz", + "integrity": "sha1-MzTceXdDaOkvAW5vvAqI9c1ua8Q=", + "dev": true + }, + "is-primitive": { + "version": "2.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/is-primitive/-/is-primitive-2.0.0.tgz", + "integrity": "sha1-IHurkWOEmcB7Kt8kCkGochADRXU=", + "dev": true + }, + "is-promise": { + "version": "2.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/is-promise/-/is-promise-2.1.0.tgz", + "integrity": "sha1-eaKp7OfwlugPNtKy87wWwf9L8/o=", + "dev": true + }, + "is-regex": { + "version": "1.0.4", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/is-regex/-/is-regex-1.0.4.tgz", + "integrity": "sha1-VRdIm1RwkbCTDglWVM7SXul+lJE=", + "dev": true, + "requires": { + "has": "^1.0.1" + } + }, + "is-regexp": { + "version": "1.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/is-regexp/-/is-regexp-1.0.0.tgz", + "integrity": "sha1-/S2INUXEa6xaYz57mgnof6LLUGk=", + "dev": true + }, + "is-resolvable": { + "version": "1.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/is-resolvable/-/is-resolvable-1.1.0.tgz", + "integrity": "sha512-qgDYXFSR5WvEfuS5dMj6oTMEbrrSaM0CrFk2Yiq/gXnBvD9pMa2jGXxyhGLfvhZpuMZe18CJpFxAt3CRs42NMg==", + "dev": true + }, + "is-retry-allowed": { + "version": "1.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/is-retry-allowed/-/is-retry-allowed-1.1.0.tgz", + "integrity": "sha1-EaBgVotnM5REAz0BJaYaINVk+zQ=", + "dev": true + }, + "is-scoped": { + "version": "1.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/is-scoped/-/is-scoped-1.0.0.tgz", + "integrity": "sha1-RJypgpnnEwOCViieyytUDcQ3yzA=", + "dev": true, + "requires": { + "scoped-regex": "^1.0.0" + } + }, + "is-stream": { + "version": "1.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/is-stream/-/is-stream-1.1.0.tgz", + "integrity": "sha1-EtSj3U5o4Lec6428hBc66A2RykQ=", + "dev": true + }, + "is-svg": { + "version": "2.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/is-svg/-/is-svg-2.1.0.tgz", + "integrity": "sha1-z2EJDaDZ77yrhyLeum8DIgjbsOk=", + "dev": true, + "requires": { + "html-comment-regex": "^1.1.0" + } + }, + "is-symbol": { + "version": "1.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/is-symbol/-/is-symbol-1.0.1.tgz", + "integrity": "sha1-PMWfAAJRlLarLjjbrmaJJWtmBXI=", + "dev": true + }, + "is-typedarray": { + "version": "1.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/is-typedarray/-/is-typedarray-1.0.0.tgz", + "integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=", + "dev": true + }, + "is-utf8": { + "version": "0.2.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/is-utf8/-/is-utf8-0.2.1.tgz", + "integrity": "sha1-Sw2hRCEE0bM2NA6AeX6GXPOffXI=", + "dev": true + }, + "is-windows": { + "version": "1.0.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/is-windows/-/is-windows-1.0.2.tgz", + "integrity": "sha512-eXK1UInq2bPmjyX6e3VHIzMLobc4J94i4AWn+Hpq3OU5KkrRC96OAcR3PRJ/pGu6m8TRnBHP9dkXQVsT/COVIA==", + "dev": true + }, + "is-wsl": { + "version": "1.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/is-wsl/-/is-wsl-1.1.0.tgz", + "integrity": "sha1-HxbkqiKwTRM2tmGIpmrzxgDDpm0=", + "dev": true + }, + "isarray": { + "version": "1.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/isarray/-/isarray-1.0.0.tgz", + "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", + "dev": true + }, + "isbinaryfile": { + "version": "3.0.3", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/isbinaryfile/-/isbinaryfile-3.0.3.tgz", + "integrity": "sha512-8cJBL5tTd2OS0dM4jz07wQd5g0dCCqIhUxPIGtZfa5L6hWlvV5MHTITy/DBAsF+Oe2LS1X3krBUhNwaGUWpWxw==", + "dev": true, + "requires": { + "buffer-alloc": "^1.2.0" + } + }, + "isemail": { + "version": "3.1.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/isemail/-/isemail-3.1.2.tgz", + "integrity": "sha512-zfRhJn9rFSGhzU5tGZqepRSAj3+g6oTOHxMGGriWNJZzyLPUK8H7VHpqKntegnW8KLyGA9zwuNaCoopl40LTpg==", + "dev": true, + "requires": { + "punycode": "2.x.x" + } + }, + "isexe": { + "version": "2.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=", + "dev": true + }, + "isobject": { + "version": "3.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/isobject/-/isobject-3.0.1.tgz", + "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", + "dev": true + }, + "isstream": { + "version": "0.1.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/isstream/-/isstream-0.1.2.tgz", + "integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo=", + "dev": true + }, + "istanbul-api": { + "version": "1.3.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/istanbul-api/-/istanbul-api-1.3.1.tgz", + "integrity": "sha512-duj6AlLcsWNwUpfyfHt0nWIeRiZpuShnP40YTxOGQgtaN8fd6JYSxsvxUphTDy8V5MfDXo4s/xVCIIvVCO808g==", + "dev": true, + "requires": { + "async": "^2.1.4", + "compare-versions": "^3.1.0", + "fileset": "^2.0.2", + "istanbul-lib-coverage": "^1.2.0", + "istanbul-lib-hook": "^1.2.0", + "istanbul-lib-instrument": "^1.10.1", + "istanbul-lib-report": "^1.1.4", + "istanbul-lib-source-maps": "^1.2.4", + "istanbul-reports": "^1.3.0", + "js-yaml": "^3.7.0", + "mkdirp": "^0.5.1", + "once": "^1.4.0" + }, + "dependencies": { + "async": { + "version": "2.6.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/async/-/async-2.6.1.tgz", + "integrity": "sha512-fNEiL2+AZt6AlAw/29Cr0UDe4sRAHCpEHh54WMz+Bb7QfNcFw4h3loofyJpLeQs4Yx7yuqu/2dLgM5hKOs6HlQ==", + "dev": true, + "requires": { + "lodash": "^4.17.10" + } + }, + "debug": { + "version": "3.2.6", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/debug/-/debug-3.2.6.tgz", + "integrity": "sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ==", + "dev": true, + "requires": { + "ms": "^2.1.1" + } + }, + "istanbul-lib-source-maps": { + "version": "1.2.5", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/istanbul-lib-source-maps/-/istanbul-lib-source-maps-1.2.5.tgz", + "integrity": "sha512-8O2T/3VhrQHn0XcJbP1/GN7kXMiRAlPi+fj3uEHrjBD8Oz7Py0prSC25C09NuAZS6bgW1NNKAvCSHZXB0irSGA==", + "dev": true, + "requires": { + "debug": "^3.1.0", + "istanbul-lib-coverage": "^1.2.0", + "mkdirp": "^0.5.1", + "rimraf": "^2.6.1", + "source-map": "^0.5.3" + } + }, + "lodash": { + "version": "4.17.11", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/lodash/-/lodash-4.17.11.tgz", + "integrity": "sha512-cQKh8igo5QUhZ7lg38DYWAxMvjSAKG0A8wGSVimP07SIUEK2UO+arSRKbRZWtelMtN5V0Hkwh5ryOto/SshYIg==", + "dev": true + }, + "ms": { + "version": "2.1.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/ms/-/ms-2.1.1.tgz", + "integrity": "sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg==", + "dev": true + } + } + }, + "istanbul-lib-coverage": { + "version": "1.2.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/istanbul-lib-coverage/-/istanbul-lib-coverage-1.2.0.tgz", + "integrity": "sha512-GvgM/uXRwm+gLlvkWHTjDAvwynZkL9ns15calTrmhGgowlwJBbWMYzWbKqE2DT6JDP1AFXKa+Zi0EkqNCUqY0A==", + "dev": true + }, + "istanbul-lib-hook": { + "version": "1.2.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/istanbul-lib-hook/-/istanbul-lib-hook-1.2.1.tgz", + "integrity": "sha512-eLAMkPG9FU0v5L02lIkcj/2/Zlz9OuluaXikdr5iStk8FDbSwAixTK9TkYxbF0eNnzAJTwM2fkV2A1tpsIp4Jg==", + "dev": true, + "requires": { + "append-transform": "^1.0.0" + } + }, + "istanbul-lib-instrument": { + "version": "1.10.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/istanbul-lib-instrument/-/istanbul-lib-instrument-1.10.1.tgz", + "integrity": "sha512-1dYuzkOCbuR5GRJqySuZdsmsNKPL3PTuyPevQfoCXJePT9C8y1ga75neU+Tuy9+yS3G/dgx8wgOmp2KLpgdoeQ==", + "dev": true, + "requires": { + "babel-generator": "^6.18.0", + "babel-template": "^6.16.0", + "babel-traverse": "^6.18.0", + "babel-types": "^6.18.0", + "babylon": "^6.18.0", + "istanbul-lib-coverage": "^1.2.0", + "semver": "^5.3.0" + } + }, + "istanbul-lib-report": { + "version": "1.1.4", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/istanbul-lib-report/-/istanbul-lib-report-1.1.4.tgz", + "integrity": "sha512-Azqvq5tT0U09nrncK3q82e/Zjkxa4tkFZv7E6VcqP0QCPn6oNljDPfrZEC/umNXds2t7b8sRJfs6Kmpzt8m2kA==", + "dev": true, + "requires": { + "istanbul-lib-coverage": "^1.2.0", + "mkdirp": "^0.5.1", + "path-parse": "^1.0.5", + "supports-color": "^3.1.2" + }, + "dependencies": { + "supports-color": { + "version": "3.2.3", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/supports-color/-/supports-color-3.2.3.tgz", + "integrity": "sha1-ZawFBLOVQXHYpklGsq48u4pfVPY=", + "dev": true, + "requires": { + "has-flag": "^1.0.0" + } + } + } + }, + "istanbul-lib-source-maps": { + "version": "1.2.3", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/istanbul-lib-source-maps/-/istanbul-lib-source-maps-1.2.3.tgz", + "integrity": "sha512-fDa0hwU/5sDXwAklXgAoCJCOsFsBplVQ6WBldz5UwaqOzmDhUK4nfuR7/G//G2lERlblUNJB8P6e8cXq3a7MlA==", + "dev": true, + "requires": { + "debug": "^3.1.0", + "istanbul-lib-coverage": "^1.1.2", + "mkdirp": "^0.5.1", + "rimraf": "^2.6.1", + "source-map": "^0.5.3" + }, + "dependencies": { + "debug": { + "version": "3.2.6", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/debug/-/debug-3.2.6.tgz", + "integrity": "sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ==", + "dev": true, + "requires": { + "ms": "^2.1.1" + } + }, + "ms": { + "version": "2.1.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/ms/-/ms-2.1.1.tgz", + "integrity": "sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg==", + "dev": true + } + } + }, + "istanbul-reports": { + "version": "1.3.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/istanbul-reports/-/istanbul-reports-1.3.0.tgz", + "integrity": "sha512-y2Z2IMqE1gefWUaVjrBm0mSKvUkaBy9Vqz8iwr/r40Y9hBbIteH5wqHG/9DLTfJ9xUnUT2j7A3+VVJ6EaYBllA==", + "dev": true, + "requires": { + "handlebars": "^4.0.3" + } + }, + "istextorbinary": { + "version": "2.2.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/istextorbinary/-/istextorbinary-2.2.1.tgz", + "integrity": "sha512-TS+hoFl8Z5FAFMK38nhBkdLt44CclNRgDHWeMgsV8ko3nDlr/9UI2Sf839sW7enijf8oKsZYXRvM8g0it9Zmcw==", + "dev": true, + "requires": { + "binaryextensions": "2", + "editions": "^1.3.3", + "textextensions": "2" + } + }, + "isurl": { + "version": "1.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/isurl/-/isurl-1.0.0.tgz", + "integrity": "sha512-1P/yWsxPlDtn7QeRD+ULKQPaIaN6yF368GZ2vDfv0AL0NwpStafjWCDDdn0k8wgFMWpVAqG7oJhxHnlud42i9w==", + "dev": true, + "requires": { + "has-to-string-tag-x": "^1.2.0", + "is-object": "^1.0.1" + } + }, + "jasmine-diff": { + "version": "0.1.3", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/jasmine-diff/-/jasmine-diff-0.1.3.tgz", + "integrity": "sha1-k8zC3MQQKMXd1GBlWAdIOfLe6qg=", + "dev": true, + "requires": { + "diff": "^3.2.0" + } + }, + "jest": { + "version": "22.4.3", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/jest/-/jest-22.4.3.tgz", + "integrity": "sha512-FFCdU/pXOEASfHxFDOWUysI/+FFoqiXJADEIXgDKuZyqSmBD3tZ4BEGH7+M79v7czj7bbkhwtd2LaEDcJiM/GQ==", + "dev": true, + "requires": { + "import-local": "^1.0.0", + "jest-cli": "^22.4.3" + }, + "dependencies": { + "ansi-regex": { + "version": "3.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/ansi-regex/-/ansi-regex-3.0.0.tgz", + "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", + "dev": true + }, + "ansi-styles": { + "version": "3.2.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, + "requires": { + "color-convert": "^1.9.0" + } + }, + "arr-diff": { + "version": "2.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/arr-diff/-/arr-diff-2.0.0.tgz", + "integrity": "sha1-jzuCf5Vai9ZpaX5KQlasPOrjVs8=", + "dev": true, + "requires": { + "arr-flatten": "^1.0.1" + } + }, + "array-unique": { + "version": "0.2.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/array-unique/-/array-unique-0.2.1.tgz", + "integrity": "sha1-odl8yvy8JiXMcPrc6zalDFiwGlM=", + "dev": true + }, + "braces": { + "version": "1.8.5", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/braces/-/braces-1.8.5.tgz", + "integrity": "sha1-uneWLhLf+WnWt2cR6RS3N4V79qc=", + "dev": true, + "requires": { + "expand-range": "^1.8.1", + "preserve": "^0.2.0", + "repeat-element": "^1.1.2" + } + }, + "chalk": { + "version": "2.4.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/chalk/-/chalk-2.4.1.tgz", + "integrity": "sha512-ObN6h1v2fTJSmUXoS3nMQ92LbDK9be4TV+6G+omQlGJFdcUX5heKi1LZ1YnRMIgwTLEj3E24bT6tYni50rlCfQ==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + } + }, + "cliui": { + "version": "4.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/cliui/-/cliui-4.1.0.tgz", + "integrity": "sha512-4FG+RSG9DL7uEwRUZXZn3SS34DiDPfzP0VOiEwtUWlE+AR2EIg+hSyvrIgUUfhdgR/UkAeW2QHgeP+hWrXs7jQ==", + "dev": true, + "requires": { + "string-width": "^2.1.1", + "strip-ansi": "^4.0.0", + "wrap-ansi": "^2.0.0" + } + }, + "expand-brackets": { + "version": "0.1.5", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/expand-brackets/-/expand-brackets-0.1.5.tgz", + "integrity": "sha1-3wcoTjQqgHzXM6xa9yQR5YHRF3s=", + "dev": true, + "requires": { + "is-posix-bracket": "^0.1.0" + } + }, + "extglob": { + "version": "0.3.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/extglob/-/extglob-0.3.2.tgz", + "integrity": "sha1-Lhj/PS9JqydlzskCPwEdqo2DSaE=", + "dev": true, + "requires": { + "is-extglob": "^1.0.0" + } + }, + "find-up": { + "version": "2.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/find-up/-/find-up-2.1.0.tgz", + "integrity": "sha1-RdG35QbHF93UgndaK3eSCjwMV6c=", + "dev": true, + "requires": { + "locate-path": "^2.0.0" + } + }, + "has-flag": { + "version": "3.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", + "dev": true + }, + "is-extglob": { + "version": "1.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/is-extglob/-/is-extglob-1.0.0.tgz", + "integrity": "sha1-rEaBd8SUNAWgkvyPKXYMb/xiBsA=", + "dev": true + }, + "is-fullwidth-code-point": { + "version": "2.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", + "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", + "dev": true + }, + "is-glob": { + "version": "2.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/is-glob/-/is-glob-2.0.1.tgz", + "integrity": "sha1-0Jb5JqPe1WAPP9/ZEZjLCIjC2GM=", + "dev": true, + "requires": { + "is-extglob": "^1.0.0" + } + }, + "jest-cli": { + "version": "22.4.3", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/jest-cli/-/jest-cli-22.4.3.tgz", + "integrity": "sha512-IiHybF0DJNqZPsbjn4Cy4vcqcmImpoFwNFnkehzVw8lTUSl4axZh5DHewu5bdpZF2Y5gUqFKYzH0FH4Qx2k+UA==", + "dev": true, + "requires": { + "ansi-escapes": "^3.0.0", + "chalk": "^2.0.1", + "exit": "^0.1.2", + "glob": "^7.1.2", + "graceful-fs": "^4.1.11", + "import-local": "^1.0.0", + "is-ci": "^1.0.10", + "istanbul-api": "^1.1.14", + "istanbul-lib-coverage": "^1.1.1", + "istanbul-lib-instrument": "^1.8.0", + "istanbul-lib-source-maps": "^1.2.1", + "jest-changed-files": "^22.4.3", + "jest-config": "^22.4.3", + "jest-environment-jsdom": "^22.4.3", + "jest-get-type": "^22.4.3", + "jest-haste-map": "^22.4.3", + "jest-message-util": "^22.4.3", + "jest-regex-util": "^22.4.3", + "jest-resolve-dependencies": "^22.4.3", + "jest-runner": "^22.4.3", + "jest-runtime": "^22.4.3", + "jest-snapshot": "^22.4.3", + "jest-util": "^22.4.3", + "jest-validate": "^22.4.3", + "jest-worker": "^22.4.3", + "micromatch": "^2.3.11", + "node-notifier": "^5.2.1", + "realpath-native": "^1.0.0", + "rimraf": "^2.5.4", + "slash": "^1.0.0", + "string-length": "^2.0.0", + "strip-ansi": "^4.0.0", + "which": "^1.2.12", + "yargs": "^10.0.3" + } + }, + "kind-of": { + "version": "3.2.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true, + "requires": { + "is-buffer": "^1.1.5" + } + }, + "micromatch": { + "version": "2.3.11", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/micromatch/-/micromatch-2.3.11.tgz", + "integrity": "sha1-hmd8l9FyCzY0MdBNDRUpO9OMFWU=", + "dev": true, + "requires": { + "arr-diff": "^2.0.0", + "array-unique": "^0.2.1", + "braces": "^1.8.2", + "expand-brackets": "^0.1.4", + "extglob": "^0.3.1", + "filename-regex": "^2.0.0", + "is-extglob": "^1.0.0", + "is-glob": "^2.0.1", + "kind-of": "^3.0.2", + "normalize-path": "^2.0.1", + "object.omit": "^2.0.0", + "parse-glob": "^3.0.4", + "regex-cache": "^0.4.2" + } + }, + "os-locale": { + "version": "2.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/os-locale/-/os-locale-2.1.0.tgz", + "integrity": "sha512-3sslG3zJbEYcaC4YVAvDorjGxc7tv6KVATnLPZONiljsUncvihe9BQoVCEs0RZ1kmf4Hk9OBqlZfJZWI4GanKA==", + "dev": true, + "requires": { + "execa": "^0.7.0", + "lcid": "^1.0.0", + "mem": "^1.1.0" + } + }, + "string-width": { + "version": "2.1.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/string-width/-/string-width-2.1.1.tgz", + "integrity": "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==", + "dev": true, + "requires": { + "is-fullwidth-code-point": "^2.0.0", + "strip-ansi": "^4.0.0" + } + }, + "strip-ansi": { + "version": "4.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/strip-ansi/-/strip-ansi-4.0.0.tgz", + "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", + "dev": true, + "requires": { + "ansi-regex": "^3.0.0" + } + }, + "supports-color": { + "version": "5.5.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } + }, + "which-module": { + "version": "2.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/which-module/-/which-module-2.0.0.tgz", + "integrity": "sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho=", + "dev": true + }, + "yargs": { + "version": "10.1.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/yargs/-/yargs-10.1.2.tgz", + "integrity": "sha512-ivSoxqBGYOqQVruxD35+EyCFDYNEFL/Uo6FcOnz+9xZdZzK0Zzw4r4KhbrME1Oo2gOggwJod2MnsdamSG7H9ig==", + "dev": true, + "requires": { + "cliui": "^4.0.0", + "decamelize": "^1.1.1", + "find-up": "^2.1.0", + "get-caller-file": "^1.0.1", + "os-locale": "^2.0.0", + "require-directory": "^2.1.1", + "require-main-filename": "^1.0.1", + "set-blocking": "^2.0.0", + "string-width": "^2.0.0", + "which-module": "^2.0.0", + "y18n": "^3.2.1", + "yargs-parser": "^8.1.0" + } + }, + "yargs-parser": { + "version": "8.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/yargs-parser/-/yargs-parser-8.1.0.tgz", + "integrity": "sha512-yP+6QqN8BmrgW2ggLtTbdrOyBNSI7zBa4IykmiV5R1wl1JWNxQvWhMfMdmzIYtKU7oP3OOInY/tl2ov3BDjnJQ==", + "dev": true, + "requires": { + "camelcase": "^4.1.0" + } + } + } + }, + "jest-changed-files": { + "version": "22.4.3", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/jest-changed-files/-/jest-changed-files-22.4.3.tgz", + "integrity": "sha512-83Dh0w1aSkUNFhy5d2dvqWxi/y6weDwVVLU6vmK0cV9VpRxPzhTeGimbsbRDSnEoszhF937M4sDLLeS7Cu/Tmw==", + "dev": true, + "requires": { + "throat": "^4.0.0" + } + }, + "jest-config": { + "version": "22.4.4", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/jest-config/-/jest-config-22.4.4.tgz", + "integrity": "sha512-9CKfo1GC4zrXSoMLcNeDvQBfgtqGTB1uP8iDIZ97oB26RCUb886KkKWhVcpyxVDOUxbhN+uzcBCeFe7w+Iem4A==", + "dev": true, + "requires": { + "chalk": "^2.0.1", + "glob": "^7.1.1", + "jest-environment-jsdom": "^22.4.1", + "jest-environment-node": "^22.4.1", + "jest-get-type": "^22.1.0", + "jest-jasmine2": "^22.4.4", + "jest-regex-util": "^22.1.0", + "jest-resolve": "^22.4.2", + "jest-util": "^22.4.1", + "jest-validate": "^22.4.4", + "pretty-format": "^22.4.0" + }, + "dependencies": { + "ansi-styles": { + "version": "3.2.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, + "requires": { + "color-convert": "^1.9.0" + } + }, + "chalk": { + "version": "2.4.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/chalk/-/chalk-2.4.1.tgz", + "integrity": "sha512-ObN6h1v2fTJSmUXoS3nMQ92LbDK9be4TV+6G+omQlGJFdcUX5heKi1LZ1YnRMIgwTLEj3E24bT6tYni50rlCfQ==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + } + }, + "has-flag": { + "version": "3.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", + "dev": true + }, + "supports-color": { + "version": "5.5.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } + } + } + }, + "jest-diff": { + "version": "22.4.3", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/jest-diff/-/jest-diff-22.4.3.tgz", + "integrity": "sha512-/QqGvCDP5oZOF6PebDuLwrB2BMD8ffJv6TAGAdEVuDx1+uEgrHpSFrfrOiMRx2eJ1hgNjlQrOQEHetVwij90KA==", + "dev": true, + "requires": { + "chalk": "^2.0.1", + "diff": "^3.2.0", + "jest-get-type": "^22.4.3", + "pretty-format": "^22.4.3" + }, + "dependencies": { + "ansi-styles": { + "version": "3.2.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, + "requires": { + "color-convert": "^1.9.0" + } + }, + "chalk": { + "version": "2.4.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/chalk/-/chalk-2.4.1.tgz", + "integrity": "sha512-ObN6h1v2fTJSmUXoS3nMQ92LbDK9be4TV+6G+omQlGJFdcUX5heKi1LZ1YnRMIgwTLEj3E24bT6tYni50rlCfQ==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + } + }, + "has-flag": { + "version": "3.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", + "dev": true + }, + "supports-color": { + "version": "5.5.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } + } + } + }, + "jest-docblock": { + "version": "22.4.3", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/jest-docblock/-/jest-docblock-22.4.3.tgz", + "integrity": "sha512-uPKBEAw7YrEMcXueMKZXn/rbMxBiSv48fSqy3uEnmgOlQhSX+lthBqHb1fKWNVmFqAp9E/RsSdBfiV31LbzaOg==", + "dev": true, + "requires": { + "detect-newline": "^2.1.0" + } + }, + "jest-environment-jsdom": { + "version": "22.4.3", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/jest-environment-jsdom/-/jest-environment-jsdom-22.4.3.tgz", + "integrity": "sha512-FviwfR+VyT3Datf13+ULjIMO5CSeajlayhhYQwpzgunswoaLIPutdbrnfUHEMyJCwvqQFaVtTmn9+Y8WCt6n1w==", + "dev": true, + "requires": { + "jest-mock": "^22.4.3", + "jest-util": "^22.4.3", + "jsdom": "^11.5.1" + } + }, + "jest-environment-node": { + "version": "22.4.3", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/jest-environment-node/-/jest-environment-node-22.4.3.tgz", + "integrity": "sha512-reZl8XF6t/lMEuPWwo9OLfttyC26A5AMgDyEQ6DBgZuyfyeNUzYT8BFo6uxCCP/Av/b7eb9fTi3sIHFPBzmlRA==", + "dev": true, + "requires": { + "jest-mock": "^22.4.3", + "jest-util": "^22.4.3" + } + }, + "jest-get-type": { + "version": "22.4.3", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/jest-get-type/-/jest-get-type-22.4.3.tgz", + "integrity": "sha512-/jsz0Y+V29w1chdXVygEKSz2nBoHoYqNShPe+QgxSNjAuP1i8+k4LbQNrfoliKej0P45sivkSCh7yiD6ubHS3w==", + "dev": true + }, + "jest-haste-map": { + "version": "22.4.3", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/jest-haste-map/-/jest-haste-map-22.4.3.tgz", + "integrity": "sha512-4Q9fjzuPVwnaqGKDpIsCSoTSnG3cteyk2oNVjBX12HHOaF1oxql+uUiqZb5Ndu7g/vTZfdNwwy4WwYogLh29DQ==", + "dev": true, + "requires": { + "fb-watchman": "^2.0.0", + "graceful-fs": "^4.1.11", + "jest-docblock": "^22.4.3", + "jest-serializer": "^22.4.3", + "jest-worker": "^22.4.3", + "micromatch": "^2.3.11", + "sane": "^2.0.0" + }, + "dependencies": { + "arr-diff": { + "version": "2.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/arr-diff/-/arr-diff-2.0.0.tgz", + "integrity": "sha1-jzuCf5Vai9ZpaX5KQlasPOrjVs8=", + "dev": true, + "requires": { + "arr-flatten": "^1.0.1" + } + }, + "array-unique": { + "version": "0.2.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/array-unique/-/array-unique-0.2.1.tgz", + "integrity": "sha1-odl8yvy8JiXMcPrc6zalDFiwGlM=", + "dev": true + }, + "braces": { + "version": "1.8.5", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/braces/-/braces-1.8.5.tgz", + "integrity": "sha1-uneWLhLf+WnWt2cR6RS3N4V79qc=", + "dev": true, + "requires": { + "expand-range": "^1.8.1", + "preserve": "^0.2.0", + "repeat-element": "^1.1.2" + } + }, + "expand-brackets": { + "version": "0.1.5", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/expand-brackets/-/expand-brackets-0.1.5.tgz", + "integrity": "sha1-3wcoTjQqgHzXM6xa9yQR5YHRF3s=", + "dev": true, + "requires": { + "is-posix-bracket": "^0.1.0" + } + }, + "extglob": { + "version": "0.3.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/extglob/-/extglob-0.3.2.tgz", + "integrity": "sha1-Lhj/PS9JqydlzskCPwEdqo2DSaE=", + "dev": true, + "requires": { + "is-extglob": "^1.0.0" + } + }, + "is-extglob": { + "version": "1.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/is-extglob/-/is-extglob-1.0.0.tgz", + "integrity": "sha1-rEaBd8SUNAWgkvyPKXYMb/xiBsA=", + "dev": true + }, + "is-glob": { + "version": "2.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/is-glob/-/is-glob-2.0.1.tgz", + "integrity": "sha1-0Jb5JqPe1WAPP9/ZEZjLCIjC2GM=", + "dev": true, + "requires": { + "is-extglob": "^1.0.0" + } + }, + "kind-of": { + "version": "3.2.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true, + "requires": { + "is-buffer": "^1.1.5" + } + }, + "micromatch": { + "version": "2.3.11", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/micromatch/-/micromatch-2.3.11.tgz", + "integrity": "sha1-hmd8l9FyCzY0MdBNDRUpO9OMFWU=", + "dev": true, + "requires": { + "arr-diff": "^2.0.0", + "array-unique": "^0.2.1", + "braces": "^1.8.2", + "expand-brackets": "^0.1.4", + "extglob": "^0.3.1", + "filename-regex": "^2.0.0", + "is-extglob": "^1.0.0", + "is-glob": "^2.0.1", + "kind-of": "^3.0.2", + "normalize-path": "^2.0.1", + "object.omit": "^2.0.0", + "parse-glob": "^3.0.4", + "regex-cache": "^0.4.2" + } + } + } + }, + "jest-jasmine2": { + "version": "22.4.4", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/jest-jasmine2/-/jest-jasmine2-22.4.4.tgz", + "integrity": "sha512-nK3vdUl50MuH7vj/8at7EQVjPGWCi3d5+6aCi7Gxy/XMWdOdbH1qtO/LjKbqD8+8dUAEH+BVVh7HkjpCWC1CSw==", + "dev": true, + "requires": { + "chalk": "^2.0.1", + "co": "^4.6.0", + "expect": "^22.4.0", + "graceful-fs": "^4.1.11", + "is-generator-fn": "^1.0.0", + "jest-diff": "^22.4.0", + "jest-matcher-utils": "^22.4.0", + "jest-message-util": "^22.4.0", + "jest-snapshot": "^22.4.0", + "jest-util": "^22.4.1", + "source-map-support": "^0.5.0" + }, + "dependencies": { + "ansi-styles": { + "version": "3.2.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, + "requires": { + "color-convert": "^1.9.0" + } + }, + "chalk": { + "version": "2.4.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/chalk/-/chalk-2.4.1.tgz", + "integrity": "sha512-ObN6h1v2fTJSmUXoS3nMQ92LbDK9be4TV+6G+omQlGJFdcUX5heKi1LZ1YnRMIgwTLEj3E24bT6tYni50rlCfQ==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + } + }, + "has-flag": { + "version": "3.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", + "dev": true + }, + "supports-color": { + "version": "5.5.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } + } + } + }, + "jest-junit": { + "version": "5.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/jest-junit/-/jest-junit-5.1.0.tgz", + "integrity": "sha512-3EVf1puv2ox5wybQDfLX3AEn3IKOgDV4E76y4pO2hBu46DEtAFZZAm//X1pzPQpqKji0zqgMIzqzF/K+uGAX9A==", + "dev": true, + "requires": { + "jest-validate": "^23.0.1", + "mkdirp": "^0.5.1", + "strip-ansi": "^4.0.0", + "xml": "^1.0.1" + }, + "dependencies": { + "ansi-regex": { + "version": "3.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/ansi-regex/-/ansi-regex-3.0.0.tgz", + "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", + "dev": true + }, + "ansi-styles": { + "version": "3.2.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, + "requires": { + "color-convert": "^1.9.0" + } + }, + "chalk": { + "version": "2.4.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/chalk/-/chalk-2.4.1.tgz", + "integrity": "sha512-ObN6h1v2fTJSmUXoS3nMQ92LbDK9be4TV+6G+omQlGJFdcUX5heKi1LZ1YnRMIgwTLEj3E24bT6tYni50rlCfQ==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + } + }, + "has-flag": { + "version": "3.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", + "dev": true + }, + "jest-validate": { + "version": "23.6.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/jest-validate/-/jest-validate-23.6.0.tgz", + "integrity": "sha512-OFKapYxe72yz7agrDAWi8v2WL8GIfVqcbKRCLbRG9PAxtzF9b1SEDdTpytNDN12z2fJynoBwpMpvj2R39plI2A==", + "dev": true, + "requires": { + "chalk": "^2.0.1", + "jest-get-type": "^22.1.0", + "leven": "^2.1.0", + "pretty-format": "^23.6.0" + } + }, + "pretty-format": { + "version": "23.6.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/pretty-format/-/pretty-format-23.6.0.tgz", + "integrity": "sha512-zf9NV1NSlDLDjycnwm6hpFATCGl/K1lt0R/GdkAK2O5LN/rwJoB+Mh93gGJjut4YbmecbfgLWVGSTCr0Ewvvbw==", + "dev": true, + "requires": { + "ansi-regex": "^3.0.0", + "ansi-styles": "^3.2.0" + } + }, + "strip-ansi": { + "version": "4.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/strip-ansi/-/strip-ansi-4.0.0.tgz", + "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", + "dev": true, + "requires": { + "ansi-regex": "^3.0.0" + } + }, + "supports-color": { + "version": "5.5.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } + } + } + }, + "jest-leak-detector": { + "version": "22.4.3", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/jest-leak-detector/-/jest-leak-detector-22.4.3.tgz", + "integrity": "sha512-NZpR/Ls7+ndO57LuXROdgCGz2RmUdC541tTImL9bdUtU3WadgFGm0yV+Ok4Fuia/1rLAn5KaJ+i76L6e3zGJYQ==", + "dev": true, + "requires": { + "pretty-format": "^22.4.3" + } + }, + "jest-matcher-utils": { + "version": "22.4.3", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/jest-matcher-utils/-/jest-matcher-utils-22.4.3.tgz", + "integrity": "sha512-lsEHVaTnKzdAPR5t4B6OcxXo9Vy4K+kRRbG5gtddY8lBEC+Mlpvm1CJcsMESRjzUhzkz568exMV1hTB76nAKbA==", + "dev": true, + "requires": { + "chalk": "^2.0.1", + "jest-get-type": "^22.4.3", + "pretty-format": "^22.4.3" + }, + "dependencies": { + "ansi-styles": { + "version": "3.2.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, + "requires": { + "color-convert": "^1.9.0" + } + }, + "chalk": { + "version": "2.4.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/chalk/-/chalk-2.4.1.tgz", + "integrity": "sha512-ObN6h1v2fTJSmUXoS3nMQ92LbDK9be4TV+6G+omQlGJFdcUX5heKi1LZ1YnRMIgwTLEj3E24bT6tYni50rlCfQ==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + } + }, + "has-flag": { + "version": "3.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", + "dev": true + }, + "supports-color": { + "version": "5.5.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } + } + } + }, + "jest-message-util": { + "version": "22.4.3", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/jest-message-util/-/jest-message-util-22.4.3.tgz", + "integrity": "sha512-iAMeKxhB3Se5xkSjU0NndLLCHtP4n+GtCqV0bISKA5dmOXQfEbdEmYiu2qpnWBDCQdEafNDDU6Q+l6oBMd/+BA==", + "dev": true, + "requires": { + "@babel/code-frame": "^7.0.0-beta.35", + "chalk": "^2.0.1", + "micromatch": "^2.3.11", + "slash": "^1.0.0", + "stack-utils": "^1.0.1" + }, + "dependencies": { + "ansi-styles": { + "version": "3.2.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, + "requires": { + "color-convert": "^1.9.0" + } + }, + "arr-diff": { + "version": "2.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/arr-diff/-/arr-diff-2.0.0.tgz", + "integrity": "sha1-jzuCf5Vai9ZpaX5KQlasPOrjVs8=", + "dev": true, + "requires": { + "arr-flatten": "^1.0.1" + } + }, + "array-unique": { + "version": "0.2.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/array-unique/-/array-unique-0.2.1.tgz", + "integrity": "sha1-odl8yvy8JiXMcPrc6zalDFiwGlM=", + "dev": true + }, + "braces": { + "version": "1.8.5", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/braces/-/braces-1.8.5.tgz", + "integrity": "sha1-uneWLhLf+WnWt2cR6RS3N4V79qc=", + "dev": true, + "requires": { + "expand-range": "^1.8.1", + "preserve": "^0.2.0", + "repeat-element": "^1.1.2" + } + }, + "chalk": { + "version": "2.4.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/chalk/-/chalk-2.4.1.tgz", + "integrity": "sha512-ObN6h1v2fTJSmUXoS3nMQ92LbDK9be4TV+6G+omQlGJFdcUX5heKi1LZ1YnRMIgwTLEj3E24bT6tYni50rlCfQ==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + } + }, + "expand-brackets": { + "version": "0.1.5", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/expand-brackets/-/expand-brackets-0.1.5.tgz", + "integrity": "sha1-3wcoTjQqgHzXM6xa9yQR5YHRF3s=", + "dev": true, + "requires": { + "is-posix-bracket": "^0.1.0" + } + }, + "extglob": { + "version": "0.3.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/extglob/-/extglob-0.3.2.tgz", + "integrity": "sha1-Lhj/PS9JqydlzskCPwEdqo2DSaE=", + "dev": true, + "requires": { + "is-extglob": "^1.0.0" + } + }, + "has-flag": { + "version": "3.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", + "dev": true + }, + "is-extglob": { + "version": "1.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/is-extglob/-/is-extglob-1.0.0.tgz", + "integrity": "sha1-rEaBd8SUNAWgkvyPKXYMb/xiBsA=", + "dev": true + }, + "is-glob": { + "version": "2.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/is-glob/-/is-glob-2.0.1.tgz", + "integrity": "sha1-0Jb5JqPe1WAPP9/ZEZjLCIjC2GM=", + "dev": true, + "requires": { + "is-extglob": "^1.0.0" + } + }, + "kind-of": { + "version": "3.2.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true, + "requires": { + "is-buffer": "^1.1.5" + } + }, + "micromatch": { + "version": "2.3.11", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/micromatch/-/micromatch-2.3.11.tgz", + "integrity": "sha1-hmd8l9FyCzY0MdBNDRUpO9OMFWU=", + "dev": true, + "requires": { + "arr-diff": "^2.0.0", + "array-unique": "^0.2.1", + "braces": "^1.8.2", + "expand-brackets": "^0.1.4", + "extglob": "^0.3.1", + "filename-regex": "^2.0.0", + "is-extglob": "^1.0.0", + "is-glob": "^2.0.1", + "kind-of": "^3.0.2", + "normalize-path": "^2.0.1", + "object.omit": "^2.0.0", + "parse-glob": "^3.0.4", + "regex-cache": "^0.4.2" + } + }, + "supports-color": { + "version": "5.5.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } + } + } + }, + "jest-mock": { + "version": "22.4.3", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/jest-mock/-/jest-mock-22.4.3.tgz", + "integrity": "sha512-+4R6mH5M1G4NK16CKg9N1DtCaFmuxhcIqF4lQK/Q1CIotqMs/XBemfpDPeVZBFow6iyUNu6EBT9ugdNOTT5o5Q==", + "dev": true + }, + "jest-preset-angular": { + "version": "5.2.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/jest-preset-angular/-/jest-preset-angular-5.2.2.tgz", + "integrity": "sha1-zeqSwaABBsRGCB1lQrbFoPjcn+w=", + "dev": true, + "requires": { + "@types/jest": "^22.1.3", + "jest-zone-patch": "^0.0.8", + "ts-jest": "^22.4.1" + } + }, + "jest-regex-util": { + "version": "22.4.3", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/jest-regex-util/-/jest-regex-util-22.4.3.tgz", + "integrity": "sha512-LFg1gWr3QinIjb8j833bq7jtQopiwdAs67OGfkPrvy7uNUbVMfTXXcOKXJaeY5GgjobELkKvKENqq1xrUectWg==", + "dev": true + }, + "jest-resolve": { + "version": "22.4.3", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/jest-resolve/-/jest-resolve-22.4.3.tgz", + "integrity": "sha512-u3BkD/MQBmwrOJDzDIaxpyqTxYH+XqAXzVJP51gt29H8jpj3QgKof5GGO2uPGKGeA1yTMlpbMs1gIQ6U4vcRhw==", + "dev": true, + "requires": { + "browser-resolve": "^1.11.2", + "chalk": "^2.0.1" + }, + "dependencies": { + "ansi-styles": { + "version": "3.2.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, + "requires": { + "color-convert": "^1.9.0" + } + }, + "chalk": { + "version": "2.4.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/chalk/-/chalk-2.4.1.tgz", + "integrity": "sha512-ObN6h1v2fTJSmUXoS3nMQ92LbDK9be4TV+6G+omQlGJFdcUX5heKi1LZ1YnRMIgwTLEj3E24bT6tYni50rlCfQ==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + } + }, + "has-flag": { + "version": "3.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", + "dev": true + }, + "supports-color": { + "version": "5.5.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } + } + } + }, + "jest-resolve-dependencies": { + "version": "22.4.3", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/jest-resolve-dependencies/-/jest-resolve-dependencies-22.4.3.tgz", + "integrity": "sha512-06czCMVToSN8F2U4EvgSB1Bv/56gc7MpCftZ9z9fBgUQM7dzHGCMBsyfVA6dZTx8v0FDcnALf7hupeQxaBCvpA==", + "dev": true, + "requires": { + "jest-regex-util": "^22.4.3" + } + }, + "jest-runner": { + "version": "22.4.3", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/jest-runner/-/jest-runner-22.4.3.tgz", + "integrity": "sha512-U7PLlQPRlWNbvOHWOrrVay9sqhBJmiKeAdKIkvX4n1G2tsvzLlf77nBD28GL1N6tGv4RmuTfI8R8JrkvCa+IBg==", + "dev": true, + "requires": { + "exit": "^0.1.2", + "jest-config": "^22.4.3", + "jest-docblock": "^22.4.3", + "jest-haste-map": "^22.4.3", + "jest-jasmine2": "^22.4.3", + "jest-leak-detector": "^22.4.3", + "jest-message-util": "^22.4.3", + "jest-runtime": "^22.4.3", + "jest-util": "^22.4.3", + "jest-worker": "^22.4.3", + "throat": "^4.0.0" + } + }, + "jest-runtime": { + "version": "22.4.3", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/jest-runtime/-/jest-runtime-22.4.3.tgz", + "integrity": "sha512-Eat/esQjevhx9BgJEC8udye+FfoJ2qvxAZfOAWshYGS22HydHn5BgsvPdTtt9cp0fSl5LxYOFA1Pja9Iz2Zt8g==", + "dev": true, + "requires": { + "babel-core": "^6.0.0", + "babel-jest": "^22.4.3", + "babel-plugin-istanbul": "^4.1.5", + "chalk": "^2.0.1", + "convert-source-map": "^1.4.0", + "exit": "^0.1.2", + "graceful-fs": "^4.1.11", + "jest-config": "^22.4.3", + "jest-haste-map": "^22.4.3", + "jest-regex-util": "^22.4.3", + "jest-resolve": "^22.4.3", + "jest-util": "^22.4.3", + "jest-validate": "^22.4.3", + "json-stable-stringify": "^1.0.1", + "micromatch": "^2.3.11", + "realpath-native": "^1.0.0", + "slash": "^1.0.0", + "strip-bom": "3.0.0", + "write-file-atomic": "^2.1.0", + "yargs": "^10.0.3" + }, + "dependencies": { + "ansi-regex": { + "version": "3.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/ansi-regex/-/ansi-regex-3.0.0.tgz", + "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", + "dev": true + }, + "ansi-styles": { + "version": "3.2.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, + "requires": { + "color-convert": "^1.9.0" + } + }, + "arr-diff": { + "version": "2.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/arr-diff/-/arr-diff-2.0.0.tgz", + "integrity": "sha1-jzuCf5Vai9ZpaX5KQlasPOrjVs8=", + "dev": true, + "requires": { + "arr-flatten": "^1.0.1" + } + }, + "array-unique": { + "version": "0.2.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/array-unique/-/array-unique-0.2.1.tgz", + "integrity": "sha1-odl8yvy8JiXMcPrc6zalDFiwGlM=", + "dev": true + }, + "braces": { + "version": "1.8.5", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/braces/-/braces-1.8.5.tgz", + "integrity": "sha1-uneWLhLf+WnWt2cR6RS3N4V79qc=", + "dev": true, + "requires": { + "expand-range": "^1.8.1", + "preserve": "^0.2.0", + "repeat-element": "^1.1.2" + } + }, + "chalk": { + "version": "2.4.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/chalk/-/chalk-2.4.1.tgz", + "integrity": "sha512-ObN6h1v2fTJSmUXoS3nMQ92LbDK9be4TV+6G+omQlGJFdcUX5heKi1LZ1YnRMIgwTLEj3E24bT6tYni50rlCfQ==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + } + }, + "cliui": { + "version": "4.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/cliui/-/cliui-4.1.0.tgz", + "integrity": "sha512-4FG+RSG9DL7uEwRUZXZn3SS34DiDPfzP0VOiEwtUWlE+AR2EIg+hSyvrIgUUfhdgR/UkAeW2QHgeP+hWrXs7jQ==", + "dev": true, + "requires": { + "string-width": "^2.1.1", + "strip-ansi": "^4.0.0", + "wrap-ansi": "^2.0.0" + } + }, + "expand-brackets": { + "version": "0.1.5", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/expand-brackets/-/expand-brackets-0.1.5.tgz", + "integrity": "sha1-3wcoTjQqgHzXM6xa9yQR5YHRF3s=", + "dev": true, + "requires": { + "is-posix-bracket": "^0.1.0" + } + }, + "extglob": { + "version": "0.3.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/extglob/-/extglob-0.3.2.tgz", + "integrity": "sha1-Lhj/PS9JqydlzskCPwEdqo2DSaE=", + "dev": true, + "requires": { + "is-extglob": "^1.0.0" + } + }, + "find-up": { + "version": "2.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/find-up/-/find-up-2.1.0.tgz", + "integrity": "sha1-RdG35QbHF93UgndaK3eSCjwMV6c=", + "dev": true, + "requires": { + "locate-path": "^2.0.0" + } + }, + "has-flag": { + "version": "3.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", + "dev": true + }, + "is-extglob": { + "version": "1.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/is-extglob/-/is-extglob-1.0.0.tgz", + "integrity": "sha1-rEaBd8SUNAWgkvyPKXYMb/xiBsA=", + "dev": true + }, + "is-fullwidth-code-point": { + "version": "2.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", + "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", + "dev": true + }, + "is-glob": { + "version": "2.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/is-glob/-/is-glob-2.0.1.tgz", + "integrity": "sha1-0Jb5JqPe1WAPP9/ZEZjLCIjC2GM=", + "dev": true, + "requires": { + "is-extglob": "^1.0.0" + } + }, + "kind-of": { + "version": "3.2.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true, + "requires": { + "is-buffer": "^1.1.5" + } + }, + "micromatch": { + "version": "2.3.11", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/micromatch/-/micromatch-2.3.11.tgz", + "integrity": "sha1-hmd8l9FyCzY0MdBNDRUpO9OMFWU=", + "dev": true, + "requires": { + "arr-diff": "^2.0.0", + "array-unique": "^0.2.1", + "braces": "^1.8.2", + "expand-brackets": "^0.1.4", + "extglob": "^0.3.1", + "filename-regex": "^2.0.0", + "is-extglob": "^1.0.0", + "is-glob": "^2.0.1", + "kind-of": "^3.0.2", + "normalize-path": "^2.0.1", + "object.omit": "^2.0.0", + "parse-glob": "^3.0.4", + "regex-cache": "^0.4.2" + } + }, + "os-locale": { + "version": "2.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/os-locale/-/os-locale-2.1.0.tgz", + "integrity": "sha512-3sslG3zJbEYcaC4YVAvDorjGxc7tv6KVATnLPZONiljsUncvihe9BQoVCEs0RZ1kmf4Hk9OBqlZfJZWI4GanKA==", + "dev": true, + "requires": { + "execa": "^0.7.0", + "lcid": "^1.0.0", + "mem": "^1.1.0" + } + }, + "string-width": { + "version": "2.1.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/string-width/-/string-width-2.1.1.tgz", + "integrity": "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==", + "dev": true, + "requires": { + "is-fullwidth-code-point": "^2.0.0", + "strip-ansi": "^4.0.0" + } + }, + "strip-ansi": { + "version": "4.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/strip-ansi/-/strip-ansi-4.0.0.tgz", + "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", + "dev": true, + "requires": { + "ansi-regex": "^3.0.0" + } + }, + "strip-bom": { + "version": "3.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/strip-bom/-/strip-bom-3.0.0.tgz", + "integrity": "sha1-IzTBjpx1n3vdVv3vfprj1YjmjtM=", + "dev": true + }, + "supports-color": { + "version": "5.5.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } + }, + "which-module": { + "version": "2.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/which-module/-/which-module-2.0.0.tgz", + "integrity": "sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho=", + "dev": true + }, + "yargs": { + "version": "10.1.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/yargs/-/yargs-10.1.2.tgz", + "integrity": "sha512-ivSoxqBGYOqQVruxD35+EyCFDYNEFL/Uo6FcOnz+9xZdZzK0Zzw4r4KhbrME1Oo2gOggwJod2MnsdamSG7H9ig==", + "dev": true, + "requires": { + "cliui": "^4.0.0", + "decamelize": "^1.1.1", + "find-up": "^2.1.0", + "get-caller-file": "^1.0.1", + "os-locale": "^2.0.0", + "require-directory": "^2.1.1", + "require-main-filename": "^1.0.1", + "set-blocking": "^2.0.0", + "string-width": "^2.0.0", + "which-module": "^2.0.0", + "y18n": "^3.2.1", + "yargs-parser": "^8.1.0" + } + }, + "yargs-parser": { + "version": "8.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/yargs-parser/-/yargs-parser-8.1.0.tgz", + "integrity": "sha512-yP+6QqN8BmrgW2ggLtTbdrOyBNSI7zBa4IykmiV5R1wl1JWNxQvWhMfMdmzIYtKU7oP3OOInY/tl2ov3BDjnJQ==", + "dev": true, + "requires": { + "camelcase": "^4.1.0" + } + } + } + }, + "jest-serializer": { + "version": "22.4.3", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/jest-serializer/-/jest-serializer-22.4.3.tgz", + "integrity": "sha512-uPaUAppx4VUfJ0QDerpNdF43F68eqKWCzzhUlKNDsUPhjOon7ZehR4C809GCqh765FoMRtTVUVnGvIoskkYHiw==", + "dev": true + }, + "jest-snapshot": { + "version": "22.4.3", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/jest-snapshot/-/jest-snapshot-22.4.3.tgz", + "integrity": "sha512-JXA0gVs5YL0HtLDCGa9YxcmmV2LZbwJ+0MfyXBBc5qpgkEYITQFJP7XNhcHFbUvRiniRpRbGVfJrOoYhhGE0RQ==", + "dev": true, + "requires": { + "chalk": "^2.0.1", + "jest-diff": "^22.4.3", + "jest-matcher-utils": "^22.4.3", + "mkdirp": "^0.5.1", + "natural-compare": "^1.4.0", + "pretty-format": "^22.4.3" + }, + "dependencies": { + "ansi-styles": { + "version": "3.2.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, + "requires": { + "color-convert": "^1.9.0" + } + }, + "chalk": { + "version": "2.4.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/chalk/-/chalk-2.4.1.tgz", + "integrity": "sha512-ObN6h1v2fTJSmUXoS3nMQ92LbDK9be4TV+6G+omQlGJFdcUX5heKi1LZ1YnRMIgwTLEj3E24bT6tYni50rlCfQ==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + } + }, + "has-flag": { + "version": "3.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", + "dev": true + }, + "supports-color": { + "version": "5.5.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } + } + } + }, + "jest-sonar-reporter": { + "version": "2.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/jest-sonar-reporter/-/jest-sonar-reporter-2.0.0.tgz", + "integrity": "sha512-ZervDCgEX5gdUbdtWsjdipLN3bKJwpxbvhkYNXTAYvAckCihobSLr9OT/IuyNIRT1EZMDDwR6DroWtrq+IL64w==", + "dev": true, + "requires": { + "xml": "^1.0.1" + } + }, + "jest-util": { + "version": "22.4.3", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/jest-util/-/jest-util-22.4.3.tgz", + "integrity": "sha512-rfDfG8wyC5pDPNdcnAlZgwKnzHvZDu8Td2NJI/jAGKEGxJPYiE4F0ss/gSAkG4778Y23Hvbz+0GMrDJTeo7RjQ==", + "dev": true, + "requires": { + "callsites": "^2.0.0", + "chalk": "^2.0.1", + "graceful-fs": "^4.1.11", + "is-ci": "^1.0.10", + "jest-message-util": "^22.4.3", + "mkdirp": "^0.5.1", + "source-map": "^0.6.0" + }, + "dependencies": { + "ansi-styles": { + "version": "3.2.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, + "requires": { + "color-convert": "^1.9.0" + } + }, + "chalk": { + "version": "2.4.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/chalk/-/chalk-2.4.1.tgz", + "integrity": "sha512-ObN6h1v2fTJSmUXoS3nMQ92LbDK9be4TV+6G+omQlGJFdcUX5heKi1LZ1YnRMIgwTLEj3E24bT6tYni50rlCfQ==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + } + }, + "has-flag": { + "version": "3.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", + "dev": true + }, + "source-map": { + "version": "0.6.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "dev": true + }, + "supports-color": { + "version": "5.5.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } + } + } + }, + "jest-validate": { + "version": "22.4.4", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/jest-validate/-/jest-validate-22.4.4.tgz", + "integrity": "sha512-dmlf4CIZRGvkaVg3fa0uetepcua44DHtktHm6rcoNVtYlpwe6fEJRkMFsaUVcFHLzbuBJ2cPw9Gl9TKfnzMVwg==", + "dev": true, + "requires": { + "chalk": "^2.0.1", + "jest-config": "^22.4.4", + "jest-get-type": "^22.1.0", + "leven": "^2.1.0", + "pretty-format": "^22.4.0" + }, + "dependencies": { + "ansi-styles": { + "version": "3.2.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, + "requires": { + "color-convert": "^1.9.0" + } + }, + "chalk": { + "version": "2.4.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/chalk/-/chalk-2.4.1.tgz", + "integrity": "sha512-ObN6h1v2fTJSmUXoS3nMQ92LbDK9be4TV+6G+omQlGJFdcUX5heKi1LZ1YnRMIgwTLEj3E24bT6tYni50rlCfQ==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + } + }, + "has-flag": { + "version": "3.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", + "dev": true + }, + "supports-color": { + "version": "5.5.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } + } + } + }, + "jest-worker": { + "version": "22.4.3", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/jest-worker/-/jest-worker-22.4.3.tgz", + "integrity": "sha512-B1ucW4fI8qVAuZmicFxI1R3kr2fNeYJyvIQ1rKcuLYnenFV5K5aMbxFj6J0i00Ju83S8jP2d7Dz14+AvbIHRYQ==", + "dev": true, + "requires": { + "merge-stream": "^1.0.1" + } + }, + "jest-zone-patch": { + "version": "0.0.8", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/jest-zone-patch/-/jest-zone-patch-0.0.8.tgz", + "integrity": "sha1-kPo7W2DpWtPmJN0sPrWbsdyr03E=", + "dev": true + }, + "jhipster-core": { + "version": "3.4.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/jhipster-core/-/jhipster-core-3.4.0.tgz", + "integrity": "sha512-iVJ6MF4jlpvtVL5gbn9t4Jw27RodjY04SXYSGfTLAzHyQRMmehHLvNq/3DBjVwHgBrDn1u2k17oLGouJus9MhA==", + "dev": true, + "requires": { + "chevrotain": "4.1.0", + "fs-extra": "7.0.0", + "lodash": "4.17.11", + "winston": "3.1.0" + }, + "dependencies": { + "fs-extra": { + "version": "7.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/fs-extra/-/fs-extra-7.0.0.tgz", + "integrity": "sha512-EglNDLRpmaTWiD/qraZn6HREAEAHJcJOmxNEYwq6xeMKnVMAy3GUcFB+wXt2C6k4CNvB/mP1y/U3dzvKKj5OtQ==", + "dev": true, + "requires": { + "graceful-fs": "^4.1.2", + "jsonfile": "^4.0.0", + "universalify": "^0.1.0" + } + }, + "jsonfile": { + "version": "4.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/jsonfile/-/jsonfile-4.0.0.tgz", + "integrity": "sha1-h3Gq4HmbZAdrdmQPygWPnBDjPss=", + "dev": true, + "requires": { + "graceful-fs": "^4.1.6" + } + }, + "lodash": { + "version": "4.17.11", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/lodash/-/lodash-4.17.11.tgz", + "integrity": "sha512-cQKh8igo5QUhZ7lg38DYWAxMvjSAKG0A8wGSVimP07SIUEK2UO+arSRKbRZWtelMtN5V0Hkwh5ryOto/SshYIg==", + "dev": true + } + } + }, + "joi": { + "version": "11.4.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/joi/-/joi-11.4.0.tgz", + "integrity": "sha512-O7Uw+w/zEWgbL6OcHbyACKSj0PkQeUgmehdoXVSxt92QFCq4+1390Rwh5moI2K/OgC7D8RHRZqHZxT2husMJHA==", + "dev": true, + "requires": { + "hoek": "4.x.x", + "isemail": "3.x.x", + "topo": "2.x.x" + } + }, + "js-base64": { + "version": "2.4.5", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/js-base64/-/js-base64-2.4.5.tgz", + "integrity": "sha512-aUnNwqMOXw3yvErjMPSQu6qIIzUmT1e5KcU1OZxRDU1g/am6mzBvcrmLAYwzmB59BHPrh5/tKaiF4OPhqRWESQ==", + "dev": true + }, + "js-object-pretty-print": { + "version": "0.3.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/js-object-pretty-print/-/js-object-pretty-print-0.3.0.tgz", + "integrity": "sha1-RnDkUAZu4ezPNRdMfRl/WqOLz3Q=", + "dev": true + }, + "js-tokens": { + "version": "3.0.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/js-tokens/-/js-tokens-3.0.2.tgz", + "integrity": "sha1-mGbfOVECEw449/mWvOtlRDIJwls=", + "dev": true + }, + "js-yaml": { + "version": "3.7.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/js-yaml/-/js-yaml-3.7.0.tgz", + "integrity": "sha1-XJZ93YN6m/3KXy3oQlOr6KHAO4A=", + "dev": true, + "requires": { + "argparse": "^1.0.7", + "esprima": "^2.6.0" + } + }, + "jsbn": { + "version": "0.1.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/jsbn/-/jsbn-0.1.1.tgz", + "integrity": "sha1-peZUwuWi3rXyAdls77yoDA7y9RM=", + "dev": true + }, + "jscodeshift": { + "version": "0.5.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/jscodeshift/-/jscodeshift-0.5.0.tgz", + "integrity": "sha512-JAcQINNMFpdzzpKJN8k5xXjF3XDuckB1/48uScSzcnNyK199iWEc9AxKL9OoX5144M2w5zEx9Qs4/E/eBZZUlw==", + "dev": true, + "requires": { + "babel-plugin-transform-flow-strip-types": "^6.8.0", + "babel-preset-es2015": "^6.9.0", + "babel-preset-stage-1": "^6.5.0", + "babel-register": "^6.9.0", + "babylon": "^7.0.0-beta.30", + "colors": "^1.1.2", + "flow-parser": "^0.*", + "lodash": "^4.13.1", + "micromatch": "^2.3.7", + "neo-async": "^2.5.0", + "node-dir": "0.1.8", + "nomnom": "^1.8.1", + "recast": "^0.14.1", + "temp": "^0.8.1", + "write-file-atomic": "^1.2.0" + }, + "dependencies": { + "arr-diff": { + "version": "2.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/arr-diff/-/arr-diff-2.0.0.tgz", + "integrity": "sha1-jzuCf5Vai9ZpaX5KQlasPOrjVs8=", + "dev": true, + "requires": { + "arr-flatten": "^1.0.1" + } + }, + "array-unique": { + "version": "0.2.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/array-unique/-/array-unique-0.2.1.tgz", + "integrity": "sha1-odl8yvy8JiXMcPrc6zalDFiwGlM=", + "dev": true + }, + "ast-types": { + "version": "0.11.3", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/ast-types/-/ast-types-0.11.3.tgz", + "integrity": "sha512-XA5o5dsNw8MhyW0Q7MWXJWc4oOzZKbdsEJq45h7c8q/d9DwWZ5F2ugUc1PuMLPGsUnphCt/cNDHu8JeBbxf1qA==", + "dev": true + }, + "babylon": { + "version": "7.0.0-beta.47", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/babylon/-/babylon-7.0.0-beta.47.tgz", + "integrity": "sha512-+rq2cr4GDhtToEzKFD6KZZMDBXhjFAr9JjPw9pAppZACeEWqNM294j+NdBzkSHYXwzzBmVjZ3nEVJlOhbR2gOQ==", + "dev": true + }, + "braces": { + "version": "1.8.5", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/braces/-/braces-1.8.5.tgz", + "integrity": "sha1-uneWLhLf+WnWt2cR6RS3N4V79qc=", + "dev": true, + "requires": { + "expand-range": "^1.8.1", + "preserve": "^0.2.0", + "repeat-element": "^1.1.2" + } + }, + "esprima": { + "version": "4.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/esprima/-/esprima-4.0.1.tgz", + "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==", + "dev": true + }, + "expand-brackets": { + "version": "0.1.5", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/expand-brackets/-/expand-brackets-0.1.5.tgz", + "integrity": "sha1-3wcoTjQqgHzXM6xa9yQR5YHRF3s=", + "dev": true, + "requires": { + "is-posix-bracket": "^0.1.0" + } + }, + "extglob": { + "version": "0.3.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/extglob/-/extglob-0.3.2.tgz", + "integrity": "sha1-Lhj/PS9JqydlzskCPwEdqo2DSaE=", + "dev": true, + "requires": { + "is-extglob": "^1.0.0" + } + }, + "is-extglob": { + "version": "1.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/is-extglob/-/is-extglob-1.0.0.tgz", + "integrity": "sha1-rEaBd8SUNAWgkvyPKXYMb/xiBsA=", + "dev": true + }, + "is-glob": { + "version": "2.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/is-glob/-/is-glob-2.0.1.tgz", + "integrity": "sha1-0Jb5JqPe1WAPP9/ZEZjLCIjC2GM=", + "dev": true, + "requires": { + "is-extglob": "^1.0.0" + } + }, + "kind-of": { + "version": "3.2.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true, + "requires": { + "is-buffer": "^1.1.5" + } + }, + "lodash": { + "version": "4.17.11", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/lodash/-/lodash-4.17.11.tgz", + "integrity": "sha512-cQKh8igo5QUhZ7lg38DYWAxMvjSAKG0A8wGSVimP07SIUEK2UO+arSRKbRZWtelMtN5V0Hkwh5ryOto/SshYIg==", + "dev": true + }, + "micromatch": { + "version": "2.3.11", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/micromatch/-/micromatch-2.3.11.tgz", + "integrity": "sha1-hmd8l9FyCzY0MdBNDRUpO9OMFWU=", + "dev": true, + "requires": { + "arr-diff": "^2.0.0", + "array-unique": "^0.2.1", + "braces": "^1.8.2", + "expand-brackets": "^0.1.4", + "extglob": "^0.3.1", + "filename-regex": "^2.0.0", + "is-extglob": "^1.0.0", + "is-glob": "^2.0.1", + "kind-of": "^3.0.2", + "normalize-path": "^2.0.1", + "object.omit": "^2.0.0", + "parse-glob": "^3.0.4", + "regex-cache": "^0.4.2" + } + }, + "recast": { + "version": "0.14.7", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/recast/-/recast-0.14.7.tgz", + "integrity": "sha512-/nwm9pkrcWagN40JeJhkPaRxiHXBRkXyRh/hgU088Z/v+qCy+zIHHY6bC6o7NaKAxPqtE6nD8zBH1LfU0/Wx6A==", + "dev": true, + "requires": { + "ast-types": "0.11.3", + "esprima": "~4.0.0", + "private": "~0.1.5", + "source-map": "~0.6.1" + } + }, + "source-map": { + "version": "0.6.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "dev": true + }, + "write-file-atomic": { + "version": "1.3.4", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/write-file-atomic/-/write-file-atomic-1.3.4.tgz", + "integrity": "sha1-+Aek8LHZ6ROuekgRLmzDrxmRtF8=", + "dev": true, + "requires": { + "graceful-fs": "^4.1.11", + "imurmurhash": "^0.1.4", + "slide": "^1.1.5" + } + } + } + }, + "jsdom": { + "version": "11.9.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/jsdom/-/jsdom-11.9.0.tgz", + "integrity": "sha512-sb3omwJTJ+HwAltLZevM/KQBusY+l2Ar5UfnTCWk9oUVBiDnQPBNiG1BaTAKttCnneonYbNo7vi4EFDY2lBfNA==", + "dev": true, + "requires": { + "abab": "^1.0.4", + "acorn": "^5.3.0", + "acorn-globals": "^4.1.0", + "array-equal": "^1.0.0", + "cssom": ">= 0.3.2 < 0.4.0", + "cssstyle": ">= 0.2.37 < 0.3.0", + "data-urls": "^1.0.0", + "domexception": "^1.0.0", + "escodegen": "^1.9.0", + "html-encoding-sniffer": "^1.0.2", + "left-pad": "^1.2.0", + "nwmatcher": "^1.4.3", + "parse5": "4.0.0", + "pn": "^1.1.0", + "request": "^2.83.0", + "request-promise-native": "^1.0.5", + "sax": "^1.2.4", + "symbol-tree": "^3.2.2", + "tough-cookie": "^2.3.3", + "w3c-hr-time": "^1.0.1", + "webidl-conversions": "^4.0.2", + "whatwg-encoding": "^1.0.3", + "whatwg-mimetype": "^2.1.0", + "whatwg-url": "^6.4.0", + "ws": "^4.0.0", + "xml-name-validator": "^3.0.0" + }, + "dependencies": { + "parse5": { + "version": "4.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/parse5/-/parse5-4.0.0.tgz", + "integrity": "sha512-VrZ7eOd3T1Fk4XWNXMgiGBK/z0MG48BWG2uQNU4I72fkQuKUTZpl+u9k+CxEG0twMVzSmXEEz12z5Fnw1jIQFA==", + "dev": true + }, + "ws": { + "version": "4.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/ws/-/ws-4.1.0.tgz", + "integrity": "sha512-ZGh/8kF9rrRNffkLFV4AzhvooEclrOH0xaugmqGsIfFgOE/pIz4fMc4Ef+5HSQqTEug2S9JZIWDR47duDSLfaA==", + "dev": true, + "requires": { + "async-limiter": "~1.0.0", + "safe-buffer": "~5.1.0" + } + } + } + }, + "jsesc": { + "version": "0.5.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/jsesc/-/jsesc-0.5.0.tgz", + "integrity": "sha1-597mbjXW/Bb3EP6R1c9p9w8IkR0=", + "dev": true + }, + "json-buffer": { + "version": "3.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/json-buffer/-/json-buffer-3.0.0.tgz", + "integrity": "sha1-Wx85evx11ne96Lz8Dkfh+aPZqJg=", + "dev": true + }, + "json-loader": { + "version": "0.5.4", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/json-loader/-/json-loader-0.5.4.tgz", + "integrity": "sha1-i6oTZaYy9Yo8RtIBdfxgAsluN94=", + "dev": true + }, + "json-parse-better-errors": { + "version": "1.0.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/json-parse-better-errors/-/json-parse-better-errors-1.0.2.tgz", + "integrity": "sha512-mrqyZKfX5EhL7hvqcV6WG1yYjnjeuYDzDhhcAAUrq8Po85NBQBJP+ZDUT75qZQ98IkUoBqdkExkukOU7Ts2wrw==", + "dev": true + }, + "json-schema": { + "version": "0.2.3", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/json-schema/-/json-schema-0.2.3.tgz", + "integrity": "sha1-tIDIkuWaLwWVTOcnvT8qTogvnhM=", + "dev": true + }, + "json-schema-traverse": { + "version": "0.3.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/json-schema-traverse/-/json-schema-traverse-0.3.1.tgz", + "integrity": "sha1-NJptRMU6Ud6JtAgFxdXlm0F9M0A=", + "dev": true + }, + "json-stable-stringify": { + "version": "1.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/json-stable-stringify/-/json-stable-stringify-1.0.1.tgz", + "integrity": "sha1-mnWdOcXy/1A/1TAGRu1EX4jE+a8=", + "dev": true, + "requires": { + "jsonify": "~0.0.0" + } + }, + "json-stringify-safe": { + "version": "5.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", + "integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus=", + "dev": true + }, + "json3": { + "version": "3.3.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/json3/-/json3-3.3.2.tgz", + "integrity": "sha1-PAQ0dD35Pi9cQq7nsZvLSDV19OE=", + "dev": true + }, + "json5": { + "version": "0.5.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/json5/-/json5-0.5.1.tgz", + "integrity": "sha1-Hq3nrMASA0rYTiOWdn6tn6VJWCE=", + "dev": true + }, + "jsonfile": { + "version": "3.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/jsonfile/-/jsonfile-3.0.1.tgz", + "integrity": "sha1-pezG9l9T9mLEQVx2daAzHQmS7GY=", + "dev": true, + "requires": { + "graceful-fs": "^4.1.6" + } + }, + "jsonify": { + "version": "0.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/jsonify/-/jsonify-0.0.0.tgz", + "integrity": "sha1-LHS27kHZPKUbe1qu6PUDYx0lKnM=", + "dev": true + }, + "jsprim": { + "version": "1.4.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/jsprim/-/jsprim-1.4.1.tgz", + "integrity": "sha1-MT5mvB5cwG5Di8G3SZwuXFastqI=", + "dev": true, + "requires": { + "assert-plus": "1.0.0", + "extsprintf": "1.3.0", + "json-schema": "0.2.3", + "verror": "1.10.0" + } + }, + "jstransform": { + "version": "11.0.3", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/jstransform/-/jstransform-11.0.3.tgz", + "integrity": "sha1-CaeJk+CuTU70SH9hVakfYZDLQiM=", + "dev": true, + "requires": { + "base62": "^1.1.0", + "commoner": "^0.10.1", + "esprima-fb": "^15001.1.0-dev-harmony-fb", + "object-assign": "^2.0.0", + "source-map": "^0.4.2" + }, + "dependencies": { + "esprima-fb": { + "version": "15001.1.0-dev-harmony-fb", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/esprima-fb/-/esprima-fb-15001.1.0-dev-harmony-fb.tgz", + "integrity": "sha1-MKlHMDxrjV6VW+4rmbHSMyBqaQE=", + "dev": true + }, + "object-assign": { + "version": "2.1.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/object-assign/-/object-assign-2.1.1.tgz", + "integrity": "sha1-Q8NuXVaf+OSBbE76i+AtJpZ8GKo=", + "dev": true + }, + "source-map": { + "version": "0.4.4", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/source-map/-/source-map-0.4.4.tgz", + "integrity": "sha1-66T12pwNyZneaAMti092FzZSA2s=", + "dev": true, + "requires": { + "amdefine": ">=0.0.4" + } + } + } + }, + "keyv": { + "version": "3.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/keyv/-/keyv-3.0.0.tgz", + "integrity": "sha512-eguHnq22OE3uVoSYG0LVWNP+4ppamWr9+zWBe1bsNcovIMy6huUJFPgy4mGwCd/rnl3vOLGW1MTlu4c57CT1xA==", + "dev": true, + "requires": { + "json-buffer": "3.0.0" + } + }, + "killable": { + "version": "1.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/killable/-/killable-1.0.0.tgz", + "integrity": "sha1-2ouEvUfeU5WHj5XWTQLyRJ/gXms=", + "dev": true + }, + "kind-of": { + "version": "6.0.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/kind-of/-/kind-of-6.0.2.tgz", + "integrity": "sha512-s5kLOcnH0XqDO+FvuaLX8DDjZ18CGFk7VygH40QoKPUQhW4e2rvM0rwUq0t8IQDOwYSeLK01U90OjzBTme2QqA==", + "dev": true + }, + "kuler": { + "version": "1.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/kuler/-/kuler-1.0.1.tgz", + "integrity": "sha512-J9nVUucG1p/skKul6DU3PUZrhs0LPulNaeUOox0IyXDi8S4CztTHs1gQphhuZmzXG7VOQSf6NJfKuzteQLv9gQ==", + "dev": true, + "requires": { + "colornames": "^1.1.1" + } + }, + "last-call-webpack-plugin": { + "version": "3.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/last-call-webpack-plugin/-/last-call-webpack-plugin-3.0.0.tgz", + "integrity": "sha512-7KI2l2GIZa9p2spzPIVZBYyNKkN+e/SQPpnjlTiPhdbDW3F86tdKKELxKpzJ5sgU19wQWsACULZmpTPYHeWO5w==", + "dev": true, + "requires": { + "lodash": "^4.17.5", + "webpack-sources": "^1.1.0" + }, + "dependencies": { + "lodash": { + "version": "4.17.11", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/lodash/-/lodash-4.17.11.tgz", + "integrity": "sha512-cQKh8igo5QUhZ7lg38DYWAxMvjSAKG0A8wGSVimP07SIUEK2UO+arSRKbRZWtelMtN5V0Hkwh5ryOto/SshYIg==", + "dev": true + } + } + }, + "lazy-cache": { + "version": "1.0.4", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/lazy-cache/-/lazy-cache-1.0.4.tgz", + "integrity": "sha1-odePw6UEdMuAhF07O24dpJpEbo4=", + "dev": true, + "optional": true + }, + "lcid": { + "version": "1.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/lcid/-/lcid-1.0.0.tgz", + "integrity": "sha1-MIrMr6C8SDo4Z7S28rlQYlHRuDU=", + "dev": true, + "requires": { + "invert-kv": "^1.0.0" + } + }, + "leb": { + "version": "0.3.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/leb/-/leb-0.3.0.tgz", + "integrity": "sha1-Mr7p+tFoMo1q6oUi2DP0GA7tHaM=", + "dev": true + }, + "left-pad": { + "version": "1.3.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/left-pad/-/left-pad-1.3.0.tgz", + "integrity": "sha512-XI5MPzVNApjAyhQzphX8BkmKsKUxD4LdyK24iZeQGinBN9yTQT3bFlCBy/aVx2HrNcqQGsdot8ghrjyrvMCoEA==", + "dev": true + }, + "leven": { + "version": "2.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/leven/-/leven-2.1.0.tgz", + "integrity": "sha1-wuep93IJTe6dNCAq6KzORoeHVYA=", + "dev": true + }, + "levn": { + "version": "0.3.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/levn/-/levn-0.3.0.tgz", + "integrity": "sha1-OwmSTt+fCDwEkP3UwLxEIeBHZO4=", + "dev": true, + "requires": { + "prelude-ls": "~1.1.2", + "type-check": "~0.3.2" + } + }, + "limiter": { + "version": "1.1.3", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/limiter/-/limiter-1.1.3.tgz", + "integrity": "sha512-zrycnIMsLw/3ZxTbW7HCez56rcFGecWTx5OZNplzcXUUmJLmoYArC6qdJzmAN5BWiNXGcpjhF9RQ1HSv5zebEw==", + "dev": true + }, + "lint-staged": { + "version": "7.3.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/lint-staged/-/lint-staged-7.3.0.tgz", + "integrity": "sha512-AXk40M9DAiPi7f4tdJggwuKIViUplYtVj1os1MVEteW7qOkU50EOehayCfO9TsoGK24o/EsWb41yrEgfJDDjCw==", + "dev": true, + "requires": { + "chalk": "^2.3.1", + "commander": "^2.14.1", + "cosmiconfig": "^5.0.2", + "debug": "^3.1.0", + "dedent": "^0.7.0", + "execa": "^0.9.0", + "find-parent-dir": "^0.3.0", + "is-glob": "^4.0.0", + "is-windows": "^1.0.2", + "jest-validate": "^23.5.0", + "listr": "^0.14.1", + "lodash": "^4.17.5", + "log-symbols": "^2.2.0", + "micromatch": "^3.1.8", + "npm-which": "^3.0.1", + "p-map": "^1.1.1", + "path-is-inside": "^1.0.2", + "pify": "^3.0.0", + "please-upgrade-node": "^3.0.2", + "staged-git-files": "1.1.1", + "string-argv": "^0.0.2", + "stringify-object": "^3.2.2" + }, + "dependencies": { + "ansi-regex": { + "version": "3.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/ansi-regex/-/ansi-regex-3.0.0.tgz", + "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", + "dev": true + }, + "ansi-styles": { + "version": "3.2.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, + "requires": { + "color-convert": "^1.9.0" + } + }, + "chalk": { + "version": "2.4.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/chalk/-/chalk-2.4.1.tgz", + "integrity": "sha512-ObN6h1v2fTJSmUXoS3nMQ92LbDK9be4TV+6G+omQlGJFdcUX5heKi1LZ1YnRMIgwTLEj3E24bT6tYni50rlCfQ==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + } + }, + "debug": { + "version": "3.2.6", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/debug/-/debug-3.2.6.tgz", + "integrity": "sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ==", + "dev": true, + "requires": { + "ms": "^2.1.1" + } + }, + "execa": { + "version": "0.9.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/execa/-/execa-0.9.0.tgz", + "integrity": "sha512-BbUMBiX4hqiHZUA5+JujIjNb6TyAlp2D5KLheMjMluwOuzcnylDL4AxZYLLn1n2AGB49eSWwyKvvEQoRpnAtmA==", + "dev": true, + "requires": { + "cross-spawn": "^5.0.1", + "get-stream": "^3.0.0", + "is-stream": "^1.1.0", + "npm-run-path": "^2.0.0", + "p-finally": "^1.0.0", + "signal-exit": "^3.0.0", + "strip-eof": "^1.0.0" + } + }, + "has-flag": { + "version": "3.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", + "dev": true + }, + "jest-validate": { + "version": "23.6.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/jest-validate/-/jest-validate-23.6.0.tgz", + "integrity": "sha512-OFKapYxe72yz7agrDAWi8v2WL8GIfVqcbKRCLbRG9PAxtzF9b1SEDdTpytNDN12z2fJynoBwpMpvj2R39plI2A==", + "dev": true, + "requires": { + "chalk": "^2.0.1", + "jest-get-type": "^22.1.0", + "leven": "^2.1.0", + "pretty-format": "^23.6.0" + } + }, + "lodash": { + "version": "4.17.11", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/lodash/-/lodash-4.17.11.tgz", + "integrity": "sha512-cQKh8igo5QUhZ7lg38DYWAxMvjSAKG0A8wGSVimP07SIUEK2UO+arSRKbRZWtelMtN5V0Hkwh5ryOto/SshYIg==", + "dev": true + }, + "ms": { + "version": "2.1.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/ms/-/ms-2.1.1.tgz", + "integrity": "sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg==", + "dev": true + }, + "pify": { + "version": "3.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/pify/-/pify-3.0.0.tgz", + "integrity": "sha1-5aSs0sEB/fPZpNB/DbxNtJ3SgXY=", + "dev": true + }, + "pretty-format": { + "version": "23.6.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/pretty-format/-/pretty-format-23.6.0.tgz", + "integrity": "sha512-zf9NV1NSlDLDjycnwm6hpFATCGl/K1lt0R/GdkAK2O5LN/rwJoB+Mh93gGJjut4YbmecbfgLWVGSTCr0Ewvvbw==", + "dev": true, + "requires": { + "ansi-regex": "^3.0.0", + "ansi-styles": "^3.2.0" + } + }, + "supports-color": { + "version": "5.5.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } + } + } + }, + "listr": { + "version": "0.14.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/listr/-/listr-0.14.2.tgz", + "integrity": "sha512-vmaNJ1KlGuGWShHI35X/F8r9xxS0VTHh9GejVXwSN20fG5xpq3Jh4bJbnumoT6q5EDM/8/YP1z3YMtQbFmhuXw==", + "dev": true, + "requires": { + "@samverschueren/stream-to-observable": "^0.3.0", + "is-observable": "^1.1.0", + "is-promise": "^2.1.0", + "is-stream": "^1.1.0", + "listr-silent-renderer": "^1.1.1", + "listr-update-renderer": "^0.4.0", + "listr-verbose-renderer": "^0.4.0", + "p-map": "^1.1.1", + "rxjs": "^6.1.0" + } + }, + "listr-silent-renderer": { + "version": "1.1.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/listr-silent-renderer/-/listr-silent-renderer-1.1.1.tgz", + "integrity": "sha1-kktaN1cVN3C/Go4/v3S4u/P5JC4=", + "dev": true + }, + "listr-update-renderer": { + "version": "0.4.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/listr-update-renderer/-/listr-update-renderer-0.4.0.tgz", + "integrity": "sha1-NE2YDaLKLosUW6MFkI8yrj9MyKc=", + "dev": true, + "requires": { + "chalk": "^1.1.3", + "cli-truncate": "^0.2.1", + "elegant-spinner": "^1.0.1", + "figures": "^1.7.0", + "indent-string": "^3.0.0", + "log-symbols": "^1.0.2", + "log-update": "^1.0.2", + "strip-ansi": "^3.0.1" + }, + "dependencies": { + "figures": { + "version": "1.7.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/figures/-/figures-1.7.0.tgz", + "integrity": "sha1-y+Hjr/zxzUS4DK3+0o3Hk6lwHS4=", + "dev": true, + "requires": { + "escape-string-regexp": "^1.0.5", + "object-assign": "^4.1.0" + } + }, + "log-symbols": { + "version": "1.0.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/log-symbols/-/log-symbols-1.0.2.tgz", + "integrity": "sha1-N2/3tY6jCGoPCfrMdGF+ylAeGhg=", + "dev": true, + "requires": { + "chalk": "^1.0.0" + } + } + } + }, + "listr-verbose-renderer": { + "version": "0.4.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/listr-verbose-renderer/-/listr-verbose-renderer-0.4.1.tgz", + "integrity": "sha1-ggb0z21S3cWCfl/RSYng6WWTOjU=", + "dev": true, + "requires": { + "chalk": "^1.1.3", + "cli-cursor": "^1.0.2", + "date-fns": "^1.27.2", + "figures": "^1.7.0" + }, + "dependencies": { + "cli-cursor": { + "version": "1.0.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/cli-cursor/-/cli-cursor-1.0.2.tgz", + "integrity": "sha1-ZNo/fValRBLll5S9Ytw1KV6PKYc=", + "dev": true, + "requires": { + "restore-cursor": "^1.0.1" + } + }, + "figures": { + "version": "1.7.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/figures/-/figures-1.7.0.tgz", + "integrity": "sha1-y+Hjr/zxzUS4DK3+0o3Hk6lwHS4=", + "dev": true, + "requires": { + "escape-string-regexp": "^1.0.5", + "object-assign": "^4.1.0" + } + }, + "onetime": { + "version": "1.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/onetime/-/onetime-1.1.0.tgz", + "integrity": "sha1-ofeDj4MUxRbwXs78vEzP4EtO14k=", + "dev": true + }, + "restore-cursor": { + "version": "1.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/restore-cursor/-/restore-cursor-1.0.1.tgz", + "integrity": "sha1-NGYfRohjJ/7SmRR5FSJS35LapUE=", + "dev": true, + "requires": { + "exit-hook": "^1.0.0", + "onetime": "^1.0.0" + } + } + } + }, + "load-json-file": { + "version": "1.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/load-json-file/-/load-json-file-1.1.0.tgz", + "integrity": "sha1-lWkFcI1YtLq0wiYbBPWfMcmTdMA=", + "dev": true, + "requires": { + "graceful-fs": "^4.1.2", + "parse-json": "^2.2.0", + "pify": "^2.0.0", + "pinkie-promise": "^2.0.0", + "strip-bom": "^2.0.0" + } + }, + "loader-runner": { + "version": "2.3.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/loader-runner/-/loader-runner-2.3.0.tgz", + "integrity": "sha1-9IKuqC1UPgeSFwDVpG7yb9rGuKI=", + "dev": true + }, + "loader-utils": { + "version": "1.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/loader-utils/-/loader-utils-1.1.0.tgz", + "integrity": "sha1-yYrvSIvM7aL/teLeZG1qdUQp9c0=", + "dev": true, + "requires": { + "big.js": "^3.1.3", + "emojis-list": "^2.0.0", + "json5": "^0.5.0" + } + }, + "localtunnel": { + "version": "1.9.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/localtunnel/-/localtunnel-1.9.0.tgz", + "integrity": "sha512-wCIiIHJ8kKIcWkTQE3m1VRABvsH2ZuOkiOpZUofUCf6Q42v3VIZ+Q0YfX1Z4sYDRj0muiKL1bLvz1FeoxsPO0w==", + "dev": true, + "requires": { + "axios": "0.17.1", + "debug": "2.6.8", + "openurl": "1.1.1", + "yargs": "6.6.0" + }, + "dependencies": { + "camelcase": { + "version": "3.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/camelcase/-/camelcase-3.0.0.tgz", + "integrity": "sha1-MvxLn82vhF/N9+c7uXysImHwqwo=", + "dev": true + }, + "debug": { + "version": "2.6.8", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/debug/-/debug-2.6.8.tgz", + "integrity": "sha1-5zFTHKLt4n0YgiJCfaF4IdaP9Pw=", + "dev": true, + "requires": { + "ms": "2.0.0" + } + }, + "yargs": { + "version": "6.6.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/yargs/-/yargs-6.6.0.tgz", + "integrity": "sha1-eC7CHvQDNF+DCoCMo9UTr1YGUgg=", + "dev": true, + "requires": { + "camelcase": "^3.0.0", + "cliui": "^3.2.0", + "decamelize": "^1.1.1", + "get-caller-file": "^1.0.1", + "os-locale": "^1.4.0", + "read-pkg-up": "^1.0.1", + "require-directory": "^2.1.1", + "require-main-filename": "^1.0.1", + "set-blocking": "^2.0.0", + "string-width": "^1.0.2", + "which-module": "^1.0.0", + "y18n": "^3.2.1", + "yargs-parser": "^4.2.0" + } + }, + "yargs-parser": { + "version": "4.2.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/yargs-parser/-/yargs-parser-4.2.1.tgz", + "integrity": "sha1-KczqwNxPA8bIe0qfIX3RjJ90hxw=", + "dev": true, + "requires": { + "camelcase": "^3.0.0" + } + } + } + }, + "locate-path": { + "version": "2.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/locate-path/-/locate-path-2.0.0.tgz", + "integrity": "sha1-K1aLJl7slExtnA3pw9u7ygNUzY4=", + "dev": true, + "requires": { + "p-locate": "^2.0.0", + "path-exists": "^3.0.0" + }, + "dependencies": { + "path-exists": { + "version": "3.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/path-exists/-/path-exists-3.0.0.tgz", + "integrity": "sha1-zg6+ql94yxiSXqfYENe1mwEP1RU=", + "dev": true + } + } + }, + "lodash": { + "version": "3.10.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/lodash/-/lodash-3.10.1.tgz", + "integrity": "sha1-W/Rejkm6QYnhfUgnid/RW9FAt7Y=", + "dev": true + }, + "lodash._reinterpolate": { + "version": "3.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/lodash._reinterpolate/-/lodash._reinterpolate-3.0.0.tgz", + "integrity": "sha1-DM8tiRZq8Ds2Y8eWU4t1rG4RTZ0=", + "dev": true + }, + "lodash.camelcase": { + "version": "4.3.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/lodash.camelcase/-/lodash.camelcase-4.3.0.tgz", + "integrity": "sha1-soqmKIorn8ZRA1x3EfZathkDMaY=", + "dev": true + }, + "lodash.debounce": { + "version": "4.0.8", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/lodash.debounce/-/lodash.debounce-4.0.8.tgz", + "integrity": "sha1-gteb/zCmfEAF/9XiUVMArZyk168=", + "dev": true + }, + "lodash.difference": { + "version": "4.5.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/lodash.difference/-/lodash.difference-4.5.0.tgz", + "integrity": "sha1-nMtOUF1Ia5FlE0V3KIWi3yf9AXw=", + "dev": true + }, + "lodash.endswith": { + "version": "4.2.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/lodash.endswith/-/lodash.endswith-4.2.1.tgz", + "integrity": "sha1-/tWawXOO0+I27dcGTsRWRIs3vAk=", + "dev": true + }, + "lodash.isfinite": { + "version": "3.3.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/lodash.isfinite/-/lodash.isfinite-3.3.2.tgz", + "integrity": "sha1-+4m2WpqAKBgz8LdHizpRBPiY67M=", + "dev": true + }, + "lodash.isfunction": { + "version": "3.0.9", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/lodash.isfunction/-/lodash.isfunction-3.0.9.tgz", + "integrity": "sha512-AirXNj15uRIMMPihnkInB4i3NHeb4iBtNg9WRWuK2o31S+ePwwNmDPaTL3o7dTJ+VXNZim7rFs4rxN4YU1oUJw==", + "dev": true + }, + "lodash.isstring": { + "version": "4.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/lodash.isstring/-/lodash.isstring-4.0.1.tgz", + "integrity": "sha1-1SfftUVuynzJu5XV2ur4i6VKVFE=", + "dev": true + }, + "lodash.memoize": { + "version": "4.1.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/lodash.memoize/-/lodash.memoize-4.1.2.tgz", + "integrity": "sha1-vMbEmkKihA7Zl/Mj6tpezRguC/4=", + "dev": true + }, + "lodash.pad": { + "version": "4.5.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/lodash.pad/-/lodash.pad-4.5.1.tgz", + "integrity": "sha1-QzCUmoM6fI2iLMIPaibE1Z3runA=", + "dev": true + }, + "lodash.padend": { + "version": "4.6.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/lodash.padend/-/lodash.padend-4.6.1.tgz", + "integrity": "sha1-U8y6BH0G4VjTEfRdpiX05J5vFm4=", + "dev": true + }, + "lodash.padstart": { + "version": "4.6.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/lodash.padstart/-/lodash.padstart-4.6.1.tgz", + "integrity": "sha1-0uPuv/DZ05rVD1y9G1KnvOa7YRs=", + "dev": true + }, + "lodash.sortby": { + "version": "4.7.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/lodash.sortby/-/lodash.sortby-4.7.0.tgz", + "integrity": "sha1-7dFMgk4sycHgsKG0K7UhBRakJDg=", + "dev": true + }, + "lodash.startswith": { + "version": "4.2.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/lodash.startswith/-/lodash.startswith-4.2.1.tgz", + "integrity": "sha1-xZjErc4YiiflMUVzHNxsDnF3YAw=", + "dev": true + }, + "lodash.tail": { + "version": "4.1.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/lodash.tail/-/lodash.tail-4.1.1.tgz", + "integrity": "sha1-0jM6NtnncXyK0vfKyv7HwytERmQ=", + "dev": true + }, + "lodash.template": { + "version": "4.4.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/lodash.template/-/lodash.template-4.4.0.tgz", + "integrity": "sha1-5zoDhcg1VZF0bgILmWecaQ5o+6A=", + "dev": true, + "requires": { + "lodash._reinterpolate": "~3.0.0", + "lodash.templatesettings": "^4.0.0" + } + }, + "lodash.templatesettings": { + "version": "4.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/lodash.templatesettings/-/lodash.templatesettings-4.1.0.tgz", + "integrity": "sha1-K01OlbpEDZFf8IvImeRVNmZxMxY=", + "dev": true, + "requires": { + "lodash._reinterpolate": "~3.0.0" + } + }, + "lodash.uniq": { + "version": "4.5.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/lodash.uniq/-/lodash.uniq-4.5.0.tgz", + "integrity": "sha1-0CJTc662Uq3BvILklFM5qEJ1R3M=", + "dev": true + }, + "log-symbols": { + "version": "2.2.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/log-symbols/-/log-symbols-2.2.0.tgz", + "integrity": "sha512-VeIAFslyIerEJLXHziedo2basKbMKtTw3vfn5IzG0XTjhAVEJyNHnL2p7vc+wBDSdQuUpNw3M2u6xb9QsAY5Eg==", + "dev": true, + "requires": { + "chalk": "^2.0.1" + }, + "dependencies": { + "ansi-styles": { + "version": "3.2.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, + "requires": { + "color-convert": "^1.9.0" + } + }, + "chalk": { + "version": "2.4.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/chalk/-/chalk-2.4.1.tgz", + "integrity": "sha512-ObN6h1v2fTJSmUXoS3nMQ92LbDK9be4TV+6G+omQlGJFdcUX5heKi1LZ1YnRMIgwTLEj3E24bT6tYni50rlCfQ==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + } + }, + "has-flag": { + "version": "3.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", + "dev": true + }, + "supports-color": { + "version": "5.5.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } + } + } + }, + "log-update": { + "version": "1.0.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/log-update/-/log-update-1.0.2.tgz", + "integrity": "sha1-GZKfZMQJPS0ucHWh2tivWcKWuNE=", + "dev": true, + "requires": { + "ansi-escapes": "^1.0.0", + "cli-cursor": "^1.0.2" + }, + "dependencies": { + "ansi-escapes": { + "version": "1.4.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/ansi-escapes/-/ansi-escapes-1.4.0.tgz", + "integrity": "sha1-06ioOzGapneTZisT52HHkRQiMG4=", + "dev": true + }, + "cli-cursor": { + "version": "1.0.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/cli-cursor/-/cli-cursor-1.0.2.tgz", + "integrity": "sha1-ZNo/fValRBLll5S9Ytw1KV6PKYc=", + "dev": true, + "requires": { + "restore-cursor": "^1.0.1" + } + }, + "onetime": { + "version": "1.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/onetime/-/onetime-1.1.0.tgz", + "integrity": "sha1-ofeDj4MUxRbwXs78vEzP4EtO14k=", + "dev": true + }, + "restore-cursor": { + "version": "1.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/restore-cursor/-/restore-cursor-1.0.1.tgz", + "integrity": "sha1-NGYfRohjJ/7SmRR5FSJS35LapUE=", + "dev": true, + "requires": { + "exit-hook": "^1.0.0", + "onetime": "^1.0.0" + } + } + } + }, + "logform": { + "version": "1.10.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/logform/-/logform-1.10.0.tgz", + "integrity": "sha512-em5ojIhU18fIMOw/333mD+ZLE2fis0EzXl1ZwHx4iQzmpQi6odNiY/t+ITNr33JZhT9/KEaH+UPIipr6a9EjWg==", + "dev": true, + "requires": { + "colors": "^1.2.1", + "fast-safe-stringify": "^2.0.4", + "fecha": "^2.3.3", + "ms": "^2.1.1", + "triple-beam": "^1.2.0" + }, + "dependencies": { + "colors": { + "version": "1.3.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/colors/-/colors-1.3.2.tgz", + "integrity": "sha512-rhP0JSBGYvpcNQj4s5AdShMeE5ahMop96cTeDl/v9qQQm2fYClE2QXZRi8wLzc+GmXSxdIqqbOIAhyObEXDbfQ==", + "dev": true + }, + "ms": { + "version": "2.1.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/ms/-/ms-2.1.1.tgz", + "integrity": "sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg==", + "dev": true + } + } + }, + "loglevel": { + "version": "1.6.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/loglevel/-/loglevel-1.6.1.tgz", + "integrity": "sha1-4PyVEztu8nbNyIh82vJKpvFW+Po=", + "dev": true + }, + "loglevelnext": { + "version": "1.0.5", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/loglevelnext/-/loglevelnext-1.0.5.tgz", + "integrity": "sha512-V/73qkPuJmx4BcBF19xPBr+0ZRVBhc4POxvZTZdMeXpJ4NItXSJ/MSwuFT0kQJlCbXvdlZoQQ/418bS1y9Jh6A==", + "dev": true, + "requires": { + "es6-symbol": "^3.1.1", + "object.assign": "^4.1.0" + } + }, + "long": { + "version": "3.2.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/long/-/long-3.2.0.tgz", + "integrity": "sha1-2CG3E4yhy1gcFymQ7xTbIAtcR0s=", + "dev": true + }, + "longest": { + "version": "1.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/longest/-/longest-1.0.1.tgz", + "integrity": "sha1-MKCy2jj3N3DoKUoNIuZiXtd9AJc=", + "dev": true + }, + "loose-envify": { + "version": "1.3.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/loose-envify/-/loose-envify-1.3.1.tgz", + "integrity": "sha1-0aitM/qc4OcT1l/dCsi3SNR4yEg=", + "dev": true, + "requires": { + "js-tokens": "^3.0.0" + } + }, + "loud-rejection": { + "version": "1.6.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/loud-rejection/-/loud-rejection-1.6.0.tgz", + "integrity": "sha1-W0b4AUft7leIcPCG0Eghz5mOVR8=", + "dev": true, + "requires": { + "currently-unhandled": "^0.4.1", + "signal-exit": "^3.0.0" + } + }, + "lower-case": { + "version": "1.1.4", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/lower-case/-/lower-case-1.1.4.tgz", + "integrity": "sha1-miyr0bno4K6ZOkv31YdcOcQujqw=", + "dev": true + }, + "lowercase-keys": { + "version": "1.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/lowercase-keys/-/lowercase-keys-1.0.1.tgz", + "integrity": "sha512-G2Lj61tXDnVFFOi8VZds+SoQjtQC3dgokKdDG2mTm1tx4m50NUHBOZSBwQQHyy0V12A0JTG4icfZQH+xPyh8VA==", + "dev": true + }, + "lru-cache": { + "version": "4.1.3", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/lru-cache/-/lru-cache-4.1.3.tgz", + "integrity": "sha512-fFEhvcgzuIoJVUF8fYr5KR0YqxD238zgObTps31YdADwPPAp82a4M8TrckkWyx7ekNlf9aBcVn81cFwwXngrJA==", + "dev": true, + "requires": { + "pseudomap": "^1.0.2", + "yallist": "^2.1.2" + } + }, + "macaddress": { + "version": "0.2.8", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/macaddress/-/macaddress-0.2.8.tgz", + "integrity": "sha1-WQTcU3w57G2+/q6QIycTX6hRHxI=", + "dev": true + }, + "macos-release": { + "version": "1.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/macos-release/-/macos-release-1.1.0.tgz", + "integrity": "sha512-mmLbumEYMi5nXReB9js3WGsB8UE6cDBWyIO62Z4DNx6GbRhDxHNjA1MlzSpJ2S2KM1wyiPRA0d19uHWYYvMHjA==", + "dev": true + }, + "make-dir": { + "version": "1.3.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/make-dir/-/make-dir-1.3.0.tgz", + "integrity": "sha512-2w31R7SJtieJJnQtGc7RVL2StM2vGYVfqUOvUDxH6bC6aJTxPxTF0GnIgCyu7tjockiUWAYQRbxa7vKn34s5sQ==", + "dev": true, + "requires": { + "pify": "^3.0.0" + }, + "dependencies": { + "pify": { + "version": "3.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/pify/-/pify-3.0.0.tgz", + "integrity": "sha1-5aSs0sEB/fPZpNB/DbxNtJ3SgXY=", + "dev": true + } + } + }, + "makeerror": { + "version": "1.0.11", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/makeerror/-/makeerror-1.0.11.tgz", + "integrity": "sha1-4BpckQnyr3lmDk6LlYd5AYT1qWw=", + "dev": true, + "requires": { + "tmpl": "1.0.x" + } + }, + "map-cache": { + "version": "0.2.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/map-cache/-/map-cache-0.2.2.tgz", + "integrity": "sha1-wyq9C9ZSXZsFFkW7TyasXcmKDb8=", + "dev": true + }, + "map-obj": { + "version": "2.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/map-obj/-/map-obj-2.0.0.tgz", + "integrity": "sha1-plzSkIepJZi4eRJXpSPgISIqwfk=", + "dev": true + }, + "map-visit": { + "version": "1.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/map-visit/-/map-visit-1.0.0.tgz", + "integrity": "sha1-7Nyo8TFE5mDxtb1B8S80edmN+48=", + "dev": true, + "requires": { + "object-visit": "^1.0.0" + } + }, + "math-expression-evaluator": { + "version": "1.2.17", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/math-expression-evaluator/-/math-expression-evaluator-1.2.17.tgz", + "integrity": "sha1-3oGf282E3M2PrlnGrreWFbnSZqw=", + "dev": true + }, + "math-random": { + "version": "1.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/math-random/-/math-random-1.0.1.tgz", + "integrity": "sha1-izqsWIuKZuSXXjzepn97sylgH6w=", + "dev": true + }, + "md5.js": { + "version": "1.3.4", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/md5.js/-/md5.js-1.3.4.tgz", + "integrity": "sha1-6b296UogpawYsENA/Fdk1bCdkB0=", + "dev": true, + "requires": { + "hash-base": "^3.0.0", + "inherits": "^2.0.1" + } + }, + "mdn-data": { + "version": "1.2.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/mdn-data/-/mdn-data-1.2.0.tgz", + "integrity": "sha512-esDqNvsJB2q5V28+u7NdtdMg6Rmg4khQmAVSjUiX7BY/7haIv0K2yWM43hYp0or+3nvG7+UaTF1JHz31hgU1TA==", + "dev": true + }, + "media-typer": { + "version": "0.3.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/media-typer/-/media-typer-0.3.0.tgz", + "integrity": "sha1-hxDXrwqmJvj/+hzgAWhUUmMlV0g=", + "dev": true + }, + "mem": { + "version": "1.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/mem/-/mem-1.1.0.tgz", + "integrity": "sha1-Xt1StIXKHZAP5kiVUFOZoN+kX3Y=", + "dev": true, + "requires": { + "mimic-fn": "^1.0.0" + } + }, + "mem-fs": { + "version": "1.1.3", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/mem-fs/-/mem-fs-1.1.3.tgz", + "integrity": "sha1-uK6NLj/Lb10/kWXBLUVRoGXZicw=", + "dev": true, + "requires": { + "through2": "^2.0.0", + "vinyl": "^1.1.0", + "vinyl-file": "^2.0.0" + } + }, + "mem-fs-editor": { + "version": "5.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/mem-fs-editor/-/mem-fs-editor-5.1.0.tgz", + "integrity": "sha512-2Yt2GCYEbcotYbIJagmow4gEtHDqzpq5XN94+yAx/NT5+bGqIjkXnm3KCUQfE6kRfScGp9IZknScoGRKu8L78w==", + "dev": true, + "requires": { + "commondir": "^1.0.1", + "deep-extend": "^0.6.0", + "ejs": "^2.5.9", + "glob": "^7.0.3", + "globby": "^8.0.1", + "isbinaryfile": "^3.0.2", + "mkdirp": "^0.5.0", + "multimatch": "^2.0.0", + "rimraf": "^2.2.8", + "through2": "^2.0.0", + "vinyl": "^2.0.1" + }, + "dependencies": { + "clone": { + "version": "2.1.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/clone/-/clone-2.1.2.tgz", + "integrity": "sha1-G39Ln1kfHo+DZwQBYANFoCiHQ18=", + "dev": true + }, + "clone-stats": { + "version": "1.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/clone-stats/-/clone-stats-1.0.0.tgz", + "integrity": "sha1-s3gt/4u1R04Yuba/D9/ngvh3doA=", + "dev": true + }, + "globby": { + "version": "8.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/globby/-/globby-8.0.1.tgz", + "integrity": "sha512-oMrYrJERnKBLXNLVTqhm3vPEdJ/b2ZE28xN4YARiix1NOIOBPEpOUnm844K1iu/BkphCaf2WNFwMszv8Soi1pw==", + "dev": true, + "requires": { + "array-union": "^1.0.1", + "dir-glob": "^2.0.0", + "fast-glob": "^2.0.2", + "glob": "^7.1.2", + "ignore": "^3.3.5", + "pify": "^3.0.0", + "slash": "^1.0.0" + } + }, + "pify": { + "version": "3.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/pify/-/pify-3.0.0.tgz", + "integrity": "sha1-5aSs0sEB/fPZpNB/DbxNtJ3SgXY=", + "dev": true + }, + "replace-ext": { + "version": "1.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/replace-ext/-/replace-ext-1.0.0.tgz", + "integrity": "sha1-3mMSg3P8v3w8z6TeWkgMRaZ5WOs=", + "dev": true + }, + "vinyl": { + "version": "2.2.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/vinyl/-/vinyl-2.2.0.tgz", + "integrity": "sha512-MBH+yP0kC/GQ5GwBqrTPTzEfiiLjta7hTtvQtbxBgTeSXsmKQRQecjibMbxIXzVT3Y9KJK+drOz1/k+vsu8Nkg==", + "dev": true, + "requires": { + "clone": "^2.1.1", + "clone-buffer": "^1.0.0", + "clone-stats": "^1.0.0", + "cloneable-readable": "^1.0.0", + "remove-trailing-separator": "^1.0.1", + "replace-ext": "^1.0.0" + } + } + } + }, + "memory-fs": { + "version": "0.4.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/memory-fs/-/memory-fs-0.4.1.tgz", + "integrity": "sha1-OpoguEYlI+RHz7x+i7gO1me/xVI=", + "dev": true, + "requires": { + "errno": "^0.1.3", + "readable-stream": "^2.0.1" + } + }, + "meow": { + "version": "5.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/meow/-/meow-5.0.0.tgz", + "integrity": "sha512-CbTqYU17ABaLefO8vCU153ZZlprKYWDljcndKKDCFcYQITzWCXZAVk4QMFZPgvzrnUQ3uItnIE/LoUOwrT15Ig==", + "dev": true, + "requires": { + "camelcase-keys": "^4.0.0", + "decamelize-keys": "^1.0.0", + "loud-rejection": "^1.0.0", + "minimist-options": "^3.0.1", + "normalize-package-data": "^2.3.4", + "read-pkg-up": "^3.0.0", + "redent": "^2.0.0", + "trim-newlines": "^2.0.0", + "yargs-parser": "^10.0.0" + }, + "dependencies": { + "find-up": { + "version": "2.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/find-up/-/find-up-2.1.0.tgz", + "integrity": "sha1-RdG35QbHF93UgndaK3eSCjwMV6c=", + "dev": true, + "requires": { + "locate-path": "^2.0.0" + } + }, + "load-json-file": { + "version": "4.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/load-json-file/-/load-json-file-4.0.0.tgz", + "integrity": "sha1-L19Fq5HjMhYjT9U62rZo607AmTs=", + "dev": true, + "requires": { + "graceful-fs": "^4.1.2", + "parse-json": "^4.0.0", + "pify": "^3.0.0", + "strip-bom": "^3.0.0" + } + }, + "parse-json": { + "version": "4.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/parse-json/-/parse-json-4.0.0.tgz", + "integrity": "sha1-vjX1Qlvh9/bHRxhPmKeIy5lHfuA=", + "dev": true, + "requires": { + "error-ex": "^1.3.1", + "json-parse-better-errors": "^1.0.1" + } + }, + "path-type": { + "version": "3.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/path-type/-/path-type-3.0.0.tgz", + "integrity": "sha512-T2ZUsdZFHgA3u4e5PfPbjd7HDDpxPnQb5jN0SrDsjNSuVXHJqtwTnWqG0B1jZrgmJ/7lj1EmVIByWt1gxGkWvg==", + "dev": true, + "requires": { + "pify": "^3.0.0" + } + }, + "pify": { + "version": "3.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/pify/-/pify-3.0.0.tgz", + "integrity": "sha1-5aSs0sEB/fPZpNB/DbxNtJ3SgXY=", + "dev": true + }, + "read-pkg": { + "version": "3.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/read-pkg/-/read-pkg-3.0.0.tgz", + "integrity": "sha1-nLxoaXj+5l0WwA4rGcI3/Pbjg4k=", + "dev": true, + "requires": { + "load-json-file": "^4.0.0", + "normalize-package-data": "^2.3.2", + "path-type": "^3.0.0" + } + }, + "read-pkg-up": { + "version": "3.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/read-pkg-up/-/read-pkg-up-3.0.0.tgz", + "integrity": "sha1-PtSWaF26D4/hGNBpHcUfSh/5bwc=", + "dev": true, + "requires": { + "find-up": "^2.0.0", + "read-pkg": "^3.0.0" + } + }, + "strip-bom": { + "version": "3.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/strip-bom/-/strip-bom-3.0.0.tgz", + "integrity": "sha1-IzTBjpx1n3vdVv3vfprj1YjmjtM=", + "dev": true + } + } + }, + "merge": { + "version": "1.2.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/merge/-/merge-1.2.0.tgz", + "integrity": "sha1-dTHjnUlJwoGma4xabgJl6LBYlNo=", + "dev": true + }, + "merge-descriptors": { + "version": "1.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/merge-descriptors/-/merge-descriptors-1.0.1.tgz", + "integrity": "sha1-sAqqVW3YtEVoFQ7J0blT8/kMu2E=", + "dev": true + }, + "merge-jsons-webpack-plugin": { + "version": "1.0.14", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/merge-jsons-webpack-plugin/-/merge-jsons-webpack-plugin-1.0.14.tgz", + "integrity": "sha1-VA56m+2uQbz5MRscg0WgpjD2UYk=", + "dev": true, + "requires": { + "es6-promise": "4.0.5", + "glob": "7.1.1", + "json-loader": "0.5.4" + }, + "dependencies": { + "glob": { + "version": "7.1.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/glob/-/glob-7.1.1.tgz", + "integrity": "sha1-gFIR3wT6rxxjo2ADBs31reULLsg=", + "dev": true, + "requires": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.2", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + } + } + } + }, + "merge-stream": { + "version": "1.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/merge-stream/-/merge-stream-1.0.1.tgz", + "integrity": "sha1-QEEgLVCKNCugAXQAjfDCUbjBNeE=", + "dev": true, + "requires": { + "readable-stream": "^2.0.1" + } + }, + "merge2": { + "version": "1.2.3", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/merge2/-/merge2-1.2.3.tgz", + "integrity": "sha512-gdUU1Fwj5ep4kplwcmftruWofEFt6lfpkkr3h860CXbAB9c3hGb55EOL2ali0Td5oebvW0E1+3Sr+Ur7XfKpRA==", + "dev": true + }, + "methods": { + "version": "1.1.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/methods/-/methods-1.1.2.tgz", + "integrity": "sha1-VSmk1nZUE07cxSZmVoNbD4Ua/O4=", + "dev": true + }, + "micromatch": { + "version": "3.1.10", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/micromatch/-/micromatch-3.1.10.tgz", + "integrity": "sha512-MWikgl9n9M3w+bpsY3He8L+w9eF9338xRl8IAO5viDizwSzziFEyUzo2xrrloB64ADbTf8uA8vRqqttDTOmccg==", + "dev": true, + "requires": { + "arr-diff": "^4.0.0", + "array-unique": "^0.3.2", + "braces": "^2.3.1", + "define-property": "^2.0.2", + "extend-shallow": "^3.0.2", + "extglob": "^2.0.4", + "fragment-cache": "^0.2.1", + "kind-of": "^6.0.2", + "nanomatch": "^1.2.9", + "object.pick": "^1.3.0", + "regex-not": "^1.0.0", + "snapdragon": "^0.8.1", + "to-regex": "^3.0.2" + } + }, + "miller-rabin": { + "version": "4.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/miller-rabin/-/miller-rabin-4.0.1.tgz", + "integrity": "sha512-115fLhvZVqWwHPbClyntxEVfVDfl9DLLTuJvq3g2O/Oxi8AiNouAHvDSzHS0viUJc+V5vm3eq91Xwqn9dp4jRA==", + "dev": true, + "requires": { + "bn.js": "^4.0.0", + "brorand": "^1.0.1" + } + }, + "mime": { + "version": "1.4.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/mime/-/mime-1.4.1.tgz", + "integrity": "sha512-KI1+qOZu5DcW6wayYHSzR/tXKCDC5Om4s1z2QJjDULzLcmf3DvzS7oluY4HCTrc+9FiKmWUgeNLg7W3uIQvxtQ==", + "dev": true + }, + "mime-db": { + "version": "1.36.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/mime-db/-/mime-db-1.36.0.tgz", + "integrity": "sha512-L+xvyD9MkoYMXb1jAmzI/lWYAxAMCPvIBSWur0PZ5nOf5euahRLVqH//FKW9mWp2lkqUgYiXPgkzfMUFi4zVDw==", + "dev": true + }, + "mime-types": { + "version": "2.1.20", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/mime-types/-/mime-types-2.1.20.tgz", + "integrity": "sha512-HrkrPaP9vGuWbLK1B1FfgAkbqNjIuy4eHlIYnFi7kamZyLLrGlo2mpcx0bBmNpKqBtYtAfGbodDddIgddSJC2A==", + "dev": true, + "requires": { + "mime-db": "~1.36.0" + } + }, + "mimic-fn": { + "version": "1.2.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/mimic-fn/-/mimic-fn-1.2.0.tgz", + "integrity": "sha512-jf84uxzwiuiIVKiOLpfYk7N46TSy8ubTonmneY9vrpHNAnp0QBt2BxWV9dO3/j+BoVAb+a5G6YDPW3M5HOdMWQ==", + "dev": true + }, + "mimic-response": { + "version": "1.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/mimic-response/-/mimic-response-1.0.1.tgz", + "integrity": "sha512-j5EctnkH7amfV/q5Hgmoal1g2QHFJRraOtmx0JpIqkxhBhI/lJSl1nMpQ45hVarwNETOoWEimndZ4QK0RHxuxQ==", + "dev": true + }, + "mini-css-extract-plugin": { + "version": "0.4.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/mini-css-extract-plugin/-/mini-css-extract-plugin-0.4.2.tgz", + "integrity": "sha512-ots7URQH4wccfJq9Ssrzu2+qupbncAce4TmTzunI9CIwlQMp2XI+WNUw6xWF6MMAGAm1cbUVINrSjATaVMyKXg==", + "dev": true, + "requires": { + "loader-utils": "^1.1.0", + "schema-utils": "^1.0.0", + "webpack-sources": "^1.1.0" + }, + "dependencies": { + "schema-utils": { + "version": "1.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/schema-utils/-/schema-utils-1.0.0.tgz", + "integrity": "sha512-i27Mic4KovM/lnGsy8whRCHhc7VicJajAjTrYg11K9zfZXnYIt4k5F+kZkwjnrhKzLic/HLU4j11mjsz2G/75g==", + "dev": true, + "requires": { + "ajv": "^6.1.0", + "ajv-errors": "^1.0.0", + "ajv-keywords": "^3.1.0" + } + } + } + }, + "minimalistic-assert": { + "version": "1.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz", + "integrity": "sha512-UtJcAD4yEaGtjPezWuO9wC4nwUnVH/8/Im3yEHQP4b67cXlD/Qr9hdITCU1xDbSEXg2XKNaP8jsReV7vQd00/A==", + "dev": true + }, + "minimalistic-crypto-utils": { + "version": "1.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/minimalistic-crypto-utils/-/minimalistic-crypto-utils-1.0.1.tgz", + "integrity": "sha1-9sAMHAsIIkblxNmd+4x8CDsrWCo=", + "dev": true + }, + "minimatch": { + "version": "3.0.4", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/minimatch/-/minimatch-3.0.4.tgz", + "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", + "dev": true, + "requires": { + "brace-expansion": "^1.1.7" + } + }, + "minimist": { + "version": "1.2.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/minimist/-/minimist-1.2.0.tgz", + "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=", + "dev": true + }, + "minimist-options": { + "version": "3.0.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/minimist-options/-/minimist-options-3.0.2.tgz", + "integrity": "sha512-FyBrT/d0d4+uiZRbqznPXqw3IpZZG3gl3wKWiX784FycUKVwBt0uLBFkQrtE4tZOrgo78nZp2jnKz3L65T5LdQ==", + "dev": true, + "requires": { + "arrify": "^1.0.1", + "is-plain-obj": "^1.1.0" + } + }, + "mississippi": { + "version": "2.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/mississippi/-/mississippi-2.0.0.tgz", + "integrity": "sha512-zHo8v+otD1J10j/tC+VNoGK9keCuByhKovAvdn74dmxJl9+mWHnx6EMsDN4lgRoMI/eYo2nchAxniIbUPb5onw==", + "dev": true, + "requires": { + "concat-stream": "^1.5.0", + "duplexify": "^3.4.2", + "end-of-stream": "^1.1.0", + "flush-write-stream": "^1.0.0", + "from2": "^2.1.0", + "parallel-transform": "^1.1.0", + "pump": "^2.0.1", + "pumpify": "^1.3.3", + "stream-each": "^1.1.0", + "through2": "^2.0.0" + } + }, + "mixin-deep": { + "version": "1.3.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/mixin-deep/-/mixin-deep-1.3.1.tgz", + "integrity": "sha512-8ZItLHeEgaqEvd5lYBXfm4EZSFCX29Jb9K+lAHhDKzReKBQKj3R+7NOF6tjqYi9t4oI8VUfaWITJQm86wnXGNQ==", + "dev": true, + "requires": { + "for-in": "^1.0.2", + "is-extendable": "^1.0.1" + }, + "dependencies": { + "is-extendable": { + "version": "1.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/is-extendable/-/is-extendable-1.0.1.tgz", + "integrity": "sha512-arnXMxT1hhoKo9k1LZdmlNyJdDDfy2v0fXjFlmok4+i8ul/6WlbVge9bhM74OpNPQPMGUToDtz+KXa1PneJxOA==", + "dev": true, + "requires": { + "is-plain-object": "^2.0.4" + } + } + } + }, + "mixin-object": { + "version": "2.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/mixin-object/-/mixin-object-2.0.1.tgz", + "integrity": "sha1-T7lJRB2rGCVA8f4DW6YOGUel5X4=", + "dev": true, + "requires": { + "for-in": "^0.1.3", + "is-extendable": "^0.1.1" + }, + "dependencies": { + "for-in": { + "version": "0.1.8", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/for-in/-/for-in-0.1.8.tgz", + "integrity": "sha1-2Hc5COMSVhCZUrH9ubP6hn0ndeE=", + "dev": true + } + } + }, + "mkdirp": { + "version": "0.5.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/mkdirp/-/mkdirp-0.5.1.tgz", + "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", + "dev": true, + "requires": { + "minimist": "0.0.8" + }, + "dependencies": { + "minimist": { + "version": "0.0.8", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/minimist/-/minimist-0.0.8.tgz", + "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=", + "dev": true + } + } + }, + "moment": { + "version": "2.22.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/moment/-/moment-2.22.2.tgz", + "integrity": "sha1-PCV/mDn8DpP/UxSWMiOeuQeD/2Y=" + }, + "moment-locales-webpack-plugin": { + "version": "1.0.5", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/moment-locales-webpack-plugin/-/moment-locales-webpack-plugin-1.0.5.tgz", + "integrity": "sha512-33jWmbPQmIFLzHV+lQ2o5pPSDjc8C7tgRcIhiYPsXwq+X/8W5MEqBIcUQuaS4je0VRZb2tO1gl9C7NBeUKnonQ==", + "dev": true, + "requires": { + "lodash.difference": "^4.5.0" + } + }, + "move-concurrently": { + "version": "1.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/move-concurrently/-/move-concurrently-1.0.1.tgz", + "integrity": "sha1-viwAX9oy4LKa8fBdfEszIUxwH5I=", + "dev": true, + "requires": { + "aproba": "^1.1.1", + "copy-concurrently": "^1.0.0", + "fs-write-stream-atomic": "^1.0.8", + "mkdirp": "^0.5.1", + "rimraf": "^2.5.4", + "run-queue": "^1.0.3" + } + }, + "ms": { + "version": "2.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/ms/-/ms-2.0.0.tgz", + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", + "dev": true + }, + "multicast-dns": { + "version": "6.2.3", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/multicast-dns/-/multicast-dns-6.2.3.tgz", + "integrity": "sha512-ji6J5enbMyGRHIAkAOu3WdV8nggqviKCEKtXcOqfphZZtQrmHKycfynJ2V7eVPUA4NhJ6V7Wf4TmGbTwKE9B6g==", + "dev": true, + "requires": { + "dns-packet": "^1.3.1", + "thunky": "^1.0.2" + } + }, + "multicast-dns-service-types": { + "version": "1.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/multicast-dns-service-types/-/multicast-dns-service-types-1.1.0.tgz", + "integrity": "sha1-iZ8R2WhuXgXLkbNdXw5jt3PPyQE=", + "dev": true + }, + "multimatch": { + "version": "2.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/multimatch/-/multimatch-2.1.0.tgz", + "integrity": "sha1-nHkGoi+0wCkZ4vX3UWG0zb1LKis=", + "dev": true, + "requires": { + "array-differ": "^1.0.0", + "array-union": "^1.0.1", + "arrify": "^1.0.0", + "minimatch": "^3.0.0" + } + }, + "mute-stream": { + "version": "0.0.7", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/mute-stream/-/mute-stream-0.0.7.tgz", + "integrity": "sha1-MHXOk7whuPq0PhvE2n6BFe0ee6s=", + "dev": true + }, + "nan": { + "version": "2.10.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/nan/-/nan-2.10.0.tgz", + "integrity": "sha512-bAdJv7fBLhWC+/Bls0Oza+mvTaNQtP+1RyhhhvD95pgUJz6XM5IzgmxOkItJ9tkoCiplvAnXI1tNmmUD/eScyA==", + "dev": true, + "optional": true + }, + "nanomatch": { + "version": "1.2.13", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/nanomatch/-/nanomatch-1.2.13.tgz", + "integrity": "sha512-fpoe2T0RbHwBTBUOftAfBPaDEi06ufaUai0mE6Yn1kacc3SnTErfb/h+X94VXzI64rKFHYImXSvdwGGCmwOqCA==", + "dev": true, + "requires": { + "arr-diff": "^4.0.0", + "array-unique": "^0.3.2", + "define-property": "^2.0.2", + "extend-shallow": "^3.0.2", + "fragment-cache": "^0.2.1", + "is-windows": "^1.0.2", + "kind-of": "^6.0.2", + "object.pick": "^1.3.0", + "regex-not": "^1.0.0", + "snapdragon": "^0.8.1", + "to-regex": "^3.0.1" + } + }, + "natural-compare": { + "version": "1.4.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/natural-compare/-/natural-compare-1.4.0.tgz", + "integrity": "sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc=", + "dev": true + }, + "negotiator": { + "version": "0.6.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/negotiator/-/negotiator-0.6.1.tgz", + "integrity": "sha1-KzJxhOiZIQEXeyhWP7XnECrNDKk=", + "dev": true + }, + "neo-async": { + "version": "2.5.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/neo-async/-/neo-async-2.5.1.tgz", + "integrity": "sha512-3KL3fvuRkZ7s4IFOMfztb7zJp3QaVWnBeGoJlgB38XnCRPj/0tLzzLG5IB8NYOHbJ8g8UGrgZv44GLDk6CxTxA==", + "dev": true + }, + "next-tick": { + "version": "1.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/next-tick/-/next-tick-1.0.0.tgz", + "integrity": "sha1-yobR/ogoFpsBICCOPchCS524NCw=", + "dev": true + }, + "ng-jhipster": { + "version": "0.5.4", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/ng-jhipster/-/ng-jhipster-0.5.4.tgz", + "integrity": "sha512-1+rWT1p04anBWpN/BkYMnnFI6jXOqZjswYgZw2VjH2I79Giyg4bDLXFvaDbPawEUFc0p3W2r0OqdaLUcudOfrw==", + "requires": { + "@ngx-translate/core": "^10.0.1", + "@ngx-translate/http-loader": "^3.0.1" + } + }, + "ngx-cookie": { + "version": "2.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/ngx-cookie/-/ngx-cookie-2.0.1.tgz", + "integrity": "sha512-3+agXZkoPxRP3IyELf7Eiuhk6TX+EAX974kkCR6Xjm+N7boEA+Fin2Q90AAE4XZzY48skkVzLH96TOikb5yU3g==" + }, + "ngx-infinite-scroll": { + "version": "0.5.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/ngx-infinite-scroll/-/ngx-infinite-scroll-0.5.1.tgz", + "integrity": "sha1-3ZRSxgL/fDIi8MoWhIGqFBQChrc=" + }, + "ngx-webstorage": { + "version": "2.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/ngx-webstorage/-/ngx-webstorage-2.0.1.tgz", + "integrity": "sha512-AhBkl1v5sBLYiGC1DuHxM90B8OewqyhYhm+KGtJIFxMh5dj3tlNgPokmWCtKcUZF26m8MgxDDuP5e6NeDCpYQw==" + }, + "nice-try": { + "version": "1.0.5", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/nice-try/-/nice-try-1.0.5.tgz", + "integrity": "sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ==", + "dev": true + }, + "no-case": { + "version": "2.3.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/no-case/-/no-case-2.3.2.tgz", + "integrity": "sha512-rmTZ9kz+f3rCvK2TD1Ue/oZlns7OGoIWP4fc3llxxRXlOkHKoWPPWJOfFYpITabSow43QJbRIoHQXtt10VldyQ==", + "dev": true, + "requires": { + "lower-case": "^1.1.1" + } + }, + "node-dir": { + "version": "0.1.8", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/node-dir/-/node-dir-0.1.8.tgz", + "integrity": "sha1-VfuN62mQcHB/tn+RpGDwRIKUx30=", + "dev": true + }, + "node-forge": { + "version": "0.7.5", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/node-forge/-/node-forge-0.7.5.tgz", + "integrity": "sha512-MmbQJ2MTESTjt3Gi/3yG1wGpIMhUfcIypUCGtTizFR9IiccFwxSpfp0vtIZlkFclEqERemxfnSdZEMR9VqqEFQ==", + "dev": true + }, + "node-int64": { + "version": "0.4.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/node-int64/-/node-int64-0.4.0.tgz", + "integrity": "sha1-h6kGXNs1XTGC2PlM4RGIuCXGijs=", + "dev": true + }, + "node-libs-browser": { + "version": "2.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/node-libs-browser/-/node-libs-browser-2.1.0.tgz", + "integrity": "sha512-5AzFzdoIMb89hBGMZglEegffzgRg+ZFoUmisQ8HI4j1KDdpx13J0taNp2y9xPbur6W61gepGDDotGBVQ7mfUCg==", + "dev": true, + "requires": { + "assert": "^1.1.1", + "browserify-zlib": "^0.2.0", + "buffer": "^4.3.0", + "console-browserify": "^1.1.0", + "constants-browserify": "^1.0.0", + "crypto-browserify": "^3.11.0", + "domain-browser": "^1.1.1", + "events": "^1.0.0", + "https-browserify": "^1.0.0", + "os-browserify": "^0.3.0", + "path-browserify": "0.0.0", + "process": "^0.11.10", + "punycode": "^1.2.4", + "querystring-es3": "^0.2.0", + "readable-stream": "^2.3.3", + "stream-browserify": "^2.0.1", + "stream-http": "^2.7.2", + "string_decoder": "^1.0.0", + "timers-browserify": "^2.0.4", + "tty-browserify": "0.0.0", + "url": "^0.11.0", + "util": "^0.10.3", + "vm-browserify": "0.0.4" + }, + "dependencies": { + "punycode": { + "version": "1.4.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/punycode/-/punycode-1.4.1.tgz", + "integrity": "sha1-wNWmOycYgArY4esPpSachN1BhF4=", + "dev": true + } + } + }, + "node-notifier": { + "version": "5.2.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/node-notifier/-/node-notifier-5.2.1.tgz", + "integrity": "sha512-MIBs+AAd6dJ2SklbbE8RUDRlIVhU8MaNLh1A9SUZDUHPiZkWLFde6UNwG41yQHZEToHgJMXqyVZ9UcS/ReOVTg==", + "dev": true, + "requires": { + "growly": "^1.3.0", + "semver": "^5.4.1", + "shellwords": "^0.1.1", + "which": "^1.3.0" + } + }, + "node-releases": { + "version": "1.0.0-alpha.11", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/node-releases/-/node-releases-1.0.0-alpha.11.tgz", + "integrity": "sha512-CaViu+2FqTNYOYNihXa5uPS/zry92I3vPU4nCB6JB3OeZ2UGtOpF5gRwuN4+m3hbEcL47bOXyun1jX2iC+3uEQ==", + "dev": true, + "requires": { + "semver": "^5.3.0" + } + }, + "nomnom": { + "version": "1.8.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/nomnom/-/nomnom-1.8.1.tgz", + "integrity": "sha1-IVH3Ikcrp55Qp2/BJbuMjy5Nwqc=", + "dev": true, + "requires": { + "chalk": "~0.4.0", + "underscore": "~1.6.0" + }, + "dependencies": { + "ansi-styles": { + "version": "1.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/ansi-styles/-/ansi-styles-1.0.0.tgz", + "integrity": "sha1-yxAt8cVvUSPquLZ817mAJ6AnkXg=", + "dev": true + }, + "chalk": { + "version": "0.4.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/chalk/-/chalk-0.4.0.tgz", + "integrity": "sha1-UZmj3c0MHv4jvAjBsCewYXbgxk8=", + "dev": true, + "requires": { + "ansi-styles": "~1.0.0", + "has-color": "~0.1.0", + "strip-ansi": "~0.1.0" + } + }, + "strip-ansi": { + "version": "0.1.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/strip-ansi/-/strip-ansi-0.1.1.tgz", + "integrity": "sha1-OeipjQRNFQZgq+SmgIrPcLt7yZE=", + "dev": true + } + } + }, + "normalize-package-data": { + "version": "2.4.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/normalize-package-data/-/normalize-package-data-2.4.0.tgz", + "integrity": "sha512-9jjUFbTPfEy3R/ad/2oNbKtW9Hgovl5O1FvFWKkKblNXoN/Oou6+9+KKohPK13Yc3/TyunyWhJp6gvRNR/PPAw==", + "dev": true, + "requires": { + "hosted-git-info": "^2.1.4", + "is-builtin-module": "^1.0.0", + "semver": "2 || 3 || 4 || 5", + "validate-npm-package-license": "^3.0.1" + } + }, + "normalize-path": { + "version": "2.1.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/normalize-path/-/normalize-path-2.1.1.tgz", + "integrity": "sha1-GrKLVW4Zg2Oowab35vogE3/mrtk=", + "dev": true, + "requires": { + "remove-trailing-separator": "^1.0.1" + } + }, + "normalize-range": { + "version": "0.1.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/normalize-range/-/normalize-range-0.1.2.tgz", + "integrity": "sha1-LRDAa9/TEuqXd2laTShDlFa3WUI=", + "dev": true + }, + "normalize-url": { + "version": "1.9.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/normalize-url/-/normalize-url-1.9.1.tgz", + "integrity": "sha1-LMDWazHqIwNkWENuNiDYWVTGbDw=", + "dev": true, + "requires": { + "object-assign": "^4.0.1", + "prepend-http": "^1.0.0", + "query-string": "^4.1.0", + "sort-keys": "^1.0.0" + } + }, + "npm-package-arg": { + "version": "6.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/npm-package-arg/-/npm-package-arg-6.1.0.tgz", + "integrity": "sha512-zYbhP2k9DbJhA0Z3HKUePUgdB1x7MfIfKssC+WLPFMKTBZKpZh5m13PgexJjCq6KW7j17r0jHWcCpxEqnnncSA==", + "dev": true, + "requires": { + "hosted-git-info": "^2.6.0", + "osenv": "^0.1.5", + "semver": "^5.5.0", + "validate-npm-package-name": "^3.0.0" + } + }, + "npm-path": { + "version": "2.0.4", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/npm-path/-/npm-path-2.0.4.tgz", + "integrity": "sha512-IFsj0R9C7ZdR5cP+ET342q77uSRdtWOlWpih5eC+lu29tIDbNEgDbzgVJ5UFvYHWhxDZ5TFkJafFioO0pPQjCw==", + "dev": true, + "requires": { + "which": "^1.2.10" + } + }, + "npm-registry-client": { + "version": "8.5.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/npm-registry-client/-/npm-registry-client-8.5.1.tgz", + "integrity": "sha512-7rjGF2eA7hKDidGyEWmHTiKfXkbrcQAsGL/Rh4Rt3x3YNRNHhwaTzVJfW3aNvvlhg4G62VCluif0sLCb/i51Hg==", + "dev": true, + "requires": { + "concat-stream": "^1.5.2", + "graceful-fs": "^4.1.6", + "normalize-package-data": "~1.0.1 || ^2.0.0", + "npm-package-arg": "^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0", + "npmlog": "2 || ^3.1.0 || ^4.0.0", + "once": "^1.3.3", + "request": "^2.74.0", + "retry": "^0.10.0", + "safe-buffer": "^5.1.1", + "semver": "2 >=2.2.1 || 3.x || 4 || 5", + "slide": "^1.1.3", + "ssri": "^5.2.4" + } + }, + "npm-run-path": { + "version": "2.0.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/npm-run-path/-/npm-run-path-2.0.2.tgz", + "integrity": "sha1-NakjLfo11wZ7TLLd8jV7GHFTbF8=", + "dev": true, + "requires": { + "path-key": "^2.0.0" + } + }, + "npm-which": { + "version": "3.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/npm-which/-/npm-which-3.0.1.tgz", + "integrity": "sha1-kiXybsOihcIJyuZ8OxGmtKtxQKo=", + "dev": true, + "requires": { + "commander": "^2.9.0", + "npm-path": "^2.0.2", + "which": "^1.2.10" + } + }, + "npmlog": { + "version": "4.1.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/npmlog/-/npmlog-4.1.2.tgz", + "integrity": "sha512-2uUqazuKlTaSI/dC8AzicUck7+IrEaOnN/e0jd3Xtt1KcGpwx30v50mL7oPyr/h9bL3E4aZccVwpwP+5W9Vjkg==", + "dev": true, + "optional": true, + "requires": { + "are-we-there-yet": "~1.1.2", + "console-control-strings": "~1.1.0", + "gauge": "~2.7.3", + "set-blocking": "~2.0.0" + } + }, + "nth-check": { + "version": "1.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/nth-check/-/nth-check-1.0.1.tgz", + "integrity": "sha1-mSms32KPwsQQmN6rgqxYDPFJquQ=", + "dev": true, + "requires": { + "boolbase": "~1.0.0" + } + }, + "num2fraction": { + "version": "1.2.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/num2fraction/-/num2fraction-1.2.2.tgz", + "integrity": "sha1-b2gragJ6Tp3fpFZM0lidHU5mnt4=", + "dev": true + }, + "number-is-nan": { + "version": "1.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/number-is-nan/-/number-is-nan-1.0.1.tgz", + "integrity": "sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0=", + "dev": true + }, + "nwmatcher": { + "version": "1.4.4", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/nwmatcher/-/nwmatcher-1.4.4.tgz", + "integrity": "sha512-3iuY4N5dhgMpCUrOVnuAdGrgxVqV2cJpM+XNccjR2DKOB1RUP0aA+wGXEiNziG/UKboFyGBIoKOaNlJxx8bciQ==", + "dev": true + }, + "oauth-sign": { + "version": "0.9.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/oauth-sign/-/oauth-sign-0.9.0.tgz", + "integrity": "sha512-fexhUFFPTGV8ybAtSIGbV6gOkSv8UtRbDBnAyLQw4QPKkgNlsH2ByPGtMUqdWkos6YCRmAqViwgZrJc/mRDzZQ==", + "dev": true + }, + "object-assign": { + "version": "4.1.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/object-assign/-/object-assign-4.1.1.tgz", + "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=", + "dev": true + }, + "object-component": { + "version": "0.0.3", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/object-component/-/object-component-0.0.3.tgz", + "integrity": "sha1-8MaapQ78lbhmwYb0AKM3acsvEpE=", + "dev": true + }, + "object-copy": { + "version": "0.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/object-copy/-/object-copy-0.1.0.tgz", + "integrity": "sha1-fn2Fi3gb18mRpBupde04EnVOmYw=", + "dev": true, + "requires": { + "copy-descriptor": "^0.1.0", + "define-property": "^0.2.5", + "kind-of": "^3.0.3" + }, + "dependencies": { + "define-property": { + "version": "0.2.5", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/define-property/-/define-property-0.2.5.tgz", + "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", + "dev": true, + "requires": { + "is-descriptor": "^0.1.0" + } + }, + "kind-of": { + "version": "3.2.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true, + "requires": { + "is-buffer": "^1.1.5" + } + } + } + }, + "object-keys": { + "version": "1.0.12", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/object-keys/-/object-keys-1.0.12.tgz", + "integrity": "sha512-FTMyFUm2wBcGHnH2eXmz7tC6IwlqQZ6mVZ+6dm6vZ4IQIHjs6FdNsQBuKGPuUUUY6NfJw2PshC08Tn6LzLDOag==", + "dev": true + }, + "object-path": { + "version": "0.9.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/object-path/-/object-path-0.9.2.tgz", + "integrity": "sha1-D9mnT8X60a45aLWGvaXGMr1sBaU=", + "dev": true + }, + "object-visit": { + "version": "1.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/object-visit/-/object-visit-1.0.1.tgz", + "integrity": "sha1-95xEk68MU3e1n+OdOV5BBC3QRbs=", + "dev": true, + "requires": { + "isobject": "^3.0.0" + } + }, + "object.assign": { + "version": "4.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/object.assign/-/object.assign-4.1.0.tgz", + "integrity": "sha512-exHJeq6kBKj58mqGyTQ9DFvrZC/eR6OwxzoM9YRoGBqrXYonaFyGiFMuc9VZrXf7DarreEwMpurG3dd+CNyW5w==", + "dev": true, + "requires": { + "define-properties": "^1.1.2", + "function-bind": "^1.1.1", + "has-symbols": "^1.0.0", + "object-keys": "^1.0.11" + } + }, + "object.getownpropertydescriptors": { + "version": "2.0.3", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/object.getownpropertydescriptors/-/object.getownpropertydescriptors-2.0.3.tgz", + "integrity": "sha1-h1jIRvW0B62rDyNuCYbxSwUcqhY=", + "dev": true, + "requires": { + "define-properties": "^1.1.2", + "es-abstract": "^1.5.1" + } + }, + "object.omit": { + "version": "2.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/object.omit/-/object.omit-2.0.1.tgz", + "integrity": "sha1-Gpx0SCnznbuFjHbKNXmuKlTr0fo=", + "dev": true, + "requires": { + "for-own": "^0.1.4", + "is-extendable": "^0.1.1" + } + }, + "object.pick": { + "version": "1.3.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/object.pick/-/object.pick-1.3.0.tgz", + "integrity": "sha1-h6EKxMFpS9Lhy/U1kaZhQftd10c=", + "dev": true, + "requires": { + "isobject": "^3.0.1" + } + }, + "object.values": { + "version": "1.0.4", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/object.values/-/object.values-1.0.4.tgz", + "integrity": "sha1-5STaCbT2b/Bd9FdUbscqyZ8TBpo=", + "dev": true, + "requires": { + "define-properties": "^1.1.2", + "es-abstract": "^1.6.1", + "function-bind": "^1.1.0", + "has": "^1.0.1" + } + }, + "obuf": { + "version": "1.1.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/obuf/-/obuf-1.1.2.tgz", + "integrity": "sha512-PX1wu0AmAdPqOL1mWhqmlOd8kOIZQwGZw6rh7uby9fTc5lhaOWFLX3I6R1hrF9k3zUY40e6igsLGkDXK92LJNg==", + "dev": true + }, + "on-finished": { + "version": "2.3.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/on-finished/-/on-finished-2.3.0.tgz", + "integrity": "sha1-IPEzZIGwg811M3mSoWlxqi2QaUc=", + "dev": true, + "requires": { + "ee-first": "1.1.1" + } + }, + "on-headers": { + "version": "1.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/on-headers/-/on-headers-1.0.1.tgz", + "integrity": "sha1-ko9dD0cNSTQmUepnlLCFfBAGk/c=", + "dev": true + }, + "once": { + "version": "1.4.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/once/-/once-1.4.0.tgz", + "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", + "dev": true, + "requires": { + "wrappy": "1" + } + }, + "one-time": { + "version": "0.0.4", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/one-time/-/one-time-0.0.4.tgz", + "integrity": "sha1-+M33eISCb+Tf+T46nMN7HkSAdC4=", + "dev": true + }, + "onetime": { + "version": "2.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/onetime/-/onetime-2.0.1.tgz", + "integrity": "sha1-BnQoIw/WdEOyeUsiu6UotoZ5YtQ=", + "dev": true, + "requires": { + "mimic-fn": "^1.0.0" + } + }, + "openurl": { + "version": "1.1.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/openurl/-/openurl-1.1.1.tgz", + "integrity": "sha1-OHW0sO96UsFW8NtB1GCduw+Us4c=", + "dev": true + }, + "opn": { + "version": "5.4.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/opn/-/opn-5.4.0.tgz", + "integrity": "sha512-YF9MNdVy/0qvJvDtunAOzFw9iasOQHpVthTCvGzxt61Il64AYSGdK+rYwld7NAfk9qJ7dt+hymBNSc9LNYS+Sw==", + "dev": true, + "requires": { + "is-wsl": "^1.1.0" + } + }, + "optimist": { + "version": "0.6.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/optimist/-/optimist-0.6.1.tgz", + "integrity": "sha1-2j6nRob6IaGaERwybpDrFaAZZoY=", + "dev": true, + "requires": { + "minimist": "~0.0.1", + "wordwrap": "~0.0.2" + }, + "dependencies": { + "minimist": { + "version": "0.0.10", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/minimist/-/minimist-0.0.10.tgz", + "integrity": "sha1-3j+YVD2/lggr5IrRoMfNqDYwHc8=", + "dev": true + } + } + }, + "optimize-css-assets-webpack-plugin": { + "version": "5.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/optimize-css-assets-webpack-plugin/-/optimize-css-assets-webpack-plugin-5.0.1.tgz", + "integrity": "sha512-Rqm6sSjWtx9FchdP0uzTQDc7GXDKnwVEGoSxjezPkzMewx7gEWE9IMUYKmigTRC4U3RaNSwYVnUDLuIdtTpm0A==", + "dev": true, + "requires": { + "cssnano": "^4.1.0", + "last-call-webpack-plugin": "^3.0.0" + }, + "dependencies": { + "ansi-styles": { + "version": "3.2.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, + "requires": { + "color-convert": "^1.9.0" + } + }, + "chalk": { + "version": "2.4.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/chalk/-/chalk-2.4.1.tgz", + "integrity": "sha512-ObN6h1v2fTJSmUXoS3nMQ92LbDK9be4TV+6G+omQlGJFdcUX5heKi1LZ1YnRMIgwTLEj3E24bT6tYni50rlCfQ==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + } + }, + "cssnano": { + "version": "4.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/cssnano/-/cssnano-4.1.0.tgz", + "integrity": "sha512-7x24b/ghbrQv2QRgqMR12H3ZZ38xYCKJSXfg21YCtnIE177/NyvMkeiuQdWauIgMjySaTZ+cd5PN2qvfbsGeSw==", + "dev": true, + "requires": { + "cosmiconfig": "^5.0.0", + "cssnano-preset-default": "^4.0.0", + "is-resolvable": "^1.0.0", + "postcss": "^6.0.0" + } + }, + "has-flag": { + "version": "3.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", + "dev": true + }, + "postcss": { + "version": "6.0.23", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/postcss/-/postcss-6.0.23.tgz", + "integrity": "sha512-soOk1h6J3VMTZtVeVpv15/Hpdl2cBLX3CAw4TAbkpTJiNPk9YP/zWcD1ND+xEtvyuuvKzbxliTOIyvkSeSJ6ag==", + "dev": true, + "requires": { + "chalk": "^2.4.1", + "source-map": "^0.6.1", + "supports-color": "^5.4.0" + } + }, + "source-map": { + "version": "0.6.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "dev": true + }, + "supports-color": { + "version": "5.5.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } + } + } + }, + "optionator": { + "version": "0.8.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/optionator/-/optionator-0.8.2.tgz", + "integrity": "sha1-NkxeQJ0/TWMB1sC0wFu6UBgK62Q=", + "dev": true, + "requires": { + "deep-is": "~0.1.3", + "fast-levenshtein": "~2.0.4", + "levn": "~0.3.0", + "prelude-ls": "~1.1.2", + "type-check": "~0.3.2", + "wordwrap": "~1.0.0" + }, + "dependencies": { + "wordwrap": { + "version": "1.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/wordwrap/-/wordwrap-1.0.0.tgz", + "integrity": "sha1-J1hIEIkUVqQXHI0CJkQa3pDLyus=", + "dev": true + } + } + }, + "ora": { + "version": "0.2.3", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/ora/-/ora-0.2.3.tgz", + "integrity": "sha1-N1J9Igrc1Tw5tzVx11QVbV22V6Q=", + "dev": true, + "requires": { + "chalk": "^1.1.1", + "cli-cursor": "^1.0.2", + "cli-spinners": "^0.1.2", + "object-assign": "^4.0.1" + }, + "dependencies": { + "cli-cursor": { + "version": "1.0.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/cli-cursor/-/cli-cursor-1.0.2.tgz", + "integrity": "sha1-ZNo/fValRBLll5S9Ytw1KV6PKYc=", + "dev": true, + "requires": { + "restore-cursor": "^1.0.1" + } + }, + "onetime": { + "version": "1.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/onetime/-/onetime-1.1.0.tgz", + "integrity": "sha1-ofeDj4MUxRbwXs78vEzP4EtO14k=", + "dev": true + }, + "restore-cursor": { + "version": "1.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/restore-cursor/-/restore-cursor-1.0.1.tgz", + "integrity": "sha1-NGYfRohjJ/7SmRR5FSJS35LapUE=", + "dev": true, + "requires": { + "exit-hook": "^1.0.0", + "onetime": "^1.0.0" + } + } + } + }, + "original": { + "version": "1.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/original/-/original-1.0.1.tgz", + "integrity": "sha512-IEvtB5vM5ULvwnqMxWBLxkS13JIEXbakizMSo3yoPNPCIWzg8TG3Usn/UhXoZFM/m+FuEA20KdzPSFq/0rS+UA==", + "dev": true, + "requires": { + "url-parse": "~1.4.0" + } + }, + "os-browserify": { + "version": "0.3.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/os-browserify/-/os-browserify-0.3.0.tgz", + "integrity": "sha1-hUNzx/XCMVkU/Jv8a9gjj92h7Cc=", + "dev": true + }, + "os-homedir": { + "version": "1.0.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/os-homedir/-/os-homedir-1.0.2.tgz", + "integrity": "sha1-/7xJiDNuDoM94MFox+8VISGqf7M=", + "dev": true + }, + "os-locale": { + "version": "1.4.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/os-locale/-/os-locale-1.4.0.tgz", + "integrity": "sha1-IPnxeuKe00XoveWDsT0gCYA8FNk=", + "dev": true, + "requires": { + "lcid": "^1.0.0" + } + }, + "os-name": { + "version": "2.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/os-name/-/os-name-2.0.1.tgz", + "integrity": "sha1-uaOGNhwXrjohc27wWZQFyajF3F4=", + "dev": true, + "requires": { + "macos-release": "^1.0.0", + "win-release": "^1.0.0" + } + }, + "os-shim": { + "version": "0.1.3", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/os-shim/-/os-shim-0.1.3.tgz", + "integrity": "sha1-a2LDeRz3kJ6jXtRuF2WLtBfLORc=", + "dev": true + }, + "os-tmpdir": { + "version": "1.0.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/os-tmpdir/-/os-tmpdir-1.0.2.tgz", + "integrity": "sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ=", + "dev": true + }, + "osenv": { + "version": "0.1.5", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/osenv/-/osenv-0.1.5.tgz", + "integrity": "sha512-0CWcCECdMVc2Rw3U5w9ZjqX6ga6ubk1xDVKxtBQPK7wis/0F2r9T6k4ydGYhecl7YUBxBVxhL5oisPsNxAPe2g==", + "dev": true, + "requires": { + "os-homedir": "^1.0.0", + "os-tmpdir": "^1.0.0" + } + }, + "p-cancelable": { + "version": "0.3.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/p-cancelable/-/p-cancelable-0.3.0.tgz", + "integrity": "sha512-RVbZPLso8+jFeq1MfNvgXtCRED2raz/dKpacfTNxsx6pLEpEomM7gah6VeHSYV3+vo0OAi4MkArtQcWWXuQoyw==", + "dev": true + }, + "p-each-series": { + "version": "1.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/p-each-series/-/p-each-series-1.0.0.tgz", + "integrity": "sha1-kw89Et0fUOdDRFeiLNbwSsatf3E=", + "dev": true, + "requires": { + "p-reduce": "^1.0.0" + } + }, + "p-finally": { + "version": "1.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/p-finally/-/p-finally-1.0.0.tgz", + "integrity": "sha1-P7z7FbiZpEEjs0ttzBi3JDNqLK4=", + "dev": true + }, + "p-is-promise": { + "version": "1.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/p-is-promise/-/p-is-promise-1.1.0.tgz", + "integrity": "sha1-nJRWmJ6fZYgBewQ01WCXZ1w9oF4=", + "dev": true + }, + "p-lazy": { + "version": "1.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/p-lazy/-/p-lazy-1.0.0.tgz", + "integrity": "sha1-7FPIAvLuOsKPFmzILQsrAt4nqDU=", + "dev": true + }, + "p-limit": { + "version": "1.3.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/p-limit/-/p-limit-1.3.0.tgz", + "integrity": "sha512-vvcXsLAJ9Dr5rQOPk7toZQZJApBl2K4J6dANSsEuh6QI41JYcsS/qhTGa9ErIUUgK3WNQoJYvylxvjqmiqEA9Q==", + "dev": true, + "requires": { + "p-try": "^1.0.0" + } + }, + "p-locate": { + "version": "2.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/p-locate/-/p-locate-2.0.0.tgz", + "integrity": "sha1-IKAQOyIqcMj9OcwuWAaA893l7EM=", + "dev": true, + "requires": { + "p-limit": "^1.1.0" + } + }, + "p-map": { + "version": "1.2.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/p-map/-/p-map-1.2.0.tgz", + "integrity": "sha512-r6zKACMNhjPJMTl8KcFH4li//gkrXWfbD6feV8l6doRHlzljFWGJ2AP6iKaCJXyZmAUMOPtvbW7EXkbWO/pLEA==", + "dev": true + }, + "p-reduce": { + "version": "1.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/p-reduce/-/p-reduce-1.0.0.tgz", + "integrity": "sha1-GMKw3ZNqRpClKfgjH1ig/bakffo=", + "dev": true + }, + "p-timeout": { + "version": "1.2.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/p-timeout/-/p-timeout-1.2.1.tgz", + "integrity": "sha1-XrOzU7f86Z8QGhA4iAuwVOu+o4Y=", + "dev": true, + "requires": { + "p-finally": "^1.0.0" + } + }, + "p-try": { + "version": "1.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/p-try/-/p-try-1.0.0.tgz", + "integrity": "sha1-y8ec26+P1CKOE/Yh8rGiN8GyB7M=", + "dev": true + }, + "pako": { + "version": "1.0.6", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/pako/-/pako-1.0.6.tgz", + "integrity": "sha512-lQe48YPsMJAig+yngZ87Lus+NF+3mtu7DVOBu6b/gHO1YpKwIj5AWjZ/TOS7i46HD/UixzWb1zeWDZfGZ3iYcg==", + "dev": true + }, + "parallel-transform": { + "version": "1.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/parallel-transform/-/parallel-transform-1.1.0.tgz", + "integrity": "sha1-1BDwZbBdojCB/NEPKIVMKb2jOwY=", + "dev": true, + "requires": { + "cyclist": "~0.2.2", + "inherits": "^2.0.3", + "readable-stream": "^2.1.5" + } + }, + "param-case": { + "version": "2.1.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/param-case/-/param-case-2.1.1.tgz", + "integrity": "sha1-35T9jPZTHs915r75oIWPvHK+Ikc=", + "dev": true, + "requires": { + "no-case": "^2.2.0" + } + }, + "parse-asn1": { + "version": "5.1.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/parse-asn1/-/parse-asn1-5.1.1.tgz", + "integrity": "sha512-KPx7flKXg775zZpnp9SxJlz00gTd4BmJ2yJufSc44gMCRrRQ7NSzAcSJQfifuOLgW6bEi+ftrALtsgALeB2Adw==", + "dev": true, + "requires": { + "asn1.js": "^4.0.0", + "browserify-aes": "^1.0.0", + "create-hash": "^1.1.0", + "evp_bytestokey": "^1.0.0", + "pbkdf2": "^3.0.3" + } + }, + "parse-gitignore": { + "version": "1.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/parse-gitignore/-/parse-gitignore-1.0.1.tgz", + "integrity": "sha512-UGyowyjtx26n65kdAMWhm6/3uy5uSrpcuH7tt+QEVudiBoVS+eqHxD5kbi9oWVRwj7sCzXqwuM+rUGw7earl6A==", + "dev": true + }, + "parse-glob": { + "version": "3.0.4", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/parse-glob/-/parse-glob-3.0.4.tgz", + "integrity": "sha1-ssN2z7EfNVE7rdFz7wu246OIORw=", + "dev": true, + "requires": { + "glob-base": "^0.3.0", + "is-dotfile": "^1.0.0", + "is-extglob": "^1.0.0", + "is-glob": "^2.0.0" + }, + "dependencies": { + "is-extglob": { + "version": "1.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/is-extglob/-/is-extglob-1.0.0.tgz", + "integrity": "sha1-rEaBd8SUNAWgkvyPKXYMb/xiBsA=", + "dev": true + }, + "is-glob": { + "version": "2.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/is-glob/-/is-glob-2.0.1.tgz", + "integrity": "sha1-0Jb5JqPe1WAPP9/ZEZjLCIjC2GM=", + "dev": true, + "requires": { + "is-extglob": "^1.0.0" + } + } + } + }, + "parse-json": { + "version": "2.2.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/parse-json/-/parse-json-2.2.0.tgz", + "integrity": "sha1-9ID0BDTvgHQfhGkJn43qGPVaTck=", + "dev": true, + "requires": { + "error-ex": "^1.2.0" + } + }, + "parse-passwd": { + "version": "1.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/parse-passwd/-/parse-passwd-1.0.0.tgz", + "integrity": "sha1-bVuTSkVpk7I9N/QKOC1vFmao5cY=", + "dev": true + }, + "parse5": { + "version": "3.0.3", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/parse5/-/parse5-3.0.3.tgz", + "integrity": "sha512-rgO9Zg5LLLkfJF9E6CCmXlSE4UVceloys8JrFqCcHloC3usd/kJCyPDwH2SOlzix2j3xaP9sUX3e8+kvkuleAA==", + "dev": true, + "requires": { + "@types/node": "*" + } + }, + "parseqs": { + "version": "0.0.5", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/parseqs/-/parseqs-0.0.5.tgz", + "integrity": "sha1-1SCKNzjkZ2bikbouoXNoSSGouJ0=", + "dev": true, + "requires": { + "better-assert": "~1.0.0" + } + }, + "parseuri": { + "version": "0.0.5", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/parseuri/-/parseuri-0.0.5.tgz", + "integrity": "sha1-gCBKUNTbt3m/3G6+J3jZDkvOMgo=", + "dev": true, + "requires": { + "better-assert": "~1.0.0" + } + }, + "parseurl": { + "version": "1.3.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/parseurl/-/parseurl-1.3.2.tgz", + "integrity": "sha1-/CidTtiZMRlGDBViUyYs3I3mW/M=", + "dev": true + }, + "pascalcase": { + "version": "0.1.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/pascalcase/-/pascalcase-0.1.1.tgz", + "integrity": "sha1-s2PlXoAGym/iF4TS2yK9FdeRfxQ=", + "dev": true + }, + "path-browserify": { + "version": "0.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/path-browserify/-/path-browserify-0.0.0.tgz", + "integrity": "sha1-oLhwcpquIUAFt9UDLsLLuw+0RRo=", + "dev": true + }, + "path-dirname": { + "version": "1.0.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/path-dirname/-/path-dirname-1.0.2.tgz", + "integrity": "sha1-zDPSTVJeCZpTiMAzbG4yuRYGCeA=", + "dev": true + }, + "path-exists": { + "version": "2.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/path-exists/-/path-exists-2.1.0.tgz", + "integrity": "sha1-D+tsZPD8UY2adU3V77YscCJ2H0s=", + "dev": true, + "requires": { + "pinkie-promise": "^2.0.0" + } + }, + "path-is-absolute": { + "version": "1.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", + "dev": true + }, + "path-is-inside": { + "version": "1.0.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/path-is-inside/-/path-is-inside-1.0.2.tgz", + "integrity": "sha1-NlQX3t5EQw0cEa9hAn+s8HS9/FM=", + "dev": true + }, + "path-key": { + "version": "2.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/path-key/-/path-key-2.0.1.tgz", + "integrity": "sha1-QRyttXTFoUDTpLGRDUDYDMn0C0A=", + "dev": true + }, + "path-parse": { + "version": "1.0.6", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/path-parse/-/path-parse-1.0.6.tgz", + "integrity": "sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw==", + "dev": true + }, + "path-to-regexp": { + "version": "0.1.7", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/path-to-regexp/-/path-to-regexp-0.1.7.tgz", + "integrity": "sha1-32BBeABfUi8V60SQ5yR6G/qmf4w=", + "dev": true + }, + "path-type": { + "version": "1.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/path-type/-/path-type-1.1.0.tgz", + "integrity": "sha1-WcRPfuSR2nBNpBXaWkBwuk+P5EE=", + "dev": true, + "requires": { + "graceful-fs": "^4.1.2", + "pify": "^2.0.0", + "pinkie-promise": "^2.0.0" + } + }, + "pbkdf2": { + "version": "3.0.16", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/pbkdf2/-/pbkdf2-3.0.16.tgz", + "integrity": "sha512-y4CXP3thSxqf7c0qmOF+9UeOTrifiVTIM+u7NWlq+PRsHbr7r7dpCmvzrZxa96JJUNi0Y5w9VqG5ZNeCVMoDcA==", + "dev": true, + "requires": { + "create-hash": "^1.1.2", + "create-hmac": "^1.1.4", + "ripemd160": "^2.0.1", + "safe-buffer": "^5.0.1", + "sha.js": "^2.4.8" + } + }, + "performance-now": { + "version": "2.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/performance-now/-/performance-now-2.1.0.tgz", + "integrity": "sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns=", + "dev": true + }, + "pify": { + "version": "2.3.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/pify/-/pify-2.3.0.tgz", + "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=", + "dev": true + }, + "pinkie": { + "version": "2.0.4", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/pinkie/-/pinkie-2.0.4.tgz", + "integrity": "sha1-clVrgM+g1IqXToDnckjoDtT3+HA=", + "dev": true + }, + "pinkie-promise": { + "version": "2.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/pinkie-promise/-/pinkie-promise-2.0.1.tgz", + "integrity": "sha1-ITXW36ejWMBprJsXh3YogihFD/o=", + "dev": true, + "requires": { + "pinkie": "^2.0.0" + } + }, + "pkg-dir": { + "version": "2.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/pkg-dir/-/pkg-dir-2.0.0.tgz", + "integrity": "sha1-9tXREJ4Z1j7fQo4L1X4Sd3YVM0s=", + "dev": true, + "requires": { + "find-up": "^2.1.0" + }, + "dependencies": { + "find-up": { + "version": "2.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/find-up/-/find-up-2.1.0.tgz", + "integrity": "sha1-RdG35QbHF93UgndaK3eSCjwMV6c=", + "dev": true, + "requires": { + "locate-path": "^2.0.0" + } + } + } + }, + "pkg-up": { + "version": "2.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/pkg-up/-/pkg-up-2.0.0.tgz", + "integrity": "sha1-yBmscoBZpGHKscOImivjxJoATX8=", + "dev": true, + "requires": { + "find-up": "^2.1.0" + }, + "dependencies": { + "find-up": { + "version": "2.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/find-up/-/find-up-2.1.0.tgz", + "integrity": "sha1-RdG35QbHF93UgndaK3eSCjwMV6c=", + "dev": true, + "requires": { + "locate-path": "^2.0.0" + } + } + } + }, + "please-upgrade-node": { + "version": "3.1.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/please-upgrade-node/-/please-upgrade-node-3.1.1.tgz", + "integrity": "sha512-KY1uHnQ2NlQHqIJQpnh/i54rKkuxCEBx+voJIS/Mvb+L2iYd2NMotwduhKTMjfC1uKoX3VXOxLjIYG66dfJTVQ==", + "dev": true, + "requires": { + "semver-compare": "^1.0.0" + } + }, + "plugin-error": { + "version": "0.1.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/plugin-error/-/plugin-error-0.1.2.tgz", + "integrity": "sha1-O5uzM1zPAPQl4HQ34ZJ2ln2kes4=", + "dev": true, + "requires": { + "ansi-cyan": "^0.1.1", + "ansi-red": "^0.1.1", + "arr-diff": "^1.0.1", + "arr-union": "^2.0.1", + "extend-shallow": "^1.1.2" + }, + "dependencies": { + "arr-diff": { + "version": "1.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/arr-diff/-/arr-diff-1.1.0.tgz", + "integrity": "sha1-aHwydYFjWI/vfeezb6vklesaOZo=", + "dev": true, + "requires": { + "arr-flatten": "^1.0.1", + "array-slice": "^0.2.3" + } + }, + "arr-union": { + "version": "2.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/arr-union/-/arr-union-2.1.0.tgz", + "integrity": "sha1-IPnqtexw9cfSFbEHexw5Fh0pLH0=", + "dev": true + }, + "extend-shallow": { + "version": "1.1.4", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/extend-shallow/-/extend-shallow-1.1.4.tgz", + "integrity": "sha1-Gda/lN/AnXa6cR85uHLSH/TdkHE=", + "dev": true, + "requires": { + "kind-of": "^1.1.0" + } + }, + "kind-of": { + "version": "1.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/kind-of/-/kind-of-1.1.0.tgz", + "integrity": "sha1-FAo9LUGjbS78+pN3tiwk+ElaXEQ=", + "dev": true + } + } + }, + "pluralize": { + "version": "7.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/pluralize/-/pluralize-7.0.0.tgz", + "integrity": "sha512-ARhBOdzS3e41FbkW/XWrTEtukqqLoK5+Z/4UeDaLuSW+39JPeFgs4gCGqsrJHVZX0fUrx//4OF0K1CUGwlIFow==", + "dev": true + }, + "pn": { + "version": "1.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/pn/-/pn-1.1.0.tgz", + "integrity": "sha512-2qHaIQr2VLRFoxe2nASzsV6ef4yOOH+Fi9FBOVH6cqeSgUnoyySPZkxzLuzd+RYOQTRpROA0ztTMqxROKSb/nA==", + "dev": true + }, + "portfinder": { + "version": "1.0.13", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/portfinder/-/portfinder-1.0.13.tgz", + "integrity": "sha1-uzLs2HwnEErm7kS1o8y/Drsa7ek=", + "dev": true, + "requires": { + "async": "^1.5.2", + "debug": "^2.2.0", + "mkdirp": "0.5.x" + } + }, + "portscanner": { + "version": "2.1.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/portscanner/-/portscanner-2.1.1.tgz", + "integrity": "sha1-6rtAnk3iSVD1oqUW01rnaTQ/u5Y=", + "dev": true, + "requires": { + "async": "1.5.2", + "is-number-like": "^1.0.3" + } + }, + "posix-character-classes": { + "version": "0.1.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/posix-character-classes/-/posix-character-classes-0.1.1.tgz", + "integrity": "sha1-AerA/jta9xoqbAL+q7jB/vfgDqs=", + "dev": true + }, + "postcss": { + "version": "5.2.18", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/postcss/-/postcss-5.2.18.tgz", + "integrity": "sha512-zrUjRRe1bpXKsX1qAJNJjqZViErVuyEkMTRrwu4ud4sbTtIBRmtaYDrHmcGgmrbsW3MHfmtIf+vJumgQn+PrXg==", + "dev": true, + "requires": { + "chalk": "^1.1.3", + "js-base64": "^2.1.9", + "source-map": "^0.5.6", + "supports-color": "^3.2.3" + }, + "dependencies": { + "supports-color": { + "version": "3.2.3", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/supports-color/-/supports-color-3.2.3.tgz", + "integrity": "sha1-ZawFBLOVQXHYpklGsq48u4pfVPY=", + "dev": true, + "requires": { + "has-flag": "^1.0.0" + } + } + } + }, + "postcss-calc": { + "version": "5.3.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/postcss-calc/-/postcss-calc-5.3.1.tgz", + "integrity": "sha1-d7rnypKK2FcW4v2kLyYb98HWW14=", + "dev": true, + "requires": { + "postcss": "^5.0.2", + "postcss-message-helpers": "^2.0.0", + "reduce-css-calc": "^1.2.6" + } + }, + "postcss-colormin": { + "version": "2.2.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/postcss-colormin/-/postcss-colormin-2.2.2.tgz", + "integrity": "sha1-ZjFBfV8OkJo9fsJrJMio0eT5bks=", + "dev": true, + "requires": { + "colormin": "^1.0.5", + "postcss": "^5.0.13", + "postcss-value-parser": "^3.2.3" + } + }, + "postcss-convert-values": { + "version": "2.6.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/postcss-convert-values/-/postcss-convert-values-2.6.1.tgz", + "integrity": "sha1-u9hZPFwf0uPRwyK7kl3K6Nrk1i0=", + "dev": true, + "requires": { + "postcss": "^5.0.11", + "postcss-value-parser": "^3.1.2" + } + }, + "postcss-discard-comments": { + "version": "2.0.4", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/postcss-discard-comments/-/postcss-discard-comments-2.0.4.tgz", + "integrity": "sha1-vv6J+v1bPazlzM5Rt2uBUUvgDj0=", + "dev": true, + "requires": { + "postcss": "^5.0.14" + } + }, + "postcss-discard-duplicates": { + "version": "2.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/postcss-discard-duplicates/-/postcss-discard-duplicates-2.1.0.tgz", + "integrity": "sha1-uavye4isGIFYpesSq8riAmO5GTI=", + "dev": true, + "requires": { + "postcss": "^5.0.4" + } + }, + "postcss-discard-empty": { + "version": "2.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/postcss-discard-empty/-/postcss-discard-empty-2.1.0.tgz", + "integrity": "sha1-0rS9nVztXr2Nyt52QMfXzX9PkrU=", + "dev": true, + "requires": { + "postcss": "^5.0.14" + } + }, + "postcss-discard-overridden": { + "version": "0.1.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/postcss-discard-overridden/-/postcss-discard-overridden-0.1.1.tgz", + "integrity": "sha1-ix6vVU9ob7KIzYdMVWZ7CqNmjVg=", + "dev": true, + "requires": { + "postcss": "^5.0.16" + } + }, + "postcss-discard-unused": { + "version": "2.2.3", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/postcss-discard-unused/-/postcss-discard-unused-2.2.3.tgz", + "integrity": "sha1-vOMLLMWR/8Y0Mitfs0ZLbZNPRDM=", + "dev": true, + "requires": { + "postcss": "^5.0.14", + "uniqs": "^2.0.0" + } + }, + "postcss-filter-plugins": { + "version": "2.0.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/postcss-filter-plugins/-/postcss-filter-plugins-2.0.2.tgz", + "integrity": "sha1-bYWGJTTXNaxCDkqFgG4fXUKG2Ew=", + "dev": true, + "requires": { + "postcss": "^5.0.4", + "uniqid": "^4.0.0" + } + }, + "postcss-load-config": { + "version": "1.2.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/postcss-load-config/-/postcss-load-config-1.2.0.tgz", + "integrity": "sha1-U56a/J3chiASHr+djDZz4M5Q0oo=", + "dev": true, + "requires": { + "cosmiconfig": "^2.1.0", + "object-assign": "^4.1.0", + "postcss-load-options": "^1.2.0", + "postcss-load-plugins": "^2.3.0" + }, + "dependencies": { + "cosmiconfig": { + "version": "2.2.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/cosmiconfig/-/cosmiconfig-2.2.2.tgz", + "integrity": "sha512-GiNXLwAFPYHy25XmTPpafYvn3CLAkJ8FLsscq78MQd1Kh0OU6Yzhn4eV2MVF4G9WEQZoWEGltatdR+ntGPMl5A==", + "dev": true, + "requires": { + "is-directory": "^0.3.1", + "js-yaml": "^3.4.3", + "minimist": "^1.2.0", + "object-assign": "^4.1.0", + "os-homedir": "^1.0.1", + "parse-json": "^2.2.0", + "require-from-string": "^1.1.0" + } + } + } + }, + "postcss-load-options": { + "version": "1.2.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/postcss-load-options/-/postcss-load-options-1.2.0.tgz", + "integrity": "sha1-sJixVZ3awt8EvAuzdfmaXP4rbYw=", + "dev": true, + "requires": { + "cosmiconfig": "^2.1.0", + "object-assign": "^4.1.0" + }, + "dependencies": { + "cosmiconfig": { + "version": "2.2.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/cosmiconfig/-/cosmiconfig-2.2.2.tgz", + "integrity": "sha512-GiNXLwAFPYHy25XmTPpafYvn3CLAkJ8FLsscq78MQd1Kh0OU6Yzhn4eV2MVF4G9WEQZoWEGltatdR+ntGPMl5A==", + "dev": true, + "requires": { + "is-directory": "^0.3.1", + "js-yaml": "^3.4.3", + "minimist": "^1.2.0", + "object-assign": "^4.1.0", + "os-homedir": "^1.0.1", + "parse-json": "^2.2.0", + "require-from-string": "^1.1.0" + } + } + } + }, + "postcss-load-plugins": { + "version": "2.3.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/postcss-load-plugins/-/postcss-load-plugins-2.3.0.tgz", + "integrity": "sha1-dFdoEWWZrKLwCfrUJrABdQSdjZI=", + "dev": true, + "requires": { + "cosmiconfig": "^2.1.1", + "object-assign": "^4.1.0" + }, + "dependencies": { + "cosmiconfig": { + "version": "2.2.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/cosmiconfig/-/cosmiconfig-2.2.2.tgz", + "integrity": "sha512-GiNXLwAFPYHy25XmTPpafYvn3CLAkJ8FLsscq78MQd1Kh0OU6Yzhn4eV2MVF4G9WEQZoWEGltatdR+ntGPMl5A==", + "dev": true, + "requires": { + "is-directory": "^0.3.1", + "js-yaml": "^3.4.3", + "minimist": "^1.2.0", + "object-assign": "^4.1.0", + "os-homedir": "^1.0.1", + "parse-json": "^2.2.0", + "require-from-string": "^1.1.0" + } + } + } + }, + "postcss-loader": { + "version": "2.1.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/postcss-loader/-/postcss-loader-2.1.1.tgz", + "integrity": "sha512-f0J/DWE/hyO9/LH0WHpXkny/ZZ238sSaG3p1SRBtVZnFWUtD7GXIEgHoBg8cnAeRbmEvUxHQptY46zWfwNYj/w==", + "dev": true, + "requires": { + "loader-utils": "^1.1.0", + "postcss": "^6.0.0", + "postcss-load-config": "^1.2.0", + "schema-utils": "^0.4.0" + }, + "dependencies": { + "ansi-styles": { + "version": "3.2.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, + "requires": { + "color-convert": "^1.9.0" + } + }, + "chalk": { + "version": "2.4.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/chalk/-/chalk-2.4.1.tgz", + "integrity": "sha512-ObN6h1v2fTJSmUXoS3nMQ92LbDK9be4TV+6G+omQlGJFdcUX5heKi1LZ1YnRMIgwTLEj3E24bT6tYni50rlCfQ==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + } + }, + "has-flag": { + "version": "3.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", + "dev": true + }, + "postcss": { + "version": "6.0.23", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/postcss/-/postcss-6.0.23.tgz", + "integrity": "sha512-soOk1h6J3VMTZtVeVpv15/Hpdl2cBLX3CAw4TAbkpTJiNPk9YP/zWcD1ND+xEtvyuuvKzbxliTOIyvkSeSJ6ag==", + "dev": true, + "requires": { + "chalk": "^2.4.1", + "source-map": "^0.6.1", + "supports-color": "^5.4.0" + } + }, + "source-map": { + "version": "0.6.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "dev": true + }, + "supports-color": { + "version": "5.5.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } + } + } + }, + "postcss-merge-idents": { + "version": "2.1.7", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/postcss-merge-idents/-/postcss-merge-idents-2.1.7.tgz", + "integrity": "sha1-TFUwMTwI4dWzu/PSu8dH4njuonA=", + "dev": true, + "requires": { + "has": "^1.0.1", + "postcss": "^5.0.10", + "postcss-value-parser": "^3.1.1" + } + }, + "postcss-merge-longhand": { + "version": "2.0.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/postcss-merge-longhand/-/postcss-merge-longhand-2.0.2.tgz", + "integrity": "sha1-I9kM0Sewp3mUkVMyc5A0oaTz1lg=", + "dev": true, + "requires": { + "postcss": "^5.0.4" + } + }, + "postcss-merge-rules": { + "version": "2.1.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/postcss-merge-rules/-/postcss-merge-rules-2.1.2.tgz", + "integrity": "sha1-0d9d+qexrMO+VT8OnhDofGG19yE=", + "dev": true, + "requires": { + "browserslist": "^1.5.2", + "caniuse-api": "^1.5.2", + "postcss": "^5.0.4", + "postcss-selector-parser": "^2.2.2", + "vendors": "^1.0.0" + } + }, + "postcss-message-helpers": { + "version": "2.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/postcss-message-helpers/-/postcss-message-helpers-2.0.0.tgz", + "integrity": "sha1-pPL0+rbk/gAvCu0ABHjN9S+bpg4=", + "dev": true + }, + "postcss-minify-font-values": { + "version": "1.0.5", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/postcss-minify-font-values/-/postcss-minify-font-values-1.0.5.tgz", + "integrity": "sha1-S1jttWZB66fIR0qzUmyv17vey2k=", + "dev": true, + "requires": { + "object-assign": "^4.0.1", + "postcss": "^5.0.4", + "postcss-value-parser": "^3.0.2" + } + }, + "postcss-minify-gradients": { + "version": "1.0.5", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/postcss-minify-gradients/-/postcss-minify-gradients-1.0.5.tgz", + "integrity": "sha1-Xb2hE3NwP4PPtKPqOIHY11/15uE=", + "dev": true, + "requires": { + "postcss": "^5.0.12", + "postcss-value-parser": "^3.3.0" + } + }, + "postcss-minify-params": { + "version": "1.2.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/postcss-minify-params/-/postcss-minify-params-1.2.2.tgz", + "integrity": "sha1-rSzgcTc7lDs9kwo/pZo1jCjW8fM=", + "dev": true, + "requires": { + "alphanum-sort": "^1.0.1", + "postcss": "^5.0.2", + "postcss-value-parser": "^3.0.2", + "uniqs": "^2.0.0" + } + }, + "postcss-minify-selectors": { + "version": "2.1.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/postcss-minify-selectors/-/postcss-minify-selectors-2.1.1.tgz", + "integrity": "sha1-ssapjAByz5G5MtGkllCBFDEXNb8=", + "dev": true, + "requires": { + "alphanum-sort": "^1.0.2", + "has": "^1.0.1", + "postcss": "^5.0.14", + "postcss-selector-parser": "^2.0.0" + } + }, + "postcss-modules-extract-imports": { + "version": "1.2.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/postcss-modules-extract-imports/-/postcss-modules-extract-imports-1.2.0.tgz", + "integrity": "sha1-ZhQOzs447wa/DT41XWm/WdFB6oU=", + "dev": true, + "requires": { + "postcss": "^6.0.1" + }, + "dependencies": { + "ansi-styles": { + "version": "3.2.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, + "requires": { + "color-convert": "^1.9.0" + } + }, + "chalk": { + "version": "2.4.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/chalk/-/chalk-2.4.1.tgz", + "integrity": "sha512-ObN6h1v2fTJSmUXoS3nMQ92LbDK9be4TV+6G+omQlGJFdcUX5heKi1LZ1YnRMIgwTLEj3E24bT6tYni50rlCfQ==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + } + }, + "has-flag": { + "version": "3.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", + "dev": true + }, + "postcss": { + "version": "6.0.23", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/postcss/-/postcss-6.0.23.tgz", + "integrity": "sha512-soOk1h6J3VMTZtVeVpv15/Hpdl2cBLX3CAw4TAbkpTJiNPk9YP/zWcD1ND+xEtvyuuvKzbxliTOIyvkSeSJ6ag==", + "dev": true, + "requires": { + "chalk": "^2.4.1", + "source-map": "^0.6.1", + "supports-color": "^5.4.0" + } + }, + "source-map": { + "version": "0.6.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "dev": true + }, + "supports-color": { + "version": "5.5.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } + } + } + }, + "postcss-modules-local-by-default": { + "version": "1.2.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/postcss-modules-local-by-default/-/postcss-modules-local-by-default-1.2.0.tgz", + "integrity": "sha1-99gMOYxaOT+nlkRmvRlQCn1hwGk=", + "dev": true, + "requires": { + "css-selector-tokenizer": "^0.7.0", + "postcss": "^6.0.1" + }, + "dependencies": { + "ansi-styles": { + "version": "3.2.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, + "requires": { + "color-convert": "^1.9.0" + } + }, + "chalk": { + "version": "2.4.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/chalk/-/chalk-2.4.1.tgz", + "integrity": "sha512-ObN6h1v2fTJSmUXoS3nMQ92LbDK9be4TV+6G+omQlGJFdcUX5heKi1LZ1YnRMIgwTLEj3E24bT6tYni50rlCfQ==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + } + }, + "has-flag": { + "version": "3.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", + "dev": true + }, + "postcss": { + "version": "6.0.23", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/postcss/-/postcss-6.0.23.tgz", + "integrity": "sha512-soOk1h6J3VMTZtVeVpv15/Hpdl2cBLX3CAw4TAbkpTJiNPk9YP/zWcD1ND+xEtvyuuvKzbxliTOIyvkSeSJ6ag==", + "dev": true, + "requires": { + "chalk": "^2.4.1", + "source-map": "^0.6.1", + "supports-color": "^5.4.0" + } + }, + "source-map": { + "version": "0.6.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "dev": true + }, + "supports-color": { + "version": "5.5.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } + } + } + }, + "postcss-modules-scope": { + "version": "1.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/postcss-modules-scope/-/postcss-modules-scope-1.1.0.tgz", + "integrity": "sha1-1upkmUx5+XtipytCb75gVqGUu5A=", + "dev": true, + "requires": { + "css-selector-tokenizer": "^0.7.0", + "postcss": "^6.0.1" + }, + "dependencies": { + "ansi-styles": { + "version": "3.2.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, + "requires": { + "color-convert": "^1.9.0" + } + }, + "chalk": { + "version": "2.4.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/chalk/-/chalk-2.4.1.tgz", + "integrity": "sha512-ObN6h1v2fTJSmUXoS3nMQ92LbDK9be4TV+6G+omQlGJFdcUX5heKi1LZ1YnRMIgwTLEj3E24bT6tYni50rlCfQ==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + } + }, + "has-flag": { + "version": "3.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", + "dev": true + }, + "postcss": { + "version": "6.0.23", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/postcss/-/postcss-6.0.23.tgz", + "integrity": "sha512-soOk1h6J3VMTZtVeVpv15/Hpdl2cBLX3CAw4TAbkpTJiNPk9YP/zWcD1ND+xEtvyuuvKzbxliTOIyvkSeSJ6ag==", + "dev": true, + "requires": { + "chalk": "^2.4.1", + "source-map": "^0.6.1", + "supports-color": "^5.4.0" + } + }, + "source-map": { + "version": "0.6.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "dev": true + }, + "supports-color": { + "version": "5.5.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } + } + } + }, + "postcss-modules-values": { + "version": "1.3.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/postcss-modules-values/-/postcss-modules-values-1.3.0.tgz", + "integrity": "sha1-7P+p1+GSUYOJ9CrQ6D9yrsRW6iA=", + "dev": true, + "requires": { + "icss-replace-symbols": "^1.1.0", + "postcss": "^6.0.1" + }, + "dependencies": { + "ansi-styles": { + "version": "3.2.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, + "requires": { + "color-convert": "^1.9.0" + } + }, + "chalk": { + "version": "2.4.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/chalk/-/chalk-2.4.1.tgz", + "integrity": "sha512-ObN6h1v2fTJSmUXoS3nMQ92LbDK9be4TV+6G+omQlGJFdcUX5heKi1LZ1YnRMIgwTLEj3E24bT6tYni50rlCfQ==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + } + }, + "has-flag": { + "version": "3.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", + "dev": true + }, + "postcss": { + "version": "6.0.23", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/postcss/-/postcss-6.0.23.tgz", + "integrity": "sha512-soOk1h6J3VMTZtVeVpv15/Hpdl2cBLX3CAw4TAbkpTJiNPk9YP/zWcD1ND+xEtvyuuvKzbxliTOIyvkSeSJ6ag==", + "dev": true, + "requires": { + "chalk": "^2.4.1", + "source-map": "^0.6.1", + "supports-color": "^5.4.0" + } + }, + "source-map": { + "version": "0.6.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "dev": true + }, + "supports-color": { + "version": "5.5.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } + } + } + }, + "postcss-normalize-charset": { + "version": "1.1.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/postcss-normalize-charset/-/postcss-normalize-charset-1.1.1.tgz", + "integrity": "sha1-757nEhLX/nWceO0WL2HtYrXLk/E=", + "dev": true, + "requires": { + "postcss": "^5.0.5" + } + }, + "postcss-normalize-display-values": { + "version": "4.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/postcss-normalize-display-values/-/postcss-normalize-display-values-4.0.0.tgz", + "integrity": "sha1-lQ4Me+NEV3ChYP/9a2ZEw8DNj4k=", + "dev": true, + "requires": { + "cssnano-util-get-match": "^4.0.0", + "postcss": "^6.0.0", + "postcss-value-parser": "^3.0.0" + }, + "dependencies": { + "ansi-styles": { + "version": "3.2.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, + "requires": { + "color-convert": "^1.9.0" + } + }, + "chalk": { + "version": "2.4.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/chalk/-/chalk-2.4.1.tgz", + "integrity": "sha512-ObN6h1v2fTJSmUXoS3nMQ92LbDK9be4TV+6G+omQlGJFdcUX5heKi1LZ1YnRMIgwTLEj3E24bT6tYni50rlCfQ==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + } + }, + "has-flag": { + "version": "3.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", + "dev": true + }, + "postcss": { + "version": "6.0.23", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/postcss/-/postcss-6.0.23.tgz", + "integrity": "sha512-soOk1h6J3VMTZtVeVpv15/Hpdl2cBLX3CAw4TAbkpTJiNPk9YP/zWcD1ND+xEtvyuuvKzbxliTOIyvkSeSJ6ag==", + "dev": true, + "requires": { + "chalk": "^2.4.1", + "source-map": "^0.6.1", + "supports-color": "^5.4.0" + } + }, + "source-map": { + "version": "0.6.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "dev": true + }, + "supports-color": { + "version": "5.5.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } + } + } + }, + "postcss-normalize-positions": { + "version": "4.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/postcss-normalize-positions/-/postcss-normalize-positions-4.0.0.tgz", + "integrity": "sha1-7pNDq5gbgixjq3JhXszNCFZERaM=", + "dev": true, + "requires": { + "cssnano-util-get-arguments": "^4.0.0", + "has": "^1.0.0", + "postcss": "^6.0.0", + "postcss-value-parser": "^3.0.0" + }, + "dependencies": { + "ansi-styles": { + "version": "3.2.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, + "requires": { + "color-convert": "^1.9.0" + } + }, + "chalk": { + "version": "2.4.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/chalk/-/chalk-2.4.1.tgz", + "integrity": "sha512-ObN6h1v2fTJSmUXoS3nMQ92LbDK9be4TV+6G+omQlGJFdcUX5heKi1LZ1YnRMIgwTLEj3E24bT6tYni50rlCfQ==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + } + }, + "has-flag": { + "version": "3.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", + "dev": true + }, + "postcss": { + "version": "6.0.23", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/postcss/-/postcss-6.0.23.tgz", + "integrity": "sha512-soOk1h6J3VMTZtVeVpv15/Hpdl2cBLX3CAw4TAbkpTJiNPk9YP/zWcD1ND+xEtvyuuvKzbxliTOIyvkSeSJ6ag==", + "dev": true, + "requires": { + "chalk": "^2.4.1", + "source-map": "^0.6.1", + "supports-color": "^5.4.0" + } + }, + "source-map": { + "version": "0.6.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "dev": true + }, + "supports-color": { + "version": "5.5.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } + } + } + }, + "postcss-normalize-repeat-style": { + "version": "4.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/postcss-normalize-repeat-style/-/postcss-normalize-repeat-style-4.0.0.tgz", + "integrity": "sha1-txHFks8W+vn/V15C+hALZ5kIPv8=", + "dev": true, + "requires": { + "cssnano-util-get-arguments": "^4.0.0", + "cssnano-util-get-match": "^4.0.0", + "postcss": "^6.0.0", + "postcss-value-parser": "^3.0.0" + }, + "dependencies": { + "ansi-styles": { + "version": "3.2.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, + "requires": { + "color-convert": "^1.9.0" + } + }, + "chalk": { + "version": "2.4.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/chalk/-/chalk-2.4.1.tgz", + "integrity": "sha512-ObN6h1v2fTJSmUXoS3nMQ92LbDK9be4TV+6G+omQlGJFdcUX5heKi1LZ1YnRMIgwTLEj3E24bT6tYni50rlCfQ==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + } + }, + "has-flag": { + "version": "3.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", + "dev": true + }, + "postcss": { + "version": "6.0.23", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/postcss/-/postcss-6.0.23.tgz", + "integrity": "sha512-soOk1h6J3VMTZtVeVpv15/Hpdl2cBLX3CAw4TAbkpTJiNPk9YP/zWcD1ND+xEtvyuuvKzbxliTOIyvkSeSJ6ag==", + "dev": true, + "requires": { + "chalk": "^2.4.1", + "source-map": "^0.6.1", + "supports-color": "^5.4.0" + } + }, + "source-map": { + "version": "0.6.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "dev": true + }, + "supports-color": { + "version": "5.5.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } + } + } + }, + "postcss-normalize-string": { + "version": "4.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/postcss-normalize-string/-/postcss-normalize-string-4.0.0.tgz", + "integrity": "sha1-cYy20wpvrGrGqDDjLAbAfbxm/l0=", + "dev": true, + "requires": { + "has": "^1.0.0", + "postcss": "^6.0.0", + "postcss-value-parser": "^3.0.0" + }, + "dependencies": { + "ansi-styles": { + "version": "3.2.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, + "requires": { + "color-convert": "^1.9.0" + } + }, + "chalk": { + "version": "2.4.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/chalk/-/chalk-2.4.1.tgz", + "integrity": "sha512-ObN6h1v2fTJSmUXoS3nMQ92LbDK9be4TV+6G+omQlGJFdcUX5heKi1LZ1YnRMIgwTLEj3E24bT6tYni50rlCfQ==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + } + }, + "has-flag": { + "version": "3.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", + "dev": true + }, + "postcss": { + "version": "6.0.23", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/postcss/-/postcss-6.0.23.tgz", + "integrity": "sha512-soOk1h6J3VMTZtVeVpv15/Hpdl2cBLX3CAw4TAbkpTJiNPk9YP/zWcD1ND+xEtvyuuvKzbxliTOIyvkSeSJ6ag==", + "dev": true, + "requires": { + "chalk": "^2.4.1", + "source-map": "^0.6.1", + "supports-color": "^5.4.0" + } + }, + "source-map": { + "version": "0.6.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "dev": true + }, + "supports-color": { + "version": "5.5.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } + } + } + }, + "postcss-normalize-timing-functions": { + "version": "4.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/postcss-normalize-timing-functions/-/postcss-normalize-timing-functions-4.0.0.tgz", + "integrity": "sha1-A1HymIaqmB1D2RssK9GuptCvbSM=", + "dev": true, + "requires": { + "cssnano-util-get-match": "^4.0.0", + "postcss": "^6.0.0", + "postcss-value-parser": "^3.0.0" + }, + "dependencies": { + "ansi-styles": { + "version": "3.2.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, + "requires": { + "color-convert": "^1.9.0" + } + }, + "chalk": { + "version": "2.4.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/chalk/-/chalk-2.4.1.tgz", + "integrity": "sha512-ObN6h1v2fTJSmUXoS3nMQ92LbDK9be4TV+6G+omQlGJFdcUX5heKi1LZ1YnRMIgwTLEj3E24bT6tYni50rlCfQ==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + } + }, + "has-flag": { + "version": "3.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", + "dev": true + }, + "postcss": { + "version": "6.0.23", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/postcss/-/postcss-6.0.23.tgz", + "integrity": "sha512-soOk1h6J3VMTZtVeVpv15/Hpdl2cBLX3CAw4TAbkpTJiNPk9YP/zWcD1ND+xEtvyuuvKzbxliTOIyvkSeSJ6ag==", + "dev": true, + "requires": { + "chalk": "^2.4.1", + "source-map": "^0.6.1", + "supports-color": "^5.4.0" + } + }, + "source-map": { + "version": "0.6.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "dev": true + }, + "supports-color": { + "version": "5.5.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } + } + } + }, + "postcss-normalize-unicode": { + "version": "4.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/postcss-normalize-unicode/-/postcss-normalize-unicode-4.0.0.tgz", + "integrity": "sha1-Ws1dR7rqXRdnSyzMSuUWb6iM35c=", + "dev": true, + "requires": { + "postcss": "^6.0.0", + "postcss-value-parser": "^3.0.0" + }, + "dependencies": { + "ansi-styles": { + "version": "3.2.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, + "requires": { + "color-convert": "^1.9.0" + } + }, + "chalk": { + "version": "2.4.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/chalk/-/chalk-2.4.1.tgz", + "integrity": "sha512-ObN6h1v2fTJSmUXoS3nMQ92LbDK9be4TV+6G+omQlGJFdcUX5heKi1LZ1YnRMIgwTLEj3E24bT6tYni50rlCfQ==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + } + }, + "has-flag": { + "version": "3.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", + "dev": true + }, + "postcss": { + "version": "6.0.23", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/postcss/-/postcss-6.0.23.tgz", + "integrity": "sha512-soOk1h6J3VMTZtVeVpv15/Hpdl2cBLX3CAw4TAbkpTJiNPk9YP/zWcD1ND+xEtvyuuvKzbxliTOIyvkSeSJ6ag==", + "dev": true, + "requires": { + "chalk": "^2.4.1", + "source-map": "^0.6.1", + "supports-color": "^5.4.0" + } + }, + "source-map": { + "version": "0.6.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "dev": true + }, + "supports-color": { + "version": "5.5.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } + } + } + }, + "postcss-normalize-url": { + "version": "3.0.8", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/postcss-normalize-url/-/postcss-normalize-url-3.0.8.tgz", + "integrity": "sha1-EI90s/L82viRov+j6kWSJ5/HgiI=", + "dev": true, + "requires": { + "is-absolute-url": "^2.0.0", + "normalize-url": "^1.4.0", + "postcss": "^5.0.14", + "postcss-value-parser": "^3.2.3" + } + }, + "postcss-normalize-whitespace": { + "version": "4.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/postcss-normalize-whitespace/-/postcss-normalize-whitespace-4.0.0.tgz", + "integrity": "sha1-HafnaxCuY8EYJ/oE/Du0oe/pnMA=", + "dev": true, + "requires": { + "postcss": "^6.0.0", + "postcss-value-parser": "^3.0.0" + }, + "dependencies": { + "ansi-styles": { + "version": "3.2.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, + "requires": { + "color-convert": "^1.9.0" + } + }, + "chalk": { + "version": "2.4.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/chalk/-/chalk-2.4.1.tgz", + "integrity": "sha512-ObN6h1v2fTJSmUXoS3nMQ92LbDK9be4TV+6G+omQlGJFdcUX5heKi1LZ1YnRMIgwTLEj3E24bT6tYni50rlCfQ==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + } + }, + "has-flag": { + "version": "3.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", + "dev": true + }, + "postcss": { + "version": "6.0.23", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/postcss/-/postcss-6.0.23.tgz", + "integrity": "sha512-soOk1h6J3VMTZtVeVpv15/Hpdl2cBLX3CAw4TAbkpTJiNPk9YP/zWcD1ND+xEtvyuuvKzbxliTOIyvkSeSJ6ag==", + "dev": true, + "requires": { + "chalk": "^2.4.1", + "source-map": "^0.6.1", + "supports-color": "^5.4.0" + } + }, + "source-map": { + "version": "0.6.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "dev": true + }, + "supports-color": { + "version": "5.5.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } + } + } + }, + "postcss-ordered-values": { + "version": "2.2.3", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/postcss-ordered-values/-/postcss-ordered-values-2.2.3.tgz", + "integrity": "sha1-7sbCpntsQSqNsgQud/6NpD+VwR0=", + "dev": true, + "requires": { + "postcss": "^5.0.4", + "postcss-value-parser": "^3.0.1" + } + }, + "postcss-reduce-idents": { + "version": "2.4.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/postcss-reduce-idents/-/postcss-reduce-idents-2.4.0.tgz", + "integrity": "sha1-wsbSDMlYKE9qv75j92Cb9AkFmtM=", + "dev": true, + "requires": { + "postcss": "^5.0.4", + "postcss-value-parser": "^3.0.2" + } + }, + "postcss-reduce-initial": { + "version": "1.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/postcss-reduce-initial/-/postcss-reduce-initial-1.0.1.tgz", + "integrity": "sha1-aPgGlfBF0IJjqHmtJA343WT2ROo=", + "dev": true, + "requires": { + "postcss": "^5.0.4" + } + }, + "postcss-reduce-transforms": { + "version": "1.0.4", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/postcss-reduce-transforms/-/postcss-reduce-transforms-1.0.4.tgz", + "integrity": "sha1-/3b02CEkN7McKYpC0uFEQCV3GuE=", + "dev": true, + "requires": { + "has": "^1.0.1", + "postcss": "^5.0.8", + "postcss-value-parser": "^3.0.1" + } + }, + "postcss-selector-parser": { + "version": "2.2.3", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/postcss-selector-parser/-/postcss-selector-parser-2.2.3.tgz", + "integrity": "sha1-+UN3iGBsPJrO4W/+jYsWKX8nu5A=", + "dev": true, + "requires": { + "flatten": "^1.0.2", + "indexes-of": "^1.0.1", + "uniq": "^1.0.1" + } + }, + "postcss-svgo": { + "version": "2.1.6", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/postcss-svgo/-/postcss-svgo-2.1.6.tgz", + "integrity": "sha1-tt8YqmE7Zm4TPwittSGcJoSsEI0=", + "dev": true, + "requires": { + "is-svg": "^2.0.0", + "postcss": "^5.0.14", + "postcss-value-parser": "^3.2.3", + "svgo": "^0.7.0" + } + }, + "postcss-unique-selectors": { + "version": "2.0.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/postcss-unique-selectors/-/postcss-unique-selectors-2.0.2.tgz", + "integrity": "sha1-mB1X0p3csz57Hf4f1DuGSfkzyh0=", + "dev": true, + "requires": { + "alphanum-sort": "^1.0.1", + "postcss": "^5.0.4", + "uniqs": "^2.0.0" + } + }, + "postcss-value-parser": { + "version": "3.3.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/postcss-value-parser/-/postcss-value-parser-3.3.0.tgz", + "integrity": "sha1-h/OPnxj3dKSrTIojL1xc6IcqnRU=", + "dev": true + }, + "postcss-zindex": { + "version": "2.2.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/postcss-zindex/-/postcss-zindex-2.2.0.tgz", + "integrity": "sha1-0hCd3AVbka9n/EyzsCWUZjnSryI=", + "dev": true, + "requires": { + "has": "^1.0.1", + "postcss": "^5.0.4", + "uniqs": "^2.0.0" + } + }, + "prelude-ls": { + "version": "1.1.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/prelude-ls/-/prelude-ls-1.1.2.tgz", + "integrity": "sha1-IZMqVJ9eUv/ZqCf1cOBL5iqX2lQ=", + "dev": true + }, + "prepend-http": { + "version": "1.0.4", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/prepend-http/-/prepend-http-1.0.4.tgz", + "integrity": "sha1-1PRWKwzjaW5BrFLQ4ALlemNdxtw=", + "dev": true + }, + "preserve": { + "version": "0.2.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/preserve/-/preserve-0.2.0.tgz", + "integrity": "sha1-gV7R9uvGWSb4ZbMQwHE7yzMVzks=", + "dev": true + }, + "prettier": { + "version": "1.11.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/prettier/-/prettier-1.11.1.tgz", + "integrity": "sha512-T/KD65Ot0PB97xTrG8afQ46x3oiVhnfGjGESSI9NWYcG92+OUPZKkwHqGWXH2t9jK1crnQjubECW0FuOth+hxw==", + "dev": true + }, + "pretty-bytes": { + "version": "5.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/pretty-bytes/-/pretty-bytes-5.1.0.tgz", + "integrity": "sha512-wa5+qGVg9Yt7PB6rYm3kXlKzgzgivYTLRandezh43jjRqgyDyP+9YxfJpJiLs9yKD1WeU8/OvtToWpW7255FtA==", + "dev": true + }, + "pretty-error": { + "version": "2.1.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/pretty-error/-/pretty-error-2.1.1.tgz", + "integrity": "sha1-X0+HyPkeWuPzuoerTPXgOxoX8aM=", + "dev": true, + "requires": { + "renderkid": "^2.0.1", + "utila": "~0.4" + } + }, + "pretty-format": { + "version": "22.4.3", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/pretty-format/-/pretty-format-22.4.3.tgz", + "integrity": "sha512-S4oT9/sT6MN7/3COoOy+ZJeA92VmOnveLHgrwBE3Z1W5N9S2A1QGNYiE1z75DAENbJrXXUb+OWXhpJcg05QKQQ==", + "dev": true, + "requires": { + "ansi-regex": "^3.0.0", + "ansi-styles": "^3.2.0" + }, + "dependencies": { + "ansi-regex": { + "version": "3.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/ansi-regex/-/ansi-regex-3.0.0.tgz", + "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", + "dev": true + }, + "ansi-styles": { + "version": "3.2.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, + "requires": { + "color-convert": "^1.9.0" + } + } + } + }, + "private": { + "version": "0.1.8", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/private/-/private-0.1.8.tgz", + "integrity": "sha512-VvivMrbvd2nKkiG38qjULzlc+4Vx4wm/whI9pQD35YrARNnhxeiRktSOhSukRLFNlzg6Br/cJPet5J/u19r/mg==", + "dev": true + }, + "process": { + "version": "0.11.10", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/process/-/process-0.11.10.tgz", + "integrity": "sha1-czIwDoQBYb2j5podHZGn1LwW8YI=", + "dev": true + }, + "process-nextick-args": { + "version": "2.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/process-nextick-args/-/process-nextick-args-2.0.0.tgz", + "integrity": "sha512-MtEC1TqN0EU5nephaJ4rAtThHtC86dNN9qCuEhtshvpVBkAW5ZO7BASN9REnF9eoXGcRub+pFuKEpOHE+HbEMw==", + "dev": true + }, + "promise": { + "version": "7.3.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/promise/-/promise-7.3.1.tgz", + "integrity": "sha512-nolQXZ/4L+bP/UGlkfaIujX9BKxGwmQ9OT4mOt5yvy8iK1h3wqTEJCijzGANTCCl9nWjY41juyAn2K3Q1hLLTg==", + "dev": true, + "requires": { + "asap": "~2.0.3" + } + }, + "promise-inflight": { + "version": "1.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/promise-inflight/-/promise-inflight-1.0.1.tgz", + "integrity": "sha1-mEcocL8igTL8vdhoEputEsPAKeM=", + "dev": true + }, + "proxy-addr": { + "version": "2.0.3", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/proxy-addr/-/proxy-addr-2.0.3.tgz", + "integrity": "sha512-jQTChiCJteusULxjBp8+jftSQE5Obdl3k4cnmLA6WXtK6XFuWRnvVL7aCiBqaLPM8c4ph0S4tKna8XvmIwEnXQ==", + "dev": true, + "requires": { + "forwarded": "~0.1.2", + "ipaddr.js": "1.6.0" + } + }, + "proxy-middleware": { + "version": "0.15.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/proxy-middleware/-/proxy-middleware-0.15.0.tgz", + "integrity": "sha1-o/3xvvtzD5UZZYcqwvYHTGFHelY=", + "dev": true + }, + "prr": { + "version": "1.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/prr/-/prr-1.0.1.tgz", + "integrity": "sha1-0/wRS6BplaRexok/SEzrHXj19HY=", + "dev": true + }, + "pseudomap": { + "version": "1.0.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/pseudomap/-/pseudomap-1.0.2.tgz", + "integrity": "sha1-8FKijacOYYkX7wqKw0wa5aaChrM=", + "dev": true + }, + "psl": { + "version": "1.1.29", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/psl/-/psl-1.1.29.tgz", + "integrity": "sha512-AeUmQ0oLN02flVHXWh9sSJF7mcdFq0ppid/JkErufc3hGIV/AMa8Fo9VgDo/cT2jFdOWoFvHp90qqBH54W+gjQ==", + "dev": true + }, + "public-encrypt": { + "version": "4.0.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/public-encrypt/-/public-encrypt-4.0.2.tgz", + "integrity": "sha512-4kJ5Esocg8X3h8YgJsKAuoesBgB7mqH3eowiDzMUPKiRDDE7E/BqqZD1hnTByIaAFiwAw246YEltSq7tdrOH0Q==", + "dev": true, + "requires": { + "bn.js": "^4.1.0", + "browserify-rsa": "^4.0.0", + "create-hash": "^1.1.0", + "parse-asn1": "^5.0.0", + "randombytes": "^2.0.1" + } + }, + "pump": { + "version": "2.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/pump/-/pump-2.0.1.tgz", + "integrity": "sha512-ruPMNRkN3MHP1cWJc9OWr+T/xDP0jhXYCLfJcBuX54hhfIBnaQmAUMfDcG4DM5UMWByBbJY69QSphm3jtDKIkA==", + "dev": true, + "requires": { + "end-of-stream": "^1.1.0", + "once": "^1.3.1" + } + }, + "pumpify": { + "version": "1.5.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/pumpify/-/pumpify-1.5.1.tgz", + "integrity": "sha512-oClZI37HvuUJJxSKKrC17bZ9Cu0ZYhEAGPsPUy9KlMUmv9dKX2o77RUmq7f3XjIxbwyGwYzbzQ1L2Ks8sIradQ==", + "dev": true, + "requires": { + "duplexify": "^3.6.0", + "inherits": "^2.0.3", + "pump": "^2.0.0" + } + }, + "punycode": { + "version": "2.1.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/punycode/-/punycode-2.1.1.tgz", + "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==", + "dev": true + }, + "q": { + "version": "1.5.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/q/-/q-1.5.1.tgz", + "integrity": "sha1-fjL3W0E4EpHQRhHxvxQQmsAGUdc=", + "dev": true + }, + "qs": { + "version": "6.5.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/qs/-/qs-6.5.2.tgz", + "integrity": "sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA==", + "dev": true + }, + "query-string": { + "version": "4.3.4", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/query-string/-/query-string-4.3.4.tgz", + "integrity": "sha1-u7aTucqRXCMlFbIosaArYJBD2+s=", + "dev": true, + "requires": { + "object-assign": "^4.1.0", + "strict-uri-encode": "^1.0.0" + } + }, + "querystring": { + "version": "0.2.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/querystring/-/querystring-0.2.0.tgz", + "integrity": "sha1-sgmEkgO7Jd+CDadW50cAWHhSFiA=", + "dev": true + }, + "querystring-es3": { + "version": "0.2.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/querystring-es3/-/querystring-es3-0.2.1.tgz", + "integrity": "sha1-nsYfeQSYdXB9aUFFlv2Qek1xHnM=", + "dev": true + }, + "querystringify": { + "version": "2.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/querystringify/-/querystringify-2.0.0.tgz", + "integrity": "sha512-eTPo5t/4bgaMNZxyjWx6N2a6AuE0mq51KWvpc7nU/MAqixcI6v6KrGUKES0HaomdnolQBBXU/++X6/QQ9KL4tw==", + "dev": true + }, + "quick-lru": { + "version": "1.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/quick-lru/-/quick-lru-1.1.0.tgz", + "integrity": "sha1-Q2CxfGETatOAeDl/8RQW4Ybc+7g=", + "dev": true + }, + "randexp": { + "version": "0.4.9", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/randexp/-/randexp-0.4.9.tgz", + "integrity": "sha512-maAX1cnBkzIZ89O4tSQUOF098xjGMC8N+9vuY/WfHwg87THw6odD2Br35donlj5e6KnB1SB0QBHhTQhhDHuTPQ==", + "dev": true, + "requires": { + "drange": "^1.0.0", + "ret": "^0.2.0" + }, + "dependencies": { + "ret": { + "version": "0.2.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/ret/-/ret-0.2.2.tgz", + "integrity": "sha512-M0b3YWQs7R3Z917WRQy1HHA7Ba7D8hvZg6UE5mLykJxQVE2ju0IXbGlaHPPlkY+WN7wFP+wUMXmBFA0aV6vYGQ==", + "dev": true + } + } + }, + "randomatic": { + "version": "3.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/randomatic/-/randomatic-3.0.0.tgz", + "integrity": "sha512-VdxFOIEY3mNO5PtSRkkle/hPJDHvQhK21oa73K4yAc9qmp6N429gAyF1gZMOTMeS0/AYzaV/2Trcef+NaIonSA==", + "dev": true, + "requires": { + "is-number": "^4.0.0", + "kind-of": "^6.0.0", + "math-random": "^1.0.1" + }, + "dependencies": { + "is-number": { + "version": "4.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/is-number/-/is-number-4.0.0.tgz", + "integrity": "sha512-rSklcAIlf1OmFdyAqbnWTLVelsQ58uvZ66S/ZyawjWqIviTWCjg2PzVGw8WUA+nNuPTqb4wgA+NszrJ+08LlgQ==", + "dev": true + } + } + }, + "randombytes": { + "version": "2.0.6", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/randombytes/-/randombytes-2.0.6.tgz", + "integrity": "sha512-CIQ5OFxf4Jou6uOKe9t1AOgqpeU5fd70A8NPdHSGeYXqXsPe6peOwI0cUl88RWZ6sP1vPMV3avd/R6cZ5/sP1A==", + "dev": true, + "requires": { + "safe-buffer": "^5.1.0" + } + }, + "randomfill": { + "version": "1.0.4", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/randomfill/-/randomfill-1.0.4.tgz", + "integrity": "sha512-87lcbR8+MhcWcUiQ+9e+Rwx8MyR2P7qnt15ynUlbm3TU/fjbgz4GsvfSUDTemtCCtVCqb4ZcEFlyPNTh9bBTLw==", + "dev": true, + "requires": { + "randombytes": "^2.0.5", + "safe-buffer": "^5.1.0" + } + }, + "range-parser": { + "version": "1.2.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/range-parser/-/range-parser-1.2.0.tgz", + "integrity": "sha1-9JvmtIeJTdxA3MlKMi9hEJLgDV4=", + "dev": true + }, + "raw-body": { + "version": "2.3.3", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/raw-body/-/raw-body-2.3.3.tgz", + "integrity": "sha512-9esiElv1BrZoI3rCDuOuKCBRbuApGGaDPQfjSflGxdy4oyzqghxu6klEkkVIvBje+FF0BX9coEv8KqW6X/7njw==", + "dev": true, + "requires": { + "bytes": "3.0.0", + "http-errors": "1.6.3", + "iconv-lite": "0.4.23", + "unpipe": "1.0.0" + } + }, + "raw-loader": { + "version": "0.5.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/raw-loader/-/raw-loader-0.5.1.tgz", + "integrity": "sha1-DD0L6u2KAclm2Xh793goElKpeao=", + "dev": true + }, + "react": { + "version": "0.14.9", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/react/-/react-0.14.9.tgz", + "integrity": "sha1-kRCmSXxJ1EuhwO3TF67CnC4NkdE=", + "dev": true, + "requires": { + "envify": "^3.0.0", + "fbjs": "^0.6.1" + } + }, + "react-dom": { + "version": "0.14.9", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/react-dom/-/react-dom-0.14.9.tgz", + "integrity": "sha1-BQZKPc8PsYgKOyv8nVjFXY2fYpM=", + "dev": true + }, + "read-chunk": { + "version": "2.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/read-chunk/-/read-chunk-2.1.0.tgz", + "integrity": "sha1-agTAkoAF7Z1C4aasVgDhnLx/9lU=", + "dev": true, + "requires": { + "pify": "^3.0.0", + "safe-buffer": "^5.1.1" + }, + "dependencies": { + "pify": { + "version": "3.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/pify/-/pify-3.0.0.tgz", + "integrity": "sha1-5aSs0sEB/fPZpNB/DbxNtJ3SgXY=", + "dev": true + } + } + }, + "read-pkg": { + "version": "1.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/read-pkg/-/read-pkg-1.1.0.tgz", + "integrity": "sha1-9f+qXs0pyzHAR0vKfXVra7KePyg=", + "dev": true, + "requires": { + "load-json-file": "^1.0.0", + "normalize-package-data": "^2.3.2", + "path-type": "^1.0.0" + } + }, + "read-pkg-up": { + "version": "1.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/read-pkg-up/-/read-pkg-up-1.0.1.tgz", + "integrity": "sha1-nWPBMnbAZZGNV/ACpX9AobZD+wI=", + "dev": true, + "requires": { + "find-up": "^1.0.0", + "read-pkg": "^1.0.0" + } + }, + "readable-stream": { + "version": "2.3.6", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/readable-stream/-/readable-stream-2.3.6.tgz", + "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", + "dev": true, + "requires": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" + } + }, + "readdirp": { + "version": "2.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/readdirp/-/readdirp-2.1.0.tgz", + "integrity": "sha1-TtCtBg3zBzMAxIRANz9y0cxkLXg=", + "dev": true, + "requires": { + "graceful-fs": "^4.1.2", + "minimatch": "^3.0.2", + "readable-stream": "^2.0.2", + "set-immediate-shim": "^1.0.1" + } + }, + "realpath-native": { + "version": "1.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/realpath-native/-/realpath-native-1.0.0.tgz", + "integrity": "sha512-XJtlRJ9jf0E1H1SLeJyQ9PGzQD7S65h1pRXEcAeK48doKOnKxcgPeNohJvD5u/2sI9J1oke6E8bZHS/fmW1UiQ==", + "dev": true, + "requires": { + "util.promisify": "^1.0.0" + } + }, + "recast": { + "version": "0.11.23", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/recast/-/recast-0.11.23.tgz", + "integrity": "sha1-RR/TAEqx5N+bTktmN2sqIZEkYtM=", + "dev": true, + "requires": { + "ast-types": "0.9.6", + "esprima": "~3.1.0", + "private": "~0.1.5", + "source-map": "~0.5.0" + }, + "dependencies": { + "esprima": { + "version": "3.1.3", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/esprima/-/esprima-3.1.3.tgz", + "integrity": "sha1-/cpRzuYTOJXjyI1TXOSdv/YqRjM=", + "dev": true + } + } + }, + "rechoir": { + "version": "0.6.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/rechoir/-/rechoir-0.6.2.tgz", + "integrity": "sha1-hSBLVNuoLVdC4oyWdW70OvUOM4Q=", + "dev": true, + "requires": { + "resolve": "^1.1.6" + } + }, + "redent": { + "version": "2.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/redent/-/redent-2.0.0.tgz", + "integrity": "sha1-wbIAe0LVfrE4kHmzyDM2OdXhzKo=", + "dev": true, + "requires": { + "indent-string": "^3.0.0", + "strip-indent": "^2.0.0" + } + }, + "reduce-css-calc": { + "version": "1.3.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/reduce-css-calc/-/reduce-css-calc-1.3.0.tgz", + "integrity": "sha1-dHyRTgSWFKTJz7umKYca0dKSdxY=", + "dev": true, + "requires": { + "balanced-match": "^0.4.2", + "math-expression-evaluator": "^1.2.14", + "reduce-function-call": "^1.0.1" + }, + "dependencies": { + "balanced-match": { + "version": "0.4.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/balanced-match/-/balanced-match-0.4.2.tgz", + "integrity": "sha1-yz8+PHMtwPAe5wtAPzAuYddwmDg=", + "dev": true + } + } + }, + "reduce-function-call": { + "version": "1.0.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/reduce-function-call/-/reduce-function-call-1.0.2.tgz", + "integrity": "sha1-WiAL+S4ON3UXUv5FsKszD9S2vpk=", + "dev": true, + "requires": { + "balanced-match": "^0.4.2" + }, + "dependencies": { + "balanced-match": { + "version": "0.4.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/balanced-match/-/balanced-match-0.4.2.tgz", + "integrity": "sha1-yz8+PHMtwPAe5wtAPzAuYddwmDg=", + "dev": true + } + } + }, + "reflect-metadata": { + "version": "0.1.12", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/reflect-metadata/-/reflect-metadata-0.1.12.tgz", + "integrity": "sha512-n+IyV+nGz3+0q3/Yf1ra12KpCyi001bi4XFxSjbiWWjfqb52iTTtpGXmCCAOWWIAn9KEuFZKGqBERHmrtScZ3A==" + }, + "regenerate": { + "version": "1.4.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/regenerate/-/regenerate-1.4.0.tgz", + "integrity": "sha512-1G6jJVDWrt0rK99kBjvEtziZNCICAuvIPkSiUFIQxVP06RCVpq3dmDo2oi6ABpYaDYaTRr67BEhL8r1wgEZZKg==", + "dev": true + }, + "regenerator-runtime": { + "version": "0.11.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/regenerator-runtime/-/regenerator-runtime-0.11.1.tgz", + "integrity": "sha512-MguG95oij0fC3QV3URf4V2SDYGJhJnJGqvIIgdECeODCT98wSWDAJ94SSuVpYQUoTcGUIL6L4yNB7j1DFFHSBg==", + "dev": true + }, + "regenerator-transform": { + "version": "0.10.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/regenerator-transform/-/regenerator-transform-0.10.1.tgz", + "integrity": "sha512-PJepbvDbuK1xgIgnau7Y90cwaAmO/LCLMI2mPvaXq2heGMR3aWW5/BQvYrhJ8jgmQjXewXvBjzfqKcVOmhjZ6Q==", + "dev": true, + "requires": { + "babel-runtime": "^6.18.0", + "babel-types": "^6.19.0", + "private": "^0.1.6" + } + }, + "regex-cache": { + "version": "0.4.4", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/regex-cache/-/regex-cache-0.4.4.tgz", + "integrity": "sha512-nVIZwtCjkC9YgvWkpM55B5rBhBYRZhAaJbgcFYXXsHnbZ9UZI9nnVWYZpBlCqv9ho2eZryPnWrZGsOdPwVWXWQ==", + "dev": true, + "requires": { + "is-equal-shallow": "^0.1.3" + } + }, + "regex-not": { + "version": "1.0.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/regex-not/-/regex-not-1.0.2.tgz", + "integrity": "sha512-J6SDjUgDxQj5NusnOtdFxDwN/+HWykR8GELwctJ7mdqhcyy1xEc4SRFHUXvxTp661YaVKAjfRLZ9cCqS6tn32A==", + "dev": true, + "requires": { + "extend-shallow": "^3.0.2", + "safe-regex": "^1.1.0" + } + }, + "regexp-to-ast": { + "version": "0.3.5", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/regexp-to-ast/-/regexp-to-ast-0.3.5.tgz", + "integrity": "sha512-1CJygtdvsfNFwiyjaMLBWtg2tfEqx/jSZ8S6TV+GlNL8kiH8rb4cm5Pb7A/C2BpyM/fA8ZJEudlCwi/jvAY+Ow==", + "dev": true + }, + "regexpu-core": { + "version": "1.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/regexpu-core/-/regexpu-core-1.0.0.tgz", + "integrity": "sha1-hqdj9Y7k18L2sQLkdkBQ3n7ZDGs=", + "dev": true, + "requires": { + "regenerate": "^1.2.1", + "regjsgen": "^0.2.0", + "regjsparser": "^0.1.4" + } + }, + "regjsgen": { + "version": "0.2.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/regjsgen/-/regjsgen-0.2.0.tgz", + "integrity": "sha1-bAFq3qxVT3WCP+N6wFuS1aTtsfc=", + "dev": true + }, + "regjsparser": { + "version": "0.1.5", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/regjsparser/-/regjsparser-0.1.5.tgz", + "integrity": "sha1-fuj4Tcb6eS0/0K4ijSS9lJ6tIFw=", + "dev": true, + "requires": { + "jsesc": "~0.5.0" + } + }, + "relateurl": { + "version": "0.2.7", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/relateurl/-/relateurl-0.2.7.tgz", + "integrity": "sha1-VNvzd+UUQKypCkzSdGANP/LYiKk=", + "dev": true + }, + "remove-trailing-separator": { + "version": "1.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/remove-trailing-separator/-/remove-trailing-separator-1.1.0.tgz", + "integrity": "sha1-wkvOKig62tW8P1jg1IJJuSN52O8=", + "dev": true + }, + "renderkid": { + "version": "2.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/renderkid/-/renderkid-2.0.1.tgz", + "integrity": "sha1-iYyr/Ivt5Le5ETWj/9Mj5YwNsxk=", + "dev": true, + "requires": { + "css-select": "^1.1.0", + "dom-converter": "~0.1", + "htmlparser2": "~3.3.0", + "strip-ansi": "^3.0.0", + "utila": "~0.3" + }, + "dependencies": { + "utila": { + "version": "0.3.3", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/utila/-/utila-0.3.3.tgz", + "integrity": "sha1-1+jn1+MJEHCSsF+NloiCTWM6QiY=", + "dev": true + } + } + }, + "repeat-element": { + "version": "1.1.3", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/repeat-element/-/repeat-element-1.1.3.tgz", + "integrity": "sha512-ahGq0ZnV5m5XtZLMb+vP76kcAM5nkLqk0lpqAuojSKGgQtn4eRi4ZZGm2olo2zKFH+sMsWaqOCW1dqAnOru72g==", + "dev": true + }, + "repeat-string": { + "version": "1.6.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/repeat-string/-/repeat-string-1.6.1.tgz", + "integrity": "sha1-jcrkcOHIirwtYA//Sndihtp15jc=", + "dev": true + }, + "repeating": { + "version": "2.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/repeating/-/repeating-2.0.1.tgz", + "integrity": "sha1-UhTFOpJtNVJwdSf7q0FdvAjQbdo=", + "dev": true, + "requires": { + "is-finite": "^1.0.0" + } + }, + "replace-ext": { + "version": "0.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/replace-ext/-/replace-ext-0.0.1.tgz", + "integrity": "sha1-KbvZIHinOfC8zitO5B6DeVNSKSQ=", + "dev": true + }, + "request": { + "version": "2.88.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/request/-/request-2.88.0.tgz", + "integrity": "sha512-NAqBSrijGLZdM0WZNsInLJpkJokL72XYjUpnB0iwsRgxh7dB6COrHnTBNwN0E+lHDAJzu7kLAkDeY08z2/A0hg==", + "dev": true, + "requires": { + "aws-sign2": "~0.7.0", + "aws4": "^1.8.0", + "caseless": "~0.12.0", + "combined-stream": "~1.0.6", + "extend": "~3.0.2", + "forever-agent": "~0.6.1", + "form-data": "~2.3.2", + "har-validator": "~5.1.0", + "http-signature": "~1.2.0", + "is-typedarray": "~1.0.0", + "isstream": "~0.1.2", + "json-stringify-safe": "~5.0.1", + "mime-types": "~2.1.19", + "oauth-sign": "~0.9.0", + "performance-now": "^2.1.0", + "qs": "~6.5.2", + "safe-buffer": "^5.1.2", + "tough-cookie": "~2.4.3", + "tunnel-agent": "^0.6.0", + "uuid": "^3.3.2" + } + }, + "request-promise-core": { + "version": "1.1.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/request-promise-core/-/request-promise-core-1.1.1.tgz", + "integrity": "sha1-Pu4AssWqgyOc+wTFcA2jb4HNCLY=", + "dev": true, + "requires": { + "lodash": "^4.13.1" + }, + "dependencies": { + "lodash": { + "version": "4.17.11", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/lodash/-/lodash-4.17.11.tgz", + "integrity": "sha512-cQKh8igo5QUhZ7lg38DYWAxMvjSAKG0A8wGSVimP07SIUEK2UO+arSRKbRZWtelMtN5V0Hkwh5ryOto/SshYIg==", + "dev": true + } + } + }, + "request-promise-native": { + "version": "1.0.5", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/request-promise-native/-/request-promise-native-1.0.5.tgz", + "integrity": "sha1-UoF3D2jgyXGeUWP9P6tIIhX0/aU=", + "dev": true, + "requires": { + "request-promise-core": "1.1.1", + "stealthy-require": "^1.1.0", + "tough-cookie": ">=2.3.3" + } + }, + "require-directory": { + "version": "2.1.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/require-directory/-/require-directory-2.1.1.tgz", + "integrity": "sha1-jGStX9MNqxyXbiNE/+f3kqam30I=", + "dev": true + }, + "require-from-string": { + "version": "1.2.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/require-from-string/-/require-from-string-1.2.1.tgz", + "integrity": "sha1-UpyczvJzgK3+yaL5ZbZJu+5jZBg=", + "dev": true + }, + "require-main-filename": { + "version": "1.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/require-main-filename/-/require-main-filename-1.0.1.tgz", + "integrity": "sha1-l/cXtp1IeE9fUmpsWqj/3aBVpNE=", + "dev": true + }, + "requires-port": { + "version": "1.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/requires-port/-/requires-port-1.0.0.tgz", + "integrity": "sha1-kl0mAdOaxIXgkc8NpcbmlNw9yv8=", + "dev": true + }, + "resolve": { + "version": "1.8.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/resolve/-/resolve-1.8.1.tgz", + "integrity": "sha512-AicPrAC7Qu1JxPCZ9ZgCZlY35QgFnNqc+0LtbRNxnVw4TXvjQ72wnuL9JQcEBgXkI9JM8MsT9kaQoHcpCRJOYA==", + "dev": true, + "requires": { + "path-parse": "^1.0.5" + } + }, + "resolve-cwd": { + "version": "2.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/resolve-cwd/-/resolve-cwd-2.0.0.tgz", + "integrity": "sha1-AKn3OHVW4nA46uIyyqNypqWbZlo=", + "dev": true, + "requires": { + "resolve-from": "^3.0.0" + } + }, + "resolve-dir": { + "version": "1.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/resolve-dir/-/resolve-dir-1.0.1.tgz", + "integrity": "sha1-eaQGRMNivoLybv/nOcm7U4IEb0M=", + "dev": true, + "requires": { + "expand-tilde": "^2.0.0", + "global-modules": "^1.0.0" + } + }, + "resolve-from": { + "version": "3.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/resolve-from/-/resolve-from-3.0.0.tgz", + "integrity": "sha1-six699nWiBvItuZTM17rywoYh0g=", + "dev": true + }, + "resolve-url": { + "version": "0.2.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/resolve-url/-/resolve-url-0.2.1.tgz", + "integrity": "sha1-LGN/53yJOv0qZj/iGqkIAGjiBSo=", + "dev": true + }, + "resp-modifier": { + "version": "6.0.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/resp-modifier/-/resp-modifier-6.0.2.tgz", + "integrity": "sha1-sSTeXE+6/LpUH0j/pzlw9KpFa08=", + "dev": true, + "requires": { + "debug": "^2.2.0", + "minimatch": "^3.0.2" + } + }, + "responselike": { + "version": "1.0.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/responselike/-/responselike-1.0.2.tgz", + "integrity": "sha1-kYcg7ztjHFZCvgaPFa3lpG9Loec=", + "dev": true, + "requires": { + "lowercase-keys": "^1.0.0" + } + }, + "restore-cursor": { + "version": "2.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/restore-cursor/-/restore-cursor-2.0.0.tgz", + "integrity": "sha1-n37ih/gv0ybU/RYpI9YhKe7g368=", + "dev": true, + "requires": { + "onetime": "^2.0.0", + "signal-exit": "^3.0.2" + } + }, + "ret": { + "version": "0.1.15", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/ret/-/ret-0.1.15.tgz", + "integrity": "sha512-TTlYpa+OL+vMMNG24xSlQGEJ3B/RzEfUlLct7b5G/ytav+wPrplCpVMFuwzXbkecJrb6IYo1iFb0S9v37754mg==", + "dev": true + }, + "retry": { + "version": "0.10.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/retry/-/retry-0.10.1.tgz", + "integrity": "sha1-52OI0heZLCUnUCQdPTlW/tmNj/Q=", + "dev": true + }, + "rgb-regex": { + "version": "1.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/rgb-regex/-/rgb-regex-1.0.1.tgz", + "integrity": "sha1-wODWiC3w4jviVKR16O3UGRX+rrE=", + "dev": true + }, + "rgba-regex": { + "version": "1.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/rgba-regex/-/rgba-regex-1.0.0.tgz", + "integrity": "sha1-QzdOLiyglosO8VI0YLfXMP8i7rM=", + "dev": true + }, + "right-align": { + "version": "0.1.3", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/right-align/-/right-align-0.1.3.tgz", + "integrity": "sha1-YTObci/mo1FWiSENJOFMlhSGE+8=", + "dev": true, + "optional": true, + "requires": { + "align-text": "^0.1.1" + } + }, + "rimraf": { + "version": "2.6.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/rimraf/-/rimraf-2.6.1.tgz", + "integrity": "sha1-wjOOxkPfeht/5cVPqG9XQopV8z0=", + "dev": true, + "requires": { + "glob": "^7.0.5" + } + }, + "ripemd160": { + "version": "2.0.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/ripemd160/-/ripemd160-2.0.2.tgz", + "integrity": "sha512-ii4iagi25WusVoiC4B4lq7pbXfAp3D9v5CwfkY33vffw2+pkDjY1D8GaN7spsxvCSx8dkPqOZCEZyfxcmJG2IA==", + "dev": true, + "requires": { + "hash-base": "^3.0.0", + "inherits": "^2.0.1" + } + }, + "run-async": { + "version": "2.3.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/run-async/-/run-async-2.3.0.tgz", + "integrity": "sha1-A3GrSuC91yDUFm19/aZP96RFpsA=", + "dev": true, + "requires": { + "is-promise": "^2.1.0" + } + }, + "run-node": { + "version": "1.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/run-node/-/run-node-1.0.0.tgz", + "integrity": "sha512-kc120TBlQ3mih1LSzdAJXo4xn/GWS2ec0l3S+syHDXP9uRr0JAT8Qd3mdMuyjqCzeZktgP3try92cEgf9Nks8A==", + "dev": true + }, + "run-queue": { + "version": "1.0.3", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/run-queue/-/run-queue-1.0.3.tgz", + "integrity": "sha1-6Eg5bwV9Ij8kOGkkYY4laUFh7Ec=", + "dev": true, + "requires": { + "aproba": "^1.1.1" + } + }, + "rx": { + "version": "4.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/rx/-/rx-4.1.0.tgz", + "integrity": "sha1-pfE/957zt0D+MKqAP7CfmIBdR4I=", + "dev": true + }, + "rxjs": { + "version": "6.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/rxjs/-/rxjs-6.1.0.tgz", + "integrity": "sha512-lMZdl6xbHJCSb5lmnb6nOhsoBVCyoDC5LDJQK9WWyq+tsI7KnlDIZ0r0AZAlBpRPLbwQA9kzSBAZwNIZEZ+hcw==", + "requires": { + "tslib": "^1.9.0" + } + }, + "rxjs-compat": { + "version": "6.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/rxjs-compat/-/rxjs-compat-6.1.0.tgz", + "integrity": "sha512-x5L1KQy1RqDRpPadN5iDOx71TV9Wqmlmu6OOEn3tFFgaTCB0/N+Lmby/rZHgJ6JEPzzt0nD9Zv+kS53E5JIR5g==" + }, + "safe-buffer": { + "version": "5.1.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", + "dev": true + }, + "safe-regex": { + "version": "1.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/safe-regex/-/safe-regex-1.1.0.tgz", + "integrity": "sha1-QKNmnzsHfR6UPURinhV91IAjvy4=", + "dev": true, + "requires": { + "ret": "~0.1.10" + } + }, + "safer-buffer": { + "version": "2.1.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/safer-buffer/-/safer-buffer-2.1.2.tgz", + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", + "dev": true + }, + "sane": { + "version": "2.5.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/sane/-/sane-2.5.0.tgz", + "integrity": "sha512-glfKd7YH4UCrh/7dD+UESsr8ylKWRE7UQPoXuz28FgmcF0ViJQhCTCCZHICRKxf8G8O1KdLEn20dcICK54c7ew==", + "dev": true, + "requires": { + "anymatch": "^2.0.0", + "exec-sh": "^0.2.0", + "fb-watchman": "^2.0.0", + "fsevents": "^1.1.1", + "micromatch": "^3.1.4", + "minimist": "^1.1.1", + "walker": "~1.0.5", + "watch": "~0.18.0" + } + }, + "sass": { + "version": "1.13.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/sass/-/sass-1.13.0.tgz", + "integrity": "sha512-FmA4D73dULJ2WsnbMar3P9Fj1Kd83T3YA+QTfbb2+T61epdIgAvfCR+m9mK/mQrN45stlipKoVqsdaEdLe+iDQ==", + "dev": true, + "requires": { + "chokidar": "^2.0.0" + } + }, + "sass-loader": { + "version": "7.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/sass-loader/-/sass-loader-7.1.0.tgz", + "integrity": "sha512-+G+BKGglmZM2GUSfT9TLuEp6tzehHPjAMoRRItOojWIqIGPloVCMhNIQuG639eJ+y033PaGTSjLaTHts8Kw79w==", + "dev": true, + "requires": { + "clone-deep": "^2.0.1", + "loader-utils": "^1.0.1", + "lodash.tail": "^4.1.1", + "neo-async": "^2.5.0", + "pify": "^3.0.0", + "semver": "^5.5.0" + }, + "dependencies": { + "pify": { + "version": "3.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/pify/-/pify-3.0.0.tgz", + "integrity": "sha1-5aSs0sEB/fPZpNB/DbxNtJ3SgXY=", + "dev": true + } + } + }, + "sax": { + "version": "1.2.4", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/sax/-/sax-1.2.4.tgz", + "integrity": "sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw==", + "dev": true + }, + "schema-utils": { + "version": "0.4.7", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/schema-utils/-/schema-utils-0.4.7.tgz", + "integrity": "sha512-v/iwU6wvwGK8HbU9yi3/nhGzP0yGSuhQMzL6ySiec1FSrZZDkhm4noOSWzrNFo/jEc+SJY6jRTwuwbSXJPDUnQ==", + "dev": true, + "requires": { + "ajv": "^6.1.0", + "ajv-keywords": "^3.1.0" + } + }, + "scoped-regex": { + "version": "1.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/scoped-regex/-/scoped-regex-1.0.0.tgz", + "integrity": "sha1-o0a7Gs1CB65wvXwMfKnlZra63bg=", + "dev": true + }, + "select-hose": { + "version": "2.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/select-hose/-/select-hose-2.0.0.tgz", + "integrity": "sha1-Yl2GWPhlr0Psliv8N2o3NZpJlMo=", + "dev": true + }, + "selfsigned": { + "version": "1.10.3", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/selfsigned/-/selfsigned-1.10.3.tgz", + "integrity": "sha512-vmZenZ+8Al3NLHkWnhBQ0x6BkML1eCP2xEi3JE+f3D9wW9fipD9NNJHYtE9XJM4TsPaHGZJIamrSI6MTg1dU2Q==", + "dev": true, + "requires": { + "node-forge": "0.7.5" + } + }, + "semver": { + "version": "5.6.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/semver/-/semver-5.6.0.tgz", + "integrity": "sha512-RS9R6R35NYgQn++fkDWaOmqGoj4Ek9gGs+DPxNUZKuwE183xjJroKvyo1IzVFeXvUrvmALy6FWD5xrdJT25gMg==", + "dev": true + }, + "semver-compare": { + "version": "1.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/semver-compare/-/semver-compare-1.0.0.tgz", + "integrity": "sha1-De4hahyUGrN+nvsXiPavxf9VN/w=", + "dev": true + }, + "semver-dsl": { + "version": "1.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/semver-dsl/-/semver-dsl-1.0.1.tgz", + "integrity": "sha1-02eN5VVeimH2Ke7QJTZq5fJzQKA=", + "dev": true, + "requires": { + "semver": "^5.3.0" + } + }, + "semver-intersect": { + "version": "1.3.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/semver-intersect/-/semver-intersect-1.3.1.tgz", + "integrity": "sha1-j6hKnhAovSOeRTDRo+GB5pjYhLo=", + "dev": true, + "requires": { + "semver": "^5.0.0" + } + }, + "send": { + "version": "0.16.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/send/-/send-0.16.2.tgz", + "integrity": "sha512-E64YFPUssFHEFBvpbbjr44NCLtI1AohxQ8ZSiJjQLskAdKuriYEP6VyGEsRDH8ScozGpkaX1BGvhanqCwkcEZw==", + "dev": true, + "requires": { + "debug": "2.6.9", + "depd": "~1.1.2", + "destroy": "~1.0.4", + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "etag": "~1.8.1", + "fresh": "0.5.2", + "http-errors": "~1.6.2", + "mime": "1.4.1", + "ms": "2.0.0", + "on-finished": "~2.3.0", + "range-parser": "~1.2.0", + "statuses": "~1.4.0" + }, + "dependencies": { + "statuses": { + "version": "1.4.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/statuses/-/statuses-1.4.0.tgz", + "integrity": "sha512-zhSCtt8v2NDrRlPQpCNtw/heZLtfUDqxBM1udqikb/Hbk52LK4nQSwr10u77iopCW5LsyHpuXS0GnEc48mLeew==", + "dev": true + } + } + }, + "serialize-javascript": { + "version": "1.5.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/serialize-javascript/-/serialize-javascript-1.5.0.tgz", + "integrity": "sha512-Ga8c8NjAAp46Br4+0oZ2WxJCwIzwP60Gq1YPgU+39PiTVxyed/iKE/zyZI6+UlVYH5Q4PaQdHhcegIFPZTUfoQ==", + "dev": true + }, + "serve-index": { + "version": "1.9.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/serve-index/-/serve-index-1.9.1.tgz", + "integrity": "sha1-03aNabHn2C5c4FD/9bRTvqEqkjk=", + "dev": true, + "requires": { + "accepts": "~1.3.4", + "batch": "0.6.1", + "debug": "2.6.9", + "escape-html": "~1.0.3", + "http-errors": "~1.6.2", + "mime-types": "~2.1.17", + "parseurl": "~1.3.2" + } + }, + "serve-static": { + "version": "1.13.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/serve-static/-/serve-static-1.13.2.tgz", + "integrity": "sha512-p/tdJrO4U387R9oMjb1oj7qSMaMfmOyd4j9hOFoxZe2baQszgHcSWjuya/CiT5kgZZKRudHNOA0pYXOl8rQ5nw==", + "dev": true, + "requires": { + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "parseurl": "~1.3.2", + "send": "0.16.2" + } + }, + "server-destroy": { + "version": "1.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/server-destroy/-/server-destroy-1.0.1.tgz", + "integrity": "sha1-8Tv5KOQrnD55OD5hzDmYtdFObN0=", + "dev": true + }, + "set-blocking": { + "version": "2.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/set-blocking/-/set-blocking-2.0.0.tgz", + "integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc=", + "dev": true + }, + "set-immediate-shim": { + "version": "1.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/set-immediate-shim/-/set-immediate-shim-1.0.1.tgz", + "integrity": "sha1-SysbJ+uAip+NzEgaWOXlb1mfP2E=", + "dev": true + }, + "set-value": { + "version": "2.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/set-value/-/set-value-2.0.0.tgz", + "integrity": "sha512-hw0yxk9GT/Hr5yJEYnHNKYXkIA8mVJgd9ditYZCe16ZczcaELYYcfvaXesNACk2O8O0nTiPQcQhGUQj8JLzeeg==", + "dev": true, + "requires": { + "extend-shallow": "^2.0.1", + "is-extendable": "^0.1.1", + "is-plain-object": "^2.0.3", + "split-string": "^3.0.1" + }, + "dependencies": { + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "dev": true, + "requires": { + "is-extendable": "^0.1.0" + } + } + } + }, + "setimmediate": { + "version": "1.0.5", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/setimmediate/-/setimmediate-1.0.5.tgz", + "integrity": "sha1-KQy7Iy4waULX1+qbg3Mqt4VvgoU=", + "dev": true + }, + "setprototypeof": { + "version": "1.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/setprototypeof/-/setprototypeof-1.1.0.tgz", + "integrity": "sha512-BvE/TwpZX4FXExxOxZyRGQQv651MSwmWKZGqvmPcRIjDqWub67kTKuIMx43cZZrS/cBBzwBcNDWoFxt2XEFIpQ==", + "dev": true + }, + "sha.js": { + "version": "2.4.11", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/sha.js/-/sha.js-2.4.11.tgz", + "integrity": "sha512-QMEp5B7cftE7APOjk5Y6xgrbWu+WkLVQwk8JNjZ8nKRciZaByEW6MubieAiToS7+dwvrjGhH8jRXz3MVd0AYqQ==", + "dev": true, + "requires": { + "inherits": "^2.0.1", + "safe-buffer": "^5.0.1" + } + }, + "shallow-clone": { + "version": "1.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/shallow-clone/-/shallow-clone-1.0.0.tgz", + "integrity": "sha512-oeXreoKR/SyNJtRJMAKPDSvd28OqEwG4eR/xc856cRGBII7gX9lvAqDxusPm0846z/w/hWYjI1NpKwJ00NHzRA==", + "dev": true, + "requires": { + "is-extendable": "^0.1.1", + "kind-of": "^5.0.0", + "mixin-object": "^2.0.1" + }, + "dependencies": { + "kind-of": { + "version": "5.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/kind-of/-/kind-of-5.1.0.tgz", + "integrity": "sha512-NGEErnH6F2vUuXDh+OlbcKW7/wOcfdRHaZ7VWtqCztfHri/++YKmP51OdWeGPuqCOba6kk2OTe5d02VmTB80Pw==", + "dev": true + } + } + }, + "shebang-command": { + "version": "1.2.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/shebang-command/-/shebang-command-1.2.0.tgz", + "integrity": "sha1-RKrGW2lbAzmJaMOfNj/uXer98eo=", + "dev": true, + "requires": { + "shebang-regex": "^1.0.0" + } + }, + "shebang-regex": { + "version": "1.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/shebang-regex/-/shebang-regex-1.0.0.tgz", + "integrity": "sha1-2kL0l0DAtC2yypcoVxyxkMmO/qM=", + "dev": true + }, + "shell-quote": { + "version": "1.6.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/shell-quote/-/shell-quote-1.6.1.tgz", + "integrity": "sha1-9HgZSczkAmlxJ0MOo7PFR29IF2c=", + "dev": true, + "requires": { + "array-filter": "~0.0.0", + "array-map": "~0.0.0", + "array-reduce": "~0.0.0", + "jsonify": "~0.0.0" + } + }, + "shelljs": { + "version": "0.8.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/shelljs/-/shelljs-0.8.2.tgz", + "integrity": "sha512-pRXeNrCA2Wd9itwhvLp5LZQvPJ0wU6bcjaTMywHHGX5XWhVN2nzSu7WV0q+oUY7mGK3mgSkDDzP3MgjqdyIgbQ==", + "dev": true, + "requires": { + "glob": "^7.0.0", + "interpret": "^1.0.0", + "rechoir": "^0.6.2" + } + }, + "shellwords": { + "version": "0.1.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/shellwords/-/shellwords-0.1.1.tgz", + "integrity": "sha512-vFwSUfQvqybiICwZY5+DAWIPLKsWO31Q91JSKl3UYv+K5c2QRPzn0qzec6QPu1Qc9eHYItiP3NdJqNVqetYAww==", + "dev": true + }, + "signal-exit": { + "version": "3.0.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/signal-exit/-/signal-exit-3.0.2.tgz", + "integrity": "sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0=", + "dev": true + }, + "simple-progress-webpack-plugin": { + "version": "1.1.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/simple-progress-webpack-plugin/-/simple-progress-webpack-plugin-1.1.2.tgz", + "integrity": "sha512-bNQfb3qSqbtsfxg6d0dGechUUJH2lZqKG5+bj2aoJmEA0rSzcm+2JVfC2YgkDABfuGItZ/O5ttt6BssWZW4SNg==", + "dev": true, + "requires": { + "chalk": "2.3.x", + "figures": "2.0.x", + "log-update": "2.3.x" + }, + "dependencies": { + "ansi-regex": { + "version": "3.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/ansi-regex/-/ansi-regex-3.0.0.tgz", + "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", + "dev": true + }, + "ansi-styles": { + "version": "3.2.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, + "requires": { + "color-convert": "^1.9.0" + } + }, + "chalk": { + "version": "2.3.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/chalk/-/chalk-2.3.2.tgz", + "integrity": "sha512-ZM4j2/ld/YZDc3Ma8PgN7gyAk+kHMMMyzLNryCPGhWrsfAuDVeuid5bpRFTDgMH9JBK2lA4dyyAkkZYF/WcqDQ==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + } + }, + "has-flag": { + "version": "3.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", + "dev": true + }, + "is-fullwidth-code-point": { + "version": "2.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", + "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", + "dev": true + }, + "log-update": { + "version": "2.3.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/log-update/-/log-update-2.3.0.tgz", + "integrity": "sha1-iDKP19HOeTiykoN0bwsbwSayRwg=", + "dev": true, + "requires": { + "ansi-escapes": "^3.0.0", + "cli-cursor": "^2.0.0", + "wrap-ansi": "^3.0.1" + } + }, + "string-width": { + "version": "2.1.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/string-width/-/string-width-2.1.1.tgz", + "integrity": "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==", + "dev": true, + "requires": { + "is-fullwidth-code-point": "^2.0.0", + "strip-ansi": "^4.0.0" + } + }, + "strip-ansi": { + "version": "4.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/strip-ansi/-/strip-ansi-4.0.0.tgz", + "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", + "dev": true, + "requires": { + "ansi-regex": "^3.0.0" + } + }, + "supports-color": { + "version": "5.5.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } + }, + "wrap-ansi": { + "version": "3.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/wrap-ansi/-/wrap-ansi-3.0.1.tgz", + "integrity": "sha1-KIoE2H7aXChuBg3+jxNc6NAH+Lo=", + "dev": true, + "requires": { + "string-width": "^2.1.1", + "strip-ansi": "^4.0.0" + } + } + } + }, + "simple-swizzle": { + "version": "0.2.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/simple-swizzle/-/simple-swizzle-0.2.2.tgz", + "integrity": "sha1-pNprY1/8zMoz9w0Xy5JZLeleVXo=", + "dev": true, + "requires": { + "is-arrayish": "^0.3.1" + }, + "dependencies": { + "is-arrayish": { + "version": "0.3.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/is-arrayish/-/is-arrayish-0.3.2.tgz", + "integrity": "sha512-eVRqCvVlZbuw3GrM63ovNSNAeA1K16kaR/LRY/92w0zxQ5/1YzwblUX652i4Xs9RwAGjW9d9y6X88t8OaAJfWQ==", + "dev": true + } + } + }, + "slash": { + "version": "1.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/slash/-/slash-1.0.0.tgz", + "integrity": "sha1-xB8vbDn8FtHNF61LXYlhFK5HDVU=", + "dev": true + }, + "slice-ansi": { + "version": "0.0.4", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/slice-ansi/-/slice-ansi-0.0.4.tgz", + "integrity": "sha1-7b+JA/ZvfOL46v1s7tZeJkyDGzU=", + "dev": true + }, + "slide": { + "version": "1.1.6", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/slide/-/slide-1.1.6.tgz", + "integrity": "sha1-VusCfWW00tzmyy4tMsTUr8nh1wc=", + "dev": true + }, + "snapdragon": { + "version": "0.8.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/snapdragon/-/snapdragon-0.8.2.tgz", + "integrity": "sha512-FtyOnWN/wCHTVXOMwvSv26d+ko5vWlIDD6zoUJ7LW8vh+ZBC8QdljveRP+crNrtBwioEUWy/4dMtbBjA4ioNlg==", + "dev": true, + "requires": { + "base": "^0.11.1", + "debug": "^2.2.0", + "define-property": "^0.2.5", + "extend-shallow": "^2.0.1", + "map-cache": "^0.2.2", + "source-map": "^0.5.6", + "source-map-resolve": "^0.5.0", + "use": "^3.1.0" + }, + "dependencies": { + "define-property": { + "version": "0.2.5", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/define-property/-/define-property-0.2.5.tgz", + "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", + "dev": true, + "requires": { + "is-descriptor": "^0.1.0" + } + }, + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "dev": true, + "requires": { + "is-extendable": "^0.1.0" + } + } + } + }, + "snapdragon-node": { + "version": "2.1.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/snapdragon-node/-/snapdragon-node-2.1.1.tgz", + "integrity": "sha512-O27l4xaMYt/RSQ5TR3vpWCAB5Kb/czIcqUFOM/C4fYcLnbZUc1PkjTAMjof2pBWaSTwOUd6qUHcFGVGj7aIwnw==", + "dev": true, + "requires": { + "define-property": "^1.0.0", + "isobject": "^3.0.0", + "snapdragon-util": "^3.0.1" + }, + "dependencies": { + "define-property": { + "version": "1.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/define-property/-/define-property-1.0.0.tgz", + "integrity": "sha1-dp66rz9KY6rTr56NMEybvnm/sOY=", + "dev": true, + "requires": { + "is-descriptor": "^1.0.0" + } + }, + "is-accessor-descriptor": { + "version": "1.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz", + "integrity": "sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ==", + "dev": true, + "requires": { + "kind-of": "^6.0.0" + } + }, + "is-data-descriptor": { + "version": "1.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz", + "integrity": "sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ==", + "dev": true, + "requires": { + "kind-of": "^6.0.0" + } + }, + "is-descriptor": { + "version": "1.0.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/is-descriptor/-/is-descriptor-1.0.2.tgz", + "integrity": "sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg==", + "dev": true, + "requires": { + "is-accessor-descriptor": "^1.0.0", + "is-data-descriptor": "^1.0.0", + "kind-of": "^6.0.2" + } + } + } + }, + "snapdragon-util": { + "version": "3.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/snapdragon-util/-/snapdragon-util-3.0.1.tgz", + "integrity": "sha512-mbKkMdQKsjX4BAL4bRYTj21edOf8cN7XHdYUJEe+Zn99hVEYcMvKPct1IqNe7+AZPirn8BCDOQBHQZknqmKlZQ==", + "dev": true, + "requires": { + "kind-of": "^3.2.0" + }, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true, + "requires": { + "is-buffer": "^1.1.5" + } + } + } + }, + "socket.io": { + "version": "2.1.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/socket.io/-/socket.io-2.1.1.tgz", + "integrity": "sha512-rORqq9c+7W0DAK3cleWNSyfv/qKXV99hV4tZe+gGLfBECw3XEhBy7x85F3wypA9688LKjtwO9pX9L33/xQI8yA==", + "dev": true, + "requires": { + "debug": "~3.1.0", + "engine.io": "~3.2.0", + "has-binary2": "~1.0.2", + "socket.io-adapter": "~1.1.0", + "socket.io-client": "2.1.1", + "socket.io-parser": "~3.2.0" + }, + "dependencies": { + "debug": { + "version": "3.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/debug/-/debug-3.1.0.tgz", + "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", + "dev": true, + "requires": { + "ms": "2.0.0" + } + }, + "engine.io-client": { + "version": "3.2.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/engine.io-client/-/engine.io-client-3.2.1.tgz", + "integrity": "sha512-y5AbkytWeM4jQr7m/koQLc5AxpRKC1hEVUb/s1FUAWEJq5AzJJ4NLvzuKPuxtDi5Mq755WuDvZ6Iv2rXj4PTzw==", + "dev": true, + "requires": { + "component-emitter": "1.2.1", + "component-inherit": "0.0.3", + "debug": "~3.1.0", + "engine.io-parser": "~2.1.1", + "has-cors": "1.1.0", + "indexof": "0.0.1", + "parseqs": "0.0.5", + "parseuri": "0.0.5", + "ws": "~3.3.1", + "xmlhttprequest-ssl": "~1.5.4", + "yeast": "0.1.2" + } + }, + "isarray": { + "version": "2.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/isarray/-/isarray-2.0.1.tgz", + "integrity": "sha1-o32U7ZzaLVmGXJ92/llu4fM4dB4=", + "dev": true + }, + "socket.io-client": { + "version": "2.1.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/socket.io-client/-/socket.io-client-2.1.1.tgz", + "integrity": "sha512-jxnFyhAuFxYfjqIgduQlhzqTcOEQSn+OHKVfAxWaNWa7ecP7xSNk2Dx/3UEsDcY7NcFafxvNvKPmmO7HTwTxGQ==", + "dev": true, + "requires": { + "backo2": "1.0.2", + "base64-arraybuffer": "0.1.5", + "component-bind": "1.0.0", + "component-emitter": "1.2.1", + "debug": "~3.1.0", + "engine.io-client": "~3.2.0", + "has-binary2": "~1.0.2", + "has-cors": "1.1.0", + "indexof": "0.0.1", + "object-component": "0.0.3", + "parseqs": "0.0.5", + "parseuri": "0.0.5", + "socket.io-parser": "~3.2.0", + "to-array": "0.1.4" + } + }, + "socket.io-parser": { + "version": "3.2.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/socket.io-parser/-/socket.io-parser-3.2.0.tgz", + "integrity": "sha512-FYiBx7rc/KORMJlgsXysflWx/RIvtqZbyGLlHZvjfmPTPeuD/I8MaW7cfFrj5tRltICJdgwflhfZ3NVVbVLFQA==", + "dev": true, + "requires": { + "component-emitter": "1.2.1", + "debug": "~3.1.0", + "isarray": "2.0.1" + } + } + } + }, + "socket.io-adapter": { + "version": "1.1.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/socket.io-adapter/-/socket.io-adapter-1.1.1.tgz", + "integrity": "sha1-KoBeihTWNyEk3ZFZrUUC+MsH8Gs=", + "dev": true + }, + "socket.io-client": { + "version": "2.0.4", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/socket.io-client/-/socket.io-client-2.0.4.tgz", + "integrity": "sha1-CRilUkBtxeVAs4Dc2Xr8SmQzL44=", + "dev": true, + "requires": { + "backo2": "1.0.2", + "base64-arraybuffer": "0.1.5", + "component-bind": "1.0.0", + "component-emitter": "1.2.1", + "debug": "~2.6.4", + "engine.io-client": "~3.1.0", + "has-cors": "1.1.0", + "indexof": "0.0.1", + "object-component": "0.0.3", + "parseqs": "0.0.5", + "parseuri": "0.0.5", + "socket.io-parser": "~3.1.1", + "to-array": "0.1.4" + } + }, + "socket.io-parser": { + "version": "3.1.3", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/socket.io-parser/-/socket.io-parser-3.1.3.tgz", + "integrity": "sha512-g0a2HPqLguqAczs3dMECuA1RgoGFPyvDqcbaDEdCWY9g59kdUAz3YRmaJBNKXflrHNwB7Q12Gkf/0CZXfdHR7g==", + "dev": true, + "requires": { + "component-emitter": "1.2.1", + "debug": "~3.1.0", + "has-binary2": "~1.0.2", + "isarray": "2.0.1" + }, + "dependencies": { + "debug": { + "version": "3.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/debug/-/debug-3.1.0.tgz", + "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", + "dev": true, + "requires": { + "ms": "2.0.0" + } + }, + "isarray": { + "version": "2.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/isarray/-/isarray-2.0.1.tgz", + "integrity": "sha1-o32U7ZzaLVmGXJ92/llu4fM4dB4=", + "dev": true + } + } + }, + "sockjs": { + "version": "0.3.19", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/sockjs/-/sockjs-0.3.19.tgz", + "integrity": "sha512-V48klKZl8T6MzatbLlzzRNhMepEys9Y4oGFpypBFFn1gLI/QQ9HtLLyWJNbPlwGLelOVOEijUbTTJeLLI59jLw==", + "dev": true, + "requires": { + "faye-websocket": "^0.10.0", + "uuid": "^3.0.1" + } + }, + "sockjs-client": { + "version": "1.1.5", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/sockjs-client/-/sockjs-client-1.1.5.tgz", + "integrity": "sha1-G7fA9yIsQPQq3xT0RCy9Eml3GoM=", + "dev": true, + "requires": { + "debug": "^2.6.6", + "eventsource": "0.1.6", + "faye-websocket": "~0.11.0", + "inherits": "^2.0.1", + "json3": "^3.3.2", + "url-parse": "^1.1.8" + }, + "dependencies": { + "faye-websocket": { + "version": "0.11.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/faye-websocket/-/faye-websocket-0.11.1.tgz", + "integrity": "sha1-8O/hjE9W5PQK/H4Gxxn9XuYYjzg=", + "dev": true, + "requires": { + "websocket-driver": ">=0.5.1" + } + } + } + }, + "sort-keys": { + "version": "1.1.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/sort-keys/-/sort-keys-1.1.2.tgz", + "integrity": "sha1-RBttTTRnmPG05J6JIK37oOVD+a0=", + "dev": true, + "requires": { + "is-plain-obj": "^1.0.0" + } + }, + "source-list-map": { + "version": "2.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/source-list-map/-/source-list-map-2.0.0.tgz", + "integrity": "sha512-I2UmuJSRr/T8jisiROLU3A3ltr+swpniSmNPI4Ml3ZCX6tVnDsuZzK7F2hl5jTqbZBWCEKlj5HRQiPExXLgE8A==", + "dev": true + }, + "source-map": { + "version": "0.5.7", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/source-map/-/source-map-0.5.7.tgz", + "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=", + "dev": true + }, + "source-map-resolve": { + "version": "0.5.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/source-map-resolve/-/source-map-resolve-0.5.2.tgz", + "integrity": "sha512-MjqsvNwyz1s0k81Goz/9vRBe9SZdB09Bdw+/zYyO+3CuPk6fouTaxscHkgtE8jKvf01kVfl8riHzERQ/kefaSA==", + "dev": true, + "requires": { + "atob": "^2.1.1", + "decode-uri-component": "^0.2.0", + "resolve-url": "^0.2.1", + "source-map-url": "^0.4.0", + "urix": "^0.1.0" + } + }, + "source-map-support": { + "version": "0.5.6", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/source-map-support/-/source-map-support-0.5.6.tgz", + "integrity": "sha512-N4KXEz7jcKqPf2b2vZF11lQIz9W5ZMuUcIOGj243lduidkf2fjkVKJS9vNxVWn3u/uxX38AcE8U9nnH9FPcq+g==", + "dev": true, + "requires": { + "buffer-from": "^1.0.0", + "source-map": "^0.6.0" + }, + "dependencies": { + "source-map": { + "version": "0.6.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "dev": true + } + } + }, + "source-map-url": { + "version": "0.4.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/source-map-url/-/source-map-url-0.4.0.tgz", + "integrity": "sha1-PpNdfd1zYxuXZZlW1VEo6HtQhKM=", + "dev": true + }, + "spawn-sync": { + "version": "1.0.15", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/spawn-sync/-/spawn-sync-1.0.15.tgz", + "integrity": "sha1-sAeZVX63+wyDdsKdROih6mfldHY=", + "dev": true, + "requires": { + "concat-stream": "^1.4.7", + "os-shim": "^0.1.2" + } + }, + "spdx-correct": { + "version": "3.0.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/spdx-correct/-/spdx-correct-3.0.2.tgz", + "integrity": "sha512-q9hedtzyXHr5S0A1vEPoK/7l8NpfkFYTq6iCY+Pno2ZbdZR6WexZFtqeVGkGxW3TEJMN914Z55EnAGMmenlIQQ==", + "dev": true, + "requires": { + "spdx-expression-parse": "^3.0.0", + "spdx-license-ids": "^3.0.0" + } + }, + "spdx-exceptions": { + "version": "2.2.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/spdx-exceptions/-/spdx-exceptions-2.2.0.tgz", + "integrity": "sha512-2XQACfElKi9SlVb1CYadKDXvoajPgBVPn/gOQLrTvHdElaVhr7ZEbqJaRnJLVNeaI4cMEAgVCeBMKF6MWRDCRA==", + "dev": true + }, + "spdx-expression-parse": { + "version": "3.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/spdx-expression-parse/-/spdx-expression-parse-3.0.0.tgz", + "integrity": "sha512-Yg6D3XpRD4kkOmTpdgbUiEJFKghJH03fiC1OPll5h/0sO6neh2jqRDVHOQ4o/LMea0tgCkbMgea5ip/e+MkWyg==", + "dev": true, + "requires": { + "spdx-exceptions": "^2.1.0", + "spdx-license-ids": "^3.0.0" + } + }, + "spdx-license-ids": { + "version": "3.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/spdx-license-ids/-/spdx-license-ids-3.0.1.tgz", + "integrity": "sha512-TfOfPcYGBB5sDuPn3deByxPhmfegAhpDYKSOXZQN81Oyrrif8ZCodOLzK3AesELnCx03kikhyDwh0pfvvQvF8w==", + "dev": true + }, + "spdy": { + "version": "3.4.7", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/spdy/-/spdy-3.4.7.tgz", + "integrity": "sha1-Qv9B7OXMD5mjpsKKq7c/XDsDrLw=", + "dev": true, + "requires": { + "debug": "^2.6.8", + "handle-thing": "^1.2.5", + "http-deceiver": "^1.2.7", + "safe-buffer": "^5.0.1", + "select-hose": "^2.0.0", + "spdy-transport": "^2.0.18" + } + }, + "spdy-transport": { + "version": "2.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/spdy-transport/-/spdy-transport-2.1.0.tgz", + "integrity": "sha512-bpUeGpZcmZ692rrTiqf9/2EUakI6/kXX1Rpe0ib/DyOzbiexVfXkw6GnvI9hVGvIwVaUhkaBojjCZwLNRGQg1g==", + "dev": true, + "requires": { + "debug": "^2.6.8", + "detect-node": "^2.0.3", + "hpack.js": "^2.1.6", + "obuf": "^1.1.1", + "readable-stream": "^2.2.9", + "safe-buffer": "^5.0.1", + "wbuf": "^1.7.2" + } + }, + "split-string": { + "version": "3.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/split-string/-/split-string-3.1.0.tgz", + "integrity": "sha512-NzNVhJDYpwceVVii8/Hu6DKfD2G+NrQHlS/V/qgv763EYudVwEcMQNxd2lh+0VrUByXN/oJkl5grOhYWvQUYiw==", + "dev": true, + "requires": { + "extend-shallow": "^3.0.0" + } + }, + "sprintf-js": { + "version": "1.1.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/sprintf-js/-/sprintf-js-1.1.1.tgz", + "integrity": "sha1-Nr54Mgr+WAH2zqPueLblqrlA6gw=", + "dev": true + }, + "sshpk": { + "version": "1.15.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/sshpk/-/sshpk-1.15.1.tgz", + "integrity": "sha512-mSdgNUaidk+dRU5MhYtN9zebdzF2iG0cNPWy8HG+W8y+fT1JnSkh0fzzpjOa0L7P8i1Rscz38t0h4gPcKz43xA==", + "dev": true, + "requires": { + "asn1": "~0.2.3", + "assert-plus": "^1.0.0", + "bcrypt-pbkdf": "^1.0.0", + "dashdash": "^1.12.0", + "ecc-jsbn": "~0.1.1", + "getpass": "^0.1.1", + "jsbn": "~0.1.0", + "safer-buffer": "^2.0.2", + "tweetnacl": "~0.14.0" + } + }, + "ssri": { + "version": "5.3.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/ssri/-/ssri-5.3.0.tgz", + "integrity": "sha512-XRSIPqLij52MtgoQavH/x/dU1qVKtWUAAZeOHsR9c2Ddi4XerFy3mc1alf+dLJKl9EUIm/Ht+EowFkTUOA6GAQ==", + "dev": true, + "requires": { + "safe-buffer": "^5.1.1" + } + }, + "stable": { + "version": "0.1.8", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/stable/-/stable-0.1.8.tgz", + "integrity": "sha512-ji9qxRnOVfcuLDySj9qzhGSEFVobyt1kIOSkj1qZzYLzq7Tos/oUUWvotUPQLlrsidqsK6tBH89Bc9kL5zHA6w==", + "dev": true + }, + "stack-trace": { + "version": "0.0.10", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/stack-trace/-/stack-trace-0.0.10.tgz", + "integrity": "sha1-VHxws0fo0ytOEI6hoqFZ5f3eGcA=", + "dev": true + }, + "stack-utils": { + "version": "1.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/stack-utils/-/stack-utils-1.0.1.tgz", + "integrity": "sha1-1PM6tU6OOHeLDKXP07OvsS22hiA=", + "dev": true + }, + "stackframe": { + "version": "1.0.4", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/stackframe/-/stackframe-1.0.4.tgz", + "integrity": "sha512-to7oADIniaYwS3MhtCa/sQhrxidCCQiF/qp4/m5iN3ipf0Y7Xlri0f6eG29r08aL7JYl8n32AF3Q5GYBZ7K8vw==", + "dev": true + }, + "staged-git-files": { + "version": "1.1.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/staged-git-files/-/staged-git-files-1.1.1.tgz", + "integrity": "sha512-H89UNKr1rQJvI1c/PIR3kiAMBV23yvR7LItZiV74HWZwzt7f3YHuujJ9nJZlt58WlFox7XQsOahexwk7nTe69A==", + "dev": true + }, + "static-extend": { + "version": "0.1.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/static-extend/-/static-extend-0.1.2.tgz", + "integrity": "sha1-YICcOcv/VTNyJv1eC1IPNB8ftcY=", + "dev": true, + "requires": { + "define-property": "^0.2.5", + "object-copy": "^0.1.0" + }, + "dependencies": { + "define-property": { + "version": "0.2.5", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/define-property/-/define-property-0.2.5.tgz", + "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", + "dev": true, + "requires": { + "is-descriptor": "^0.1.0" + } + } + } + }, + "statuses": { + "version": "1.3.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/statuses/-/statuses-1.3.1.tgz", + "integrity": "sha1-+vUbnrdKrvOzrPStX2Gr8ky3uT4=", + "dev": true + }, + "stealthy-require": { + "version": "1.1.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/stealthy-require/-/stealthy-require-1.1.1.tgz", + "integrity": "sha1-NbCYdbT/SfJqd35QmzCQoyJr8ks=", + "dev": true + }, + "stream-browserify": { + "version": "2.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/stream-browserify/-/stream-browserify-2.0.1.tgz", + "integrity": "sha1-ZiZu5fm9uZQKTkUUyvtDu3Hlyds=", + "dev": true, + "requires": { + "inherits": "~2.0.1", + "readable-stream": "^2.0.2" + } + }, + "stream-each": { + "version": "1.2.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/stream-each/-/stream-each-1.2.2.tgz", + "integrity": "sha512-mc1dbFhGBxvTM3bIWmAAINbqiuAk9TATcfIQC8P+/+HJefgaiTlMn2dHvkX8qlI12KeYKSQ1Ua9RrIqrn1VPoA==", + "dev": true, + "requires": { + "end-of-stream": "^1.1.0", + "stream-shift": "^1.0.0" + } + }, + "stream-http": { + "version": "2.8.3", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/stream-http/-/stream-http-2.8.3.tgz", + "integrity": "sha512-+TSkfINHDo4J+ZobQLWiMouQYB+UVYFttRA94FpEzzJ7ZdqcL4uUUQ7WkdkI4DSozGmgBUE/a47L+38PenXhUw==", + "dev": true, + "requires": { + "builtin-status-codes": "^3.0.0", + "inherits": "^2.0.1", + "readable-stream": "^2.3.6", + "to-arraybuffer": "^1.0.0", + "xtend": "^4.0.0" + } + }, + "stream-shift": { + "version": "1.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/stream-shift/-/stream-shift-1.0.0.tgz", + "integrity": "sha1-1cdSgl5TZ+eG944Y5EXqIjoVWVI=", + "dev": true + }, + "stream-throttle": { + "version": "0.1.3", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/stream-throttle/-/stream-throttle-0.1.3.tgz", + "integrity": "sha1-rdV8jXzHOoFjDTHNVdOWHPr7qcM=", + "dev": true, + "requires": { + "commander": "^2.2.0", + "limiter": "^1.0.5" + } + }, + "stream-to-observable": { + "version": "0.2.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/stream-to-observable/-/stream-to-observable-0.2.0.tgz", + "integrity": "sha1-WdbqOT2HwsDdrBCqDVYbxrpvDhA=", + "dev": true, + "requires": { + "any-observable": "^0.2.0" + }, + "dependencies": { + "any-observable": { + "version": "0.2.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/any-observable/-/any-observable-0.2.0.tgz", + "integrity": "sha1-xnhwBYADV5AJCD9UrAq6+1wz0kI=", + "dev": true + } + } + }, + "streamfilter": { + "version": "1.0.7", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/streamfilter/-/streamfilter-1.0.7.tgz", + "integrity": "sha512-Gk6KZM+yNA1JpW0KzlZIhjo3EaBJDkYfXtYSbOwNIQ7Zd6006E6+sCFlW1NDvFG/vnXhKmw6TJJgiEQg/8lXfQ==", + "dev": true, + "requires": { + "readable-stream": "^2.0.2" + } + }, + "strict-uri-encode": { + "version": "1.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/strict-uri-encode/-/strict-uri-encode-1.1.0.tgz", + "integrity": "sha1-J5siXfHVgrH1TmWt3UNS4Y+qBxM=", + "dev": true + }, + "string-argv": { + "version": "0.0.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/string-argv/-/string-argv-0.0.2.tgz", + "integrity": "sha1-2sMECGkMIfPDYwo/86BYd73L1zY=", + "dev": true + }, + "string-length": { + "version": "2.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/string-length/-/string-length-2.0.0.tgz", + "integrity": "sha1-1A27aGo6zpYMHP/KVivyxF+DY+0=", + "dev": true, + "requires": { + "astral-regex": "^1.0.0", + "strip-ansi": "^4.0.0" + }, + "dependencies": { + "ansi-regex": { + "version": "3.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/ansi-regex/-/ansi-regex-3.0.0.tgz", + "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", + "dev": true + }, + "strip-ansi": { + "version": "4.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/strip-ansi/-/strip-ansi-4.0.0.tgz", + "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", + "dev": true, + "requires": { + "ansi-regex": "^3.0.0" + } + } + } + }, + "string-template": { + "version": "0.2.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/string-template/-/string-template-0.2.1.tgz", + "integrity": "sha1-QpMuWYo1LQH8IuwzZ9nYTuxsmt0=", + "dev": true + }, + "string-width": { + "version": "1.0.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/string-width/-/string-width-1.0.2.tgz", + "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", + "dev": true, + "requires": { + "code-point-at": "^1.0.0", + "is-fullwidth-code-point": "^1.0.0", + "strip-ansi": "^3.0.0" + } + }, + "string_decoder": { + "version": "1.1.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/string_decoder/-/string_decoder-1.1.1.tgz", + "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", + "dev": true, + "requires": { + "safe-buffer": "~5.1.0" + } + }, + "stringify-object": { + "version": "3.2.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/stringify-object/-/stringify-object-3.2.2.tgz", + "integrity": "sha512-O696NF21oLiDy8PhpWu8AEqoZHw++QW6mUv0UvKZe8gWSdSvMXkiLufK7OmnP27Dro4GU5kb9U7JIO0mBuCRQg==", + "dev": true, + "requires": { + "get-own-enumerable-property-symbols": "^2.0.1", + "is-obj": "^1.0.1", + "is-regexp": "^1.0.0" + } + }, + "strip-ansi": { + "version": "3.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/strip-ansi/-/strip-ansi-3.0.1.tgz", + "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", + "dev": true, + "requires": { + "ansi-regex": "^2.0.0" + } + }, + "strip-bom": { + "version": "2.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/strip-bom/-/strip-bom-2.0.0.tgz", + "integrity": "sha1-YhmoVhZSBJHzV4i9vxRHqZx+aw4=", + "dev": true, + "requires": { + "is-utf8": "^0.2.0" + } + }, + "strip-bom-stream": { + "version": "2.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/strip-bom-stream/-/strip-bom-stream-2.0.0.tgz", + "integrity": "sha1-+H217yYT9paKpUWr/h7HKLaoKco=", + "dev": true, + "requires": { + "first-chunk-stream": "^2.0.0", + "strip-bom": "^2.0.0" + } + }, + "strip-comments": { + "version": "1.0.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/strip-comments/-/strip-comments-1.0.2.tgz", + "integrity": "sha512-kL97alc47hoyIQSV165tTt9rG5dn4w1dNnBhOQ3bOU1Nc1hel09jnXANaHJ7vzHLd4Ju8kseDGzlev96pghLFw==", + "dev": true, + "requires": { + "babel-extract-comments": "^1.0.0", + "babel-plugin-transform-object-rest-spread": "^6.26.0" + } + }, + "strip-eof": { + "version": "1.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/strip-eof/-/strip-eof-1.0.0.tgz", + "integrity": "sha1-u0P/VZim6wXYm1n80SnJgzE2Br8=", + "dev": true + }, + "strip-indent": { + "version": "2.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/strip-indent/-/strip-indent-2.0.0.tgz", + "integrity": "sha1-XvjbKV0B5u1sv3qrlpmNeCJSe2g=", + "dev": true + }, + "style-loader": { + "version": "0.20.3", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/style-loader/-/style-loader-0.20.3.tgz", + "integrity": "sha512-2I7AVP73MvK33U7B9TKlYZAqdROyMXDYSMvHLX43qy3GCOaJNiV6i0v/sv9idWIaQ42Yn2dNv79Q5mKXbKhAZg==", + "dev": true, + "requires": { + "loader-utils": "^1.1.0", + "schema-utils": "^0.4.5" + } + }, + "stylehacks": { + "version": "4.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/stylehacks/-/stylehacks-4.0.0.tgz", + "integrity": "sha1-ZLMjlRxKJOX8ey7AbBN78y0VXoo=", + "dev": true, + "requires": { + "browserslist": "^4.0.0", + "postcss": "^6.0.0", + "postcss-selector-parser": "^3.0.0" + }, + "dependencies": { + "ansi-styles": { + "version": "3.2.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, + "requires": { + "color-convert": "^1.9.0" + } + }, + "browserslist": { + "version": "4.1.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/browserslist/-/browserslist-4.1.1.tgz", + "integrity": "sha512-VBorw+tgpOtZ1BYhrVSVTzTt/3+vSE3eFUh0N2GCFK1HffceOaf32YS/bs6WiFhjDAblAFrx85jMy3BG9fBK2Q==", + "dev": true, + "requires": { + "caniuse-lite": "^1.0.30000884", + "electron-to-chromium": "^1.3.62", + "node-releases": "^1.0.0-alpha.11" + } + }, + "chalk": { + "version": "2.4.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/chalk/-/chalk-2.4.1.tgz", + "integrity": "sha512-ObN6h1v2fTJSmUXoS3nMQ92LbDK9be4TV+6G+omQlGJFdcUX5heKi1LZ1YnRMIgwTLEj3E24bT6tYni50rlCfQ==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + } + }, + "has-flag": { + "version": "3.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", + "dev": true + }, + "postcss": { + "version": "6.0.23", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/postcss/-/postcss-6.0.23.tgz", + "integrity": "sha512-soOk1h6J3VMTZtVeVpv15/Hpdl2cBLX3CAw4TAbkpTJiNPk9YP/zWcD1ND+xEtvyuuvKzbxliTOIyvkSeSJ6ag==", + "dev": true, + "requires": { + "chalk": "^2.4.1", + "source-map": "^0.6.1", + "supports-color": "^5.4.0" + } + }, + "postcss-selector-parser": { + "version": "3.1.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/postcss-selector-parser/-/postcss-selector-parser-3.1.1.tgz", + "integrity": "sha1-T4dfSvsMllc9XPTXQBGu4lCn6GU=", + "dev": true, + "requires": { + "dot-prop": "^4.1.1", + "indexes-of": "^1.0.1", + "uniq": "^1.0.1" + } + }, + "source-map": { + "version": "0.6.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "dev": true + }, + "supports-color": { + "version": "5.5.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } + } + } + }, + "subarg": { + "version": "1.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/subarg/-/subarg-1.0.0.tgz", + "integrity": "sha1-9izxdYHplrSPyWVpn1TAauJouNI=", + "dev": true, + "requires": { + "minimist": "^1.1.0" + } + }, + "supports-color": { + "version": "2.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/supports-color/-/supports-color-2.0.0.tgz", + "integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc=", + "dev": true + }, + "svgo": { + "version": "0.7.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/svgo/-/svgo-0.7.2.tgz", + "integrity": "sha1-n1dyQTlSE1xv779Ar+ak+qiLS7U=", + "dev": true, + "requires": { + "coa": "~1.0.1", + "colors": "~1.1.2", + "csso": "~2.3.1", + "js-yaml": "~3.7.0", + "mkdirp": "~0.5.1", + "sax": "~1.2.1", + "whet.extend": "~0.9.9" + } + }, + "swagger-ui": { + "version": "2.2.10", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/swagger-ui/-/swagger-ui-2.2.10.tgz", + "integrity": "sha1-sl56IWZOXZC/OR2zDbCN5B6FLXs=" + }, + "symbol-observable": { + "version": "1.2.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/symbol-observable/-/symbol-observable-1.2.0.tgz", + "integrity": "sha512-e900nM8RRtGhlV36KGEU9k65K3mPb1WV70OdjfxlG2EAuM1noi/E/BaW/uMhL7bPEssK8QV57vN3esixjUvcXQ==", + "dev": true + }, + "symbol-tree": { + "version": "3.2.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/symbol-tree/-/symbol-tree-3.2.2.tgz", + "integrity": "sha1-rifbOPZgp64uHDt9G8KQgZuFGeY=", + "dev": true + }, + "tabtab": { + "version": "2.2.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/tabtab/-/tabtab-2.2.2.tgz", + "integrity": "sha1-egR/FDsBC0y9MfhX6ClhUSy/ThQ=", + "dev": true, + "requires": { + "debug": "^2.2.0", + "inquirer": "^1.0.2", + "lodash.difference": "^4.5.0", + "lodash.uniq": "^4.5.0", + "minimist": "^1.2.0", + "mkdirp": "^0.5.1", + "npmlog": "^2.0.3", + "object-assign": "^4.1.0" + }, + "dependencies": { + "ansi-escapes": { + "version": "1.4.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/ansi-escapes/-/ansi-escapes-1.4.0.tgz", + "integrity": "sha1-06ioOzGapneTZisT52HHkRQiMG4=", + "dev": true + }, + "cli-cursor": { + "version": "1.0.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/cli-cursor/-/cli-cursor-1.0.2.tgz", + "integrity": "sha1-ZNo/fValRBLll5S9Ytw1KV6PKYc=", + "dev": true, + "requires": { + "restore-cursor": "^1.0.1" + } + }, + "external-editor": { + "version": "1.1.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/external-editor/-/external-editor-1.1.1.tgz", + "integrity": "sha1-Etew24UPf/fnCBuvQAVwAGDEYAs=", + "dev": true, + "requires": { + "extend": "^3.0.0", + "spawn-sync": "^1.0.15", + "tmp": "^0.0.29" + } + }, + "figures": { + "version": "1.7.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/figures/-/figures-1.7.0.tgz", + "integrity": "sha1-y+Hjr/zxzUS4DK3+0o3Hk6lwHS4=", + "dev": true, + "requires": { + "escape-string-regexp": "^1.0.5", + "object-assign": "^4.1.0" + } + }, + "gauge": { + "version": "1.2.7", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/gauge/-/gauge-1.2.7.tgz", + "integrity": "sha1-6c7FSD09TuDvRLYKfZnkk14TbZM=", + "dev": true, + "requires": { + "ansi": "^0.3.0", + "has-unicode": "^2.0.0", + "lodash.pad": "^4.1.0", + "lodash.padend": "^4.1.0", + "lodash.padstart": "^4.1.0" + } + }, + "inquirer": { + "version": "1.2.3", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/inquirer/-/inquirer-1.2.3.tgz", + "integrity": "sha1-TexvMvN+97sLLtPx0aXD9UUHSRg=", + "dev": true, + "requires": { + "ansi-escapes": "^1.1.0", + "chalk": "^1.0.0", + "cli-cursor": "^1.0.1", + "cli-width": "^2.0.0", + "external-editor": "^1.1.0", + "figures": "^1.3.5", + "lodash": "^4.3.0", + "mute-stream": "0.0.6", + "pinkie-promise": "^2.0.0", + "run-async": "^2.2.0", + "rx": "^4.1.0", + "string-width": "^1.0.1", + "strip-ansi": "^3.0.0", + "through": "^2.3.6" + } + }, + "lodash": { + "version": "4.17.11", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/lodash/-/lodash-4.17.11.tgz", + "integrity": "sha512-cQKh8igo5QUhZ7lg38DYWAxMvjSAKG0A8wGSVimP07SIUEK2UO+arSRKbRZWtelMtN5V0Hkwh5ryOto/SshYIg==", + "dev": true + }, + "mute-stream": { + "version": "0.0.6", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/mute-stream/-/mute-stream-0.0.6.tgz", + "integrity": "sha1-SJYrGeFp/R38JAs/HnMXYnu8R9s=", + "dev": true + }, + "npmlog": { + "version": "2.0.4", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/npmlog/-/npmlog-2.0.4.tgz", + "integrity": "sha1-mLUlMPJRTKkNCexbIsiEZyI3VpI=", + "dev": true, + "requires": { + "ansi": "~0.3.1", + "are-we-there-yet": "~1.1.2", + "gauge": "~1.2.5" + } + }, + "onetime": { + "version": "1.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/onetime/-/onetime-1.1.0.tgz", + "integrity": "sha1-ofeDj4MUxRbwXs78vEzP4EtO14k=", + "dev": true + }, + "restore-cursor": { + "version": "1.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/restore-cursor/-/restore-cursor-1.0.1.tgz", + "integrity": "sha1-NGYfRohjJ/7SmRR5FSJS35LapUE=", + "dev": true, + "requires": { + "exit-hook": "^1.0.0", + "onetime": "^1.0.0" + } + }, + "tmp": { + "version": "0.0.29", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/tmp/-/tmp-0.0.29.tgz", + "integrity": "sha1-8lEl/w3Z2jzLDC3Tce4SiLuRKMA=", + "dev": true, + "requires": { + "os-tmpdir": "~1.0.1" + } + } + } + }, + "tapable": { + "version": "1.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/tapable/-/tapable-1.0.0.tgz", + "integrity": "sha512-dQRhbNQkRnaqauC7WqSJ21EEksgT0fYZX2lqXzGkpo8JNig9zGZTYoMGvyI2nWmXlE2VSVXVDu7wLVGu/mQEsg==", + "dev": true + }, + "temp": { + "version": "0.8.3", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/temp/-/temp-0.8.3.tgz", + "integrity": "sha1-4Ma8TSa5AxJEEOT+2BEDAU38H1k=", + "dev": true, + "requires": { + "os-tmpdir": "^1.0.0", + "rimraf": "~2.2.6" + }, + "dependencies": { + "rimraf": { + "version": "2.2.8", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/rimraf/-/rimraf-2.2.8.tgz", + "integrity": "sha1-5Dm+Kq7jJzIZUnMPmaiSnk/FBYI=", + "dev": true + } + } + }, + "terser": { + "version": "3.8.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/terser/-/terser-3.8.2.tgz", + "integrity": "sha512-FGSBXiBJe2TSXy6pWwXpY0YcEWEK35UKL64BBbxX3aHqM4Nj0RMqXvqBuoSGfyd80t8MKQ5JwYm5jRRGTSEFNg==", + "dev": true, + "requires": { + "commander": "~2.17.1", + "source-map": "~0.6.1", + "source-map-support": "~0.5.6" + }, + "dependencies": { + "commander": { + "version": "2.17.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/commander/-/commander-2.17.1.tgz", + "integrity": "sha512-wPMUt6FnH2yzG95SA6mzjQOEKUU3aLaDEmzs1ti+1E9h+CsrZghRlqEM/EJ4KscsQVG8uNN4uVreUeT8+drlgg==", + "dev": true + }, + "source-map": { + "version": "0.6.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "dev": true + } + } + }, + "terser-webpack-plugin": { + "version": "1.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/terser-webpack-plugin/-/terser-webpack-plugin-1.0.0.tgz", + "integrity": "sha512-J1i69VN1tyhzpzbWrNvNaS1G4G7iNCvTvoT+qGNFxQPqND2Kk49M6yKw5/yA+dcU0D5pH/PuuH2ouDbhqDf0RQ==", + "dev": true, + "requires": { + "@webpack-contrib/schema-utils": "^1.0.0-beta.0", + "cacache": "^11.0.2", + "find-cache-dir": "^2.0.0", + "serialize-javascript": "^1.4.0", + "source-map": "^0.6.1", + "terser": "^3.8.1", + "webpack-sources": "^1.1.0", + "worker-farm": "^1.5.2" + }, + "dependencies": { + "cacache": { + "version": "11.0.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/cacache/-/cacache-11.0.2.tgz", + "integrity": "sha512-hMiz7LN4w8sdfmKsvNs80ao/vf2JCGWWdpu95JyY90AJZRbZJmgE71dCefRiNf8OCqiZQDcUBfYiLlUNu4/j5A==", + "dev": true, + "requires": { + "bluebird": "^3.5.1", + "chownr": "^1.0.1", + "figgy-pudding": "^3.1.0", + "glob": "^7.1.2", + "graceful-fs": "^4.1.11", + "lru-cache": "^4.1.2", + "mississippi": "^3.0.0", + "mkdirp": "^0.5.1", + "move-concurrently": "^1.0.1", + "promise-inflight": "^1.0.1", + "rimraf": "^2.6.2", + "ssri": "^6.0.0", + "unique-filename": "^1.1.0", + "y18n": "^4.0.0" + } + }, + "find-cache-dir": { + "version": "2.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/find-cache-dir/-/find-cache-dir-2.0.0.tgz", + "integrity": "sha512-LDUY6V1Xs5eFskUVYtIwatojt6+9xC9Chnlk/jYOOvn3FAFfSaWddxahDGyNHh0b2dMXa6YW2m0tk8TdVaXHlA==", + "dev": true, + "requires": { + "commondir": "^1.0.1", + "make-dir": "^1.0.0", + "pkg-dir": "^3.0.0" + } + }, + "find-up": { + "version": "3.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/find-up/-/find-up-3.0.0.tgz", + "integrity": "sha512-1yD6RmLI1XBfxugvORwlck6f75tYL+iR0jqwsOrOxMZyGYqUuDhJ0l4AXdO1iX/FTs9cBAMEk1gWSEx1kSbylg==", + "dev": true, + "requires": { + "locate-path": "^3.0.0" + } + }, + "locate-path": { + "version": "3.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/locate-path/-/locate-path-3.0.0.tgz", + "integrity": "sha512-7AO748wWnIhNqAuaty2ZWHkQHRSNfPVIsPIfwEOWO22AmaoVrWavlOcMR5nzTLNYvp36X220/maaRsrec1G65A==", + "dev": true, + "requires": { + "p-locate": "^3.0.0", + "path-exists": "^3.0.0" + } + }, + "mississippi": { + "version": "3.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/mississippi/-/mississippi-3.0.0.tgz", + "integrity": "sha512-x471SsVjUtBRtcvd4BzKE9kFC+/2TeWgKCgw0bZcw1b9l2X3QX5vCWgF+KaZaYm87Ss//rHnWryupDrgLvmSkA==", + "dev": true, + "requires": { + "concat-stream": "^1.5.0", + "duplexify": "^3.4.2", + "end-of-stream": "^1.1.0", + "flush-write-stream": "^1.0.0", + "from2": "^2.1.0", + "parallel-transform": "^1.1.0", + "pump": "^3.0.0", + "pumpify": "^1.3.3", + "stream-each": "^1.1.0", + "through2": "^2.0.0" + } + }, + "p-limit": { + "version": "2.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/p-limit/-/p-limit-2.0.0.tgz", + "integrity": "sha512-fl5s52lI5ahKCernzzIyAP0QAZbGIovtVHGwpcu1Jr/EpzLVDI2myISHwGqK7m8uQFugVWSrbxH7XnhGtvEc+A==", + "dev": true, + "requires": { + "p-try": "^2.0.0" + } + }, + "p-locate": { + "version": "3.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/p-locate/-/p-locate-3.0.0.tgz", + "integrity": "sha512-x+12w/To+4GFfgJhBEpiDcLozRJGegY+Ei7/z0tSLkMmxGZNybVMSfWj9aJn8Z5Fc7dBUNJOOVgPv2H7IwulSQ==", + "dev": true, + "requires": { + "p-limit": "^2.0.0" + } + }, + "p-try": { + "version": "2.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/p-try/-/p-try-2.0.0.tgz", + "integrity": "sha512-hMp0onDKIajHfIkdRk3P4CdCmErkYAxxDtP3Wx/4nZ3aGlau2VKh3mZpcuFkH27WQkL/3WBCPOktzA9ZOAnMQQ==", + "dev": true + }, + "path-exists": { + "version": "3.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/path-exists/-/path-exists-3.0.0.tgz", + "integrity": "sha1-zg6+ql94yxiSXqfYENe1mwEP1RU=", + "dev": true + }, + "pkg-dir": { + "version": "3.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/pkg-dir/-/pkg-dir-3.0.0.tgz", + "integrity": "sha512-/E57AYkoeQ25qkxMj5PBOVgF8Kiu/h7cYS30Z5+R7WaiCCBfLq58ZI/dSeaEKb9WVJV5n/03QwrN3IeWIFllvw==", + "dev": true, + "requires": { + "find-up": "^3.0.0" + } + }, + "pump": { + "version": "3.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/pump/-/pump-3.0.0.tgz", + "integrity": "sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww==", + "dev": true, + "requires": { + "end-of-stream": "^1.1.0", + "once": "^1.3.1" + } + }, + "rimraf": { + "version": "2.6.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/rimraf/-/rimraf-2.6.2.tgz", + "integrity": "sha512-lreewLK/BlghmxtfH36YYVg1i8IAce4TI7oao75I1g245+6BctqTVQiBP3YUJ9C6DQOXJmkYR9X9fCLtCOJc5w==", + "dev": true, + "requires": { + "glob": "^7.0.5" + } + }, + "source-map": { + "version": "0.6.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "dev": true + }, + "ssri": { + "version": "6.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/ssri/-/ssri-6.0.0.tgz", + "integrity": "sha512-zYOGfVHPhxyzwi8MdtdNyxv3IynWCIM4jYReR48lqu0VngxgH1c+C6CmipRdJ55eVByTJV/gboFEEI7TEQI8DA==", + "dev": true + }, + "y18n": { + "version": "4.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/y18n/-/y18n-4.0.0.tgz", + "integrity": "sha512-r9S/ZyXu/Xu9q1tYlpsLIsa3EeLXXk0VwlxqTcFRfg9EhMW+17kbt9G0NrgCmhGb5vT2hyhJZLfDGx+7+5Uj/w==", + "dev": true + } + } + }, + "test-exclude": { + "version": "4.2.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/test-exclude/-/test-exclude-4.2.1.tgz", + "integrity": "sha512-qpqlP/8Zl+sosLxBcVKl9vYy26T9NPalxSzzCP/OY6K7j938ui2oKgo+kRZYfxAeIpLqpbVnsHq1tyV70E4lWQ==", + "dev": true, + "requires": { + "arrify": "^1.0.1", + "micromatch": "^3.1.8", + "object-assign": "^4.1.0", + "read-pkg-up": "^1.0.1", + "require-main-filename": "^1.0.1" + } + }, + "text-hex": { + "version": "1.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/text-hex/-/text-hex-1.0.0.tgz", + "integrity": "sha512-uuVGNWzgJ4yhRaNSiubPY7OjISw4sw4E5Uv0wbjp+OzcbmVU/rsT8ujgcXJhn9ypzsgr5vlzpPqP+MBBKcGvbg==", + "dev": true + }, + "text-table": { + "version": "0.2.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/text-table/-/text-table-0.2.0.tgz", + "integrity": "sha1-f17oI66AUgfACvLfSoTsP8+lcLQ=", + "dev": true + }, + "textextensions": { + "version": "2.2.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/textextensions/-/textextensions-2.2.0.tgz", + "integrity": "sha512-j5EMxnryTvKxwH2Cq+Pb43tsf6sdEgw6Pdwxk83mPaq0ToeFJt6WE4J3s5BqY7vmjlLgkgXvhtXUxo80FyBhCA==", + "dev": true + }, + "tfunk": { + "version": "3.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/tfunk/-/tfunk-3.1.0.tgz", + "integrity": "sha1-OORBT8ZJd9h6/apy+sttKfgve1s=", + "dev": true, + "requires": { + "chalk": "^1.1.1", + "object-path": "^0.9.0" + } + }, + "thread-loader": { + "version": "1.1.5", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/thread-loader/-/thread-loader-1.1.5.tgz", + "integrity": "sha512-BklxWyBW9EsRC6neZPuwwV6L1iRkGwe8sFWUcI1g+3DS3JajW/zJKo2t6j2a72bXngv9a4xyDHpn1EpXM9VWDw==", + "dev": true, + "requires": { + "async": "^2.3.0", + "loader-runner": "^2.3.0", + "loader-utils": "^1.1.0" + }, + "dependencies": { + "async": { + "version": "2.6.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/async/-/async-2.6.1.tgz", + "integrity": "sha512-fNEiL2+AZt6AlAw/29Cr0UDe4sRAHCpEHh54WMz+Bb7QfNcFw4h3loofyJpLeQs4Yx7yuqu/2dLgM5hKOs6HlQ==", + "dev": true, + "requires": { + "lodash": "^4.17.10" + } + }, + "lodash": { + "version": "4.17.11", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/lodash/-/lodash-4.17.11.tgz", + "integrity": "sha512-cQKh8igo5QUhZ7lg38DYWAxMvjSAKG0A8wGSVimP07SIUEK2UO+arSRKbRZWtelMtN5V0Hkwh5ryOto/SshYIg==", + "dev": true + } + } + }, + "throat": { + "version": "4.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/throat/-/throat-4.1.0.tgz", + "integrity": "sha1-iQN8vJLFarGJJua6TLsgDhVnKmo=", + "dev": true + }, + "through": { + "version": "2.3.8", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/through/-/through-2.3.8.tgz", + "integrity": "sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU=", + "dev": true + }, + "through2": { + "version": "2.0.3", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/through2/-/through2-2.0.3.tgz", + "integrity": "sha1-AARWmzfHx0ujnEPzzteNGtlBQL4=", + "dev": true, + "requires": { + "readable-stream": "^2.1.5", + "xtend": "~4.0.1" + } + }, + "thunky": { + "version": "1.0.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/thunky/-/thunky-1.0.2.tgz", + "integrity": "sha1-qGLgGOP7HqLsP85dVWBc9X8kc3E=", + "dev": true + }, + "timed-out": { + "version": "4.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/timed-out/-/timed-out-4.0.1.tgz", + "integrity": "sha1-8y6srFoXW+ol1/q1Zas+2HQe9W8=", + "dev": true + }, + "timers-browserify": { + "version": "2.0.10", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/timers-browserify/-/timers-browserify-2.0.10.tgz", + "integrity": "sha512-YvC1SV1XdOUaL6gx5CoGroT3Gu49pK9+TZ38ErPldOWW4j49GI1HKs9DV+KGq/w6y+LZ72W1c8cKz2vzY+qpzg==", + "dev": true, + "requires": { + "setimmediate": "^1.0.4" + } + }, + "timsort": { + "version": "0.3.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/timsort/-/timsort-0.3.0.tgz", + "integrity": "sha1-QFQRqOfmM5/mTbmiNN4R3DHgK9Q=", + "dev": true + }, + "tmp": { + "version": "0.0.33", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/tmp/-/tmp-0.0.33.tgz", + "integrity": "sha512-jRCJlojKnZ3addtTOjdIqoRuPEKBvNXcGYqzO6zWZX8KfKEpnGY5jfggJQ3EjKuu8D4bJRr0y+cYJFmYbImXGw==", + "dev": true, + "requires": { + "os-tmpdir": "~1.0.2" + } + }, + "tmpl": { + "version": "1.0.4", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/tmpl/-/tmpl-1.0.4.tgz", + "integrity": "sha1-I2QN17QtAEM5ERQIIOXPRA5SHdE=", + "dev": true + }, + "to-array": { + "version": "0.1.4", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/to-array/-/to-array-0.1.4.tgz", + "integrity": "sha1-F+bBH3PdTz10zaek/zI46a2b+JA=", + "dev": true + }, + "to-arraybuffer": { + "version": "1.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/to-arraybuffer/-/to-arraybuffer-1.0.1.tgz", + "integrity": "sha1-fSKbH8xjfkZsoIEYCDanqr/4P0M=", + "dev": true + }, + "to-fast-properties": { + "version": "1.0.3", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/to-fast-properties/-/to-fast-properties-1.0.3.tgz", + "integrity": "sha1-uDVx+k2MJbguIxsG46MFXeTKGkc=", + "dev": true + }, + "to-object-path": { + "version": "0.3.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/to-object-path/-/to-object-path-0.3.0.tgz", + "integrity": "sha1-KXWIt7Dn4KwI4E5nL4XB9JmeF68=", + "dev": true, + "requires": { + "kind-of": "^3.0.2" + }, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true, + "requires": { + "is-buffer": "^1.1.5" + } + } + } + }, + "to-regex": { + "version": "3.0.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/to-regex/-/to-regex-3.0.2.tgz", + "integrity": "sha512-FWtleNAtZ/Ki2qtqej2CXTOayOH9bHDQF+Q48VpWyDXjbYxA4Yz8iDB31zXOBUlOHHKidDbqGVrTUvQMPmBGBw==", + "dev": true, + "requires": { + "define-property": "^2.0.2", + "extend-shallow": "^3.0.2", + "regex-not": "^1.0.2", + "safe-regex": "^1.1.0" + } + }, + "to-regex-range": { + "version": "2.1.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/to-regex-range/-/to-regex-range-2.1.1.tgz", + "integrity": "sha1-fIDBe53+vlmeJzZ+DU3VWQFB2zg=", + "dev": true, + "requires": { + "is-number": "^3.0.0", + "repeat-string": "^1.6.1" + } + }, + "to-string-loader": { + "version": "1.1.5", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/to-string-loader/-/to-string-loader-1.1.5.tgz", + "integrity": "sha1-e3qheJG3u0lHp6Eb+wO1/enG5pU=", + "dev": true, + "requires": { + "loader-utils": "^0.2.16" + }, + "dependencies": { + "loader-utils": { + "version": "0.2.17", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/loader-utils/-/loader-utils-0.2.17.tgz", + "integrity": "sha1-+G5jdNQyBabmxg6RlvF8Apm/s0g=", + "dev": true, + "requires": { + "big.js": "^3.1.3", + "emojis-list": "^2.0.0", + "json5": "^0.5.0", + "object-assign": "^4.0.1" + } + } + } + }, + "topo": { + "version": "2.0.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/topo/-/topo-2.0.2.tgz", + "integrity": "sha1-zVYVdSU5BXwNwEkaYhw7xvvh0YI=", + "dev": true, + "requires": { + "hoek": "4.x.x" + } + }, + "toposort": { + "version": "1.0.7", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/toposort/-/toposort-1.0.7.tgz", + "integrity": "sha1-LmhELZ9k7HILjMieZEOsbKqVACk=", + "dev": true + }, + "tough-cookie": { + "version": "2.4.3", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/tough-cookie/-/tough-cookie-2.4.3.tgz", + "integrity": "sha512-Q5srk/4vDM54WJsJio3XNn6K2sCG+CQ8G5Wz6bZhRZoAe/+TxjWB/GlFAnYEbkYVlON9FMk/fE3h2RLpPXo4lQ==", + "dev": true, + "requires": { + "psl": "^1.1.24", + "punycode": "^1.4.1" + }, + "dependencies": { + "punycode": { + "version": "1.4.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/punycode/-/punycode-1.4.1.tgz", + "integrity": "sha1-wNWmOycYgArY4esPpSachN1BhF4=", + "dev": true + } + } + }, + "tr46": { + "version": "1.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/tr46/-/tr46-1.0.1.tgz", + "integrity": "sha1-qLE/1r/SSJUZZ0zN5VujaTtwbQk=", + "dev": true, + "requires": { + "punycode": "^2.1.0" + } + }, + "tree-kill": { + "version": "1.2.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/tree-kill/-/tree-kill-1.2.0.tgz", + "integrity": "sha512-DlX6dR0lOIRDFxI0mjL9IYg6OTncLm/Zt+JiBhE5OlFcAR8yc9S7FFXU9so0oda47frdM/JFsk7UjNt9vscKcg==", + "dev": true + }, + "trim-newlines": { + "version": "2.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/trim-newlines/-/trim-newlines-2.0.0.tgz", + "integrity": "sha1-tAPQuRvlDDMd/EuC7s6yLD3hbSA=", + "dev": true + }, + "trim-right": { + "version": "1.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/trim-right/-/trim-right-1.0.1.tgz", + "integrity": "sha1-yy4SAwZ+DI3h9hQJS5/kVwTqYAM=", + "dev": true + }, + "triple-beam": { + "version": "1.3.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/triple-beam/-/triple-beam-1.3.0.tgz", + "integrity": "sha512-XrHUvV5HpdLmIj4uVMxHggLbFSZYIn7HEWsqePZcI50pco+MPqJ50wMGY794X7AOOhxOBAjbkqfAbEe/QMp2Lw==", + "dev": true + }, + "ts-jest": { + "version": "22.4.4", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/ts-jest/-/ts-jest-22.4.4.tgz", + "integrity": "sha512-v9pO7u4HNMDSBCN9IEvlR6taDAGm2mo7nHEDLWyoFDgYeZ4aHm8JHEPrthd8Pmcl4eCM8J4Ata4ROR/cwFRV2A==", + "dev": true, + "requires": { + "babel-core": "^6.26.0", + "babel-plugin-istanbul": "^4.1.4", + "babel-plugin-transform-es2015-modules-commonjs": "^6.26.0", + "babel-preset-jest": "^22.4.0", + "cpx": "^1.5.0", + "fs-extra": "4.0.3", + "jest-config": "^22.4.2", + "pkg-dir": "^2.0.0", + "yargs": "^11.0.0" + }, + "dependencies": { + "ansi-regex": { + "version": "3.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/ansi-regex/-/ansi-regex-3.0.0.tgz", + "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", + "dev": true + }, + "cliui": { + "version": "4.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/cliui/-/cliui-4.1.0.tgz", + "integrity": "sha512-4FG+RSG9DL7uEwRUZXZn3SS34DiDPfzP0VOiEwtUWlE+AR2EIg+hSyvrIgUUfhdgR/UkAeW2QHgeP+hWrXs7jQ==", + "dev": true, + "requires": { + "string-width": "^2.1.1", + "strip-ansi": "^4.0.0", + "wrap-ansi": "^2.0.0" + } + }, + "find-up": { + "version": "2.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/find-up/-/find-up-2.1.0.tgz", + "integrity": "sha1-RdG35QbHF93UgndaK3eSCjwMV6c=", + "dev": true, + "requires": { + "locate-path": "^2.0.0" + } + }, + "fs-extra": { + "version": "4.0.3", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/fs-extra/-/fs-extra-4.0.3.tgz", + "integrity": "sha512-q6rbdDd1o2mAnQreO7YADIxf/Whx4AHBiRf6d+/cVT8h44ss+lHgxf1FemcqDnQt9X3ct4McHr+JMGlYSsK7Cg==", + "dev": true, + "requires": { + "graceful-fs": "^4.1.2", + "jsonfile": "^4.0.0", + "universalify": "^0.1.0" + } + }, + "is-fullwidth-code-point": { + "version": "2.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", + "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", + "dev": true + }, + "jsonfile": { + "version": "4.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/jsonfile/-/jsonfile-4.0.0.tgz", + "integrity": "sha1-h3Gq4HmbZAdrdmQPygWPnBDjPss=", + "dev": true, + "requires": { + "graceful-fs": "^4.1.6" + } + }, + "os-locale": { + "version": "2.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/os-locale/-/os-locale-2.1.0.tgz", + "integrity": "sha512-3sslG3zJbEYcaC4YVAvDorjGxc7tv6KVATnLPZONiljsUncvihe9BQoVCEs0RZ1kmf4Hk9OBqlZfJZWI4GanKA==", + "dev": true, + "requires": { + "execa": "^0.7.0", + "lcid": "^1.0.0", + "mem": "^1.1.0" + } + }, + "string-width": { + "version": "2.1.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/string-width/-/string-width-2.1.1.tgz", + "integrity": "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==", + "dev": true, + "requires": { + "is-fullwidth-code-point": "^2.0.0", + "strip-ansi": "^4.0.0" + } + }, + "strip-ansi": { + "version": "4.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/strip-ansi/-/strip-ansi-4.0.0.tgz", + "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", + "dev": true, + "requires": { + "ansi-regex": "^3.0.0" + } + }, + "which-module": { + "version": "2.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/which-module/-/which-module-2.0.0.tgz", + "integrity": "sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho=", + "dev": true + }, + "yargs": { + "version": "11.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/yargs/-/yargs-11.0.0.tgz", + "integrity": "sha512-Rjp+lMYQOWtgqojx1dEWorjCofi1YN7AoFvYV7b1gx/7dAAeuI4kN5SZiEvr0ZmsZTOpDRcCqrpI10L31tFkBw==", + "dev": true, + "requires": { + "cliui": "^4.0.0", + "decamelize": "^1.1.1", + "find-up": "^2.1.0", + "get-caller-file": "^1.0.1", + "os-locale": "^2.0.0", + "require-directory": "^2.1.1", + "require-main-filename": "^1.0.1", + "set-blocking": "^2.0.0", + "string-width": "^2.0.0", + "which-module": "^2.0.0", + "y18n": "^3.2.1", + "yargs-parser": "^9.0.2" + } + }, + "yargs-parser": { + "version": "9.0.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/yargs-parser/-/yargs-parser-9.0.2.tgz", + "integrity": "sha1-nM9qQ0YP5O1Aqbto9I1DuKaMwHc=", + "dev": true, + "requires": { + "camelcase": "^4.1.0" + } + } + } + }, + "ts-loader": { + "version": "4.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/ts-loader/-/ts-loader-4.0.1.tgz", + "integrity": "sha512-dzgQnkAGY4sLqVw6t4LJH8FGR8j0zsPmC1Ff2ChzKhYO+hgWJkSEyrHTlSSZqn5oWr0Po7q/IRoeq8O4SNKQ9A==", + "dev": true, + "requires": { + "chalk": "^2.3.0", + "enhanced-resolve": "^4.0.0", + "loader-utils": "^1.0.2", + "micromatch": "^3.1.4", + "semver": "^5.0.1" + }, + "dependencies": { + "ansi-styles": { + "version": "3.2.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, + "requires": { + "color-convert": "^1.9.0" + } + }, + "chalk": { + "version": "2.4.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/chalk/-/chalk-2.4.1.tgz", + "integrity": "sha512-ObN6h1v2fTJSmUXoS3nMQ92LbDK9be4TV+6G+omQlGJFdcUX5heKi1LZ1YnRMIgwTLEj3E24bT6tYni50rlCfQ==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + } + }, + "has-flag": { + "version": "3.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", + "dev": true + }, + "supports-color": { + "version": "5.5.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } + } + } + }, + "tsickle": { + "version": "0.30.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/tsickle/-/tsickle-0.30.0.tgz", + "integrity": "sha512-A4ALnEDQNrECn5xhgHmoXKM5qERCM395pKIfqcV57ex3zEInVogu/A191Btv8OPEINkr3xQ3Q2XRywyqkge3Qg==", + "dev": true, + "requires": { + "jasmine-diff": "^0.1.3", + "minimist": "^1.2.0", + "mkdirp": "^0.5.1", + "source-map": "^0.6.0", + "source-map-support": "^0.5.0" + }, + "dependencies": { + "source-map": { + "version": "0.6.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "dev": true + } + } + }, + "tslib": { + "version": "1.9.3", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/tslib/-/tslib-1.9.3.tgz", + "integrity": "sha512-4krF8scpejhaOgqzBEcGM7yDIEfi0/8+8zDRZhNZZ2kjmHJ4hv3zCbQWxoJGz1iw5U0Jl0nma13xzHXcncMavQ==" + }, + "tslint": { + "version": "5.9.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/tslint/-/tslint-5.9.1.tgz", + "integrity": "sha1-ElX4ej/1frCw4fDmEKi0dIBGya4=", + "dev": true, + "requires": { + "babel-code-frame": "^6.22.0", + "builtin-modules": "^1.1.1", + "chalk": "^2.3.0", + "commander": "^2.12.1", + "diff": "^3.2.0", + "glob": "^7.1.1", + "js-yaml": "^3.7.0", + "minimatch": "^3.0.4", + "resolve": "^1.3.2", + "semver": "^5.3.0", + "tslib": "^1.8.0", + "tsutils": "^2.12.1" + }, + "dependencies": { + "ansi-styles": { + "version": "3.2.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, + "requires": { + "color-convert": "^1.9.0" + } + }, + "chalk": { + "version": "2.4.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/chalk/-/chalk-2.4.1.tgz", + "integrity": "sha512-ObN6h1v2fTJSmUXoS3nMQ92LbDK9be4TV+6G+omQlGJFdcUX5heKi1LZ1YnRMIgwTLEj3E24bT6tYni50rlCfQ==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + } + }, + "has-flag": { + "version": "3.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", + "dev": true + }, + "supports-color": { + "version": "5.5.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } + } + } + }, + "tslint-config-prettier": { + "version": "1.9.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/tslint-config-prettier/-/tslint-config-prettier-1.9.0.tgz", + "integrity": "sha512-glCHJJrJYXoP/nvhrmb7gt7q2Er0PaXu3zwySpIxRZvCYgBWt8l+Qi4VVTgFt5Moj/1klWg08PxxjE3/7hvp3Q==", + "dev": true + }, + "tslint-loader": { + "version": "3.6.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/tslint-loader/-/tslint-loader-3.6.0.tgz", + "integrity": "sha512-Me9Qf/87BOfCY8uJJw+J7VMF4U8WiMXKLhKKKugMydF0xMhMOt9wo2mjYTNhwbF9H7SHh8PAIwRG8roisTNekQ==", + "dev": true, + "requires": { + "loader-utils": "^1.0.2", + "mkdirp": "^0.5.1", + "object-assign": "^4.1.1", + "rimraf": "^2.4.4", + "semver": "^5.3.0" + } + }, + "tsutils": { + "version": "2.27.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/tsutils/-/tsutils-2.27.1.tgz", + "integrity": "sha512-AE/7uzp32MmaHvNNFES85hhUDHFdFZp6OAiZcd6y4ZKKIg6orJTm8keYWBhIhrJQH3a4LzNKat7ZPXZt5aTf6w==", + "dev": true, + "requires": { + "tslib": "^1.8.1" + } + }, + "tty-browserify": { + "version": "0.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/tty-browserify/-/tty-browserify-0.0.0.tgz", + "integrity": "sha1-oVe6QC2iTpv5V/mqadUk7tQpAaY=", + "dev": true + }, + "tunnel-agent": { + "version": "0.6.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/tunnel-agent/-/tunnel-agent-0.6.0.tgz", + "integrity": "sha1-J6XeoGs2sEoKmWZ3SykIaPD8QP0=", + "dev": true, + "requires": { + "safe-buffer": "^5.0.1" + } + }, + "tweetnacl": { + "version": "0.14.5", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/tweetnacl/-/tweetnacl-0.14.5.tgz", + "integrity": "sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q=", + "dev": true + }, + "type-check": { + "version": "0.3.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/type-check/-/type-check-0.3.2.tgz", + "integrity": "sha1-WITKtRLPHTVeP7eE8wgEsrUg23I=", + "dev": true, + "requires": { + "prelude-ls": "~1.1.2" + } + }, + "type-is": { + "version": "1.6.16", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/type-is/-/type-is-1.6.16.tgz", + "integrity": "sha512-HRkVv/5qY2G6I8iab9cI7v1bOIdhm94dVjQCPFElW9W+3GeDOSHmy2EBYe4VTApuzolPcmgFTN3ftVJRKR2J9Q==", + "dev": true, + "requires": { + "media-typer": "0.3.0", + "mime-types": "~2.1.18" + } + }, + "typedarray": { + "version": "0.0.6", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/typedarray/-/typedarray-0.0.6.tgz", + "integrity": "sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=", + "dev": true + }, + "typescript": { + "version": "2.7.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/typescript/-/typescript-2.7.2.tgz", + "integrity": "sha512-p5TCYZDAO0m4G344hD+wx/LATebLWZNkkh2asWUFqSsD2OrDNhbAHuSjobrmsUmdzjJjEeZVU9g1h3O6vpstnw==", + "dev": true + }, + "ua-parser-js": { + "version": "0.7.17", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/ua-parser-js/-/ua-parser-js-0.7.17.tgz", + "integrity": "sha512-uRdSdu1oA1rncCQL7sCj8vSyZkgtL7faaw9Tc9rZ3mGgraQ7+Pdx7w5mnOSF3gw9ZNG6oc+KXfkon3bKuROm0g==", + "dev": true + }, + "uglify-js": { + "version": "3.3.28", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/uglify-js/-/uglify-js-3.3.28.tgz", + "integrity": "sha512-68Rc/aA6cswiaQ5SrE979UJcXX+ADA1z33/ZsPd+fbAiVdjZ16OXdbtGO+rJUUBgK6qdf3SOPhQf3K/ybF5Miw==", + "dev": true, + "requires": { + "commander": "~2.15.0", + "source-map": "~0.6.1" + }, + "dependencies": { + "commander": { + "version": "2.15.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/commander/-/commander-2.15.1.tgz", + "integrity": "sha512-VlfT9F3V0v+jr4yxPc5gg9s62/fIVWsd2Bk2iD435um1NlGMYdVCq+MjcXnhYq2icNOizHr1kK+5TI6H0Hy0ag==", + "dev": true + }, + "source-map": { + "version": "0.6.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "dev": true + } + } + }, + "uglify-to-browserify": { + "version": "1.0.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/uglify-to-browserify/-/uglify-to-browserify-1.0.2.tgz", + "integrity": "sha1-bgkk1r2mta/jSeOabWMoUKD4grc=", + "dev": true, + "optional": true + }, + "uglifyjs-webpack-plugin": { + "version": "1.2.6", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/uglifyjs-webpack-plugin/-/uglifyjs-webpack-plugin-1.2.6.tgz", + "integrity": "sha512-NDP94ahjW7ZH+qzdjxjIV04n5YGnrYD2jeHgKgnpUKmdAfcXEO5DbVo21fXAm/KPMyX9k21zWFBMYm9m9R2ptg==", + "dev": true, + "requires": { + "cacache": "^10.0.4", + "find-cache-dir": "^1.0.0", + "schema-utils": "^0.4.5", + "serialize-javascript": "^1.4.0", + "source-map": "^0.6.1", + "uglify-es": "^3.3.4", + "webpack-sources": "^1.1.0", + "worker-farm": "^1.5.2" + }, + "dependencies": { + "commander": { + "version": "2.13.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/commander/-/commander-2.13.0.tgz", + "integrity": "sha512-MVuS359B+YzaWqjCL/c+22gfryv+mCBPHAv3zyVI2GN8EY6IRP8VwtasXn8jyyhvvq84R4ImN1OKRtcbIasjYA==", + "dev": true + }, + "source-map": { + "version": "0.6.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "dev": true + }, + "uglify-es": { + "version": "3.3.9", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/uglify-es/-/uglify-es-3.3.9.tgz", + "integrity": "sha512-r+MU0rfv4L/0eeW3xZrd16t4NZfK8Ld4SWVglYBb7ez5uXFWHuVRs6xCTrf1yirs9a4j4Y27nn7SRfO6v67XsQ==", + "dev": true, + "requires": { + "commander": "~2.13.0", + "source-map": "~0.6.1" + } + } + } + }, + "ultron": { + "version": "1.1.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/ultron/-/ultron-1.1.1.tgz", + "integrity": "sha512-UIEXBNeYmKptWH6z8ZnqTeS8fV74zG0/eRU9VGkpzz+LIJNs8W/zM/L+7ctCkRrgbNnnR0xxw4bKOr0cW0N0Og==", + "dev": true + }, + "underscore": { + "version": "1.6.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/underscore/-/underscore-1.6.0.tgz", + "integrity": "sha1-izixDKze9jM3uLJOT/htRa6lKag=", + "dev": true + }, + "union-value": { + "version": "1.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/union-value/-/union-value-1.0.0.tgz", + "integrity": "sha1-XHHDTLW61dzr4+oM0IIHulqhrqQ=", + "dev": true, + "requires": { + "arr-union": "^3.1.0", + "get-value": "^2.0.6", + "is-extendable": "^0.1.1", + "set-value": "^0.4.3" + }, + "dependencies": { + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "dev": true, + "requires": { + "is-extendable": "^0.1.0" + } + }, + "set-value": { + "version": "0.4.3", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/set-value/-/set-value-0.4.3.tgz", + "integrity": "sha1-fbCPnT0i3H945Trzw79GZuzfzPE=", + "dev": true, + "requires": { + "extend-shallow": "^2.0.1", + "is-extendable": "^0.1.1", + "is-plain-object": "^2.0.1", + "to-object-path": "^0.3.0" + } + } + } + }, + "uniq": { + "version": "1.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/uniq/-/uniq-1.0.1.tgz", + "integrity": "sha1-sxxa6CVIRKOoKBVBzisEuGWnNP8=", + "dev": true + }, + "uniqid": { + "version": "4.1.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/uniqid/-/uniqid-4.1.1.tgz", + "integrity": "sha1-iSIN32t1GuUrX3JISGNShZa7hME=", + "dev": true, + "requires": { + "macaddress": "^0.2.8" + } + }, + "uniqs": { + "version": "2.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/uniqs/-/uniqs-2.0.0.tgz", + "integrity": "sha1-/+3ks2slKQaW5uFl1KWe25mOawI=", + "dev": true + }, + "unique-filename": { + "version": "1.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/unique-filename/-/unique-filename-1.1.0.tgz", + "integrity": "sha1-0F8v5AMlYIcfMOk8vnNe6iAVFPM=", + "dev": true, + "requires": { + "unique-slug": "^2.0.0" + } + }, + "unique-slug": { + "version": "2.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/unique-slug/-/unique-slug-2.0.0.tgz", + "integrity": "sha1-22Z258fMBimHj/GWCXx4hVrp9Ks=", + "dev": true, + "requires": { + "imurmurhash": "^0.1.4" + } + }, + "universalify": { + "version": "0.1.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/universalify/-/universalify-0.1.2.tgz", + "integrity": "sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==", + "dev": true + }, + "unpipe": { + "version": "1.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/unpipe/-/unpipe-1.0.0.tgz", + "integrity": "sha1-sr9O6FFKrmFltIF4KdIbLvSZBOw=", + "dev": true + }, + "unquote": { + "version": "1.1.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/unquote/-/unquote-1.1.1.tgz", + "integrity": "sha1-j97XMk7G6IoP+LkF58CYzcCG1UQ=", + "dev": true + }, + "unset-value": { + "version": "1.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/unset-value/-/unset-value-1.0.0.tgz", + "integrity": "sha1-g3aHP30jNRef+x5vw6jtDfyKtVk=", + "dev": true, + "requires": { + "has-value": "^0.3.1", + "isobject": "^3.0.0" + }, + "dependencies": { + "has-value": { + "version": "0.3.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/has-value/-/has-value-0.3.1.tgz", + "integrity": "sha1-ex9YutpiyoJ+wKIHgCVlSEWZXh8=", + "dev": true, + "requires": { + "get-value": "^2.0.3", + "has-values": "^0.1.4", + "isobject": "^2.0.0" + }, + "dependencies": { + "isobject": { + "version": "2.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/isobject/-/isobject-2.1.0.tgz", + "integrity": "sha1-8GVWEJaj8dou9GJy+BXIQNh+DIk=", + "dev": true, + "requires": { + "isarray": "1.0.0" + } + } + } + }, + "has-values": { + "version": "0.1.4", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/has-values/-/has-values-0.1.4.tgz", + "integrity": "sha1-bWHeldkd/Km5oCCJrThL/49it3E=", + "dev": true + } + } + }, + "untildify": { + "version": "3.0.3", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/untildify/-/untildify-3.0.3.tgz", + "integrity": "sha512-iSk/J8efr8uPT/Z4eSUywnqyrQU7DSdMfdqK4iWEaUVVmcP5JcnpRqmVMwcwcnmI1ATFNgC5V90u09tBynNFKA==", + "dev": true + }, + "upath": { + "version": "1.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/upath/-/upath-1.1.0.tgz", + "integrity": "sha512-bzpH/oBhoS/QI/YtbkqCg6VEiPYjSZtrHQM6/QnJS6OL9pKUFLqb3aFh4Scvwm45+7iAgiMkLhSbaZxUqmrprw==", + "dev": true + }, + "upper-case": { + "version": "1.1.3", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/upper-case/-/upper-case-1.1.3.tgz", + "integrity": "sha1-9rRQHC7EzdJrp4vnIilh3ndiFZg=", + "dev": true + }, + "uri-js": { + "version": "3.0.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/uri-js/-/uri-js-3.0.2.tgz", + "integrity": "sha1-+QuFhQf4HepNz7s8TD2/orVX+qo=", + "dev": true, + "requires": { + "punycode": "^2.1.0" + } + }, + "urix": { + "version": "0.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/urix/-/urix-0.1.0.tgz", + "integrity": "sha1-2pN/emLiH+wf0Y1Js1wpNQZ6bHI=", + "dev": true + }, + "url": { + "version": "0.11.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/url/-/url-0.11.0.tgz", + "integrity": "sha1-ODjpfPxgUh63PFJajlW/3Z4uKPE=", + "dev": true, + "requires": { + "punycode": "1.3.2", + "querystring": "0.2.0" + }, + "dependencies": { + "punycode": { + "version": "1.3.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/punycode/-/punycode-1.3.2.tgz", + "integrity": "sha1-llOgNvt8HuQjQvIyXM7v6jkmxI0=", + "dev": true + } + } + }, + "url-join": { + "version": "4.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/url-join/-/url-join-4.0.0.tgz", + "integrity": "sha1-TTNA6AfTdzvamZH4MFrNzCpmXSo=", + "dev": true + }, + "url-parse": { + "version": "1.4.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/url-parse/-/url-parse-1.4.1.tgz", + "integrity": "sha512-x95Td74QcvICAA0+qERaVkRpTGKyBHHYdwL2LXZm5t/gBtCB9KQSO/0zQgSTYEV1p0WcvSg79TLNPSvd5IDJMQ==", + "dev": true, + "requires": { + "querystringify": "^2.0.0", + "requires-port": "^1.0.0" + } + }, + "url-parse-lax": { + "version": "1.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/url-parse-lax/-/url-parse-lax-1.0.0.tgz", + "integrity": "sha1-evjzA2Rem9eaJy56FKxovAYJ2nM=", + "dev": true, + "requires": { + "prepend-http": "^1.0.1" + } + }, + "url-to-options": { + "version": "1.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/url-to-options/-/url-to-options-1.0.1.tgz", + "integrity": "sha1-FQWgOiiaSMvXpDTvuu7FBV9WM6k=", + "dev": true + }, + "use": { + "version": "3.1.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/use/-/use-3.1.1.tgz", + "integrity": "sha512-cwESVXlO3url9YWlFW/TA9cshCEhtu7IKJ/p5soJ/gGpj7vbvFrAY/eIioQ6Dw23KjZhYgiIo8HOs1nQ2vr/oQ==", + "dev": true + }, + "util": { + "version": "0.10.4", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/util/-/util-0.10.4.tgz", + "integrity": "sha512-0Pm9hTQ3se5ll1XihRic3FDIku70C+iHUdT/W926rSgHV5QgXsYbKZN8MSC3tJtSkhuROzvsQjAaFENRXr+19A==", + "dev": true, + "requires": { + "inherits": "2.0.3" + } + }, + "util-deprecate": { + "version": "1.0.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/util-deprecate/-/util-deprecate-1.0.2.tgz", + "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=", + "dev": true + }, + "util.promisify": { + "version": "1.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/util.promisify/-/util.promisify-1.0.0.tgz", + "integrity": "sha512-i+6qA2MPhvoKLuxnJNpXAGhg7HphQOSUq2LKMZD0m15EiskXUkMvKdF4Uui0WYeCUGea+o2cw/ZuwehtfsrNkA==", + "dev": true, + "requires": { + "define-properties": "^1.1.2", + "object.getownpropertydescriptors": "^2.0.3" + } + }, + "utila": { + "version": "0.4.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/utila/-/utila-0.4.0.tgz", + "integrity": "sha1-ihagXURWV6Oupe7MWxKk+lN5dyw=", + "dev": true + }, + "utils-merge": { + "version": "1.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/utils-merge/-/utils-merge-1.0.1.tgz", + "integrity": "sha1-n5VxD1CiZ5R7LMwSR0HBAoQn5xM=", + "dev": true + }, + "uuid": { + "version": "3.3.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/uuid/-/uuid-3.3.2.tgz", + "integrity": "sha512-yXJmeNaw3DnnKAOKJE51sL/ZaYfWJRl1pK9dr19YFCu0ObS231AB1/LbqTKRAQ5kw8A90rA6fr4riOUpTZvQZA==", + "dev": true + }, + "v8-compile-cache": { + "version": "1.1.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/v8-compile-cache/-/v8-compile-cache-1.1.2.tgz", + "integrity": "sha512-ejdrifsIydN1XDH7EuR2hn8ZrkRKUYF7tUcBjBy/lhrCvs2K+zRlbW9UHc0IQ9RsYFZJFqJrieoIHfkCa0DBRA==", + "dev": true + }, + "validate-npm-package-license": { + "version": "3.0.4", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz", + "integrity": "sha512-DpKm2Ui/xN7/HQKCtpZxoRWBhZ9Z0kqtygG8XCgNQ8ZlDnxuQmWhj566j8fN4Cu3/JmbhsDo7fcAJq4s9h27Ew==", + "dev": true, + "requires": { + "spdx-correct": "^3.0.0", + "spdx-expression-parse": "^3.0.0" + } + }, + "validate-npm-package-name": { + "version": "3.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/validate-npm-package-name/-/validate-npm-package-name-3.0.0.tgz", + "integrity": "sha1-X6kS2B630MdK/BQN5zF/DKffQ34=", + "dev": true, + "requires": { + "builtins": "^1.0.3" + } + }, + "vary": { + "version": "1.1.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/vary/-/vary-1.1.2.tgz", + "integrity": "sha1-IpnwLG3tMNSllhsLn3RSShj2NPw=", + "dev": true + }, + "vendors": { + "version": "1.0.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/vendors/-/vendors-1.0.2.tgz", + "integrity": "sha512-w/hry/368nO21AN9QljsaIhb9ZiZtZARoVH5f3CsFbawdLdayCgKRPup7CggujvySMxx0I91NOyxdVENohprLQ==", + "dev": true + }, + "verror": { + "version": "1.10.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/verror/-/verror-1.10.0.tgz", + "integrity": "sha1-OhBcoXBTr1XW4nDB+CiGguGNpAA=", + "dev": true, + "requires": { + "assert-plus": "^1.0.0", + "core-util-is": "1.0.2", + "extsprintf": "^1.2.0" + } + }, + "vinyl": { + "version": "1.2.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/vinyl/-/vinyl-1.2.0.tgz", + "integrity": "sha1-XIgDbPVl5d8FVYv8kR+GVt8hiIQ=", + "dev": true, + "requires": { + "clone": "^1.0.0", + "clone-stats": "^0.0.1", + "replace-ext": "0.0.1" + } + }, + "vinyl-file": { + "version": "2.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/vinyl-file/-/vinyl-file-2.0.0.tgz", + "integrity": "sha1-p+v1/779obfRjRQPyweyI++2dRo=", + "dev": true, + "requires": { + "graceful-fs": "^4.1.2", + "pify": "^2.3.0", + "pinkie-promise": "^2.0.0", + "strip-bom": "^2.0.0", + "strip-bom-stream": "^2.0.0", + "vinyl": "^1.1.0" + } + }, + "vm-browserify": { + "version": "0.0.4", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/vm-browserify/-/vm-browserify-0.0.4.tgz", + "integrity": "sha1-XX6kW7755Kb/ZflUOOCofDV9WnM=", + "dev": true, + "requires": { + "indexof": "0.0.1" + } + }, + "vue-parser": { + "version": "1.1.6", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/vue-parser/-/vue-parser-1.1.6.tgz", + "integrity": "sha512-v3/R7PLbaFVF/c8IIzWs1HgRpT2gN0dLRkaLIT5q+zJGVgmhN4VuZJF4Y9N4hFtFjS4B1EHxAOP6/tzqM4Ug2g==", + "dev": true, + "requires": { + "parse5": "^3.0.3" + } + }, + "w3c-hr-time": { + "version": "1.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/w3c-hr-time/-/w3c-hr-time-1.0.1.tgz", + "integrity": "sha1-gqwr/2PZUOqeMYmlimViX+3xkEU=", + "dev": true, + "requires": { + "browser-process-hrtime": "^0.1.2" + } + }, + "walker": { + "version": "1.0.7", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/walker/-/walker-1.0.7.tgz", + "integrity": "sha1-L3+bj9ENZ3JisYqITijRlhjgKPs=", + "dev": true, + "requires": { + "makeerror": "1.0.x" + } + }, + "watch": { + "version": "0.18.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/watch/-/watch-0.18.0.tgz", + "integrity": "sha1-KAlUdsbffJDJYxOJkMClQj60uYY=", + "dev": true, + "requires": { + "exec-sh": "^0.2.0", + "minimist": "^1.2.0" + } + }, + "watchpack": { + "version": "1.6.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/watchpack/-/watchpack-1.6.0.tgz", + "integrity": "sha512-i6dHe3EyLjMmDlU1/bGQpEw25XSjkJULPuAVKCbNRefQVq48yXKUpwg538F7AZTf9kyr57zj++pQFltUa5H7yA==", + "dev": true, + "requires": { + "chokidar": "^2.0.2", + "graceful-fs": "^4.1.2", + "neo-async": "^2.5.0" + } + }, + "wbuf": { + "version": "1.7.3", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/wbuf/-/wbuf-1.7.3.tgz", + "integrity": "sha512-O84QOnr0icsbFGLS0O3bI5FswxzRr8/gHwWkDlQFskhSPryQXvrTMxjxGP4+iWYoauLoBvfDpkrOauZ+0iZpDA==", + "dev": true, + "requires": { + "minimalistic-assert": "^1.0.0" + } + }, + "webassemblyjs": { + "version": "1.3.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/webassemblyjs/-/webassemblyjs-1.3.0.tgz", + "integrity": "sha512-q/16d2hYjex5G5wczUqmP0e37KKxUYttvZgt6xgMia7yrSIZ2rX6tq/7HPey8Wi/T6oIWxUwsJ+rDcpKzdPmTw==", + "dev": true, + "requires": { + "@webassemblyjs/ast": "1.3.0", + "@webassemblyjs/validation": "1.3.0", + "@webassemblyjs/wasm-parser": "1.3.0", + "@webassemblyjs/wast-parser": "1.3.0", + "long": "^3.2.0" + } + }, + "webidl-conversions": { + "version": "4.0.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/webidl-conversions/-/webidl-conversions-4.0.2.tgz", + "integrity": "sha512-YQ+BmxuTgd6UXZW3+ICGfyqRyHXVlD5GtQr5+qjiNW7bF0cqrzX500HVXPBOvgXb5YnzDd+h0zqyv61KUD7+Sg==", + "dev": true + }, + "webpack": { + "version": "4.8.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/webpack/-/webpack-4.8.0.tgz", + "integrity": "sha512-tfPUKNWkoD+iHk1X0eyQhLR5X9auy5xguiJyjJy5nMgy5yZpmI+s6Y3husZFHmQOGNCl+xxU/A63jk3IceTZTg==", + "dev": true, + "requires": { + "@webassemblyjs/ast": "1.3.0", + "@webassemblyjs/wasm-edit": "1.3.0", + "@webassemblyjs/wasm-parser": "1.3.0", + "acorn": "^5.0.0", + "acorn-dynamic-import": "^3.0.0", + "ajv": "^6.1.0", + "ajv-keywords": "^3.1.0", + "chrome-trace-event": "^0.1.1", + "enhanced-resolve": "^4.0.0", + "eslint-scope": "^3.7.1", + "loader-runner": "^2.3.0", + "loader-utils": "^1.1.0", + "memory-fs": "~0.4.1", + "micromatch": "^3.1.8", + "mkdirp": "~0.5.0", + "neo-async": "^2.5.0", + "node-libs-browser": "^2.0.0", + "schema-utils": "^0.4.4", + "tapable": "^1.0.0", + "uglifyjs-webpack-plugin": "^1.2.4", + "watchpack": "^1.5.0", + "webpack-sources": "^1.0.1" + } + }, + "webpack-addons": { + "version": "1.1.5", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/webpack-addons/-/webpack-addons-1.1.5.tgz", + "integrity": "sha512-MGO0nVniCLFAQz1qv22zM02QPjcpAoJdy7ED0i3Zy7SY1IecgXCm460ib7H/Wq7e9oL5VL6S2BxaObxwIcag0g==", + "dev": true, + "requires": { + "jscodeshift": "^0.4.0" + }, + "dependencies": { + "arr-diff": { + "version": "2.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/arr-diff/-/arr-diff-2.0.0.tgz", + "integrity": "sha1-jzuCf5Vai9ZpaX5KQlasPOrjVs8=", + "dev": true, + "requires": { + "arr-flatten": "^1.0.1" + } + }, + "array-unique": { + "version": "0.2.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/array-unique/-/array-unique-0.2.1.tgz", + "integrity": "sha1-odl8yvy8JiXMcPrc6zalDFiwGlM=", + "dev": true + }, + "ast-types": { + "version": "0.10.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/ast-types/-/ast-types-0.10.1.tgz", + "integrity": "sha512-UY7+9DPzlJ9VM8eY0b2TUZcZvF+1pO0hzMtAyjBYKhOmnvRlqYNYnWdtsMj0V16CGaMlpL0G1jnLbLo4AyotuQ==", + "dev": true + }, + "braces": { + "version": "1.8.5", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/braces/-/braces-1.8.5.tgz", + "integrity": "sha1-uneWLhLf+WnWt2cR6RS3N4V79qc=", + "dev": true, + "requires": { + "expand-range": "^1.8.1", + "preserve": "^0.2.0", + "repeat-element": "^1.1.2" + } + }, + "esprima": { + "version": "4.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/esprima/-/esprima-4.0.1.tgz", + "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==", + "dev": true + }, + "expand-brackets": { + "version": "0.1.5", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/expand-brackets/-/expand-brackets-0.1.5.tgz", + "integrity": "sha1-3wcoTjQqgHzXM6xa9yQR5YHRF3s=", + "dev": true, + "requires": { + "is-posix-bracket": "^0.1.0" + } + }, + "extglob": { + "version": "0.3.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/extglob/-/extglob-0.3.2.tgz", + "integrity": "sha1-Lhj/PS9JqydlzskCPwEdqo2DSaE=", + "dev": true, + "requires": { + "is-extglob": "^1.0.0" + } + }, + "is-extglob": { + "version": "1.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/is-extglob/-/is-extglob-1.0.0.tgz", + "integrity": "sha1-rEaBd8SUNAWgkvyPKXYMb/xiBsA=", + "dev": true + }, + "is-glob": { + "version": "2.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/is-glob/-/is-glob-2.0.1.tgz", + "integrity": "sha1-0Jb5JqPe1WAPP9/ZEZjLCIjC2GM=", + "dev": true, + "requires": { + "is-extglob": "^1.0.0" + } + }, + "jscodeshift": { + "version": "0.4.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/jscodeshift/-/jscodeshift-0.4.1.tgz", + "integrity": "sha512-iOX6If+hsw0q99V3n31t4f5VlD1TQZddH08xbT65ZqA7T4Vkx68emrDZMUOLVvCEAJ6NpAk7DECe3fjC/t52AQ==", + "dev": true, + "requires": { + "async": "^1.5.0", + "babel-plugin-transform-flow-strip-types": "^6.8.0", + "babel-preset-es2015": "^6.9.0", + "babel-preset-stage-1": "^6.5.0", + "babel-register": "^6.9.0", + "babylon": "^6.17.3", + "colors": "^1.1.2", + "flow-parser": "^0.*", + "lodash": "^4.13.1", + "micromatch": "^2.3.7", + "node-dir": "0.1.8", + "nomnom": "^1.8.1", + "recast": "^0.12.5", + "temp": "^0.8.1", + "write-file-atomic": "^1.2.0" + } + }, + "kind-of": { + "version": "3.2.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true, + "requires": { + "is-buffer": "^1.1.5" + } + }, + "lodash": { + "version": "4.17.11", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/lodash/-/lodash-4.17.11.tgz", + "integrity": "sha512-cQKh8igo5QUhZ7lg38DYWAxMvjSAKG0A8wGSVimP07SIUEK2UO+arSRKbRZWtelMtN5V0Hkwh5ryOto/SshYIg==", + "dev": true + }, + "micromatch": { + "version": "2.3.11", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/micromatch/-/micromatch-2.3.11.tgz", + "integrity": "sha1-hmd8l9FyCzY0MdBNDRUpO9OMFWU=", + "dev": true, + "requires": { + "arr-diff": "^2.0.0", + "array-unique": "^0.2.1", + "braces": "^1.8.2", + "expand-brackets": "^0.1.4", + "extglob": "^0.3.1", + "filename-regex": "^2.0.0", + "is-extglob": "^1.0.0", + "is-glob": "^2.0.1", + "kind-of": "^3.0.2", + "normalize-path": "^2.0.1", + "object.omit": "^2.0.0", + "parse-glob": "^3.0.4", + "regex-cache": "^0.4.2" + } + }, + "recast": { + "version": "0.12.9", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/recast/-/recast-0.12.9.tgz", + "integrity": "sha512-y7ANxCWmMW8xLOaiopiRDlyjQ9ajKRENBH+2wjntIbk3A6ZR1+BLQttkmSHMY7Arl+AAZFwJ10grg2T6f1WI8A==", + "dev": true, + "requires": { + "ast-types": "0.10.1", + "core-js": "^2.4.1", + "esprima": "~4.0.0", + "private": "~0.1.5", + "source-map": "~0.6.1" + } + }, + "source-map": { + "version": "0.6.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "dev": true + }, + "write-file-atomic": { + "version": "1.3.4", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/write-file-atomic/-/write-file-atomic-1.3.4.tgz", + "integrity": "sha1-+Aek8LHZ6ROuekgRLmzDrxmRtF8=", + "dev": true, + "requires": { + "graceful-fs": "^4.1.11", + "imurmurhash": "^0.1.4", + "slide": "^1.1.5" + } + } + } + }, + "webpack-cli": { + "version": "2.1.3", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/webpack-cli/-/webpack-cli-2.1.3.tgz", + "integrity": "sha512-5AsKoL/Ccn8iTrwk3uErdyhetGH+c7VRQ7Itim2GL0IhBRq5rtojVDk00buMRmFmBpw1RvHXq97Gup965LbozA==", + "dev": true, + "requires": { + "chalk": "^2.3.2", + "cross-spawn": "^6.0.5", + "diff": "^3.5.0", + "enhanced-resolve": "^4.0.0", + "envinfo": "^4.4.2", + "glob-all": "^3.1.0", + "global-modules": "^1.0.0", + "got": "^8.2.0", + "import-local": "^1.0.0", + "inquirer": "^5.1.0", + "interpret": "^1.0.4", + "jscodeshift": "^0.5.0", + "listr": "^0.13.0", + "loader-utils": "^1.1.0", + "lodash": "^4.17.5", + "log-symbols": "^2.2.0", + "mkdirp": "^0.5.1", + "p-each-series": "^1.0.0", + "p-lazy": "^1.0.0", + "prettier": "^1.5.3", + "supports-color": "^5.3.0", + "v8-compile-cache": "^1.1.2", + "webpack-addons": "^1.1.5", + "yargs": "^11.1.0", + "yeoman-environment": "^2.0.0", + "yeoman-generator": "^2.0.4" + }, + "dependencies": { + "ansi-regex": { + "version": "3.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/ansi-regex/-/ansi-regex-3.0.0.tgz", + "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", + "dev": true + }, + "ansi-styles": { + "version": "3.2.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, + "requires": { + "color-convert": "^1.9.0" + } + }, + "async": { + "version": "2.6.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/async/-/async-2.6.1.tgz", + "integrity": "sha512-fNEiL2+AZt6AlAw/29Cr0UDe4sRAHCpEHh54WMz+Bb7QfNcFw4h3loofyJpLeQs4Yx7yuqu/2dLgM5hKOs6HlQ==", + "dev": true, + "requires": { + "lodash": "^4.17.10" + } + }, + "chalk": { + "version": "2.4.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/chalk/-/chalk-2.4.1.tgz", + "integrity": "sha512-ObN6h1v2fTJSmUXoS3nMQ92LbDK9be4TV+6G+omQlGJFdcUX5heKi1LZ1YnRMIgwTLEj3E24bT6tYni50rlCfQ==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + } + }, + "cliui": { + "version": "4.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/cliui/-/cliui-4.1.0.tgz", + "integrity": "sha512-4FG+RSG9DL7uEwRUZXZn3SS34DiDPfzP0VOiEwtUWlE+AR2EIg+hSyvrIgUUfhdgR/UkAeW2QHgeP+hWrXs7jQ==", + "dev": true, + "requires": { + "string-width": "^2.1.1", + "strip-ansi": "^4.0.0", + "wrap-ansi": "^2.0.0" + }, + "dependencies": { + "strip-ansi": { + "version": "4.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/strip-ansi/-/strip-ansi-4.0.0.tgz", + "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", + "dev": true, + "requires": { + "ansi-regex": "^3.0.0" + } + } + } + }, + "clone": { + "version": "2.1.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/clone/-/clone-2.1.2.tgz", + "integrity": "sha1-G39Ln1kfHo+DZwQBYANFoCiHQ18=", + "dev": true + }, + "clone-stats": { + "version": "1.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/clone-stats/-/clone-stats-1.0.0.tgz", + "integrity": "sha1-s3gt/4u1R04Yuba/D9/ngvh3doA=", + "dev": true + }, + "cross-spawn": { + "version": "6.0.5", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/cross-spawn/-/cross-spawn-6.0.5.tgz", + "integrity": "sha512-eTVLrBSt7fjbDygz805pMnstIs2VTBNkRm0qxZd+M7A5XDdxVRWO5MxGBXZhjY4cqLYLdtrGqRf8mBPmzwSpWQ==", + "dev": true, + "requires": { + "nice-try": "^1.0.4", + "path-key": "^2.0.1", + "semver": "^5.5.0", + "shebang-command": "^1.2.0", + "which": "^1.2.9" + } + }, + "dargs": { + "version": "5.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/dargs/-/dargs-5.1.0.tgz", + "integrity": "sha1-7H6lDHhWTNNsnV7Bj2Yyn63ieCk=", + "dev": true + }, + "debug": { + "version": "3.2.6", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/debug/-/debug-3.2.6.tgz", + "integrity": "sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ==", + "dev": true, + "requires": { + "ms": "^2.1.1" + } + }, + "figures": { + "version": "1.7.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/figures/-/figures-1.7.0.tgz", + "integrity": "sha1-y+Hjr/zxzUS4DK3+0o3Hk6lwHS4=", + "dev": true, + "requires": { + "escape-string-regexp": "^1.0.5", + "object-assign": "^4.1.0" + } + }, + "find-up": { + "version": "2.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/find-up/-/find-up-2.1.0.tgz", + "integrity": "sha1-RdG35QbHF93UgndaK3eSCjwMV6c=", + "dev": true, + "requires": { + "locate-path": "^2.0.0" + } + }, + "got": { + "version": "8.3.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/got/-/got-8.3.2.tgz", + "integrity": "sha512-qjUJ5U/hawxosMryILofZCkm3C84PLJS/0grRIpjAwu+Lkxxj5cxeCU25BG0/3mDSpXKTyZr8oh8wIgLaH0QCw==", + "dev": true, + "requires": { + "@sindresorhus/is": "^0.7.0", + "cacheable-request": "^2.1.1", + "decompress-response": "^3.3.0", + "duplexer3": "^0.1.4", + "get-stream": "^3.0.0", + "into-stream": "^3.1.0", + "is-retry-allowed": "^1.1.0", + "isurl": "^1.0.0-alpha5", + "lowercase-keys": "^1.0.0", + "mimic-response": "^1.0.0", + "p-cancelable": "^0.4.0", + "p-timeout": "^2.0.1", + "pify": "^3.0.0", + "safe-buffer": "^5.1.1", + "timed-out": "^4.0.1", + "url-parse-lax": "^3.0.0", + "url-to-options": "^1.0.1" + } + }, + "has-flag": { + "version": "3.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", + "dev": true + }, + "indent-string": { + "version": "2.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/indent-string/-/indent-string-2.1.0.tgz", + "integrity": "sha1-ji1INIdCEhtKghi3oTfppSBJ3IA=", + "dev": true, + "requires": { + "repeating": "^2.0.0" + } + }, + "is-fullwidth-code-point": { + "version": "2.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", + "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", + "dev": true + }, + "is-observable": { + "version": "0.2.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/is-observable/-/is-observable-0.2.0.tgz", + "integrity": "sha1-s2ExHYPG5dcmyr9eJQsCNxBvWuI=", + "dev": true, + "requires": { + "symbol-observable": "^0.2.2" + } + }, + "listr": { + "version": "0.13.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/listr/-/listr-0.13.0.tgz", + "integrity": "sha1-ILsLowuuZg7oTMBQPfS+PVYjiH0=", + "dev": true, + "requires": { + "chalk": "^1.1.3", + "cli-truncate": "^0.2.1", + "figures": "^1.7.0", + "indent-string": "^2.1.0", + "is-observable": "^0.2.0", + "is-promise": "^2.1.0", + "is-stream": "^1.1.0", + "listr-silent-renderer": "^1.1.1", + "listr-update-renderer": "^0.4.0", + "listr-verbose-renderer": "^0.4.0", + "log-symbols": "^1.0.2", + "log-update": "^1.0.2", + "ora": "^0.2.3", + "p-map": "^1.1.1", + "rxjs": "^5.4.2", + "stream-to-observable": "^0.2.0", + "strip-ansi": "^3.0.1" + }, + "dependencies": { + "ansi-styles": { + "version": "2.2.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/ansi-styles/-/ansi-styles-2.2.1.tgz", + "integrity": "sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4=", + "dev": true + }, + "chalk": { + "version": "1.1.3", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/chalk/-/chalk-1.1.3.tgz", + "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", + "dev": true, + "requires": { + "ansi-styles": "^2.2.1", + "escape-string-regexp": "^1.0.2", + "has-ansi": "^2.0.0", + "strip-ansi": "^3.0.0", + "supports-color": "^2.0.0" + } + }, + "log-symbols": { + "version": "1.0.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/log-symbols/-/log-symbols-1.0.2.tgz", + "integrity": "sha1-N2/3tY6jCGoPCfrMdGF+ylAeGhg=", + "dev": true, + "requires": { + "chalk": "^1.0.0" + } + }, + "supports-color": { + "version": "2.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/supports-color/-/supports-color-2.0.0.tgz", + "integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc=", + "dev": true + } + } + }, + "load-json-file": { + "version": "4.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/load-json-file/-/load-json-file-4.0.0.tgz", + "integrity": "sha1-L19Fq5HjMhYjT9U62rZo607AmTs=", + "dev": true, + "requires": { + "graceful-fs": "^4.1.2", + "parse-json": "^4.0.0", + "pify": "^3.0.0", + "strip-bom": "^3.0.0" + } + }, + "lodash": { + "version": "4.17.11", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/lodash/-/lodash-4.17.11.tgz", + "integrity": "sha512-cQKh8igo5QUhZ7lg38DYWAxMvjSAKG0A8wGSVimP07SIUEK2UO+arSRKbRZWtelMtN5V0Hkwh5ryOto/SshYIg==", + "dev": true + }, + "mem-fs-editor": { + "version": "4.0.3", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/mem-fs-editor/-/mem-fs-editor-4.0.3.tgz", + "integrity": "sha512-tgWmwI/+6vwu6POan82dTjxEpwAoaj0NAFnghtVo/FcLK2/7IhPUtFUUYlwou4MOY6OtjTUJtwpfH1h+eSUziw==", + "dev": true, + "requires": { + "commondir": "^1.0.1", + "deep-extend": "^0.6.0", + "ejs": "^2.5.9", + "glob": "^7.0.3", + "globby": "^7.1.1", + "isbinaryfile": "^3.0.2", + "mkdirp": "^0.5.0", + "multimatch": "^2.0.0", + "rimraf": "^2.2.8", + "through2": "^2.0.0", + "vinyl": "^2.0.1" + } + }, + "ms": { + "version": "2.1.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/ms/-/ms-2.1.1.tgz", + "integrity": "sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg==", + "dev": true + }, + "os-locale": { + "version": "2.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/os-locale/-/os-locale-2.1.0.tgz", + "integrity": "sha512-3sslG3zJbEYcaC4YVAvDorjGxc7tv6KVATnLPZONiljsUncvihe9BQoVCEs0RZ1kmf4Hk9OBqlZfJZWI4GanKA==", + "dev": true, + "requires": { + "execa": "^0.7.0", + "lcid": "^1.0.0", + "mem": "^1.1.0" + } + }, + "p-cancelable": { + "version": "0.4.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/p-cancelable/-/p-cancelable-0.4.1.tgz", + "integrity": "sha512-HNa1A8LvB1kie7cERyy21VNeHb2CWJJYqyyC2o3klWFfMGlFmWv2Z7sFgZH8ZiaYL95ydToKTFVXgMV/Os0bBQ==", + "dev": true + }, + "p-timeout": { + "version": "2.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/p-timeout/-/p-timeout-2.0.1.tgz", + "integrity": "sha512-88em58dDVB/KzPEx1X0N3LwFfYZPyDc4B6eF38M1rk9VTZMbxXXgjugz8mmwpS9Ox4BDZ+t6t3QP5+/gazweIA==", + "dev": true, + "requires": { + "p-finally": "^1.0.0" + } + }, + "parse-json": { + "version": "4.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/parse-json/-/parse-json-4.0.0.tgz", + "integrity": "sha1-vjX1Qlvh9/bHRxhPmKeIy5lHfuA=", + "dev": true, + "requires": { + "error-ex": "^1.3.1", + "json-parse-better-errors": "^1.0.1" + } + }, + "path-type": { + "version": "3.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/path-type/-/path-type-3.0.0.tgz", + "integrity": "sha512-T2ZUsdZFHgA3u4e5PfPbjd7HDDpxPnQb5jN0SrDsjNSuVXHJqtwTnWqG0B1jZrgmJ/7lj1EmVIByWt1gxGkWvg==", + "dev": true, + "requires": { + "pify": "^3.0.0" + } + }, + "pify": { + "version": "3.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/pify/-/pify-3.0.0.tgz", + "integrity": "sha1-5aSs0sEB/fPZpNB/DbxNtJ3SgXY=", + "dev": true + }, + "prepend-http": { + "version": "2.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/prepend-http/-/prepend-http-2.0.0.tgz", + "integrity": "sha1-6SQ0v6XqjBn0HN/UAddBo8gZ2Jc=", + "dev": true + }, + "pretty-bytes": { + "version": "4.0.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/pretty-bytes/-/pretty-bytes-4.0.2.tgz", + "integrity": "sha1-sr+C5zUNZcbDOqlaqlpPYyf2HNk=", + "dev": true + }, + "read-pkg": { + "version": "3.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/read-pkg/-/read-pkg-3.0.0.tgz", + "integrity": "sha1-nLxoaXj+5l0WwA4rGcI3/Pbjg4k=", + "dev": true, + "requires": { + "load-json-file": "^4.0.0", + "normalize-package-data": "^2.3.2", + "path-type": "^3.0.0" + } + }, + "read-pkg-up": { + "version": "3.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/read-pkg-up/-/read-pkg-up-3.0.0.tgz", + "integrity": "sha1-PtSWaF26D4/hGNBpHcUfSh/5bwc=", + "dev": true, + "requires": { + "find-up": "^2.0.0", + "read-pkg": "^3.0.0" + } + }, + "replace-ext": { + "version": "1.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/replace-ext/-/replace-ext-1.0.0.tgz", + "integrity": "sha1-3mMSg3P8v3w8z6TeWkgMRaZ5WOs=", + "dev": true + }, + "rimraf": { + "version": "2.6.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/rimraf/-/rimraf-2.6.2.tgz", + "integrity": "sha512-lreewLK/BlghmxtfH36YYVg1i8IAce4TI7oao75I1g245+6BctqTVQiBP3YUJ9C6DQOXJmkYR9X9fCLtCOJc5w==", + "dev": true, + "requires": { + "glob": "^7.0.5" + } + }, + "rxjs": { + "version": "5.5.12", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/rxjs/-/rxjs-5.5.12.tgz", + "integrity": "sha512-xx2itnL5sBbqeeiVgNPVuQQ1nC8Jp2WfNJhXWHmElW9YmrpS9UVnNzhP3EH3HFqexO5Tlp8GhYY+WEcqcVMvGw==", + "dev": true, + "requires": { + "symbol-observable": "1.0.1" + }, + "dependencies": { + "symbol-observable": { + "version": "1.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/symbol-observable/-/symbol-observable-1.0.1.tgz", + "integrity": "sha1-g0D8RwLDEi310iKI+IKD9RPT/dQ=", + "dev": true + } + } + }, + "string-width": { + "version": "2.1.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/string-width/-/string-width-2.1.1.tgz", + "integrity": "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==", + "dev": true, + "requires": { + "is-fullwidth-code-point": "^2.0.0", + "strip-ansi": "^4.0.0" + }, + "dependencies": { + "strip-ansi": { + "version": "4.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/strip-ansi/-/strip-ansi-4.0.0.tgz", + "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", + "dev": true, + "requires": { + "ansi-regex": "^3.0.0" + } + } + } + }, + "strip-bom": { + "version": "3.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/strip-bom/-/strip-bom-3.0.0.tgz", + "integrity": "sha1-IzTBjpx1n3vdVv3vfprj1YjmjtM=", + "dev": true + }, + "supports-color": { + "version": "5.5.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } + }, + "symbol-observable": { + "version": "0.2.4", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/symbol-observable/-/symbol-observable-0.2.4.tgz", + "integrity": "sha1-lag9smGG1q9+ehjb2XYKL4bQj0A=", + "dev": true + }, + "url-parse-lax": { + "version": "3.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/url-parse-lax/-/url-parse-lax-3.0.0.tgz", + "integrity": "sha1-FrXK/Afb42dsGxmZF3gj1lA6yww=", + "dev": true, + "requires": { + "prepend-http": "^2.0.0" + } + }, + "vinyl": { + "version": "2.2.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/vinyl/-/vinyl-2.2.0.tgz", + "integrity": "sha512-MBH+yP0kC/GQ5GwBqrTPTzEfiiLjta7hTtvQtbxBgTeSXsmKQRQecjibMbxIXzVT3Y9KJK+drOz1/k+vsu8Nkg==", + "dev": true, + "requires": { + "clone": "^2.1.1", + "clone-buffer": "^1.0.0", + "clone-stats": "^1.0.0", + "cloneable-readable": "^1.0.0", + "remove-trailing-separator": "^1.0.1", + "replace-ext": "^1.0.0" + } + }, + "which-module": { + "version": "2.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/which-module/-/which-module-2.0.0.tgz", + "integrity": "sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho=", + "dev": true + }, + "yargs": { + "version": "11.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/yargs/-/yargs-11.1.0.tgz", + "integrity": "sha512-NwW69J42EsCSanF8kyn5upxvjp5ds+t3+udGBeTbFnERA+lF541DDpMawzo4z6W/QrzNM18D+BPMiOBibnFV5A==", + "dev": true, + "requires": { + "cliui": "^4.0.0", + "decamelize": "^1.1.1", + "find-up": "^2.1.0", + "get-caller-file": "^1.0.1", + "os-locale": "^2.0.0", + "require-directory": "^2.1.1", + "require-main-filename": "^1.0.1", + "set-blocking": "^2.0.0", + "string-width": "^2.0.0", + "which-module": "^2.0.0", + "y18n": "^3.2.1", + "yargs-parser": "^9.0.2" + } + }, + "yargs-parser": { + "version": "9.0.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/yargs-parser/-/yargs-parser-9.0.2.tgz", + "integrity": "sha1-nM9qQ0YP5O1Aqbto9I1DuKaMwHc=", + "dev": true, + "requires": { + "camelcase": "^4.1.0" + } + }, + "yeoman-generator": { + "version": "2.0.5", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/yeoman-generator/-/yeoman-generator-2.0.5.tgz", + "integrity": "sha512-rV6tJ8oYzm4mmdF2T3wjY+Q42jKF2YiiD0VKfJ8/0ZYwmhCKC9Xs2346HVLPj/xE13i68psnFJv7iS6gWRkeAg==", + "dev": true, + "requires": { + "async": "^2.6.0", + "chalk": "^2.3.0", + "cli-table": "^0.3.1", + "cross-spawn": "^6.0.5", + "dargs": "^5.1.0", + "dateformat": "^3.0.3", + "debug": "^3.1.0", + "detect-conflict": "^1.0.0", + "error": "^7.0.2", + "find-up": "^2.1.0", + "github-username": "^4.0.0", + "istextorbinary": "^2.2.1", + "lodash": "^4.17.10", + "make-dir": "^1.1.0", + "mem-fs-editor": "^4.0.0", + "minimist": "^1.2.0", + "pretty-bytes": "^4.0.2", + "read-chunk": "^2.1.0", + "read-pkg-up": "^3.0.0", + "rimraf": "^2.6.2", + "run-async": "^2.0.0", + "shelljs": "^0.8.0", + "text-table": "^0.2.0", + "through2": "^2.0.0", + "yeoman-environment": "^2.0.5" + } + } + } + }, + "webpack-dev-middleware": { + "version": "3.1.3", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/webpack-dev-middleware/-/webpack-dev-middleware-3.1.3.tgz", + "integrity": "sha512-I6Mmy/QjWU/kXwCSFGaiOoL5YEQIVmbb0o45xMoCyQAg/mClqZVTcsX327sPfekDyJWpCxb+04whNyLOIxpJdQ==", + "dev": true, + "requires": { + "loud-rejection": "^1.6.0", + "memory-fs": "~0.4.1", + "mime": "^2.1.0", + "path-is-absolute": "^1.0.0", + "range-parser": "^1.0.3", + "url-join": "^4.0.0", + "webpack-log": "^1.0.1" + }, + "dependencies": { + "mime": { + "version": "2.3.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/mime/-/mime-2.3.1.tgz", + "integrity": "sha512-OEUllcVoydBHGN1z84yfQDimn58pZNNNXgZlHXSboxMlFvgI6MXSWpWKpFRra7H1HxpVhHTkrghfRW49k6yjeg==", + "dev": true + } + } + }, + "webpack-dev-server": { + "version": "3.1.5", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/webpack-dev-server/-/webpack-dev-server-3.1.5.tgz", + "integrity": "sha512-LVHg+EPwZLHIlfvokSTgtJqO/vI5CQi89fASb5JEDtVMDjY0yuIEqPPdMiKaBJIB/Ab7v/UN/sYZ7WsZvntQKw==", + "dev": true, + "requires": { + "ansi-html": "0.0.7", + "array-includes": "^3.0.3", + "bonjour": "^3.5.0", + "chokidar": "^2.0.0", + "compression": "^1.5.2", + "connect-history-api-fallback": "^1.3.0", + "debug": "^3.1.0", + "del": "^3.0.0", + "express": "^4.16.2", + "html-entities": "^1.2.0", + "http-proxy-middleware": "~0.18.0", + "import-local": "^1.0.0", + "internal-ip": "1.2.0", + "ip": "^1.1.5", + "killable": "^1.0.0", + "loglevel": "^1.4.1", + "opn": "^5.1.0", + "portfinder": "^1.0.9", + "selfsigned": "^1.9.1", + "serve-index": "^1.7.2", + "sockjs": "0.3.19", + "sockjs-client": "1.1.5", + "spdy": "^3.4.1", + "strip-ansi": "^3.0.0", + "supports-color": "^5.1.0", + "webpack-dev-middleware": "3.1.3", + "webpack-log": "^1.1.2", + "yargs": "11.0.0" + }, + "dependencies": { + "ansi-regex": { + "version": "3.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/ansi-regex/-/ansi-regex-3.0.0.tgz", + "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", + "dev": true + }, + "cliui": { + "version": "4.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/cliui/-/cliui-4.1.0.tgz", + "integrity": "sha512-4FG+RSG9DL7uEwRUZXZn3SS34DiDPfzP0VOiEwtUWlE+AR2EIg+hSyvrIgUUfhdgR/UkAeW2QHgeP+hWrXs7jQ==", + "dev": true, + "requires": { + "string-width": "^2.1.1", + "strip-ansi": "^4.0.0", + "wrap-ansi": "^2.0.0" + }, + "dependencies": { + "strip-ansi": { + "version": "4.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/strip-ansi/-/strip-ansi-4.0.0.tgz", + "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", + "dev": true, + "requires": { + "ansi-regex": "^3.0.0" + } + } + } + }, + "debug": { + "version": "3.2.6", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/debug/-/debug-3.2.6.tgz", + "integrity": "sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ==", + "dev": true, + "requires": { + "ms": "^2.1.1" + } + }, + "find-up": { + "version": "2.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/find-up/-/find-up-2.1.0.tgz", + "integrity": "sha1-RdG35QbHF93UgndaK3eSCjwMV6c=", + "dev": true, + "requires": { + "locate-path": "^2.0.0" + } + }, + "has-flag": { + "version": "3.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", + "dev": true + }, + "is-fullwidth-code-point": { + "version": "2.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", + "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", + "dev": true + }, + "ms": { + "version": "2.1.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/ms/-/ms-2.1.1.tgz", + "integrity": "sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg==", + "dev": true + }, + "os-locale": { + "version": "2.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/os-locale/-/os-locale-2.1.0.tgz", + "integrity": "sha512-3sslG3zJbEYcaC4YVAvDorjGxc7tv6KVATnLPZONiljsUncvihe9BQoVCEs0RZ1kmf4Hk9OBqlZfJZWI4GanKA==", + "dev": true, + "requires": { + "execa": "^0.7.0", + "lcid": "^1.0.0", + "mem": "^1.1.0" + } + }, + "string-width": { + "version": "2.1.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/string-width/-/string-width-2.1.1.tgz", + "integrity": "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==", + "dev": true, + "requires": { + "is-fullwidth-code-point": "^2.0.0", + "strip-ansi": "^4.0.0" + }, + "dependencies": { + "strip-ansi": { + "version": "4.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/strip-ansi/-/strip-ansi-4.0.0.tgz", + "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", + "dev": true, + "requires": { + "ansi-regex": "^3.0.0" + } + } + } + }, + "supports-color": { + "version": "5.5.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } + }, + "which-module": { + "version": "2.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/which-module/-/which-module-2.0.0.tgz", + "integrity": "sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho=", + "dev": true + }, + "yargs": { + "version": "11.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/yargs/-/yargs-11.0.0.tgz", + "integrity": "sha512-Rjp+lMYQOWtgqojx1dEWorjCofi1YN7AoFvYV7b1gx/7dAAeuI4kN5SZiEvr0ZmsZTOpDRcCqrpI10L31tFkBw==", + "dev": true, + "requires": { + "cliui": "^4.0.0", + "decamelize": "^1.1.1", + "find-up": "^2.1.0", + "get-caller-file": "^1.0.1", + "os-locale": "^2.0.0", + "require-directory": "^2.1.1", + "require-main-filename": "^1.0.1", + "set-blocking": "^2.0.0", + "string-width": "^2.0.0", + "which-module": "^2.0.0", + "y18n": "^3.2.1", + "yargs-parser": "^9.0.2" + } + }, + "yargs-parser": { + "version": "9.0.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/yargs-parser/-/yargs-parser-9.0.2.tgz", + "integrity": "sha1-nM9qQ0YP5O1Aqbto9I1DuKaMwHc=", + "dev": true, + "requires": { + "camelcase": "^4.1.0" + } + } + } + }, + "webpack-log": { + "version": "1.2.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/webpack-log/-/webpack-log-1.2.0.tgz", + "integrity": "sha512-U9AnICnu50HXtiqiDxuli5gLB5PGBo7VvcHx36jRZHwK4vzOYLbImqT4lwWwoMHdQWwEKw736fCHEekokTEKHA==", + "dev": true, + "requires": { + "chalk": "^2.1.0", + "log-symbols": "^2.1.0", + "loglevelnext": "^1.0.1", + "uuid": "^3.1.0" + }, + "dependencies": { + "ansi-styles": { + "version": "3.2.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, + "requires": { + "color-convert": "^1.9.0" + } + }, + "chalk": { + "version": "2.4.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/chalk/-/chalk-2.4.1.tgz", + "integrity": "sha512-ObN6h1v2fTJSmUXoS3nMQ92LbDK9be4TV+6G+omQlGJFdcUX5heKi1LZ1YnRMIgwTLEj3E24bT6tYni50rlCfQ==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + } + }, + "has-flag": { + "version": "3.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", + "dev": true + }, + "supports-color": { + "version": "5.5.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } + } + } + }, + "webpack-merge": { + "version": "4.1.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/webpack-merge/-/webpack-merge-4.1.2.tgz", + "integrity": "sha512-/0QYwW/H1N/CdXYA2PNPVbsxO3u2Fpz34vs72xm03SRfg6bMNGfMJIQEpQjKRvkG2JvT6oRJFpDtSrwbX8Jzvw==", + "dev": true, + "requires": { + "lodash": "^4.17.5" + }, + "dependencies": { + "lodash": { + "version": "4.17.11", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/lodash/-/lodash-4.17.11.tgz", + "integrity": "sha512-cQKh8igo5QUhZ7lg38DYWAxMvjSAKG0A8wGSVimP07SIUEK2UO+arSRKbRZWtelMtN5V0Hkwh5ryOto/SshYIg==", + "dev": true + } + } + }, + "webpack-notifier": { + "version": "1.6.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/webpack-notifier/-/webpack-notifier-1.6.0.tgz", + "integrity": "sha1-/6yOVf+MRpdSuMG7sBGhbxCYbgI=", + "dev": true, + "requires": { + "node-notifier": "^5.1.2", + "object-assign": "^4.1.0", + "strip-ansi": "^3.0.1" + } + }, + "webpack-sources": { + "version": "1.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/webpack-sources/-/webpack-sources-1.1.0.tgz", + "integrity": "sha512-aqYp18kPphgoO5c/+NaUvEeACtZjMESmDChuD3NBciVpah3XpMEU9VAAtIaB1BsfJWWTSdv8Vv1m3T0aRk2dUw==", + "dev": true, + "requires": { + "source-list-map": "^2.0.0", + "source-map": "~0.6.1" + }, + "dependencies": { + "source-map": { + "version": "0.6.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "dev": true + } + } + }, + "webpack-visualizer-plugin": { + "version": "0.1.11", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/webpack-visualizer-plugin/-/webpack-visualizer-plugin-0.1.11.tgz", + "integrity": "sha1-uHcK2GtPZSYSxosbeCJT+vn4o04=", + "dev": true, + "requires": { + "d3": "^3.5.6", + "mkdirp": "^0.5.1", + "react": "^0.14.0", + "react-dom": "^0.14.0" + } + }, + "websocket-driver": { + "version": "0.7.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/websocket-driver/-/websocket-driver-0.7.0.tgz", + "integrity": "sha1-DK+dLXVdk67gSdS90NP+LMoqJOs=", + "dev": true, + "requires": { + "http-parser-js": ">=0.4.0", + "websocket-extensions": ">=0.1.1" + } + }, + "websocket-extensions": { + "version": "0.1.3", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/websocket-extensions/-/websocket-extensions-0.1.3.tgz", + "integrity": "sha512-nqHUnMXmBzT0w570r2JpJxfiSD1IzoI+HGVdd3aZ0yNi3ngvQ4jv1dtHt5VGxfI2yj5yqImPhOK4vmIh2xMbGg==", + "dev": true + }, + "whatwg-encoding": { + "version": "1.0.3", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/whatwg-encoding/-/whatwg-encoding-1.0.3.tgz", + "integrity": "sha512-jLBwwKUhi8WtBfsMQlL4bUUcT8sMkAtQinscJAe/M4KHCkHuUJAF6vuB0tueNIw4c8ziO6AkRmgY+jL3a0iiPw==", + "dev": true, + "requires": { + "iconv-lite": "0.4.19" + }, + "dependencies": { + "iconv-lite": { + "version": "0.4.19", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/iconv-lite/-/iconv-lite-0.4.19.tgz", + "integrity": "sha512-oTZqweIP51xaGPI4uPa56/Pri/480R+mo7SeU+YETByQNhDG55ycFyNLIgta9vXhILrxXDmF7ZGhqZIcuN0gJQ==", + "dev": true + } + } + }, + "whatwg-fetch": { + "version": "0.9.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/whatwg-fetch/-/whatwg-fetch-0.9.0.tgz", + "integrity": "sha1-DjaExsuZlbQ+/J3wPkw2XZX9nMA=", + "dev": true + }, + "whatwg-mimetype": { + "version": "2.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/whatwg-mimetype/-/whatwg-mimetype-2.1.0.tgz", + "integrity": "sha512-FKxhYLytBQiUKjkYteN71fAUA3g6KpNXoho1isLiLSB3N1G4F35Q5vUxWfKFhBwi5IWF27VE6WxhrnnC+m0Mew==", + "dev": true + }, + "whatwg-url": { + "version": "6.4.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/whatwg-url/-/whatwg-url-6.4.1.tgz", + "integrity": "sha512-FwygsxsXx27x6XXuExA/ox3Ktwcbf+OAvrKmLulotDAiO1Q6ixchPFaHYsis2zZBZSJTR0+dR+JVtf7MlbqZjw==", + "dev": true, + "requires": { + "lodash.sortby": "^4.7.0", + "tr46": "^1.0.1", + "webidl-conversions": "^4.0.2" + } + }, + "whet.extend": { + "version": "0.9.9", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/whet.extend/-/whet.extend-0.9.9.tgz", + "integrity": "sha1-+HfVv2SMl+WqVC+twW1qJZucEaE=", + "dev": true + }, + "which": { + "version": "1.3.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/which/-/which-1.3.1.tgz", + "integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==", + "dev": true, + "requires": { + "isexe": "^2.0.0" + } + }, + "which-module": { + "version": "1.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/which-module/-/which-module-1.0.0.tgz", + "integrity": "sha1-u6Y8qGGUiZT/MHc2CJ47lgJsKk8=", + "dev": true + }, + "wide-align": { + "version": "1.1.3", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/wide-align/-/wide-align-1.1.3.tgz", + "integrity": "sha512-QGkOQc8XL6Bt5PwnsExKBPuMKBxnGxWWW3fU55Xt4feHozMUhdUMaBCk290qpm/wG5u/RSKzwdAC4i51YigihA==", + "dev": true, + "optional": true, + "requires": { + "string-width": "^1.0.2 || 2" + } + }, + "win-release": { + "version": "1.1.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/win-release/-/win-release-1.1.1.tgz", + "integrity": "sha1-X6VeAr58qTTt/BJmVjLoSbcuUgk=", + "dev": true, + "requires": { + "semver": "^5.0.1" + } + }, + "window-size": { + "version": "0.2.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/window-size/-/window-size-0.2.0.tgz", + "integrity": "sha1-tDFbtCFKPXBY6+7okuE/ok2YsHU=", + "dev": true + }, + "winston": { + "version": "3.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/winston/-/winston-3.1.0.tgz", + "integrity": "sha512-FsQfEE+8YIEeuZEYhHDk5cILo1HOcWkGwvoidLrDgPog0r4bser1lEIOco2dN9zpDJ1M88hfDgZvxe5z4xNcwg==", + "dev": true, + "requires": { + "async": "^2.6.0", + "diagnostics": "^1.1.1", + "is-stream": "^1.1.0", + "logform": "^1.9.1", + "one-time": "0.0.4", + "readable-stream": "^2.3.6", + "stack-trace": "0.0.x", + "triple-beam": "^1.3.0", + "winston-transport": "^4.2.0" + }, + "dependencies": { + "async": { + "version": "2.6.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/async/-/async-2.6.1.tgz", + "integrity": "sha512-fNEiL2+AZt6AlAw/29Cr0UDe4sRAHCpEHh54WMz+Bb7QfNcFw4h3loofyJpLeQs4Yx7yuqu/2dLgM5hKOs6HlQ==", + "dev": true, + "requires": { + "lodash": "^4.17.10" + } + }, + "lodash": { + "version": "4.17.11", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/lodash/-/lodash-4.17.11.tgz", + "integrity": "sha512-cQKh8igo5QUhZ7lg38DYWAxMvjSAKG0A8wGSVimP07SIUEK2UO+arSRKbRZWtelMtN5V0Hkwh5ryOto/SshYIg==", + "dev": true + } + } + }, + "winston-transport": { + "version": "4.2.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/winston-transport/-/winston-transport-4.2.0.tgz", + "integrity": "sha512-0R1bvFqxSlK/ZKTH86nymOuKv/cT1PQBMuDdA7k7f0S9fM44dNH6bXnuxwXPrN8lefJgtZq08BKdyZ0DZIy/rg==", + "dev": true, + "requires": { + "readable-stream": "^2.3.6", + "triple-beam": "^1.2.0" + } + }, + "wordwrap": { + "version": "0.0.3", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/wordwrap/-/wordwrap-0.0.3.tgz", + "integrity": "sha1-o9XabNXAvAAI03I0u68b7WMFkQc=", + "dev": true + }, + "workbox-background-sync": { + "version": "3.6.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/workbox-background-sync/-/workbox-background-sync-3.6.1.tgz", + "integrity": "sha512-lMXwUbZ/FQBWf/jkFwz0ARfMLeIk9q73+fsqGwwUwUcr8NC6GDZlgtH9sPndxU1VbM+bieRM9R9kVStE4s2uVQ==", + "dev": true, + "requires": { + "workbox-core": "^3.6.1" + } + }, + "workbox-broadcast-cache-update": { + "version": "3.6.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/workbox-broadcast-cache-update/-/workbox-broadcast-cache-update-3.6.1.tgz", + "integrity": "sha512-wC6LQNNPGLfZ1W+kSA2sP5YrbUl5axYgD0iNU37l4ABaCmjpu2XiFwPH+v4NOj/YWJt+z2563YB4SFM+/rC2mg==", + "dev": true, + "requires": { + "workbox-core": "^3.6.1" + } + }, + "workbox-build": { + "version": "3.6.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/workbox-build/-/workbox-build-3.6.1.tgz", + "integrity": "sha512-1xEaFzVWzcIMwNHIW8WesGL+7MOx7XeHU1et1VWGDbxHV0i2HL8koMxq3g2WpKJy+yEh0hRG+4KuTGMmeuQcMA==", + "dev": true, + "requires": { + "babel-runtime": "^6.26.0", + "common-tags": "^1.4.0", + "fs-extra": "^4.0.2", + "glob": "^7.1.2", + "joi": "^11.1.1", + "lodash.template": "^4.4.0", + "pretty-bytes": "^4.0.2", + "stringify-object": "^3.2.2", + "strip-comments": "^1.0.2", + "workbox-background-sync": "^3.6.1", + "workbox-broadcast-cache-update": "^3.6.1", + "workbox-cache-expiration": "^3.6.1", + "workbox-cacheable-response": "^3.6.1", + "workbox-core": "^3.6.1", + "workbox-google-analytics": "^3.6.1", + "workbox-navigation-preload": "^3.6.1", + "workbox-precaching": "^3.6.1", + "workbox-range-requests": "^3.6.1", + "workbox-routing": "^3.6.1", + "workbox-strategies": "^3.6.1", + "workbox-streams": "^3.6.1", + "workbox-sw": "^3.6.1" + }, + "dependencies": { + "fs-extra": { + "version": "4.0.3", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/fs-extra/-/fs-extra-4.0.3.tgz", + "integrity": "sha512-q6rbdDd1o2mAnQreO7YADIxf/Whx4AHBiRf6d+/cVT8h44ss+lHgxf1FemcqDnQt9X3ct4McHr+JMGlYSsK7Cg==", + "dev": true, + "requires": { + "graceful-fs": "^4.1.2", + "jsonfile": "^4.0.0", + "universalify": "^0.1.0" + } + }, + "jsonfile": { + "version": "4.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/jsonfile/-/jsonfile-4.0.0.tgz", + "integrity": "sha1-h3Gq4HmbZAdrdmQPygWPnBDjPss=", + "dev": true, + "requires": { + "graceful-fs": "^4.1.6" + } + }, + "pretty-bytes": { + "version": "4.0.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/pretty-bytes/-/pretty-bytes-4.0.2.tgz", + "integrity": "sha1-sr+C5zUNZcbDOqlaqlpPYyf2HNk=", + "dev": true + } + } + }, + "workbox-cache-expiration": { + "version": "3.6.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/workbox-cache-expiration/-/workbox-cache-expiration-3.6.1.tgz", + "integrity": "sha512-mOV90D8cJ6S2s1GUGbfTvQ+WWKEMAvbHkH+vjIFdl+hXcToC7toctBI3UzI7vmmFv3TRQcP3TAxBmJgEFjgJew==", + "dev": true, + "requires": { + "workbox-core": "^3.6.1" + } + }, + "workbox-cacheable-response": { + "version": "3.6.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/workbox-cacheable-response/-/workbox-cacheable-response-3.6.1.tgz", + "integrity": "sha512-67tsFrpgX5LI3Nu82eVXlqfdq/PegF+agjcrLRDfSlD6cySCZCb0cyFHwLhegw5A6BayRHzYcBM5/imGeaMwjw==", + "dev": true, + "requires": { + "workbox-core": "^3.6.1" + } + }, + "workbox-core": { + "version": "3.6.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/workbox-core/-/workbox-core-3.6.1.tgz", + "integrity": "sha512-xrrPQ335Cdekihe1jhscXYm4mmhh7ZXqSlZqJhyVmp9lNp5xzz1t0R22AfoaVNsg0zdu6Ouqnn0RsQ53QkZ8tw==", + "dev": true + }, + "workbox-google-analytics": { + "version": "3.6.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/workbox-google-analytics/-/workbox-google-analytics-3.6.1.tgz", + "integrity": "sha512-rnAT2RseiQO8DWjjkQkojVHX/6MK/L88+UFKr92xG1fKGD2asOk97AG6i0fAAti6f4KMg2s5UWZthiFR9QH4fQ==", + "dev": true, + "requires": { + "workbox-background-sync": "^3.6.1", + "workbox-core": "^3.6.1", + "workbox-routing": "^3.6.1", + "workbox-strategies": "^3.6.1" + } + }, + "workbox-navigation-preload": { + "version": "3.6.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/workbox-navigation-preload/-/workbox-navigation-preload-3.6.1.tgz", + "integrity": "sha512-Dzzp0JasGZWHSbZdx+UY0ZFaJu6P1LGIlFw3A+oTHbop9rZY219BNREcpzHT107SP7VFBkz/KIGF7s05FD6tpQ==", + "dev": true, + "requires": { + "workbox-core": "^3.6.1" + } + }, + "workbox-precaching": { + "version": "3.6.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/workbox-precaching/-/workbox-precaching-3.6.1.tgz", + "integrity": "sha512-qKNelNcGGSnKZveZRO+4sFKxr33iNMcP9Pbm8OkdEdAAZem0Ia4hIL87mHvwCvRnuj/vaV2BwRghZnzmLsK8Ng==", + "dev": true, + "requires": { + "workbox-core": "^3.6.1" + } + }, + "workbox-range-requests": { + "version": "3.6.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/workbox-range-requests/-/workbox-range-requests-3.6.1.tgz", + "integrity": "sha512-/ZPvMvKUzWBVmmN+fCPslF8RXin0C5WAla9EE0taiAMWdrVfPGghERtZLHumk/yM/M3k+OqWzPxCV0Wg/mjbqg==", + "dev": true, + "requires": { + "workbox-core": "^3.6.1" + } + }, + "workbox-routing": { + "version": "3.6.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/workbox-routing/-/workbox-routing-3.6.1.tgz", + "integrity": "sha512-9LoBs5ck9Rjutno4yfBzqFyiUqj2UvILgYHGFkjHLp7lA4KK9VIuBJjGCLNaWr2r0pe6DVM5tM2OvlAOa2JO3w==", + "dev": true, + "requires": { + "workbox-core": "^3.6.1" + } + }, + "workbox-strategies": { + "version": "3.6.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/workbox-strategies/-/workbox-strategies-3.6.1.tgz", + "integrity": "sha512-OEw1psICNGpL1bqFZGyjl9N9hnmnRvsOA2EWAXxKVlwqmVvGzSeb8S46DPnH2JQgy77DRfNzeHVdfN6XirqdJw==", + "dev": true, + "requires": { + "workbox-core": "^3.6.1" + } + }, + "workbox-streams": { + "version": "3.6.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/workbox-streams/-/workbox-streams-3.6.1.tgz", + "integrity": "sha512-SjO8wyUJ72+EXFVn9i9140hxbiN7d56k8gDHTxVoQT7OrCVYWkGFR0GzfnoRONaaHvO+/CGOyS37/Y+IXr7Vdw==", + "dev": true, + "requires": { + "workbox-core": "^3.6.1" + } + }, + "workbox-sw": { + "version": "3.6.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/workbox-sw/-/workbox-sw-3.6.1.tgz", + "integrity": "sha512-bXKvvjt5Oet87cpuSuVpiFYBohCv9xLmniZwMZPAFQVEtpPCyWv5X+UVZ+BpHVDBcRMYz7lXNIRWa9J54zR2vA==", + "dev": true + }, + "workbox-webpack-plugin": { + "version": "3.2.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/workbox-webpack-plugin/-/workbox-webpack-plugin-3.2.0.tgz", + "integrity": "sha512-zl1/2ChVhwcpSumDd3jSUfbDIk5MtTSW5xc/h/WPkBpYi4dwvfwmQ8KAXc1qBIEoDz++R483zwYTyJQJ0g6f3w==", + "dev": true, + "requires": { + "json-stable-stringify": "^1.0.1", + "workbox-build": "^3.2.0" + } + }, + "worker-farm": { + "version": "1.6.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/worker-farm/-/worker-farm-1.6.0.tgz", + "integrity": "sha512-6w+3tHbM87WnSWnENBUvA2pxJPLhQUg5LKwUQHq3r+XPhIM+Gh2R5ycbwPCyuGbNg+lPgdcnQUhuC02kJCvffQ==", + "dev": true, + "requires": { + "errno": "~0.1.7" + } + }, + "wrap-ansi": { + "version": "2.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/wrap-ansi/-/wrap-ansi-2.1.0.tgz", + "integrity": "sha1-2Pw9KE3QV5T+hJc8rs3Rz4JP3YU=", + "dev": true, + "requires": { + "string-width": "^1.0.1", + "strip-ansi": "^3.0.1" + } + }, + "wrappy": { + "version": "1.0.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", + "dev": true + }, + "write-file-atomic": { + "version": "2.3.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/write-file-atomic/-/write-file-atomic-2.3.0.tgz", + "integrity": "sha512-xuPeK4OdjWqtfi59ylvVL0Yn35SF3zgcAcv7rBPFHVaEapaDr4GdGgm3j7ckTwH9wHL7fGmgfAnb0+THrHb8tA==", + "dev": true, + "requires": { + "graceful-fs": "^4.1.11", + "imurmurhash": "^0.1.4", + "signal-exit": "^3.0.2" + } + }, + "write-file-webpack-plugin": { + "version": "4.2.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/write-file-webpack-plugin/-/write-file-webpack-plugin-4.2.0.tgz", + "integrity": "sha512-sIjfV+M1Ia8p/lVcLjvM2I0Lq/40tCMZe+k0Pxg2TG6TKjUgHGwQeM42QdYLiHAIAITGQK1HEQA3YknFubzfDQ==", + "dev": true, + "requires": { + "chalk": "^1.1.1", + "debug": "^2.6.8", + "filesize": "^3.2.1", + "lodash": "^4.5.1", + "mkdirp": "^0.5.1", + "moment": "^2.11.2" + }, + "dependencies": { + "lodash": { + "version": "4.17.11", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/lodash/-/lodash-4.17.11.tgz", + "integrity": "sha512-cQKh8igo5QUhZ7lg38DYWAxMvjSAKG0A8wGSVimP07SIUEK2UO+arSRKbRZWtelMtN5V0Hkwh5ryOto/SshYIg==", + "dev": true + } + } + }, + "ws": { + "version": "3.3.3", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/ws/-/ws-3.3.3.tgz", + "integrity": "sha512-nnWLa/NwZSt4KQJu51MYlCcSQ5g7INpOrOMt4XV8j4dqTXdmlUmSHQ8/oLC069ckre0fRsgfvsKwbTdtKLCDkA==", + "dev": true, + "requires": { + "async-limiter": "~1.0.0", + "safe-buffer": "~5.1.0", + "ultron": "~1.1.0" + } + }, + "xml": { + "version": "1.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/xml/-/xml-1.0.1.tgz", + "integrity": "sha1-eLpyAgApxbyHuKgaPPzXS0ovweU=", + "dev": true + }, + "xml-name-validator": { + "version": "3.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/xml-name-validator/-/xml-name-validator-3.0.0.tgz", + "integrity": "sha512-A5CUptxDsvxKJEU3yO6DuWBSJz/qizqzJKOMIfUJHETbBw/sFaDxgd6fxm1ewUaM0jZ444Fc5vC5ROYurg/4Pw==", + "dev": true + }, + "xml2js": { + "version": "0.4.19", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/xml2js/-/xml2js-0.4.19.tgz", + "integrity": "sha512-esZnJZJOiJR9wWKMyuvSE1y6Dq5LCuJanqhxslH2bxM6duahNZ+HMpCLhBQGZkbX6xRf8x1Y2eJlgt2q3qo49Q==", + "dev": true, + "requires": { + "sax": ">=0.6.0", + "xmlbuilder": "~9.0.1" + } + }, + "xmlbuilder": { + "version": "9.0.7", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/xmlbuilder/-/xmlbuilder-9.0.7.tgz", + "integrity": "sha1-Ey7mPS7FVlxVfiD0wi35rKaGsQ0=", + "dev": true + }, + "xmlhttprequest-ssl": { + "version": "1.5.5", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/xmlhttprequest-ssl/-/xmlhttprequest-ssl-1.5.5.tgz", + "integrity": "sha1-wodrBhaKrcQOV9l+gRkayPQ5iz4=", + "dev": true + }, + "xtend": { + "version": "4.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/xtend/-/xtend-4.0.1.tgz", + "integrity": "sha1-pcbVMr5lbiPbgg77lDofBJmNY68=", + "dev": true + }, + "y18n": { + "version": "3.2.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/y18n/-/y18n-3.2.1.tgz", + "integrity": "sha1-bRX7qITAhnnA136I53WegR4H+kE=", + "dev": true + }, + "yallist": { + "version": "2.1.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/yallist/-/yallist-2.1.2.tgz", + "integrity": "sha1-HBH5IY8HYImkfdUS+TxmmaaoHVI=", + "dev": true + }, + "yargs": { + "version": "6.4.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/yargs/-/yargs-6.4.0.tgz", + "integrity": "sha1-gW4ahm1VmMzzTlWW3c4i2S2kkNQ=", + "dev": true, + "requires": { + "camelcase": "^3.0.0", + "cliui": "^3.2.0", + "decamelize": "^1.1.1", + "get-caller-file": "^1.0.1", + "os-locale": "^1.4.0", + "read-pkg-up": "^1.0.1", + "require-directory": "^2.1.1", + "require-main-filename": "^1.0.1", + "set-blocking": "^2.0.0", + "string-width": "^1.0.2", + "which-module": "^1.0.0", + "window-size": "^0.2.0", + "y18n": "^3.2.1", + "yargs-parser": "^4.1.0" + }, + "dependencies": { + "camelcase": { + "version": "3.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/camelcase/-/camelcase-3.0.0.tgz", + "integrity": "sha1-MvxLn82vhF/N9+c7uXysImHwqwo=", + "dev": true + }, + "yargs-parser": { + "version": "4.2.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/yargs-parser/-/yargs-parser-4.2.1.tgz", + "integrity": "sha1-KczqwNxPA8bIe0qfIX3RjJ90hxw=", + "dev": true, + "requires": { + "camelcase": "^3.0.0" + } + } + } + }, + "yargs-parser": { + "version": "10.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/yargs-parser/-/yargs-parser-10.1.0.tgz", + "integrity": "sha512-VCIyR1wJoEBZUqk5PA+oOBF6ypbwh5aNB3I50guxAL/quggdfs4TtNHQrSazFA3fYZ+tEqfs0zIGlv0c/rgjbQ==", + "dev": true, + "requires": { + "camelcase": "^4.1.0" + } + }, + "yeast": { + "version": "0.1.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/yeast/-/yeast-0.1.2.tgz", + "integrity": "sha1-AI4G2AlDIMNy28L47XagymyKxBk=", + "dev": true + }, + "yeoman-environment": { + "version": "2.3.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/yeoman-environment/-/yeoman-environment-2.3.0.tgz", + "integrity": "sha512-PHSAkVOqYdcR+C+Uht1SGC4eVD/9OhygYFkYaI66xF8vKIeS1RNYay+umj2ZrQeJ50tF5Q/RSO6qGDz9y3Ifug==", + "dev": true, + "requires": { + "chalk": "^2.1.0", + "cross-spawn": "^6.0.5", + "debug": "^3.1.0", + "diff": "^3.3.1", + "escape-string-regexp": "^1.0.2", + "globby": "^8.0.1", + "grouped-queue": "^0.3.3", + "inquirer": "^5.2.0", + "is-scoped": "^1.0.0", + "lodash": "^4.17.10", + "log-symbols": "^2.1.0", + "mem-fs": "^1.1.0", + "strip-ansi": "^4.0.0", + "text-table": "^0.2.0", + "untildify": "^3.0.2" + }, + "dependencies": { + "ansi-regex": { + "version": "3.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/ansi-regex/-/ansi-regex-3.0.0.tgz", + "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", + "dev": true + }, + "ansi-styles": { + "version": "3.2.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, + "requires": { + "color-convert": "^1.9.0" + } + }, + "chalk": { + "version": "2.4.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/chalk/-/chalk-2.4.1.tgz", + "integrity": "sha512-ObN6h1v2fTJSmUXoS3nMQ92LbDK9be4TV+6G+omQlGJFdcUX5heKi1LZ1YnRMIgwTLEj3E24bT6tYni50rlCfQ==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + } + }, + "cross-spawn": { + "version": "6.0.5", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/cross-spawn/-/cross-spawn-6.0.5.tgz", + "integrity": "sha512-eTVLrBSt7fjbDygz805pMnstIs2VTBNkRm0qxZd+M7A5XDdxVRWO5MxGBXZhjY4cqLYLdtrGqRf8mBPmzwSpWQ==", + "dev": true, + "requires": { + "nice-try": "^1.0.4", + "path-key": "^2.0.1", + "semver": "^5.5.0", + "shebang-command": "^1.2.0", + "which": "^1.2.9" + } + }, + "debug": { + "version": "3.2.6", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/debug/-/debug-3.2.6.tgz", + "integrity": "sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ==", + "dev": true, + "requires": { + "ms": "^2.1.1" + } + }, + "globby": { + "version": "8.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/globby/-/globby-8.0.1.tgz", + "integrity": "sha512-oMrYrJERnKBLXNLVTqhm3vPEdJ/b2ZE28xN4YARiix1NOIOBPEpOUnm844K1iu/BkphCaf2WNFwMszv8Soi1pw==", + "dev": true, + "requires": { + "array-union": "^1.0.1", + "dir-glob": "^2.0.0", + "fast-glob": "^2.0.2", + "glob": "^7.1.2", + "ignore": "^3.3.5", + "pify": "^3.0.0", + "slash": "^1.0.0" + } + }, + "has-flag": { + "version": "3.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", + "dev": true + }, + "lodash": { + "version": "4.17.11", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/lodash/-/lodash-4.17.11.tgz", + "integrity": "sha512-cQKh8igo5QUhZ7lg38DYWAxMvjSAKG0A8wGSVimP07SIUEK2UO+arSRKbRZWtelMtN5V0Hkwh5ryOto/SshYIg==", + "dev": true + }, + "ms": { + "version": "2.1.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/ms/-/ms-2.1.1.tgz", + "integrity": "sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg==", + "dev": true + }, + "pify": { + "version": "3.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/pify/-/pify-3.0.0.tgz", + "integrity": "sha1-5aSs0sEB/fPZpNB/DbxNtJ3SgXY=", + "dev": true + }, + "strip-ansi": { + "version": "4.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/strip-ansi/-/strip-ansi-4.0.0.tgz", + "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", + "dev": true, + "requires": { + "ansi-regex": "^3.0.0" + } + }, + "supports-color": { + "version": "5.5.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } + } + } + }, + "yeoman-generator": { + "version": "3.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/yeoman-generator/-/yeoman-generator-3.0.0.tgz", + "integrity": "sha512-aHsNXzkdgAoakZTZsDX7T56wYWYd1O5E/GBIFAVMJLH7TKRr+1MiEJszZQbbCSA+J+lpT743/8L88j35yNdTLQ==", + "dev": true, + "requires": { + "async": "^2.6.0", + "chalk": "^2.3.0", + "cli-table": "^0.3.1", + "cross-spawn": "^6.0.5", + "dargs": "^6.0.0", + "dateformat": "^3.0.3", + "debug": "^3.1.0", + "detect-conflict": "^1.0.0", + "error": "^7.0.2", + "find-up": "^3.0.0", + "github-username": "^4.0.0", + "istextorbinary": "^2.2.1", + "lodash": "^4.17.10", + "make-dir": "^1.1.0", + "mem-fs-editor": "^5.0.0", + "minimist": "^1.2.0", + "pretty-bytes": "^5.1.0", + "read-chunk": "^2.1.0", + "read-pkg-up": "^4.0.0", + "rimraf": "^2.6.2", + "run-async": "^2.0.0", + "shelljs": "^0.8.0", + "text-table": "^0.2.0", + "through2": "^2.0.0", + "yeoman-environment": "^2.0.5" + }, + "dependencies": { + "ansi-styles": { + "version": "3.2.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, + "requires": { + "color-convert": "^1.9.0" + } + }, + "async": { + "version": "2.6.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/async/-/async-2.6.1.tgz", + "integrity": "sha512-fNEiL2+AZt6AlAw/29Cr0UDe4sRAHCpEHh54WMz+Bb7QfNcFw4h3loofyJpLeQs4Yx7yuqu/2dLgM5hKOs6HlQ==", + "dev": true, + "requires": { + "lodash": "^4.17.10" + } + }, + "chalk": { + "version": "2.4.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/chalk/-/chalk-2.4.1.tgz", + "integrity": "sha512-ObN6h1v2fTJSmUXoS3nMQ92LbDK9be4TV+6G+omQlGJFdcUX5heKi1LZ1YnRMIgwTLEj3E24bT6tYni50rlCfQ==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + } + }, + "cross-spawn": { + "version": "6.0.5", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/cross-spawn/-/cross-spawn-6.0.5.tgz", + "integrity": "sha512-eTVLrBSt7fjbDygz805pMnstIs2VTBNkRm0qxZd+M7A5XDdxVRWO5MxGBXZhjY4cqLYLdtrGqRf8mBPmzwSpWQ==", + "dev": true, + "requires": { + "nice-try": "^1.0.4", + "path-key": "^2.0.1", + "semver": "^5.5.0", + "shebang-command": "^1.2.0", + "which": "^1.2.9" + } + }, + "debug": { + "version": "3.2.6", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/debug/-/debug-3.2.6.tgz", + "integrity": "sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ==", + "dev": true, + "requires": { + "ms": "^2.1.1" + } + }, + "find-up": { + "version": "3.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/find-up/-/find-up-3.0.0.tgz", + "integrity": "sha512-1yD6RmLI1XBfxugvORwlck6f75tYL+iR0jqwsOrOxMZyGYqUuDhJ0l4AXdO1iX/FTs9cBAMEk1gWSEx1kSbylg==", + "dev": true, + "requires": { + "locate-path": "^3.0.0" + } + }, + "has-flag": { + "version": "3.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", + "dev": true + }, + "load-json-file": { + "version": "4.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/load-json-file/-/load-json-file-4.0.0.tgz", + "integrity": "sha1-L19Fq5HjMhYjT9U62rZo607AmTs=", + "dev": true, + "requires": { + "graceful-fs": "^4.1.2", + "parse-json": "^4.0.0", + "pify": "^3.0.0", + "strip-bom": "^3.0.0" + } + }, + "locate-path": { + "version": "3.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/locate-path/-/locate-path-3.0.0.tgz", + "integrity": "sha512-7AO748wWnIhNqAuaty2ZWHkQHRSNfPVIsPIfwEOWO22AmaoVrWavlOcMR5nzTLNYvp36X220/maaRsrec1G65A==", + "dev": true, + "requires": { + "p-locate": "^3.0.0", + "path-exists": "^3.0.0" + } + }, + "lodash": { + "version": "4.17.11", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/lodash/-/lodash-4.17.11.tgz", + "integrity": "sha512-cQKh8igo5QUhZ7lg38DYWAxMvjSAKG0A8wGSVimP07SIUEK2UO+arSRKbRZWtelMtN5V0Hkwh5ryOto/SshYIg==", + "dev": true + }, + "ms": { + "version": "2.1.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/ms/-/ms-2.1.1.tgz", + "integrity": "sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg==", + "dev": true + }, + "p-limit": { + "version": "2.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/p-limit/-/p-limit-2.0.0.tgz", + "integrity": "sha512-fl5s52lI5ahKCernzzIyAP0QAZbGIovtVHGwpcu1Jr/EpzLVDI2myISHwGqK7m8uQFugVWSrbxH7XnhGtvEc+A==", + "dev": true, + "requires": { + "p-try": "^2.0.0" + } + }, + "p-locate": { + "version": "3.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/p-locate/-/p-locate-3.0.0.tgz", + "integrity": "sha512-x+12w/To+4GFfgJhBEpiDcLozRJGegY+Ei7/z0tSLkMmxGZNybVMSfWj9aJn8Z5Fc7dBUNJOOVgPv2H7IwulSQ==", + "dev": true, + "requires": { + "p-limit": "^2.0.0" + } + }, + "p-try": { + "version": "2.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/p-try/-/p-try-2.0.0.tgz", + "integrity": "sha512-hMp0onDKIajHfIkdRk3P4CdCmErkYAxxDtP3Wx/4nZ3aGlau2VKh3mZpcuFkH27WQkL/3WBCPOktzA9ZOAnMQQ==", + "dev": true + }, + "parse-json": { + "version": "4.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/parse-json/-/parse-json-4.0.0.tgz", + "integrity": "sha1-vjX1Qlvh9/bHRxhPmKeIy5lHfuA=", + "dev": true, + "requires": { + "error-ex": "^1.3.1", + "json-parse-better-errors": "^1.0.1" + } + }, + "path-exists": { + "version": "3.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/path-exists/-/path-exists-3.0.0.tgz", + "integrity": "sha1-zg6+ql94yxiSXqfYENe1mwEP1RU=", + "dev": true + }, + "path-type": { + "version": "3.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/path-type/-/path-type-3.0.0.tgz", + "integrity": "sha512-T2ZUsdZFHgA3u4e5PfPbjd7HDDpxPnQb5jN0SrDsjNSuVXHJqtwTnWqG0B1jZrgmJ/7lj1EmVIByWt1gxGkWvg==", + "dev": true, + "requires": { + "pify": "^3.0.0" + } + }, + "pify": { + "version": "3.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/pify/-/pify-3.0.0.tgz", + "integrity": "sha1-5aSs0sEB/fPZpNB/DbxNtJ3SgXY=", + "dev": true + }, + "read-pkg": { + "version": "3.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/read-pkg/-/read-pkg-3.0.0.tgz", + "integrity": "sha1-nLxoaXj+5l0WwA4rGcI3/Pbjg4k=", + "dev": true, + "requires": { + "load-json-file": "^4.0.0", + "normalize-package-data": "^2.3.2", + "path-type": "^3.0.0" + } + }, + "read-pkg-up": { + "version": "4.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/read-pkg-up/-/read-pkg-up-4.0.0.tgz", + "integrity": "sha512-6etQSH7nJGsK0RbG/2TeDzZFa8shjQ1um+SwQQ5cwKy0dhSXdOncEhb1CPpvQG4h7FyOV6EB6YlV0yJvZQNAkA==", + "dev": true, + "requires": { + "find-up": "^3.0.0", + "read-pkg": "^3.0.0" + } + }, + "rimraf": { + "version": "2.6.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/rimraf/-/rimraf-2.6.2.tgz", + "integrity": "sha512-lreewLK/BlghmxtfH36YYVg1i8IAce4TI7oao75I1g245+6BctqTVQiBP3YUJ9C6DQOXJmkYR9X9fCLtCOJc5w==", + "dev": true, + "requires": { + "glob": "^7.0.5" + } + }, + "strip-bom": { + "version": "3.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/strip-bom/-/strip-bom-3.0.0.tgz", + "integrity": "sha1-IzTBjpx1n3vdVv3vfprj1YjmjtM=", + "dev": true + }, + "supports-color": { + "version": "5.5.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } + } + } + }, + "zone.js": { + "version": "0.8.26", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/zone.js/-/zone.js-0.8.26.tgz", + "integrity": "sha512-W9Nj+UmBJG251wkCacIkETgra4QgBo/vgoEkb4a2uoLzpQG7qF9nzwoLXWU5xj3Fg2mxGvEDh47mg24vXccYjA==" + } + } +} diff --git a/jhipster/jhipster-uaa/gateway/package.json b/jhipster/jhipster-uaa/gateway/package.json new file mode 100644 index 0000000000..2196622413 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/package.json @@ -0,0 +1,131 @@ +{ + "name": "gateway", + "version": "0.0.0", + "description": "Description for gateway", + "private": true, + "license": "UNLICENSED", + "cacheDirectories": [ + "node_modules" + ], + "dependencies": { + "@angular/common": "6.1.0", + "@angular/compiler": "6.1.0", + "@angular/core": "6.1.0", + "@angular/forms": "6.1.0", + "@angular/platform-browser": "6.1.0", + "@angular/platform-browser-dynamic": "6.1.0", + "@angular/router": "6.1.0", + "@fortawesome/angular-fontawesome": "0.2.0", + "@fortawesome/fontawesome-svg-core": "1.2.4", + "@fortawesome/free-solid-svg-icons": "5.3.1", + "@ng-bootstrap/ng-bootstrap": "3.0.0", + "bootstrap": "4.1.3", + "core-js": "2.5.7", + "moment": "2.22.2", + "ng-jhipster": "0.5.4", + "ngx-cookie": "2.0.1", + "ngx-infinite-scroll": "0.5.1", + "ngx-webstorage": "2.0.1", + "reflect-metadata": "0.1.12", + "rxjs": "6.1.0", + "rxjs-compat": "6.1.0", + "swagger-ui": "2.2.10", + "tslib": "1.9.3", + "zone.js": "0.8.26" + }, + "devDependencies": { + "@angular/cli": "6.1.2", + "@angular/compiler-cli": "6.1.0", + "@ngtools/webpack": "6.0.0", + "@types/jest": "22.2.3", + "@types/node": "9.4.7", + "angular-router-loader": "0.8.5", + "angular2-template-loader": "0.6.2", + "browser-sync": "2.24.6", + "browser-sync-webpack-plugin": "2.2.2", + "cache-loader": "1.2.2", + "codelyzer": "4.2.1", + "copy-webpack-plugin": "4.5.1", + "css-loader": "0.28.10", + "exports-loader": "0.7.0", + "file-loader": "1.1.11", + "fork-ts-checker-webpack-plugin": "0.4.1", + "friendly-errors-webpack-plugin": "1.7.0", + "generator-jhipster": "5.4.2", + "html-loader": "0.5.5", + "html-webpack-plugin": "3.2.0", + "husky": "1.1.0", + "jest": "22.4.3", + "jest-junit": "5.1.0", + "jest-preset-angular": "5.2.2", + "jest-sonar-reporter": "2.0.0", + "lint-staged": "7.3.0", + "merge-jsons-webpack-plugin": "1.0.14", + "mini-css-extract-plugin": "0.4.2", + "moment-locales-webpack-plugin": "1.0.5", + "optimize-css-assets-webpack-plugin": "5.0.1", + "prettier": "1.11.1", + "proxy-middleware": "0.15.0", + "raw-loader": "0.5.1", + "rimraf": "2.6.1", + "simple-progress-webpack-plugin": "1.1.2", + "style-loader": "0.20.3", + "tapable": "1.0.0", + "terser-webpack-plugin": "1.0.0", + "thread-loader": "1.1.5", + "to-string-loader": "1.1.5", + "ts-loader": "4.0.1", + "tslint": "5.9.1", + "tslint-config-prettier": "1.9.0", + "tslint-loader": "3.6.0", + "typescript": "2.7.2", + "sass": "1.13.0", + "sass-loader": "7.1.0", + "postcss-loader": "2.1.1", + "xml2js": "0.4.19", + "webpack": "4.8.0", + "webpack-cli": "2.1.3", + "webpack-dev-server": "3.1.5", + "webpack-merge": "4.1.2", + "webpack-notifier": "1.6.0", + "webpack-visualizer-plugin": "0.1.11", + "workbox-webpack-plugin": "3.2.0", + "write-file-webpack-plugin": "4.2.0" + }, + "engines": { + "node": ">=8.9.0" + }, + "lint-staged": { + "src/**/*.{ts,css,scss}": [ + "prettier --write", + "git add" + ] + }, + "scripts": { + "prettier:format": "prettier --write \"src/**/*.{ts,css,scss}\"", + "lint": "tslint --project tsconfig.json -e 'node_modules/**'", + "lint:fix": "npm run lint -- --fix", + "ngc": "ngc -p tsconfig-aot.json", + "cleanup": "rimraf target/{aot,www}", + "clean-www": "rimraf target//www/app/{src,target/}", + "start": "npm run webpack:dev", + "start-tls": "npm run webpack:dev -- --env.tls", + "serve": "npm run start", + "build": "npm run webpack:prod", + "test": "npm run lint && jest --coverage --logHeapUsage -w=2 --config src/test/javascript/jest.conf.js", + "test:watch": "npm test -- --watch --clearCache", + "webpack:dev": "npm run webpack-dev-server -- --config webpack/webpack.dev.js --inline --hot --port=9060 --watch-content-base --env.stats=minimal", + "webpack:dev-verbose": "npm run webpack-dev-server -- --config webpack/webpack.dev.js --inline --hot --port=9060 --watch-content-base --profile --progress --env.stats=normal", + "webpack:build:main": "npm run webpack -- --config webpack/webpack.dev.js --env.stats=normal", + "webpack:build": "npm run cleanup && npm run webpack:build:main", + "webpack:prod:main": "npm run webpack -- --config webpack/webpack.prod.js --profile", + "webpack:prod": "npm run cleanup && npm run webpack:prod:main && npm run clean-www", + "webpack:test": "npm run test", + "webpack-dev-server": "node --max_old_space_size=4096 node_modules/webpack-dev-server/bin/webpack-dev-server.js", + "webpack": "node --max_old_space_size=4096 node_modules/webpack/bin/webpack.js" + }, + "jestSonar": { + "reportPath": "target/test-results/jest", + "reportFile": "TESTS-results-sonar.xml" + } +} diff --git a/jhipster/jhipster-uaa/gateway/pom.xml b/jhipster/jhipster-uaa/gateway/pom.xml new file mode 100644 index 0000000000..52f84e4006 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/pom.xml @@ -0,0 +1,1095 @@ + + + 4.0.0 + + com.baeldung.jhipster.gateway + gateway + 0.0.1-SNAPSHOT + war + Gateway + + + + + + + + + + 3.0.0 + 1.8 + 2.12.6 + v8.12.0 + 6.4.1 + UTF-8 + UTF-8 + ${project.build.directory}/test-results + yyyyMMddHHmmss + ${java.version} + ${java.version} + -Djava.security.egd=file:/dev/./urandom -Xmx256m + jdt_apt + false + + + + + + + 2.0.25 + + 2.0.5.RELEASE + + 5.2.17.Final + + 3.22.0-GA + + 3.5.5 + 3.6 + 2.0.1.Final + 1.2.0.Final + + + 3.1.0 + 3.8.0 + 2.10 + 3.0.0-M2 + 3.1.0 + 2.22.0 + 3.2.2 + 0.9.11 + 1.6 + 0.8.2 + 3.4.2 + 3.5.0.1254 + 2.2.5 + + + http://localhost:9001 + src/main/webapp/content/**/*.*, src/main/webapp/i18n/*.js, target/www/**/*.* + S3437,S4684,UndocumentedApi,BoldAndItalicTagsCheck + + src/main/webapp/app/**/*.* + Web:BoldAndItalicTagsCheck + + src/main/java/**/* + squid:S3437 + + src/main/java/**/* + squid:UndocumentedApi + + src/main/java/**/* + squid:S4684 + ${project.testresult.directory}/coverage/jacoco/jacoco.exec + jacoco + ${project.testresult.directory}/jest/TESTS-results-sonar.xml + ${project.testresult.directory}/lcov.info + ${project.basedir}/src/main/ + ${project.testresult.directory}/surefire-reports + ${project.basedir}/src/test/ + + + + + + + + io.github.jhipster + jhipster-dependencies + ${jhipster-dependencies.version} + pom + import + + + + + + + + io.github.jhipster + jhipster-framework + + + + org.springframework.boot + spring-boot-starter-cache + + + io.dropwizard.metrics + metrics-core + + + io.dropwizard.metrics + metrics-annotation + + + io.dropwizard.metrics + metrics-json + + + io.dropwizard.metrics + metrics-jvm + + + io.dropwizard.metrics + metrics-servlet + + + io.dropwizard.metrics + metrics-servlets + + + com.fasterxml.jackson.datatype + jackson-datatype-hibernate5 + + + com.fasterxml.jackson.datatype + jackson-datatype-hppc + + + com.fasterxml.jackson.datatype + jackson-datatype-jsr310 + + + com.fasterxml.jackson.module + jackson-module-afterburner + + + com.h2database + h2 + test + + + org.apache.httpcomponents + httpclient + + + com.hazelcast + hazelcast + + + com.hazelcast + hazelcast-hibernate52 + + + com.hazelcast + hazelcast-spring + + + com.jayway.jsonpath + json-path + test + + + + io.springfox + springfox-swagger2 + + + io.springfox + springfox-bean-validators + + + com.mattbertolini + liquibase-slf4j + + + com.ryantenney.metrics + metrics-spring + + + com.zaxxer + HikariCP + + + commons-io + commons-io + + + org.apache.commons + commons-lang3 + + + javax.cache + cache-api + + + mysql + mysql-connector-java + + + org.assertj + assertj-core + test + + + org.hibernate + hibernate-jpamodelgen + ${hibernate.version} + provided + + + org.hibernate + hibernate-envers + + + org.hibernate.validator + hibernate-validator + + + org.liquibase + liquibase-core + + + net.logstash.logback + logstash-logback-encoder + + + org.mapstruct + mapstruct-jdk8 + ${mapstruct.version} + + + org.mapstruct + mapstruct-processor + ${mapstruct.version} + provided + + + org.springframework.boot + spring-boot-configuration-processor + provided + + + org.springframework.boot + spring-boot-loader-tools + + + org.springframework.boot + spring-boot-starter-actuator + + + org.springframework.boot + spring-boot-starter-aop + + + org.springframework.boot + spring-boot-starter-data-jpa + + + org.springframework.boot + spring-boot-starter-logging + + + org.springframework.boot + spring-boot-starter-mail + + + org.springframework.boot + spring-boot-starter-security + + + org.springframework.boot + spring-boot-starter-thymeleaf + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework.boot + spring-boot-starter-test + test + + + org.springframework.boot + spring-boot-test + test + + + org.springframework.security + spring-security-test + test + + + org.zalando + problem-spring-web + 0.24.0-RC.0 + + + org.springframework.security.oauth + spring-security-oauth2 + + + org.springframework.security + spring-security-jwt + + + + org.springframework.cloud + spring-cloud-starter-netflix-zuul + + + com.github.vladimir-bukhtoyarov + bucket4j-core + + + com.github.vladimir-bukhtoyarov + bucket4j-jcache + + + org.springframework.cloud + spring-cloud-starter + + + org.springframework.cloud + spring-cloud-starter-netflix-ribbon + + + org.springframework.cloud + spring-cloud-starter-netflix-hystrix + + + org.springframework.retry + spring-retry + + + org.springframework.cloud + spring-cloud-starter-netflix-eureka-client + + + org.springframework.cloud + spring-cloud-starter-config + + + org.springframework.cloud + spring-cloud-security + + + org.springframework.cloud + spring-cloud-starter-openfeign + + + org.springframework.cloud + spring-cloud-spring-service-connector + + + + org.springframework.security + spring-security-data + + + + + + spring-boot:run + + + org.apache.maven.plugins + maven-compiler-plugin + ${maven-compiler-plugin.version} + + + + org.mapstruct + mapstruct-processor + ${mapstruct.version} + + + + org.hibernate + hibernate-jpamodelgen + ${hibernate.version} + + + + + + + org.apache.maven.plugins + maven-eclipse-plugin + ${maven-eclipse-plugin.version} + + true + true + + + + org.apache.maven.plugins + maven-enforcer-plugin + ${maven-enforcer-plugin.version} + + + enforce-versions + + enforce + + + + + + + You are running an older version of Maven. JHipster requires at least Maven ${maven.version} + [${maven.version},) + + + + You are running an incompatible version of Java. JHipster requires JDK ${java.version} + [1.8,1.9) + + + + + + org.apache.maven.plugins + maven-resources-plugin + ${maven-resources-plugin.version} + + + default-resources + validate + + copy-resources + + + target/classes + false + + # + + + + src/main/resources/ + true + + config/*.yml + + + + src/main/resources/ + false + + config/*.yml + + + + + + + docker-resources + verify + + copy-resources + + + target/classes/static/ + + + target/www + false + + + + + + + + org.apache.maven.plugins + maven-surefire-plugin + ${maven-surefire-plugin.version} + + + alphabetical + + + + org.jacoco + jacoco-maven-plugin + ${jacoco-maven-plugin.version} + + + pre-unit-tests + + prepare-agent + + + + ${project.testresult.directory}/coverage/jacoco/jacoco.exec + + + + + post-unit-test + test + + report + + + ${project.testresult.directory}/coverage/jacoco/jacoco.exec + ${project.testresult.directory}/coverage/jacoco + + + + + + org.sonarsource.scanner.maven + sonar-maven-plugin + ${sonar-maven-plugin.version} + + + org.liquibase + liquibase-maven-plugin + ${liquibase.version} + + src/main/resources/config/liquibase/master.xml + src/main/resources/config/liquibase/changelog/${maven.build.timestamp}_changelog.xml + org.h2.Driver + jdbc:h2:file:./target/h2db/db/gateway + + gateway + + hibernate:spring:com.baeldung.jhipster.gateway.domain?dialect=org.hibernate.dialect.H2Dialect&hibernate.physical_naming_strategy=org.springframework.boot.orm.jpa.hibernate.SpringPhysicalNamingStrategy&hibernate.implicit_naming_strategy=org.springframework.boot.orm.jpa.hibernate.SpringImplicitNamingStrategy + true + debug + + + + org.javassist + javassist + ${javassist.version} + + + org.liquibase.ext + liquibase-hibernate5 + ${liquibase-hibernate5.version} + + + org.springframework.boot + spring-boot-starter-data-jpa + ${spring-boot.version} + + + javax.validation + validation-api + ${validation-api.version} + + + + + org.springframework.boot + spring-boot-maven-plugin + ${spring-boot.version} + + + + repackage + + + + + ${start-class} + true + true + + + + + com.google.cloud.tools + jib-maven-plugin + ${jib-maven-plugin.version} + + + openjdk:8-jre-alpine + + + gateway:latest + + + + sh + + chmod +x /entrypoint.sh && sync && /entrypoint.sh + + + 8080 + 5701/udp + + + ALWAYS + 0 + + true + + + + + + + + + + org.eclipse.m2e + lifecycle-mapping + 1.0.0 + + + + + + org.jacoco + + jacoco-maven-plugin + + + ${jacoco-maven-plugin.version} + + + prepare-agent + + + + + + + + + com.github.eirslett + frontend-maven-plugin + ${frontend-maven-plugin.version} + + install-node-and-npm + npm + + + + + + + + + + + + + + + + no-liquibase + + ,no-liquibase + + + + swagger + + ,swagger + + + + tls + + ,tls + + + + webpack + + + ${basedir}/target/www/app/main.bundle.js + + + + + org.springframework.boot + spring-boot-starter-undertow + + + org.springframework.boot + spring-boot-devtools + true + + + com.h2database + h2 + + + + + + com.github.eirslett + frontend-maven-plugin + ${frontend-maven-plugin.version} + + + install node and npm + + install-node-and-npm + + + ${node.version} + ${npm.version} + + + + npm install + + npm + + + + webpack build dev + + npm + + generate-resources + + run webpack:build + false + + + + + + org.apache.maven.plugins + maven-war-plugin + ${maven-war-plugin.version} + + false + target/www/ + + + src/main/webapp + + WEB-INF/** + + + + + + + + + + dev${profile.no-liquibase} + + + + dev + + true + + + + org.springframework.boot + spring-boot-starter-undertow + + + org.springframework.boot + spring-boot-devtools + true + + + com.h2database + h2 + + + + + + org.apache.maven.plugins + maven-war-plugin + ${maven-war-plugin.version} + + false + target/www/ + + + src/main/webapp + + WEB-INF/** + + + + + + + + + + dev${profile.tls}${profile.no-liquibase} + + + + prod + + + org.springframework.boot + spring-boot-starter-undertow + + + + + + maven-clean-plugin + ${maven-clean-plugin.version} + + + + target/www/ + + + + + + org.apache.maven.plugins + maven-war-plugin + ${maven-war-plugin.version} + + false + target/www/ + + + src/main/webapp + + WEB-INF/** + + + + + + + org.springframework.boot + spring-boot-maven-plugin + ${spring-boot.version} + + ${start-class} + true + + + + + build-info + + + + + + com.github.eirslett + frontend-maven-plugin + ${frontend-maven-plugin.version} + + + install node and npm + + install-node-and-npm + + + ${node.version} + ${npm.version} + + + + npm install + + npm + + + install + + + + webpack build test + + npm + + test + + run webpack:test + false + + + + webpack build prod + + npm + + generate-resources + + run webpack:prod + false + + + + + + pl.project13.maven + git-commit-id-plugin + ${git-commit-id-plugin.version} + + + + revision + + + + + false + true + + ^git.commit.id.abbrev$ + ^git.commit.id.describe$ + ^git.branch$ + + + + + + + + prod${profile.swagger}${profile.no-liquibase} + + + + + cc + + + org.springframework.boot + spring-boot-starter-undertow + + + org.springframework.boot + spring-boot-devtools + true + + + + + + org.apache.maven.plugins + maven-war-plugin + ${maven-war-plugin.version} + + false + src/main/webapp/ + + + + org.springframework.boot + spring-boot-maven-plugin + ${spring-boot.version} + + ${start-class} + true + true + true + + + + + org.apache.maven.plugins + maven-compiler-plugin + ${maven-compiler-plugin.version} + + + default-compile + none + + + default-testCompile + none + + + + + net.alchim31.maven + scala-maven-plugin + ${scala-maven-plugin.version} + + + compile + compile + + add-source + compile + + + + test-compile + test-compile + + add-source + testCompile + + + + + incremental + true + ${scala.version} + + + + + + + dev,swagger + + + + + zipkin + + + org.springframework.cloud + spring-cloud-starter-zipkin + + + + + + IDE + + + org.mapstruct + mapstruct-processor + ${mapstruct.version} + + + org.hibernate + hibernate-jpamodelgen + ${hibernate.version} + + + + + + diff --git a/jhipster/jhipster-uaa/gateway/postcss.config.js b/jhipster/jhipster-uaa/gateway/postcss.config.js new file mode 100644 index 0000000000..f549c034d5 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/postcss.config.js @@ -0,0 +1,3 @@ +module.exports = { + plugins: [] +} diff --git a/jhipster/jhipster-uaa/gateway/proxy.conf.json b/jhipster/jhipster-uaa/gateway/proxy.conf.json new file mode 100644 index 0000000000..8b41fdf7fa --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/proxy.conf.json @@ -0,0 +1,7 @@ +{ + "*": { + "target": "http://localhost:8080", + "secure": false, + "loglevel": "debug" + } +} diff --git a/jhipster/jhipster-uaa/gateway/src/main/docker/.dockerignore b/jhipster/jhipster-uaa/gateway/src/main/docker/.dockerignore new file mode 100644 index 0000000000..b03bdc71ee --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/docker/.dockerignore @@ -0,0 +1,14 @@ +# https://docs.docker.com/engine/reference/builder/#dockerignore-file +classes/ +generated-sources/ +generated-test-sources/ +h2db/ +maven-archiver/ +maven-status/ +reports/ +surefire-reports/ +test-classes/ +test-results/ +www/ +!*.jar +!*.war diff --git a/jhipster/jhipster-uaa/gateway/src/main/docker/Dockerfile b/jhipster/jhipster-uaa/gateway/src/main/docker/Dockerfile new file mode 100644 index 0000000000..6a1c74c0bf --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/docker/Dockerfile @@ -0,0 +1,20 @@ +FROM openjdk:8-jre-alpine + +ENV SPRING_OUTPUT_ANSI_ENABLED=ALWAYS \ + JHIPSTER_SLEEP=0 \ + JAVA_OPTS="" + +# Add a jhipster user to run our application so that it doesn't need to run as root +RUN adduser -D -s /bin/sh jhipster +WORKDIR /home/jhipster + +ADD entrypoint.sh entrypoint.sh +RUN chmod 755 entrypoint.sh && chown jhipster:jhipster entrypoint.sh +USER jhipster + +ENTRYPOINT ["./entrypoint.sh"] + +EXPOSE 8080 5701/udp + +ADD *.war app.war + diff --git a/jhipster/jhipster-uaa/gateway/src/main/docker/app.yml b/jhipster/jhipster-uaa/gateway/src/main/docker/app.yml new file mode 100644 index 0000000000..347681e676 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/docker/app.yml @@ -0,0 +1,24 @@ +version: '2' +services: + gateway-app: + image: gateway + environment: + # - _JAVA_OPTIONS=-Xmx512m -Xms256m + - SPRING_PROFILES_ACTIVE=prod,swagger + - EUREKA_CLIENT_SERVICE_URL_DEFAULTZONE=http://admin:$${jhipster.registry.password}@jhipster-registry:8761/eureka + - SPRING_CLOUD_CONFIG_URI=http://admin:$${jhipster.registry.password}@jhipster-registry:8761/config + - SPRING_DATASOURCE_URL=jdbc:mysql://gateway-mysql:3306/gateway?useUnicode=true&characterEncoding=utf8&useSSL=false + - JHIPSTER_SLEEP=30 # gives time for the JHipster Registry to boot before the application + ports: + - 8080:8080 + gateway-mysql: + extends: + file: mysql.yml + service: gateway-mysql + jhipster-registry: + extends: + file: jhipster-registry.yml + service: jhipster-registry + environment: + - SPRING_CLOUD_CONFIG_SERVER_COMPOSITE_0_TYPE=native + - SPRING_CLOUD_CONFIG_SERVER_COMPOSITE_0_SEARCH_LOCATIONS=file:./central-config/docker-config/ diff --git a/jhipster/jhipster-uaa/gateway/src/main/docker/central-server-config/README.md b/jhipster/jhipster-uaa/gateway/src/main/docker/central-server-config/README.md new file mode 100644 index 0000000000..6aab9ffdd5 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/docker/central-server-config/README.md @@ -0,0 +1,7 @@ +# Central configuration sources details + +The JHipster-Registry will use the following directories as its configuration source : +- localhost-config : when running the registry in docker with the jhipster-registry.yml docker-compose file +- docker-config : when running the registry and the app both in docker with the app.yml docker-compose file + +For more info, refer to https://www.jhipster.tech/microservices-architecture/#registry_app_configuration diff --git a/jhipster/jhipster-uaa/gateway/src/main/docker/central-server-config/docker-config/application.yml b/jhipster/jhipster-uaa/gateway/src/main/docker/central-server-config/docker-config/application.yml new file mode 100644 index 0000000000..8a973c0a35 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/docker/central-server-config/docker-config/application.yml @@ -0,0 +1,15 @@ +# Common configuration shared between all applications +configserver: + name: Docker JHipster Registry + status: Connected to the JHipster Registry running in Docker + +jhipster: + security: + authentication: + jwt: + secret: my-secret-key-which-should-be-changed-in-production-and-be-base64-encoded + +eureka: + client: + service-url: + defaultZone: http://admin:${jhipster.registry.password}@jhipster-registry:8761/eureka/ diff --git a/jhipster/jhipster-uaa/gateway/src/main/docker/central-server-config/localhost-config/application.yml b/jhipster/jhipster-uaa/gateway/src/main/docker/central-server-config/localhost-config/application.yml new file mode 100644 index 0000000000..db4602e419 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/docker/central-server-config/localhost-config/application.yml @@ -0,0 +1,15 @@ +# Common configuration shared between all applications +configserver: + name: Docker JHipster Registry + status: Connected to the JHipster Registry running in Docker + +jhipster: + security: + authentication: + jwt: + secret: my-secret-key-which-should-be-changed-in-production-and-be-base64-encoded + +eureka: + client: + service-url: + defaultZone: http://admin:${jhipster.registry.password}@localhost:8761/eureka/ diff --git a/jhipster/jhipster-uaa/gateway/src/main/docker/entrypoint.sh b/jhipster/jhipster-uaa/gateway/src/main/docker/entrypoint.sh new file mode 100644 index 0000000000..ccffafb5a4 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/docker/entrypoint.sh @@ -0,0 +1,4 @@ +#!/bin/sh + +echo "The application will start in ${JHIPSTER_SLEEP}s..." && sleep ${JHIPSTER_SLEEP} +exec java ${JAVA_OPTS} -Djava.security.egd=file:/dev/./urandom -jar "${HOME}/app.war" "$@" diff --git a/jhipster/jhipster-uaa/gateway/src/main/docker/hazelcast-management-center.yml b/jhipster/jhipster-uaa/gateway/src/main/docker/hazelcast-management-center.yml new file mode 100644 index 0000000000..9ad1303458 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/docker/hazelcast-management-center.yml @@ -0,0 +1,6 @@ +version: '2' +services: + gateway-hazelcast-management-center: + image: hazelcast/management-center:3.9.3 + ports: + - 8180:8080 diff --git a/jhipster/jhipster-uaa/gateway/src/main/docker/jhipster-registry.yml b/jhipster/jhipster-uaa/gateway/src/main/docker/jhipster-registry.yml new file mode 100644 index 0000000000..512bc54be6 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/docker/jhipster-registry.yml @@ -0,0 +1,22 @@ +version: '2' +services: + jhipster-registry: + image: jhipster/jhipster-registry:v4.0.4 + volumes: + - ./central-server-config:/central-config + # When run with the "dev" Spring profile, the JHipster Registry will + # read the config from the local filesystem (central-server-config directory) + # When run with the "prod" Spring profile, it will read the configuration from a Git repository + # See https://www.jhipster.tech/microservices-architecture/#registry_app_configuration + environment: + # - _JAVA_OPTIONS=-Xmx512m -Xms256m + - SPRING_PROFILES_ACTIVE=dev,swagger,uaa + - SPRING_SECURITY_USER_PASSWORD=admin + - JHIPSTER_REGISTRY_PASSWORD=admin + - SPRING_CLOUD_CONFIG_SERVER_COMPOSITE_0_TYPE=native + - SPRING_CLOUD_CONFIG_SERVER_COMPOSITE_0_SEARCH_LOCATIONS=file:./central-config/localhost-config/ + # - SPRING_CLOUD_CONFIG_SERVER_COMPOSITE_0_TYPE=git + # - SPRING_CLOUD_CONFIG_SERVER_COMPOSITE_0_URI=https://github.com/jhipster/jhipster-registry/ + # - SPRING_CLOUD_CONFIG_SERVER_COMPOSITE_0_SEARCH_PATHS=central-config + ports: + - 8761:8761 diff --git a/jhipster/jhipster-uaa/gateway/src/main/docker/mysql.yml b/jhipster/jhipster-uaa/gateway/src/main/docker/mysql.yml new file mode 100644 index 0000000000..a3cc7bf368 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/docker/mysql.yml @@ -0,0 +1,13 @@ +version: '2' +services: + gateway-mysql: + image: mysql:5.7.20 + # volumes: + # - ~/volumes/jhipster/gateway/mysql/:/var/lib/mysql/ + environment: + - MYSQL_USER=root + - MYSQL_ALLOW_EMPTY_PASSWORD=yes + - MYSQL_DATABASE=gateway + ports: + - 3306:3306 + command: mysqld --lower_case_table_names=1 --skip-ssl --character_set_server=utf8mb4 --explicit_defaults_for_timestamp diff --git a/jhipster/jhipster-uaa/gateway/src/main/docker/sonar.yml b/jhipster/jhipster-uaa/gateway/src/main/docker/sonar.yml new file mode 100644 index 0000000000..64182e81ef --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/docker/sonar.yml @@ -0,0 +1,7 @@ +version: '2' +services: + gateway-sonar: + image: sonarqube:7.1-alpine + ports: + - 9001:9000 + - 9092:9092 diff --git a/jhipster/jhipster-uaa/gateway/src/main/java/com/baeldung/jhipster/gateway/ApplicationWebXml.java b/jhipster/jhipster-uaa/gateway/src/main/java/com/baeldung/jhipster/gateway/ApplicationWebXml.java new file mode 100644 index 0000000000..30ad451b11 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/java/com/baeldung/jhipster/gateway/ApplicationWebXml.java @@ -0,0 +1,21 @@ +package com.baeldung.jhipster.gateway; + +import com.baeldung.jhipster.gateway.config.DefaultProfileUtil; +import org.springframework.boot.builder.SpringApplicationBuilder; +import org.springframework.boot.web.servlet.support.SpringBootServletInitializer; + +/** + * This is a helper Java class that provides an alternative to creating a web.xml. + * This will be invoked only when the application is deployed to a Servlet container like Tomcat, JBoss etc. + */ +public class ApplicationWebXml extends SpringBootServletInitializer { + + @Override + protected SpringApplicationBuilder configure(SpringApplicationBuilder application) { + /** + * set a default to use when no profile is configured. + */ + DefaultProfileUtil.addDefaultProfile(application.application()); + return application.sources(GatewayApp.class); + } +} diff --git a/jhipster/jhipster-uaa/gateway/src/main/java/com/baeldung/jhipster/gateway/GatewayApp.java b/jhipster/jhipster-uaa/gateway/src/main/java/com/baeldung/jhipster/gateway/GatewayApp.java new file mode 100644 index 0000000000..60d90eae25 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/java/com/baeldung/jhipster/gateway/GatewayApp.java @@ -0,0 +1,109 @@ +package com.baeldung.jhipster.gateway; + +import com.baeldung.jhipster.gateway.config.ApplicationProperties; +import com.baeldung.jhipster.gateway.config.DefaultProfileUtil; + +import io.github.jhipster.config.JHipsterConstants; + +import org.apache.commons.lang3.StringUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.boot.autoconfigure.liquibase.LiquibaseProperties; +import org.springframework.boot.context.properties.EnableConfigurationProperties; +import org.springframework.cloud.client.discovery.EnableDiscoveryClient; +import org.springframework.cloud.netflix.zuul.EnableZuulProxy; +import org.springframework.core.env.Environment; + +import javax.annotation.PostConstruct; +import java.net.InetAddress; +import java.net.UnknownHostException; +import java.util.Arrays; +import java.util.Collection; + +@SpringBootApplication +@EnableConfigurationProperties({LiquibaseProperties.class, ApplicationProperties.class}) +@EnableDiscoveryClient +@EnableZuulProxy +public class GatewayApp { + + private static final Logger log = LoggerFactory.getLogger(GatewayApp.class); + + private final Environment env; + + public GatewayApp(Environment env) { + this.env = env; + } + + /** + * Initializes gateway. + *

+ * Spring profiles can be configured with a program argument --spring.profiles.active=your-active-profile + *

+ * You can find more information on how profiles work with JHipster on https://www.jhipster.tech/profiles/. + */ + @PostConstruct + public void initApplication() { + Collection activeProfiles = Arrays.asList(env.getActiveProfiles()); + if (activeProfiles.contains(JHipsterConstants.SPRING_PROFILE_DEVELOPMENT) && activeProfiles.contains(JHipsterConstants.SPRING_PROFILE_PRODUCTION)) { + log.error("You have misconfigured your application! It should not run " + + "with both the 'dev' and 'prod' profiles at the same time."); + } + if (activeProfiles.contains(JHipsterConstants.SPRING_PROFILE_DEVELOPMENT) && activeProfiles.contains(JHipsterConstants.SPRING_PROFILE_CLOUD)) { + log.error("You have misconfigured your application! It should not " + + "run with both the 'dev' and 'cloud' profiles at the same time."); + } + } + + /** + * Main method, used to run the application. + * + * @param args the command line arguments + */ + public static void main(String[] args) { + SpringApplication app = new SpringApplication(GatewayApp.class); + DefaultProfileUtil.addDefaultProfile(app); + Environment env = app.run(args).getEnvironment(); + logApplicationStartup(env); + } + + private static void logApplicationStartup(Environment env) { + String protocol = "http"; + if (env.getProperty("server.ssl.key-store") != null) { + protocol = "https"; + } + String serverPort = env.getProperty("server.port"); + String contextPath = env.getProperty("server.servlet.context-path"); + if (StringUtils.isBlank(contextPath)) { + contextPath = "/"; + } + String hostAddress = "localhost"; + try { + hostAddress = InetAddress.getLocalHost().getHostAddress(); + } catch (UnknownHostException e) { + log.warn("The host name could not be determined, using `localhost` as fallback"); + } + log.info("\n----------------------------------------------------------\n\t" + + "Application '{}' is running! Access URLs:\n\t" + + "Local: \t\t{}://localhost:{}{}\n\t" + + "External: \t{}://{}:{}{}\n\t" + + "Profile(s): \t{}\n----------------------------------------------------------", + env.getProperty("spring.application.name"), + protocol, + serverPort, + contextPath, + protocol, + hostAddress, + serverPort, + contextPath, + env.getActiveProfiles()); + + String configServerStatus = env.getProperty("configserver.status"); + if (configServerStatus == null) { + configServerStatus = "Not found or not setup for this application"; + } + log.info("\n----------------------------------------------------------\n\t" + + "Config Server: \t{}\n----------------------------------------------------------", configServerStatus); + } +} diff --git a/jhipster/jhipster-uaa/gateway/src/main/java/com/baeldung/jhipster/gateway/aop/logging/LoggingAspect.java b/jhipster/jhipster-uaa/gateway/src/main/java/com/baeldung/jhipster/gateway/aop/logging/LoggingAspect.java new file mode 100644 index 0000000000..1563bf25bf --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/java/com/baeldung/jhipster/gateway/aop/logging/LoggingAspect.java @@ -0,0 +1,98 @@ +package com.baeldung.jhipster.gateway.aop.logging; + +import io.github.jhipster.config.JHipsterConstants; + +import org.aspectj.lang.JoinPoint; +import org.aspectj.lang.ProceedingJoinPoint; +import org.aspectj.lang.annotation.AfterThrowing; +import org.aspectj.lang.annotation.Around; +import org.aspectj.lang.annotation.Aspect; +import org.aspectj.lang.annotation.Pointcut; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.core.env.Environment; + +import java.util.Arrays; + +/** + * Aspect for logging execution of service and repository Spring components. + * + * By default, it only runs with the "dev" profile. + */ +@Aspect +public class LoggingAspect { + + private final Logger log = LoggerFactory.getLogger(this.getClass()); + + private final Environment env; + + public LoggingAspect(Environment env) { + this.env = env; + } + + /** + * Pointcut that matches all repositories, services and Web REST endpoints. + */ + @Pointcut("within(@org.springframework.stereotype.Repository *)" + + " || within(@org.springframework.stereotype.Service *)" + + " || within(@org.springframework.web.bind.annotation.RestController *)") + public void springBeanPointcut() { + // Method is empty as this is just a Pointcut, the implementations are in the advices. + } + + /** + * Pointcut that matches all Spring beans in the application's main packages. + */ + @Pointcut("within(com.baeldung.jhipster.gateway.repository..*)"+ + " || within(com.baeldung.jhipster.gateway.service..*)"+ + " || within(com.baeldung.jhipster.gateway.web.rest..*)") + public void applicationPackagePointcut() { + // Method is empty as this is just a Pointcut, the implementations are in the advices. + } + + /** + * Advice that logs methods throwing exceptions. + * + * @param joinPoint join point for advice + * @param e exception + */ + @AfterThrowing(pointcut = "applicationPackagePointcut() && springBeanPointcut()", throwing = "e") + public void logAfterThrowing(JoinPoint joinPoint, Throwable e) { + if (env.acceptsProfiles(JHipsterConstants.SPRING_PROFILE_DEVELOPMENT)) { + log.error("Exception in {}.{}() with cause = \'{}\' and exception = \'{}\'", joinPoint.getSignature().getDeclaringTypeName(), + joinPoint.getSignature().getName(), e.getCause() != null? e.getCause() : "NULL", e.getMessage(), e); + + } else { + log.error("Exception in {}.{}() with cause = {}", joinPoint.getSignature().getDeclaringTypeName(), + joinPoint.getSignature().getName(), e.getCause() != null? e.getCause() : "NULL"); + } + } + + /** + * Advice that logs when a method is entered and exited. + * + * @param joinPoint join point for advice + * @return result + * @throws Throwable throws IllegalArgumentException + */ + @Around("applicationPackagePointcut() && springBeanPointcut()") + public Object logAround(ProceedingJoinPoint joinPoint) throws Throwable { + if (log.isDebugEnabled()) { + log.debug("Enter: {}.{}() with argument[s] = {}", joinPoint.getSignature().getDeclaringTypeName(), + joinPoint.getSignature().getName(), Arrays.toString(joinPoint.getArgs())); + } + try { + Object result = joinPoint.proceed(); + if (log.isDebugEnabled()) { + log.debug("Exit: {}.{}() with result = {}", joinPoint.getSignature().getDeclaringTypeName(), + joinPoint.getSignature().getName(), result); + } + return result; + } catch (IllegalArgumentException e) { + log.error("Illegal argument: {} in {}.{}()", Arrays.toString(joinPoint.getArgs()), + joinPoint.getSignature().getDeclaringTypeName(), joinPoint.getSignature().getName()); + + throw e; + } + } +} diff --git a/jhipster/jhipster-uaa/gateway/src/main/java/com/baeldung/jhipster/gateway/config/ApplicationProperties.java b/jhipster/jhipster-uaa/gateway/src/main/java/com/baeldung/jhipster/gateway/config/ApplicationProperties.java new file mode 100644 index 0000000000..01beaf3416 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/java/com/baeldung/jhipster/gateway/config/ApplicationProperties.java @@ -0,0 +1,14 @@ +package com.baeldung.jhipster.gateway.config; + +import org.springframework.boot.context.properties.ConfigurationProperties; + +/** + * Properties specific to Gateway. + *

+ * Properties are configured in the application.yml file. + * See {@link io.github.jhipster.config.JHipsterProperties} for a good example. + */ +@ConfigurationProperties(prefix = "application", ignoreUnknownFields = false) +public class ApplicationProperties { + +} diff --git a/jhipster/jhipster-uaa/gateway/src/main/java/com/baeldung/jhipster/gateway/config/AsyncConfiguration.java b/jhipster/jhipster-uaa/gateway/src/main/java/com/baeldung/jhipster/gateway/config/AsyncConfiguration.java new file mode 100644 index 0000000000..ba3a65750a --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/java/com/baeldung/jhipster/gateway/config/AsyncConfiguration.java @@ -0,0 +1,59 @@ +package com.baeldung.jhipster.gateway.config; + +import io.github.jhipster.async.ExceptionHandlingAsyncTaskExecutor; +import io.github.jhipster.config.JHipsterProperties; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.aop.interceptor.AsyncUncaughtExceptionHandler; +import org.springframework.aop.interceptor.SimpleAsyncUncaughtExceptionHandler; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.scheduling.annotation.*; +import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; +import org.springframework.scheduling.annotation.SchedulingConfigurer; +import org.springframework.scheduling.config.ScheduledTaskRegistrar; + +import java.util.concurrent.Executor; +import java.util.concurrent.Executors; + +@Configuration +@EnableAsync +@EnableScheduling +public class AsyncConfiguration implements AsyncConfigurer, SchedulingConfigurer { + + private final Logger log = LoggerFactory.getLogger(AsyncConfiguration.class); + + private final JHipsterProperties jHipsterProperties; + + public AsyncConfiguration(JHipsterProperties jHipsterProperties) { + this.jHipsterProperties = jHipsterProperties; + } + + @Override + @Bean(name = "taskExecutor") + public Executor getAsyncExecutor() { + log.debug("Creating Async Task Executor"); + ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor(); + executor.setCorePoolSize(jHipsterProperties.getAsync().getCorePoolSize()); + executor.setMaxPoolSize(jHipsterProperties.getAsync().getMaxPoolSize()); + executor.setQueueCapacity(jHipsterProperties.getAsync().getQueueCapacity()); + executor.setThreadNamePrefix("gateway-Executor-"); + return new ExceptionHandlingAsyncTaskExecutor(executor); + } + + @Override + public AsyncUncaughtExceptionHandler getAsyncUncaughtExceptionHandler() { + return new SimpleAsyncUncaughtExceptionHandler(); + } + + @Override + public void configureTasks(ScheduledTaskRegistrar taskRegistrar) { + taskRegistrar.setScheduler(scheduledTaskExecutor()); + } + + @Bean + public Executor scheduledTaskExecutor() { + return Executors.newScheduledThreadPool(jHipsterProperties.getAsync().getCorePoolSize()); + } +} diff --git a/jhipster/jhipster-uaa/gateway/src/main/java/com/baeldung/jhipster/gateway/config/CacheConfiguration.java b/jhipster/jhipster-uaa/gateway/src/main/java/com/baeldung/jhipster/gateway/config/CacheConfiguration.java new file mode 100644 index 0000000000..f4d9a818c9 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/java/com/baeldung/jhipster/gateway/config/CacheConfiguration.java @@ -0,0 +1,155 @@ +package com.baeldung.jhipster.gateway.config; + +import io.github.jhipster.config.JHipsterConstants; +import io.github.jhipster.config.JHipsterProperties; + +import com.hazelcast.config.*; +import com.hazelcast.core.HazelcastInstance; +import com.hazelcast.core.Hazelcast; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.autoconfigure.web.ServerProperties; + +import org.springframework.cache.CacheManager; +import org.springframework.cache.annotation.EnableCaching; +import org.springframework.cloud.client.ServiceInstance; +import org.springframework.cloud.client.discovery.DiscoveryClient; +import org.springframework.cloud.client.serviceregistry.Registration; +import org.springframework.context.annotation.*; +import org.springframework.core.env.Environment; + +import javax.annotation.PreDestroy; + +@Configuration +@EnableCaching +public class CacheConfiguration { + + private final Logger log = LoggerFactory.getLogger(CacheConfiguration.class); + + private final Environment env; + + private final ServerProperties serverProperties; + + private final DiscoveryClient discoveryClient; + + private Registration registration; + + public CacheConfiguration(Environment env, ServerProperties serverProperties, DiscoveryClient discoveryClient) { + this.env = env; + this.serverProperties = serverProperties; + this.discoveryClient = discoveryClient; + } + + @Autowired(required = false) + public void setRegistration(Registration registration) { + this.registration = registration; + } + + @PreDestroy + public void destroy() { + log.info("Closing Cache Manager"); + Hazelcast.shutdownAll(); + } + + @Bean + public CacheManager cacheManager(HazelcastInstance hazelcastInstance) { + log.debug("Starting HazelcastCacheManager"); + CacheManager cacheManager = new com.hazelcast.spring.cache.HazelcastCacheManager(hazelcastInstance); + return cacheManager; + } + + @Bean + public HazelcastInstance hazelcastInstance(JHipsterProperties jHipsterProperties) { + log.debug("Configuring Hazelcast"); + HazelcastInstance hazelCastInstance = Hazelcast.getHazelcastInstanceByName("gateway"); + if (hazelCastInstance != null) { + log.debug("Hazelcast already initialized"); + return hazelCastInstance; + } + Config config = new Config(); + config.setInstanceName("gateway"); + config.getNetworkConfig().getJoin().getMulticastConfig().setEnabled(false); + if (this.registration == null) { + log.warn("No discovery service is set up, Hazelcast cannot create a cluster."); + } else { + // The serviceId is by default the application's name, + // see the "spring.application.name" standard Spring property + String serviceId = registration.getServiceId(); + log.debug("Configuring Hazelcast clustering for instanceId: {}", serviceId); + // In development, everything goes through 127.0.0.1, with a different port + if (env.acceptsProfiles(JHipsterConstants.SPRING_PROFILE_DEVELOPMENT)) { + log.debug("Application is running with the \"dev\" profile, Hazelcast " + + "cluster will only work with localhost instances"); + + System.setProperty("hazelcast.local.localAddress", "127.0.0.1"); + config.getNetworkConfig().setPort(serverProperties.getPort() + 5701); + config.getNetworkConfig().getJoin().getTcpIpConfig().setEnabled(true); + for (ServiceInstance instance : discoveryClient.getInstances(serviceId)) { + String clusterMember = "127.0.0.1:" + (instance.getPort() + 5701); + log.debug("Adding Hazelcast (dev) cluster member " + clusterMember); + config.getNetworkConfig().getJoin().getTcpIpConfig().addMember(clusterMember); + } + } else { // Production configuration, one host per instance all using port 5701 + config.getNetworkConfig().setPort(5701); + config.getNetworkConfig().getJoin().getTcpIpConfig().setEnabled(true); + for (ServiceInstance instance : discoveryClient.getInstances(serviceId)) { + String clusterMember = instance.getHost() + ":5701"; + log.debug("Adding Hazelcast (prod) cluster member " + clusterMember); + config.getNetworkConfig().getJoin().getTcpIpConfig().addMember(clusterMember); + } + } + } + config.getMapConfigs().put("default", initializeDefaultMapConfig(jHipsterProperties)); + + // Full reference is available at: http://docs.hazelcast.org/docs/management-center/3.9/manual/html/Deploying_and_Starting.html + config.setManagementCenterConfig(initializeDefaultManagementCenterConfig(jHipsterProperties)); + config.getMapConfigs().put("com.baeldung.jhipster.gateway.domain.*", initializeDomainMapConfig(jHipsterProperties)); + return Hazelcast.newHazelcastInstance(config); + } + + private ManagementCenterConfig initializeDefaultManagementCenterConfig(JHipsterProperties jHipsterProperties) { + ManagementCenterConfig managementCenterConfig = new ManagementCenterConfig(); + managementCenterConfig.setEnabled(jHipsterProperties.getCache().getHazelcast().getManagementCenter().isEnabled()); + managementCenterConfig.setUrl(jHipsterProperties.getCache().getHazelcast().getManagementCenter().getUrl()); + managementCenterConfig.setUpdateInterval(jHipsterProperties.getCache().getHazelcast().getManagementCenter().getUpdateInterval()); + return managementCenterConfig; + } + + private MapConfig initializeDefaultMapConfig(JHipsterProperties jHipsterProperties) { + MapConfig mapConfig = new MapConfig(); + + /* + Number of backups. If 1 is set as the backup-count for example, + then all entries of the map will be copied to another JVM for + fail-safety. Valid numbers are 0 (no backup), 1, 2, 3. + */ + mapConfig.setBackupCount(jHipsterProperties.getCache().getHazelcast().getBackupCount()); + + /* + Valid values are: + NONE (no eviction), + LRU (Least Recently Used), + LFU (Least Frequently Used). + NONE is the default. + */ + mapConfig.setEvictionPolicy(EvictionPolicy.LRU); + + /* + Maximum size of the map. When max size is reached, + map is evicted based on the policy defined. + Any integer between 0 and Integer.MAX_VALUE. 0 means + Integer.MAX_VALUE. Default is 0. + */ + mapConfig.setMaxSizeConfig(new MaxSizeConfig(0, MaxSizeConfig.MaxSizePolicy.USED_HEAP_SIZE)); + + return mapConfig; + } + + private MapConfig initializeDomainMapConfig(JHipsterProperties jHipsterProperties) { + MapConfig mapConfig = new MapConfig(); + mapConfig.setTimeToLiveSeconds(jHipsterProperties.getCache().getHazelcast().getTimeToLiveSeconds()); + return mapConfig; + } +} diff --git a/jhipster/jhipster-uaa/gateway/src/main/java/com/baeldung/jhipster/gateway/config/CloudDatabaseConfiguration.java b/jhipster/jhipster-uaa/gateway/src/main/java/com/baeldung/jhipster/gateway/config/CloudDatabaseConfiguration.java new file mode 100644 index 0000000000..0614a2a3d0 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/java/com/baeldung/jhipster/gateway/config/CloudDatabaseConfiguration.java @@ -0,0 +1,24 @@ +package com.baeldung.jhipster.gateway.config; + +import io.github.jhipster.config.JHipsterConstants; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.cache.CacheManager; +import org.springframework.cloud.config.java.AbstractCloudConfig; +import org.springframework.context.annotation.*; + +import javax.sql.DataSource; + +@Configuration +@Profile(JHipsterConstants.SPRING_PROFILE_CLOUD) +public class CloudDatabaseConfiguration extends AbstractCloudConfig { + + private final Logger log = LoggerFactory.getLogger(CloudDatabaseConfiguration.class); + + @Bean + public DataSource dataSource(CacheManager cacheManager) { + log.info("Configuring JDBC datasource from a cloud provider"); + return connectionFactory().dataSource(); + } +} diff --git a/jhipster/jhipster-uaa/gateway/src/main/java/com/baeldung/jhipster/gateway/config/Constants.java b/jhipster/jhipster-uaa/gateway/src/main/java/com/baeldung/jhipster/gateway/config/Constants.java new file mode 100644 index 0000000000..48542e5196 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/java/com/baeldung/jhipster/gateway/config/Constants.java @@ -0,0 +1,17 @@ +package com.baeldung.jhipster.gateway.config; + +/** + * Application constants. + */ +public final class Constants { + + // Regex for acceptable logins + public static final String LOGIN_REGEX = "^[_.@A-Za-z0-9-]*$"; + + public static final String SYSTEM_ACCOUNT = "system"; + public static final String ANONYMOUS_USER = "anonymoususer"; + public static final String DEFAULT_LANGUAGE = "en"; + + private Constants() { + } +} diff --git a/jhipster/jhipster-uaa/gateway/src/main/java/com/baeldung/jhipster/gateway/config/DatabaseConfiguration.java b/jhipster/jhipster-uaa/gateway/src/main/java/com/baeldung/jhipster/gateway/config/DatabaseConfiguration.java new file mode 100644 index 0000000000..ae5103f8b0 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/java/com/baeldung/jhipster/gateway/config/DatabaseConfiguration.java @@ -0,0 +1,39 @@ +package com.baeldung.jhipster.gateway.config; + +import io.github.jhipster.config.JHipsterConstants; +import io.github.jhipster.config.h2.H2ConfigurationHelper; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.Profile; + +import org.springframework.data.jpa.repository.config.EnableJpaAuditing; +import org.springframework.data.jpa.repository.config.EnableJpaRepositories; +import org.springframework.transaction.annotation.EnableTransactionManagement; + +import java.sql.SQLException; + +@Configuration +@EnableJpaRepositories("com.baeldung.jhipster.gateway.repository") +@EnableJpaAuditing(auditorAwareRef = "springSecurityAuditorAware") +@EnableTransactionManagement +public class DatabaseConfiguration { + + private final Logger log = LoggerFactory.getLogger(DatabaseConfiguration.class); + + + /** + * Open the TCP port for the H2 database, so it is available remotely. + * + * @return the H2 database TCP server + * @throws SQLException if the server failed to start + */ + @Bean(initMethod = "start", destroyMethod = "stop") + @Profile(JHipsterConstants.SPRING_PROFILE_DEVELOPMENT) + public Object h2TCPServer() throws SQLException { + log.debug("Starting H2 database"); + return H2ConfigurationHelper.createServer(); + } + +} diff --git a/jhipster/jhipster-uaa/gateway/src/main/java/com/baeldung/jhipster/gateway/config/DateTimeFormatConfiguration.java b/jhipster/jhipster-uaa/gateway/src/main/java/com/baeldung/jhipster/gateway/config/DateTimeFormatConfiguration.java new file mode 100644 index 0000000000..1fb622a04e --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/java/com/baeldung/jhipster/gateway/config/DateTimeFormatConfiguration.java @@ -0,0 +1,20 @@ +package com.baeldung.jhipster.gateway.config; + +import org.springframework.context.annotation.Configuration; +import org.springframework.format.FormatterRegistry; +import org.springframework.format.datetime.standard.DateTimeFormatterRegistrar; +import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; + +/** + * Configure the converters to use the ISO format for dates by default. + */ +@Configuration +public class DateTimeFormatConfiguration implements WebMvcConfigurer { + + @Override + public void addFormatters(FormatterRegistry registry) { + DateTimeFormatterRegistrar registrar = new DateTimeFormatterRegistrar(); + registrar.setUseIsoFormat(true); + registrar.registerFormatters(registry); + } +} diff --git a/jhipster/jhipster-uaa/gateway/src/main/java/com/baeldung/jhipster/gateway/config/DefaultProfileUtil.java b/jhipster/jhipster-uaa/gateway/src/main/java/com/baeldung/jhipster/gateway/config/DefaultProfileUtil.java new file mode 100644 index 0000000000..b6c6209cd4 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/java/com/baeldung/jhipster/gateway/config/DefaultProfileUtil.java @@ -0,0 +1,51 @@ +package com.baeldung.jhipster.gateway.config; + +import io.github.jhipster.config.JHipsterConstants; + +import org.springframework.boot.SpringApplication; +import org.springframework.core.env.Environment; + +import java.util.*; + +/** + * Utility class to load a Spring profile to be used as default + * when there is no spring.profiles.active set in the environment or as command line argument. + * If the value is not available in application.yml then dev profile will be used as default. + */ +public final class DefaultProfileUtil { + + private static final String SPRING_PROFILE_DEFAULT = "spring.profiles.default"; + + private DefaultProfileUtil() { + } + + /** + * Set a default to use when no profile is configured. + * + * @param app the Spring application + */ + public static void addDefaultProfile(SpringApplication app) { + Map defProperties = new HashMap<>(); + /* + * The default profile to use when no other profiles are defined + * This cannot be set in the application.yml file. + * See https://github.com/spring-projects/spring-boot/issues/1219 + */ + defProperties.put(SPRING_PROFILE_DEFAULT, JHipsterConstants.SPRING_PROFILE_DEVELOPMENT); + app.setDefaultProperties(defProperties); + } + + /** + * Get the profiles that are applied else get default profiles. + * + * @param env spring environment + * @return profiles + */ + public static String[] getActiveProfiles(Environment env) { + String[] profiles = env.getActiveProfiles(); + if (profiles.length == 0) { + return env.getDefaultProfiles(); + } + return profiles; + } +} diff --git a/jhipster/jhipster-uaa/gateway/src/main/java/com/baeldung/jhipster/gateway/config/GatewayConfiguration.java b/jhipster/jhipster-uaa/gateway/src/main/java/com/baeldung/jhipster/gateway/config/GatewayConfiguration.java new file mode 100644 index 0000000000..cd1000ad80 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/java/com/baeldung/jhipster/gateway/config/GatewayConfiguration.java @@ -0,0 +1,55 @@ +package com.baeldung.jhipster.gateway.config; + +import io.github.jhipster.config.JHipsterProperties; + +import com.baeldung.jhipster.gateway.gateway.ratelimiting.RateLimitingFilter; +import com.baeldung.jhipster.gateway.gateway.accesscontrol.AccessControlFilter; +import com.baeldung.jhipster.gateway.gateway.responserewriting.SwaggerBasePathRewritingFilter; + +import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; +import org.springframework.cloud.netflix.zuul.filters.RouteLocator; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +@Configuration +public class GatewayConfiguration { + + @Configuration + public static class SwaggerBasePathRewritingConfiguration { + + @Bean + public SwaggerBasePathRewritingFilter swaggerBasePathRewritingFilter(){ + return new SwaggerBasePathRewritingFilter(); + } + } + + @Configuration + public static class AccessControlFilterConfiguration { + + @Bean + public AccessControlFilter accessControlFilter(RouteLocator routeLocator, JHipsterProperties jHipsterProperties){ + return new AccessControlFilter(routeLocator, jHipsterProperties); + } + } + + /** + * Configures the Zuul filter that limits the number of API calls per user. + *

+ * This uses Bucket4J to limit the API calls, see {@link com.baeldung.jhipster.gateway.gateway.ratelimiting.RateLimitingFilter}. + */ + @Configuration + @ConditionalOnProperty("jhipster.gateway.rate-limiting.enabled") + public static class RateLimitingConfiguration { + + private final JHipsterProperties jHipsterProperties; + + public RateLimitingConfiguration(JHipsterProperties jHipsterProperties) { + this.jHipsterProperties = jHipsterProperties; + } + + @Bean + public RateLimitingFilter rateLimitingFilter() { + return new RateLimitingFilter(jHipsterProperties); + } + } +} diff --git a/jhipster/jhipster-uaa/gateway/src/main/java/com/baeldung/jhipster/gateway/config/JacksonConfiguration.java b/jhipster/jhipster-uaa/gateway/src/main/java/com/baeldung/jhipster/gateway/config/JacksonConfiguration.java new file mode 100644 index 0000000000..c90a10558b --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/java/com/baeldung/jhipster/gateway/config/JacksonConfiguration.java @@ -0,0 +1,63 @@ +package com.baeldung.jhipster.gateway.config; + +import com.fasterxml.jackson.datatype.hibernate5.Hibernate5Module; +import com.fasterxml.jackson.datatype.jdk8.Jdk8Module; +import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; +import com.fasterxml.jackson.module.afterburner.AfterburnerModule; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.zalando.problem.ProblemModule; +import org.zalando.problem.violations.ConstraintViolationProblemModule; + +@Configuration +public class JacksonConfiguration { + + /** + * Support for Java date and time API. + * @return the corresponding Jackson module. + */ + @Bean + public JavaTimeModule javaTimeModule() { + return new JavaTimeModule(); + } + + @Bean + public Jdk8Module jdk8TimeModule() { + return new Jdk8Module(); + } + + + /* + * Support for Hibernate types in Jackson. + */ + @Bean + public Hibernate5Module hibernate5Module() { + return new Hibernate5Module(); + } + + /* + * Jackson Afterburner module to speed up serialization/deserialization. + */ + @Bean + public AfterburnerModule afterburnerModule() { + return new AfterburnerModule(); + } + + /* + * Module for serialization/deserialization of RFC7807 Problem. + */ + @Bean + ProblemModule problemModule() { + return new ProblemModule(); + } + + /* + * Module for serialization/deserialization of ConstraintViolationProblem. + */ + @Bean + ConstraintViolationProblemModule constraintViolationProblemModule() { + return new ConstraintViolationProblemModule(); + } + +} diff --git a/jhipster/jhipster-uaa/gateway/src/main/java/com/baeldung/jhipster/gateway/config/LiquibaseConfiguration.java b/jhipster/jhipster-uaa/gateway/src/main/java/com/baeldung/jhipster/gateway/config/LiquibaseConfiguration.java new file mode 100644 index 0000000000..8e67a70d1d --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/java/com/baeldung/jhipster/gateway/config/LiquibaseConfiguration.java @@ -0,0 +1,53 @@ +package com.baeldung.jhipster.gateway.config; + +import javax.sql.DataSource; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.boot.autoconfigure.liquibase.LiquibaseProperties; +import org.springframework.cache.CacheManager; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.core.env.Environment; +import org.springframework.core.task.TaskExecutor; + +import io.github.jhipster.config.JHipsterConstants; +import io.github.jhipster.config.liquibase.AsyncSpringLiquibase; +import liquibase.integration.spring.SpringLiquibase; + +@Configuration +public class LiquibaseConfiguration { + + private final Logger log = LoggerFactory.getLogger(LiquibaseConfiguration.class); + + private final Environment env; + + private final CacheManager cacheManager; + + public LiquibaseConfiguration(Environment env, CacheManager cacheManager) { + this.env = env; + this.cacheManager = cacheManager; + } + + @Bean + public SpringLiquibase liquibase(@Qualifier("taskExecutor") TaskExecutor taskExecutor, + DataSource dataSource, LiquibaseProperties liquibaseProperties) { + + // Use liquibase.integration.spring.SpringLiquibase if you don't want Liquibase to start asynchronously + SpringLiquibase liquibase = new AsyncSpringLiquibase(taskExecutor, env); + liquibase.setDataSource(dataSource); + liquibase.setChangeLog("classpath:config/liquibase/master.xml"); + liquibase.setContexts(liquibaseProperties.getContexts()); + liquibase.setDefaultSchema(liquibaseProperties.getDefaultSchema()); + liquibase.setDropFirst(liquibaseProperties.isDropFirst()); + liquibase.setChangeLogParameters(liquibaseProperties.getParameters()); + if (env.acceptsProfiles(JHipsterConstants.SPRING_PROFILE_NO_LIQUIBASE)) { + liquibase.setShouldRun(false); + } else { + liquibase.setShouldRun(liquibaseProperties.isEnabled()); + log.debug("Configuring Liquibase"); + } + return liquibase; + } +} diff --git a/jhipster/jhipster-uaa/gateway/src/main/java/com/baeldung/jhipster/gateway/config/LocaleConfiguration.java b/jhipster/jhipster-uaa/gateway/src/main/java/com/baeldung/jhipster/gateway/config/LocaleConfiguration.java new file mode 100644 index 0000000000..ac7c3c8299 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/java/com/baeldung/jhipster/gateway/config/LocaleConfiguration.java @@ -0,0 +1,27 @@ +package com.baeldung.jhipster.gateway.config; + +import io.github.jhipster.config.locale.AngularCookieLocaleResolver; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.web.servlet.LocaleResolver; +import org.springframework.web.servlet.config.annotation.*; +import org.springframework.web.servlet.i18n.LocaleChangeInterceptor; + +@Configuration +public class LocaleConfiguration implements WebMvcConfigurer { + + @Bean(name = "localeResolver") + public LocaleResolver localeResolver() { + AngularCookieLocaleResolver cookieLocaleResolver = new AngularCookieLocaleResolver(); + cookieLocaleResolver.setCookieName("NG_TRANSLATE_LANG_KEY"); + return cookieLocaleResolver; + } + + @Override + public void addInterceptors(InterceptorRegistry registry) { + LocaleChangeInterceptor localeChangeInterceptor = new LocaleChangeInterceptor(); + localeChangeInterceptor.setParamName("language"); + registry.addInterceptor(localeChangeInterceptor); + } +} diff --git a/jhipster/jhipster-uaa/gateway/src/main/java/com/baeldung/jhipster/gateway/config/LoggingAspectConfiguration.java b/jhipster/jhipster-uaa/gateway/src/main/java/com/baeldung/jhipster/gateway/config/LoggingAspectConfiguration.java new file mode 100644 index 0000000000..16b9c16515 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/java/com/baeldung/jhipster/gateway/config/LoggingAspectConfiguration.java @@ -0,0 +1,19 @@ +package com.baeldung.jhipster.gateway.config; + +import com.baeldung.jhipster.gateway.aop.logging.LoggingAspect; + +import io.github.jhipster.config.JHipsterConstants; + +import org.springframework.context.annotation.*; +import org.springframework.core.env.Environment; + +@Configuration +@EnableAspectJAutoProxy +public class LoggingAspectConfiguration { + + @Bean + @Profile(JHipsterConstants.SPRING_PROFILE_DEVELOPMENT) + public LoggingAspect loggingAspect(Environment env) { + return new LoggingAspect(env); + } +} diff --git a/jhipster/jhipster-uaa/gateway/src/main/java/com/baeldung/jhipster/gateway/config/LoggingConfiguration.java b/jhipster/jhipster-uaa/gateway/src/main/java/com/baeldung/jhipster/gateway/config/LoggingConfiguration.java new file mode 100644 index 0000000000..8e7443dc34 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/java/com/baeldung/jhipster/gateway/config/LoggingConfiguration.java @@ -0,0 +1,163 @@ +package com.baeldung.jhipster.gateway.config; + +import java.net.InetSocketAddress; +import java.util.Iterator; + +import io.github.jhipster.config.JHipsterProperties; + +import ch.qos.logback.classic.AsyncAppender; +import ch.qos.logback.classic.Level; +import ch.qos.logback.classic.LoggerContext; +import ch.qos.logback.classic.boolex.OnMarkerEvaluator; +import ch.qos.logback.classic.spi.ILoggingEvent; +import ch.qos.logback.classic.spi.LoggerContextListener; +import ch.qos.logback.core.Appender; +import ch.qos.logback.core.filter.EvaluatorFilter; +import ch.qos.logback.core.spi.ContextAwareBase; +import ch.qos.logback.core.spi.FilterReply; +import net.logstash.logback.appender.LogstashTcpSocketAppender; +import net.logstash.logback.encoder.LogstashEncoder; +import net.logstash.logback.stacktrace.ShortenedThrowableConverter; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.cloud.context.config.annotation.RefreshScope; +import org.springframework.context.annotation.Configuration; + +@Configuration +@RefreshScope +public class LoggingConfiguration { + + private static final String LOGSTASH_APPENDER_NAME = "LOGSTASH"; + + private static final String ASYNC_LOGSTASH_APPENDER_NAME = "ASYNC_LOGSTASH"; + + private final Logger log = LoggerFactory.getLogger(LoggingConfiguration.class); + + private LoggerContext context = (LoggerContext) LoggerFactory.getILoggerFactory(); + + private final String appName; + + private final String serverPort; + + private final String version; + + private final JHipsterProperties jHipsterProperties; + + public LoggingConfiguration(@Value("${spring.application.name}") String appName, @Value("${server.port}") String serverPort, + @Value("${info.project.version:}") String version, JHipsterProperties jHipsterProperties) { + this.appName = appName; + this.serverPort = serverPort; + this.version = version; + this.jHipsterProperties = jHipsterProperties; + if (jHipsterProperties.getLogging().getLogstash().isEnabled()) { + addLogstashAppender(context); + addContextListener(context); + } + if (jHipsterProperties.getMetrics().getLogs().isEnabled()) { + setMetricsMarkerLogbackFilter(context); + } + } + + private void addContextListener(LoggerContext context) { + LogbackLoggerContextListener loggerContextListener = new LogbackLoggerContextListener(); + loggerContextListener.setContext(context); + context.addListener(loggerContextListener); + } + + private void addLogstashAppender(LoggerContext context) { + log.info("Initializing Logstash logging"); + + LogstashTcpSocketAppender logstashAppender = new LogstashTcpSocketAppender(); + logstashAppender.setName(LOGSTASH_APPENDER_NAME); + logstashAppender.setContext(context); + String optionalFields = ""; + String customFields = "{\"app_name\":\"" + appName + "\",\"app_port\":\"" + serverPort + "\"," + + optionalFields + "\"version\":\"" + version + "\"}"; + + // More documentation is available at: https://github.com/logstash/logstash-logback-encoder + LogstashEncoder logstashEncoder = new LogstashEncoder(); + // Set the Logstash appender config from JHipster properties + logstashEncoder.setCustomFields(customFields); + // Set the Logstash appender config from JHipster properties + logstashAppender.addDestinations(new InetSocketAddress(jHipsterProperties.getLogging().getLogstash().getHost(), jHipsterProperties.getLogging().getLogstash().getPort())); + + ShortenedThrowableConverter throwableConverter = new ShortenedThrowableConverter(); + throwableConverter.setRootCauseFirst(true); + logstashEncoder.setThrowableConverter(throwableConverter); + logstashEncoder.setCustomFields(customFields); + + logstashAppender.setEncoder(logstashEncoder); + logstashAppender.start(); + + // Wrap the appender in an Async appender for performance + AsyncAppender asyncLogstashAppender = new AsyncAppender(); + asyncLogstashAppender.setContext(context); + asyncLogstashAppender.setName(ASYNC_LOGSTASH_APPENDER_NAME); + asyncLogstashAppender.setQueueSize(jHipsterProperties.getLogging().getLogstash().getQueueSize()); + asyncLogstashAppender.addAppender(logstashAppender); + asyncLogstashAppender.start(); + + context.getLogger("ROOT").addAppender(asyncLogstashAppender); + } + + // Configure a log filter to remove "metrics" logs from all appenders except the "LOGSTASH" appender + private void setMetricsMarkerLogbackFilter(LoggerContext context) { + log.info("Filtering metrics logs from all appenders except the {} appender", LOGSTASH_APPENDER_NAME); + OnMarkerEvaluator onMarkerMetricsEvaluator = new OnMarkerEvaluator(); + onMarkerMetricsEvaluator.setContext(context); + onMarkerMetricsEvaluator.addMarker("metrics"); + onMarkerMetricsEvaluator.start(); + EvaluatorFilter metricsFilter = new EvaluatorFilter<>(); + metricsFilter.setContext(context); + metricsFilter.setEvaluator(onMarkerMetricsEvaluator); + metricsFilter.setOnMatch(FilterReply.DENY); + metricsFilter.start(); + + for (ch.qos.logback.classic.Logger logger : context.getLoggerList()) { + for (Iterator> it = logger.iteratorForAppenders(); it.hasNext();) { + Appender appender = it.next(); + if (!appender.getName().equals(ASYNC_LOGSTASH_APPENDER_NAME)) { + log.debug("Filter metrics logs from the {} appender", appender.getName()); + appender.setContext(context); + appender.addFilter(metricsFilter); + appender.start(); + } + } + } + } + + /** + * Logback configuration is achieved by configuration file and API. + * When configuration file change is detected, the configuration is reset. + * This listener ensures that the programmatic configuration is also re-applied after reset. + */ + class LogbackLoggerContextListener extends ContextAwareBase implements LoggerContextListener { + + @Override + public boolean isResetResistant() { + return true; + } + + @Override + public void onStart(LoggerContext context) { + addLogstashAppender(context); + } + + @Override + public void onReset(LoggerContext context) { + addLogstashAppender(context); + } + + @Override + public void onStop(LoggerContext context) { + // Nothing to do. + } + + @Override + public void onLevelChange(ch.qos.logback.classic.Logger logger, Level level) { + // Nothing to do. + } + } + +} diff --git a/jhipster/jhipster-uaa/gateway/src/main/java/com/baeldung/jhipster/gateway/config/MetricsConfiguration.java b/jhipster/jhipster-uaa/gateway/src/main/java/com/baeldung/jhipster/gateway/config/MetricsConfiguration.java new file mode 100644 index 0000000000..0626cdade7 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/java/com/baeldung/jhipster/gateway/config/MetricsConfiguration.java @@ -0,0 +1,99 @@ +package com.baeldung.jhipster.gateway.config; + +import io.github.jhipster.config.JHipsterProperties; + +import com.codahale.metrics.JmxReporter; +import com.codahale.metrics.JvmAttributeGaugeSet; +import com.codahale.metrics.MetricRegistry; +import com.codahale.metrics.Slf4jReporter; +import com.codahale.metrics.health.HealthCheckRegistry; +import com.codahale.metrics.jvm.*; +import com.ryantenney.metrics.spring.config.annotation.EnableMetrics; +import com.ryantenney.metrics.spring.config.annotation.MetricsConfigurerAdapter; +import com.zaxxer.hikari.HikariDataSource; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.slf4j.Marker; +import org.slf4j.MarkerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.*; + +import javax.annotation.PostConstruct; +import java.lang.management.ManagementFactory; +import java.util.concurrent.TimeUnit; + +@Configuration +@EnableMetrics(proxyTargetClass = true) +public class MetricsConfiguration extends MetricsConfigurerAdapter { + + private static final String PROP_METRIC_REG_JVM_MEMORY = "jvm.memory"; + private static final String PROP_METRIC_REG_JVM_GARBAGE = "jvm.garbage"; + private static final String PROP_METRIC_REG_JVM_THREADS = "jvm.threads"; + private static final String PROP_METRIC_REG_JVM_FILES = "jvm.files"; + private static final String PROP_METRIC_REG_JVM_BUFFERS = "jvm.buffers"; + private static final String PROP_METRIC_REG_JVM_ATTRIBUTE_SET = "jvm.attributes"; + + private final Logger log = LoggerFactory.getLogger(MetricsConfiguration.class); + + private MetricRegistry metricRegistry = new MetricRegistry(); + + private HealthCheckRegistry healthCheckRegistry = new HealthCheckRegistry(); + + private final JHipsterProperties jHipsterProperties; + + private HikariDataSource hikariDataSource; + + public MetricsConfiguration(JHipsterProperties jHipsterProperties) { + this.jHipsterProperties = jHipsterProperties; + } + + @Autowired(required = false) + public void setHikariDataSource(HikariDataSource hikariDataSource) { + this.hikariDataSource = hikariDataSource; + } + + @Override + @Bean + public MetricRegistry getMetricRegistry() { + return metricRegistry; + } + + @Override + @Bean + public HealthCheckRegistry getHealthCheckRegistry() { + return healthCheckRegistry; + } + + @PostConstruct + public void init() { + log.debug("Registering JVM gauges"); + metricRegistry.register(PROP_METRIC_REG_JVM_MEMORY, new MemoryUsageGaugeSet()); + metricRegistry.register(PROP_METRIC_REG_JVM_GARBAGE, new GarbageCollectorMetricSet()); + metricRegistry.register(PROP_METRIC_REG_JVM_THREADS, new ThreadStatesGaugeSet()); + metricRegistry.register(PROP_METRIC_REG_JVM_FILES, new FileDescriptorRatioGauge()); + metricRegistry.register(PROP_METRIC_REG_JVM_BUFFERS, new BufferPoolMetricSet(ManagementFactory.getPlatformMBeanServer())); + metricRegistry.register(PROP_METRIC_REG_JVM_ATTRIBUTE_SET, new JvmAttributeGaugeSet()); + if (hikariDataSource != null) { + log.debug("Monitoring the datasource"); + // remove the factory created by HikariDataSourceMetricsPostProcessor until JHipster migrate to Micrometer + hikariDataSource.setMetricsTrackerFactory(null); + hikariDataSource.setMetricRegistry(metricRegistry); + } + if (jHipsterProperties.getMetrics().getJmx().isEnabled()) { + log.debug("Initializing Metrics JMX reporting"); + JmxReporter jmxReporter = JmxReporter.forRegistry(metricRegistry).build(); + jmxReporter.start(); + } + if (jHipsterProperties.getMetrics().getLogs().isEnabled()) { + log.info("Initializing Metrics Log reporting"); + Marker metricsMarker = MarkerFactory.getMarker("metrics"); + final Slf4jReporter reporter = Slf4jReporter.forRegistry(metricRegistry) + .outputTo(LoggerFactory.getLogger("metrics")) + .markWith(metricsMarker) + .convertRatesTo(TimeUnit.SECONDS) + .convertDurationsTo(TimeUnit.MILLISECONDS) + .build(); + reporter.start(jHipsterProperties.getMetrics().getLogs().getReportFrequency(), TimeUnit.SECONDS); + } + } +} diff --git a/jhipster/jhipster-uaa/gateway/src/main/java/com/baeldung/jhipster/gateway/config/SecurityConfiguration.java b/jhipster/jhipster-uaa/gateway/src/main/java/com/baeldung/jhipster/gateway/config/SecurityConfiguration.java new file mode 100644 index 0000000000..bdc0650901 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/java/com/baeldung/jhipster/gateway/config/SecurityConfiguration.java @@ -0,0 +1,83 @@ +package com.baeldung.jhipster.gateway.config; + +import com.baeldung.jhipster.gateway.config.oauth2.OAuth2JwtAccessTokenConverter; +import com.baeldung.jhipster.gateway.config.oauth2.OAuth2Properties; +import com.baeldung.jhipster.gateway.security.oauth2.OAuth2SignatureVerifierClient; +import com.baeldung.jhipster.gateway.security.AuthoritiesConstants; + +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.cloud.client.loadbalancer.RestTemplateCustomizer; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity; +import org.springframework.security.config.annotation.web.builders.HttpSecurity; +import org.springframework.security.config.http.SessionCreationPolicy; +import org.springframework.security.oauth2.config.annotation.web.configuration.EnableResourceServer; +import org.springframework.security.oauth2.config.annotation.web.configuration.ResourceServerConfigurerAdapter; +import org.springframework.security.oauth2.provider.token.TokenStore; +import org.springframework.security.oauth2.provider.token.store.JwtAccessTokenConverter; +import org.springframework.security.oauth2.provider.token.store.JwtTokenStore; +import org.springframework.security.web.csrf.CookieCsrfTokenRepository; +import org.springframework.security.web.csrf.CsrfFilter; +import org.springframework.web.filter.CorsFilter; +import org.springframework.web.client.RestTemplate; + +@Configuration +@EnableResourceServer +@EnableGlobalMethodSecurity(prePostEnabled = true, securedEnabled = true) +public class SecurityConfiguration extends ResourceServerConfigurerAdapter { + private final OAuth2Properties oAuth2Properties; + + private final CorsFilter corsFilter; + + public SecurityConfiguration(OAuth2Properties oAuth2Properties, CorsFilter corsFilter) { + this.oAuth2Properties = oAuth2Properties; + this.corsFilter = corsFilter; + } + + @Override + public void configure(HttpSecurity http) throws Exception { + http + .csrf() + .ignoringAntMatchers("/h2-console/**") + .csrfTokenRepository(CookieCsrfTokenRepository.withHttpOnlyFalse()) + .and() + .addFilterBefore(corsFilter, CsrfFilter.class) + .headers() + .frameOptions() + .disable() + .and() + .sessionManagement() + .sessionCreationPolicy(SessionCreationPolicy.STATELESS) + .and() + .authorizeRequests() + .antMatchers("/api/**").authenticated() + .antMatchers("/management/health").permitAll() + .antMatchers("/management/info").permitAll() + .antMatchers("/management/**").hasAuthority(AuthoritiesConstants.ADMIN); + } + + @Bean + public TokenStore tokenStore(JwtAccessTokenConverter jwtAccessTokenConverter) { + return new JwtTokenStore(jwtAccessTokenConverter); + } + + @Bean + public JwtAccessTokenConverter jwtAccessTokenConverter(OAuth2SignatureVerifierClient signatureVerifierClient) { + return new OAuth2JwtAccessTokenConverter(oAuth2Properties, signatureVerifierClient); + } + + @Bean + @Qualifier("loadBalancedRestTemplate") + public RestTemplate loadBalancedRestTemplate(RestTemplateCustomizer customizer) { + RestTemplate restTemplate = new RestTemplate(); + customizer.customize(restTemplate); + return restTemplate; + } + + @Bean + @Qualifier("vanillaRestTemplate") + public RestTemplate vanillaRestTemplate() { + return new RestTemplate(); + } +} diff --git a/jhipster/jhipster-uaa/gateway/src/main/java/com/baeldung/jhipster/gateway/config/WebConfigurer.java b/jhipster/jhipster-uaa/gateway/src/main/java/com/baeldung/jhipster/gateway/config/WebConfigurer.java new file mode 100644 index 0000000000..3bc1d6ad88 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/java/com/baeldung/jhipster/gateway/config/WebConfigurer.java @@ -0,0 +1,210 @@ +package com.baeldung.jhipster.gateway.config; + +import com.codahale.metrics.MetricRegistry; +import com.codahale.metrics.servlet.InstrumentedFilter; +import com.codahale.metrics.servlets.MetricsServlet; +import io.github.jhipster.config.JHipsterConstants; +import io.github.jhipster.config.JHipsterProperties; +import io.github.jhipster.config.h2.H2ConfigurationHelper; +import io.github.jhipster.web.filter.CachingHttpHeadersFilter; +import io.undertow.UndertowOptions; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.web.embedded.undertow.UndertowServletWebServerFactory; +import org.springframework.boot.web.server.*; +import org.springframework.boot.web.servlet.ServletContextInitializer; +import org.springframework.boot.web.servlet.server.ConfigurableServletWebServerFactory; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.core.env.Environment; +import org.springframework.http.MediaType; +import org.springframework.web.cors.CorsConfiguration; +import org.springframework.web.cors.UrlBasedCorsConfigurationSource; +import org.springframework.web.filter.CorsFilter; + +import javax.servlet.*; +import java.io.File; +import java.io.UnsupportedEncodingException; +import java.nio.charset.StandardCharsets; +import java.nio.file.Paths; +import java.util.*; + +import static java.net.URLDecoder.decode; + +/** + * Configuration of web application with Servlet 3.0 APIs. + */ +@Configuration +public class WebConfigurer implements ServletContextInitializer, WebServerFactoryCustomizer { + + private final Logger log = LoggerFactory.getLogger(WebConfigurer.class); + + private final Environment env; + + private final JHipsterProperties jHipsterProperties; + + private MetricRegistry metricRegistry; + + public WebConfigurer(Environment env, JHipsterProperties jHipsterProperties) { + + this.env = env; + this.jHipsterProperties = jHipsterProperties; + } + + @Override + public void onStartup(ServletContext servletContext) throws ServletException { + if (env.getActiveProfiles().length != 0) { + log.info("Web application configuration, using profiles: {}", (Object[]) env.getActiveProfiles()); + } + EnumSet disps = EnumSet.of(DispatcherType.REQUEST, DispatcherType.FORWARD, DispatcherType.ASYNC); + initMetrics(servletContext, disps); + if (env.acceptsProfiles(JHipsterConstants.SPRING_PROFILE_PRODUCTION)) { + initCachingHttpHeadersFilter(servletContext, disps); + } + if (env.acceptsProfiles(JHipsterConstants.SPRING_PROFILE_DEVELOPMENT)) { + initH2Console(servletContext); + } + log.info("Web application fully configured"); + } + + /** + * Customize the Servlet engine: Mime types, the document root, the cache. + */ + @Override + public void customize(WebServerFactory server) { + setMimeMappings(server); + // When running in an IDE or with ./mvnw spring-boot:run, set location of the static web assets. + setLocationForStaticAssets(server); + + /* + * Enable HTTP/2 for Undertow - https://twitter.com/ankinson/status/829256167700492288 + * HTTP/2 requires HTTPS, so HTTP requests will fallback to HTTP/1.1. + * See the JHipsterProperties class and your application-*.yml configuration files + * for more information. + */ + if (jHipsterProperties.getHttp().getVersion().equals(JHipsterProperties.Http.Version.V_2_0) && + server instanceof UndertowServletWebServerFactory) { + + ((UndertowServletWebServerFactory) server) + .addBuilderCustomizers(builder -> + builder.setServerOption(UndertowOptions.ENABLE_HTTP2, true)); + } + } + + private void setMimeMappings(WebServerFactory server) { + if (server instanceof ConfigurableServletWebServerFactory) { + MimeMappings mappings = new MimeMappings(MimeMappings.DEFAULT); + // IE issue, see https://github.com/jhipster/generator-jhipster/pull/711 + mappings.add("html", MediaType.TEXT_HTML_VALUE + ";charset=" + StandardCharsets.UTF_8.name().toLowerCase()); + // CloudFoundry issue, see https://github.com/cloudfoundry/gorouter/issues/64 + mappings.add("json", MediaType.TEXT_HTML_VALUE + ";charset=" + StandardCharsets.UTF_8.name().toLowerCase()); + ConfigurableServletWebServerFactory servletWebServer = (ConfigurableServletWebServerFactory) server; + servletWebServer.setMimeMappings(mappings); + } + } + + private void setLocationForStaticAssets(WebServerFactory server) { + if (server instanceof ConfigurableServletWebServerFactory) { + ConfigurableServletWebServerFactory servletWebServer = (ConfigurableServletWebServerFactory) server; + File root; + String prefixPath = resolvePathPrefix(); + root = new File(prefixPath + "target/www/"); + if (root.exists() && root.isDirectory()) { + servletWebServer.setDocumentRoot(root); + } + } + } + + /** + * Resolve path prefix to static resources. + */ + private String resolvePathPrefix() { + String fullExecutablePath; + try { + fullExecutablePath = decode(this.getClass().getResource("").getPath(), StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + /* try without decoding if this ever happens */ + fullExecutablePath = this.getClass().getResource("").getPath(); + } + String rootPath = Paths.get(".").toUri().normalize().getPath(); + String extractedPath = fullExecutablePath.replace(rootPath, ""); + int extractionEndIndex = extractedPath.indexOf("target/"); + if (extractionEndIndex <= 0) { + return ""; + } + return extractedPath.substring(0, extractionEndIndex); + } + + /** + * Initializes the caching HTTP Headers Filter. + */ + private void initCachingHttpHeadersFilter(ServletContext servletContext, + EnumSet disps) { + log.debug("Registering Caching HTTP Headers Filter"); + FilterRegistration.Dynamic cachingHttpHeadersFilter = + servletContext.addFilter("cachingHttpHeadersFilter", + new CachingHttpHeadersFilter(jHipsterProperties)); + + cachingHttpHeadersFilter.addMappingForUrlPatterns(disps, true, "/i18n/*"); + cachingHttpHeadersFilter.addMappingForUrlPatterns(disps, true, "/content/*"); + cachingHttpHeadersFilter.addMappingForUrlPatterns(disps, true, "/app/*"); + cachingHttpHeadersFilter.setAsyncSupported(true); + } + + /** + * Initializes Metrics. + */ + private void initMetrics(ServletContext servletContext, EnumSet disps) { + log.debug("Initializing Metrics registries"); + servletContext.setAttribute(InstrumentedFilter.REGISTRY_ATTRIBUTE, + metricRegistry); + servletContext.setAttribute(MetricsServlet.METRICS_REGISTRY, + metricRegistry); + + log.debug("Registering Metrics Filter"); + FilterRegistration.Dynamic metricsFilter = servletContext.addFilter("webappMetricsFilter", + new InstrumentedFilter()); + + metricsFilter.addMappingForUrlPatterns(disps, true, "/*"); + metricsFilter.setAsyncSupported(true); + + log.debug("Registering Metrics Servlet"); + ServletRegistration.Dynamic metricsAdminServlet = + servletContext.addServlet("metricsServlet", new MetricsServlet()); + + metricsAdminServlet.addMapping("/management/metrics/*"); + metricsAdminServlet.setAsyncSupported(true); + metricsAdminServlet.setLoadOnStartup(2); + } + + @Bean + public CorsFilter corsFilter() { + UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource(); + CorsConfiguration config = jHipsterProperties.getCors(); + if (config.getAllowedOrigins() != null && !config.getAllowedOrigins().isEmpty()) { + log.debug("Registering CORS filter"); + source.registerCorsConfiguration("/api/**", config); + source.registerCorsConfiguration("/management/**", config); + source.registerCorsConfiguration("/v2/api-docs", config); + source.registerCorsConfiguration("/auth/**", config); + source.registerCorsConfiguration("/*/api/**", config); + source.registerCorsConfiguration("/*/management/**", config); + source.registerCorsConfiguration("/*/oauth/**", config); + } + return new CorsFilter(source); + } + + /** + * Initializes H2 console. + */ + private void initH2Console(ServletContext servletContext) { + log.debug("Initialize H2 console"); + H2ConfigurationHelper.initH2Console(servletContext); + } + + @Autowired(required = false) + public void setMetricRegistry(MetricRegistry metricRegistry) { + this.metricRegistry = metricRegistry; + } +} diff --git a/jhipster/jhipster-uaa/gateway/src/main/java/com/baeldung/jhipster/gateway/config/apidoc/GatewaySwaggerResourcesProvider.java b/jhipster/jhipster-uaa/gateway/src/main/java/com/baeldung/jhipster/gateway/config/apidoc/GatewaySwaggerResourcesProvider.java new file mode 100644 index 0000000000..69bf50d30f --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/java/com/baeldung/jhipster/gateway/config/apidoc/GatewaySwaggerResourcesProvider.java @@ -0,0 +1,54 @@ +package com.baeldung.jhipster.gateway.config.apidoc; + +import java.util.ArrayList; +import java.util.List; + +import io.github.jhipster.config.JHipsterConstants; + +import org.springframework.context.annotation.*; +import org.springframework.cloud.netflix.zuul.filters.Route; +import org.springframework.cloud.netflix.zuul.filters.RouteLocator; +import org.springframework.context.annotation.Primary; +import org.springframework.stereotype.Component; + +import springfox.documentation.swagger.web.SwaggerResource; +import springfox.documentation.swagger.web.SwaggerResourcesProvider; + +/** + * Retrieves all registered microservices Swagger resources. + */ +@Component +@Primary +@Profile(JHipsterConstants.SPRING_PROFILE_SWAGGER) +public class GatewaySwaggerResourcesProvider implements SwaggerResourcesProvider { + + private final RouteLocator routeLocator; + + public GatewaySwaggerResourcesProvider(RouteLocator routeLocator) { + this.routeLocator = routeLocator; + } + + @Override + public List get() { + List resources = new ArrayList<>(); + + //Add the default swagger resource that correspond to the gateway's own swagger doc + resources.add(swaggerResource("default", "/v2/api-docs")); + + //Add the registered microservices swagger docs as additional swagger resources + List routes = routeLocator.getRoutes(); + routes.forEach(route -> { + resources.add(swaggerResource(route.getId(), route.getFullPath().replace("**", "v2/api-docs"))); + }); + + return resources; + } + + private SwaggerResource swaggerResource(String name, String location) { + SwaggerResource swaggerResource = new SwaggerResource(); + swaggerResource.setName(name); + swaggerResource.setLocation(location); + swaggerResource.setSwaggerVersion("2.0"); + return swaggerResource; + } +} diff --git a/jhipster/jhipster-uaa/gateway/src/main/java/com/baeldung/jhipster/gateway/config/audit/AuditEventConverter.java b/jhipster/jhipster-uaa/gateway/src/main/java/com/baeldung/jhipster/gateway/config/audit/AuditEventConverter.java new file mode 100644 index 0000000000..f8745d0918 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/java/com/baeldung/jhipster/gateway/config/audit/AuditEventConverter.java @@ -0,0 +1,86 @@ +package com.baeldung.jhipster.gateway.config.audit; + +import com.baeldung.jhipster.gateway.domain.PersistentAuditEvent; + +import org.springframework.boot.actuate.audit.AuditEvent; +import org.springframework.security.web.authentication.WebAuthenticationDetails; +import org.springframework.stereotype.Component; + +import java.util.*; + +@Component +public class AuditEventConverter { + + /** + * Convert a list of PersistentAuditEvent to a list of AuditEvent + * + * @param persistentAuditEvents the list to convert + * @return the converted list. + */ + public List convertToAuditEvent(Iterable persistentAuditEvents) { + if (persistentAuditEvents == null) { + return Collections.emptyList(); + } + List auditEvents = new ArrayList<>(); + for (PersistentAuditEvent persistentAuditEvent : persistentAuditEvents) { + auditEvents.add(convertToAuditEvent(persistentAuditEvent)); + } + return auditEvents; + } + + /** + * Convert a PersistentAuditEvent to an AuditEvent + * + * @param persistentAuditEvent the event to convert + * @return the converted list. + */ + public AuditEvent convertToAuditEvent(PersistentAuditEvent persistentAuditEvent) { + if (persistentAuditEvent == null) { + return null; + } + return new AuditEvent(persistentAuditEvent.getAuditEventDate(), persistentAuditEvent.getPrincipal(), + persistentAuditEvent.getAuditEventType(), convertDataToObjects(persistentAuditEvent.getData())); + } + + /** + * Internal conversion. This is needed to support the current SpringBoot actuator AuditEventRepository interface + * + * @param data the data to convert + * @return a map of String, Object + */ + public Map convertDataToObjects(Map data) { + Map results = new HashMap<>(); + + if (data != null) { + for (Map.Entry entry : data.entrySet()) { + results.put(entry.getKey(), entry.getValue()); + } + } + return results; + } + + /** + * Internal conversion. This method will allow to save additional data. + * By default, it will save the object as string + * + * @param data the data to convert + * @return a map of String, String + */ + public Map convertDataToStrings(Map data) { + Map results = new HashMap<>(); + + if (data != null) { + for (Map.Entry entry : data.entrySet()) { + // Extract the data that will be saved. + if (entry.getValue() instanceof WebAuthenticationDetails) { + WebAuthenticationDetails authenticationDetails = (WebAuthenticationDetails) entry.getValue(); + results.put("remoteAddress", authenticationDetails.getRemoteAddress()); + results.put("sessionId", authenticationDetails.getSessionId()); + } else { + results.put(entry.getKey(), Objects.toString(entry.getValue())); + } + } + } + return results; + } +} diff --git a/jhipster/jhipster-uaa/gateway/src/main/java/com/baeldung/jhipster/gateway/config/audit/package-info.java b/jhipster/jhipster-uaa/gateway/src/main/java/com/baeldung/jhipster/gateway/config/audit/package-info.java new file mode 100644 index 0000000000..2772f6041d --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/java/com/baeldung/jhipster/gateway/config/audit/package-info.java @@ -0,0 +1,4 @@ +/** + * Audit specific code. + */ +package com.baeldung.jhipster.gateway.config.audit; diff --git a/jhipster/jhipster-uaa/gateway/src/main/java/com/baeldung/jhipster/gateway/config/oauth2/OAuth2AuthenticationConfiguration.java b/jhipster/jhipster-uaa/gateway/src/main/java/com/baeldung/jhipster/gateway/config/oauth2/OAuth2AuthenticationConfiguration.java new file mode 100644 index 0000000000..bc5a4979a1 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/java/com/baeldung/jhipster/gateway/config/oauth2/OAuth2AuthenticationConfiguration.java @@ -0,0 +1,80 @@ +package com.baeldung.jhipster.gateway.config.oauth2; + +import com.baeldung.jhipster.gateway.security.oauth2.CookieTokenExtractor; +import com.baeldung.jhipster.gateway.security.oauth2.OAuth2AuthenticationService; +import com.baeldung.jhipster.gateway.security.oauth2.OAuth2CookieHelper; +import com.baeldung.jhipster.gateway.security.oauth2.OAuth2TokenEndpointClient; +import com.baeldung.jhipster.gateway.web.filter.RefreshTokenFilterConfigurer; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity; +import org.springframework.security.config.annotation.web.builders.HttpSecurity; +import org.springframework.security.oauth2.config.annotation.web.configuration.EnableResourceServer; +import org.springframework.security.oauth2.config.annotation.web.configuration.ResourceServerConfigurerAdapter; +import org.springframework.security.oauth2.config.annotation.web.configurers.ResourceServerSecurityConfigurer; +import org.springframework.security.oauth2.provider.authentication.TokenExtractor; +import org.springframework.security.oauth2.provider.token.TokenStore; + +/** + * Configures the RefreshFilter refreshing expired OAuth2 token Cookies. + */ +@Configuration +@EnableResourceServer +@EnableGlobalMethodSecurity(prePostEnabled = true, securedEnabled = true) +public class OAuth2AuthenticationConfiguration extends ResourceServerConfigurerAdapter { + private final OAuth2Properties oAuth2Properties; + private final OAuth2TokenEndpointClient tokenEndpointClient; + private final TokenStore tokenStore; + + public OAuth2AuthenticationConfiguration(OAuth2Properties oAuth2Properties, OAuth2TokenEndpointClient tokenEndpointClient, TokenStore tokenStore) { + this.oAuth2Properties = oAuth2Properties; + this.tokenEndpointClient = tokenEndpointClient; + this.tokenStore = tokenStore; + } + + @Override + public void configure(HttpSecurity http) throws Exception { + http + .authorizeRequests() + .antMatchers("/auth/login").permitAll() + .antMatchers("/auth/logout").authenticated() + .and() + .apply(refreshTokenSecurityConfigurerAdapter()); + } + + /** + * A SecurityConfigurerAdapter to install a servlet filter that refreshes OAuth2 tokens. + */ + private RefreshTokenFilterConfigurer refreshTokenSecurityConfigurerAdapter() { + return new RefreshTokenFilterConfigurer(uaaAuthenticationService(), tokenStore); + } + + @Bean + public OAuth2CookieHelper cookieHelper() { + return new OAuth2CookieHelper(oAuth2Properties); + } + + @Bean + public OAuth2AuthenticationService uaaAuthenticationService() { + return new OAuth2AuthenticationService(tokenEndpointClient, cookieHelper()); + } + + /** + * Configure the ResourceServer security by installing a new TokenExtractor. + */ + @Override + public void configure(ResourceServerSecurityConfigurer resources) throws Exception { + resources.tokenExtractor(tokenExtractor()); + } + + /** + * The new TokenExtractor can extract tokens from Cookies and Authorization headers. + * + * @return the CookieTokenExtractor bean. + */ + @Bean + public TokenExtractor tokenExtractor() { + return new CookieTokenExtractor(); + } + +} diff --git a/jhipster/jhipster-uaa/gateway/src/main/java/com/baeldung/jhipster/gateway/config/oauth2/OAuth2JwtAccessTokenConverter.java b/jhipster/jhipster-uaa/gateway/src/main/java/com/baeldung/jhipster/gateway/config/oauth2/OAuth2JwtAccessTokenConverter.java new file mode 100644 index 0000000000..64bbac0008 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/java/com/baeldung/jhipster/gateway/config/oauth2/OAuth2JwtAccessTokenConverter.java @@ -0,0 +1,109 @@ +package com.baeldung.jhipster.gateway.config.oauth2; + +import com.baeldung.jhipster.gateway.security.oauth2.OAuth2SignatureVerifierClient; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.security.jwt.crypto.sign.SignatureVerifier; +import org.springframework.security.oauth2.common.exceptions.InvalidTokenException; +import org.springframework.security.oauth2.provider.token.store.JwtAccessTokenConverter; +import org.springframework.security.oauth2.provider.OAuth2Authentication; + +import java.util.Map; + +/** + * Improved JwtAccessTokenConverter that can handle lazy fetching of public verifier keys. + */ +public class OAuth2JwtAccessTokenConverter extends JwtAccessTokenConverter { + private final Logger log = LoggerFactory.getLogger(OAuth2JwtAccessTokenConverter.class); + + private final OAuth2Properties oAuth2Properties; + private final OAuth2SignatureVerifierClient signatureVerifierClient; + /** + * When did we last fetch the public key? + */ + private long lastKeyFetchTimestamp; + + public OAuth2JwtAccessTokenConverter(OAuth2Properties oAuth2Properties, OAuth2SignatureVerifierClient signatureVerifierClient) { + this.oAuth2Properties = oAuth2Properties; + this.signatureVerifierClient = signatureVerifierClient; + tryCreateSignatureVerifier(); + } + + /** + * Try to decode the token with the current public key. + * If it fails, contact the OAuth2 server to get a new public key, then try again. + * We might not have fetched it in the first place or it might have changed. + * + * @param token the JWT token to decode. + * @return the resulting claims. + * @throws InvalidTokenException if we cannot decode the token. + */ + @Override + protected Map decode(String token) { + try { + //check if our public key and thus SignatureVerifier have expired + long ttl = oAuth2Properties.getSignatureVerification().getTtl(); + if (ttl > 0 && System.currentTimeMillis() - lastKeyFetchTimestamp > ttl) { + throw new InvalidTokenException("public key expired"); + } + return super.decode(token); + } catch (InvalidTokenException ex) { + if (tryCreateSignatureVerifier()) { + return super.decode(token); + } + throw ex; + } + } + + /** + * Fetch a new public key from the AuthorizationServer. + * + * @return true, if we could fetch it; false, if we could not. + */ + private boolean tryCreateSignatureVerifier() { + long t = System.currentTimeMillis(); + if (t - lastKeyFetchTimestamp < oAuth2Properties.getSignatureVerification().getPublicKeyRefreshRateLimit()) { + return false; + } + try { + SignatureVerifier verifier = signatureVerifierClient.getSignatureVerifier(); + if (verifier != null) { + setVerifier(verifier); + lastKeyFetchTimestamp = t; + log.debug("Public key retrieved from OAuth2 server to create SignatureVerifier"); + return true; + } + } catch (Throwable ex) { + log.error("could not get public key from OAuth2 server to create SignatureVerifier", ex); + } + return false; + } + /** + * Extract JWT claims and set it to OAuth2Authentication decoded details. + * Here is how to get details: + * + *

+     * 
+     *  SecurityContext securityContext = SecurityContextHolder.getContext();
+     *  Authentication authentication = securityContext.getAuthentication();
+     *  if (authentication != null) {
+     *      Object details = authentication.getDetails();
+     *      if(details instanceof OAuth2AuthenticationDetails) {
+     *          Object decodedDetails = ((OAuth2AuthenticationDetails) details).getDecodedDetails();
+     *          if(decodedDetails != null && decodedDetails instanceof Map) {
+     *             String detailFoo = ((Map) decodedDetails).get("foo");
+     *          }
+     *      }
+     *  }
+     * 
+     *  
+ * @param claims OAuth2JWTToken claims + * @return OAuth2Authentication + */ + @Override + public OAuth2Authentication extractAuthentication(Map claims) { + OAuth2Authentication authentication = super.extractAuthentication(claims); + authentication.setDetails(claims); + return authentication; + } +} diff --git a/jhipster/jhipster-uaa/gateway/src/main/java/com/baeldung/jhipster/gateway/config/oauth2/OAuth2Properties.java b/jhipster/jhipster-uaa/gateway/src/main/java/com/baeldung/jhipster/gateway/config/oauth2/OAuth2Properties.java new file mode 100644 index 0000000000..1280994304 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/java/com/baeldung/jhipster/gateway/config/oauth2/OAuth2Properties.java @@ -0,0 +1,118 @@ +package com.baeldung.jhipster.gateway.config.oauth2; + +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.stereotype.Component; + +/** + * OAuth2 properties define properties for OAuth2-based microservices. + */ +@Component +@ConfigurationProperties(prefix = "oauth2", ignoreUnknownFields = false) +public class OAuth2Properties { + private WebClientConfiguration webClientConfiguration = new WebClientConfiguration(); + + private SignatureVerification signatureVerification = new SignatureVerification(); + + public WebClientConfiguration getWebClientConfiguration() { + return webClientConfiguration; + } + + public SignatureVerification getSignatureVerification() { + return signatureVerification; + } + + public static class WebClientConfiguration { + private String clientId = "web_app"; + private String secret = "changeit"; + /** + * Holds the session timeout in seconds for non-remember-me sessions. + * After so many seconds of inactivity, the session will be terminated. + * Only checked during token refresh, so long access token validity may + * delay the session timeout accordingly. + */ + private int sessionTimeoutInSeconds = 1800; + /** + * Defines the cookie domain. If specified, cookies will be set on this domain. + * If not configured, then cookies will be set on the top-level domain of the + * request you sent, i.e. if you send a request to app1.your-domain.com, + * then cookies will be set on .your-domain.com, such that they + * are also valid for app2.your-domain.com. + */ + private String cookieDomain; + + public String getClientId() { + return clientId; + } + + public void setClientId(String clientId) { + this.clientId = clientId; + } + + public String getSecret() { + return secret; + } + + public void setSecret(String secret) { + this.secret = secret; + } + + public int getSessionTimeoutInSeconds() { + return sessionTimeoutInSeconds; + } + + public void setSessionTimeoutInSeconds(int sessionTimeoutInSeconds) { + this.sessionTimeoutInSeconds = sessionTimeoutInSeconds; + } + + public String getCookieDomain() { + return cookieDomain; + } + + public void setCookieDomain(String cookieDomain) { + this.cookieDomain = cookieDomain; + } + } + + public static class SignatureVerification { + /** + * Maximum refresh rate for public keys in ms. + * We won't fetch new public keys any faster than that to avoid spamming UAA in case + * we receive a lot of "illegal" tokens. + */ + private long publicKeyRefreshRateLimit = 10 * 1000L; + /** + * Maximum TTL for the public key in ms. + * The public key will be fetched again from UAA if it gets older than that. + * That way, we make sure that we get the newest keys always in case they are updated there. + */ + private long ttl = 24 * 60 * 60 * 1000L; + /** + * Endpoint where to retrieve the public key used to verify token signatures. + */ + private String publicKeyEndpointUri = "http://uaa/oauth/token_key"; + + public long getPublicKeyRefreshRateLimit() { + return publicKeyRefreshRateLimit; + } + + public void setPublicKeyRefreshRateLimit(long publicKeyRefreshRateLimit) { + this.publicKeyRefreshRateLimit = publicKeyRefreshRateLimit; + } + + public long getTtl() { + return ttl; + } + + public void setTtl(long ttl) { + this.ttl = ttl; + } + + public String getPublicKeyEndpointUri() { + return publicKeyEndpointUri; + } + + public void setPublicKeyEndpointUri(String publicKeyEndpointUri) { + this.publicKeyEndpointUri = publicKeyEndpointUri; + } + } +} diff --git a/jhipster/jhipster-uaa/gateway/src/main/java/com/baeldung/jhipster/gateway/config/package-info.java b/jhipster/jhipster-uaa/gateway/src/main/java/com/baeldung/jhipster/gateway/config/package-info.java new file mode 100644 index 0000000000..2ee9067535 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/java/com/baeldung/jhipster/gateway/config/package-info.java @@ -0,0 +1,4 @@ +/** + * Spring Framework configuration files. + */ +package com.baeldung.jhipster.gateway.config; diff --git a/jhipster/jhipster-uaa/gateway/src/main/java/com/baeldung/jhipster/gateway/domain/AbstractAuditingEntity.java b/jhipster/jhipster-uaa/gateway/src/main/java/com/baeldung/jhipster/gateway/domain/AbstractAuditingEntity.java new file mode 100644 index 0000000000..b626ca0633 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/java/com/baeldung/jhipster/gateway/domain/AbstractAuditingEntity.java @@ -0,0 +1,79 @@ +package com.baeldung.jhipster.gateway.domain; + +import com.fasterxml.jackson.annotation.JsonIgnore; +import org.hibernate.envers.Audited; +import org.springframework.data.annotation.CreatedBy; +import org.springframework.data.annotation.CreatedDate; +import org.springframework.data.annotation.LastModifiedBy; +import org.springframework.data.annotation.LastModifiedDate; +import org.springframework.data.jpa.domain.support.AuditingEntityListener; + +import java.io.Serializable; +import java.time.Instant; +import javax.persistence.Column; +import javax.persistence.EntityListeners; +import javax.persistence.MappedSuperclass; + +/** + * Base abstract class for entities which will hold definitions for created, last modified by and created, + * last modified by date. + */ +@MappedSuperclass +@Audited +@EntityListeners(AuditingEntityListener.class) +public abstract class AbstractAuditingEntity implements Serializable { + + private static final long serialVersionUID = 1L; + + @CreatedBy + @Column(name = "created_by", nullable = false, length = 50, updatable = false) + @JsonIgnore + private String createdBy; + + @CreatedDate + @Column(name = "created_date", nullable = false, updatable = false) + @JsonIgnore + private Instant createdDate = Instant.now(); + + @LastModifiedBy + @Column(name = "last_modified_by", length = 50) + @JsonIgnore + private String lastModifiedBy; + + @LastModifiedDate + @Column(name = "last_modified_date") + @JsonIgnore + private Instant lastModifiedDate = Instant.now(); + + public String getCreatedBy() { + return createdBy; + } + + public void setCreatedBy(String createdBy) { + this.createdBy = createdBy; + } + + public Instant getCreatedDate() { + return createdDate; + } + + public void setCreatedDate(Instant createdDate) { + this.createdDate = createdDate; + } + + public String getLastModifiedBy() { + return lastModifiedBy; + } + + public void setLastModifiedBy(String lastModifiedBy) { + this.lastModifiedBy = lastModifiedBy; + } + + public Instant getLastModifiedDate() { + return lastModifiedDate; + } + + public void setLastModifiedDate(Instant lastModifiedDate) { + this.lastModifiedDate = lastModifiedDate; + } +} diff --git a/jhipster/jhipster-uaa/gateway/src/main/java/com/baeldung/jhipster/gateway/domain/PersistentAuditEvent.java b/jhipster/jhipster-uaa/gateway/src/main/java/com/baeldung/jhipster/gateway/domain/PersistentAuditEvent.java new file mode 100644 index 0000000000..3922b96000 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/java/com/baeldung/jhipster/gateway/domain/PersistentAuditEvent.java @@ -0,0 +1,81 @@ +package com.baeldung.jhipster.gateway.domain; + +import javax.persistence.*; +import javax.validation.constraints.NotNull; +import java.io.Serializable; +import java.time.Instant; +import java.util.HashMap; +import java.util.Map; + +/** + * Persist AuditEvent managed by the Spring Boot actuator. + * + * @see org.springframework.boot.actuate.audit.AuditEvent + */ +@Entity +@Table(name = "jhi_persistent_audit_event") +public class PersistentAuditEvent implements Serializable { + + private static final long serialVersionUID = 1L; + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Column(name = "event_id") + private Long id; + + @NotNull + @Column(nullable = false) + private String principal; + + @Column(name = "event_date") + private Instant auditEventDate; + + @Column(name = "event_type") + private String auditEventType; + + @ElementCollection + @MapKeyColumn(name = "name") + @Column(name = "value") + @CollectionTable(name = "jhi_persistent_audit_evt_data", joinColumns=@JoinColumn(name="event_id")) + private Map data = new HashMap<>(); + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getPrincipal() { + return principal; + } + + public void setPrincipal(String principal) { + this.principal = principal; + } + + public Instant getAuditEventDate() { + return auditEventDate; + } + + public void setAuditEventDate(Instant auditEventDate) { + this.auditEventDate = auditEventDate; + } + + public String getAuditEventType() { + return auditEventType; + } + + public void setAuditEventType(String auditEventType) { + this.auditEventType = auditEventType; + } + + public Map getData() { + return data; + } + + public void setData(Map data) { + this.data = data; + } +} diff --git a/jhipster/jhipster-uaa/gateway/src/main/java/com/baeldung/jhipster/gateway/domain/package-info.java b/jhipster/jhipster-uaa/gateway/src/main/java/com/baeldung/jhipster/gateway/domain/package-info.java new file mode 100644 index 0000000000..912c64f019 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/java/com/baeldung/jhipster/gateway/domain/package-info.java @@ -0,0 +1,4 @@ +/** + * JPA domain objects. + */ +package com.baeldung.jhipster.gateway.domain; diff --git a/jhipster/jhipster-uaa/gateway/src/main/java/com/baeldung/jhipster/gateway/gateway/accesscontrol/AccessControlFilter.java b/jhipster/jhipster-uaa/gateway/src/main/java/com/baeldung/jhipster/gateway/gateway/accesscontrol/AccessControlFilter.java new file mode 100644 index 0000000000..102789c198 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/java/com/baeldung/jhipster/gateway/gateway/accesscontrol/AccessControlFilter.java @@ -0,0 +1,99 @@ +package com.baeldung.jhipster.gateway.gateway.accesscontrol; + +import io.github.jhipster.config.JHipsterProperties; + +import java.util.List; +import java.util.Map; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.cloud.netflix.zuul.filters.Route; +import org.springframework.cloud.netflix.zuul.filters.RouteLocator; +import org.springframework.http.HttpStatus; + +import com.netflix.zuul.ZuulFilter; +import com.netflix.zuul.context.RequestContext; + +/** + * Zuul filter for restricting access to backend micro-services endpoints. + */ +public class AccessControlFilter extends ZuulFilter { + + private final Logger log = LoggerFactory.getLogger(AccessControlFilter.class); + + private final RouteLocator routeLocator; + + private final JHipsterProperties jHipsterProperties; + + public AccessControlFilter(RouteLocator routeLocator, JHipsterProperties jHipsterProperties) { + this.routeLocator = routeLocator; + this.jHipsterProperties = jHipsterProperties; + } + + @Override + public String filterType() { + return "pre"; + } + + @Override + public int filterOrder() { + return 0; + } + + /** + * Filter requests on endpoints that are not in the list of authorized microservices endpoints. + */ + @Override + public boolean shouldFilter() { + String requestUri = RequestContext.getCurrentContext().getRequest().getRequestURI(); + String contextPath = RequestContext.getCurrentContext().getRequest().getContextPath(); + + // If the request Uri does not start with the path of the authorized endpoints, we block the request + for (Route route : routeLocator.getRoutes()) { + String serviceUrl = contextPath + route.getFullPath(); + String serviceName = route.getId(); + + // If this route correspond to the current request URI + // We do a substring to remove the "**" at the end of the route URL + if (requestUri.startsWith(serviceUrl.substring(0, serviceUrl.length() - 2))) { + return !isAuthorizedRequest(serviceUrl, serviceName, requestUri); + } + } + return true; + } + + private boolean isAuthorizedRequest(String serviceUrl, String serviceName, String requestUri) { + Map> authorizedMicroservicesEndpoints = jHipsterProperties.getGateway() + .getAuthorizedMicroservicesEndpoints(); + + // If the authorized endpoints list was left empty for this route, all access are allowed + if (authorizedMicroservicesEndpoints.get(serviceName) == null) { + log.debug("Access Control: allowing access for {}, as no access control policy has been set up for " + + "service: {}", requestUri, serviceName); + return true; + } else { + List authorizedEndpoints = authorizedMicroservicesEndpoints.get(serviceName); + + // Go over the authorized endpoints to control that the request URI matches it + for (String endpoint : authorizedEndpoints) { + // We do a substring to remove the "**/" at the end of the route URL + String gatewayEndpoint = serviceUrl.substring(0, serviceUrl.length() - 3) + endpoint; + if (requestUri.startsWith(gatewayEndpoint)) { + log.debug("Access Control: allowing access for {}, as it matches the following authorized " + + "microservice endpoint: {}", requestUri, gatewayEndpoint); + return true; + } + } + } + return false; + } + + @Override + public Object run() { + RequestContext ctx = RequestContext.getCurrentContext(); + ctx.setResponseStatusCode(HttpStatus.FORBIDDEN.value()); + ctx.setSendZuulResponse(false); + log.debug("Access Control: filtered unauthorized access on endpoint {}", ctx.getRequest().getRequestURI()); + return null; + } +} diff --git a/jhipster/jhipster-uaa/gateway/src/main/java/com/baeldung/jhipster/gateway/gateway/ratelimiting/RateLimitingFilter.java b/jhipster/jhipster-uaa/gateway/src/main/java/com/baeldung/jhipster/gateway/gateway/ratelimiting/RateLimitingFilter.java new file mode 100644 index 0000000000..4c0673282c --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/java/com/baeldung/jhipster/gateway/gateway/ratelimiting/RateLimitingFilter.java @@ -0,0 +1,121 @@ +package com.baeldung.jhipster.gateway.gateway.ratelimiting; + +import com.baeldung.jhipster.gateway.security.SecurityUtils; + +import java.time.Duration; +import java.util.function.Supplier; +import javax.cache.CacheManager; +import javax.cache.Caching; +import javax.cache.configuration.CompleteConfiguration; +import javax.cache.configuration.MutableConfiguration; +import javax.cache.spi.CachingProvider; +import javax.servlet.http.HttpServletRequest; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.http.HttpStatus; + +import com.netflix.zuul.ZuulFilter; +import com.netflix.zuul.context.RequestContext; + +import io.github.bucket4j.*; +import io.github.bucket4j.grid.GridBucketState; +import io.github.bucket4j.grid.ProxyManager; +import io.github.bucket4j.grid.jcache.JCache; +import io.github.jhipster.config.JHipsterProperties; + +/** + * Zuul filter for limiting the number of HTTP calls per client. + * + * See the Bucket4j documentation at https://github.com/vladimir-bukhtoyarov/bucket4j + * https://github.com/vladimir-bukhtoyarov/bucket4j/blob/master/doc-pages/jcache-usage + * .md#example-1---limiting-access-to-http-server-by-ip-address + */ +public class RateLimitingFilter extends ZuulFilter { + + private final Logger log = LoggerFactory.getLogger(RateLimitingFilter.class); + + public final static String GATEWAY_RATE_LIMITING_CACHE_NAME = "gateway-rate-limiting"; + + private final JHipsterProperties jHipsterProperties; + + private javax.cache.Cache cache; + + private ProxyManager buckets; + + public RateLimitingFilter(JHipsterProperties jHipsterProperties) { + this.jHipsterProperties = jHipsterProperties; + + CachingProvider cachingProvider = Caching.getCachingProvider(); + CacheManager cacheManager = cachingProvider.getCacheManager(); + CompleteConfiguration config = + new MutableConfiguration() + .setTypes(String.class, GridBucketState.class); + + this.cache = cacheManager.createCache(GATEWAY_RATE_LIMITING_CACHE_NAME, config); + this.buckets = Bucket4j.extension(JCache.class).proxyManagerForCache(cache); + } + + @Override + public String filterType() { + return "pre"; + } + + @Override + public int filterOrder() { + return 10; + } + + @Override + public boolean shouldFilter() { + // specific APIs can be filtered out using + // if (RequestContext.getCurrentContext().getRequest().getRequestURI().startsWith("/api")) { ... } + return true; + } + + @Override + public Object run() { + String bucketId = getId(RequestContext.getCurrentContext().getRequest()); + Bucket bucket = buckets.getProxy(bucketId, getConfigSupplier()); + if (bucket.tryConsume(1)) { + // the limit is not exceeded + log.debug("API rate limit OK for {}", bucketId); + } else { + // limit is exceeded + log.info("API rate limit exceeded for {}", bucketId); + apiLimitExceeded(); + } + return null; + } + + private Supplier getConfigSupplier() { + return () -> { + JHipsterProperties.Gateway.RateLimiting rateLimitingProperties = + jHipsterProperties.getGateway().getRateLimiting(); + + return Bucket4j.configurationBuilder() + .addLimit(Bandwidth.simple(rateLimitingProperties.getLimit(), + Duration.ofSeconds(rateLimitingProperties.getDurationInSeconds()))) + .build(); + }; + } + + /** + * Create a Zuul response error when the API limit is exceeded. + */ + private void apiLimitExceeded() { + RequestContext ctx = RequestContext.getCurrentContext(); + ctx.setResponseStatusCode(HttpStatus.TOO_MANY_REQUESTS.value()); + if (ctx.getResponseBody() == null) { + ctx.setResponseBody("API rate limit exceeded"); + ctx.setSendZuulResponse(false); + } + } + + /** + * The ID that will identify the limit: the user login or the user IP address. + */ + private String getId(HttpServletRequest httpServletRequest) { + return SecurityUtils.getCurrentUserLogin().orElse(httpServletRequest.getRemoteAddr()); + } +} diff --git a/jhipster/jhipster-uaa/gateway/src/main/java/com/baeldung/jhipster/gateway/gateway/responserewriting/SwaggerBasePathRewritingFilter.java b/jhipster/jhipster-uaa/gateway/src/main/java/com/baeldung/jhipster/gateway/gateway/responserewriting/SwaggerBasePathRewritingFilter.java new file mode 100644 index 0000000000..6dd2d4de8f --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/java/com/baeldung/jhipster/gateway/gateway/responserewriting/SwaggerBasePathRewritingFilter.java @@ -0,0 +1,99 @@ +package com.baeldung.jhipster.gateway.gateway.responserewriting; + +import com.fasterxml.jackson.databind.ObjectMapper; +import com.netflix.zuul.context.RequestContext; +import org.apache.commons.io.IOUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.cloud.netflix.zuul.filters.ZuulProperties; +import org.springframework.cloud.netflix.zuul.filters.post.SendResponseFilter; +import springfox.documentation.swagger2.web.Swagger2Controller; + +import java.io.*; +import java.nio.charset.StandardCharsets; +import java.util.LinkedHashMap; +import java.util.zip.GZIPInputStream; +import java.util.zip.GZIPOutputStream; + +/** + * Zuul filter to rewrite micro-services Swagger URL Base Path. + */ +public class SwaggerBasePathRewritingFilter extends SendResponseFilter { + + private final Logger log = LoggerFactory.getLogger(SwaggerBasePathRewritingFilter.class); + + private ObjectMapper mapper = new ObjectMapper(); + + public SwaggerBasePathRewritingFilter() { + super(new ZuulProperties()); + } + + @Override + public String filterType() { + return "post"; + } + + @Override + public int filterOrder() { + return 100; + } + + /** + * Filter requests to micro-services Swagger docs. + */ + @Override + public boolean shouldFilter() { + return RequestContext.getCurrentContext().getRequest().getRequestURI().endsWith(Swagger2Controller.DEFAULT_URL); + } + + @Override + public Object run() { + RequestContext context = RequestContext.getCurrentContext(); + + context.getResponse().setCharacterEncoding("UTF-8"); + + String rewrittenResponse = rewriteBasePath(context); + if (context.getResponseGZipped()) { + try { + context.setResponseDataStream(new ByteArrayInputStream(gzipData(rewrittenResponse))); + } catch (IOException e) { + log.error("Swagger-docs filter error", e); + } + } else { + context.setResponseBody(rewrittenResponse); + } + return null; + } + + @SuppressWarnings("unchecked") + private String rewriteBasePath(RequestContext context) { + InputStream responseDataStream = context.getResponseDataStream(); + String requestUri = RequestContext.getCurrentContext().getRequest().getRequestURI(); + try { + if (context.getResponseGZipped()) { + responseDataStream = new GZIPInputStream(context.getResponseDataStream()); + } + String response = IOUtils.toString(responseDataStream, StandardCharsets.UTF_8); + if (response != null) { + LinkedHashMap map = this.mapper.readValue(response, LinkedHashMap.class); + + String basePath = requestUri.replace(Swagger2Controller.DEFAULT_URL, ""); + map.put("basePath", basePath); + log.debug("Swagger-docs: rewritten Base URL with correct micro-service route: {}", basePath); + return mapper.writeValueAsString(map); + } + } catch (IOException e) { + log.error("Swagger-docs filter error", e); + } + return null; + } + + public static byte[] gzipData(String content) throws IOException { + ByteArrayOutputStream bos = new ByteArrayOutputStream(); + PrintWriter gzip = new PrintWriter(new GZIPOutputStream(bos)); + gzip.print(content); + gzip.flush(); + gzip.close(); + return bos.toByteArray(); + } +} diff --git a/jhipster/jhipster-uaa/gateway/src/main/java/com/baeldung/jhipster/gateway/repository/package-info.java b/jhipster/jhipster-uaa/gateway/src/main/java/com/baeldung/jhipster/gateway/repository/package-info.java new file mode 100644 index 0000000000..10a1bec77c --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/java/com/baeldung/jhipster/gateway/repository/package-info.java @@ -0,0 +1,4 @@ +/** + * Spring Data JPA repositories. + */ +package com.baeldung.jhipster.gateway.repository; diff --git a/jhipster/jhipster-uaa/gateway/src/main/java/com/baeldung/jhipster/gateway/security/AuthoritiesConstants.java b/jhipster/jhipster-uaa/gateway/src/main/java/com/baeldung/jhipster/gateway/security/AuthoritiesConstants.java new file mode 100644 index 0000000000..31480b886b --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/java/com/baeldung/jhipster/gateway/security/AuthoritiesConstants.java @@ -0,0 +1,16 @@ +package com.baeldung.jhipster.gateway.security; + +/** + * Constants for Spring Security authorities. + */ +public final class AuthoritiesConstants { + + public static final String ADMIN = "ROLE_ADMIN"; + + public static final String USER = "ROLE_USER"; + + public static final String ANONYMOUS = "ROLE_ANONYMOUS"; + + private AuthoritiesConstants() { + } +} diff --git a/jhipster/jhipster-uaa/gateway/src/main/java/com/baeldung/jhipster/gateway/security/SecurityUtils.java b/jhipster/jhipster-uaa/gateway/src/main/java/com/baeldung/jhipster/gateway/security/SecurityUtils.java new file mode 100644 index 0000000000..e7d4ca3238 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/java/com/baeldung/jhipster/gateway/security/SecurityUtils.java @@ -0,0 +1,64 @@ +package com.baeldung.jhipster.gateway.security; + +import org.springframework.security.core.context.SecurityContext; +import org.springframework.security.core.context.SecurityContextHolder; +import org.springframework.security.core.userdetails.UserDetails; + +import java.util.Optional; + +/** + * Utility class for Spring Security. + */ +public final class SecurityUtils { + + private SecurityUtils() { + } + + /** + * Get the login of the current user. + * + * @return the login of the current user + */ + public static Optional getCurrentUserLogin() { + SecurityContext securityContext = SecurityContextHolder.getContext(); + return Optional.ofNullable(securityContext.getAuthentication()) + .map(authentication -> { + if (authentication.getPrincipal() instanceof UserDetails) { + UserDetails springSecurityUser = (UserDetails) authentication.getPrincipal(); + return springSecurityUser.getUsername(); + } else if (authentication.getPrincipal() instanceof String) { + return (String) authentication.getPrincipal(); + } + return null; + }); + } + + /** + * Check if a user is authenticated. + * + * @return true if the user is authenticated, false otherwise + */ + public static boolean isAuthenticated() { + SecurityContext securityContext = SecurityContextHolder.getContext(); + return Optional.ofNullable(securityContext.getAuthentication()) + .map(authentication -> authentication.getAuthorities().stream() + .noneMatch(grantedAuthority -> grantedAuthority.getAuthority().equals(AuthoritiesConstants.ANONYMOUS))) + .orElse(false); + } + + /** + * If the current user has a specific authority (security role). + *

+ * The name of this method comes from the isUserInRole() method in the Servlet API + * + * @param authority the authority to check + * @return true if the current user has the authority, false otherwise + */ + public static boolean isCurrentUserInRole(String authority) { + SecurityContext securityContext = SecurityContextHolder.getContext(); + return Optional.ofNullable(securityContext.getAuthentication()) + .map(authentication -> authentication.getAuthorities().stream() + .anyMatch(grantedAuthority -> grantedAuthority.getAuthority().equals(authority))) + .orElse(false); + } +} diff --git a/jhipster/jhipster-uaa/gateway/src/main/java/com/baeldung/jhipster/gateway/security/SpringSecurityAuditorAware.java b/jhipster/jhipster-uaa/gateway/src/main/java/com/baeldung/jhipster/gateway/security/SpringSecurityAuditorAware.java new file mode 100644 index 0000000000..0329d5202b --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/java/com/baeldung/jhipster/gateway/security/SpringSecurityAuditorAware.java @@ -0,0 +1,20 @@ +package com.baeldung.jhipster.gateway.security; + +import com.baeldung.jhipster.gateway.config.Constants; + +import java.util.Optional; + +import org.springframework.data.domain.AuditorAware; +import org.springframework.stereotype.Component; + +/** + * Implementation of AuditorAware based on Spring Security. + */ +@Component +public class SpringSecurityAuditorAware implements AuditorAware { + + @Override + public Optional getCurrentAuditor() { + return Optional.of(SecurityUtils.getCurrentUserLogin().orElse(Constants.SYSTEM_ACCOUNT)); + } +} diff --git a/jhipster/jhipster-uaa/gateway/src/main/java/com/baeldung/jhipster/gateway/security/oauth2/CookieCollection.java b/jhipster/jhipster-uaa/gateway/src/main/java/com/baeldung/jhipster/gateway/security/oauth2/CookieCollection.java new file mode 100644 index 0000000000..7810ed8661 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/java/com/baeldung/jhipster/gateway/security/oauth2/CookieCollection.java @@ -0,0 +1,139 @@ +package com.baeldung.jhipster.gateway.security.oauth2; + +import javax.servlet.http.Cookie; +import java.util.Arrays; +import java.util.Collection; +import java.util.HashMap; +import java.util.Iterator; +import java.util.Map; + +/** + * A Collection of Cookies that allows modification - unlike a mere array. + *

+ * Since {@link Cookie} doesn't implement hashCode nor equals, + * we cannot simply put it into a HashSet. + */ +public class CookieCollection implements Collection { + private final Map cookieMap; + + public CookieCollection() { + cookieMap = new HashMap<>(); + } + + public CookieCollection(Cookie... cookies) { + this(Arrays.asList(cookies)); + } + + public CookieCollection(Collection cookies) { + cookieMap = new HashMap<>(cookies.size()); + addAll(cookies); + } + + @Override + public int size() { + return cookieMap.size(); + } + + @Override + public boolean isEmpty() { + return cookieMap.isEmpty(); + } + + @Override + public boolean contains(Object o) { + if (o instanceof String) { + return cookieMap.containsKey(o); + } + if (o instanceof Cookie) { + return cookieMap.containsValue(o); + } + return false; + } + + @Override + public Iterator iterator() { + return cookieMap.values().iterator(); + } + + public Cookie[] toArray() { + Cookie[] cookies = new Cookie[cookieMap.size()]; + return toArray(cookies); + } + + @Override + public T[] toArray(T[] ts) { + return cookieMap.values().toArray(ts); + } + + @Override + public boolean add(Cookie cookie) { + if (cookie == null) { + return false; + } + cookieMap.put(cookie.getName(), cookie); + return true; + } + + @Override + public boolean remove(Object o) { + if (o instanceof String) { + return cookieMap.remove((String)o) != null; + } + if (o instanceof Cookie) { + Cookie c = (Cookie)o; + return cookieMap.remove(c.getName()) != null; + } + return false; + } + + public Cookie get(String name) { + return cookieMap.get(name); + } + + @Override + public boolean containsAll(Collection collection) { + for(Object o : collection) { + if (!contains(o)) { + return false; + } + } + return true; + } + + @Override + public boolean addAll(Collection collection) { + boolean result = false; + for(Cookie cookie : collection) { + result|= add(cookie); + } + return result; + } + + @Override + public boolean removeAll(Collection collection) { + boolean result = false; + for(Object cookie : collection) { + result|= remove(cookie); + } + return result; + } + + @Override + public boolean retainAll(Collection collection) { + boolean result = false; + Iterator> it = cookieMap.entrySet().iterator(); + while(it.hasNext()) { + Map.Entry e = it.next(); + if (!collection.contains(e.getKey()) && !collection.contains(e.getValue())) { + it.remove(); + result = true; + } + } + return result; + } + + @Override + public void clear() { + cookieMap.clear(); + } +} diff --git a/jhipster/jhipster-uaa/gateway/src/main/java/com/baeldung/jhipster/gateway/security/oauth2/CookieTokenExtractor.java b/jhipster/jhipster-uaa/gateway/src/main/java/com/baeldung/jhipster/gateway/security/oauth2/CookieTokenExtractor.java new file mode 100644 index 0000000000..0128d80c46 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/java/com/baeldung/jhipster/gateway/security/oauth2/CookieTokenExtractor.java @@ -0,0 +1,33 @@ +package com.baeldung.jhipster.gateway.security.oauth2; + +import org.springframework.security.oauth2.provider.authentication.BearerTokenExtractor; + +import javax.servlet.http.Cookie; +import javax.servlet.http.HttpServletRequest; + +/** + * Extracts the access token from a cookie. + * Falls back to a BearerTokenExtractor extracting information from the Authorization header, if no + * cookie was found. + */ +public class CookieTokenExtractor extends BearerTokenExtractor { + /** + * Extract the JWT access token from the request, if present. + * If not, then it falls back to the {@link BearerTokenExtractor} behaviour. + * + * @param request the request containing the cookies. + * @return the extracted JWT token; or null. + */ + @Override + protected String extractToken(HttpServletRequest request) { + String result; + Cookie accessTokenCookie = OAuth2CookieHelper.getAccessTokenCookie(request); + if (accessTokenCookie != null) { + result = accessTokenCookie.getValue(); + } else { + result = super.extractToken(request); + } + return result; + } + +} diff --git a/jhipster/jhipster-uaa/gateway/src/main/java/com/baeldung/jhipster/gateway/security/oauth2/CookiesHttpServletRequestWrapper.java b/jhipster/jhipster-uaa/gateway/src/main/java/com/baeldung/jhipster/gateway/security/oauth2/CookiesHttpServletRequestWrapper.java new file mode 100644 index 0000000000..98fa68188f --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/java/com/baeldung/jhipster/gateway/security/oauth2/CookiesHttpServletRequestWrapper.java @@ -0,0 +1,31 @@ +package com.baeldung.jhipster.gateway.security.oauth2; + +import javax.servlet.http.Cookie; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletRequestWrapper; + +/** + * A request mapper used to modify the cookies in the original request. + * This is needed such that we can modify the cookies of the request during a token refresh. + * The token refresh happens before authentication by the OAuth2AuthenticationProcessingFilter + * so we must make sure that further in the filter chain, we have the new cookies and not the expired/missing ones. + */ +class CookiesHttpServletRequestWrapper extends HttpServletRequestWrapper { + /** + * The new cookies of the request. Use these instead of the ones found in the wrapped request. + */ + private Cookie[] cookies; + + public CookiesHttpServletRequestWrapper(HttpServletRequest request, Cookie[] cookies) { + super(request); + this.cookies = cookies; + } + + /** + * Return the modified cookies instead of the original ones. + */ + @Override + public Cookie[] getCookies() { + return cookies; + } +} diff --git a/jhipster/jhipster-uaa/gateway/src/main/java/com/baeldung/jhipster/gateway/security/oauth2/OAuth2AuthenticationService.java b/jhipster/jhipster-uaa/gateway/src/main/java/com/baeldung/jhipster/gateway/security/oauth2/OAuth2AuthenticationService.java new file mode 100644 index 0000000000..ba8dcaf988 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/java/com/baeldung/jhipster/gateway/security/oauth2/OAuth2AuthenticationService.java @@ -0,0 +1,163 @@ +package com.baeldung.jhipster.gateway.security.oauth2; + +import com.baeldung.jhipster.gateway.web.rest.errors.InvalidPasswordException; +import io.github.jhipster.security.PersistentTokenCache; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.http.ResponseEntity; +import org.springframework.security.oauth2.common.OAuth2AccessToken; +import org.springframework.web.client.HttpClientErrorException; + +import javax.servlet.http.Cookie; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.util.Map; + +/** + * Manages authentication cases for OAuth2 updating the cookies holding access and refresh tokens accordingly. + *

+ * It can authenticate users, refresh the token cookies should they expire and log users out. + */ +public class OAuth2AuthenticationService { + + private final Logger log = LoggerFactory.getLogger(OAuth2AuthenticationService.class); + + /** + * Number of milliseconds to cache refresh token grants so we don't have to repeat them in case of parallel requests. + */ + private static final long REFRESH_TOKEN_VALIDITY_MILLIS = 10000l; + + /** + * Used to contact the OAuth2 token endpoint. + */ + private final OAuth2TokenEndpointClient authorizationClient; + + /** + * Helps us with cookie handling. + */ + private final OAuth2CookieHelper cookieHelper; + + /** + * Caches Refresh grant results for a refresh token value so we can reuse them. + * This avoids hammering UAA in case of several multi-threaded requests arriving in parallel. + */ + private final PersistentTokenCache recentlyRefreshed; + + public OAuth2AuthenticationService(OAuth2TokenEndpointClient authorizationClient, OAuth2CookieHelper cookieHelper) { + this.authorizationClient = authorizationClient; + this.cookieHelper = cookieHelper; + recentlyRefreshed = new PersistentTokenCache<>(REFRESH_TOKEN_VALIDITY_MILLIS); + } + + /** + * Authenticate the user by username and password. + * + * @param request the request coming from the client. + * @param response the response going back to the server. + * @param params the params holding the username, password and rememberMe. + * @return the OAuth2AccessToken as a ResponseEntity. Will return OK (200), if successful. + * If the UAA cannot authenticate the user, the status code returned by UAA will be returned. + */ + public ResponseEntity authenticate(HttpServletRequest request, HttpServletResponse response, + Map params) { + try { + String username = params.get("username"); + String password = params.get("password"); + boolean rememberMe = Boolean.valueOf(params.get("rememberMe")); + OAuth2AccessToken accessToken = authorizationClient.sendPasswordGrant(username, password); + OAuth2Cookies cookies = new OAuth2Cookies(); + cookieHelper.createCookies(request, accessToken, rememberMe, cookies); + cookies.addCookiesTo(response); + if (log.isDebugEnabled()) { + log.debug("successfully authenticated user {}", params.get("username")); + } + return ResponseEntity.ok(accessToken); + } catch (HttpClientErrorException ex) { + log.error("failed to get OAuth2 tokens from UAA", ex); + throw new InvalidPasswordException(); + } + } + + /** + * Try to refresh the access token using the refresh token provided as cookie. + * Note that browsers typically send multiple requests in parallel which means the access token + * will be expired on multiple threads. We don't want to send multiple requests to UAA though, + * so we need to cache results for a certain duration and synchronize threads to avoid sending + * multiple requests in parallel. + * + * @param request the request potentially holding the refresh token. + * @param response the response setting the new cookies (if refresh was successful). + * @param refreshCookie the refresh token cookie. Must not be null. + * @return the new servlet request containing the updated cookies for relaying downstream. + */ + public HttpServletRequest refreshToken(HttpServletRequest request, HttpServletResponse response, Cookie + refreshCookie) { + //check if non-remember-me session has expired + if (cookieHelper.isSessionExpired(refreshCookie)) { + log.info("session has expired due to inactivity"); + logout(request, response); //logout to clear cookies in browser + return stripTokens(request); //don't include cookies downstream + } + OAuth2Cookies cookies = getCachedCookies(refreshCookie.getValue()); + synchronized (cookies) { + //check if we have a result from another thread already + if (cookies.getAccessTokenCookie() == null) { //no, we are first! + //send a refresh_token grant to UAA, getting new tokens + String refreshCookieValue = OAuth2CookieHelper.getRefreshTokenValue(refreshCookie); + OAuth2AccessToken accessToken = authorizationClient.sendRefreshGrant(refreshCookieValue); + boolean rememberMe = OAuth2CookieHelper.isRememberMe(refreshCookie); + cookieHelper.createCookies(request, accessToken, rememberMe, cookies); + //add cookies to response to update browser + cookies.addCookiesTo(response); + } else { + log.debug("reusing cached refresh_token grant"); + } + //replace cookies in original request with new ones + CookieCollection requestCookies = new CookieCollection(request.getCookies()); + requestCookies.add(cookies.getAccessTokenCookie()); + requestCookies.add(cookies.getRefreshTokenCookie()); + return new CookiesHttpServletRequestWrapper(request, requestCookies.toArray()); + } + } + + /** + * Get the result from the cache in a thread-safe manner. + * + * @param refreshTokenValue the refresh token for which we want the results. + * @return a RefreshGrantResult for that token. This will either be empty, if we are the first one to do the + * request, + * or contain some results already, if another thread already handled the grant for us. + */ + private OAuth2Cookies getCachedCookies(String refreshTokenValue) { + synchronized (recentlyRefreshed) { + OAuth2Cookies ctx = recentlyRefreshed.get(refreshTokenValue); + if (ctx == null) { + ctx = new OAuth2Cookies(); + recentlyRefreshed.put(refreshTokenValue, ctx); + } + return ctx; + } + } + + /** + * Logs the user out by clearing all cookies. + * + * @param httpServletRequest the request containing the Cookies. + * @param httpServletResponse the response used to clear them. + */ + public void logout(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) { + cookieHelper.clearCookies(httpServletRequest, httpServletResponse); + } + + /** + * Strips token cookies preventing them from being used further down the chain. + * For example, the OAuth2 client won't checked them and they won't be relayed to other services. + * + * @param httpServletRequest the incoming request. + * @return the request to replace it with which has the tokens stripped. + */ + public HttpServletRequest stripTokens(HttpServletRequest httpServletRequest) { + Cookie[] cookies = cookieHelper.stripCookies(httpServletRequest.getCookies()); + return new CookiesHttpServletRequestWrapper(httpServletRequest, cookies); + } +} diff --git a/jhipster/jhipster-uaa/gateway/src/main/java/com/baeldung/jhipster/gateway/security/oauth2/OAuth2CookieHelper.java b/jhipster/jhipster-uaa/gateway/src/main/java/com/baeldung/jhipster/gateway/security/oauth2/OAuth2CookieHelper.java new file mode 100644 index 0000000000..7250fbd219 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/java/com/baeldung/jhipster/gateway/security/oauth2/OAuth2CookieHelper.java @@ -0,0 +1,334 @@ +package com.baeldung.jhipster.gateway.security.oauth2; + +import com.baeldung.jhipster.gateway.config.oauth2.OAuth2Properties; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.boot.json.JsonParser; +import org.springframework.boot.json.JsonParserFactory; +import org.springframework.security.jwt.Jwt; +import org.springframework.security.jwt.JwtHelper; +import org.springframework.security.oauth2.common.OAuth2AccessToken; +import org.springframework.security.oauth2.common.OAuth2RefreshToken; +import org.springframework.security.oauth2.common.exceptions.InvalidTokenException; +import org.springframework.security.oauth2.provider.token.AccessTokenConverter; +import org.springframework.util.StringUtils; + +import javax.servlet.http.Cookie; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.util.Arrays; +import java.util.List; +import java.util.Map; + +import static org.apache.http.conn.util.InetAddressUtils.isIPv4Address; +import static org.apache.http.conn.util.InetAddressUtils.isIPv6Address; +import org.apache.http.conn.util.PublicSuffixMatcher; +import org.apache.http.conn.util.PublicSuffixMatcherLoader; + +/** + * Helps with OAuth2 cookie handling. + */ +public class OAuth2CookieHelper { + /** + * Name of the access token cookie. + */ + public static final String ACCESS_TOKEN_COOKIE = OAuth2AccessToken.ACCESS_TOKEN; + /** + * Name of the refresh token cookie in case of remember me. + */ + public static final String REFRESH_TOKEN_COOKIE = OAuth2AccessToken.REFRESH_TOKEN; + /** + * Name of the session-only refresh token in case the user did not check remember me. + */ + public static final String SESSION_TOKEN_COOKIE = "session_token"; + /** + * The names of the Cookies we set. + */ + private static final List COOKIE_NAMES = Arrays.asList(ACCESS_TOKEN_COOKIE, REFRESH_TOKEN_COOKIE, + SESSION_TOKEN_COOKIE); + /** + * Number of seconds to expire refresh token cookies before the enclosed token expires. + * This makes sure we don't run into race conditions where the cookie is still there but + * expires while we process it. + */ + private static final long REFRESH_TOKEN_EXPIRATION_WINDOW_SECS = 3L; + + /** + * Public suffix matcher (to strip private subdomains off cookie scope). + */ + PublicSuffixMatcher suffixMatcher; + + private final Logger log = LoggerFactory.getLogger(OAuth2CookieHelper.class); + + private OAuth2Properties oAuth2Properties; + + /** + * Used to parse JWT claims. + */ + private JsonParser jsonParser = JsonParserFactory.getJsonParser(); + + public OAuth2CookieHelper(OAuth2Properties oAuth2Properties) { + this.oAuth2Properties = oAuth2Properties; + + // Alternatively, always get an up-to-date list by passing an URL + this.suffixMatcher = PublicSuffixMatcherLoader.getDefault(); + } + + public static Cookie getAccessTokenCookie(HttpServletRequest request) { + return getCookie(request, ACCESS_TOKEN_COOKIE); + } + + public static Cookie getRefreshTokenCookie(HttpServletRequest request) { + Cookie cookie = getCookie(request, REFRESH_TOKEN_COOKIE); + if (cookie == null) { + cookie = getCookie(request, SESSION_TOKEN_COOKIE); + } + return cookie; + } + + + /** + * Get a cookie by name from the given servlet request. + * + * @param request the request containing the cookie. + * @param cookieName the case-sensitive name of the cookie to get. + * @return the resulting Cookie; or null, if not found. + */ + private static Cookie getCookie(HttpServletRequest request, String cookieName) { + if (request.getCookies() != null) { + for (Cookie cookie : request.getCookies()) { + if (cookie.getName().equals(cookieName)) { + String value = cookie.getValue(); + if (StringUtils.hasText(value)) { + return cookie; + } + } + } + } + return null; + } + + /** + * Create cookies using the provided values. + * + * @param request the request we are handling. + * @param accessToken the access token and enclosed refresh token for our cookies. + * @param rememberMe whether the user had originally checked "remember me". + * @param result will get the resulting cookies set. + */ + public void createCookies(HttpServletRequest request, OAuth2AccessToken accessToken, boolean rememberMe, + OAuth2Cookies result) { + String domain = getCookieDomain(request); + log.debug("creating cookies for domain {}", domain); + Cookie accessTokenCookie = new Cookie(ACCESS_TOKEN_COOKIE, accessToken.getValue()); + setCookieProperties(accessTokenCookie, request.isSecure(), domain); + log.debug("created access token cookie '{}'", accessTokenCookie.getName()); + + OAuth2RefreshToken refreshToken = accessToken.getRefreshToken(); + Cookie refreshTokenCookie = createRefreshTokenCookie(refreshToken, rememberMe); + setCookieProperties(refreshTokenCookie, request.isSecure(), domain); + log.debug("created refresh token cookie '{}', age: {}", refreshTokenCookie.getName(), refreshTokenCookie + .getMaxAge()); + + result.setCookies(accessTokenCookie, refreshTokenCookie); + } + + /** + * Create a cookie out of the given refresh token. + * Refresh token cookies contain the base64 encoded refresh token (a JWT token). + * They also contain a hint whether the refresh token was for remember me or not. + * If not, then the cookie will be prefixed by the timestamp it was created at followed by a pipe '|'. + * This gives us the chance to expire session cookies regardless of the token duration. + */ + private Cookie createRefreshTokenCookie(OAuth2RefreshToken refreshToken, boolean rememberMe) { + int maxAge = -1; + String name = SESSION_TOKEN_COOKIE; + String value = refreshToken.getValue(); + if (rememberMe) { + name = REFRESH_TOKEN_COOKIE; + //get expiration in seconds from the token's "exp" claim + Integer exp = getClaim(refreshToken.getValue(), AccessTokenConverter.EXP, Integer.class); + if (exp != null) { + int now = (int) (System.currentTimeMillis() / 1000L); + maxAge = exp - now; + log.debug("refresh token valid for another {} secs", maxAge); + //let cookie expire a bit earlier than the token to avoid race conditions + maxAge -= REFRESH_TOKEN_EXPIRATION_WINDOW_SECS; + } + } + Cookie refreshTokenCookie = new Cookie(name, value); + refreshTokenCookie.setMaxAge(maxAge); + return refreshTokenCookie; + } + + /** + * Returns true if the refresh token cookie was set with remember me checked. + * We can recognize this by the name of the cookie. + * + * @param refreshTokenCookie the cookie holding the refresh token. + * @return true, if it was set persistently (i.e. for "remember me"). + */ + public static boolean isRememberMe(Cookie refreshTokenCookie) { + return refreshTokenCookie.getName().equals(REFRESH_TOKEN_COOKIE); + } + + /** + * Extracts the refresh token from the refresh token cookie. + * Since we encode additional information into the cookie, this needs to be called to get + * hold of the enclosed JWT. + * + * @param refreshCookie the cookie we store the value in. + * @return the refresh JWT from the cookie. + */ + public static String getRefreshTokenValue(Cookie refreshCookie) { + String value = refreshCookie.getValue(); + int i = value.indexOf('|'); + if (i > 0) { + return value.substring(i + 1); + } + return value; + } + + /** + * Checks if the refresh token session has expired. + * Only makes sense for non-persistent cookies, i.e. when remember me was not checked. + * The motivation for this is that we want to throw out a user after a while if he's inactive. + * We cannot do this via refresh token validity because that one is also used for remember me. + * + * @param refreshCookie the refresh token cookie to check. + * @return true, if the session is expired. + */ + public boolean isSessionExpired(Cookie refreshCookie) { + if (isRememberMe(refreshCookie)) { //no session expiration for "remember me" + return false; + } + //read non-remember-me session length in secs + int validity = oAuth2Properties.getWebClientConfiguration().getSessionTimeoutInSeconds(); + if (validity < 0) { //no session expiration configured + return false; + } + Integer iat = getClaim(refreshCookie.getValue(), "iat", Integer.class); + if (iat == null) { //token creating timestamp in secs is missing, session does not expire + return false; + } + int now = (int) (System.currentTimeMillis() / 1000L); + int sessionDuration = now - iat; + log.debug("session duration {} secs, will timeout at {}", sessionDuration, validity); + return sessionDuration > validity; //session has expired + } + + /** + * Retrieve the given claim from the given token. + * + * @param refreshToken the JWT token to examine. + * @param claimName name of the claim to get. + * @param clazz the Class we expect to find there. + * @return the desired claim. + * @throws InvalidTokenException if we cannot find the claim in the token or it is of wrong type. + */ + @SuppressWarnings("unchecked") + private T getClaim(String refreshToken, String claimName, Class clazz) { + Jwt jwt = JwtHelper.decode(refreshToken); + String claims = jwt.getClaims(); + Map claimsMap = jsonParser.parseMap(claims); + Object claimValue = claimsMap.get(claimName); + if (claimValue == null) { + return null; + } + if (!clazz.isAssignableFrom(claimValue.getClass())) { + throw new InvalidTokenException("claim is not of expected type: " + claimName); + } + return (T) claimValue; + } + + /** + * Set cookie properties of access and refresh tokens. + * + * @param cookie the cookie to modify. + * @param isSecure whether it is coming from a secure request. + * @param domain the domain for which the cookie is valid. If null, then will fall back to default. + */ + private void setCookieProperties(Cookie cookie, boolean isSecure, String domain) { + cookie.setHttpOnly(true); + cookie.setPath("/"); + cookie.setSecure(isSecure); //if the request comes per HTTPS set the secure option on the cookie + if (domain != null) { + cookie.setDomain(domain); + } + } + + /** + * Logs the user out by clearing all cookies. + * + * @param httpServletRequest the request containing the Cookies. + * @param httpServletResponse the response used to clear them. + */ + public void clearCookies(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) { + String domain = getCookieDomain(httpServletRequest); + for (String cookieName : COOKIE_NAMES) { + clearCookie(httpServletRequest, httpServletResponse, domain, cookieName); + } + } + + private void clearCookie(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, + String domain, String cookieName) { + Cookie cookie = new Cookie(cookieName, ""); + setCookieProperties(cookie, httpServletRequest.isSecure(), domain); + cookie.setMaxAge(0); + httpServletResponse.addCookie(cookie); + log.debug("clearing cookie {}", cookie.getName()); + } + + /** + * Returns the top level domain of the server from the request. This is used to limit the Cookie + * to the top domain instead of the full domain name. + *

+ * A lot of times, individual gateways of the same domain get their own subdomain but authentication + * shall work across all subdomains of the top level domain. + *

+ * For example, when sending a request to app1.domain.com, + * this returns .domain.com. + * + * @param request the HTTP request we received from the client. + * @return the top level domain to set the cookies for. + * Returns null if the domain is not under a public suffix (.com, .co.uk), e.g. for localhost. + */ + private String getCookieDomain(HttpServletRequest request) { + String domain = oAuth2Properties.getWebClientConfiguration().getCookieDomain(); + if (domain != null) { + return domain; + } + // if not explicitly defined, use top-level domain + domain = request.getServerName().toLowerCase(); + // strip off leading www. + if (domain.startsWith("www.")) { + domain = domain.substring(4); + } + // if it isn't an IP address + if (!isIPv4Address(domain) && !isIPv6Address(domain)) { + // strip off private subdomains, leaving public TLD only + String suffix = suffixMatcher.getDomainRoot(domain); + if (suffix != null && !suffix.equals(domain)) { + // preserve leading dot + return "." + suffix; + } + } + // no top-level domain, stick with default domain + return null; + } + + /** + * Strip our token cookies from the array. + * + * @param cookies the cookies we receive as input. + * @return the new cookie array without our tokens. + */ + Cookie[] stripCookies(Cookie[] cookies) { + CookieCollection cc = new CookieCollection(cookies); + if (cc.removeAll(COOKIE_NAMES)) { + return cc.toArray(); + } + return cookies; + } +} diff --git a/jhipster/jhipster-uaa/gateway/src/main/java/com/baeldung/jhipster/gateway/security/oauth2/OAuth2Cookies.java b/jhipster/jhipster-uaa/gateway/src/main/java/com/baeldung/jhipster/gateway/security/oauth2/OAuth2Cookies.java new file mode 100644 index 0000000000..5dfc898b24 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/java/com/baeldung/jhipster/gateway/security/oauth2/OAuth2Cookies.java @@ -0,0 +1,35 @@ +package com.baeldung.jhipster.gateway.security.oauth2; + +import javax.servlet.http.Cookie; +import javax.servlet.http.HttpServletResponse; + +/** + * Holds the access token and refresh token cookies. + */ +class OAuth2Cookies { + private Cookie accessTokenCookie; + private Cookie refreshTokenCookie; + + public Cookie getAccessTokenCookie() { + return accessTokenCookie; + } + + public Cookie getRefreshTokenCookie() { + return refreshTokenCookie; + } + + public void setCookies(Cookie accessTokenCookie, Cookie refreshTokenCookie) { + this.accessTokenCookie = accessTokenCookie; + this.refreshTokenCookie = refreshTokenCookie; + } + + /** + * Add the access token and refresh token as cookies to the response after successful authentication. + * + * @param response the response to add them to. + */ + void addCookiesTo(HttpServletResponse response) { + response.addCookie(getAccessTokenCookie()); + response.addCookie(getRefreshTokenCookie()); + } +} diff --git a/jhipster/jhipster-uaa/gateway/src/main/java/com/baeldung/jhipster/gateway/security/oauth2/OAuth2SignatureVerifierClient.java b/jhipster/jhipster-uaa/gateway/src/main/java/com/baeldung/jhipster/gateway/security/oauth2/OAuth2SignatureVerifierClient.java new file mode 100644 index 0000000000..5c07b38b8a --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/java/com/baeldung/jhipster/gateway/security/oauth2/OAuth2SignatureVerifierClient.java @@ -0,0 +1,23 @@ +package com.baeldung.jhipster.gateway.security.oauth2; + +import org.springframework.security.jwt.crypto.sign.SignatureVerifier; + +/** + * Abstracts how to create a SignatureVerifier to verify JWT tokens with a public key. + * Implementations will have to contact the OAuth2 authorization server to fetch the public key + * and use it to build a SignatureVerifier in a server specific way. + * + * @see UaaSignatureVerifierClient + */ +public interface OAuth2SignatureVerifierClient { + /** + * Returns the SignatureVerifier used to verify JWT tokens. + * Fetches the public key from the Authorization server to create + * this verifier. + * + * @return the new verifier used to verify JWT signatures. + * Will be null if we cannot contact the token endpoint. + * @throws Exception if we could not create a SignatureVerifier or contact the token endpoint. + */ + SignatureVerifier getSignatureVerifier() throws Exception; +} diff --git a/jhipster/jhipster-uaa/gateway/src/main/java/com/baeldung/jhipster/gateway/security/oauth2/OAuth2TokenEndpointClient.java b/jhipster/jhipster-uaa/gateway/src/main/java/com/baeldung/jhipster/gateway/security/oauth2/OAuth2TokenEndpointClient.java new file mode 100644 index 0000000000..9a68d4e93f --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/java/com/baeldung/jhipster/gateway/security/oauth2/OAuth2TokenEndpointClient.java @@ -0,0 +1,32 @@ +package com.baeldung.jhipster.gateway.security.oauth2; + +import org.springframework.security.oauth2.common.OAuth2AccessToken; + +/** + * Client talking to an OAuth2 Authorization server token endpoint. + * + * @see UaaTokenEndpointClient + * @see OAuth2TokenEndpointClientAdapter + */ +public interface OAuth2TokenEndpointClient { + /** + * Send a password grant to the token endpoint. + * + * @param username the username to authenticate. + * @param password his password. + * @return the access token and enclosed refresh token received from the token endpoint. + * @throws org.springframework.security.oauth2.common.exceptions.ClientAuthenticationException + * if we cannot contact the token endpoint. + */ + OAuth2AccessToken sendPasswordGrant(String username, String password); + + /** + * Send a refresh_token grant to the token endpoint. + * + * @param refreshTokenValue the refresh token used to get new tokens. + * @return the new access/refresh token pair. + * @throws org.springframework.security.oauth2.common.exceptions.ClientAuthenticationException + * if we cannot contact the token endpoint. + */ + OAuth2AccessToken sendRefreshGrant(String refreshTokenValue); +} diff --git a/jhipster/jhipster-uaa/gateway/src/main/java/com/baeldung/jhipster/gateway/security/oauth2/OAuth2TokenEndpointClientAdapter.java b/jhipster/jhipster-uaa/gateway/src/main/java/com/baeldung/jhipster/gateway/security/oauth2/OAuth2TokenEndpointClientAdapter.java new file mode 100644 index 0000000000..5506ce895c --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/java/com/baeldung/jhipster/gateway/security/oauth2/OAuth2TokenEndpointClientAdapter.java @@ -0,0 +1,120 @@ +package com.baeldung.jhipster.gateway.security.oauth2; + +import com.baeldung.jhipster.gateway.config.oauth2.OAuth2Properties; +import io.github.jhipster.config.JHipsterProperties; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +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.security.oauth2.common.OAuth2AccessToken; +import org.springframework.security.oauth2.common.exceptions.InvalidClientException; +import org.springframework.util.LinkedMultiValueMap; +import org.springframework.util.MultiValueMap; +import org.springframework.web.client.HttpClientErrorException; +import org.springframework.web.client.RestTemplate; + +/** + * Default base class for an OAuth2TokenEndpointClient. + * Individual implementations for a particular OAuth2 provider can use this as a starting point. + */ +public abstract class OAuth2TokenEndpointClientAdapter implements OAuth2TokenEndpointClient { + private final Logger log = LoggerFactory.getLogger(OAuth2TokenEndpointClientAdapter.class); + protected final RestTemplate restTemplate; + protected final JHipsterProperties jHipsterProperties; + protected final OAuth2Properties oAuth2Properties; + + public OAuth2TokenEndpointClientAdapter(RestTemplate restTemplate, JHipsterProperties jHipsterProperties, OAuth2Properties oAuth2Properties) { + this.restTemplate = restTemplate; + this.jHipsterProperties = jHipsterProperties; + this.oAuth2Properties = oAuth2Properties; + } + + /** + * Sends a password grant to the token endpoint. + * + * @param username the username to authenticate. + * @param password his password. + * @return the access token. + */ + @Override + public OAuth2AccessToken sendPasswordGrant(String username, String password) { + HttpHeaders reqHeaders = new HttpHeaders(); + reqHeaders.setContentType(MediaType.APPLICATION_FORM_URLENCODED); + MultiValueMap formParams = new LinkedMultiValueMap<>(); + formParams.set("username", username); + formParams.set("password", password); + formParams.set("grant_type", "password"); + addAuthentication(reqHeaders, formParams); + HttpEntity> entity = new HttpEntity<>(formParams, reqHeaders); + log.debug("contacting OAuth2 token endpoint to login user: {}", username); + ResponseEntity + responseEntity = restTemplate.postForEntity(getTokenEndpoint(), entity, OAuth2AccessToken.class); + if (responseEntity.getStatusCode() != HttpStatus.OK) { + log.debug("failed to authenticate user with OAuth2 token endpoint, status: {}", responseEntity.getStatusCodeValue()); + throw new HttpClientErrorException(responseEntity.getStatusCode()); + } + OAuth2AccessToken accessToken = responseEntity.getBody(); + return accessToken; + } + + /** + * Sends a refresh grant to the token endpoint using the current refresh token to obtain new tokens. + * + * @param refreshTokenValue the refresh token to use to obtain new tokens. + * @return the new, refreshed access token. + */ + @Override + public OAuth2AccessToken sendRefreshGrant(String refreshTokenValue) { + MultiValueMap params = new LinkedMultiValueMap<>(); + params.add("grant_type", "refresh_token"); + params.add("refresh_token", refreshTokenValue); + HttpHeaders headers = new HttpHeaders(); + addAuthentication(headers, params); + HttpEntity> entity = new HttpEntity<>(params, headers); + log.debug("contacting OAuth2 token endpoint to refresh OAuth2 JWT tokens"); + ResponseEntity responseEntity = restTemplate.postForEntity(getTokenEndpoint(), entity, + OAuth2AccessToken.class); + if (responseEntity.getStatusCode() != HttpStatus.OK) { + log.debug("failed to refresh tokens: {}", responseEntity.getStatusCodeValue()); + throw new HttpClientErrorException(responseEntity.getStatusCode()); + } + OAuth2AccessToken accessToken = responseEntity.getBody(); + log.info("refreshed OAuth2 JWT cookies using refresh_token grant"); + return accessToken; + } + + protected abstract void addAuthentication(HttpHeaders reqHeaders, MultiValueMap formParams); + + protected String getClientSecret() { + String clientSecret = oAuth2Properties.getWebClientConfiguration().getSecret(); + if (clientSecret == null) { + throw new InvalidClientException("no client-secret configured in application properties"); + } + return clientSecret; + } + + protected String getClientId() { + String clientId = oAuth2Properties.getWebClientConfiguration().getClientId(); + if (clientId == null) { + throw new InvalidClientException("no client-id configured in application properties"); + } + return clientId; + } + + /** + * Returns the configured OAuth2 token endpoint URI. + * + * @return the OAuth2 token endpoint URI. + */ + protected String getTokenEndpoint() { + String tokenEndpointUrl = jHipsterProperties.getSecurity().getClientAuthorization().getAccessTokenUri(); + if (tokenEndpointUrl == null) { + throw new InvalidClientException("no token endpoint configured in application properties"); + } + return tokenEndpointUrl; + } + +} diff --git a/jhipster/jhipster-uaa/gateway/src/main/java/com/baeldung/jhipster/gateway/security/oauth2/UaaSignatureVerifierClient.java b/jhipster/jhipster-uaa/gateway/src/main/java/com/baeldung/jhipster/gateway/security/oauth2/UaaSignatureVerifierClient.java new file mode 100644 index 0000000000..1a4ff10852 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/java/com/baeldung/jhipster/gateway/security/oauth2/UaaSignatureVerifierClient.java @@ -0,0 +1,63 @@ +package com.baeldung.jhipster.gateway.security.oauth2; + +import com.baeldung.jhipster.gateway.config.oauth2.OAuth2Properties; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.cloud.client.discovery.DiscoveryClient; +import org.springframework.http.HttpEntity; +import org.springframework.http.HttpHeaders; +import org.springframework.http.HttpMethod; +import org.springframework.security.jwt.crypto.sign.RsaVerifier; +import org.springframework.security.jwt.crypto.sign.SignatureVerifier; +import org.springframework.security.oauth2.common.exceptions.InvalidClientException; +import org.springframework.stereotype.Component; +import org.springframework.web.client.RestTemplate; + +import java.util.Map; + +/** + * Client fetching the public key from UAA to create a SignatureVerifier. + */ +@Component +public class UaaSignatureVerifierClient implements OAuth2SignatureVerifierClient { + private final Logger log = LoggerFactory.getLogger(UaaSignatureVerifierClient.class); + private final RestTemplate restTemplate; + protected final OAuth2Properties oAuth2Properties; + + public UaaSignatureVerifierClient(DiscoveryClient discoveryClient, @Qualifier("loadBalancedRestTemplate") RestTemplate restTemplate, + OAuth2Properties oAuth2Properties) { + this.restTemplate = restTemplate; + this.oAuth2Properties = oAuth2Properties; + // Load available UAA servers + discoveryClient.getServices(); + } + + /** + * Fetches the public key from the UAA. + * + * @return the public key used to verify JWT tokens; or null. + */ + @Override + public SignatureVerifier getSignatureVerifier() throws Exception { + try { + HttpEntity request = new HttpEntity(new HttpHeaders()); + String key = (String) restTemplate + .exchange(getPublicKeyEndpoint(), HttpMethod.GET, request, Map.class).getBody() + .get("value"); + return new RsaVerifier(key); + } catch (IllegalStateException ex) { + log.warn("could not contact UAA to get public key"); + return null; + } + } + + /** Returns the configured endpoint URI to retrieve the public key. */ + private String getPublicKeyEndpoint() { + String tokenEndpointUrl = oAuth2Properties.getSignatureVerification().getPublicKeyEndpointUri(); + if (tokenEndpointUrl == null) { + throw new InvalidClientException("no token endpoint configured in application properties"); + } + return tokenEndpointUrl; + } +} diff --git a/jhipster/jhipster-uaa/gateway/src/main/java/com/baeldung/jhipster/gateway/security/oauth2/UaaTokenEndpointClient.java b/jhipster/jhipster-uaa/gateway/src/main/java/com/baeldung/jhipster/gateway/security/oauth2/UaaTokenEndpointClient.java new file mode 100644 index 0000000000..01c8febdb2 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/java/com/baeldung/jhipster/gateway/security/oauth2/UaaTokenEndpointClient.java @@ -0,0 +1,40 @@ +package com.baeldung.jhipster.gateway.security.oauth2; + +import com.baeldung.jhipster.gateway.config.oauth2.OAuth2Properties; +import io.github.jhipster.config.JHipsterProperties; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.http.HttpHeaders; +import org.springframework.stereotype.Component; +import org.springframework.util.Base64Utils; +import org.springframework.util.MultiValueMap; +import org.springframework.web.client.RestTemplate; + +import java.nio.charset.StandardCharsets; + +/** + * Client talking to UAA's token endpoint to do different OAuth2 grants. + */ +@Component +public class UaaTokenEndpointClient extends OAuth2TokenEndpointClientAdapter implements OAuth2TokenEndpointClient { + + public UaaTokenEndpointClient(@Qualifier("loadBalancedRestTemplate") RestTemplate restTemplate, + JHipsterProperties jHipsterProperties, OAuth2Properties oAuth2Properties) { + super(restTemplate, jHipsterProperties, oAuth2Properties); + } + + @Override + protected void addAuthentication(HttpHeaders reqHeaders, MultiValueMap formParams) { + reqHeaders.add("Authorization", getAuthorizationHeader()); + } + + /** + * @return a Basic authorization header to be used to talk to UAA. + */ + protected String getAuthorizationHeader() { + String clientId = getClientId(); + String clientSecret = getClientSecret(); + String authorization = clientId + ":" + clientSecret; + return "Basic " + Base64Utils.encodeToString(authorization.getBytes(StandardCharsets.UTF_8)); + } + +} diff --git a/jhipster/jhipster-uaa/gateway/src/main/java/com/baeldung/jhipster/gateway/security/package-info.java b/jhipster/jhipster-uaa/gateway/src/main/java/com/baeldung/jhipster/gateway/security/package-info.java new file mode 100644 index 0000000000..ae119e4f05 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/java/com/baeldung/jhipster/gateway/security/package-info.java @@ -0,0 +1,4 @@ +/** + * Spring Security configuration. + */ +package com.baeldung.jhipster.gateway.security; diff --git a/jhipster/jhipster-uaa/gateway/src/main/java/com/baeldung/jhipster/gateway/service/package-info.java b/jhipster/jhipster-uaa/gateway/src/main/java/com/baeldung/jhipster/gateway/service/package-info.java new file mode 100644 index 0000000000..14fd609c71 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/java/com/baeldung/jhipster/gateway/service/package-info.java @@ -0,0 +1,4 @@ +/** + * Service layer beans. + */ +package com.baeldung.jhipster.gateway.service; diff --git a/jhipster/jhipster-uaa/gateway/src/main/java/com/baeldung/jhipster/gateway/web/filter/RefreshTokenFilter.java b/jhipster/jhipster-uaa/gateway/src/main/java/com/baeldung/jhipster/gateway/web/filter/RefreshTokenFilter.java new file mode 100644 index 0000000000..07ba790047 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/java/com/baeldung/jhipster/gateway/web/filter/RefreshTokenFilter.java @@ -0,0 +1,118 @@ +package com.baeldung.jhipster.gateway.web.filter; + +import com.baeldung.jhipster.gateway.security.oauth2.OAuth2AuthenticationService; +import com.baeldung.jhipster.gateway.security.oauth2.OAuth2CookieHelper; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.security.oauth2.common.OAuth2AccessToken; +import org.springframework.security.oauth2.common.exceptions.ClientAuthenticationException; +import org.springframework.security.oauth2.common.exceptions.InvalidTokenException; +import org.springframework.security.oauth2.common.exceptions.UnauthorizedClientException; +import org.springframework.security.oauth2.provider.token.TokenStore; +import org.springframework.web.client.HttpClientErrorException; +import org.springframework.web.filter.GenericFilterBean; + +import javax.servlet.FilterChain; +import javax.servlet.ServletException; +import javax.servlet.ServletRequest; +import javax.servlet.ServletResponse; +import javax.servlet.http.Cookie; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; + +/** + * Filters incoming requests and refreshes the access token before it expires. + */ +public class RefreshTokenFilter extends GenericFilterBean { + /** + * Number of seconds before expiry to start refreshing access tokens so we don't run into race conditions when forwarding + * requests downstream. Otherwise, access tokens may still be valid when we check here but may then be expired + * when relayed to another microservice a wee bit later. + */ + private static final int REFRESH_WINDOW_SECS = 30; + + private final Logger log = LoggerFactory.getLogger(RefreshTokenFilter.class); + + /** + * The OAuth2AuthenticationService is doing the actual work. We are just a simple filter after all. + */ + private final OAuth2AuthenticationService authenticationService; + private final TokenStore tokenStore; + + public RefreshTokenFilter(OAuth2AuthenticationService authenticationService, TokenStore tokenStore) { + this.authenticationService = authenticationService; + this.tokenStore = tokenStore; + } + + /** + * Check access token cookie and refresh it, if it is either not present, expired or about to expire. + */ + @Override + public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) + throws IOException, ServletException { + HttpServletRequest httpServletRequest = (HttpServletRequest) servletRequest; + HttpServletResponse httpServletResponse = (HttpServletResponse) servletResponse; + try { + httpServletRequest = refreshTokensIfExpiring(httpServletRequest, httpServletResponse); + } catch (ClientAuthenticationException ex) { + log.warn("Security exception: could not refresh tokens", ex); + httpServletRequest = authenticationService.stripTokens(httpServletRequest); + } + filterChain.doFilter(httpServletRequest, servletResponse); + } + + /** + * Refresh the access and refresh tokens if they are about to expire. + * + * @param httpServletRequest the servlet request holding the current cookies. If no refresh cookie is present, + * then we are out of luck. + * @param httpServletResponse the servlet response that gets the new set-cookie headers, if they had to be + * refreshed. + * @return a new request to use downstream that contains the new cookies, if they had to be refreshed. + * @throws InvalidTokenException if the tokens could not be refreshed. + */ + public HttpServletRequest refreshTokensIfExpiring(HttpServletRequest httpServletRequest, HttpServletResponse + httpServletResponse) { + HttpServletRequest newHttpServletRequest = httpServletRequest; + //get access token from cookie + Cookie accessTokenCookie = OAuth2CookieHelper.getAccessTokenCookie(httpServletRequest); + if (mustRefreshToken(accessTokenCookie)) { //we either have no access token, or it is expired, or it is about to expire + //get the refresh token cookie and, if present, request new tokens + Cookie refreshCookie = OAuth2CookieHelper.getRefreshTokenCookie(httpServletRequest); + if (refreshCookie != null) { + try { + newHttpServletRequest = authenticationService.refreshToken(httpServletRequest, httpServletResponse, refreshCookie); + } catch (HttpClientErrorException ex) { + throw new UnauthorizedClientException("could not refresh OAuth2 token", ex); + } + } else if (accessTokenCookie != null) { + log.warn("access token found, but no refresh token, stripping them all"); + OAuth2AccessToken token = tokenStore.readAccessToken(accessTokenCookie.getValue()); + if (token.isExpired()) { + throw new InvalidTokenException("access token has expired, but there's no refresh token"); + } + } + } + return newHttpServletRequest; + } + + /** + * Check if we must refresh the access token. + * We must refresh it, if we either have no access token, or it is expired, or it is about to expire. + * + * @param accessTokenCookie the current access token. + * @return true, if it must be refreshed; false, otherwise. + */ + private boolean mustRefreshToken(Cookie accessTokenCookie) { + if (accessTokenCookie == null) { + return true; + } + OAuth2AccessToken token = tokenStore.readAccessToken(accessTokenCookie.getValue()); + //check if token is expired or about to expire + if (token.isExpired() || token.getExpiresIn() < REFRESH_WINDOW_SECS) { + return true; + } + return false; //access token is still fine + } +} diff --git a/jhipster/jhipster-uaa/gateway/src/main/java/com/baeldung/jhipster/gateway/web/filter/RefreshTokenFilterConfigurer.java b/jhipster/jhipster-uaa/gateway/src/main/java/com/baeldung/jhipster/gateway/web/filter/RefreshTokenFilterConfigurer.java new file mode 100644 index 0000000000..dda1da763a --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/java/com/baeldung/jhipster/gateway/web/filter/RefreshTokenFilterConfigurer.java @@ -0,0 +1,36 @@ +package com.baeldung.jhipster.gateway.web.filter; + +import com.baeldung.jhipster.gateway.security.oauth2.OAuth2AuthenticationService; + +import org.springframework.security.config.annotation.SecurityConfigurerAdapter; +import org.springframework.security.config.annotation.web.builders.HttpSecurity; +import org.springframework.security.oauth2.provider.authentication.OAuth2AuthenticationProcessingFilter; +import org.springframework.security.oauth2.provider.token.TokenStore; +import org.springframework.security.web.DefaultSecurityFilterChain; + +/** + * Configures a RefreshTokenFilter to refresh access tokens if they are about to expire. + * + * @see RefreshTokenFilter + */ +public class RefreshTokenFilterConfigurer extends SecurityConfigurerAdapter { + /** + * RefreshTokenFilter needs the OAuth2AuthenticationService to refresh cookies using the refresh token. + */ + private OAuth2AuthenticationService authenticationService; + private final TokenStore tokenStore; + + public RefreshTokenFilterConfigurer(OAuth2AuthenticationService authenticationService, TokenStore tokenStore) { + this.authenticationService = authenticationService; + this.tokenStore = tokenStore; + } + + /** + * Install RefreshTokenFilter as a servlet Filter. + */ + @Override + public void configure(HttpSecurity http) throws Exception { + RefreshTokenFilter customFilter = new RefreshTokenFilter(authenticationService, tokenStore); + http.addFilterBefore(customFilter, OAuth2AuthenticationProcessingFilter.class); + } +} diff --git a/jhipster/jhipster-uaa/gateway/src/main/java/com/baeldung/jhipster/gateway/web/rest/AuthResource.java b/jhipster/jhipster-uaa/gateway/src/main/java/com/baeldung/jhipster/gateway/web/rest/AuthResource.java new file mode 100644 index 0000000000..0a5d89b6d8 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/java/com/baeldung/jhipster/gateway/web/rest/AuthResource.java @@ -0,0 +1,68 @@ +package com.baeldung.jhipster.gateway.web.rest; + +import com.codahale.metrics.annotation.Timed; +import com.baeldung.jhipster.gateway.security.oauth2.OAuth2AuthenticationService; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.http.MediaType; +import org.springframework.http.ResponseEntity; +import org.springframework.security.core.context.SecurityContextHolder; +import org.springframework.security.oauth2.common.OAuth2AccessToken; +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 javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.util.Map; + +/** + * Authentication endpoint for web client. + * Used to authenticate a user using OAuth2 access tokens or log him out. + * + * @author markus.oellinger + */ +@RestController +@RequestMapping("/auth") +public class AuthResource { + + private final Logger log = LoggerFactory.getLogger(AuthResource.class); + + private OAuth2AuthenticationService authenticationService; + + public AuthResource(OAuth2AuthenticationService authenticationService) { + this.authenticationService = authenticationService; + } + + /** + * Authenticates a user setting the access and refresh token cookies. + * + * @param request the HttpServletRequest holding - among others - the headers passed from the client. + * @param response the HttpServletResponse getting the cookies set upon successful authentication. + * @param params the login params (username, password, rememberMe). + * @return the access token of the authenticated user. Will return an error code if it fails to authenticate the user. + */ + @RequestMapping(value = "/login", method = RequestMethod.POST, consumes = MediaType + .APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE) + @Timed + public ResponseEntity authenticate(HttpServletRequest request, HttpServletResponse response, @RequestBody + Map params) { + return authenticationService.authenticate(request, response, params); + } + + /** + * Logout current user deleting his cookies. + * + * @param request the HttpServletRequest holding - among others - the headers passed from the client. + * @param response the HttpServletResponse getting the cookies set upon successful authentication. + * @return an empty response entity. + */ + @RequestMapping(value = "/logout", method = RequestMethod.POST) + @Timed + public ResponseEntity logout(HttpServletRequest request, HttpServletResponse response) { + log.info("logging out user {}", SecurityContextHolder.getContext().getAuthentication().getName()); + authenticationService.logout(request, response); + return ResponseEntity.noContent().build(); + } +} diff --git a/jhipster/jhipster-uaa/gateway/src/main/java/com/baeldung/jhipster/gateway/web/rest/GatewayResource.java b/jhipster/jhipster-uaa/gateway/src/main/java/com/baeldung/jhipster/gateway/web/rest/GatewayResource.java new file mode 100644 index 0000000000..13cd7d60ec --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/java/com/baeldung/jhipster/gateway/web/rest/GatewayResource.java @@ -0,0 +1,54 @@ +package com.baeldung.jhipster.gateway.web.rest; + +import com.baeldung.jhipster.gateway.web.rest.vm.RouteVM; + +import java.util.ArrayList; +import java.util.List; + +import org.springframework.cloud.client.discovery.DiscoveryClient; +import org.springframework.cloud.netflix.zuul.filters.Route; +import org.springframework.cloud.netflix.zuul.filters.RouteLocator; +import org.springframework.http.*; +import org.springframework.security.access.annotation.Secured; +import com.baeldung.jhipster.gateway.security.AuthoritiesConstants; +import org.springframework.web.bind.annotation.*; + +import com.codahale.metrics.annotation.Timed; + +/** + * REST controller for managing Gateway configuration. + */ +@RestController +@RequestMapping("/api/gateway") +public class GatewayResource { + + private final RouteLocator routeLocator; + + private final DiscoveryClient discoveryClient; + + public GatewayResource(RouteLocator routeLocator, DiscoveryClient discoveryClient) { + this.routeLocator = routeLocator; + this.discoveryClient = discoveryClient; + } + + /** + * GET /routes : get the active routes. + * + * @return the ResponseEntity with status 200 (OK) and with body the list of routes + */ + @GetMapping("/routes") + @Timed + @Secured(AuthoritiesConstants.ADMIN) + public ResponseEntity> activeRoutes() { + List routes = routeLocator.getRoutes(); + List routeVMs = new ArrayList<>(); + routes.forEach(route -> { + RouteVM routeVM = new RouteVM(); + routeVM.setPath(route.getFullPath()); + routeVM.setServiceId(route.getId()); + routeVM.setServiceInstances(discoveryClient.getInstances(route.getLocation())); + routeVMs.add(routeVM); + }); + return new ResponseEntity<>(routeVMs, HttpStatus.OK); + } +} diff --git a/jhipster/jhipster-uaa/gateway/src/main/java/com/baeldung/jhipster/gateway/web/rest/LogsResource.java b/jhipster/jhipster-uaa/gateway/src/main/java/com/baeldung/jhipster/gateway/web/rest/LogsResource.java new file mode 100644 index 0000000000..c631d57c02 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/java/com/baeldung/jhipster/gateway/web/rest/LogsResource.java @@ -0,0 +1,39 @@ +package com.baeldung.jhipster.gateway.web.rest; + +import com.baeldung.jhipster.gateway.web.rest.vm.LoggerVM; + +import ch.qos.logback.classic.Level; +import ch.qos.logback.classic.LoggerContext; +import com.codahale.metrics.annotation.Timed; +import org.slf4j.LoggerFactory; +import org.springframework.http.HttpStatus; +import org.springframework.web.bind.annotation.*; + +import java.util.List; +import java.util.stream.Collectors; + +/** + * Controller for view and managing Log Level at runtime. + */ +@RestController +@RequestMapping("/management") +public class LogsResource { + + @GetMapping("/logs") + @Timed + public List getList() { + LoggerContext context = (LoggerContext) LoggerFactory.getILoggerFactory(); + return context.getLoggerList() + .stream() + .map(LoggerVM::new) + .collect(Collectors.toList()); + } + + @PutMapping("/logs") + @ResponseStatus(HttpStatus.NO_CONTENT) + @Timed + public void changeLevel(@RequestBody LoggerVM jsonLogger) { + LoggerContext context = (LoggerContext) LoggerFactory.getILoggerFactory(); + context.getLogger(jsonLogger.getName()).setLevel(Level.valueOf(jsonLogger.getLevel())); + } +} diff --git a/jhipster/jhipster-uaa/gateway/src/main/java/com/baeldung/jhipster/gateway/web/rest/errors/BadRequestAlertException.java b/jhipster/jhipster-uaa/gateway/src/main/java/com/baeldung/jhipster/gateway/web/rest/errors/BadRequestAlertException.java new file mode 100644 index 0000000000..981b964c69 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/java/com/baeldung/jhipster/gateway/web/rest/errors/BadRequestAlertException.java @@ -0,0 +1,42 @@ +package com.baeldung.jhipster.gateway.web.rest.errors; + +import org.zalando.problem.AbstractThrowableProblem; +import org.zalando.problem.Status; + +import java.net.URI; +import java.util.HashMap; +import java.util.Map; + +public class BadRequestAlertException extends AbstractThrowableProblem { + + private static final long serialVersionUID = 1L; + + private final String entityName; + + private final String errorKey; + + public BadRequestAlertException(String defaultMessage, String entityName, String errorKey) { + this(ErrorConstants.DEFAULT_TYPE, defaultMessage, entityName, errorKey); + } + + public BadRequestAlertException(URI type, String defaultMessage, String entityName, String errorKey) { + super(type, defaultMessage, Status.BAD_REQUEST, null, null, null, getAlertParameters(entityName, errorKey)); + this.entityName = entityName; + this.errorKey = errorKey; + } + + public String getEntityName() { + return entityName; + } + + public String getErrorKey() { + return errorKey; + } + + private static Map getAlertParameters(String entityName, String errorKey) { + Map parameters = new HashMap<>(); + parameters.put("message", "error." + errorKey); + parameters.put("params", entityName); + return parameters; + } +} diff --git a/jhipster/jhipster-uaa/gateway/src/main/java/com/baeldung/jhipster/gateway/web/rest/errors/CustomParameterizedException.java b/jhipster/jhipster-uaa/gateway/src/main/java/com/baeldung/jhipster/gateway/web/rest/errors/CustomParameterizedException.java new file mode 100644 index 0000000000..640e80b911 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/java/com/baeldung/jhipster/gateway/web/rest/errors/CustomParameterizedException.java @@ -0,0 +1,54 @@ +package com.baeldung.jhipster.gateway.web.rest.errors; + +import org.zalando.problem.AbstractThrowableProblem; + +import java.util.HashMap; +import java.util.Map; + +import static org.zalando.problem.Status.BAD_REQUEST; + +/** + * Custom, parameterized exception, which can be translated on the client side. + * For example: + * + *

+ * throw new CustomParameterizedException("myCustomError", "hello", "world");
+ * 
+ * + * Can be translated with: + * + *
+ * "error.myCustomError" :  "The server says {{param0}} to {{param1}}"
+ * 
+ */ +public class CustomParameterizedException extends AbstractThrowableProblem { + + private static final long serialVersionUID = 1L; + + private static final String PARAM = "param"; + + public CustomParameterizedException(String message, String... params) { + this(message, toParamMap(params)); + } + + public CustomParameterizedException(String message, Map paramMap) { + super(ErrorConstants.PARAMETERIZED_TYPE, "Parameterized Exception", BAD_REQUEST, null, null, null, toProblemParameters(message, paramMap)); + } + + public static Map toParamMap(String... params) { + Map paramMap = new HashMap<>(); + if (params != null && params.length > 0) { + for (int i = 0; i < params.length; i++) { + paramMap.put(PARAM + i, params[i]); + } + } + return paramMap; + } + + public static Map toProblemParameters(String message, Map paramMap) { + Map parameters = new HashMap<>(); + parameters.put("message", message); + parameters.put("params", paramMap); + return parameters; + } +} diff --git a/jhipster/jhipster-uaa/gateway/src/main/java/com/baeldung/jhipster/gateway/web/rest/errors/EmailAlreadyUsedException.java b/jhipster/jhipster-uaa/gateway/src/main/java/com/baeldung/jhipster/gateway/web/rest/errors/EmailAlreadyUsedException.java new file mode 100644 index 0000000000..37df808e98 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/java/com/baeldung/jhipster/gateway/web/rest/errors/EmailAlreadyUsedException.java @@ -0,0 +1,10 @@ +package com.baeldung.jhipster.gateway.web.rest.errors; + +public class EmailAlreadyUsedException extends BadRequestAlertException { + + private static final long serialVersionUID = 1L; + + public EmailAlreadyUsedException() { + super(ErrorConstants.EMAIL_ALREADY_USED_TYPE, "Email is already in use!", "userManagement", "emailexists"); + } +} diff --git a/jhipster/jhipster-uaa/gateway/src/main/java/com/baeldung/jhipster/gateway/web/rest/errors/EmailNotFoundException.java b/jhipster/jhipster-uaa/gateway/src/main/java/com/baeldung/jhipster/gateway/web/rest/errors/EmailNotFoundException.java new file mode 100644 index 0000000000..42a3bad8bf --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/java/com/baeldung/jhipster/gateway/web/rest/errors/EmailNotFoundException.java @@ -0,0 +1,13 @@ +package com.baeldung.jhipster.gateway.web.rest.errors; + +import org.zalando.problem.AbstractThrowableProblem; +import org.zalando.problem.Status; + +public class EmailNotFoundException extends AbstractThrowableProblem { + + private static final long serialVersionUID = 1L; + + public EmailNotFoundException() { + super(ErrorConstants.EMAIL_NOT_FOUND_TYPE, "Email address not registered", Status.BAD_REQUEST); + } +} diff --git a/jhipster/jhipster-uaa/gateway/src/main/java/com/baeldung/jhipster/gateway/web/rest/errors/ErrorConstants.java b/jhipster/jhipster-uaa/gateway/src/main/java/com/baeldung/jhipster/gateway/web/rest/errors/ErrorConstants.java new file mode 100644 index 0000000000..15c9755956 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/java/com/baeldung/jhipster/gateway/web/rest/errors/ErrorConstants.java @@ -0,0 +1,21 @@ +package com.baeldung.jhipster.gateway.web.rest.errors; + +import java.net.URI; + +public final class ErrorConstants { + + public static final String ERR_CONCURRENCY_FAILURE = "error.concurrencyFailure"; + public static final String ERR_VALIDATION = "error.validation"; + public static final String PROBLEM_BASE_URL = "https://www.jhipster.tech/problem"; + public static final URI DEFAULT_TYPE = URI.create(PROBLEM_BASE_URL + "/problem-with-message"); + public static final URI CONSTRAINT_VIOLATION_TYPE = URI.create(PROBLEM_BASE_URL + "/constraint-violation"); + public static final URI PARAMETERIZED_TYPE = URI.create(PROBLEM_BASE_URL + "/parameterized"); + public static final URI ENTITY_NOT_FOUND_TYPE = URI.create(PROBLEM_BASE_URL + "/entity-not-found"); + public static final URI INVALID_PASSWORD_TYPE = URI.create(PROBLEM_BASE_URL + "/invalid-password"); + public static final URI EMAIL_ALREADY_USED_TYPE = URI.create(PROBLEM_BASE_URL + "/email-already-used"); + public static final URI LOGIN_ALREADY_USED_TYPE = URI.create(PROBLEM_BASE_URL + "/login-already-used"); + public static final URI EMAIL_NOT_FOUND_TYPE = URI.create(PROBLEM_BASE_URL + "/email-not-found"); + + private ErrorConstants() { + } +} diff --git a/jhipster/jhipster-uaa/gateway/src/main/java/com/baeldung/jhipster/gateway/web/rest/errors/ExceptionTranslator.java b/jhipster/jhipster-uaa/gateway/src/main/java/com/baeldung/jhipster/gateway/web/rest/errors/ExceptionTranslator.java new file mode 100644 index 0000000000..d5c9e577a6 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/java/com/baeldung/jhipster/gateway/web/rest/errors/ExceptionTranslator.java @@ -0,0 +1,107 @@ +package com.baeldung.jhipster.gateway.web.rest.errors; + +import com.baeldung.jhipster.gateway.web.rest.util.HeaderUtil; + +import org.springframework.dao.ConcurrencyFailureException; +import org.springframework.http.ResponseEntity; +import org.springframework.validation.BindingResult; +import org.springframework.web.bind.MethodArgumentNotValidException; +import org.springframework.web.bind.annotation.ControllerAdvice; +import org.springframework.web.bind.annotation.ExceptionHandler; +import org.springframework.web.context.request.NativeWebRequest; +import org.zalando.problem.DefaultProblem; +import org.zalando.problem.Problem; +import org.zalando.problem.ProblemBuilder; +import org.zalando.problem.Status; +import org.zalando.problem.spring.web.advice.ProblemHandling; +import org.zalando.problem.violations.ConstraintViolationProblem; + +import javax.annotation.Nonnull; +import javax.annotation.Nullable; +import javax.servlet.http.HttpServletRequest; +import java.util.List; +import java.util.NoSuchElementException; +import java.util.stream.Collectors; + +/** + * Controller advice to translate the server side exceptions to client-friendly json structures. + * The error response follows RFC7807 - Problem Details for HTTP APIs (https://tools.ietf.org/html/rfc7807) + */ +@ControllerAdvice +public class ExceptionTranslator implements ProblemHandling { + + /** + * Post-process the Problem payload to add the message key for the front-end if needed + */ + @Override + public ResponseEntity process(@Nullable ResponseEntity entity, NativeWebRequest request) { + if (entity == null) { + return entity; + } + Problem problem = entity.getBody(); + if (!(problem instanceof ConstraintViolationProblem || problem instanceof DefaultProblem)) { + return entity; + } + ProblemBuilder builder = Problem.builder() + .withType(Problem.DEFAULT_TYPE.equals(problem.getType()) ? ErrorConstants.DEFAULT_TYPE : problem.getType()) + .withStatus(problem.getStatus()) + .withTitle(problem.getTitle()) + .with("path", request.getNativeRequest(HttpServletRequest.class).getRequestURI()); + + if (problem instanceof ConstraintViolationProblem) { + builder + .with("violations", ((ConstraintViolationProblem) problem).getViolations()) + .with("message", ErrorConstants.ERR_VALIDATION); + } else { + builder + .withCause(((DefaultProblem) problem).getCause()) + .withDetail(problem.getDetail()) + .withInstance(problem.getInstance()); + problem.getParameters().forEach(builder::with); + if (!problem.getParameters().containsKey("message") && problem.getStatus() != null) { + builder.with("message", "error.http." + problem.getStatus().getStatusCode()); + } + } + return new ResponseEntity<>(builder.build(), entity.getHeaders(), entity.getStatusCode()); + } + + @Override + public ResponseEntity handleMethodArgumentNotValid(MethodArgumentNotValidException ex, @Nonnull NativeWebRequest request) { + BindingResult result = ex.getBindingResult(); + List fieldErrors = result.getFieldErrors().stream() + .map(f -> new FieldErrorVM(f.getObjectName(), f.getField(), f.getCode())) + .collect(Collectors.toList()); + + Problem problem = Problem.builder() + .withType(ErrorConstants.CONSTRAINT_VIOLATION_TYPE) + .withTitle("Method argument not valid") + .withStatus(defaultConstraintViolationStatus()) + .with("message", ErrorConstants.ERR_VALIDATION) + .with("fieldErrors", fieldErrors) + .build(); + return create(ex, problem, request); + } + + @ExceptionHandler + public ResponseEntity handleNoSuchElementException(NoSuchElementException ex, NativeWebRequest request) { + Problem problem = Problem.builder() + .withStatus(Status.NOT_FOUND) + .with("message", ErrorConstants.ENTITY_NOT_FOUND_TYPE) + .build(); + return create(ex, problem, request); + } + + @ExceptionHandler + public ResponseEntity handleBadRequestAlertException(BadRequestAlertException ex, NativeWebRequest request) { + return create(ex, request, HeaderUtil.createFailureAlert(ex.getEntityName(), ex.getErrorKey(), ex.getMessage())); + } + + @ExceptionHandler + public ResponseEntity handleConcurrencyFailure(ConcurrencyFailureException ex, NativeWebRequest request) { + Problem problem = Problem.builder() + .withStatus(Status.CONFLICT) + .with("message", ErrorConstants.ERR_CONCURRENCY_FAILURE) + .build(); + return create(ex, problem, request); + } +} diff --git a/jhipster/jhipster-uaa/gateway/src/main/java/com/baeldung/jhipster/gateway/web/rest/errors/FieldErrorVM.java b/jhipster/jhipster-uaa/gateway/src/main/java/com/baeldung/jhipster/gateway/web/rest/errors/FieldErrorVM.java new file mode 100644 index 0000000000..cb49de90eb --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/java/com/baeldung/jhipster/gateway/web/rest/errors/FieldErrorVM.java @@ -0,0 +1,33 @@ +package com.baeldung.jhipster.gateway.web.rest.errors; + +import java.io.Serializable; + +public class FieldErrorVM implements Serializable { + + private static final long serialVersionUID = 1L; + + private final String objectName; + + private final String field; + + private final String message; + + public FieldErrorVM(String dto, String field, String message) { + this.objectName = dto; + this.field = field; + this.message = message; + } + + public String getObjectName() { + return objectName; + } + + public String getField() { + return field; + } + + public String getMessage() { + return message; + } + +} diff --git a/jhipster/jhipster-uaa/gateway/src/main/java/com/baeldung/jhipster/gateway/web/rest/errors/InternalServerErrorException.java b/jhipster/jhipster-uaa/gateway/src/main/java/com/baeldung/jhipster/gateway/web/rest/errors/InternalServerErrorException.java new file mode 100644 index 0000000000..7e64638fe1 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/java/com/baeldung/jhipster/gateway/web/rest/errors/InternalServerErrorException.java @@ -0,0 +1,16 @@ +package com.baeldung.jhipster.gateway.web.rest.errors; + +import org.zalando.problem.AbstractThrowableProblem; +import org.zalando.problem.Status; + +/** + * Simple exception with a message, that returns an Internal Server Error code. + */ +public class InternalServerErrorException extends AbstractThrowableProblem { + + private static final long serialVersionUID = 1L; + + public InternalServerErrorException(String message) { + super(ErrorConstants.DEFAULT_TYPE, message, Status.INTERNAL_SERVER_ERROR); + } +} diff --git a/jhipster/jhipster-uaa/gateway/src/main/java/com/baeldung/jhipster/gateway/web/rest/errors/InvalidPasswordException.java b/jhipster/jhipster-uaa/gateway/src/main/java/com/baeldung/jhipster/gateway/web/rest/errors/InvalidPasswordException.java new file mode 100644 index 0000000000..101763b703 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/java/com/baeldung/jhipster/gateway/web/rest/errors/InvalidPasswordException.java @@ -0,0 +1,13 @@ +package com.baeldung.jhipster.gateway.web.rest.errors; + +import org.zalando.problem.AbstractThrowableProblem; +import org.zalando.problem.Status; + +public class InvalidPasswordException extends AbstractThrowableProblem { + + private static final long serialVersionUID = 1L; + + public InvalidPasswordException() { + super(ErrorConstants.INVALID_PASSWORD_TYPE, "Incorrect password", Status.BAD_REQUEST); + } +} diff --git a/jhipster/jhipster-uaa/gateway/src/main/java/com/baeldung/jhipster/gateway/web/rest/errors/LoginAlreadyUsedException.java b/jhipster/jhipster-uaa/gateway/src/main/java/com/baeldung/jhipster/gateway/web/rest/errors/LoginAlreadyUsedException.java new file mode 100644 index 0000000000..60518572fe --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/java/com/baeldung/jhipster/gateway/web/rest/errors/LoginAlreadyUsedException.java @@ -0,0 +1,10 @@ +package com.baeldung.jhipster.gateway.web.rest.errors; + +public class LoginAlreadyUsedException extends BadRequestAlertException { + + private static final long serialVersionUID = 1L; + + public LoginAlreadyUsedException() { + super(ErrorConstants.LOGIN_ALREADY_USED_TYPE, "Login name already used!", "userManagement", "userexists"); + } +} diff --git a/jhipster/jhipster-uaa/gateway/src/main/java/com/baeldung/jhipster/gateway/web/rest/errors/package-info.java b/jhipster/jhipster-uaa/gateway/src/main/java/com/baeldung/jhipster/gateway/web/rest/errors/package-info.java new file mode 100644 index 0000000000..f13641c5b8 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/java/com/baeldung/jhipster/gateway/web/rest/errors/package-info.java @@ -0,0 +1,6 @@ +/** + * Specific errors used with Zalando's "problem-spring-web" library. + * + * More information on https://github.com/zalando/problem-spring-web + */ +package com.baeldung.jhipster.gateway.web.rest.errors; diff --git a/jhipster/jhipster-uaa/gateway/src/main/java/com/baeldung/jhipster/gateway/web/rest/package-info.java b/jhipster/jhipster-uaa/gateway/src/main/java/com/baeldung/jhipster/gateway/web/rest/package-info.java new file mode 100644 index 0000000000..e64efc7eed --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/java/com/baeldung/jhipster/gateway/web/rest/package-info.java @@ -0,0 +1,4 @@ +/** + * Spring MVC REST controllers. + */ +package com.baeldung.jhipster.gateway.web.rest; diff --git a/jhipster/jhipster-uaa/gateway/src/main/java/com/baeldung/jhipster/gateway/web/rest/util/HeaderUtil.java b/jhipster/jhipster-uaa/gateway/src/main/java/com/baeldung/jhipster/gateway/web/rest/util/HeaderUtil.java new file mode 100644 index 0000000000..979064f3d7 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/java/com/baeldung/jhipster/gateway/web/rest/util/HeaderUtil.java @@ -0,0 +1,45 @@ +package com.baeldung.jhipster.gateway.web.rest.util; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.http.HttpHeaders; + +/** + * Utility class for HTTP headers creation. + */ +public final class HeaderUtil { + + private static final Logger log = LoggerFactory.getLogger(HeaderUtil.class); + + private static final String APPLICATION_NAME = "gatewayApp"; + + private HeaderUtil() { + } + + public static HttpHeaders createAlert(String message, String param) { + HttpHeaders headers = new HttpHeaders(); + headers.add("X-" + APPLICATION_NAME + "-alert", message); + headers.add("X-" + APPLICATION_NAME + "-params", param); + return headers; + } + + public static HttpHeaders createEntityCreationAlert(String entityName, String param) { + return createAlert(APPLICATION_NAME + "." + entityName + ".created", param); + } + + public static HttpHeaders createEntityUpdateAlert(String entityName, String param) { + return createAlert(APPLICATION_NAME + "." + entityName + ".updated", param); + } + + public static HttpHeaders createEntityDeletionAlert(String entityName, String param) { + return createAlert(APPLICATION_NAME + "." + entityName + ".deleted", param); + } + + public static HttpHeaders createFailureAlert(String entityName, String errorKey, String defaultMessage) { + log.error("Entity processing failed, {}", defaultMessage); + HttpHeaders headers = new HttpHeaders(); + headers.add("X-" + APPLICATION_NAME + "-error", "error." + errorKey); + headers.add("X-" + APPLICATION_NAME + "-params", entityName); + return headers; + } +} diff --git a/jhipster/jhipster-uaa/gateway/src/main/java/com/baeldung/jhipster/gateway/web/rest/util/PaginationUtil.java b/jhipster/jhipster-uaa/gateway/src/main/java/com/baeldung/jhipster/gateway/web/rest/util/PaginationUtil.java new file mode 100644 index 0000000000..bf6308068d --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/java/com/baeldung/jhipster/gateway/web/rest/util/PaginationUtil.java @@ -0,0 +1,45 @@ +package com.baeldung.jhipster.gateway.web.rest.util; + +import org.springframework.data.domain.Page; +import org.springframework.http.HttpHeaders; +import org.springframework.web.util.UriComponentsBuilder; + +/** + * Utility class for handling pagination. + * + *

+ * Pagination uses the same principles as the GitHub API, + * and follow RFC 5988 (Link header). + */ +public final class PaginationUtil { + + private PaginationUtil() { + } + + public static HttpHeaders generatePaginationHttpHeaders(Page page, String baseUrl) { + + HttpHeaders headers = new HttpHeaders(); + headers.add("X-Total-Count", Long.toString(page.getTotalElements())); + String link = ""; + if ((page.getNumber() + 1) < page.getTotalPages()) { + link = "<" + generateUri(baseUrl, page.getNumber() + 1, page.getSize()) + ">; rel=\"next\","; + } + // prev link + if ((page.getNumber()) > 0) { + link += "<" + generateUri(baseUrl, page.getNumber() - 1, page.getSize()) + ">; rel=\"prev\","; + } + // last and first link + int lastPage = 0; + if (page.getTotalPages() > 0) { + lastPage = page.getTotalPages() - 1; + } + link += "<" + generateUri(baseUrl, lastPage, page.getSize()) + ">; rel=\"last\","; + link += "<" + generateUri(baseUrl, 0, page.getSize()) + ">; rel=\"first\""; + headers.add(HttpHeaders.LINK, link); + return headers; + } + + private static String generateUri(String baseUrl, int page, int size) { + return UriComponentsBuilder.fromUriString(baseUrl).queryParam("page", page).queryParam("size", size).toUriString(); + } +} diff --git a/jhipster/jhipster-uaa/gateway/src/main/java/com/baeldung/jhipster/gateway/web/rest/vm/LoggerVM.java b/jhipster/jhipster-uaa/gateway/src/main/java/com/baeldung/jhipster/gateway/web/rest/vm/LoggerVM.java new file mode 100644 index 0000000000..b5a25603de --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/java/com/baeldung/jhipster/gateway/web/rest/vm/LoggerVM.java @@ -0,0 +1,46 @@ +package com.baeldung.jhipster.gateway.web.rest.vm; + +import ch.qos.logback.classic.Logger; + +/** + * View Model object for storing a Logback logger. + */ +public class LoggerVM { + + private String name; + + private String level; + + public LoggerVM(Logger logger) { + this.name = logger.getName(); + this.level = logger.getEffectiveLevel().toString(); + } + + public LoggerVM() { + // Empty public constructor used by Jackson. + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getLevel() { + return level; + } + + public void setLevel(String level) { + this.level = level; + } + + @Override + public String toString() { + return "LoggerVM{" + + "name='" + name + '\'' + + ", level='" + level + '\'' + + '}'; + } +} diff --git a/jhipster/jhipster-uaa/gateway/src/main/java/com/baeldung/jhipster/gateway/web/rest/vm/RouteVM.java b/jhipster/jhipster-uaa/gateway/src/main/java/com/baeldung/jhipster/gateway/web/rest/vm/RouteVM.java new file mode 100644 index 0000000000..28ff5578f5 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/java/com/baeldung/jhipster/gateway/web/rest/vm/RouteVM.java @@ -0,0 +1,41 @@ +package com.baeldung.jhipster.gateway.web.rest.vm; + +import java.util.List; + +import org.springframework.cloud.client.ServiceInstance; + +/** + * View Model that stores a route managed by the Gateway. + */ +public class RouteVM { + + private String path; + + private String serviceId; + + private List serviceInstances; + + public String getPath() { + return path; + } + + public void setPath(String path) { + this.path = path; + } + + public String getServiceId() { + return serviceId; + } + + public void setServiceId(String serviceId) { + this.serviceId = serviceId; + } + + public List getServiceInstances() { + return serviceInstances; + } + + public void setServiceInstances(List serviceInstances) { + this.serviceInstances = serviceInstances; + } +} diff --git a/jhipster/jhipster-uaa/gateway/src/main/java/com/baeldung/jhipster/gateway/web/rest/vm/package-info.java b/jhipster/jhipster-uaa/gateway/src/main/java/com/baeldung/jhipster/gateway/web/rest/vm/package-info.java new file mode 100644 index 0000000000..a20ce3226e --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/java/com/baeldung/jhipster/gateway/web/rest/vm/package-info.java @@ -0,0 +1,4 @@ +/** + * View Models used by Spring MVC REST controllers. + */ +package com.baeldung.jhipster.gateway.web.rest.vm; diff --git a/jhipster/jhipster-uaa/gateway/src/main/jib/entrypoint.sh b/jhipster/jhipster-uaa/gateway/src/main/jib/entrypoint.sh new file mode 100644 index 0000000000..5ac1e54b29 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/jib/entrypoint.sh @@ -0,0 +1,4 @@ +#!/bin/sh + +echo "The application will start in ${JHIPSTER_SLEEP}s..." && sleep ${JHIPSTER_SLEEP} +exec java ${JAVA_OPTS} -Djava.security.egd=file:/dev/./urandom -cp /app/resources/:/app/classes/:/app/libs/* "com.baeldung.jhipster.gateway.GatewayApp" "$@" diff --git a/jhipster/jhipster-uaa/gateway/src/main/resources/.h2.server.properties b/jhipster/jhipster-uaa/gateway/src/main/resources/.h2.server.properties new file mode 100644 index 0000000000..22c176d4ac --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/resources/.h2.server.properties @@ -0,0 +1,6 @@ +#H2 Server Properties +#Tue Oct 16 03:48:16 BRT 2018 +0=JHipster H2 (Disk)|org.h2.Driver|jdbc\:h2\:file\:./target/h2db/db/gateway|gateway +webAllowOthers=true +webPort=8082 +webSSL=false diff --git a/jhipster/jhipster-uaa/gateway/src/main/resources/banner.txt b/jhipster/jhipster-uaa/gateway/src/main/resources/banner.txt new file mode 100644 index 0000000000..e0bc55aaff --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/resources/banner.txt @@ -0,0 +1,10 @@ + + ${AnsiColor.GREEN} ██╗${AnsiColor.RED} ██╗ ██╗ ████████╗ ███████╗ ██████╗ ████████╗ ████████╗ ███████╗ + ${AnsiColor.GREEN} ██║${AnsiColor.RED} ██║ ██║ ╚══██╔══╝ ██╔═══██╗ ██╔════╝ ╚══██╔══╝ ██╔═════╝ ██╔═══██╗ + ${AnsiColor.GREEN} ██║${AnsiColor.RED} ████████║ ██║ ███████╔╝ ╚█████╗ ██║ ██████╗ ███████╔╝ + ${AnsiColor.GREEN}██╗ ██║${AnsiColor.RED} ██╔═══██║ ██║ ██╔════╝ ╚═══██╗ ██║ ██╔═══╝ ██╔══██║ + ${AnsiColor.GREEN}╚██████╔╝${AnsiColor.RED} ██║ ██║ ████████╗ ██║ ██████╔╝ ██║ ████████╗ ██║ ╚██╗ + ${AnsiColor.GREEN} ╚═════╝ ${AnsiColor.RED} ╚═╝ ╚═╝ ╚═══════╝ ╚═╝ ╚═════╝ ╚═╝ ╚═══════╝ ╚═╝ ╚═╝ + +${AnsiColor.BRIGHT_BLUE}:: JHipster 🤓 :: Running Spring Boot ${spring-boot.version} :: +:: https://www.jhipster.tech ::${AnsiColor.DEFAULT} diff --git a/jhipster/jhipster-uaa/gateway/src/main/resources/config/application-dev.yml b/jhipster/jhipster-uaa/gateway/src/main/resources/config/application-dev.yml new file mode 100644 index 0000000000..c2a47d3ab9 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/resources/config/application-dev.yml @@ -0,0 +1,168 @@ +# =================================================================== +# Spring Boot configuration for the "dev" profile. +# +# This configuration overrides the application.yml file. +# +# More information on profiles: https://www.jhipster.tech/profiles/ +# More information on configuration properties: https://www.jhipster.tech/common-application-properties/ +# =================================================================== + +# =================================================================== +# Standard Spring Boot properties. +# Full reference is available at: +# http://docs.spring.io/spring-boot/docs/current/reference/html/common-application-properties.html +# =================================================================== + +logging: + level: + ROOT: DEBUG + io.github.jhipster: DEBUG + com.baeldung.jhipster.gateway: DEBUG + +eureka: + instance: + prefer-ip-address: true + client: + service-url: + defaultZone: http://admin:${jhipster.registry.password}@localhost:8761/eureka/ + +spring: + profiles: + active: dev + include: + - swagger + # Uncomment to activate TLS for the dev profile + #- tls + devtools: + restart: + enabled: true + livereload: + enabled: false # we use Webpack dev server + BrowserSync for livereload + jackson: + serialization.indent_output: true + datasource: + type: com.zaxxer.hikari.HikariDataSource + url: jdbc:h2:file:./target/h2db/db/gateway;DB_CLOSE_DELAY=-1 + username: gateway + password: + hikari: + auto-commit: false + h2: + console: + enabled: false + jpa: + database-platform: io.github.jhipster.domain.util.FixedH2Dialect + database: H2 + show-sql: true + properties: + hibernate.id.new_generator_mappings: true + hibernate.connection.provider_disables_autocommit: true + hibernate.cache.use_second_level_cache: true + hibernate.cache.use_query_cache: false + hibernate.generate_statistics: true + hibernate.cache.region.factory_class: com.hazelcast.hibernate.HazelcastCacheRegionFactory + hibernate.cache.hazelcast.instance_name: gateway + hibernate.cache.use_minimal_puts: true + hibernate.cache.hazelcast.use_lite_member: true + liquibase: + contexts: dev + mail: + host: localhost + port: 25 + username: + password: + messages: + cache-duration: PT1S # 1 second, see the ISO 8601 standard + thymeleaf: + cache: false + sleuth: + sampler: + percentage: 1 # report 100% of traces + zipkin: # Use the "zipkin" Maven profile to have the Spring Cloud Zipkin dependencies + base-url: http://localhost:9411 + enabled: false + locator: + discovery: + enabled: true + +server: + port: 8080 + +# =================================================================== +# JHipster specific properties +# +# Full reference is available at: https://www.jhipster.tech/common-application-properties/ +# =================================================================== + +jhipster: + gateway: + rate-limiting: + enabled: false + limit: 100000 + duration-in-seconds: 3600 + authorized-microservices-endpoints: # Access Control Policy, if left empty for a route, all endpoints will be accessible + app1: /api,/v2/api-docs # recommended dev configuration + http: + version: V_1_1 # To use HTTP/2 you will need to activate TLS (see application-tls.yml) + cache: # Cache configuration + hazelcast: # Hazelcast distributed cache + time-to-live-seconds: 3600 + backup-count: 1 + management-center: # Full reference is available at: http://docs.hazelcast.org/docs/management-center/3.9/manual/html/Deploying_and_Starting.html + enabled: false + update-interval: 3 + url: http://localhost:8180/mancenter + # CORS is only enabled by default with the "dev" profile, so BrowserSync can access the API + cors: + allowed-origins: "*" + allowed-methods: "*" + allowed-headers: "*" + exposed-headers: "Authorization,Link,X-Total-Count" + allow-credentials: true + max-age: 1800 + security: + client-authorization: + access-token-uri: http://uaa/oauth/token + token-service-id: uaa + client-id: internal + client-secret: internal + mail: # specific JHipster mail property, for standard properties see MailProperties + from: gateway@localhost + base-url: http://127.0.0.1:8080 + metrics: # DropWizard Metrics configuration, used by MetricsConfiguration + jmx: + enabled: true + logs: # Reports Dropwizard metrics in the logs + enabled: false + report-frequency: 60 # in seconds + logging: + logstash: # Forward logs to logstash over a socket, used by LoggingConfiguration + enabled: false + host: localhost + port: 5000 + queue-size: 512 +oauth2: + signature-verification: + public-key-endpoint-uri: http://uaa/oauth/token_key + #ttl for public keys to verify JWT tokens (in ms) + ttl: 3600000 + #max. rate at which public keys will be fetched (in ms) + public-key-refresh-rate-limit: 10000 + web-client-configuration: + #keep in sync with UAA configuration + client-id: web_app + secret: changeit + # Controls session expiration due to inactivity (ignored for remember-me). + # Negative values disable session inactivity expiration. + session-timeout-in-seconds: 1800 + +# =================================================================== +# Application specific properties +# Add your own application properties here, see the ApplicationProperties class +# to have type-safe configuration, like in the JHipsterProperties above +# +# More documentation is available at: +# https://www.jhipster.tech/common-application-properties/ +# =================================================================== + +# application: diff --git a/jhipster/jhipster-uaa/gateway/src/main/resources/config/application-prod.yml b/jhipster/jhipster-uaa/gateway/src/main/resources/config/application-prod.yml new file mode 100644 index 0000000000..a0f1a00859 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/resources/config/application-prod.yml @@ -0,0 +1,175 @@ +# =================================================================== +# Spring Boot configuration for the "prod" profile. +# +# This configuration overrides the application.yml file. +# +# More information on profiles: https://www.jhipster.tech/profiles/ +# More information on configuration properties: https://www.jhipster.tech/common-application-properties/ +# =================================================================== + +# =================================================================== +# Standard Spring Boot properties. +# Full reference is available at: +# http://docs.spring.io/spring-boot/docs/current/reference/html/common-application-properties.html +# =================================================================== + +logging: + level: + ROOT: INFO + com.baeldung.jhipster.gateway: INFO + io.github.jhipster: INFO + +eureka: + instance: + prefer-ip-address: true + client: + service-url: + defaultZone: http://admin:${jhipster.registry.password}@localhost:8761/eureka/ + +spring: + devtools: + restart: + enabled: false + livereload: + enabled: false + datasource: + type: com.zaxxer.hikari.HikariDataSource + url: jdbc:mysql://localhost:3306/gateway?useUnicode=true&characterEncoding=utf8&useSSL=false + username: root + password: + hikari: + auto-commit: false + data-source-properties: + cachePrepStmts: true + prepStmtCacheSize: 250 + prepStmtCacheSqlLimit: 2048 + useServerPrepStmts: true + jpa: + database-platform: org.hibernate.dialect.MySQL5InnoDBDialect + database: MYSQL + show-sql: false + properties: + hibernate.id.new_generator_mappings: true + hibernate.connection.provider_disables_autocommit: true + hibernate.cache.use_second_level_cache: true + hibernate.cache.use_query_cache: false + hibernate.generate_statistics: false + hibernate.cache.region.factory_class: com.hazelcast.hibernate.HazelcastCacheRegionFactory + hibernate.cache.hazelcast.instance_name: gateway + hibernate.cache.use_minimal_puts: true + hibernate.cache.hazelcast.use_lite_member: true + liquibase: + contexts: prod + mail: + host: localhost + port: 25 + username: + password: + thymeleaf: + cache: true + sleuth: + sampler: + percentage: 1 # report 100% of traces + zipkin: # Use the "zipkin" Maven profile to have the Spring Cloud Zipkin dependencies + base-url: http://localhost:9411 + enabled: false + locator: + discovery: + enabled: true + +# =================================================================== +# To enable TLS in production, generate a certificate using: +# keytool -genkey -alias gateway -storetype PKCS12 -keyalg RSA -keysize 2048 -keystore keystore.p12 -validity 3650 +# +# You can also use Let's Encrypt: +# https://maximilian-boehm.com/hp2121/Create-a-Java-Keystore-JKS-from-Let-s-Encrypt-Certificates.htm +# +# Then, modify the server.ssl properties so your "server" configuration looks like: +# +# server: +# port: 443 +# ssl: +# key-store: classpath:config/tls/keystore.p12 +# key-store-password: password +# key-store-type: PKCS12 +# key-alias: gateway +# # The ciphers suite enforce the security by deactivating some old and deprecated SSL cipher, this list was tested against SSL Labs (https://www.ssllabs.com/ssltest/) +# ciphers: TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA,TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA,TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 ,TLS_DHE_RSA_WITH_AES_128_GCM_SHA256 ,TLS_DHE_RSA_WITH_AES_256_GCM_SHA384 ,TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256,TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384,TLS_DHE_RSA_WITH_AES_128_CBC_SHA256,TLS_DHE_RSA_WITH_AES_128_CBC_SHA,TLS_DHE_RSA_WITH_AES_256_CBC_SHA256,TLS_DHE_RSA_WITH_AES_256_CBC_SHA,TLS_RSA_WITH_AES_128_GCM_SHA256,TLS_RSA_WITH_AES_256_GCM_SHA384,TLS_RSA_WITH_AES_128_CBC_SHA256,TLS_RSA_WITH_AES_256_CBC_SHA256,TLS_RSA_WITH_AES_128_CBC_SHA,TLS_RSA_WITH_AES_256_CBC_SHA,TLS_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA,TLS_RSA_WITH_CAMELLIA_256_CBC_SHA,TLS_DHE_RSA_WITH_CAMELLIA_128_CBC_SHA,TLS_RSA_WITH_CAMELLIA_128_CBC_SHA +# =================================================================== +server: + port: 8080 + compression: + enabled: true + mime-types: text/html,text/xml,text/plain,text/css, application/javascript, application/json + min-response-size: 1024 + +# =================================================================== +# JHipster specific properties +# +# Full reference is available at: https://www.jhipster.tech/common-application-properties/ +# =================================================================== + +jhipster: + gateway: + rate-limiting: + enabled: false + authorized-microservices-endpoints: # Access Control Policy, if left empty for a route, all endpoints will be accessible + app1: /api # recommended prod configuration + http: + version: V_1_1 # To use HTTP/2 you will need SSL support (see above the "server.ssl" configuration) + cache: # Used by the CachingHttpHeadersFilter + timeToLiveInDays: 1461 + cache: # Cache configuration + hazelcast: # Hazelcast distributed cache + time-to-live-seconds: 3600 + backup-count: 1 + management-center: # Full reference is available at: http://docs.hazelcast.org/docs/management-center/3.9/manual/html/Deploying_and_Starting.html + enabled: false + update-interval: 3 + url: + security: + client-authorization: + access-token-uri: http://uaa/oauth/token + token-service-id: uaa + client-id: internal + client-secret: internal + mail: # specific JHipster mail property, for standard properties see MailProperties + from: gateway@localhost + base-url: http://my-server-url-to-change # Modify according to your server's URL + metrics: # DropWizard Metrics configuration, used by MetricsConfiguration + jmx: + enabled: true + logs: # Reports Dropwizard metrics in the logs + enabled: false + report-frequency: 60 # in seconds + logging: + logstash: # Forward logs to logstash over a socket, used by LoggingConfiguration + enabled: false + host: localhost + port: 5000 + queue-size: 512 +oauth2: + signature-verification: + public-key-endpoint-uri: http://uaa/oauth/token_key + #ttl for public keys to verify JWT tokens (in ms) + ttl: 3600000 + #max. rate at which public keys will be fetched (in ms) + public-key-refresh-rate-limit: 10000 + web-client-configuration: + #change client secret in production, keep in sync with UAA configuration + client-id: web_app + secret: changeit + # Controls session expiration due to inactivity (ignored for remember-me). + # Negative values disable session inactivity expiration. + session-timeout-in-seconds: 1800 + +# =================================================================== +# Application specific properties +# Add your own application properties here, see the ApplicationProperties class +# to have type-safe configuration, like in the JHipsterProperties above +# +# More documentation is available at: +# https://www.jhipster.tech/common-application-properties/ +# =================================================================== + +# application: diff --git a/jhipster/jhipster-uaa/gateway/src/main/resources/config/application-tls.yml b/jhipster/jhipster-uaa/gateway/src/main/resources/config/application-tls.yml new file mode 100644 index 0000000000..e082c8f455 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/resources/config/application-tls.yml @@ -0,0 +1,18 @@ +# =================================================================== +# Activate this profile to enable TLS and HTTP/2. +# +# JHipster has generated a self-signed certificate, which will be used to encrypt traffic. +# As your browser will not understand this certificate, you will need to import it. +# +# Another (easiest) solution with Chrome is to enable the "allow-insecure-localhost" flag +# at chrome://flags/#allow-insecure-localhost +# =================================================================== +server: + ssl: + key-store: classpath:config/tls/keystore.p12 + key-store-password: password + key-store-type: PKCS12 + key-alias: selfsigned +jhipster: + http: + version: V_2_0 diff --git a/jhipster/jhipster-uaa/gateway/src/main/resources/config/application.yml b/jhipster/jhipster-uaa/gateway/src/main/resources/config/application.yml new file mode 100644 index 0000000000..b5848e8963 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/resources/config/application.yml @@ -0,0 +1,157 @@ +# =================================================================== +# Spring Boot configuration. +# +# This configuration will be overridden by the Spring profile you use, +# for example application-dev.yml if you use the "dev" profile. +# +# More information on profiles: https://www.jhipster.tech/profiles/ +# More information on configuration properties: https://www.jhipster.tech/common-application-properties/ +# =================================================================== + +# =================================================================== +# Standard Spring Boot properties. +# Full reference is available at: +# http://docs.spring.io/spring-boot/docs/current/reference/html/common-application-properties.html +# =================================================================== + +eureka: + client: + enabled: true + healthcheck: + enabled: true + fetch-registry: true + register-with-eureka: true + instance-info-replication-interval-seconds: 10 + registry-fetch-interval-seconds: 10 + instance: + appname: gateway + instanceId: gateway:${spring.application.instance-id:${random.value}} + lease-renewal-interval-in-seconds: 5 + lease-expiration-duration-in-seconds: 10 + status-page-url-path: ${management.endpoints.web.base-path}/info + health-check-url-path: ${management.endpoints.web.base-path}/health + metadata-map: + zone: primary # This is needed for the load balancer + profile: ${spring.profiles.active} + version: ${info.project.version:} + git-version: ${git.commit.id.describe:} + git-commit: ${git.commit.id.abbrev:} + git-branch: ${git.branch:} +ribbon: + eureka: + enabled: true +# See http://cloud.spring.io/spring-cloud-netflix/spring-cloud-netflix.html +zuul: # those values must be configured depending on the application specific needs + sensitive-headers: Cookie,Set-Cookie #see https://github.com/spring-cloud/spring-cloud-netflix/issues/3126 + host: + max-total-connections: 1000 + max-per-route-connections: 100 + semaphore: + max-semaphores: 500 + +# See https://github.com/Netflix/Hystrix/wiki/Configuration +hystrix: + command: + default: + execution: + isolation: + thread: + timeoutInMilliseconds: 10000 + +management: + endpoints: + web: + base-path: /management + exposure: + include: ["configprops", "env", "health", "info", "threaddump", "logfile" ] + endpoint: + health: + show-details: when_authorized + info: + git: + mode: full + health: + mail: + enabled: false # When using the MailService, configure an SMTP server and set this to true + metrics: + enabled: false # http://micrometer.io/ is disabled by default, as we use http://metrics.dropwizard.io/ instead + +spring: + application: + name: gateway + jpa: + open-in-view: false + hibernate: + ddl-auto: none + naming: + physical-strategy: org.springframework.boot.orm.jpa.hibernate.SpringPhysicalNamingStrategy + implicit-strategy: org.springframework.boot.orm.jpa.hibernate.SpringImplicitNamingStrategy + messages: + basename: i18n/messages + mvc: + favicon: + enabled: false + thymeleaf: + mode: HTML +security: + oauth2: + resource: + filter-order: 3 + +server: + servlet: + session: + cookie: + http-only: true + +# Properties to be exposed on the /info management endpoint +info: + # Comma separated list of profiles that will trigger the ribbon to show + display-ribbon-on-profiles: "dev" + +# =================================================================== +# JHipster specific properties +# +# Full reference is available at: https://www.jhipster.tech/common-application-properties/ +# =================================================================== + +jhipster: + async: + core-pool-size: 2 + max-pool-size: 50 + queue-capacity: 10000 + # By default CORS is disabled. Uncomment to enable. + #cors: + #allowed-origins: "*" + #allowed-methods: "*" + #allowed-headers: "*" + #exposed-headers: "Authorization,Link,X-Total-Count" + #allow-credentials: true + #max-age: 1800 + mail: + from: gateway@localhost + swagger: + default-include-pattern: /api/.* + title: gateway API + description: gateway API documentation + version: 0.0.1 + terms-of-service-url: + contact-name: + contact-url: + contact-email: + license: + license-url: + +logging: + file: target/gateway.log + +# =================================================================== +# Application specific properties +# Add your own application properties here, see the ApplicationProperties class +# to have type-safe configuration, like in the JHipsterProperties above +# +# More documentation is available at: +# https://www.jhipster.tech/common-application-properties/ +# =================================================================== + +# application: diff --git a/jhipster/jhipster-uaa/gateway/src/main/resources/config/bootstrap-prod.yml b/jhipster/jhipster-uaa/gateway/src/main/resources/config/bootstrap-prod.yml new file mode 100644 index 0000000000..9d8989f5a6 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/resources/config/bootstrap-prod.yml @@ -0,0 +1,22 @@ +# =================================================================== +# Spring Cloud Config bootstrap configuration for the "prod" profile +# =================================================================== + +spring: + cloud: + config: + fail-fast: true + retry: + initial-interval: 1000 + max-interval: 2000 + max-attempts: 100 + uri: http://admin:${jhipster.registry.password}@localhost:8761/config + # name of the config server's property source (file.yml) that we want to use + name: gateway + profile: prod # profile(s) of the property source + label: master # toggle to switch to a different version of the configuration as stored in git + # it can be set to any label, branch or commit of the configuration source Git repository + +jhipster: + registry: + password: admin diff --git a/jhipster/jhipster-uaa/gateway/src/main/resources/config/bootstrap.yml b/jhipster/jhipster-uaa/gateway/src/main/resources/config/bootstrap.yml new file mode 100644 index 0000000000..a6ebd56b33 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/resources/config/bootstrap.yml @@ -0,0 +1,26 @@ +# =================================================================== +# Spring Cloud Config bootstrap configuration for the "dev" profile +# In prod profile, properties will be overwriten by the ones defined in bootstrap-prod.yml +# =================================================================== + +jhipster: + registry: + password: admin + +spring: + application: + name: gateway + profiles: + # The commented value for `active` can be replaced with valid Spring profiles to load. + # Otherwise, it will be filled in by maven when building the WAR file + # Either way, it can be overridden by `--spring.profiles.active` value passed in the commandline or `-Dspring.profiles.active` set in `JAVA_OPTS` + active: #spring.profiles.active# + cloud: + config: + fail-fast: false # if not in "prod" profile, do not force to use Spring Cloud Config + uri: http://admin:${jhipster.registry.password}@localhost:8761/config + # name of the config server's property source (file.yml) that we want to use + name: gateway + profile: dev # profile(s) of the property source + label: master # toggle to switch to a different version of the configuration as stored in git + # it can be set to any label, branch or commit of the configuration source Git repository diff --git a/jhipster/jhipster-uaa/gateway/src/main/resources/config/liquibase/changelog/00000000000000_initial_schema.xml b/jhipster/jhipster-uaa/gateway/src/main/resources/config/liquibase/changelog/00000000000000_initial_schema.xml new file mode 100644 index 0000000000..d75921613c --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/resources/config/liquibase/changelog/00000000000000_initial_schema.xml @@ -0,0 +1,59 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/jhipster/jhipster-uaa/gateway/src/main/resources/config/liquibase/master.xml b/jhipster/jhipster-uaa/gateway/src/main/resources/config/liquibase/master.xml new file mode 100644 index 0000000000..f2b0b1f7e6 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/resources/config/liquibase/master.xml @@ -0,0 +1,10 @@ + + + + + + + diff --git a/jhipster/jhipster-uaa/gateway/src/main/resources/config/tls/keystore.p12 b/jhipster/jhipster-uaa/gateway/src/main/resources/config/tls/keystore.p12 new file mode 100644 index 0000000000..f308de393d Binary files /dev/null and b/jhipster/jhipster-uaa/gateway/src/main/resources/config/tls/keystore.p12 differ diff --git a/jhipster/jhipster-uaa/gateway/src/main/resources/i18n/messages.properties b/jhipster/jhipster-uaa/gateway/src/main/resources/i18n/messages.properties new file mode 100644 index 0000000000..124274d5c3 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/resources/i18n/messages.properties @@ -0,0 +1,21 @@ +# Error page +error.title=Your request cannot be processed +error.subtitle=Sorry, an error has occurred. +error.status=Status: +error.message=Message: + +# Activation email +email.activation.title=gateway account activation +email.activation.greeting=Dear {0} +email.activation.text1=Your gateway account has been created, please click on the URL below to activate it: +email.activation.text2=Regards, +email.signature=gateway Team. + +# Creation email +email.creation.text1=Your gateway account has been created, please click on the URL below to access it: + +# Reset email +email.reset.title=gateway password reset +email.reset.greeting=Dear {0} +email.reset.text1=For your gateway account a password reset was requested, please click on the URL below to reset it: +email.reset.text2=Regards, diff --git a/jhipster/jhipster-uaa/gateway/src/main/resources/i18n/messages_en.properties b/jhipster/jhipster-uaa/gateway/src/main/resources/i18n/messages_en.properties new file mode 100644 index 0000000000..124274d5c3 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/resources/i18n/messages_en.properties @@ -0,0 +1,21 @@ +# Error page +error.title=Your request cannot be processed +error.subtitle=Sorry, an error has occurred. +error.status=Status: +error.message=Message: + +# Activation email +email.activation.title=gateway account activation +email.activation.greeting=Dear {0} +email.activation.text1=Your gateway account has been created, please click on the URL below to activate it: +email.activation.text2=Regards, +email.signature=gateway Team. + +# Creation email +email.creation.text1=Your gateway account has been created, please click on the URL below to access it: + +# Reset email +email.reset.title=gateway password reset +email.reset.greeting=Dear {0} +email.reset.text1=For your gateway account a password reset was requested, please click on the URL below to reset it: +email.reset.text2=Regards, diff --git a/jhipster/jhipster-uaa/gateway/src/main/resources/i18n/messages_fr.properties b/jhipster/jhipster-uaa/gateway/src/main/resources/i18n/messages_fr.properties new file mode 100644 index 0000000000..84cea81d74 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/resources/i18n/messages_fr.properties @@ -0,0 +1,21 @@ +# Error page +error.title=Votre demande ne peut être traitée +error.subtitle=Désolé, une erreur s'est produite. +error.status=Statut : +error.message=Message : + +# Activation email +email.activation.title=Activation de votre compte gateway +email.activation.greeting=Cher {0} +email.activation.text1=Votre compte gateway a été créé, pour l'activer merci de cliquer sur le lien ci-dessous : +email.activation.text2=Cordialement, +email.signature=gateway. + +# Creation email +email.creation.text1=Votre compte gateway a été créé, merci de cliquer sur le lien ci-dessous pour y accéder : + +# Reset email +email.reset.title=gateway Réinitialisation de mot de passe +email.reset.greeting=Cher {0} +email.reset.text1=Un nouveau mot de passe pour votre compte gateway a été demandé, veuillez cliquer sur le lien ci-dessous pour le réinitialiser : +email.reset.text2=Cordialement, diff --git a/jhipster/jhipster-uaa/gateway/src/main/resources/i18n/messages_pt_br.properties b/jhipster/jhipster-uaa/gateway/src/main/resources/i18n/messages_pt_br.properties new file mode 100644 index 0000000000..f8853b507a --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/resources/i18n/messages_pt_br.properties @@ -0,0 +1,21 @@ +# Error page +error.title=A requisição não pode ser processada +error.subtitle=Desculpe, ocorreu um erro. +error.status=Status: +error.message=Mensagem: + +# Activation email +email.activation.title=gateway ativação +email.activation.greeting=Caro {0} +email.activation.text1=Sua conta gateway foi criada, por favor click na URL abaixo para ativar: +email.activation.text2=Atenciosamente, +email.signature=gateway. + +# Creation email +email.creation.text1=Sua gateway account foi criada, por favor clique no URL abaixo para acessá-lo: + +# Reset email +email.reset.title=A Senha da aplicação gateway foi reiniciada +email.reset.greeting=Caro {0} +email.reset.text1=Foi solicitado o reinicio de senha da sua conta gateway. Por favor clique na url abaixo para alterá-la: +email.reset.text2=Prezado, diff --git a/jhipster/jhipster-uaa/gateway/src/main/resources/logback-spring.xml b/jhipster/jhipster-uaa/gateway/src/main/resources/logback-spring.xml new file mode 100644 index 0000000000..a30ab8c1d2 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/resources/logback-spring.xml @@ -0,0 +1,70 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + true + + + diff --git a/jhipster/jhipster-uaa/gateway/src/main/resources/templates/error.html b/jhipster/jhipster-uaa/gateway/src/main/resources/templates/error.html new file mode 100644 index 0000000000..08616bcf1e --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/resources/templates/error.html @@ -0,0 +1,163 @@ + + + + + + Your request cannot be processed + + + +

+

Your request cannot be processed :(

+ +

Sorry, an error has occurred.

+ + Status:  ()
+ + Message: 
+
+ + + +
+ + diff --git a/jhipster/jhipster-uaa/gateway/src/main/webapp/404.html b/jhipster/jhipster-uaa/gateway/src/main/webapp/404.html new file mode 100644 index 0000000000..3fdc0bee1a --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/webapp/404.html @@ -0,0 +1,61 @@ + + + + + Page Not Found + + + + + +

Page Not Found

+

Sorry, but the page you were trying to view does not exist.

+ + + diff --git a/jhipster/jhipster-uaa/gateway/src/main/webapp/app/account/account.module.ts b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/account/account.module.ts new file mode 100644 index 0000000000..e597aa0052 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/account/account.module.ts @@ -0,0 +1,30 @@ +import { NgModule, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core'; +import { RouterModule } from '@angular/router'; + +import { GatewaySharedModule } from 'app/shared'; + +import { + PasswordStrengthBarComponent, + RegisterComponent, + ActivateComponent, + PasswordComponent, + PasswordResetInitComponent, + PasswordResetFinishComponent, + SettingsComponent, + accountState +} from './'; + +@NgModule({ + imports: [GatewaySharedModule, RouterModule.forChild(accountState)], + declarations: [ + ActivateComponent, + RegisterComponent, + PasswordComponent, + PasswordStrengthBarComponent, + PasswordResetInitComponent, + PasswordResetFinishComponent, + SettingsComponent + ], + schemas: [CUSTOM_ELEMENTS_SCHEMA] +}) +export class GatewayAccountModule {} diff --git a/jhipster/jhipster-uaa/gateway/src/main/webapp/app/account/account.route.ts b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/account/account.route.ts new file mode 100644 index 0000000000..f849342e69 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/account/account.route.ts @@ -0,0 +1,12 @@ +import { Routes } from '@angular/router'; + +import { activateRoute, passwordRoute, passwordResetFinishRoute, passwordResetInitRoute, registerRoute, settingsRoute } from './'; + +const ACCOUNT_ROUTES = [activateRoute, passwordRoute, passwordResetFinishRoute, passwordResetInitRoute, registerRoute, settingsRoute]; + +export const accountState: Routes = [ + { + path: '', + children: ACCOUNT_ROUTES + } +]; diff --git a/jhipster/jhipster-uaa/gateway/src/main/webapp/app/account/activate/activate.component.html b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/account/activate/activate.component.html new file mode 100644 index 0000000000..6a28eef775 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/account/activate/activate.component.html @@ -0,0 +1,17 @@ +
+
+
+

Activation

+ +
+ Your user account has been activated. Please + sign in. +
+ +
+ Your user could not be activated. Please use the registration form to sign up. +
+ +
+
+
diff --git a/jhipster/jhipster-uaa/gateway/src/main/webapp/app/account/activate/activate.component.ts b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/account/activate/activate.component.ts new file mode 100644 index 0000000000..5c398073c3 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/account/activate/activate.component.ts @@ -0,0 +1,37 @@ +import { Component, OnInit } from '@angular/core'; +import { NgbModalRef } from '@ng-bootstrap/ng-bootstrap'; +import { ActivatedRoute } from '@angular/router'; + +import { LoginModalService } from 'app/core'; +import { ActivateService } from './activate.service'; + +@Component({ + selector: 'jhi-activate', + templateUrl: './activate.component.html' +}) +export class ActivateComponent implements OnInit { + error: string; + success: string; + modalRef: NgbModalRef; + + constructor(private activateService: ActivateService, private loginModalService: LoginModalService, private route: ActivatedRoute) {} + + ngOnInit() { + this.route.queryParams.subscribe(params => { + this.activateService.get(params['key']).subscribe( + () => { + this.error = null; + this.success = 'OK'; + }, + () => { + this.success = null; + this.error = 'ERROR'; + } + ); + }); + } + + login() { + this.modalRef = this.loginModalService.open(); + } +} diff --git a/jhipster/jhipster-uaa/gateway/src/main/webapp/app/account/activate/activate.route.ts b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/account/activate/activate.route.ts new file mode 100644 index 0000000000..f958dcfd51 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/account/activate/activate.route.ts @@ -0,0 +1,14 @@ +import { Route } from '@angular/router'; + +import { UserRouteAccessService } from 'app/core'; +import { ActivateComponent } from './activate.component'; + +export const activateRoute: Route = { + path: 'activate', + component: ActivateComponent, + data: { + authorities: [], + pageTitle: 'activate.title' + }, + canActivate: [UserRouteAccessService] +}; diff --git a/jhipster/jhipster-uaa/gateway/src/main/webapp/app/account/activate/activate.service.ts b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/account/activate/activate.service.ts new file mode 100644 index 0000000000..0e7297c64d --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/account/activate/activate.service.ts @@ -0,0 +1,16 @@ +import { Injectable } from '@angular/core'; +import { HttpClient, HttpParams } from '@angular/common/http'; +import { Observable } from 'rxjs'; + +import { SERVER_API_URL } from 'app/app.constants'; + +@Injectable({ providedIn: 'root' }) +export class ActivateService { + constructor(private http: HttpClient) {} + + get(key: string): Observable { + return this.http.get(SERVER_API_URL + 'uaa/api/activate', { + params: new HttpParams().set('key', key) + }); + } +} diff --git a/jhipster/jhipster-uaa/gateway/src/main/webapp/app/account/index.ts b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/account/index.ts new file mode 100644 index 0000000000..aeada0551c --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/account/index.ts @@ -0,0 +1,19 @@ +export * from './activate/activate.component'; +export * from './activate/activate.service'; +export * from './activate/activate.route'; +export * from './password/password.component'; +export * from './password/password-strength-bar.component'; +export * from './password/password.service'; +export * from './password/password.route'; +export * from './password-reset/finish/password-reset-finish.component'; +export * from './password-reset/finish/password-reset-finish.service'; +export * from './password-reset/finish/password-reset-finish.route'; +export * from './password-reset/init/password-reset-init.component'; +export * from './password-reset/init/password-reset-init.service'; +export * from './password-reset/init/password-reset-init.route'; +export * from './register/register.component'; +export * from './register/register.service'; +export * from './register/register.route'; +export * from './settings/settings.component'; +export * from './settings/settings.route'; +export * from './account.route'; diff --git a/jhipster/jhipster-uaa/gateway/src/main/webapp/app/account/password-reset/finish/password-reset-finish.component.html b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/account/password-reset/finish/password-reset-finish.component.html new file mode 100644 index 0000000000..bcbc911114 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/account/password-reset/finish/password-reset-finish.component.html @@ -0,0 +1,77 @@ +
+
+
+

Reset password

+ +
+ The password reset key is missing. +
+ +
+

Choose a new password

+
+ +
+

Your password couldn't be reset. Remember a password request is only valid for 24 hours.

+
+ +

+ Your password has been reset. Please + sign in. +

+ +
+ The password and its confirmation do not match! +
+ +
+
+
+ + +
+ + Your password is required. + + + Your password is required to be at least 4 characters. + + + Your password cannot be longer than 50 characters. + +
+ +
+ +
+ + +
+ + Your password confirmation is required. + + + Your password confirmation is required to be at least 4 characters. + + + Your password confirmation cannot be longer than 50 characters. + +
+
+ +
+
+ +
+
+
diff --git a/jhipster/jhipster-uaa/gateway/src/main/webapp/app/account/password-reset/finish/password-reset-finish.component.ts b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/account/password-reset/finish/password-reset-finish.component.ts new file mode 100644 index 0000000000..72aac25c96 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/account/password-reset/finish/password-reset-finish.component.ts @@ -0,0 +1,65 @@ +import { Component, OnInit, AfterViewInit, Renderer, ElementRef } from '@angular/core'; +import { NgbModalRef } from '@ng-bootstrap/ng-bootstrap'; +import { ActivatedRoute } from '@angular/router'; + +import { LoginModalService } from 'app/core'; +import { PasswordResetFinishService } from './password-reset-finish.service'; + +@Component({ + selector: 'jhi-password-reset-finish', + templateUrl: './password-reset-finish.component.html' +}) +export class PasswordResetFinishComponent implements OnInit, AfterViewInit { + confirmPassword: string; + doNotMatch: string; + error: string; + keyMissing: boolean; + resetAccount: any; + success: string; + modalRef: NgbModalRef; + key: string; + + constructor( + private passwordResetFinishService: PasswordResetFinishService, + private loginModalService: LoginModalService, + private route: ActivatedRoute, + private elementRef: ElementRef, + private renderer: Renderer + ) {} + + ngOnInit() { + this.route.queryParams.subscribe(params => { + this.key = params['key']; + }); + this.resetAccount = {}; + this.keyMissing = !this.key; + } + + ngAfterViewInit() { + if (this.elementRef.nativeElement.querySelector('#password') != null) { + this.renderer.invokeElementMethod(this.elementRef.nativeElement.querySelector('#password'), 'focus', []); + } + } + + finishReset() { + this.doNotMatch = null; + this.error = null; + if (this.resetAccount.password !== this.confirmPassword) { + this.doNotMatch = 'ERROR'; + } else { + this.passwordResetFinishService.save({ key: this.key, newPassword: this.resetAccount.password }).subscribe( + () => { + this.success = 'OK'; + }, + () => { + this.success = null; + this.error = 'ERROR'; + } + ); + } + } + + login() { + this.modalRef = this.loginModalService.open(); + } +} diff --git a/jhipster/jhipster-uaa/gateway/src/main/webapp/app/account/password-reset/finish/password-reset-finish.route.ts b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/account/password-reset/finish/password-reset-finish.route.ts new file mode 100644 index 0000000000..686cb972e3 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/account/password-reset/finish/password-reset-finish.route.ts @@ -0,0 +1,12 @@ +import { Route } from '@angular/router'; + +import { PasswordResetFinishComponent } from './password-reset-finish.component'; + +export const passwordResetFinishRoute: Route = { + path: 'reset/finish', + component: PasswordResetFinishComponent, + data: { + authorities: [], + pageTitle: 'global.menu.account.password' + } +}; diff --git a/jhipster/jhipster-uaa/gateway/src/main/webapp/app/account/password-reset/finish/password-reset-finish.service.ts b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/account/password-reset/finish/password-reset-finish.service.ts new file mode 100644 index 0000000000..0e483d882b --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/account/password-reset/finish/password-reset-finish.service.ts @@ -0,0 +1,14 @@ +import { Injectable } from '@angular/core'; +import { HttpClient } from '@angular/common/http'; +import { Observable } from 'rxjs'; + +import { SERVER_API_URL } from 'app/app.constants'; + +@Injectable({ providedIn: 'root' }) +export class PasswordResetFinishService { + constructor(private http: HttpClient) {} + + save(keyAndPassword: any): Observable { + return this.http.post(SERVER_API_URL + 'uaa/api/account/reset-password/finish', keyAndPassword); + } +} diff --git a/jhipster/jhipster-uaa/gateway/src/main/webapp/app/account/password-reset/init/password-reset-init.component.html b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/account/password-reset/init/password-reset-init.component.html new file mode 100644 index 0000000000..8f42e600e2 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/account/password-reset/init/password-reset-init.component.html @@ -0,0 +1,46 @@ +
+
+
+

Reset your password

+ +
+ Email address isn't registered! Please check and try again. +
+ +
+

Enter the email address you used to register.

+
+ +
+

Check your emails for details on how to reset your password.

+
+ +
+
+ + +
+ + Your email is required. + + + Your email is invalid. + + + Your email is required to be at least 5 characters. + + + Your email cannot be longer than 100 characters. + +
+
+ +
+
+
+
diff --git a/jhipster/jhipster-uaa/gateway/src/main/webapp/app/account/password-reset/init/password-reset-init.component.ts b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/account/password-reset/init/password-reset-init.component.ts new file mode 100644 index 0000000000..e32617341c --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/account/password-reset/init/password-reset-init.component.ts @@ -0,0 +1,43 @@ +import { Component, OnInit, AfterViewInit, Renderer, ElementRef } from '@angular/core'; +import { EMAIL_NOT_FOUND_TYPE } from 'app/shared'; +import { PasswordResetInitService } from './password-reset-init.service'; + +@Component({ + selector: 'jhi-password-reset-init', + templateUrl: './password-reset-init.component.html' +}) +export class PasswordResetInitComponent implements OnInit, AfterViewInit { + error: string; + errorEmailNotExists: string; + resetAccount: any; + success: string; + + constructor(private passwordResetInitService: PasswordResetInitService, private elementRef: ElementRef, private renderer: Renderer) {} + + ngOnInit() { + this.resetAccount = {}; + } + + ngAfterViewInit() { + this.renderer.invokeElementMethod(this.elementRef.nativeElement.querySelector('#email'), 'focus', []); + } + + requestReset() { + this.error = null; + this.errorEmailNotExists = null; + + this.passwordResetInitService.save(this.resetAccount.email).subscribe( + () => { + this.success = 'OK'; + }, + response => { + this.success = null; + if (response.status === 400 && response.error.type === EMAIL_NOT_FOUND_TYPE) { + this.errorEmailNotExists = 'ERROR'; + } else { + this.error = 'ERROR'; + } + } + ); + } +} diff --git a/jhipster/jhipster-uaa/gateway/src/main/webapp/app/account/password-reset/init/password-reset-init.route.ts b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/account/password-reset/init/password-reset-init.route.ts new file mode 100644 index 0000000000..6d7da08cd7 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/account/password-reset/init/password-reset-init.route.ts @@ -0,0 +1,12 @@ +import { Route } from '@angular/router'; + +import { PasswordResetInitComponent } from './password-reset-init.component'; + +export const passwordResetInitRoute: Route = { + path: 'reset/request', + component: PasswordResetInitComponent, + data: { + authorities: [], + pageTitle: 'global.menu.account.password' + } +}; diff --git a/jhipster/jhipster-uaa/gateway/src/main/webapp/app/account/password-reset/init/password-reset-init.service.ts b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/account/password-reset/init/password-reset-init.service.ts new file mode 100644 index 0000000000..462eee3f91 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/account/password-reset/init/password-reset-init.service.ts @@ -0,0 +1,14 @@ +import { Injectable } from '@angular/core'; +import { HttpClient } from '@angular/common/http'; +import { Observable } from 'rxjs'; + +import { SERVER_API_URL } from 'app/app.constants'; + +@Injectable({ providedIn: 'root' }) +export class PasswordResetInitService { + constructor(private http: HttpClient) {} + + save(mail: string): Observable { + return this.http.post(SERVER_API_URL + 'uaa/api/account/reset-password/init', mail); + } +} diff --git a/jhipster/jhipster-uaa/gateway/src/main/webapp/app/account/password/password-strength-bar.component.ts b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/account/password/password-strength-bar.component.ts new file mode 100644 index 0000000000..326b5ec888 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/account/password/password-strength-bar.component.ts @@ -0,0 +1,84 @@ +import { Component, ElementRef, Input, Renderer } from '@angular/core'; + +@Component({ + selector: 'jhi-password-strength-bar', + template: ` +
+ Password strength: +
    +
  • +
  • +
  • +
  • +
  • +
+
`, + styleUrls: ['password-strength-bar.scss'] +}) +export class PasswordStrengthBarComponent { + colors = ['#F00', '#F90', '#FF0', '#9F0', '#0F0']; + + constructor(private renderer: Renderer, private elementRef: ElementRef) {} + + measureStrength(p: string): number { + let force = 0; + const regex = /[$-/:-?{-~!"^_`\[\]]/g; // " + const lowerLetters = /[a-z]+/.test(p); + const upperLetters = /[A-Z]+/.test(p); + const numbers = /[0-9]+/.test(p); + const symbols = regex.test(p); + + const flags = [lowerLetters, upperLetters, numbers, symbols]; + const passedMatches = flags.filter((isMatchedFlag: boolean) => { + return isMatchedFlag === true; + }).length; + + force += 2 * p.length + (p.length >= 10 ? 1 : 0); + force += passedMatches * 10; + + // penality (short password) + force = p.length <= 6 ? Math.min(force, 10) : force; + + // penality (poor variety of characters) + force = passedMatches === 1 ? Math.min(force, 10) : force; + force = passedMatches === 2 ? Math.min(force, 20) : force; + force = passedMatches === 3 ? Math.min(force, 40) : force; + + return force; + } + + getColor(s: number): any { + let idx = 0; + if (s <= 10) { + idx = 0; + } else if (s <= 20) { + idx = 1; + } else if (s <= 30) { + idx = 2; + } else if (s <= 40) { + idx = 3; + } else { + idx = 4; + } + return { idx: idx + 1, col: this.colors[idx] }; + } + + @Input() + set passwordToCheck(password: string) { + if (password) { + const c = this.getColor(this.measureStrength(password)); + const element = this.elementRef.nativeElement; + if (element.className) { + this.renderer.setElementClass(element, element.className, false); + } + const lis = element.getElementsByTagName('li'); + for (let i = 0; i < lis.length; i++) { + if (i < c.idx) { + this.renderer.setElementStyle(lis[i], 'backgroundColor', c.col); + } else { + this.renderer.setElementStyle(lis[i], 'backgroundColor', '#DDD'); + } + } + } + } +} diff --git a/jhipster/jhipster-uaa/gateway/src/main/webapp/app/account/password/password-strength-bar.scss b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/account/password/password-strength-bar.scss new file mode 100644 index 0000000000..9744b9b784 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/account/password/password-strength-bar.scss @@ -0,0 +1,23 @@ +/* ========================================================================== +start Password strength bar style +========================================================================== */ +ul#strength { + display: inline; + list-style: none; + margin: 0; + margin-left: 15px; + padding: 0; + vertical-align: 2px; +} + +.point { + background: #ddd; + border-radius: 2px; + display: inline-block; + height: 5px; + margin-right: 1px; + width: 20px; + &:last-child { + margin: 0 !important; + } +} diff --git a/jhipster/jhipster-uaa/gateway/src/main/webapp/app/account/password/password.component.html b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/account/password/password.component.html new file mode 100644 index 0000000000..fafe672d8b --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/account/password/password.component.html @@ -0,0 +1,77 @@ +
+
+
+

Password for [{{account.login}}]

+ +
+ Password changed! +
+
+ An error has occurred! The password could not be changed. +
+ +
+ The password and its confirmation do not match! +
+ +
+ +
+ + +
+ + Your password is required. + +
+
+
+ + +
+ + Your password is required. + + + Your password is required to be at least 4 characters. + + + Your password cannot be longer than 50 characters. + +
+ +
+
+ + +
+ + Your confirmation password is required. + + + Your confirmation password is required to be at least 4 characters. + + + Your confirmation password cannot be longer than 50 characters. + +
+
+ + +
+
+
+
diff --git a/jhipster/jhipster-uaa/gateway/src/main/webapp/app/account/password/password.component.ts b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/account/password/password.component.ts new file mode 100644 index 0000000000..64d4d87f00 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/account/password/password.component.ts @@ -0,0 +1,46 @@ +import { Component, OnInit } from '@angular/core'; + +import { Principal } from 'app/core'; +import { PasswordService } from './password.service'; + +@Component({ + selector: 'jhi-password', + templateUrl: './password.component.html' +}) +export class PasswordComponent implements OnInit { + doNotMatch: string; + error: string; + success: string; + account: any; + currentPassword: string; + newPassword: string; + confirmPassword: string; + + constructor(private passwordService: PasswordService, private principal: Principal) {} + + ngOnInit() { + this.principal.identity().then(account => { + this.account = account; + }); + } + + changePassword() { + if (this.newPassword !== this.confirmPassword) { + this.error = null; + this.success = null; + this.doNotMatch = 'ERROR'; + } else { + this.doNotMatch = null; + this.passwordService.save(this.newPassword, this.currentPassword).subscribe( + () => { + this.error = null; + this.success = 'OK'; + }, + () => { + this.success = null; + this.error = 'ERROR'; + } + ); + } + } +} diff --git a/jhipster/jhipster-uaa/gateway/src/main/webapp/app/account/password/password.route.ts b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/account/password/password.route.ts new file mode 100644 index 0000000000..2a6ec475ed --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/account/password/password.route.ts @@ -0,0 +1,14 @@ +import { Route } from '@angular/router'; + +import { UserRouteAccessService } from 'app/core'; +import { PasswordComponent } from './password.component'; + +export const passwordRoute: Route = { + path: 'password', + component: PasswordComponent, + data: { + authorities: ['ROLE_USER'], + pageTitle: 'global.menu.account.password' + }, + canActivate: [UserRouteAccessService] +}; diff --git a/jhipster/jhipster-uaa/gateway/src/main/webapp/app/account/password/password.service.ts b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/account/password/password.service.ts new file mode 100644 index 0000000000..b93ab26d33 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/account/password/password.service.ts @@ -0,0 +1,14 @@ +import { Injectable } from '@angular/core'; +import { HttpClient } from '@angular/common/http'; +import { Observable } from 'rxjs'; + +import { SERVER_API_URL } from 'app/app.constants'; + +@Injectable({ providedIn: 'root' }) +export class PasswordService { + constructor(private http: HttpClient) {} + + save(newPassword: string, currentPassword: string): Observable { + return this.http.post(SERVER_API_URL + 'uaa/api/account/change-password', { currentPassword, newPassword }); + } +} diff --git a/jhipster/jhipster-uaa/gateway/src/main/webapp/app/account/register/register.component.html b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/account/register/register.component.html new file mode 100644 index 0000000000..fd5c89e2de --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/account/register/register.component.html @@ -0,0 +1,124 @@ +
+
+
+

Registration

+ +
+ Registration saved! Please check your email for confirmation. +
+ +
+ Registration failed! Please try again later. +
+ +
+ Login name already registered! Please choose another one. +
+ +
+ Email is already in use! Please choose another one. +
+ +
+ The password and its confirmation do not match! +
+
+
+
+
+
+
+ + +
+ + Your username is required. + + + Your username is required to be at least 1 character. + + + Your username cannot be longer than 50 characters. + + + Your username can only contain letters and digits. + +
+
+
+ + +
+ + Your email is required. + + + Your email is invalid. + + + Your email is required to be at least 5 characters. + + + Your email cannot be longer than 100 characters. + +
+
+
+ + +
+ + Your password is required. + + + Your password is required to be at least 4 characters. + + + Your password cannot be longer than 50 characters. + +
+ +
+
+ + +
+ + Your confirmation password is required. + + + Your confirmation password is required to be at least 4 characters. + + + Your confirmation password cannot be longer than 50 characters. + +
+
+ + +
+

+
+ If you want to + sign in, you can try the default accounts:
- Administrator (login="admin" and password="admin")
- User (login="user" and password="user").
+
+
+
+
diff --git a/jhipster/jhipster-uaa/gateway/src/main/webapp/app/account/register/register.component.ts b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/account/register/register.component.ts new file mode 100644 index 0000000000..de97a880df --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/account/register/register.component.ts @@ -0,0 +1,75 @@ +import { Component, OnInit, AfterViewInit, Renderer, ElementRef } from '@angular/core'; +import { HttpErrorResponse } from '@angular/common/http'; +import { NgbModalRef } from '@ng-bootstrap/ng-bootstrap'; +import { JhiLanguageService } from 'ng-jhipster'; + +import { EMAIL_ALREADY_USED_TYPE, LOGIN_ALREADY_USED_TYPE } from 'app/shared'; +import { LoginModalService } from 'app/core'; +import { Register } from './register.service'; + +@Component({ + selector: 'jhi-register', + templateUrl: './register.component.html' +}) +export class RegisterComponent implements OnInit, AfterViewInit { + confirmPassword: string; + doNotMatch: string; + error: string; + errorEmailExists: string; + errorUserExists: string; + registerAccount: any; + success: boolean; + modalRef: NgbModalRef; + + constructor( + private languageService: JhiLanguageService, + private loginModalService: LoginModalService, + private registerService: Register, + private elementRef: ElementRef, + private renderer: Renderer + ) {} + + ngOnInit() { + this.success = false; + this.registerAccount = {}; + } + + ngAfterViewInit() { + this.renderer.invokeElementMethod(this.elementRef.nativeElement.querySelector('#login'), 'focus', []); + } + + register() { + if (this.registerAccount.password !== this.confirmPassword) { + this.doNotMatch = 'ERROR'; + } else { + this.doNotMatch = null; + this.error = null; + this.errorUserExists = null; + this.errorEmailExists = null; + this.languageService.getCurrent().then(key => { + this.registerAccount.langKey = key; + this.registerService.save(this.registerAccount).subscribe( + () => { + this.success = true; + }, + response => this.processError(response) + ); + }); + } + } + + openLogin() { + this.modalRef = this.loginModalService.open(); + } + + private processError(response: HttpErrorResponse) { + this.success = null; + if (response.status === 400 && response.error.type === LOGIN_ALREADY_USED_TYPE) { + this.errorUserExists = 'ERROR'; + } else if (response.status === 400 && response.error.type === EMAIL_ALREADY_USED_TYPE) { + this.errorEmailExists = 'ERROR'; + } else { + this.error = 'ERROR'; + } + } +} diff --git a/jhipster/jhipster-uaa/gateway/src/main/webapp/app/account/register/register.route.ts b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/account/register/register.route.ts new file mode 100644 index 0000000000..ca834d5d58 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/account/register/register.route.ts @@ -0,0 +1,12 @@ +import { Route } from '@angular/router'; + +import { RegisterComponent } from './register.component'; + +export const registerRoute: Route = { + path: 'register', + component: RegisterComponent, + data: { + authorities: [], + pageTitle: 'register.title' + } +}; diff --git a/jhipster/jhipster-uaa/gateway/src/main/webapp/app/account/register/register.service.ts b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/account/register/register.service.ts new file mode 100644 index 0000000000..e9b14c42ba --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/account/register/register.service.ts @@ -0,0 +1,14 @@ +import { Injectable } from '@angular/core'; +import { HttpClient } from '@angular/common/http'; +import { Observable } from 'rxjs'; + +import { SERVER_API_URL } from 'app/app.constants'; + +@Injectable({ providedIn: 'root' }) +export class Register { + constructor(private http: HttpClient) {} + + save(account: any): Observable { + return this.http.post(SERVER_API_URL + 'uaa/api/register', account); + } +} diff --git a/jhipster/jhipster-uaa/gateway/src/main/webapp/app/account/settings/settings.component.html b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/account/settings/settings.component.html new file mode 100644 index 0000000000..b0c114b819 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/account/settings/settings.component.html @@ -0,0 +1,86 @@ +
+
+
+

User settings for [{{settingsAccount.login}}]

+ +
+ Settings saved! +
+ + + +
+ +
+ + +
+ + Your first name is required. + + + Your first name is required to be at least 1 character. + + + Your first name cannot be longer than 50 characters. + +
+
+
+ + +
+ + Your last name is required. + + + Your last name is required to be at least 1 character. + + + Your last name cannot be longer than 50 characters. + +
+
+
+ + +
+ + Your email is required. + + + Your email is invalid. + + + Your email is required to be at least 5 characters. + + + Your email cannot be longer than 100 characters. + +
+
+
+ + +
+ +
+
+
+ +
diff --git a/jhipster/jhipster-uaa/gateway/src/main/webapp/app/account/settings/settings.component.ts b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/account/settings/settings.component.ts new file mode 100644 index 0000000000..1b5b88b626 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/account/settings/settings.component.ts @@ -0,0 +1,64 @@ +import { Component, OnInit } from '@angular/core'; +import { JhiLanguageService } from 'ng-jhipster'; + +import { Principal, AccountService, JhiLanguageHelper } from 'app/core'; + +@Component({ + selector: 'jhi-settings', + templateUrl: './settings.component.html' +}) +export class SettingsComponent implements OnInit { + error: string; + success: string; + settingsAccount: any; + languages: any[]; + + constructor( + private account: AccountService, + private principal: Principal, + private languageService: JhiLanguageService, + private languageHelper: JhiLanguageHelper + ) {} + + ngOnInit() { + this.principal.identity().then(account => { + this.settingsAccount = this.copyAccount(account); + }); + this.languageHelper.getAll().then(languages => { + this.languages = languages; + }); + } + + save() { + this.account.save(this.settingsAccount).subscribe( + () => { + this.error = null; + this.success = 'OK'; + this.principal.identity(true).then(account => { + this.settingsAccount = this.copyAccount(account); + }); + this.languageService.getCurrent().then(current => { + if (this.settingsAccount.langKey !== current) { + this.languageService.changeLanguage(this.settingsAccount.langKey); + } + }); + }, + () => { + this.success = null; + this.error = 'ERROR'; + } + ); + } + + copyAccount(account) { + return { + activated: account.activated, + email: account.email, + firstName: account.firstName, + langKey: account.langKey, + lastName: account.lastName, + login: account.login, + imageUrl: account.imageUrl + }; + } +} diff --git a/jhipster/jhipster-uaa/gateway/src/main/webapp/app/account/settings/settings.route.ts b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/account/settings/settings.route.ts new file mode 100644 index 0000000000..95c2de6e0f --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/account/settings/settings.route.ts @@ -0,0 +1,14 @@ +import { Route } from '@angular/router'; + +import { UserRouteAccessService } from 'app/core'; +import { SettingsComponent } from './settings.component'; + +export const settingsRoute: Route = { + path: 'settings', + component: SettingsComponent, + data: { + authorities: ['ROLE_USER'], + pageTitle: 'global.menu.account.settings' + }, + canActivate: [UserRouteAccessService] +}; diff --git a/jhipster/jhipster-uaa/gateway/src/main/webapp/app/admin/admin.module.ts b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/admin/admin.module.ts new file mode 100644 index 0000000000..3ecbaa49ff --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/admin/admin.module.ts @@ -0,0 +1,57 @@ +import { NgModule, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core'; +import { RouterModule } from '@angular/router'; +import { JhiLanguageService } from 'ng-jhipster'; +import { JhiLanguageHelper } from 'app/core'; +import { GatewaySharedModule } from 'app/shared'; +/* jhipster-needle-add-admin-module-import - JHipster will add admin modules imports here */ + +import { + adminState, + AuditsComponent, + UserMgmtComponent, + UserMgmtDetailComponent, + UserMgmtUpdateComponent, + UserMgmtDeleteDialogComponent, + LogsComponent, + JhiMetricsMonitoringModalComponent, + JhiMetricsMonitoringComponent, + JhiHealthModalComponent, + JhiHealthCheckComponent, + JhiConfigurationComponent, + JhiDocsComponent, + JhiGatewayComponent +} from './'; + +@NgModule({ + imports: [ + GatewaySharedModule, + RouterModule.forChild(adminState) + /* jhipster-needle-add-admin-module - JHipster will add admin modules here */ + ], + declarations: [ + AuditsComponent, + UserMgmtComponent, + UserMgmtDetailComponent, + UserMgmtUpdateComponent, + UserMgmtDeleteDialogComponent, + LogsComponent, + JhiConfigurationComponent, + JhiHealthCheckComponent, + JhiHealthModalComponent, + JhiDocsComponent, + JhiGatewayComponent, + JhiMetricsMonitoringComponent, + JhiMetricsMonitoringModalComponent + ], + entryComponents: [UserMgmtDeleteDialogComponent, JhiHealthModalComponent, JhiMetricsMonitoringModalComponent], + schemas: [CUSTOM_ELEMENTS_SCHEMA] +}) +export class GatewayAdminModule { + constructor(private languageService: JhiLanguageService, private languageHelper: JhiLanguageHelper) { + this.languageHelper.language.subscribe((languageKey: string) => { + if (languageKey !== undefined) { + this.languageService.changeLanguage(languageKey); + } + }); + } +} diff --git a/jhipster/jhipster-uaa/gateway/src/main/webapp/app/admin/admin.route.ts b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/admin/admin.route.ts new file mode 100644 index 0000000000..79fb15cf7a --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/admin/admin.route.ts @@ -0,0 +1,18 @@ +import { Routes } from '@angular/router'; + +import { auditsRoute, configurationRoute, docsRoute, healthRoute, logsRoute, metricsRoute, gatewayRoute, userMgmtRoute } from './'; + +import { UserRouteAccessService } from 'app/core'; + +const ADMIN_ROUTES = [auditsRoute, configurationRoute, docsRoute, healthRoute, logsRoute, gatewayRoute, ...userMgmtRoute, metricsRoute]; + +export const adminState: Routes = [ + { + path: '', + data: { + authorities: ['ROLE_ADMIN'] + }, + canActivate: [UserRouteAccessService], + children: ADMIN_ROUTES + } +]; diff --git a/jhipster/jhipster-uaa/gateway/src/main/webapp/app/admin/audits/audit-data.model.ts b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/admin/audits/audit-data.model.ts new file mode 100644 index 0000000000..a2506c4090 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/admin/audits/audit-data.model.ts @@ -0,0 +1,3 @@ +export class AuditData { + constructor(public remoteAddress: string, public sessionId: string) {} +} diff --git a/jhipster/jhipster-uaa/gateway/src/main/webapp/app/admin/audits/audit.model.ts b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/admin/audits/audit.model.ts new file mode 100644 index 0000000000..6497fb444e --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/admin/audits/audit.model.ts @@ -0,0 +1,5 @@ +import { AuditData } from './audit-data.model'; + +export class Audit { + constructor(public data: AuditData, public principal: string, public timestamp: string, public type: string) {} +} diff --git a/jhipster/jhipster-uaa/gateway/src/main/webapp/app/admin/audits/audits.component.html b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/admin/audits/audits.component.html new file mode 100644 index 0000000000..e55799e91e --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/admin/audits/audits.component.html @@ -0,0 +1,52 @@ +
+

Audits

+ +
+
+

Filter by date

+
+
+ from +
+ + +
+ To +
+ +
+
+
+ +
+ + + + + + + + + + + + + + + + + +
DateUserStateExtra data
{{audit.timestamp| date:'medium'}}{{audit.principal}}{{audit.type}} + {{audit.data.message}} + Remote Address {{audit.data.remoteAddress}} +
+
+
+
+ +
+
+ +
+
+
diff --git a/jhipster/jhipster-uaa/gateway/src/main/webapp/app/admin/audits/audits.component.ts b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/admin/audits/audits.component.ts new file mode 100644 index 0000000000..bda472d634 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/admin/audits/audits.component.ts @@ -0,0 +1,128 @@ +import { Component, OnInit, OnDestroy } from '@angular/core'; +import { HttpResponse } from '@angular/common/http'; +import { DatePipe } from '@angular/common'; +import { ActivatedRoute, Router } from '@angular/router'; +import { JhiParseLinks, JhiAlertService } from 'ng-jhipster'; + +import { ITEMS_PER_PAGE } from 'app/shared'; +import { Audit } from './audit.model'; +import { AuditsService } from './audits.service'; + +@Component({ + selector: 'jhi-audit', + templateUrl: './audits.component.html' +}) +export class AuditsComponent implements OnInit, OnDestroy { + audits: Audit[]; + fromDate: string; + itemsPerPage: any; + links: any; + queryCount: number; + page: number; + routeData: any; + predicate: any; + previousPage: any; + reverse: boolean; + toDate: string; + totalItems: number; + + constructor( + private auditsService: AuditsService, + private alertService: JhiAlertService, + private parseLinks: JhiParseLinks, + private activatedRoute: ActivatedRoute, + private datePipe: DatePipe, + private router: Router + ) { + this.itemsPerPage = ITEMS_PER_PAGE; + this.routeData = this.activatedRoute.data.subscribe(data => { + this.page = data['pagingParams'].page; + this.previousPage = data['pagingParams'].page; + this.reverse = data['pagingParams'].ascending; + this.predicate = data['pagingParams'].predicate; + }); + } + + ngOnInit() { + this.today(); + this.previousMonth(); + this.loadAll(); + } + + ngOnDestroy() { + this.routeData.unsubscribe(); + } + + previousMonth() { + const dateFormat = 'yyyy-MM-dd'; + let fromDate: Date = new Date(); + + if (fromDate.getMonth() === 0) { + fromDate = new Date(fromDate.getFullYear() - 1, 11, fromDate.getDate()); + } else { + fromDate = new Date(fromDate.getFullYear(), fromDate.getMonth() - 1, fromDate.getDate()); + } + + this.fromDate = this.datePipe.transform(fromDate, dateFormat); + } + + today() { + const dateFormat = 'yyyy-MM-dd'; + // Today + 1 day - needed if the current day must be included + const today: Date = new Date(); + today.setDate(today.getDate() + 1); + const date = new Date(today.getFullYear(), today.getMonth(), today.getDate()); + this.toDate = this.datePipe.transform(date, dateFormat); + } + + loadAll() { + this.auditsService + .query({ + page: this.page - 1, + size: this.itemsPerPage, + sort: this.sort(), + fromDate: this.fromDate, + toDate: this.toDate + }) + .subscribe( + (res: HttpResponse) => this.onSuccess(res.body, res.headers), + (res: HttpResponse) => this.onError(res.body) + ); + } + + sort() { + const result = [this.predicate + ',' + (this.reverse ? 'asc' : 'desc')]; + if (this.predicate !== 'id') { + result.push('id'); + } + return result; + } + + loadPage(page: number) { + if (page !== this.previousPage) { + this.previousPage = page; + this.transition(); + } + } + + transition() { + this.router.navigate(['/admin/audits'], { + queryParams: { + page: this.page, + sort: this.predicate + ',' + (this.reverse ? 'asc' : 'desc') + } + }); + this.loadAll(); + } + + private onSuccess(data, headers) { + this.links = this.parseLinks.parse(headers.get('link')); + this.totalItems = headers.get('X-Total-Count'); + this.queryCount = this.totalItems; + this.audits = data; + } + + private onError(error) { + this.alertService.error(error.error, error.message, null); + } +} diff --git a/jhipster/jhipster-uaa/gateway/src/main/webapp/app/admin/audits/audits.route.ts b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/admin/audits/audits.route.ts new file mode 100644 index 0000000000..9c161dca4a --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/admin/audits/audits.route.ts @@ -0,0 +1,17 @@ +import { Injectable } from '@angular/core'; +import { Resolve, ActivatedRouteSnapshot, RouterStateSnapshot, Route } from '@angular/router'; +import { JhiPaginationUtil, JhiResolvePagingParams } from 'ng-jhipster'; + +import { AuditsComponent } from './audits.component'; + +export const auditsRoute: Route = { + path: 'audits', + component: AuditsComponent, + resolve: { + pagingParams: JhiResolvePagingParams + }, + data: { + pageTitle: 'audits.title', + defaulSort: 'auditEventDate,desc' + } +}; diff --git a/jhipster/jhipster-uaa/gateway/src/main/webapp/app/admin/audits/audits.service.ts b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/admin/audits/audits.service.ts new file mode 100644 index 0000000000..fba5285b6e --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/admin/audits/audits.service.ts @@ -0,0 +1,25 @@ +import { Injectable } from '@angular/core'; +import { HttpClient, HttpParams, HttpResponse } from '@angular/common/http'; +import { Observable } from 'rxjs'; + +import { createRequestOption } from 'app/shared'; +import { SERVER_API_URL } from 'app/app.constants'; +import { Audit } from './audit.model'; + +@Injectable({ providedIn: 'root' }) +export class AuditsService { + constructor(private http: HttpClient) {} + + query(req: any): Observable> { + const params: HttpParams = createRequestOption(req); + params.set('fromDate', req.fromDate); + params.set('toDate', req.toDate); + + const requestURL = SERVER_API_URL + 'uaa/management/audits'; + + return this.http.get(requestURL, { + params, + observe: 'response' + }); + } +} diff --git a/jhipster/jhipster-uaa/gateway/src/main/webapp/app/admin/configuration/configuration.component.html b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/admin/configuration/configuration.component.html new file mode 100644 index 0000000000..c95775a0ab --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/admin/configuration/configuration.component.html @@ -0,0 +1,46 @@ +
+

Configuration

+ + Filter (by prefix) +

Spring configuration

+ + + + + + + + + + + + + +
PrefixProperties
{{entry.prefix}} +
+
{{key}}
+
+ {{entry.properties[key] | json}} +
+
+
+
+

{{key}}

+ + + + + + + + + + + + + +
PropertyValue
{{item.key}} + {{item.val}} +
+
+
diff --git a/jhipster/jhipster-uaa/gateway/src/main/webapp/app/admin/configuration/configuration.component.ts b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/admin/configuration/configuration.component.ts new file mode 100644 index 0000000000..6867210c91 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/admin/configuration/configuration.component.ts @@ -0,0 +1,43 @@ +import { Component, OnInit } from '@angular/core'; + +import { JhiConfigurationService } from './configuration.service'; + +@Component({ + selector: 'jhi-configuration', + templateUrl: './configuration.component.html' +}) +export class JhiConfigurationComponent implements OnInit { + allConfiguration: any = null; + configuration: any = null; + configKeys: any[]; + filter: string; + orderProp: string; + reverse: boolean; + + constructor(private configurationService: JhiConfigurationService) { + this.configKeys = []; + this.filter = ''; + this.orderProp = 'prefix'; + this.reverse = false; + } + + keys(dict): Array { + return dict === undefined ? [] : Object.keys(dict); + } + + ngOnInit() { + this.configurationService.get().subscribe(configuration => { + this.configuration = configuration; + + for (const config of configuration) { + if (config.properties !== undefined) { + this.configKeys.push(Object.keys(config.properties)); + } + } + }); + + this.configurationService.getEnv().subscribe(configuration => { + this.allConfiguration = configuration; + }); + } +} diff --git a/jhipster/jhipster-uaa/gateway/src/main/webapp/app/admin/configuration/configuration.route.ts b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/admin/configuration/configuration.route.ts new file mode 100644 index 0000000000..1ff61dfa57 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/admin/configuration/configuration.route.ts @@ -0,0 +1,11 @@ +import { Route } from '@angular/router'; + +import { JhiConfigurationComponent } from './configuration.component'; + +export const configurationRoute: Route = { + path: 'jhi-configuration', + component: JhiConfigurationComponent, + data: { + pageTitle: 'configuration.title' + } +}; diff --git a/jhipster/jhipster-uaa/gateway/src/main/webapp/app/admin/configuration/configuration.service.ts b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/admin/configuration/configuration.service.ts new file mode 100644 index 0000000000..cd6ba93766 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/admin/configuration/configuration.service.ts @@ -0,0 +1,67 @@ +import { Injectable } from '@angular/core'; +import { HttpClient, HttpResponse } from '@angular/common/http'; +import { Observable } from 'rxjs'; +import { map } from 'rxjs/operators'; + +import { SERVER_API_URL } from 'app/app.constants'; + +@Injectable({ providedIn: 'root' }) +export class JhiConfigurationService { + constructor(private http: HttpClient) {} + + get(): Observable { + return this.http.get(SERVER_API_URL + 'management/configprops', { observe: 'response' }).pipe( + map((res: HttpResponse) => { + const properties: any[] = []; + const propertiesObject = this.getConfigPropertiesObjects(res.body); + for (const key in propertiesObject) { + if (propertiesObject.hasOwnProperty(key)) { + properties.push(propertiesObject[key]); + } + } + + return properties.sort((propertyA, propertyB) => { + return propertyA.prefix === propertyB.prefix ? 0 : propertyA.prefix < propertyB.prefix ? -1 : 1; + }); + }) + ); + } + + getConfigPropertiesObjects(res: Object) { + // This code is for Spring Boot 2 + if (res['contexts'] !== undefined) { + for (const key in res['contexts']) { + // If the key is not bootstrap, it will be the ApplicationContext Id + // For default app, it is baseName + // For microservice, it is baseName-1 + if (!key.startsWith('bootstrap')) { + return res['contexts'][key]['beans']; + } + } + } + // by default, use the default ApplicationContext Id + return res['contexts']['gateway']['beans']; + } + + getEnv(): Observable { + return this.http.get(SERVER_API_URL + 'management/env', { observe: 'response' }).pipe( + map((res: HttpResponse) => { + const properties: any = {}; + const propertySources = res.body['propertySources']; + + for (const propertyObject of propertySources) { + const name = propertyObject['name']; + const detailProperties = propertyObject['properties']; + const vals: any[] = []; + for (const keyDetail in detailProperties) { + if (detailProperties.hasOwnProperty(keyDetail)) { + vals.push({ key: keyDetail, val: detailProperties[keyDetail]['value'] }); + } + } + properties[name] = vals; + } + return properties; + }) + ); + } +} diff --git a/jhipster/jhipster-uaa/gateway/src/main/webapp/app/admin/docs/docs.component.html b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/admin/docs/docs.component.html new file mode 100644 index 0000000000..30efbbb93e --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/admin/docs/docs.component.html @@ -0,0 +1,2 @@ + diff --git a/jhipster/jhipster-uaa/gateway/src/main/webapp/app/admin/docs/docs.component.ts b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/admin/docs/docs.component.ts new file mode 100644 index 0000000000..b338e7c3a6 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/admin/docs/docs.component.ts @@ -0,0 +1,9 @@ +import { Component } from '@angular/core'; + +@Component({ + selector: 'jhi-docs', + templateUrl: './docs.component.html' +}) +export class JhiDocsComponent { + constructor() {} +} diff --git a/jhipster/jhipster-uaa/gateway/src/main/webapp/app/admin/docs/docs.route.ts b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/admin/docs/docs.route.ts new file mode 100644 index 0000000000..9a3a3f80c2 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/admin/docs/docs.route.ts @@ -0,0 +1,11 @@ +import { Route } from '@angular/router'; + +import { JhiDocsComponent } from './docs.component'; + +export const docsRoute: Route = { + path: 'docs', + component: JhiDocsComponent, + data: { + pageTitle: 'global.menu.admin.apidocs' + } +}; diff --git a/jhipster/jhipster-uaa/gateway/src/main/webapp/app/admin/gateway/gateway-route.model.ts b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/admin/gateway/gateway-route.model.ts new file mode 100644 index 0000000000..d8a304ea3c --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/admin/gateway/gateway-route.model.ts @@ -0,0 +1,3 @@ +export class GatewayRoute { + constructor(public path: string, public serviceId: string, public serviceInstances: any[]) {} +} diff --git a/jhipster/jhipster-uaa/gateway/src/main/webapp/app/admin/gateway/gateway-routes.service.ts b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/admin/gateway/gateway-routes.service.ts new file mode 100644 index 0000000000..ad3a2eee5c --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/admin/gateway/gateway-routes.service.ts @@ -0,0 +1,15 @@ +import { Injectable } from '@angular/core'; +import { HttpClient } from '@angular/common/http'; +import { Observable } from 'rxjs'; + +import { SERVER_API_URL } from 'app/app.constants'; +import { GatewayRoute } from './gateway-route.model'; + +@Injectable() +export class GatewayRoutesService { + constructor(private http: HttpClient) {} + + findAll(): Observable { + return this.http.get(SERVER_API_URL + 'api/gateway/routes/'); + } +} diff --git a/jhipster/jhipster-uaa/gateway/src/main/webapp/app/admin/gateway/gateway.component.html b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/admin/gateway/gateway.component.html new file mode 100644 index 0000000000..7154c4b3b7 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/admin/gateway/gateway.component.html @@ -0,0 +1,50 @@ +
+

+ Gateway + +

+

Current routes

+
+ + + + + + + + + + + + + + + +
URLServiceAvailable servers
{{route.path}}{{route.serviceId}} +
+ Warning: no server available! +
+
+ + + + + + +
{{instance.uri}} +
{{instance.instanceInfo.status}}
+
?
+
+ + + {{entry.key}} + {{entry.value}} + + +
+
+
+
+
diff --git a/jhipster/jhipster-uaa/gateway/src/main/webapp/app/admin/gateway/gateway.component.ts b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/admin/gateway/gateway.component.ts new file mode 100644 index 0000000000..55bc9cc42f --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/admin/gateway/gateway.component.ts @@ -0,0 +1,28 @@ +import { Component, OnInit } from '@angular/core'; + +import { GatewayRoutesService } from './gateway-routes.service'; +import { GatewayRoute } from './gateway-route.model'; + +@Component({ + selector: 'jhi-gateway', + templateUrl: './gateway.component.html', + providers: [GatewayRoutesService] +}) +export class JhiGatewayComponent implements OnInit { + gatewayRoutes: GatewayRoute[]; + updatingRoutes: Boolean; + + constructor(private gatewayRoutesService: GatewayRoutesService) {} + + ngOnInit() { + this.refresh(); + } + + refresh() { + this.updatingRoutes = true; + this.gatewayRoutesService.findAll().subscribe(gatewayRoutes => { + this.gatewayRoutes = gatewayRoutes; + this.updatingRoutes = false; + }); + } +} diff --git a/jhipster/jhipster-uaa/gateway/src/main/webapp/app/admin/gateway/gateway.route.ts b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/admin/gateway/gateway.route.ts new file mode 100644 index 0000000000..fffcd6a8a8 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/admin/gateway/gateway.route.ts @@ -0,0 +1,11 @@ +import { Route } from '@angular/router'; + +import { JhiGatewayComponent } from './gateway.component'; + +export const gatewayRoute: Route = { + path: 'gateway', + component: JhiGatewayComponent, + data: { + pageTitle: 'gateway.title' + } +}; diff --git a/jhipster/jhipster-uaa/gateway/src/main/webapp/app/admin/health/health-modal.component.html b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/admin/health/health-modal.component.html new file mode 100644 index 0000000000..4f698460d0 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/admin/health/health-modal.component.html @@ -0,0 +1,36 @@ + + + diff --git a/jhipster/jhipster-uaa/gateway/src/main/webapp/app/admin/health/health-modal.component.ts b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/admin/health/health-modal.component.ts new file mode 100644 index 0000000000..28128bf321 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/admin/health/health-modal.component.ts @@ -0,0 +1,41 @@ +import { Component } from '@angular/core'; +import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap'; + +import { JhiHealthService } from './health.service'; + +@Component({ + selector: 'jhi-health-modal', + templateUrl: './health-modal.component.html' +}) +export class JhiHealthModalComponent { + currentHealth: any; + + constructor(private healthService: JhiHealthService, public activeModal: NgbActiveModal) {} + + baseName(name) { + return this.healthService.getBaseName(name); + } + + subSystemName(name) { + return this.healthService.getSubSystemName(name); + } + + readableValue(value: number) { + if (this.currentHealth.name === 'diskSpace') { + // Should display storage space in an human readable unit + const val = value / 1073741824; + if (val > 1) { + // Value + return val.toFixed(2) + ' GB'; + } else { + return (value / 1048576).toFixed(2) + ' MB'; + } + } + + if (typeof value === 'object') { + return JSON.stringify(value); + } else { + return value.toString(); + } + } +} diff --git a/jhipster/jhipster-uaa/gateway/src/main/webapp/app/admin/health/health.component.html b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/admin/health/health.component.html new file mode 100644 index 0000000000..c17bde9af1 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/admin/health/health.component.html @@ -0,0 +1,34 @@ +
+

+ Health Checks + +

+
+ + + + + + + + + + + + + + + +
Service NameStatusDetails
{{'health.indicator.' + baseName(health.name) | translate}} {{subSystemName(health.name)}} + + {{health.status}} + + + + + +
+
+
diff --git a/jhipster/jhipster-uaa/gateway/src/main/webapp/app/admin/health/health.component.ts b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/admin/health/health.component.ts new file mode 100644 index 0000000000..ada3ef62f4 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/admin/health/health.component.ts @@ -0,0 +1,66 @@ +import { Component, OnInit } from '@angular/core'; +import { NgbModal } from '@ng-bootstrap/ng-bootstrap'; + +import { JhiHealthService } from './health.service'; +import { JhiHealthModalComponent } from './health-modal.component'; + +@Component({ + selector: 'jhi-health', + templateUrl: './health.component.html' +}) +export class JhiHealthCheckComponent implements OnInit { + healthData: any; + updatingHealth: boolean; + + constructor(private modalService: NgbModal, private healthService: JhiHealthService) {} + + ngOnInit() { + this.refresh(); + } + + baseName(name: string) { + return this.healthService.getBaseName(name); + } + + getBadgeClass(statusState) { + if (statusState === 'UP') { + return 'badge-success'; + } else { + return 'badge-danger'; + } + } + + refresh() { + this.updatingHealth = true; + + this.healthService.checkHealth().subscribe( + health => { + this.healthData = this.healthService.transformHealthData(health); + this.updatingHealth = false; + }, + error => { + if (error.status === 503) { + this.healthData = this.healthService.transformHealthData(error.error); + this.updatingHealth = false; + } + } + ); + } + + showHealth(health: any) { + const modalRef = this.modalService.open(JhiHealthModalComponent); + modalRef.componentInstance.currentHealth = health; + modalRef.result.then( + result => { + // Left blank intentionally, nothing to do here + }, + reason => { + // Left blank intentionally, nothing to do here + } + ); + } + + subSystemName(name: string) { + return this.healthService.getSubSystemName(name); + } +} diff --git a/jhipster/jhipster-uaa/gateway/src/main/webapp/app/admin/health/health.route.ts b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/admin/health/health.route.ts new file mode 100644 index 0000000000..df801e0c0e --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/admin/health/health.route.ts @@ -0,0 +1,11 @@ +import { Route } from '@angular/router'; + +import { JhiHealthCheckComponent } from './health.component'; + +export const healthRoute: Route = { + path: 'jhi-health', + component: JhiHealthCheckComponent, + data: { + pageTitle: 'health.title' + } +}; diff --git a/jhipster/jhipster-uaa/gateway/src/main/webapp/app/admin/health/health.service.ts b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/admin/health/health.service.ts new file mode 100644 index 0000000000..4c1b0e5ec8 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/admin/health/health.service.ts @@ -0,0 +1,133 @@ +import { Injectable } from '@angular/core'; +import { HttpClient } from '@angular/common/http'; +import { Observable } from 'rxjs'; + +import { SERVER_API_URL } from 'app/app.constants'; + +@Injectable({ providedIn: 'root' }) +export class JhiHealthService { + separator: string; + + constructor(private http: HttpClient) { + this.separator = '.'; + } + + checkHealth(): Observable { + return this.http.get(SERVER_API_URL + 'management/health'); + } + + transformHealthData(data): any { + const response = []; + this.flattenHealthData(response, null, data.details); + return response; + } + + getBaseName(name): string { + if (name) { + const split = name.split('.'); + return split[0]; + } + } + + getSubSystemName(name): string { + if (name) { + const split = name.split('.'); + split.splice(0, 1); + const remainder = split.join('.'); + return remainder ? ' - ' + remainder : ''; + } + } + + /* private methods */ + private addHealthObject(result, isLeaf, healthObject, name): any { + const healthData: any = { + name + }; + + const details = {}; + let hasDetails = false; + + for (const key in healthObject) { + if (healthObject.hasOwnProperty(key)) { + const value = healthObject[key]; + if (key === 'status' || key === 'error') { + healthData[key] = value; + } else { + if (!this.isHealthObject(value)) { + details[key] = value; + hasDetails = true; + } + } + } + } + + // Add the details + if (hasDetails) { + healthData.details = details; + } + + // Only add nodes if they provide additional information + if (isLeaf || hasDetails || healthData.error) { + result.push(healthData); + } + return healthData; + } + + private flattenHealthData(result, path, data): any { + for (const key in data) { + if (data.hasOwnProperty(key)) { + const value = data[key]; + if (this.isHealthObject(value)) { + if (this.hasSubSystem(value)) { + this.addHealthObject(result, false, value, this.getModuleName(path, key)); + this.flattenHealthData(result, this.getModuleName(path, key), value); + } else { + this.addHealthObject(result, true, value, this.getModuleName(path, key)); + } + } + } + } + return result; + } + + private getModuleName(path, name): string { + let result; + if (path && name) { + result = path + this.separator + name; + } else if (path) { + result = path; + } else if (name) { + result = name; + } else { + result = ''; + } + return result; + } + + private hasSubSystem(healthObject): boolean { + let result = false; + + for (const key in healthObject) { + if (healthObject.hasOwnProperty(key)) { + const value = healthObject[key]; + if (value && value.status) { + result = true; + } + } + } + return result; + } + + private isHealthObject(healthObject): boolean { + let result = false; + + for (const key in healthObject) { + if (healthObject.hasOwnProperty(key)) { + if (key === 'status') { + result = true; + } + } + } + return result; + } +} diff --git a/jhipster/jhipster-uaa/gateway/src/main/webapp/app/admin/index.ts b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/admin/index.ts new file mode 100644 index 0000000000..c5bfdb81a7 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/admin/index.ts @@ -0,0 +1,32 @@ +export * from './audits/audits.component'; +export * from './audits/audits.service'; +export * from './audits/audits.route'; +export * from './audits/audit.model'; +export * from './audits/audit-data.model'; +export * from './configuration/configuration.component'; +export * from './configuration/configuration.service'; +export * from './configuration/configuration.route'; +export * from './docs/docs.component'; +export * from './docs/docs.route'; +export * from './health/health.component'; +export * from './health/health-modal.component'; +export * from './health/health.service'; +export * from './health/health.route'; +export * from './logs/logs.component'; +export * from './logs/logs.service'; +export * from './logs/logs.route'; +export * from './logs/log.model'; +export * from './gateway/gateway.component'; +export * from './gateway/gateway-routes.service'; +export * from './gateway/gateway.route'; +export * from './gateway/gateway-route.model'; +export * from './metrics/metrics.component'; +export * from './metrics/metrics-modal.component'; +export * from './metrics/metrics.service'; +export * from './metrics/metrics.route'; +export * from './user-management/user-management-update.component'; +export * from './user-management/user-management-delete-dialog.component'; +export * from './user-management/user-management-detail.component'; +export * from './user-management/user-management.component'; +export * from './user-management/user-management.route'; +export * from './admin.route'; diff --git a/jhipster/jhipster-uaa/gateway/src/main/webapp/app/admin/logs/log.model.ts b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/admin/logs/log.model.ts new file mode 100644 index 0000000000..3f27b6728c --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/admin/logs/log.model.ts @@ -0,0 +1,3 @@ +export class Log { + constructor(public name: string, public level: string) {} +} diff --git a/jhipster/jhipster-uaa/gateway/src/main/webapp/app/admin/logs/logs.component.html b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/admin/logs/logs.component.html new file mode 100644 index 0000000000..0a3f7de683 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/admin/logs/logs.component.html @@ -0,0 +1,28 @@ +
+

Logs

+ +

There are {{ loggers.length }} loggers.

+ + Filter + + + + + + + + + + + + + +
NameLevel
{{logger.name | slice:0:140}} + + + + + + +
+
diff --git a/jhipster/jhipster-uaa/gateway/src/main/webapp/app/admin/logs/logs.component.ts b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/admin/logs/logs.component.ts new file mode 100644 index 0000000000..28547f9ae6 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/admin/logs/logs.component.ts @@ -0,0 +1,32 @@ +import { Component, OnInit } from '@angular/core'; + +import { Log } from './log.model'; +import { LogsService } from './logs.service'; + +@Component({ + selector: 'jhi-logs', + templateUrl: './logs.component.html' +}) +export class LogsComponent implements OnInit { + loggers: Log[]; + filter: string; + orderProp: string; + reverse: boolean; + + constructor(private logsService: LogsService) { + this.filter = ''; + this.orderProp = 'name'; + this.reverse = false; + } + + ngOnInit() { + this.logsService.findAll().subscribe(response => (this.loggers = response.body)); + } + + changeLevel(name: string, level: string) { + const log = new Log(name, level); + this.logsService.changeLevel(log).subscribe(() => { + this.logsService.findAll().subscribe(response => (this.loggers = response.body)); + }); + } +} diff --git a/jhipster/jhipster-uaa/gateway/src/main/webapp/app/admin/logs/logs.route.ts b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/admin/logs/logs.route.ts new file mode 100644 index 0000000000..1de755c758 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/admin/logs/logs.route.ts @@ -0,0 +1,11 @@ +import { Route } from '@angular/router'; + +import { LogsComponent } from './logs.component'; + +export const logsRoute: Route = { + path: 'logs', + component: LogsComponent, + data: { + pageTitle: 'logs.title' + } +}; diff --git a/jhipster/jhipster-uaa/gateway/src/main/webapp/app/admin/logs/logs.service.ts b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/admin/logs/logs.service.ts new file mode 100644 index 0000000000..71a596b0ab --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/admin/logs/logs.service.ts @@ -0,0 +1,19 @@ +import { Injectable } from '@angular/core'; +import { HttpClient, HttpResponse } from '@angular/common/http'; +import { Observable } from 'rxjs'; + +import { SERVER_API_URL } from 'app/app.constants'; +import { Log } from './log.model'; + +@Injectable({ providedIn: 'root' }) +export class LogsService { + constructor(private http: HttpClient) {} + + changeLevel(log: Log): Observable> { + return this.http.put(SERVER_API_URL + 'management/logs', log, { observe: 'response' }); + } + + findAll(): Observable> { + return this.http.get(SERVER_API_URL + 'management/logs', { observe: 'response' }); + } +} diff --git a/jhipster/jhipster-uaa/gateway/src/main/webapp/app/admin/metrics/metrics-modal.component.html b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/admin/metrics/metrics-modal.component.html new file mode 100644 index 0000000000..72da2ff6ce --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/admin/metrics/metrics-modal.component.html @@ -0,0 +1,56 @@ + + + + diff --git a/jhipster/jhipster-uaa/gateway/src/main/webapp/app/admin/metrics/metrics-modal.component.ts b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/admin/metrics/metrics-modal.component.ts new file mode 100644 index 0000000000..24585fb44e --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/admin/metrics/metrics-modal.component.ts @@ -0,0 +1,46 @@ +import { Component, OnInit } from '@angular/core'; +import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap'; + +@Component({ + selector: 'jhi-metrics-modal', + templateUrl: './metrics-modal.component.html' +}) +export class JhiMetricsMonitoringModalComponent implements OnInit { + threadDumpFilter: any; + threadDump: any; + threadDumpAll = 0; + threadDumpBlocked = 0; + threadDumpRunnable = 0; + threadDumpTimedWaiting = 0; + threadDumpWaiting = 0; + + constructor(public activeModal: NgbActiveModal) {} + + ngOnInit() { + this.threadDump.forEach(value => { + if (value.threadState === 'RUNNABLE') { + this.threadDumpRunnable += 1; + } else if (value.threadState === 'WAITING') { + this.threadDumpWaiting += 1; + } else if (value.threadState === 'TIMED_WAITING') { + this.threadDumpTimedWaiting += 1; + } else if (value.threadState === 'BLOCKED') { + this.threadDumpBlocked += 1; + } + }); + + this.threadDumpAll = this.threadDumpRunnable + this.threadDumpWaiting + this.threadDumpTimedWaiting + this.threadDumpBlocked; + } + + getBadgeClass(threadState) { + if (threadState === 'RUNNABLE') { + return 'badge-success'; + } else if (threadState === 'WAITING') { + return 'badge-info'; + } else if (threadState === 'TIMED_WAITING') { + return 'badge-warning'; + } else if (threadState === 'BLOCKED') { + return 'badge-danger'; + } + } +} diff --git a/jhipster/jhipster-uaa/gateway/src/main/webapp/app/admin/metrics/metrics.component.html b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/admin/metrics/metrics.component.html new file mode 100644 index 0000000000..2cf13dad55 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/admin/metrics/metrics.component.html @@ -0,0 +1,216 @@ +
+

+ Application Metrics + +

+ +

JVM Metrics

+
+
+ Memory +

Total Memory ({{metrics.gauges['jvm.memory.total.used'].value / 1048576 | number:'1.0-0'}}M / {{metrics.gauges['jvm.memory.total.max'].value / 1048576 | number:'1.0-0'}}M)

+ + {{metrics.gauges['jvm.memory.total.used'].value * 100 / metrics.gauges['jvm.memory.total.max'].value | number:'1.0-0'}}% + +

Heap Memory ({{metrics.gauges['jvm.memory.heap.used'].value / 1048576 | number:'1.0-0'}}M / {{metrics.gauges['jvm.memory.heap.max'].value / 1048576 | number:'1.0-0'}}M)

+ + {{metrics.gauges['jvm.memory.heap.used'].value * 100 / metrics.gauges['jvm.memory.heap.max'].value | number:'1.0-0'}}% + +

Non-Heap Memory ({{metrics.gauges['jvm.memory.non-heap.used'].value / 1048576 | number:'1.0-0'}}M / {{metrics.gauges['jvm.memory.non-heap.committed'].value / 1048576 | number:'1.0-0'}}M)

+ + {{metrics.gauges['jvm.memory.non-heap.used'].value * 100 / metrics.gauges['jvm.memory.non-heap.committed'].value | number:'1.0-0'}}% + +
+
+ Threads (Total: {{metrics.gauges['jvm.threads.count'].value}}) +

Runnable {{metrics.gauges['jvm.threads.runnable.count'].value}}

+ + {{metrics.gauges['jvm.threads.runnable.count'].value * 100 / metrics.gauges['jvm.threads.count'].value | number:'1.0-0'}}% + +

Timed Waiting ({{metrics.gauges['jvm.threads.timed_waiting.count'].value}})

+ + {{metrics.gauges['jvm.threads.timed_waiting.count'].value * 100 / metrics.gauges['jvm.threads.count'].value | number:'1.0-0'}}% + +

Waiting ({{metrics.gauges['jvm.threads.waiting.count'].value}})

+ + {{metrics.gauges['jvm.threads.waiting.count'].value * 100 / metrics.gauges['jvm.threads.count'].value | number:'1.0-0'}}% + +

Blocked ({{metrics.gauges['jvm.threads.blocked.count'].value}})

+ + {{metrics.gauges['jvm.threads.blocked.count'].value * 100 / metrics.gauges['jvm.threads.count'].value | number:'1.0-0'}}% + +
+
+ Garbage collections +
+
Mark Sweep count
+
{{metrics.gauges['jvm.garbage.PS-MarkSweep.count'].value}}
+
+
+
Mark Sweep time
+
{{metrics.gauges['jvm.garbage.PS-MarkSweep.time'].value}}ms
+
+
+
Scavenge count
+
{{metrics.gauges['jvm.garbage.PS-Scavenge.count'].value}}
+
+
+
Scavenge time
+
{{metrics.gauges['jvm.garbage.PS-Scavenge.time'].value}}ms
+
+
+
+
Updating...
+ +

HTTP requests (events per second)

+

+ Active requests {{metrics.counters['com.codahale.metrics.servlet.InstrumentedFilter.activeRequests'].count | number:'1.0-0'}} - Total requests {{metrics.timers['com.codahale.metrics.servlet.InstrumentedFilter.requests'].count | number:'1.0-0'}} +

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
CodeCountMeanAverage (1 min)Average (5 min)Average (15 min)
OK + + {{metrics.meters['com.codahale.metrics.servlet.InstrumentedFilter.responseCodes.ok'].count}} + + + {{filterNaN(metrics.meters['com.codahale.metrics.servlet.InstrumentedFilter.responseCodes.ok'].mean_rate) | number:'1.0-2'}} + + {{filterNaN(metrics.meters['com.codahale.metrics.servlet.InstrumentedFilter.responseCodes.ok'].m1_rate) | number:'1.0-2'}} + + {{filterNaN(metrics.meters['com.codahale.metrics.servlet.InstrumentedFilter.responseCodes.ok'].m5_rate) | number:'1.0-2'}} + + {{filterNaN(metrics.meters['com.codahale.metrics.servlet.InstrumentedFilter.responseCodes.ok'].m15_rate) | number:'1.0-2'}} +
Not Found + + {{metrics.meters['com.codahale.metrics.servlet.InstrumentedFilter.responseCodes.notFound'].count}} + + + {{filterNaN(metrics.meters['com.codahale.metrics.servlet.InstrumentedFilter.responseCodes.notFound'].mean_rate) | number:'1.0-2'}} + + {{filterNaN(metrics.meters['com.codahale.metrics.servlet.InstrumentedFilter.responseCodes.notFound'].m1_rate) | number:'1.0-2'}} + + {{filterNaN(metrics.meters['com.codahale.metrics.servlet.InstrumentedFilter.responseCodes.notFound'].m5_rate) | number:'1.0-2'}} + + {{filterNaN(metrics.meters['com.codahale.metrics.servlet.InstrumentedFilter.responseCodes.notFound'].m15_rate) | number:'1.0-2'}} +
Server error + + {{metrics.meters['com.codahale.metrics.servlet.InstrumentedFilter.responseCodes.serverError'].count}} + + + {{filterNaN(metrics.meters['com.codahale.metrics.servlet.InstrumentedFilter.responseCodes.serverError'].mean_rate) | number:'1.0-2'}} + + {{filterNaN(metrics.meters['com.codahale.metrics.servlet.InstrumentedFilter.responseCodes.serverError'].m1_rate) | number:'1.0-2'}} + + {{filterNaN(metrics.meters['com.codahale.metrics.servlet.InstrumentedFilter.responseCodes.serverError'].m5_rate) | number:'1.0-2'}} + + {{filterNaN(metrics.meters['com.codahale.metrics.servlet.InstrumentedFilter.responseCodes.serverError'].m15_rate) | number:'1.0-2'}} +
+
+ +

Services statistics (time in millisecond)

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
Service nameCountMeanMinp50p75p95p99Max
{{entry.key}}{{entry.value.count}}{{entry.value.mean * 1024 | number:'1.0-0'}}{{entry.value.min * 1024 | number:'1.0-0'}}{{entry.value.p50 * 1024 | number:'1.0-0'}}{{entry.value.p75 * 1024 | number:'1.0-0'}}{{entry.value.p95 * 1024 | number:'1.0-0'}}{{entry.value.p99 * 1024 | number:'1.0-0'}}{{entry.value.max * 1024 | number:'1.0-0'}}
+
+

DataSource statistics (time in millisecond)

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
Usage ({{metrics.gauges['HikariPool-1.pool.ActiveConnections'].value}} / {{metrics.gauges['HikariPool-1.pool.TotalConnections'].value}})CountMeanMinp50p75p95p99Max
+
+ + {{metrics.gauges['HikariPool-1.pool.ActiveConnections'].value * 100 / metrics.gauges['HikariPool-1.pool.TotalConnections'].value | number:'1.0-0'}}% + +
+
{{metrics.histograms['HikariPool-1.pool.Usage'].count}}{{filterNaN(metrics.histograms['HikariPool-1.pool.Usage'].mean) | number:'1.0-2'}}{{filterNaN(metrics.histograms['HikariPool-1.pool.Usage'].min) | number:'1.0-2'}}{{filterNaN(metrics.histograms['HikariPool-1.pool.Usage'].p50) | number:'1.0-2'}}{{filterNaN(metrics.histograms['HikariPool-1.pool.Usage'].p75) | number:'1.0-2'}}{{filterNaN(metrics.histograms['HikariPool-1.pool.Usage'].p95) | number:'1.0-2'}}{{filterNaN(metrics.histograms['HikariPool-1.pool.Usage'].p99) | number:'1.0-2'}}{{filterNaN(metrics.histograms['HikariPool-1.pool.Usage'].max) | number:'1.0-2'}}
+
+
diff --git a/jhipster/jhipster-uaa/gateway/src/main/webapp/app/admin/metrics/metrics.component.ts b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/admin/metrics/metrics.component.ts new file mode 100644 index 0000000000..c86c9f1c97 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/admin/metrics/metrics.component.ts @@ -0,0 +1,77 @@ +import { Component, OnInit } from '@angular/core'; +import { NgbModal } from '@ng-bootstrap/ng-bootstrap'; + +import { JhiMetricsMonitoringModalComponent } from './metrics-modal.component'; +import { JhiMetricsService } from './metrics.service'; + +@Component({ + selector: 'jhi-metrics', + templateUrl: './metrics.component.html' +}) +export class JhiMetricsMonitoringComponent implements OnInit { + metrics: any = {}; + cachesStats: any = {}; + servicesStats: any = {}; + updatingMetrics = true; + JCACHE_KEY: string; + + constructor(private modalService: NgbModal, private metricsService: JhiMetricsService) { + this.JCACHE_KEY = 'jcache.statistics'; + } + + ngOnInit() { + this.refresh(); + } + + refresh() { + this.updatingMetrics = true; + this.metricsService.getMetrics().subscribe(metrics => { + this.metrics = metrics; + this.updatingMetrics = false; + this.servicesStats = {}; + this.cachesStats = {}; + Object.keys(metrics.timers).forEach(key => { + const value = metrics.timers[key]; + if (key.includes('web.rest') || key.includes('service')) { + this.servicesStats[key] = value; + } + }); + Object.keys(metrics.gauges).forEach(key => { + if (key.includes('jcache.statistics')) { + const value = metrics.gauges[key].value; + // remove gets or puts + const index = key.lastIndexOf('.'); + const newKey = key.substr(0, index); + + // Keep the name of the domain + this.cachesStats[newKey] = { + name: this.JCACHE_KEY.length, + value + }; + } + }); + }); + } + + refreshThreadDumpData() { + this.metricsService.threadDump().subscribe(data => { + const modalRef = this.modalService.open(JhiMetricsMonitoringModalComponent, { size: 'lg' }); + modalRef.componentInstance.threadDump = data.threads; + modalRef.result.then( + result => { + // Left blank intentionally, nothing to do here + }, + reason => { + // Left blank intentionally, nothing to do here + } + ); + }); + } + + filterNaN(input) { + if (isNaN(input)) { + return 0; + } + return input; + } +} diff --git a/jhipster/jhipster-uaa/gateway/src/main/webapp/app/admin/metrics/metrics.route.ts b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/admin/metrics/metrics.route.ts new file mode 100644 index 0000000000..ba8f59363a --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/admin/metrics/metrics.route.ts @@ -0,0 +1,11 @@ +import { Route } from '@angular/router'; + +import { JhiMetricsMonitoringComponent } from './metrics.component'; + +export const metricsRoute: Route = { + path: 'jhi-metrics', + component: JhiMetricsMonitoringComponent, + data: { + pageTitle: 'metrics.title' + } +}; diff --git a/jhipster/jhipster-uaa/gateway/src/main/webapp/app/admin/metrics/metrics.service.ts b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/admin/metrics/metrics.service.ts new file mode 100644 index 0000000000..16ccc07324 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/admin/metrics/metrics.service.ts @@ -0,0 +1,18 @@ +import { Injectable } from '@angular/core'; +import { HttpClient } from '@angular/common/http'; +import { Observable } from 'rxjs'; + +import { SERVER_API_URL } from 'app/app.constants'; + +@Injectable({ providedIn: 'root' }) +export class JhiMetricsService { + constructor(private http: HttpClient) {} + + getMetrics(): Observable { + return this.http.get(SERVER_API_URL + 'management/metrics'); + } + + threadDump(): Observable { + return this.http.get(SERVER_API_URL + 'management/threaddump'); + } +} diff --git a/jhipster/jhipster-uaa/gateway/src/main/webapp/app/admin/user-management/user-management-delete-dialog.component.html b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/admin/user-management/user-management-delete-dialog.component.html new file mode 100644 index 0000000000..5b2eec36e2 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/admin/user-management/user-management-delete-dialog.component.html @@ -0,0 +1,19 @@ +
+ + + +
diff --git a/jhipster/jhipster-uaa/gateway/src/main/webapp/app/admin/user-management/user-management-delete-dialog.component.ts b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/admin/user-management/user-management-delete-dialog.component.ts new file mode 100644 index 0000000000..d7674f6cd9 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/admin/user-management/user-management-delete-dialog.component.ts @@ -0,0 +1,29 @@ +import { Component } from '@angular/core'; +import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap'; +import { JhiEventManager } from 'ng-jhipster'; + +import { User, UserService } from 'app/core'; + +@Component({ + selector: 'jhi-user-mgmt-delete-dialog', + templateUrl: './user-management-delete-dialog.component.html' +}) +export class UserMgmtDeleteDialogComponent { + user: User; + + constructor(private userService: UserService, public activeModal: NgbActiveModal, private eventManager: JhiEventManager) {} + + clear() { + this.activeModal.dismiss('cancel'); + } + + confirmDelete(login) { + this.userService.delete(login).subscribe(response => { + this.eventManager.broadcast({ + name: 'userListModification', + content: 'Deleted a user' + }); + this.activeModal.dismiss(true); + }); + } +} diff --git a/jhipster/jhipster-uaa/gateway/src/main/webapp/app/admin/user-management/user-management-detail.component.html b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/admin/user-management/user-management-detail.component.html new file mode 100644 index 0000000000..0fee91b953 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/admin/user-management/user-management-detail.component.html @@ -0,0 +1,49 @@ +
+
+
+

+ User [{{user.login}}] +

+
+
Login
+
+ {{user.login}} + + +
+
First Name
+
{{user.firstName}}
+
Last Name
+
{{user.lastName}}
+
Email
+
{{user.email}}
+
Lang Key
+
{{user.langKey}}
+
Created By
+
{{user.createdBy}}
+
Created Date
+
{{user.createdDate | date:'dd/MM/yy HH:mm' }}
+
Last Modified By
+
{{user.lastModifiedBy}}
+
Last Modified Date
+
{{user.lastModifiedDate | date:'dd/MM/yy HH:mm'}}
+
Profiles
+
+
    +
  • + {{authority}} +
  • +
+
+
+ +
+
+
diff --git a/jhipster/jhipster-uaa/gateway/src/main/webapp/app/admin/user-management/user-management-detail.component.ts b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/admin/user-management/user-management-detail.component.ts new file mode 100644 index 0000000000..0b323d89a0 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/admin/user-management/user-management-detail.component.ts @@ -0,0 +1,20 @@ +import { Component, OnInit, OnDestroy } from '@angular/core'; +import { ActivatedRoute } from '@angular/router'; + +import { User } from 'app/core'; + +@Component({ + selector: 'jhi-user-mgmt-detail', + templateUrl: './user-management-detail.component.html' +}) +export class UserMgmtDetailComponent implements OnInit { + user: User; + + constructor(private route: ActivatedRoute) {} + + ngOnInit() { + this.route.data.subscribe(({ user }) => { + this.user = user.body ? user.body : user; + }); + } +} diff --git a/jhipster/jhipster-uaa/gateway/src/main/webapp/app/admin/user-management/user-management-update.component.html b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/admin/user-management/user-management-update.component.html new file mode 100644 index 0000000000..3d1975ae86 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/admin/user-management/user-management-update.component.html @@ -0,0 +1,124 @@ +
+
+
+

+ Create or edit a User +

+
+ +
+ + +
+ +
+ + + +
+ + This field is required. + + + + This field cannot be longer than 50 characters. + + + + This field can only contain letters, digits and e-mail addresses. + +
+
+
+ + + +
+ + This field cannot be longer than 50 characters. + +
+
+
+ + + +
+ + This field cannot be longer than 50 characters. + +
+
+
+ + + +
+ + This field is required. + + + + This field cannot be longer than 100 characters. + + + + This field is required to be at least 5 characters. + + + + Your email is invalid. + +
+
+
+ +
+ +
+ + +
+
+ + +
+
+
+ + +
+
+
+
diff --git a/jhipster/jhipster-uaa/gateway/src/main/webapp/app/admin/user-management/user-management-update.component.ts b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/admin/user-management/user-management-update.component.ts new file mode 100644 index 0000000000..84e06c5bdf --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/admin/user-management/user-management-update.component.ts @@ -0,0 +1,58 @@ +import { Component, OnInit } from '@angular/core'; +import { ActivatedRoute, Router } from '@angular/router'; + +import { JhiLanguageHelper, User, UserService } from 'app/core'; + +@Component({ + selector: 'jhi-user-mgmt-update', + templateUrl: './user-management-update.component.html' +}) +export class UserMgmtUpdateComponent implements OnInit { + user: User; + languages: any[]; + authorities: any[]; + isSaving: boolean; + + constructor( + private languageHelper: JhiLanguageHelper, + private userService: UserService, + private route: ActivatedRoute, + private router: Router + ) {} + + ngOnInit() { + this.isSaving = false; + this.route.data.subscribe(({ user }) => { + this.user = user.body ? user.body : user; + }); + this.authorities = []; + this.userService.authorities().subscribe(authorities => { + this.authorities = authorities; + }); + this.languageHelper.getAll().then(languages => { + this.languages = languages; + }); + } + + previousState() { + window.history.back(); + } + + save() { + this.isSaving = true; + if (this.user.id !== null) { + this.userService.update(this.user).subscribe(response => this.onSaveSuccess(response), () => this.onSaveError()); + } else { + this.userService.create(this.user).subscribe(response => this.onSaveSuccess(response), () => this.onSaveError()); + } + } + + private onSaveSuccess(result) { + this.isSaving = false; + this.previousState(); + } + + private onSaveError() { + this.isSaving = false; + } +} diff --git a/jhipster/jhipster-uaa/gateway/src/main/webapp/app/admin/user-management/user-management.component.html b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/admin/user-management/user-management.component.html new file mode 100644 index 0000000000..7cbf79c460 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/admin/user-management/user-management.component.html @@ -0,0 +1,79 @@ +
+

+ Users + +

+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ID Login Email Lang Key ProfilesCreated Date Last Modified By Last Modified Date
{{user.id}}{{user.login}}{{user.email}} + + + {{user.langKey}} +
+ {{ authority }} +
+
{{user.createdDate | date:'dd/MM/yy HH:mm'}}{{user.lastModifiedBy}}{{user.lastModifiedDate | date:'dd/MM/yy HH:mm'}} +
+ + + +
+
+
+
+
+ +
+
+ +
+
+
diff --git a/jhipster/jhipster-uaa/gateway/src/main/webapp/app/admin/user-management/user-management.component.ts b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/admin/user-management/user-management.component.ts new file mode 100644 index 0000000000..9ef046d655 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/admin/user-management/user-management.component.ts @@ -0,0 +1,146 @@ +import { Component, OnInit, OnDestroy } from '@angular/core'; +import { HttpResponse } from '@angular/common/http'; +import { NgbModal } from '@ng-bootstrap/ng-bootstrap'; + +import { ActivatedRoute, Router } from '@angular/router'; +import { JhiEventManager, JhiParseLinks, JhiAlertService } from 'ng-jhipster'; + +import { ITEMS_PER_PAGE } from 'app/shared'; +import { Principal, UserService, User } from 'app/core'; +import { UserMgmtDeleteDialogComponent } from 'app/admin'; + +@Component({ + selector: 'jhi-user-mgmt', + templateUrl: './user-management.component.html' +}) +export class UserMgmtComponent implements OnInit, OnDestroy { + currentAccount: any; + users: User[]; + error: any; + success: any; + routeData: any; + links: any; + totalItems: any; + queryCount: any; + itemsPerPage: any; + page: any; + predicate: any; + previousPage: any; + reverse: any; + + constructor( + private userService: UserService, + private alertService: JhiAlertService, + private principal: Principal, + private parseLinks: JhiParseLinks, + private activatedRoute: ActivatedRoute, + private router: Router, + private eventManager: JhiEventManager, + private modalService: NgbModal + ) { + this.itemsPerPage = ITEMS_PER_PAGE; + this.routeData = this.activatedRoute.data.subscribe(data => { + this.page = data['pagingParams'].page; + this.previousPage = data['pagingParams'].page; + this.reverse = data['pagingParams'].ascending; + this.predicate = data['pagingParams'].predicate; + }); + } + + ngOnInit() { + this.principal.identity().then(account => { + this.currentAccount = account; + this.loadAll(); + this.registerChangeInUsers(); + }); + } + + ngOnDestroy() { + this.routeData.unsubscribe(); + } + + registerChangeInUsers() { + this.eventManager.subscribe('userListModification', response => this.loadAll()); + } + + setActive(user, isActivated) { + user.activated = isActivated; + + this.userService.update(user).subscribe(response => { + if (response.status === 200) { + this.error = null; + this.success = 'OK'; + this.loadAll(); + } else { + this.success = null; + this.error = 'ERROR'; + } + }); + } + + loadAll() { + this.userService + .query({ + page: this.page - 1, + size: this.itemsPerPage, + sort: this.sort() + }) + .subscribe( + (res: HttpResponse) => this.onSuccess(res.body, res.headers), + (res: HttpResponse) => this.onError(res.body) + ); + } + + trackIdentity(index, item: User) { + return item.id; + } + + sort() { + const result = [this.predicate + ',' + (this.reverse ? 'asc' : 'desc')]; + if (this.predicate !== 'id') { + result.push('id'); + } + return result; + } + + loadPage(page: number) { + if (page !== this.previousPage) { + this.previousPage = page; + this.transition(); + } + } + + transition() { + this.router.navigate(['/admin/user-management'], { + queryParams: { + page: this.page, + sort: this.predicate + ',' + (this.reverse ? 'asc' : 'desc') + } + }); + this.loadAll(); + } + + deleteUser(user: User) { + const modalRef = this.modalService.open(UserMgmtDeleteDialogComponent, { size: 'lg', backdrop: 'static' }); + modalRef.componentInstance.user = user; + modalRef.result.then( + result => { + // Left blank intentionally, nothing to do here + }, + reason => { + // Left blank intentionally, nothing to do here + } + ); + } + + private onSuccess(data, headers) { + this.links = this.parseLinks.parse(headers.get('link')); + this.totalItems = headers.get('X-Total-Count'); + this.queryCount = this.totalItems; + this.users = data; + } + + private onError(error) { + this.alertService.error(error.error, error.message, null); + } +} diff --git a/jhipster/jhipster-uaa/gateway/src/main/webapp/app/admin/user-management/user-management.route.ts b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/admin/user-management/user-management.route.ts new file mode 100644 index 0000000000..29675e93d8 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/admin/user-management/user-management.route.ts @@ -0,0 +1,68 @@ +import { Injectable } from '@angular/core'; +import { Resolve, ActivatedRouteSnapshot, RouterStateSnapshot, Routes, CanActivate } from '@angular/router'; +import { JhiPaginationUtil, JhiResolvePagingParams } from 'ng-jhipster'; + +import { Principal, User, UserService } from 'app/core'; +import { UserMgmtComponent } from './user-management.component'; +import { UserMgmtDetailComponent } from './user-management-detail.component'; +import { UserMgmtUpdateComponent } from './user-management-update.component'; + +@Injectable({ providedIn: 'root' }) +export class UserResolve implements CanActivate { + constructor(private principal: Principal) {} + + canActivate() { + return this.principal.identity().then(account => this.principal.hasAnyAuthority(['ROLE_ADMIN'])); + } +} + +@Injectable({ providedIn: 'root' }) +export class UserMgmtResolve implements Resolve { + constructor(private service: UserService) {} + + resolve(route: ActivatedRouteSnapshot, state: RouterStateSnapshot) { + const id = route.params['login'] ? route.params['login'] : null; + if (id) { + return this.service.find(id); + } + return new User(); + } +} + +export const userMgmtRoute: Routes = [ + { + path: 'user-management', + component: UserMgmtComponent, + resolve: { + pagingParams: JhiResolvePagingParams + }, + data: { + pageTitle: 'userManagement.home.title', + defaultSort: 'id,asc' + } + }, + { + path: 'user-management/:login/view', + component: UserMgmtDetailComponent, + resolve: { + user: UserMgmtResolve + }, + data: { + pageTitle: 'userManagement.home.title' + } + }, + { + path: 'user-management/new', + component: UserMgmtUpdateComponent, + resolve: { + user: UserMgmtResolve + } + }, + { + path: 'user-management/:login/edit', + component: UserMgmtUpdateComponent, + resolve: { + user: UserMgmtResolve + } + } +]; diff --git a/jhipster/jhipster-uaa/gateway/src/main/webapp/app/app-routing.module.ts b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/app-routing.module.ts new file mode 100644 index 0000000000..8491f5ffea --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/app-routing.module.ts @@ -0,0 +1,23 @@ +import { NgModule } from '@angular/core'; +import { RouterModule } from '@angular/router'; +import { errorRoute, navbarRoute } from './layouts'; +import { DEBUG_INFO_ENABLED } from 'app/app.constants'; + +const LAYOUT_ROUTES = [navbarRoute, ...errorRoute]; + +@NgModule({ + imports: [ + RouterModule.forRoot( + [ + ...LAYOUT_ROUTES, + { + path: 'admin', + loadChildren: './admin/admin.module#GatewayAdminModule' + } + ], + { useHash: true, enableTracing: DEBUG_INFO_ENABLED } + ) + ], + exports: [RouterModule] +}) +export class GatewayAppRoutingModule {} diff --git a/jhipster/jhipster-uaa/gateway/src/main/webapp/app/app.constants.ts b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/app.constants.ts new file mode 100644 index 0000000000..9760a49a91 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/app.constants.ts @@ -0,0 +1,8 @@ +// These constants are injected via webpack environment variables. +// You can add more variables in webpack.common.js or in profile specific webpack..js files. +// If you change the values in the webpack config files, you need to re run webpack to update the application + +export const VERSION = process.env.VERSION; +export const DEBUG_INFO_ENABLED: boolean = !!process.env.DEBUG_INFO_ENABLED; +export const SERVER_API_URL = process.env.SERVER_API_URL; +export const BUILD_TIMESTAMP = process.env.BUILD_TIMESTAMP; diff --git a/jhipster/jhipster-uaa/gateway/src/main/webapp/app/app.main.ts b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/app.main.ts new file mode 100644 index 0000000000..0404cd69e8 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/app.main.ts @@ -0,0 +1,14 @@ +import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; +import { ProdConfig } from './blocks/config/prod.config'; +import { GatewayAppModule } from './app.module'; + +ProdConfig(); + +if (module['hot']) { + module['hot'].accept(); +} + +platformBrowserDynamic() + .bootstrapModule(GatewayAppModule, { preserveWhitespaces: true }) + .then(success => console.log(`Application started`)) + .catch(err => console.error(err)); diff --git a/jhipster/jhipster-uaa/gateway/src/main/webapp/app/app.module.ts b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/app.module.ts new file mode 100644 index 0000000000..a490c03db8 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/app.module.ts @@ -0,0 +1,62 @@ +import './vendor.ts'; + +import { NgModule, Injector } from '@angular/core'; +import { BrowserModule } from '@angular/platform-browser'; +import { HTTP_INTERCEPTORS } from '@angular/common/http'; +import { NgbDatepickerConfig } from '@ng-bootstrap/ng-bootstrap'; +import { Ng2Webstorage } from 'ngx-webstorage'; +import { JhiEventManager } from 'ng-jhipster'; + +import { AuthExpiredInterceptor } from './blocks/interceptor/auth-expired.interceptor'; +import { ErrorHandlerInterceptor } from './blocks/interceptor/errorhandler.interceptor'; +import { NotificationInterceptor } from './blocks/interceptor/notification.interceptor'; +import { GatewaySharedModule } from 'app/shared'; +import { GatewayCoreModule } from 'app/core'; +import { GatewayAppRoutingModule } from './app-routing.module'; +import { GatewayHomeModule } from './home/home.module'; +import { GatewayAccountModule } from './account/account.module'; +import { GatewayEntityModule } from './entities/entity.module'; +import * as moment from 'moment'; +// jhipster-needle-angular-add-module-import JHipster will add new module here +import { JhiMainComponent, NavbarComponent, FooterComponent, PageRibbonComponent, ActiveMenuDirective, ErrorComponent } from './layouts'; + +@NgModule({ + imports: [ + BrowserModule, + GatewayAppRoutingModule, + Ng2Webstorage.forRoot({ prefix: 'jhi', separator: '-' }), + GatewaySharedModule, + GatewayCoreModule, + GatewayHomeModule, + GatewayAccountModule, + GatewayEntityModule + // jhipster-needle-angular-add-module JHipster will add new module here + ], + declarations: [JhiMainComponent, NavbarComponent, ErrorComponent, PageRibbonComponent, ActiveMenuDirective, FooterComponent], + providers: [ + { + provide: HTTP_INTERCEPTORS, + useClass: AuthExpiredInterceptor, + multi: true, + deps: [Injector] + }, + { + provide: HTTP_INTERCEPTORS, + useClass: ErrorHandlerInterceptor, + multi: true, + deps: [JhiEventManager] + }, + { + provide: HTTP_INTERCEPTORS, + useClass: NotificationInterceptor, + multi: true, + deps: [Injector] + } + ], + bootstrap: [JhiMainComponent] +}) +export class GatewayAppModule { + constructor(private dpConfig: NgbDatepickerConfig) { + this.dpConfig.minDate = { year: moment().year() - 100, month: 1, day: 1 }; + } +} diff --git a/jhipster/jhipster-uaa/gateway/src/main/webapp/app/blocks/config/prod.config.ts b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/blocks/config/prod.config.ts new file mode 100644 index 0000000000..c6221c1eaf --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/blocks/config/prod.config.ts @@ -0,0 +1,9 @@ +import { enableProdMode } from '@angular/core'; +import { DEBUG_INFO_ENABLED } from 'app/app.constants'; + +export function ProdConfig() { + // disable debug data on prod profile to improve performance + if (!DEBUG_INFO_ENABLED) { + enableProdMode(); + } +} diff --git a/jhipster/jhipster-uaa/gateway/src/main/webapp/app/blocks/config/uib-pagination.config.ts b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/blocks/config/uib-pagination.config.ts new file mode 100644 index 0000000000..0c2ea94808 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/blocks/config/uib-pagination.config.ts @@ -0,0 +1,14 @@ +import { Injectable } from '@angular/core'; +import { NgbPaginationConfig } from '@ng-bootstrap/ng-bootstrap'; +import { ITEMS_PER_PAGE } from 'app/shared'; + +@Injectable({ providedIn: 'root' }) +export class PaginationConfig { + // tslint:disable-next-line: no-unused-variable + constructor(private config: NgbPaginationConfig) { + config.boundaryLinks = true; + config.maxSize = 5; + config.pageSize = ITEMS_PER_PAGE; + config.size = 'sm'; + } +} diff --git a/jhipster/jhipster-uaa/gateway/src/main/webapp/app/blocks/interceptor/auth-expired.interceptor.ts b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/blocks/interceptor/auth-expired.interceptor.ts new file mode 100644 index 0000000000..a4a67f3bf4 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/blocks/interceptor/auth-expired.interceptor.ts @@ -0,0 +1,39 @@ +import { Injector } from '@angular/core'; +import { HttpInterceptor, HttpRequest, HttpHandler, HttpEvent, HttpErrorResponse } from '@angular/common/http'; +import { Observable } from 'rxjs'; +import { tap } from 'rxjs/operators'; +import { Router } from '@angular/router'; + +import { LoginModalService } from 'app/core/login/login-modal.service'; +import { Principal } from 'app/core/auth/principal.service'; +import { LoginService } from 'app/core/login/login.service'; + +export class AuthExpiredInterceptor implements HttpInterceptor { + constructor(private injector: Injector) {} + + intercept(request: HttpRequest, next: HttpHandler): Observable> { + return next.handle(request).pipe( + tap( + (event: HttpEvent) => {}, + (err: any) => { + if (err instanceof HttpErrorResponse) { + if (err.status === 401) { + const principal = this.injector.get(Principal); + + if (principal.isAuthenticated()) { + principal.authenticate(null); + const loginModalService: LoginModalService = this.injector.get(LoginModalService); + loginModalService.open(); + } else { + const loginService: LoginService = this.injector.get(LoginService); + loginService.logout(); + const router = this.injector.get(Router); + router.navigate(['/']); + } + } + } + } + ) + ); + } +} diff --git a/jhipster/jhipster-uaa/gateway/src/main/webapp/app/blocks/interceptor/errorhandler.interceptor.ts b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/blocks/interceptor/errorhandler.interceptor.ts new file mode 100644 index 0000000000..dba028244e --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/blocks/interceptor/errorhandler.interceptor.ts @@ -0,0 +1,25 @@ +import { JhiEventManager } from 'ng-jhipster'; +import { HttpInterceptor, HttpRequest, HttpErrorResponse, HttpHandler, HttpEvent } from '@angular/common/http'; +import { Observable } from 'rxjs'; +import { tap } from 'rxjs/operators'; + +export class ErrorHandlerInterceptor implements HttpInterceptor { + constructor(private eventManager: JhiEventManager) {} + + intercept(request: HttpRequest, next: HttpHandler): Observable> { + return next.handle(request).pipe( + tap( + (event: HttpEvent) => {}, + (err: any) => { + if (err instanceof HttpErrorResponse) { + if (!(err.status === 401 && (err.message === '' || (err.url && err.url.includes('/api/account'))))) { + if (this.eventManager !== undefined) { + this.eventManager.broadcast({ name: 'gatewayApp.httpError', content: err }); + } + } + } + } + ) + ); + } +} diff --git a/jhipster/jhipster-uaa/gateway/src/main/webapp/app/blocks/interceptor/notification.interceptor.ts b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/blocks/interceptor/notification.interceptor.ts new file mode 100644 index 0000000000..5edfdcfa64 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/blocks/interceptor/notification.interceptor.ts @@ -0,0 +1,43 @@ +import { JhiAlertService } from 'ng-jhipster'; +import { HttpInterceptor, HttpRequest, HttpResponse, HttpHandler, HttpEvent } from '@angular/common/http'; +import { Injector } from '@angular/core'; +import { Observable } from 'rxjs'; +import { tap } from 'rxjs/operators'; + +export class NotificationInterceptor implements HttpInterceptor { + private alertService: JhiAlertService; + + // tslint:disable-next-line: no-unused-variable + constructor(private injector: Injector) { + setTimeout(() => (this.alertService = injector.get(JhiAlertService))); + } + + intercept(request: HttpRequest, next: HttpHandler): Observable> { + return next.handle(request).pipe( + tap( + (event: HttpEvent) => { + if (event instanceof HttpResponse) { + const arr = event.headers.keys(); + let alert = null; + let alertParams = null; + arr.forEach(entry => { + if (entry.toLowerCase().endsWith('app-alert')) { + alert = event.headers.get(entry); + } else if (entry.toLowerCase().endsWith('app-params')) { + alertParams = event.headers.get(entry); + } + }); + if (alert) { + if (typeof alert === 'string') { + if (this.alertService) { + this.alertService.success(alert, { param: alertParams }, null); + } + } + } + } + }, + (err: any) => {} + ) + ); + } +} diff --git a/jhipster/jhipster-uaa/gateway/src/main/webapp/app/core/auth/account.service.ts b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/core/auth/account.service.ts new file mode 100644 index 0000000000..fab4e415bc --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/core/auth/account.service.ts @@ -0,0 +1,18 @@ +import { Injectable } from '@angular/core'; +import { HttpClient, HttpResponse } from '@angular/common/http'; +import { Observable } from 'rxjs'; + +import { SERVER_API_URL } from 'app/app.constants'; + +@Injectable({ providedIn: 'root' }) +export class AccountService { + constructor(private http: HttpClient) {} + + get(): Observable> { + return this.http.get(SERVER_API_URL + 'uaa/api/account', { observe: 'response' }); + } + + save(account: any): Observable> { + return this.http.post(SERVER_API_URL + 'uaa/api/account', account, { observe: 'response' }); + } +} diff --git a/jhipster/jhipster-uaa/gateway/src/main/webapp/app/core/auth/auth-jwt.service.ts b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/core/auth/auth-jwt.service.ts new file mode 100644 index 0000000000..221f5586bd --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/core/auth/auth-jwt.service.ts @@ -0,0 +1,39 @@ +import { Injectable } from '@angular/core'; +import { HttpClient } from '@angular/common/http'; +import { Observable } from 'rxjs'; +import { map } from 'rxjs/operators'; + +import { SERVER_API_URL } from 'app/app.constants'; + +@Injectable({ providedIn: 'root' }) +export class AuthServerProvider { + constructor(private http: HttpClient) {} + + getToken() { + return null; + } + + login(credentials): Observable { + const data = { + username: credentials.username, + password: credentials.password, + rememberMe: credentials.rememberMe + }; + return this.http.post(SERVER_API_URL + 'auth/login', data, {}); + } + + loginWithToken(jwt, rememberMe) { + if (jwt) { + this.storeAuthenticationToken(jwt, rememberMe); + return Promise.resolve(jwt); + } else { + return Promise.reject('auth-jwt-service Promise reject'); // Put appropriate error message here + } + } + + storeAuthenticationToken(jwt, rememberMe) {} + + logout(): Observable { + return this.http.post(SERVER_API_URL + 'auth/logout', null); + } +} diff --git a/jhipster/jhipster-uaa/gateway/src/main/webapp/app/core/auth/csrf.service.ts b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/core/auth/csrf.service.ts new file mode 100644 index 0000000000..1eeee79972 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/core/auth/csrf.service.ts @@ -0,0 +1,12 @@ +import { Injectable } from '@angular/core'; +import { CookieService } from 'ngx-cookie'; + +@Injectable({ providedIn: 'root' }) +export class CSRFService { + constructor(private cookieService: CookieService) {} + + getCSRF(name?: string) { + name = `${name ? name : 'XSRF-TOKEN'}`; + return this.cookieService.get(name); + } +} diff --git a/jhipster/jhipster-uaa/gateway/src/main/webapp/app/core/auth/principal.service.ts b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/core/auth/principal.service.ts new file mode 100644 index 0000000000..a074bbd3bb --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/core/auth/principal.service.ts @@ -0,0 +1,102 @@ +import { Injectable } from '@angular/core'; +import { Observable, Subject } from 'rxjs'; +import { AccountService } from './account.service'; + +@Injectable({ providedIn: 'root' }) +export class Principal { + private userIdentity: any; + private authenticated = false; + private authenticationState = new Subject(); + + constructor(private account: AccountService) {} + + authenticate(identity) { + this.userIdentity = identity; + this.authenticated = identity !== null; + this.authenticationState.next(this.userIdentity); + } + + hasAnyAuthority(authorities: string[]): Promise { + return Promise.resolve(this.hasAnyAuthorityDirect(authorities)); + } + + hasAnyAuthorityDirect(authorities: string[]): boolean { + if (!this.authenticated || !this.userIdentity || !this.userIdentity.authorities) { + return false; + } + + for (let i = 0; i < authorities.length; i++) { + if (this.userIdentity.authorities.includes(authorities[i])) { + return true; + } + } + + return false; + } + + hasAuthority(authority: string): Promise { + if (!this.authenticated) { + return Promise.resolve(false); + } + + return this.identity().then( + id => { + return Promise.resolve(id.authorities && id.authorities.includes(authority)); + }, + () => { + return Promise.resolve(false); + } + ); + } + + identity(force?: boolean): Promise { + if (force === true) { + this.userIdentity = undefined; + } + + // check and see if we have retrieved the userIdentity data from the server. + // if we have, reuse it by immediately resolving + if (this.userIdentity) { + return Promise.resolve(this.userIdentity); + } + + // retrieve the userIdentity data from the server, update the identity object, and then resolve. + return this.account + .get() + .toPromise() + .then(response => { + const account = response.body; + if (account) { + this.userIdentity = account; + this.authenticated = true; + } else { + this.userIdentity = null; + this.authenticated = false; + } + this.authenticationState.next(this.userIdentity); + return this.userIdentity; + }) + .catch(err => { + this.userIdentity = null; + this.authenticated = false; + this.authenticationState.next(this.userIdentity); + return null; + }); + } + + isAuthenticated(): boolean { + return this.authenticated; + } + + isIdentityResolved(): boolean { + return this.userIdentity !== undefined; + } + + getAuthenticationState(): Observable { + return this.authenticationState.asObservable(); + } + + getImageUrl(): string { + return this.isIdentityResolved() ? this.userIdentity.imageUrl : null; + } +} diff --git a/jhipster/jhipster-uaa/gateway/src/main/webapp/app/core/auth/state-storage.service.ts b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/core/auth/state-storage.service.ts new file mode 100644 index 0000000000..0e5befbfc3 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/core/auth/state-storage.service.ts @@ -0,0 +1,46 @@ +import { Injectable } from '@angular/core'; +import { SessionStorageService } from 'ngx-webstorage'; + +@Injectable({ providedIn: 'root' }) +export class StateStorageService { + constructor(private $sessionStorage: SessionStorageService) {} + + getPreviousState() { + return this.$sessionStorage.retrieve('previousState'); + } + + resetPreviousState() { + this.$sessionStorage.clear('previousState'); + } + + storePreviousState(previousStateName, previousStateParams) { + const previousState = { name: previousStateName, params: previousStateParams }; + this.$sessionStorage.store('previousState', previousState); + } + + getDestinationState() { + return this.$sessionStorage.retrieve('destinationState'); + } + + storeUrl(url: string) { + this.$sessionStorage.store('previousUrl', url); + } + + getUrl() { + return this.$sessionStorage.retrieve('previousUrl'); + } + + storeDestinationState(destinationState, destinationStateParams, fromState) { + const destinationInfo = { + destination: { + name: destinationState.name, + data: destinationState.data + }, + params: destinationStateParams, + from: { + name: fromState.name + } + }; + this.$sessionStorage.store('destinationState', destinationInfo); + } +} diff --git a/jhipster/jhipster-uaa/gateway/src/main/webapp/app/core/auth/user-route-access-service.ts b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/core/auth/user-route-access-service.ts new file mode 100644 index 0000000000..e86cba3497 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/core/auth/user-route-access-service.ts @@ -0,0 +1,56 @@ +import { Injectable, isDevMode } from '@angular/core'; +import { ActivatedRouteSnapshot, CanActivate, Router, RouterStateSnapshot } from '@angular/router'; + +import { Principal } from '../'; +import { LoginModalService } from '../login/login-modal.service'; +import { StateStorageService } from './state-storage.service'; + +@Injectable({ providedIn: 'root' }) +export class UserRouteAccessService implements CanActivate { + constructor( + private router: Router, + private loginModalService: LoginModalService, + private principal: Principal, + private stateStorageService: StateStorageService + ) {} + + canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): boolean | Promise { + const authorities = route.data['authorities']; + // We need to call the checkLogin / and so the principal.identity() function, to ensure, + // that the client has a principal too, if they already logged in by the server. + // This could happen on a page refresh. + return this.checkLogin(authorities, state.url); + } + + checkLogin(authorities: string[], url: string): Promise { + const principal = this.principal; + return Promise.resolve( + principal.identity().then(account => { + if (!authorities || authorities.length === 0) { + return true; + } + + if (account) { + return principal.hasAnyAuthority(authorities).then(response => { + if (response) { + return true; + } + if (isDevMode()) { + console.error('User has not any of required authorities: ', authorities); + } + return false; + }); + } + + this.stateStorageService.storeUrl(url); + this.router.navigate(['accessdenied']).then(() => { + // only show the login dialog, if the user hasn't logged in yet + if (!account) { + this.loginModalService.open(); + } + }); + return false; + }) + ); + } +} diff --git a/jhipster/jhipster-uaa/gateway/src/main/webapp/app/core/core.module.ts b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/core/core.module.ts new file mode 100644 index 0000000000..92807732dd --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/core/core.module.ts @@ -0,0 +1,24 @@ +import { NgModule, LOCALE_ID } from '@angular/core'; +import { DatePipe, registerLocaleData } from '@angular/common'; +import { HttpClientModule } from '@angular/common/http'; +import { Title } from '@angular/platform-browser'; +import locale from '@angular/common/locales/en'; + +@NgModule({ + imports: [HttpClientModule], + exports: [], + declarations: [], + providers: [ + Title, + { + provide: LOCALE_ID, + useValue: 'en' + }, + DatePipe + ] +}) +export class GatewayCoreModule { + constructor() { + registerLocaleData(locale); + } +} diff --git a/jhipster/jhipster-uaa/gateway/src/main/webapp/app/core/index.ts b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/core/index.ts new file mode 100644 index 0000000000..7663d225ad --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/core/index.ts @@ -0,0 +1,14 @@ +export * from './auth/csrf.service'; +export * from './auth/state-storage.service'; +export * from './auth/account.service'; +export * from './auth/auth-jwt.service'; +export * from './language/language.helper'; +export * from './language/language.constants'; +export * from './user/account.model'; +export * from './user/user.model'; +export * from './auth/principal.service'; +export * from './auth/user-route-access-service'; +export * from './login/login-modal.service'; +export * from './login/login.service'; +export * from './user/user.service'; +export * from './core.module'; diff --git a/jhipster/jhipster-uaa/gateway/src/main/webapp/app/core/language/language.constants.ts b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/core/language/language.constants.ts new file mode 100644 index 0000000000..000d72837a --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/core/language/language.constants.ts @@ -0,0 +1,10 @@ +/* + Languages codes are ISO_639-1 codes, see http://en.wikipedia.org/wiki/List_of_ISO_639-1_codes + They are written in English to avoid character encoding issues (not a perfect solution) +*/ +export const LANGUAGES: string[] = [ + 'en', + 'fr', + 'pt-br' + // jhipster-needle-i18n-language-constant - JHipster will add/remove languages in this array +]; diff --git a/jhipster/jhipster-uaa/gateway/src/main/webapp/app/core/language/language.helper.ts b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/core/language/language.helper.ts new file mode 100644 index 0000000000..6abfc8d271 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/core/language/language.helper.ts @@ -0,0 +1,66 @@ +import { Injectable, RendererFactory2, Renderer2 } from '@angular/core'; +import { Title } from '@angular/platform-browser'; +import { Router, ActivatedRouteSnapshot } from '@angular/router'; +import { TranslateService, LangChangeEvent } from '@ngx-translate/core'; +import { BehaviorSubject, Observable } from 'rxjs'; + +import { LANGUAGES } from 'app/core/language/language.constants'; + +@Injectable({ providedIn: 'root' }) +export class JhiLanguageHelper { + renderer: Renderer2 = null; + private _language: BehaviorSubject; + + constructor( + private translateService: TranslateService, + // tslint:disable-next-line: no-unused-variable + private rootRenderer: RendererFactory2, + private titleService: Title, + private router: Router + ) { + this._language = new BehaviorSubject(this.translateService.currentLang); + this.renderer = rootRenderer.createRenderer(document.querySelector('html'), null); + this.init(); + } + + getAll(): Promise { + return Promise.resolve(LANGUAGES); + } + + get language(): Observable { + return this._language.asObservable(); + } + + /** + * Update the window title using params in the following + * order: + * 1. titleKey parameter + * 2. $state.$current.data.pageTitle (current state page title) + * 3. 'global.title' + */ + updateTitle(titleKey?: string) { + if (!titleKey) { + titleKey = this.getPageTitle(this.router.routerState.snapshot.root); + } + + this.translateService.get(titleKey).subscribe(title => { + this.titleService.setTitle(title); + }); + } + + private init() { + this.translateService.onLangChange.subscribe((event: LangChangeEvent) => { + this._language.next(this.translateService.currentLang); + this.renderer.setAttribute(document.querySelector('html'), 'lang', this.translateService.currentLang); + this.updateTitle(); + }); + } + + private getPageTitle(routeSnapshot: ActivatedRouteSnapshot) { + let title: string = routeSnapshot.data && routeSnapshot.data['pageTitle'] ? routeSnapshot.data['pageTitle'] : 'gatewayApp'; + if (routeSnapshot.firstChild) { + title = this.getPageTitle(routeSnapshot.firstChild) || title; + } + return title; + } +} diff --git a/jhipster/jhipster-uaa/gateway/src/main/webapp/app/core/login/login-modal.service.ts b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/core/login/login-modal.service.ts new file mode 100644 index 0000000000..a0002aa56b --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/core/login/login-modal.service.ts @@ -0,0 +1,27 @@ +import { Injectable } from '@angular/core'; +import { NgbModal, NgbModalRef } from '@ng-bootstrap/ng-bootstrap'; + +import { JhiLoginModalComponent } from 'app/shared/login/login.component'; + +@Injectable({ providedIn: 'root' }) +export class LoginModalService { + private isOpen = false; + constructor(private modalService: NgbModal) {} + + open(): NgbModalRef { + if (this.isOpen) { + return; + } + this.isOpen = true; + const modalRef = this.modalService.open(JhiLoginModalComponent); + modalRef.result.then( + result => { + this.isOpen = false; + }, + reason => { + this.isOpen = false; + } + ); + return modalRef; + } +} diff --git a/jhipster/jhipster-uaa/gateway/src/main/webapp/app/core/login/login.service.ts b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/core/login/login.service.ts new file mode 100644 index 0000000000..0a2970dc02 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/core/login/login.service.ts @@ -0,0 +1,47 @@ +import { Injectable } from '@angular/core'; +import { JhiLanguageService } from 'ng-jhipster'; + +import { Principal } from '../auth/principal.service'; +import { AuthServerProvider } from '../auth/auth-jwt.service'; + +@Injectable({ providedIn: 'root' }) +export class LoginService { + constructor( + private languageService: JhiLanguageService, + private principal: Principal, + private authServerProvider: AuthServerProvider + ) {} + + login(credentials, callback?) { + const cb = callback || function() {}; + + return new Promise((resolve, reject) => { + this.authServerProvider.login(credentials).subscribe( + data => { + this.principal.identity(true).then(account => { + // After the login the language will be changed to + // the language selected by the user during his registration + if (account !== null) { + this.languageService.changeLanguage(account.langKey); + } + resolve(data); + }); + return cb(); + }, + err => { + this.logout(); + reject(err); + return cb(err); + } + ); + }); + } + + logout() { + if (this.principal.isAuthenticated()) { + this.authServerProvider.logout().subscribe(() => this.principal.authenticate(null)); + } else { + this.principal.authenticate(null); + } + } +} diff --git a/jhipster/jhipster-uaa/gateway/src/main/webapp/app/core/user/account.model.ts b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/core/user/account.model.ts new file mode 100644 index 0000000000..35679657e3 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/core/user/account.model.ts @@ -0,0 +1,12 @@ +export class Account { + constructor( + public activated: boolean, + public authorities: string[], + public email: string, + public firstName: string, + public langKey: string, + public lastName: string, + public login: string, + public imageUrl: string + ) {} +} diff --git a/jhipster/jhipster-uaa/gateway/src/main/webapp/app/core/user/user.model.ts b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/core/user/user.model.ts new file mode 100644 index 0000000000..e82da11ac5 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/core/user/user.model.ts @@ -0,0 +1,47 @@ +export interface IUser { + id?: any; + login?: string; + firstName?: string; + lastName?: string; + email?: string; + activated?: boolean; + langKey?: string; + authorities?: any[]; + createdBy?: string; + createdDate?: Date; + lastModifiedBy?: string; + lastModifiedDate?: Date; + password?: string; +} + +export class User implements IUser { + constructor( + public id?: any, + public login?: string, + public firstName?: string, + public lastName?: string, + public email?: string, + public activated?: boolean, + public langKey?: string, + public authorities?: any[], + public createdBy?: string, + public createdDate?: Date, + public lastModifiedBy?: string, + public lastModifiedDate?: Date, + public password?: string + ) { + this.id = id ? id : null; + this.login = login ? login : null; + this.firstName = firstName ? firstName : null; + this.lastName = lastName ? lastName : null; + this.email = email ? email : null; + this.activated = activated ? activated : false; + this.langKey = langKey ? langKey : null; + this.authorities = authorities ? authorities : null; + this.createdBy = createdBy ? createdBy : null; + this.createdDate = createdDate ? createdDate : null; + this.lastModifiedBy = lastModifiedBy ? lastModifiedBy : null; + this.lastModifiedDate = lastModifiedDate ? lastModifiedDate : null; + this.password = password ? password : null; + } +} diff --git a/jhipster/jhipster-uaa/gateway/src/main/webapp/app/core/user/user.service.ts b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/core/user/user.service.ts new file mode 100644 index 0000000000..2b0a46f7cd --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/core/user/user.service.ts @@ -0,0 +1,39 @@ +import { Injectable } from '@angular/core'; +import { HttpClient, HttpResponse } from '@angular/common/http'; +import { Observable, of } from 'rxjs'; + +import { SERVER_API_URL } from 'app/app.constants'; +import { createRequestOption } from 'app/shared/util/request-util'; +import { IUser } from './user.model'; + +@Injectable({ providedIn: 'root' }) +export class UserService { + private resourceUrl = SERVER_API_URL + 'uaa/api/users'; + + constructor(private http: HttpClient) {} + + create(user: IUser): Observable> { + return this.http.post(this.resourceUrl, user, { observe: 'response' }); + } + + update(user: IUser): Observable> { + return this.http.put(this.resourceUrl, user, { observe: 'response' }); + } + + find(login: string): Observable> { + return this.http.get(`${this.resourceUrl}/${login}`, { observe: 'response' }); + } + + query(req?: any): Observable> { + const options = createRequestOption(req); + return this.http.get(this.resourceUrl, { params: options, observe: 'response' }); + } + + delete(login: string): Observable> { + return this.http.delete(`${this.resourceUrl}/${login}`, { observe: 'response' }); + } + + authorities(): Observable { + return this.http.get(SERVER_API_URL + 'uaa/api/users/authorities'); + } +} diff --git a/jhipster/jhipster-uaa/gateway/src/main/webapp/app/entities/entity.module.ts b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/entities/entity.module.ts new file mode 100644 index 0000000000..0c0ba652ad --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/entities/entity.module.ts @@ -0,0 +1,17 @@ +import { NgModule, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core'; + +import { GatewayQuoteModule as QuotesQuoteModule } from './quotes/quote/quote.module'; +/* jhipster-needle-add-entity-module-import - JHipster will add entity modules imports here */ + +@NgModule({ + // prettier-ignore + imports: [ + QuotesQuoteModule, + /* jhipster-needle-add-entity-module - JHipster will add entity modules here */ + ], + declarations: [], + entryComponents: [], + providers: [], + schemas: [CUSTOM_ELEMENTS_SCHEMA] +}) +export class GatewayEntityModule {} diff --git a/jhipster/jhipster-uaa/gateway/src/main/webapp/app/entities/quotes/quote/index.ts b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/entities/quotes/quote/index.ts new file mode 100644 index 0000000000..0944894e50 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/entities/quotes/quote/index.ts @@ -0,0 +1,6 @@ +export * from './quote.service'; +export * from './quote-update.component'; +export * from './quote-delete-dialog.component'; +export * from './quote-detail.component'; +export * from './quote.component'; +export * from './quote.route'; diff --git a/jhipster/jhipster-uaa/gateway/src/main/webapp/app/entities/quotes/quote/quote-delete-dialog.component.html b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/entities/quotes/quote/quote-delete-dialog.component.html new file mode 100644 index 0000000000..c915ac0411 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/entities/quotes/quote/quote-delete-dialog.component.html @@ -0,0 +1,19 @@ +
+ + + +
diff --git a/jhipster/jhipster-uaa/gateway/src/main/webapp/app/entities/quotes/quote/quote-delete-dialog.component.ts b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/entities/quotes/quote/quote-delete-dialog.component.ts new file mode 100644 index 0000000000..585f3bbcdd --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/entities/quotes/quote/quote-delete-dialog.component.ts @@ -0,0 +1,65 @@ +import { Component, OnInit, OnDestroy } from '@angular/core'; +import { ActivatedRoute, Router } from '@angular/router'; + +import { NgbActiveModal, NgbModal, NgbModalRef } from '@ng-bootstrap/ng-bootstrap'; +import { JhiEventManager } from 'ng-jhipster'; + +import { IQuote } from 'app/shared/model/quotes/quote.model'; +import { QuoteService } from './quote.service'; + +@Component({ + selector: 'jhi-quote-delete-dialog', + templateUrl: './quote-delete-dialog.component.html' +}) +export class QuoteDeleteDialogComponent { + quote: IQuote; + + constructor(private quoteService: QuoteService, public activeModal: NgbActiveModal, private eventManager: JhiEventManager) {} + + clear() { + this.activeModal.dismiss('cancel'); + } + + confirmDelete(id: number) { + this.quoteService.delete(id).subscribe(response => { + this.eventManager.broadcast({ + name: 'quoteListModification', + content: 'Deleted an quote' + }); + this.activeModal.dismiss(true); + }); + } +} + +@Component({ + selector: 'jhi-quote-delete-popup', + template: '' +}) +export class QuoteDeletePopupComponent implements OnInit, OnDestroy { + private ngbModalRef: NgbModalRef; + + constructor(private activatedRoute: ActivatedRoute, private router: Router, private modalService: NgbModal) {} + + ngOnInit() { + this.activatedRoute.data.subscribe(({ quote }) => { + setTimeout(() => { + this.ngbModalRef = this.modalService.open(QuoteDeleteDialogComponent as Component, { size: 'lg', backdrop: 'static' }); + this.ngbModalRef.componentInstance.quote = quote; + this.ngbModalRef.result.then( + result => { + this.router.navigate([{ outlets: { popup: null } }], { replaceUrl: true, queryParamsHandling: 'merge' }); + this.ngbModalRef = null; + }, + reason => { + this.router.navigate([{ outlets: { popup: null } }], { replaceUrl: true, queryParamsHandling: 'merge' }); + this.ngbModalRef = null; + } + ); + }, 0); + }); + } + + ngOnDestroy() { + this.ngbModalRef = null; + } +} diff --git a/jhipster/jhipster-uaa/gateway/src/main/webapp/app/entities/quotes/quote/quote-detail.component.html b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/entities/quotes/quote/quote-detail.component.html new file mode 100644 index 0000000000..b18be8b19f --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/entities/quotes/quote/quote-detail.component.html @@ -0,0 +1,35 @@ +
+
+
+

Quote {{quote.id}}

+
+ +
+
Symbol
+
+ {{quote.symbol}} +
+
Price
+
+ {{quote.price}} +
+
Last Trade
+
+ {{quote.lastTrade}} +
+
+ + + + +
+
+
diff --git a/jhipster/jhipster-uaa/gateway/src/main/webapp/app/entities/quotes/quote/quote-detail.component.ts b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/entities/quotes/quote/quote-detail.component.ts new file mode 100644 index 0000000000..9c6ac3e8f1 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/entities/quotes/quote/quote-detail.component.ts @@ -0,0 +1,24 @@ +import { Component, OnInit } from '@angular/core'; +import { ActivatedRoute } from '@angular/router'; + +import { IQuote } from 'app/shared/model/quotes/quote.model'; + +@Component({ + selector: 'jhi-quote-detail', + templateUrl: './quote-detail.component.html' +}) +export class QuoteDetailComponent implements OnInit { + quote: IQuote; + + constructor(private activatedRoute: ActivatedRoute) {} + + ngOnInit() { + this.activatedRoute.data.subscribe(({ quote }) => { + this.quote = quote; + }); + } + + previousState() { + window.history.back(); + } +} diff --git a/jhipster/jhipster-uaa/gateway/src/main/webapp/app/entities/quotes/quote/quote-update.component.html b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/entities/quotes/quote/quote-update.component.html new file mode 100644 index 0000000000..fe76ccd9e6 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/entities/quotes/quote/quote-update.component.html @@ -0,0 +1,67 @@ +
+
+
+

Create or edit a Quote

+
+ +
+ + +
+
+ + +
+ + This field is required. + +
+
+
+ + +
+ + This field is required. + + + This field should be a number. + +
+
+
+ +
+ +
+
+ + This field is required. + + + This field should be a date and time. + +
+
+ +
+
+ + +
+
+
+
diff --git a/jhipster/jhipster-uaa/gateway/src/main/webapp/app/entities/quotes/quote/quote-update.component.ts b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/entities/quotes/quote/quote-update.component.ts new file mode 100644 index 0000000000..06badc70dd --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/entities/quotes/quote/quote-update.component.ts @@ -0,0 +1,56 @@ +import { Component, OnInit } from '@angular/core'; +import { ActivatedRoute } from '@angular/router'; +import { HttpResponse, HttpErrorResponse } from '@angular/common/http'; +import { Observable } from 'rxjs'; +import * as moment from 'moment'; +import { DATE_TIME_FORMAT } from 'app/shared/constants/input.constants'; + +import { IQuote } from 'app/shared/model/quotes/quote.model'; +import { QuoteService } from './quote.service'; + +@Component({ + selector: 'jhi-quote-update', + templateUrl: './quote-update.component.html' +}) +export class QuoteUpdateComponent implements OnInit { + quote: IQuote; + isSaving: boolean; + lastTrade: string; + + constructor(private quoteService: QuoteService, private activatedRoute: ActivatedRoute) {} + + ngOnInit() { + this.isSaving = false; + this.activatedRoute.data.subscribe(({ quote }) => { + this.quote = quote; + this.lastTrade = this.quote.lastTrade != null ? this.quote.lastTrade.format(DATE_TIME_FORMAT) : null; + }); + } + + previousState() { + window.history.back(); + } + + save() { + this.isSaving = true; + this.quote.lastTrade = this.lastTrade != null ? moment(this.lastTrade, DATE_TIME_FORMAT) : null; + if (this.quote.id !== undefined) { + this.subscribeToSaveResponse(this.quoteService.update(this.quote)); + } else { + this.subscribeToSaveResponse(this.quoteService.create(this.quote)); + } + } + + private subscribeToSaveResponse(result: Observable>) { + result.subscribe((res: HttpResponse) => this.onSaveSuccess(), (res: HttpErrorResponse) => this.onSaveError()); + } + + private onSaveSuccess() { + this.isSaving = false; + this.previousState(); + } + + private onSaveError() { + this.isSaving = false; + } +} diff --git a/jhipster/jhipster-uaa/gateway/src/main/webapp/app/entities/quotes/quote/quote.component.html b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/entities/quotes/quote/quote.component.html new file mode 100644 index 0000000000..20362f3799 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/entities/quotes/quote/quote.component.html @@ -0,0 +1,66 @@ +
+

+ Quotes + +

+ +
+
+ + + + + + + + + + + + + + + + + + + +
ID Symbol Price Last Trade
{{quote.id}}{{quote.symbol}}{{quote.price}}{{quote.lastTrade | date:'medium'}} +
+ + + +
+
+
+
+
+ +
+
+ +
+
+
diff --git a/jhipster/jhipster-uaa/gateway/src/main/webapp/app/entities/quotes/quote/quote.component.ts b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/entities/quotes/quote/quote.component.ts new file mode 100644 index 0000000000..c855ceeafb --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/entities/quotes/quote/quote.component.ts @@ -0,0 +1,132 @@ +import { Component, OnInit, OnDestroy } from '@angular/core'; +import { HttpErrorResponse, HttpHeaders, HttpResponse } from '@angular/common/http'; +import { ActivatedRoute, Router } from '@angular/router'; +import { Subscription } from 'rxjs'; +import { JhiEventManager, JhiParseLinks, JhiAlertService } from 'ng-jhipster'; + +import { IQuote } from 'app/shared/model/quotes/quote.model'; +import { Principal } from 'app/core'; + +import { ITEMS_PER_PAGE } from 'app/shared'; +import { QuoteService } from './quote.service'; + +@Component({ + selector: 'jhi-quote', + templateUrl: './quote.component.html' +}) +export class QuoteComponent implements OnInit, OnDestroy { + currentAccount: any; + quotes: IQuote[]; + error: any; + success: any; + eventSubscriber: Subscription; + routeData: any; + links: any; + totalItems: any; + queryCount: any; + itemsPerPage: any; + page: any; + predicate: any; + previousPage: any; + reverse: any; + + constructor( + private quoteService: QuoteService, + private parseLinks: JhiParseLinks, + private jhiAlertService: JhiAlertService, + private principal: Principal, + private activatedRoute: ActivatedRoute, + private router: Router, + private eventManager: JhiEventManager + ) { + this.itemsPerPage = ITEMS_PER_PAGE; + this.routeData = this.activatedRoute.data.subscribe(data => { + this.page = data.pagingParams.page; + this.previousPage = data.pagingParams.page; + this.reverse = data.pagingParams.ascending; + this.predicate = data.pagingParams.predicate; + }); + } + + loadAll() { + this.quoteService + .query({ + page: this.page - 1, + size: this.itemsPerPage, + sort: this.sort() + }) + .subscribe( + (res: HttpResponse) => this.paginateQuotes(res.body, res.headers), + (res: HttpErrorResponse) => this.onError(res.message) + ); + } + + loadPage(page: number) { + if (page !== this.previousPage) { + this.previousPage = page; + this.transition(); + } + } + + transition() { + this.router.navigate(['/quote'], { + queryParams: { + page: this.page, + size: this.itemsPerPage, + sort: this.predicate + ',' + (this.reverse ? 'asc' : 'desc') + } + }); + this.loadAll(); + } + + clear() { + this.page = 0; + this.router.navigate([ + '/quote', + { + page: this.page, + sort: this.predicate + ',' + (this.reverse ? 'asc' : 'desc') + } + ]); + this.loadAll(); + } + + ngOnInit() { + this.loadAll(); + this.principal.identity().then(account => { + this.currentAccount = account; + }); + this.registerChangeInQuotes(); + } + + ngOnDestroy() { + this.eventManager.destroy(this.eventSubscriber); + } + + trackId(index: number, item: IQuote) { + return item.id; + } + + registerChangeInQuotes() { + this.eventSubscriber = this.eventManager.subscribe('quoteListModification', response => this.loadAll()); + } + + sort() { + const result = [this.predicate + ',' + (this.reverse ? 'asc' : 'desc')]; + if (this.predicate !== 'id') { + result.push('id'); + } + return result; + } + + private paginateQuotes(data: IQuote[], headers: HttpHeaders) { + this.links = this.parseLinks.parse(headers.get('link')); + this.totalItems = parseInt(headers.get('X-Total-Count'), 10); + this.queryCount = this.totalItems; + this.quotes = data; + } + + private onError(errorMessage: string) { + this.jhiAlertService.error(errorMessage, null, null); + } +} diff --git a/jhipster/jhipster-uaa/gateway/src/main/webapp/app/entities/quotes/quote/quote.module.ts b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/entities/quotes/quote/quote.module.ts new file mode 100644 index 0000000000..b29613b4a4 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/entities/quotes/quote/quote.module.ts @@ -0,0 +1,23 @@ +import { NgModule, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core'; +import { RouterModule } from '@angular/router'; + +import { GatewaySharedModule } from 'app/shared'; +import { + QuoteComponent, + QuoteDetailComponent, + QuoteUpdateComponent, + QuoteDeletePopupComponent, + QuoteDeleteDialogComponent, + quoteRoute, + quotePopupRoute +} from './'; + +const ENTITY_STATES = [...quoteRoute, ...quotePopupRoute]; + +@NgModule({ + imports: [GatewaySharedModule, RouterModule.forChild(ENTITY_STATES)], + declarations: [QuoteComponent, QuoteDetailComponent, QuoteUpdateComponent, QuoteDeleteDialogComponent, QuoteDeletePopupComponent], + entryComponents: [QuoteComponent, QuoteUpdateComponent, QuoteDeleteDialogComponent, QuoteDeletePopupComponent], + schemas: [CUSTOM_ELEMENTS_SCHEMA] +}) +export class GatewayQuoteModule {} diff --git a/jhipster/jhipster-uaa/gateway/src/main/webapp/app/entities/quotes/quote/quote.route.ts b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/entities/quotes/quote/quote.route.ts new file mode 100644 index 0000000000..1479f1c56a --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/entities/quotes/quote/quote.route.ts @@ -0,0 +1,95 @@ +import { Injectable } from '@angular/core'; +import { HttpResponse } from '@angular/common/http'; +import { Resolve, ActivatedRouteSnapshot, RouterStateSnapshot, Routes } from '@angular/router'; +import { JhiPaginationUtil, JhiResolvePagingParams } from 'ng-jhipster'; +import { UserRouteAccessService } from 'app/core'; +import { of } from 'rxjs'; +import { map } from 'rxjs/operators'; +import { Quote } from 'app/shared/model/quotes/quote.model'; +import { QuoteService } from './quote.service'; +import { QuoteComponent } from './quote.component'; +import { QuoteDetailComponent } from './quote-detail.component'; +import { QuoteUpdateComponent } from './quote-update.component'; +import { QuoteDeletePopupComponent } from './quote-delete-dialog.component'; +import { IQuote } from 'app/shared/model/quotes/quote.model'; + +@Injectable({ providedIn: 'root' }) +export class QuoteResolve implements Resolve { + constructor(private service: QuoteService) {} + + resolve(route: ActivatedRouteSnapshot, state: RouterStateSnapshot) { + const id = route.params['id'] ? route.params['id'] : null; + if (id) { + return this.service.find(id).pipe(map((quote: HttpResponse) => quote.body)); + } + return of(new Quote()); + } +} + +export const quoteRoute: Routes = [ + { + path: 'quote', + component: QuoteComponent, + resolve: { + pagingParams: JhiResolvePagingParams + }, + data: { + authorities: ['ROLE_USER'], + defaultSort: 'id,asc', + pageTitle: 'gatewayApp.quotesQuote.home.title' + }, + canActivate: [UserRouteAccessService] + }, + { + path: 'quote/:id/view', + component: QuoteDetailComponent, + resolve: { + quote: QuoteResolve + }, + data: { + authorities: ['ROLE_USER'], + pageTitle: 'gatewayApp.quotesQuote.home.title' + }, + canActivate: [UserRouteAccessService] + }, + { + path: 'quote/new', + component: QuoteUpdateComponent, + resolve: { + quote: QuoteResolve + }, + data: { + authorities: ['ROLE_USER'], + pageTitle: 'gatewayApp.quotesQuote.home.title' + }, + canActivate: [UserRouteAccessService] + }, + { + path: 'quote/:id/edit', + component: QuoteUpdateComponent, + resolve: { + quote: QuoteResolve + }, + data: { + authorities: ['ROLE_USER'], + pageTitle: 'gatewayApp.quotesQuote.home.title' + }, + canActivate: [UserRouteAccessService] + } +]; + +export const quotePopupRoute: Routes = [ + { + path: 'quote/:id/delete', + component: QuoteDeletePopupComponent, + resolve: { + quote: QuoteResolve + }, + data: { + authorities: ['ROLE_USER'], + pageTitle: 'gatewayApp.quotesQuote.home.title' + }, + canActivate: [UserRouteAccessService], + outlet: 'popup' + } +]; diff --git a/jhipster/jhipster-uaa/gateway/src/main/webapp/app/entities/quotes/quote/quote.service.ts b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/entities/quotes/quote/quote.service.ts new file mode 100644 index 0000000000..3551d0e3e8 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/entities/quotes/quote/quote.service.ts @@ -0,0 +1,70 @@ +import { Injectable } from '@angular/core'; +import { HttpClient, HttpResponse } from '@angular/common/http'; +import { Observable } from 'rxjs'; +import * as moment from 'moment'; +import { DATE_FORMAT } from 'app/shared/constants/input.constants'; +import { map } from 'rxjs/operators'; + +import { SERVER_API_URL } from 'app/app.constants'; +import { createRequestOption } from 'app/shared'; +import { IQuote } from 'app/shared/model/quotes/quote.model'; + +type EntityResponseType = HttpResponse; +type EntityArrayResponseType = HttpResponse; + +@Injectable({ providedIn: 'root' }) +export class QuoteService { + private resourceUrl = SERVER_API_URL + 'quotes/api/quotes'; + + constructor(private http: HttpClient) {} + + create(quote: IQuote): Observable { + const copy = this.convertDateFromClient(quote); + return this.http + .post(this.resourceUrl, copy, { observe: 'response' }) + .pipe(map((res: EntityResponseType) => this.convertDateFromServer(res))); + } + + update(quote: IQuote): Observable { + const copy = this.convertDateFromClient(quote); + return this.http + .put(this.resourceUrl, copy, { observe: 'response' }) + .pipe(map((res: EntityResponseType) => this.convertDateFromServer(res))); + } + + find(id: number): Observable { + return this.http + .get(`${this.resourceUrl}/${id}`, { observe: 'response' }) + .pipe(map((res: EntityResponseType) => this.convertDateFromServer(res))); + } + + query(req?: any): Observable { + const options = createRequestOption(req); + return this.http + .get(this.resourceUrl, { params: options, observe: 'response' }) + .pipe(map((res: EntityArrayResponseType) => this.convertDateArrayFromServer(res))); + } + + delete(id: number): Observable> { + return this.http.delete(`${this.resourceUrl}/${id}`, { observe: 'response' }); + } + + private convertDateFromClient(quote: IQuote): IQuote { + const copy: IQuote = Object.assign({}, quote, { + lastTrade: quote.lastTrade != null && quote.lastTrade.isValid() ? quote.lastTrade.toJSON() : null + }); + return copy; + } + + private convertDateFromServer(res: EntityResponseType): EntityResponseType { + res.body.lastTrade = res.body.lastTrade != null ? moment(res.body.lastTrade) : null; + return res; + } + + private convertDateArrayFromServer(res: EntityArrayResponseType): EntityArrayResponseType { + res.body.forEach((quote: IQuote) => { + quote.lastTrade = quote.lastTrade != null ? moment(quote.lastTrade) : null; + }); + return res; + } +} diff --git a/jhipster/jhipster-uaa/gateway/src/main/webapp/app/home/home.component.html b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/home/home.component.html new file mode 100644 index 0000000000..0afe9ec7ed --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/home/home.component.html @@ -0,0 +1,41 @@ +
+
+ +
+
+

Welcome, Java Hipster!

+

This is your homepage

+ +
+
+ You are logged in as user "{{account.login}}". +
+ +
+ If you want to + sign in, you can try the default accounts:
- Administrator (login="admin" and password="admin")
- User (login="user" and password="user").
+
+
+ You don't have an account yet?  + Register a new account +
+
+ +

+ If you have any question on JHipster: +

+ + + +

+ If you like JHipster, don't forget to give us a star on GitHub! +

+
+
diff --git a/jhipster/jhipster-uaa/gateway/src/main/webapp/app/home/home.component.ts b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/home/home.component.ts new file mode 100644 index 0000000000..4c155c521b --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/home/home.component.ts @@ -0,0 +1,40 @@ +import { Component, OnInit } from '@angular/core'; +import { NgbModalRef } from '@ng-bootstrap/ng-bootstrap'; +import { JhiEventManager } from 'ng-jhipster'; + +import { LoginModalService, Principal, Account } from 'app/core'; + +@Component({ + selector: 'jhi-home', + templateUrl: './home.component.html', + styleUrls: ['home.scss'] +}) +export class HomeComponent implements OnInit { + account: Account; + modalRef: NgbModalRef; + + constructor(private principal: Principal, private loginModalService: LoginModalService, private eventManager: JhiEventManager) {} + + ngOnInit() { + this.principal.identity().then(account => { + this.account = account; + }); + this.registerAuthenticationSuccess(); + } + + registerAuthenticationSuccess() { + this.eventManager.subscribe('authenticationSuccess', message => { + this.principal.identity().then(account => { + this.account = account; + }); + }); + } + + isAuthenticated() { + return this.principal.isAuthenticated(); + } + + login() { + this.modalRef = this.loginModalService.open(); + } +} diff --git a/jhipster/jhipster-uaa/gateway/src/main/webapp/app/home/home.module.ts b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/home/home.module.ts new file mode 100644 index 0000000000..9d3e34c3d3 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/home/home.module.ts @@ -0,0 +1,12 @@ +import { NgModule, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core'; +import { RouterModule } from '@angular/router'; + +import { GatewaySharedModule } from 'app/shared'; +import { HOME_ROUTE, HomeComponent } from './'; + +@NgModule({ + imports: [GatewaySharedModule, RouterModule.forChild([HOME_ROUTE])], + declarations: [HomeComponent], + schemas: [CUSTOM_ELEMENTS_SCHEMA] +}) +export class GatewayHomeModule {} diff --git a/jhipster/jhipster-uaa/gateway/src/main/webapp/app/home/home.route.ts b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/home/home.route.ts new file mode 100644 index 0000000000..cfa1a3fb42 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/home/home.route.ts @@ -0,0 +1,12 @@ +import { Route } from '@angular/router'; + +import { HomeComponent } from './'; + +export const HOME_ROUTE: Route = { + path: '', + component: HomeComponent, + data: { + authorities: [], + pageTitle: 'home.title' + } +}; diff --git a/jhipster/jhipster-uaa/gateway/src/main/webapp/app/home/home.scss b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/home/home.scss new file mode 100644 index 0000000000..e0545ef6f5 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/home/home.scss @@ -0,0 +1,23 @@ +/* ========================================================================== +Main page styles +========================================================================== */ + +.hipster { + display: inline-block; + width: 347px; + height: 497px; + background: url('../../content/images/hipster.png') no-repeat center top; + background-size: contain; +} + +/* wait autoprefixer update to allow simple generation of high pixel density media query */ +@media only screen and (-webkit-min-device-pixel-ratio: 2), + only screen and (-moz-min-device-pixel-ratio: 2), + only screen and (-o-min-device-pixel-ratio: 2/1), + only screen and (min-resolution: 192dpi), + only screen and (min-resolution: 2dppx) { + .hipster { + background: url('../../content/images/hipster2x.png') no-repeat center top; + background-size: contain; + } +} diff --git a/jhipster/jhipster-uaa/gateway/src/main/webapp/app/home/index.ts b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/home/index.ts new file mode 100644 index 0000000000..d76285b277 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/home/index.ts @@ -0,0 +1,3 @@ +export * from './home.component'; +export * from './home.route'; +export * from './home.module'; diff --git a/jhipster/jhipster-uaa/gateway/src/main/webapp/app/layouts/error/error.component.html b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/layouts/error/error.component.html new file mode 100644 index 0000000000..78e20d984e --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/layouts/error/error.component.html @@ -0,0 +1,17 @@ +
+
+
+ +
+
+

Error Page!

+ +
+
{{errorMessage}} +
+
+
You are not authorized to access this page. +
+
+
+
diff --git a/jhipster/jhipster-uaa/gateway/src/main/webapp/app/layouts/error/error.component.ts b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/layouts/error/error.component.ts new file mode 100644 index 0000000000..3548172827 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/layouts/error/error.component.ts @@ -0,0 +1,24 @@ +import { Component, OnInit } from '@angular/core'; +import { ActivatedRoute } from '@angular/router'; + +@Component({ + selector: 'jhi-error', + templateUrl: './error.component.html' +}) +export class ErrorComponent implements OnInit { + errorMessage: string; + error403: boolean; + + constructor(private route: ActivatedRoute) {} + + ngOnInit() { + this.route.data.subscribe(routeData => { + if (routeData.error403) { + this.error403 = routeData.error403; + } + if (routeData.errorMessage) { + this.errorMessage = routeData.errorMessage; + } + }); + } +} diff --git a/jhipster/jhipster-uaa/gateway/src/main/webapp/app/layouts/error/error.route.ts b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/layouts/error/error.route.ts new file mode 100644 index 0000000000..365249d627 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/layouts/error/error.route.ts @@ -0,0 +1,23 @@ +import { Routes } from '@angular/router'; + +import { ErrorComponent } from './error.component'; + +export const errorRoute: Routes = [ + { + path: 'error', + component: ErrorComponent, + data: { + authorities: [], + pageTitle: 'error.title' + } + }, + { + path: 'accessdenied', + component: ErrorComponent, + data: { + authorities: [], + pageTitle: 'error.title', + error403: true + } + } +]; diff --git a/jhipster/jhipster-uaa/gateway/src/main/webapp/app/layouts/footer/footer.component.html b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/layouts/footer/footer.component.html new file mode 100644 index 0000000000..9312ad063e --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/layouts/footer/footer.component.html @@ -0,0 +1,3 @@ + diff --git a/jhipster/jhipster-uaa/gateway/src/main/webapp/app/layouts/footer/footer.component.ts b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/layouts/footer/footer.component.ts new file mode 100644 index 0000000000..37da8bca75 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/layouts/footer/footer.component.ts @@ -0,0 +1,7 @@ +import { Component } from '@angular/core'; + +@Component({ + selector: 'jhi-footer', + templateUrl: './footer.component.html' +}) +export class FooterComponent {} diff --git a/jhipster/jhipster-uaa/gateway/src/main/webapp/app/layouts/index.ts b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/layouts/index.ts new file mode 100644 index 0000000000..d7432602a7 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/layouts/index.ts @@ -0,0 +1,10 @@ +export * from './error/error.component'; +export * from './error/error.route'; +export * from './main/main.component'; +export * from './footer/footer.component'; +export * from './navbar/navbar.component'; +export * from './navbar/navbar.route'; +export * from './navbar/active-menu.directive'; +export * from './profiles/page-ribbon.component'; +export * from './profiles/profile.service'; +export * from './profiles/profile-info.model'; diff --git a/jhipster/jhipster-uaa/gateway/src/main/webapp/app/layouts/main/main.component.html b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/layouts/main/main.component.html new file mode 100644 index 0000000000..5bcd12ab0b --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/layouts/main/main.component.html @@ -0,0 +1,11 @@ + +
+ +
+
+
+ + +
+ +
diff --git a/jhipster/jhipster-uaa/gateway/src/main/webapp/app/layouts/main/main.component.ts b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/layouts/main/main.component.ts new file mode 100644 index 0000000000..4554218504 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/layouts/main/main.component.ts @@ -0,0 +1,28 @@ +import { Component, OnInit } from '@angular/core'; +import { Router, ActivatedRouteSnapshot, NavigationEnd } from '@angular/router'; + +import { JhiLanguageHelper } from 'app/core'; + +@Component({ + selector: 'jhi-main', + templateUrl: './main.component.html' +}) +export class JhiMainComponent implements OnInit { + constructor(private jhiLanguageHelper: JhiLanguageHelper, private router: Router) {} + + private getPageTitle(routeSnapshot: ActivatedRouteSnapshot) { + let title: string = routeSnapshot.data && routeSnapshot.data['pageTitle'] ? routeSnapshot.data['pageTitle'] : 'gatewayApp'; + if (routeSnapshot.firstChild) { + title = this.getPageTitle(routeSnapshot.firstChild) || title; + } + return title; + } + + ngOnInit() { + this.router.events.subscribe(event => { + if (event instanceof NavigationEnd) { + this.jhiLanguageHelper.updateTitle(this.getPageTitle(this.router.routerState.snapshot.root)); + } + }); + } +} diff --git a/jhipster/jhipster-uaa/gateway/src/main/webapp/app/layouts/navbar/active-menu.directive.ts b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/layouts/navbar/active-menu.directive.ts new file mode 100644 index 0000000000..edbdeb94fd --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/layouts/navbar/active-menu.directive.ts @@ -0,0 +1,26 @@ +import { Directive, OnInit, ElementRef, Renderer, Input } from '@angular/core'; +import { TranslateService, LangChangeEvent } from '@ngx-translate/core'; + +@Directive({ + selector: '[jhiActiveMenu]' +}) +export class ActiveMenuDirective implements OnInit { + @Input() jhiActiveMenu: string; + + constructor(private el: ElementRef, private renderer: Renderer, private translateService: TranslateService) {} + + ngOnInit() { + this.translateService.onLangChange.subscribe((event: LangChangeEvent) => { + this.updateActiveFlag(event.lang); + }); + this.updateActiveFlag(this.translateService.currentLang); + } + + updateActiveFlag(selectedLanguage) { + if (this.jhiActiveMenu === selectedLanguage) { + this.renderer.setElementClass(this.el.nativeElement, 'active', true); + } else { + this.renderer.setElementClass(this.el.nativeElement, 'active', false); + } + } +} diff --git a/jhipster/jhipster-uaa/gateway/src/main/webapp/app/layouts/navbar/navbar.component.html b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/layouts/navbar/navbar.component.html new file mode 100644 index 0000000000..4491fd34bb --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/layouts/navbar/navbar.component.html @@ -0,0 +1,166 @@ + diff --git a/jhipster/jhipster-uaa/gateway/src/main/webapp/app/layouts/navbar/navbar.component.ts b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/layouts/navbar/navbar.component.ts new file mode 100644 index 0000000000..e16b4d343f --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/layouts/navbar/navbar.component.ts @@ -0,0 +1,76 @@ +import { Component, OnInit } from '@angular/core'; +import { Router } from '@angular/router'; +import { NgbModalRef } from '@ng-bootstrap/ng-bootstrap'; +import { JhiLanguageService } from 'ng-jhipster'; + +import { VERSION } from 'app/app.constants'; +import { JhiLanguageHelper, Principal, LoginModalService, LoginService } from 'app/core'; +import { ProfileService } from '../profiles/profile.service'; + +@Component({ + selector: 'jhi-navbar', + templateUrl: './navbar.component.html', + styleUrls: ['navbar.scss'] +}) +export class NavbarComponent implements OnInit { + inProduction: boolean; + isNavbarCollapsed: boolean; + languages: any[]; + swaggerEnabled: boolean; + modalRef: NgbModalRef; + version: string; + + constructor( + private loginService: LoginService, + private languageService: JhiLanguageService, + private languageHelper: JhiLanguageHelper, + private principal: Principal, + private loginModalService: LoginModalService, + private profileService: ProfileService, + private router: Router + ) { + this.version = VERSION ? 'v' + VERSION : ''; + this.isNavbarCollapsed = true; + } + + ngOnInit() { + this.languageHelper.getAll().then(languages => { + this.languages = languages; + }); + + this.profileService.getProfileInfo().then(profileInfo => { + this.inProduction = profileInfo.inProduction; + this.swaggerEnabled = profileInfo.swaggerEnabled; + }); + } + + changeLanguage(languageKey: string) { + this.languageService.changeLanguage(languageKey); + } + + collapseNavbar() { + this.isNavbarCollapsed = true; + } + + isAuthenticated() { + return this.principal.isAuthenticated(); + } + + login() { + this.modalRef = this.loginModalService.open(); + } + + logout() { + this.collapseNavbar(); + this.loginService.logout(); + this.router.navigate(['']); + } + + toggleNavbar() { + this.isNavbarCollapsed = !this.isNavbarCollapsed; + } + + getImageUrl() { + return this.isAuthenticated() ? this.principal.getImageUrl() : null; + } +} diff --git a/jhipster/jhipster-uaa/gateway/src/main/webapp/app/layouts/navbar/navbar.route.ts b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/layouts/navbar/navbar.route.ts new file mode 100644 index 0000000000..317d99604b --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/layouts/navbar/navbar.route.ts @@ -0,0 +1,9 @@ +import { Route } from '@angular/router'; + +import { NavbarComponent } from './navbar.component'; + +export const navbarRoute: Route = { + path: '', + component: NavbarComponent, + outlet: 'navbar' +}; diff --git a/jhipster/jhipster-uaa/gateway/src/main/webapp/app/layouts/navbar/navbar.scss b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/layouts/navbar/navbar.scss new file mode 100644 index 0000000000..be76638270 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/layouts/navbar/navbar.scss @@ -0,0 +1,78 @@ +/* ========================================================================== +Navbar +========================================================================== */ + +.navbar-version { + font-size: 10px; + color: #ccc; +} + +.jh-navbar { + background-color: #353d47; + padding: 0.2em 1em; + .profile-image { + margin: -10px 0px; + height: 40px; + width: 40px; + border-radius: 50%; + } + .dropdown-item.active, + .dropdown-item.active:focus, + .dropdown-item.active:hover { + background-color: #353d47; + } + .dropdown-toggle::after { + margin-left: 0.15em; + } + ul.navbar-nav { + padding: 0.5em; + .nav-item { + margin-left: 1.5rem; + } + } + a.nav-link { + font-weight: 400; + } + .jh-navbar-toggler { + color: #ccc; + font-size: 1.5em; + padding: 10px; + &:hover { + color: #fff; + } + } +} + +@media screen and (min-width: 768px) { + .jh-navbar-toggler { + display: none; + } +} + +@media screen and (max-width: 992px) { + .jh-logo-container { + width: 100%; + } +} + +.navbar-title { + display: inline-block; + vertical-align: middle; +} + +/* ========================================================================== +Logo styles +========================================================================== */ +.navbar-brand { + &.logo { + padding: 5px 15px; + .logo-img { + height: 45px; + width: 70px; + display: inline-block; + vertical-align: middle; + background: url('../../../content/images/logo-jhipster.png') no-repeat center center; + background-size: contain; + } + } +} diff --git a/jhipster/jhipster-uaa/gateway/src/main/webapp/app/layouts/profiles/page-ribbon.component.ts b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/layouts/profiles/page-ribbon.component.ts new file mode 100644 index 0000000000..f2c48078b4 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/layouts/profiles/page-ribbon.component.ts @@ -0,0 +1,22 @@ +import { Component, OnInit } from '@angular/core'; +import { ProfileService } from './profile.service'; +import { ProfileInfo } from './profile-info.model'; + +@Component({ + selector: 'jhi-page-ribbon', + template: ``, + styleUrls: ['page-ribbon.scss'] +}) +export class PageRibbonComponent implements OnInit { + profileInfo: ProfileInfo; + ribbonEnv: string; + + constructor(private profileService: ProfileService) {} + + ngOnInit() { + this.profileService.getProfileInfo().then(profileInfo => { + this.profileInfo = profileInfo; + this.ribbonEnv = profileInfo.ribbonEnv; + }); + } +} diff --git a/jhipster/jhipster-uaa/gateway/src/main/webapp/app/layouts/profiles/page-ribbon.scss b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/layouts/profiles/page-ribbon.scss new file mode 100644 index 0000000000..90125b70cb --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/layouts/profiles/page-ribbon.scss @@ -0,0 +1,31 @@ +/* ========================================================================== +Developement Ribbon +========================================================================== */ +.ribbon { + background-color: rgba(170, 0, 0, 0.5); + left: -3.5em; + -moz-transform: rotate(-45deg); + -ms-transform: rotate(-45deg); + -o-transform: rotate(-45deg); + -webkit-transform: rotate(-45deg); + transform: rotate(-45deg); + overflow: hidden; + position: absolute; + top: 40px; + white-space: nowrap; + width: 15em; + z-index: 9999; + pointer-events: none; + opacity: 0.75; + a { + color: #fff; + display: block; + font-weight: 400; + margin: 1px 0; + padding: 10px 50px; + text-align: center; + text-decoration: none; + text-shadow: 0 0 5px #444; + pointer-events: none; + } +} diff --git a/jhipster/jhipster-uaa/gateway/src/main/webapp/app/layouts/profiles/profile-info.model.ts b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/layouts/profiles/profile-info.model.ts new file mode 100644 index 0000000000..f1adc52c7b --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/layouts/profiles/profile-info.model.ts @@ -0,0 +1,6 @@ +export class ProfileInfo { + activeProfiles: string[]; + ribbonEnv: string; + inProduction: boolean; + swaggerEnabled: boolean; +} diff --git a/jhipster/jhipster-uaa/gateway/src/main/webapp/app/layouts/profiles/profile.service.ts b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/layouts/profiles/profile.service.ts new file mode 100644 index 0000000000..d07fad7e7f --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/layouts/profiles/profile.service.ts @@ -0,0 +1,40 @@ +import { Injectable } from '@angular/core'; +import { HttpClient, HttpResponse } from '@angular/common/http'; + +import { SERVER_API_URL } from 'app/app.constants'; +import { ProfileInfo } from './profile-info.model'; +import { map } from 'rxjs/operators'; + +@Injectable({ providedIn: 'root' }) +export class ProfileService { + private infoUrl = SERVER_API_URL + 'management/info'; + private profileInfo: Promise; + + constructor(private http: HttpClient) {} + + getProfileInfo(): Promise { + if (!this.profileInfo) { + this.profileInfo = this.http + .get(this.infoUrl, { observe: 'response' }) + .pipe( + map((res: HttpResponse) => { + const data = res.body; + const pi = new ProfileInfo(); + pi.activeProfiles = data['activeProfiles']; + const displayRibbonOnProfiles = data['display-ribbon-on-profiles'].split(','); + if (pi.activeProfiles) { + const ribbonProfiles = displayRibbonOnProfiles.filter(profile => pi.activeProfiles.includes(profile)); + if (ribbonProfiles.length !== 0) { + pi.ribbonEnv = ribbonProfiles[0]; + } + pi.inProduction = pi.activeProfiles.includes('prod'); + pi.swaggerEnabled = pi.activeProfiles.includes('swagger'); + } + return pi; + }) + ) + .toPromise(); + } + return this.profileInfo; + } +} diff --git a/jhipster/jhipster-uaa/gateway/src/main/webapp/app/polyfills.ts b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/polyfills.ts new file mode 100644 index 0000000000..cf38f3221b --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/polyfills.ts @@ -0,0 +1,70 @@ +/** + * 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/es7/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'; + +require('../manifest.webapp'); diff --git a/jhipster/jhipster-uaa/gateway/src/main/webapp/app/shared/alert/alert-error.component.ts b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/shared/alert/alert-error.component.ts new file mode 100644 index 0000000000..6553dcc312 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/shared/alert/alert-error.component.ts @@ -0,0 +1,115 @@ +import { Component, OnDestroy } from '@angular/core'; +import { TranslateService } from '@ngx-translate/core'; +import { JhiEventManager, JhiAlertService } from 'ng-jhipster'; +import { Subscription } from 'rxjs'; + +@Component({ + selector: 'jhi-alert-error', + template: ` + ` +}) +export class JhiAlertErrorComponent implements OnDestroy { + alerts: any[]; + cleanHttpErrorListener: Subscription; + /* tslint:disable */ + constructor(private alertService: JhiAlertService, private eventManager: JhiEventManager, private translateService: TranslateService) { + /* tslint:enable */ + this.alerts = []; + + this.cleanHttpErrorListener = eventManager.subscribe('gatewayApp.httpError', response => { + let i; + const httpErrorResponse = response.content; + switch (httpErrorResponse.status) { + // connection refused, server not reachable + case 0: + this.addErrorAlert('Server not reachable', 'error.server.not.reachable'); + break; + + case 400: + const arr = httpErrorResponse.headers.keys(); + let errorHeader = null; + let entityKey = null; + arr.forEach(entry => { + if (entry.toLowerCase().endsWith('app-error')) { + errorHeader = httpErrorResponse.headers.get(entry); + } else if (entry.toLowerCase().endsWith('app-params')) { + entityKey = httpErrorResponse.headers.get(entry); + } + }); + if (errorHeader) { + const entityName = translateService.instant('global.menu.entities.' + entityKey); + this.addErrorAlert(errorHeader, errorHeader, { entityName }); + } else if (httpErrorResponse.error !== '' && httpErrorResponse.error.fieldErrors) { + const fieldErrors = httpErrorResponse.error.fieldErrors; + for (i = 0; i < fieldErrors.length; i++) { + const fieldError = fieldErrors[i]; + if (['Min', 'Max', 'DecimalMin', 'DecimalMax'].includes(fieldError.message)) { + fieldError.message = 'Size'; + } + // convert 'something[14].other[4].id' to 'something[].other[].id' so translations can be written to it + const convertedField = fieldError.field.replace(/\[\d*\]/g, '[]'); + const fieldName = translateService.instant('gatewayApp.' + fieldError.objectName + '.' + convertedField); + this.addErrorAlert('Error on field "' + fieldName + '"', 'error.' + fieldError.message, { fieldName }); + } + } else if (httpErrorResponse.error !== '' && httpErrorResponse.error.message) { + this.addErrorAlert( + httpErrorResponse.error.message, + httpErrorResponse.error.message, + httpErrorResponse.error.params + ); + } else { + this.addErrorAlert(httpErrorResponse.error); + } + break; + + case 404: + this.addErrorAlert('Not found', 'error.url.not.found'); + break; + + default: + if (httpErrorResponse.error !== '' && httpErrorResponse.error.message) { + this.addErrorAlert(httpErrorResponse.error.message); + } else { + this.addErrorAlert(httpErrorResponse.error); + } + } + }); + } + + setClasses(alert) { + return { + toast: !!alert.toast, + [alert.position]: true + }; + } + + ngOnDestroy() { + if (this.cleanHttpErrorListener !== undefined && this.cleanHttpErrorListener !== null) { + this.eventManager.destroy(this.cleanHttpErrorListener); + this.alerts = []; + } + } + + addErrorAlert(message, key?, data?) { + key = key && key !== null ? key : message; + this.alerts.push( + this.alertService.addAlert( + { + type: 'danger', + msg: key, + params: data, + timeout: 5000, + toast: this.alertService.isToast(), + scoped: true + }, + this.alerts + ) + ); + } +} diff --git a/jhipster/jhipster-uaa/gateway/src/main/webapp/app/shared/alert/alert.component.ts b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/shared/alert/alert.component.ts new file mode 100644 index 0000000000..b864f53066 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/shared/alert/alert.component.ts @@ -0,0 +1,34 @@ +import { Component, OnDestroy, OnInit } from '@angular/core'; +import { JhiAlertService } from 'ng-jhipster'; + +@Component({ + selector: 'jhi-alert', + template: ` + ` +}) +export class JhiAlertComponent implements OnInit, OnDestroy { + alerts: any[]; + + constructor(private alertService: JhiAlertService) {} + + ngOnInit() { + this.alerts = this.alertService.get(); + } + + setClasses(alert) { + return { + toast: !!alert.toast, + [alert.position]: true + }; + } + + ngOnDestroy() { + this.alerts = []; + } +} diff --git a/jhipster/jhipster-uaa/gateway/src/main/webapp/app/shared/auth/has-any-authority.directive.ts b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/shared/auth/has-any-authority.directive.ts new file mode 100644 index 0000000000..16a7d40858 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/shared/auth/has-any-authority.directive.ts @@ -0,0 +1,39 @@ +import { Directive, Input, TemplateRef, ViewContainerRef } from '@angular/core'; +import { Principal } from 'app/core/auth/principal.service'; + +/** + * @whatItDoes Conditionally includes an HTML element if current user has any + * of the authorities passed as the `expression`. + * + * @howToUse + * ``` + * ... + * + * ... + * ``` + */ +@Directive({ + selector: '[jhiHasAnyAuthority]' +}) +export class HasAnyAuthorityDirective { + private authorities: string[]; + + constructor(private principal: Principal, private templateRef: TemplateRef, private viewContainerRef: ViewContainerRef) {} + + @Input() + set jhiHasAnyAuthority(value: string | string[]) { + this.authorities = typeof value === 'string' ? [value] : value; + this.updateView(); + // Get notified each time authentication state changes. + this.principal.getAuthenticationState().subscribe(identity => this.updateView()); + } + + private updateView(): void { + this.principal.hasAnyAuthority(this.authorities).then(result => { + this.viewContainerRef.clear(); + if (result) { + this.viewContainerRef.createEmbeddedView(this.templateRef); + } + }); + } +} diff --git a/jhipster/jhipster-uaa/gateway/src/main/webapp/app/shared/constants/error.constants.ts b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/shared/constants/error.constants.ts new file mode 100644 index 0000000000..2ebea94220 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/shared/constants/error.constants.ts @@ -0,0 +1,4 @@ +export const PROBLEM_BASE_URL = 'https://www.jhipster.tech/problem'; +export const EMAIL_ALREADY_USED_TYPE = PROBLEM_BASE_URL + '/email-already-used'; +export const LOGIN_ALREADY_USED_TYPE = PROBLEM_BASE_URL + '/login-already-used'; +export const EMAIL_NOT_FOUND_TYPE = PROBLEM_BASE_URL + '/email-not-found'; diff --git a/jhipster/jhipster-uaa/gateway/src/main/webapp/app/shared/constants/input.constants.ts b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/shared/constants/input.constants.ts new file mode 100644 index 0000000000..1e3978a9b3 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/shared/constants/input.constants.ts @@ -0,0 +1,2 @@ +export const DATE_FORMAT = 'YYYY-MM-DD'; +export const DATE_TIME_FORMAT = 'YYYY-MM-DDTHH:mm'; diff --git a/jhipster/jhipster-uaa/gateway/src/main/webapp/app/shared/constants/pagination.constants.ts b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/shared/constants/pagination.constants.ts new file mode 100644 index 0000000000..a148d4579b --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/shared/constants/pagination.constants.ts @@ -0,0 +1 @@ +export const ITEMS_PER_PAGE = 20; diff --git a/jhipster/jhipster-uaa/gateway/src/main/webapp/app/shared/index.ts b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/shared/index.ts new file mode 100644 index 0000000000..27d7cc078c --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/shared/index.ts @@ -0,0 +1,13 @@ +export * from './constants/error.constants'; +export * from './constants/pagination.constants'; +export * from './constants/input.constants'; +export * from './alert/alert.component'; +export * from './alert/alert-error.component'; +export * from './auth/has-any-authority.directive'; +export * from './language/find-language-from-key.pipe'; +export * from './login/login.component'; +export * from './util/request-util'; +export * from './shared-libs.module'; +export * from './shared-common.module'; +export * from './shared.module'; +export * from './util/datepicker-adapter'; diff --git a/jhipster/jhipster-uaa/gateway/src/main/webapp/app/shared/language/find-language-from-key.pipe.ts b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/shared/language/find-language-from-key.pipe.ts new file mode 100644 index 0000000000..0886c9297b --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/shared/language/find-language-from-key.pipe.ts @@ -0,0 +1,14 @@ +import { Pipe, PipeTransform } from '@angular/core'; + +@Pipe({ name: 'findLanguageFromKey' }) +export class FindLanguageFromKeyPipe implements PipeTransform { + private languages: any = { + en: { name: 'English' }, + fr: { name: 'Français' }, + 'pt-br': { name: 'Português (Brasil)' } + // jhipster-needle-i18n-language-key-pipe - JHipster will add/remove languages in this object + }; + transform(lang: string): string { + return this.languages[lang].name; + } +} diff --git a/jhipster/jhipster-uaa/gateway/src/main/webapp/app/shared/login/login.component.html b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/shared/login/login.component.html new file mode 100644 index 0000000000..6112e0a657 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/shared/login/login.component.html @@ -0,0 +1,43 @@ + + diff --git a/jhipster/jhipster-uaa/gateway/src/main/webapp/app/shared/login/login.component.ts b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/shared/login/login.component.ts new file mode 100644 index 0000000000..6715983b2c --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/shared/login/login.component.ts @@ -0,0 +1,87 @@ +import { Component, AfterViewInit, Renderer, ElementRef } from '@angular/core'; +import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap'; +import { Router } from '@angular/router'; +import { JhiEventManager } from 'ng-jhipster'; + +import { LoginService } from 'app/core/login/login.service'; +import { StateStorageService } from 'app/core/auth/state-storage.service'; + +@Component({ + selector: 'jhi-login-modal', + templateUrl: './login.component.html' +}) +export class JhiLoginModalComponent implements AfterViewInit { + authenticationError: boolean; + password: string; + rememberMe: boolean; + username: string; + credentials: any; + + constructor( + private eventManager: JhiEventManager, + private loginService: LoginService, + private stateStorageService: StateStorageService, + private elementRef: ElementRef, + private renderer: Renderer, + private router: Router, + public activeModal: NgbActiveModal + ) { + this.credentials = {}; + } + + ngAfterViewInit() { + setTimeout(() => this.renderer.invokeElementMethod(this.elementRef.nativeElement.querySelector('#username'), 'focus', []), 0); + } + + cancel() { + this.credentials = { + username: null, + password: null, + rememberMe: true + }; + this.authenticationError = false; + this.activeModal.dismiss('cancel'); + } + + login() { + this.loginService + .login({ + username: this.username, + password: this.password, + rememberMe: this.rememberMe + }) + .then(() => { + this.authenticationError = false; + this.activeModal.dismiss('login success'); + if (this.router.url === '/register' || /^\/activate\//.test(this.router.url) || /^\/reset\//.test(this.router.url)) { + this.router.navigate(['']); + } + + this.eventManager.broadcast({ + name: 'authenticationSuccess', + content: 'Sending Authentication Success' + }); + + // previousState was set in the authExpiredInterceptor before being redirected to login modal. + // since login is succesful, go to stored previousState and clear previousState + const redirect = this.stateStorageService.getUrl(); + if (redirect) { + this.stateStorageService.storeUrl(null); + this.router.navigate([redirect]); + } + }) + .catch(() => { + this.authenticationError = true; + }); + } + + register() { + this.activeModal.dismiss('to state register'); + this.router.navigate(['/register']); + } + + requestResetPassword() { + this.activeModal.dismiss('to state requestReset'); + this.router.navigate(['/reset', 'request']); + } +} diff --git a/jhipster/jhipster-uaa/gateway/src/main/webapp/app/shared/model/quotes/quote.model.ts b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/shared/model/quotes/quote.model.ts new file mode 100644 index 0000000000..a937ab8589 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/shared/model/quotes/quote.model.ts @@ -0,0 +1,12 @@ +import { Moment } from 'moment'; + +export interface IQuote { + id?: number; + symbol?: string; + price?: number; + lastTrade?: Moment; +} + +export class Quote implements IQuote { + constructor(public id?: number, public symbol?: string, public price?: number, public lastTrade?: Moment) {} +} diff --git a/jhipster/jhipster-uaa/gateway/src/main/webapp/app/shared/shared-common.module.ts b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/shared/shared-common.module.ts new file mode 100644 index 0000000000..af68857fe2 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/shared/shared-common.module.ts @@ -0,0 +1,10 @@ +import { NgModule } from '@angular/core'; + +import { GatewaySharedLibsModule, FindLanguageFromKeyPipe, JhiAlertComponent, JhiAlertErrorComponent } from './'; + +@NgModule({ + imports: [GatewaySharedLibsModule], + declarations: [FindLanguageFromKeyPipe, JhiAlertComponent, JhiAlertErrorComponent], + exports: [GatewaySharedLibsModule, FindLanguageFromKeyPipe, JhiAlertComponent, JhiAlertErrorComponent] +}) +export class GatewaySharedCommonModule {} diff --git a/jhipster/jhipster-uaa/gateway/src/main/webapp/app/shared/shared-libs.module.ts b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/shared/shared-libs.module.ts new file mode 100644 index 0000000000..b5fdd1457c --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/shared/shared-libs.module.ts @@ -0,0 +1,26 @@ +import { NgModule } from '@angular/core'; +import { FormsModule } from '@angular/forms'; +import { CommonModule } from '@angular/common'; +import { NgbModule } from '@ng-bootstrap/ng-bootstrap'; +import { NgJhipsterModule } from 'ng-jhipster'; +import { InfiniteScrollModule } from 'ngx-infinite-scroll'; +import { CookieModule } from 'ngx-cookie'; +import { FontAwesomeModule } from '@fortawesome/angular-fontawesome'; + +@NgModule({ + imports: [ + NgbModule.forRoot(), + NgJhipsterModule.forRoot({ + // set below to true to make alerts look like toast + alertAsToast: false, + alertTimeout: 5000, + i18nEnabled: true, + defaultI18nLang: 'en' + }), + InfiniteScrollModule, + CookieModule.forRoot(), + FontAwesomeModule + ], + exports: [FormsModule, CommonModule, NgbModule, NgJhipsterModule, InfiniteScrollModule, FontAwesomeModule] +}) +export class GatewaySharedLibsModule {} diff --git a/jhipster/jhipster-uaa/gateway/src/main/webapp/app/shared/shared.module.ts b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/shared/shared.module.ts new file mode 100644 index 0000000000..d83c1a54f9 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/shared/shared.module.ts @@ -0,0 +1,15 @@ +import { NgModule, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core'; +import { NgbDateAdapter } from '@ng-bootstrap/ng-bootstrap'; + +import { NgbDateMomentAdapter } from './util/datepicker-adapter'; +import { GatewaySharedLibsModule, GatewaySharedCommonModule, JhiLoginModalComponent, HasAnyAuthorityDirective } from './'; + +@NgModule({ + imports: [GatewaySharedLibsModule, GatewaySharedCommonModule], + declarations: [JhiLoginModalComponent, HasAnyAuthorityDirective], + providers: [{ provide: NgbDateAdapter, useClass: NgbDateMomentAdapter }], + entryComponents: [JhiLoginModalComponent], + exports: [GatewaySharedCommonModule, JhiLoginModalComponent, HasAnyAuthorityDirective], + schemas: [CUSTOM_ELEMENTS_SCHEMA] +}) +export class GatewaySharedModule {} diff --git a/jhipster/jhipster-uaa/gateway/src/main/webapp/app/shared/util/datepicker-adapter.ts b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/shared/util/datepicker-adapter.ts new file mode 100644 index 0000000000..61b1bf02dd --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/shared/util/datepicker-adapter.ts @@ -0,0 +1,21 @@ +/** + * Angular bootstrap Date adapter + */ +import { Injectable } from '@angular/core'; +import { NgbDateAdapter, NgbDateStruct } from '@ng-bootstrap/ng-bootstrap'; +import { Moment } from 'moment'; +import * as moment from 'moment'; + +@Injectable() +export class NgbDateMomentAdapter extends NgbDateAdapter { + fromModel(date: Moment): NgbDateStruct { + if (date != null && date.isValid()) { + return { year: date.year(), month: date.month() + 1, day: date.date() }; + } + return null; + } + + toModel(date: NgbDateStruct): Moment { + return date ? moment(date.year + '-' + date.month + '-' + date.day, 'YYYY-MM-DD') : null; + } +} diff --git a/jhipster/jhipster-uaa/gateway/src/main/webapp/app/shared/util/request-util.ts b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/shared/util/request-util.ts new file mode 100644 index 0000000000..6579c3cb2a --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/shared/util/request-util.ts @@ -0,0 +1,18 @@ +import { HttpParams } from '@angular/common/http'; + +export const createRequestOption = (req?: any): HttpParams => { + let options: HttpParams = new HttpParams(); + if (req) { + Object.keys(req).forEach(key => { + if (key !== 'sort') { + options = options.set(key, req[key]); + } + }); + if (req.sort) { + req.sort.forEach(val => { + options = options.append('sort', val); + }); + } + } + return options; +}; diff --git a/jhipster/jhipster-uaa/gateway/src/main/webapp/app/vendor.ts b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/vendor.ts new file mode 100644 index 0000000000..e8923d5c66 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/webapp/app/vendor.ts @@ -0,0 +1,81 @@ +/* after changing this file run 'npm run webpack:build' */ +/* tslint:disable */ +import '../content/scss/vendor.scss'; + +// Imports all fontawesome core and solid icons + +import { library } from '@fortawesome/fontawesome-svg-core'; +import { + faUser, + faSort, + faSortUp, + faSortDown, + faSync, + faEye, + faBan, + faTimes, + faArrowLeft, + faSave, + faPlus, + faPencilAlt, + faBars, + faThList, + faUserPlus, + faRoad, + faTachometerAlt, + faHeart, + faList, + faBell, + faBook, + faHdd, + faFlag, + faWrench, + faClock, + faCloud, + faSignOutAlt, + faSignInAlt, + faCalendarAlt, + faSearch, + faTrashAlt, + faAsterisk, + faTasks, + faHome +} from '@fortawesome/free-solid-svg-icons'; + +// Adds the SVG icon to the library so you can use it in your page +library.add(faUser); +library.add(faSort); +library.add(faSortUp); +library.add(faSortDown); +library.add(faSync); +library.add(faEye); +library.add(faBan); +library.add(faTimes); +library.add(faArrowLeft); +library.add(faSave); +library.add(faPlus); +library.add(faPencilAlt); +library.add(faBars); +library.add(faHome); +library.add(faThList); +library.add(faUserPlus); +library.add(faRoad); +library.add(faTachometerAlt); +library.add(faHeart); +library.add(faList); +library.add(faBell); +library.add(faTasks); +library.add(faBook); +library.add(faHdd); +library.add(faFlag); +library.add(faWrench); +library.add(faClock); +library.add(faCloud); +library.add(faSignOutAlt); +library.add(faSignInAlt); +library.add(faCalendarAlt); +library.add(faSearch); +library.add(faTrashAlt); +library.add(faAsterisk); + +// jhipster-needle-add-element-to-vendor - JHipster will add new menu items here diff --git a/jhipster/jhipster-uaa/gateway/src/main/webapp/content/images/hipster.png b/jhipster/jhipster-uaa/gateway/src/main/webapp/content/images/hipster.png new file mode 100644 index 0000000000..141778d482 Binary files /dev/null and b/jhipster/jhipster-uaa/gateway/src/main/webapp/content/images/hipster.png differ diff --git a/jhipster/jhipster-uaa/gateway/src/main/webapp/content/images/hipster192.png b/jhipster/jhipster-uaa/gateway/src/main/webapp/content/images/hipster192.png new file mode 100644 index 0000000000..2ab1093017 Binary files /dev/null and b/jhipster/jhipster-uaa/gateway/src/main/webapp/content/images/hipster192.png differ diff --git a/jhipster/jhipster-uaa/gateway/src/main/webapp/content/images/hipster256.png b/jhipster/jhipster-uaa/gateway/src/main/webapp/content/images/hipster256.png new file mode 100644 index 0000000000..49d6c76d5d Binary files /dev/null and b/jhipster/jhipster-uaa/gateway/src/main/webapp/content/images/hipster256.png differ diff --git a/jhipster/jhipster-uaa/gateway/src/main/webapp/content/images/hipster2x.png b/jhipster/jhipster-uaa/gateway/src/main/webapp/content/images/hipster2x.png new file mode 100644 index 0000000000..4751c91680 Binary files /dev/null and b/jhipster/jhipster-uaa/gateway/src/main/webapp/content/images/hipster2x.png differ diff --git a/jhipster/jhipster-uaa/gateway/src/main/webapp/content/images/hipster384.png b/jhipster/jhipster-uaa/gateway/src/main/webapp/content/images/hipster384.png new file mode 100644 index 0000000000..616e470fce Binary files /dev/null and b/jhipster/jhipster-uaa/gateway/src/main/webapp/content/images/hipster384.png differ diff --git a/jhipster/jhipster-uaa/gateway/src/main/webapp/content/images/hipster512.png b/jhipster/jhipster-uaa/gateway/src/main/webapp/content/images/hipster512.png new file mode 100644 index 0000000000..61a543639d Binary files /dev/null and b/jhipster/jhipster-uaa/gateway/src/main/webapp/content/images/hipster512.png differ diff --git a/jhipster/jhipster-uaa/gateway/src/main/webapp/content/images/logo-jhipster.png b/jhipster/jhipster-uaa/gateway/src/main/webapp/content/images/logo-jhipster.png new file mode 100644 index 0000000000..d8eb48da05 Binary files /dev/null and b/jhipster/jhipster-uaa/gateway/src/main/webapp/content/images/logo-jhipster.png differ diff --git a/jhipster/jhipster-uaa/gateway/src/main/webapp/content/scss/_bootstrap-variables.scss b/jhipster/jhipster-uaa/gateway/src/main/webapp/content/scss/_bootstrap-variables.scss new file mode 100644 index 0000000000..be0f226497 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/webapp/content/scss/_bootstrap-variables.scss @@ -0,0 +1,42 @@ +/* +* Bootstrap overrides https://getbootstrap.com/docs/4.0/getting-started/theming/ +* All values defined in bootstrap source +* https://github.com/twbs/bootstrap/blob/v4-dev/scss/_variables.scss can be overwritten here +* Make sure not to add !default to values here +*/ + +// Colors: +// Grayscale and brand colors for use across Bootstrap. + +$primary: #3e8acc; +$success: #28a745; +$info: #17a2b8; +$warning: #ffc107; +$danger: #dc3545; + +// Options: +// Quickly modify global styling by enabling or disabling optional features. +$enable-rounded: true; +$enable-shadows: false; +$enable-gradients: false; +$enable-transitions: true; +$enable-hover-media-query: false; +$enable-grid-classes: true; +$enable-print-styles: true; + +// Components: +// Define common padding and border radius sizes and more. + +$border-radius: 0.15rem; +$border-radius-lg: 0.125rem; +$border-radius-sm: 0.1rem; + +// Body: +// Settings for the `` element. + +$body-bg: #e4e5e6; + +// Typography: +// Font, line-height, and color for body text, headings, and more. + +$font-size-base: 1rem; diff --git a/jhipster/jhipster-uaa/gateway/src/main/webapp/content/scss/global.scss b/jhipster/jhipster-uaa/gateway/src/main/webapp/content/scss/global.scss new file mode 100644 index 0000000000..cfbb9bf5b8 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/webapp/content/scss/global.scss @@ -0,0 +1,226 @@ +@import 'bootstrap-variables'; + +/* ============================================================== +Bootstrap tweaks +===============================================================*/ + +body, +h1, +h2, +h3, +h4 { + font-weight: 300; +} + +a { + color: #533f03; + font-weight: bold; +} + +a:hover { + color: #533f03; + font-weight: bold; + /* make sure browsers use the pointer cursor for anchors, even with no href */ + cursor: pointer; +} + +/* ========================================================================== +Browser Upgrade Prompt +========================================================================== */ +.browserupgrade { + margin: 0.2em 0; + background: #ccc; + color: #000; + padding: 0.2em 0; +} + +/* ========================================================================== +Generic styles +========================================================================== */ + +/* Error highlight on input fields */ +.ng-valid[required], +.ng-valid.required { + border-left: 5px solid green; +} + +.ng-invalid:not(form) { + border-left: 5px solid red; +} + +/* other generic styles */ + +.jh-card { + padding: 1.5%; + margin-top: 20px; + border: none; +} + +.error { + color: white; + background-color: red; +} + +.pad { + padding: 10px; +} + +.w-40 { + width: 40% !important; +} + +.w-60 { + width: 60% !important; +} + +.break { + white-space: normal; + word-break: break-all; +} + +.readonly { + background-color: #eee; + opacity: 1; +} + +.footer { + border-top: 1px solid rgba(0, 0, 0, 0.125); +} + +.hand, +[jhisortby] { + cursor: pointer; +} + +/* ========================================================================== +Custom alerts for notification +========================================================================== */ +.alerts { + .alert { + text-overflow: ellipsis; + pre { + background: none; + border: none; + font: inherit; + color: inherit; + padding: 0; + margin: 0; + } + .popover pre { + font-size: 10px; + } + } + .toast { + position: fixed; + width: 100%; + &.left { + left: 5px; + } + &.right { + right: 5px; + } + &.top { + top: 55px; + } + &.bottom { + bottom: 55px; + } + } +} + +@media screen and (min-width: 480px) { + .alerts .toast { + width: 50%; + } +} + +/* ========================================================================== +entity tables helpers +========================================================================== */ + +/* Remove Bootstrap padding from the element +http://stackoverflow.com/questions/19562903/remove-padding-from-columns-in-bootstrap-3 */ +@mixin no-padding($side) { + @if $side == 'all' { + .no-padding { + padding: 0 !important; + } + } @else { + .no-padding-#{$side} { + padding-#{$side}: 0 !important; + } + } +} +@include no-padding('left'); +@include no-padding('right'); +@include no-padding('top'); +@include no-padding('bottom'); +@include no-padding('all'); + +/* bootstrap 3 input-group 100% width +http://stackoverflow.com/questions/23436430/bootstrap-3-input-group-100-width */ +.width-min { + width: 1% !important; +} + +/* Makes toolbar not wrap on smaller screens +http://www.sketchingwithcss.com/samplechapter/cheatsheet.html#right */ +.flex-btn-group-container { + display: -webkit-flex; + display: flex; + -webkit-flex-direction: row; + flex-direction: row; + -webkit-justify-content: flex-end; + justify-content: flex-end; +} + +/* ========================================================================== +entity detail page css +========================================================================== */ +.row.jh-entity-details > { + dd { + margin-bottom: 15px; + } +} + +@media screen and (min-width: 768px) { + .row.jh-entity-details > { + dt { + margin-bottom: 15px; + } + dd { + border-bottom: 1px solid #eee; + padding-left: 180px; + margin-left: 0; + } + } +} + +/* ========================================================================== +ui bootstrap tweaks +========================================================================== */ +.nav, +.pagination, +.carousel, +.panel-title a { + cursor: pointer; +} + +.datetime-picker-dropdown > li.date-picker-menu div > table .btn-default, +.uib-datepicker-popup > li > div.uib-datepicker > table .btn-default { + border: 0; +} + +.datetime-picker-dropdown > li.date-picker-menu div > table:focus, +.uib-datepicker-popup > li > div.uib-datepicker > table:focus { + outline: none; +} + +.thread-dump-modal-lock { + max-width: 450px; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; +} + +/* jhipster-needle-scss-add-main JHipster will add new css style */ diff --git a/jhipster/jhipster-uaa/gateway/src/main/webapp/content/scss/vendor.scss b/jhipster/jhipster-uaa/gateway/src/main/webapp/content/scss/vendor.scss new file mode 100644 index 0000000000..12a8f54b83 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/webapp/content/scss/vendor.scss @@ -0,0 +1,12 @@ +/* after changing this file run 'npm run webpack:build' */ + +/*************************** +put Sass variables here: +eg $input-color: red; +****************************/ +// Override Boostrap variables +@import 'bootstrap-variables'; +// Import Bootstrap source files from node_modules +@import '~bootstrap/scss/bootstrap'; + +/* jhipster-needle-scss-add-vendor JHipster will add new css style */ diff --git a/jhipster/jhipster-uaa/gateway/src/main/webapp/favicon.ico b/jhipster/jhipster-uaa/gateway/src/main/webapp/favicon.ico new file mode 100644 index 0000000000..44c7595f58 Binary files /dev/null and b/jhipster/jhipster-uaa/gateway/src/main/webapp/favicon.ico differ diff --git a/jhipster/jhipster-uaa/gateway/src/main/webapp/i18n/en/activate.json b/jhipster/jhipster-uaa/gateway/src/main/webapp/i18n/en/activate.json new file mode 100644 index 0000000000..2926b78913 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/webapp/i18n/en/activate.json @@ -0,0 +1,9 @@ +{ + "activate": { + "title": "Activation", + "messages": { + "success": "Your user account has been activated. Please ", + "error": "Your user could not be activated. Please use the registration form to sign up." + } + } +} diff --git a/jhipster/jhipster-uaa/gateway/src/main/webapp/i18n/en/audits.json b/jhipster/jhipster-uaa/gateway/src/main/webapp/i18n/en/audits.json new file mode 100644 index 0000000000..ed5e16d4c5 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/webapp/i18n/en/audits.json @@ -0,0 +1,27 @@ +{ + "audits": { + "title": "Audits", + "filter": { + "title": "Filter per date", + "from": "from", + "to": "to", + "button": { + "weeks": "Weeks", + "today": "today", + "clear": "clear", + "close": "close" + } + }, + "table": { + "header": { + "principal": "User", + "date": "Date", + "status": "State", + "data": "Extra data" + }, + "data": { + "remoteAddress": "Remote Address:" + } + } + } +} diff --git a/jhipster/jhipster-uaa/gateway/src/main/webapp/i18n/en/configuration.json b/jhipster/jhipster-uaa/gateway/src/main/webapp/i18n/en/configuration.json new file mode 100644 index 0000000000..81e208de5c --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/webapp/i18n/en/configuration.json @@ -0,0 +1,10 @@ +{ + "configuration": { + "title": "Configuration", + "filter": "Filter (by prefix)", + "table": { + "prefix": "Prefix", + "properties": "Properties" + } + } +} diff --git a/jhipster/jhipster-uaa/gateway/src/main/webapp/i18n/en/error.json b/jhipster/jhipster-uaa/gateway/src/main/webapp/i18n/en/error.json new file mode 100644 index 0000000000..943389899c --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/webapp/i18n/en/error.json @@ -0,0 +1,13 @@ +{ + "error": { + "title": "Error page!", + "http": { + "400": "Bad request.", + "403": "You are not authorized to access this page.", + "405": "The HTTP verb you used is not supported for this URL.", + "500": "Internal server error." + }, + "concurrencyFailure": "Another user modified this data at the same time as you. Your changes were rejected.", + "validation": "Validation error on the server." + } +} diff --git a/jhipster/jhipster-uaa/gateway/src/main/webapp/i18n/en/gateway.json b/jhipster/jhipster-uaa/gateway/src/main/webapp/i18n/en/gateway.json new file mode 100644 index 0000000000..6eb7791bc2 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/webapp/i18n/en/gateway.json @@ -0,0 +1,15 @@ +{ + "gateway": { + "title": "Gateway", + "routes": { + "title": "Current routes", + "url": "URL", + "service": "Service", + "servers": "Available servers", + "error": "Warning: no server available!" + }, + "refresh": { + "button": "Refresh" + } + } +} diff --git a/jhipster/jhipster-uaa/gateway/src/main/webapp/i18n/en/global.json b/jhipster/jhipster-uaa/gateway/src/main/webapp/i18n/en/global.json new file mode 100644 index 0000000000..2de18534e0 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/webapp/i18n/en/global.json @@ -0,0 +1,138 @@ +{ + "global": { + "title": "Gateway", + "browsehappy": "You are using an outdated browser. Please upgrade your browser to improve your experience.", + "menu": { + "home": "Home", + "jhipster-needle-menu-add-element": "JHipster will add additional menu entries here (do not translate!)", + "entities": { + "main": "Entities", + "quotesQuote": "Quote", + "jhipster-needle-menu-add-entry": "JHipster will add additional entities here (do not translate!)" + }, + "account": { + "main": "Account", + "settings": "Settings", + "password": "Password", + "sessions": "Sessions", + "login": "Sign in", + "logout": "Sign out", + "register": "Register" + }, + "admin": { + "main": "Administration", + "gateway": "Gateway", + "userManagement": "User management", + "tracker": "User tracker", + "metrics": "Metrics", + "health": "Health", + "configuration": "Configuration", + "logs": "Logs", + "audits": "Audits", + "apidocs": "API", + "database": "Database", + "jhipster-needle-menu-add-admin-element": "JHipster will add additional menu entries here (do not translate!)" + }, + "language": "Language" + }, + "form": { + "username": "Username", + "username.placeholder": "Your username", + "currentpassword": "Current password", + "currentpassword.placeholder": "Current password", + "newpassword": "New password", + "newpassword.placeholder": "New password", + "confirmpassword": "New password confirmation", + "confirmpassword.placeholder": "Confirm the new password", + "email": "Email", + "email.placeholder": "Your email" + }, + "messages": { + "info": { + "authenticated": { + "prefix": "If you want to ", + "link": "sign in", + "suffix": ", you can try the default accounts:
- Administrator (login=\"admin\" and password=\"admin\")
- User (login=\"user\" and password=\"user\")." + }, + "register": { + "noaccount": "You don't have an account yet?", + "link": "Register a new account" + } + }, + "error": { + "dontmatch": "The password and its confirmation do not match!" + }, + "validate": { + "newpassword": { + "required": "Your password is required.", + "minlength": "Your password is required to be at least 4 characters.", + "maxlength": "Your password cannot be longer than 50 characters.", + "strength": "Password strength:" + }, + "confirmpassword": { + "required": "Your confirmation password is required.", + "minlength": "Your confirmation password is required to be at least 4 characters.", + "maxlength": "Your confirmation password cannot be longer than 50 characters." + }, + "email": { + "required": "Your email is required.", + "invalid": "Your email is invalid.", + "minlength": "Your email is required to be at least 5 characters.", + "maxlength": "Your email cannot be longer than 50 characters." + } + } + }, + "field": { + "id": "ID" + }, + "ribbon": { + "dev":"Development" + }, + "item-count": "Showing {{first}} - {{second}} of {{total}} items." + }, + "entity": { + "action": { + "addblob": "Add blob", + "addimage": "Add image", + "back": "Back", + "cancel": "Cancel", + "delete": "Delete", + "edit": "Edit", + "open": "Open", + "save": "Save", + "view": "View" + }, + "detail": { + "field": "Field", + "value": "Value" + }, + "delete": { + "title": "Confirm delete operation" + }, + "validation": { + "required": "This field is required.", + "minlength": "This field is required to be at least {{ min }} characters.", + "maxlength": "This field cannot be longer than {{ max }} characters.", + "min": "This field should be at least {{ min }}.", + "max": "This field cannot be more than {{ max }}.", + "minbytes": "This field should be at least {{ min }} bytes.", + "maxbytes": "This field cannot be more than {{ max }} bytes.", + "pattern": "This field should follow pattern for {{ pattern }}.", + "number": "This field should be a number.", + "datetimelocal": "This field should be a date and time.", + "patternLogin": "This field can only contain letters, digits and e-mail addresses." + } + }, + "error": { + "internalServerError": "Internal server error", + "server.not.reachable": "Server not reachable", + "url.not.found": "Not found", + "NotNull": "Field {{ fieldName }} cannot be empty!", + "Size": "Field {{ fieldName }} does not meet min/max size requirements!", + "userexists": "Login name already used!", + "emailexists": "Email is already in use!", + "idexists": "A new {{ entityName }} cannot already have an ID", + "idnull": "Invalid ID" + }, + "footer": "This is your footer" +} diff --git a/jhipster/jhipster-uaa/gateway/src/main/webapp/i18n/en/health.json b/jhipster/jhipster-uaa/gateway/src/main/webapp/i18n/en/health.json new file mode 100644 index 0000000000..6084146524 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/webapp/i18n/en/health.json @@ -0,0 +1,32 @@ +{ + "health": { + "title": "Health Checks", + "refresh.button": "Refresh", + "stacktrace": "Stacktrace", + "details": { + "details": "Details", + "properties": "Properties", + "name": "Name", + "value": "Value", + "error": "Error" + }, + "indicator": { + "discoveryComposite": "Discovery Composite", + "refreshScope": "Microservice Refresh Scope", + "configServer": "Microservice Config Server", + "hystrix": "Hystrix", + "diskSpace": "Disk space", + "mail": "Email", + "db": "Database" + }, + "table": { + "service": "Service name", + "status": "Status" + }, + "status": { + "UNKNOWN": "UNKNOWN", + "UP": "UP", + "DOWN": "DOWN" + } + } +} diff --git a/jhipster/jhipster-uaa/gateway/src/main/webapp/i18n/en/home.json b/jhipster/jhipster-uaa/gateway/src/main/webapp/i18n/en/home.json new file mode 100644 index 0000000000..402f18700a --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/webapp/i18n/en/home.json @@ -0,0 +1,19 @@ +{ + "home": { + "title": "Welcome, Java Hipster!", + "subtitle": "This is your homepage", + "logged": { + "message": "You are logged in as user \"{{username}}\"." + }, + "question": "If you have any question on JHipster:", + "link": { + "homepage": "JHipster homepage", + "stackoverflow": "JHipster on Stack Overflow", + "bugtracker": "JHipster bug tracker", + "chat": "JHipster public chat room", + "follow": "follow @java_hipster on Twitter" + }, + "like": "If you like JHipster, don't forget to give us a star on", + "github": "GitHub" + } +} diff --git a/jhipster/jhipster-uaa/gateway/src/main/webapp/i18n/en/login.json b/jhipster/jhipster-uaa/gateway/src/main/webapp/i18n/en/login.json new file mode 100644 index 0000000000..3a000852e6 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/webapp/i18n/en/login.json @@ -0,0 +1,19 @@ +{ + "login": { + "title": "Sign in", + "form": { + "password": "Password", + "password.placeholder": "Your password", + "rememberme": "Remember me", + "button": "Sign in" + }, + "messages": { + "error": { + "authentication": "Failed to sign in! Please check your credentials and try again." + } + }, + "password" : { + "forgot": "Did you forget your password?" + } + } +} diff --git a/jhipster/jhipster-uaa/gateway/src/main/webapp/i18n/en/logs.json b/jhipster/jhipster-uaa/gateway/src/main/webapp/i18n/en/logs.json new file mode 100644 index 0000000000..a614b128da --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/webapp/i18n/en/logs.json @@ -0,0 +1,11 @@ +{ + "logs": { + "title": "Logs", + "nbloggers": "There are {{ total }} loggers.", + "filter": "Filter", + "table": { + "name": "Name", + "level": "Level" + } + } +} diff --git a/jhipster/jhipster-uaa/gateway/src/main/webapp/i18n/en/metrics.json b/jhipster/jhipster-uaa/gateway/src/main/webapp/i18n/en/metrics.json new file mode 100644 index 0000000000..9d804947c5 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/webapp/i18n/en/metrics.json @@ -0,0 +1,101 @@ +{ + "metrics": { + "title": "Application Metrics", + "refresh.button": "Refresh", + "updating": "Updating...", + "jvm": { + "title": "JVM Metrics", + "memory": { + "title": "Memory", + "total": "Total Memory", + "heap": "Heap Memory", + "nonheap": "Non-Heap Memory" + }, + "threads": { + "title": "Threads", + "all": "All", + "runnable": "Runnable", + "timedwaiting": "Timed waiting", + "waiting": "Waiting", + "blocked": "Blocked", + "dump": { + "title": "Threads dump", + "id": "Id: ", + "blockedtime": "Blocked Time", + "blockedcount": "Blocked Count", + "waitedtime": "Waited Time", + "waitedcount": "Waited Count", + "lockname": "Lock name", + "stacktrace": "Stacktrace", + "show": "Show Stacktrace", + "hide": "Hide Stacktrace" + } + }, + "gc": { + "title": "Garbage collections", + "marksweepcount": "Mark Sweep count", + "marksweeptime": "Mark Sweep time", + "scavengecount": "Scavenge count", + "scavengetime": "Scavenge time" + }, + "http": { + "title": "HTTP requests (events per second)", + "active": "Active requests:", + "total": "Total requests:", + "table": { + "code": "Code", + "count": "Count", + "mean": "Mean", + "average": "Average" + }, + "code": { + "ok": "Ok", + "notfound": "Not found", + "servererror": "Server Error" + } + } + }, + "servicesstats": { + "title": "Services statistics (time in millisecond)", + "table": { + "name": "Service name", + "count": "Count", + "mean": "Mean", + "min": "Min", + "max": "Max", + "p50": "p50", + "p75": "p75", + "p95": "p95", + "p99": "p99" + } + }, + "cache": { + "title": "Cache statistics", + "cachename": "Cache name", + "hits": "Cache Hits", + "misses": "Cache Misses", + "gets": "Cache Gets", + "puts": "Cache Puts", + "removals": "Cache Removals", + "evictions": "Cache Evictions", + "hitPercent": "Cache Hit %", + "missPercent": "Cache Miss %", + "averageGetTime": "Average get time (µs)", + "averagePutTime": "Average put time (µs)", + "averageRemoveTime": "Average remove time (µs)" + }, + "datasource": { + "usage": "Usage", + "title": "DataSource statistics (time in millisecond)", + "name": "Pool usage", + "count": "Count", + "mean": "Mean", + "min": "Min", + "max": "Max", + "p50": "p50", + "p75": "p75", + "p95": "p95", + "p99": "p99" + } + } +} diff --git a/jhipster/jhipster-uaa/gateway/src/main/webapp/i18n/en/password.json b/jhipster/jhipster-uaa/gateway/src/main/webapp/i18n/en/password.json new file mode 100644 index 0000000000..46227a7702 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/webapp/i18n/en/password.json @@ -0,0 +1,12 @@ +{ + "password": { + "title": "Password for [{{username}}]", + "form": { + "button": "Save" + }, + "messages": { + "error": "An error has occurred! The password could not be changed.", + "success": "Password changed!" + } + } +} diff --git a/jhipster/jhipster-uaa/gateway/src/main/webapp/i18n/en/quotesQuote.json b/jhipster/jhipster-uaa/gateway/src/main/webapp/i18n/en/quotesQuote.json new file mode 100644 index 0000000000..f538c6c895 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/webapp/i18n/en/quotesQuote.json @@ -0,0 +1,28 @@ + +{ + "gatewayApp": { + "quotesQuote" : { + "home": { + "title": "Quotes", + "createLabel": "Create a new Quote", + "createOrEditLabel": "Create or edit a Quote" + }, + "delete": { + "question": "Are you sure you want to delete Quote {{ id }}?" + }, + "detail": { + "title": "Quote" + }, + "symbol": "Symbol", + "price": "Price", + "lastTrade": "Last Trade" + } + }, + "quotesApp": { + "quotesQuote" : { + "created": "A new Quote is created with identifier {{ param }}", + "updated": "A Quote is updated with identifier {{ param }}", + "deleted": "A Quote is deleted with identifier {{ param }}" + } + } +} diff --git a/jhipster/jhipster-uaa/gateway/src/main/webapp/i18n/en/register.json b/jhipster/jhipster-uaa/gateway/src/main/webapp/i18n/en/register.json new file mode 100644 index 0000000000..3a03980bf2 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/webapp/i18n/en/register.json @@ -0,0 +1,24 @@ +{ + "register": { + "title": "Registration", + "form": { + "button": "Register" + }, + "messages": { + "validate": { + "login": { + "required": "Your username is required.", + "minlength": "Your username is required to be at least 1 character.", + "maxlength": "Your username cannot be longer than 50 characters.", + "pattern": "Your username can only contain letters and digits." + } + }, + "success": "Registration saved! Please check your email for confirmation.", + "error": { + "fail": "Registration failed! Please try again later.", + "userexists": "Login name already registered! Please choose another one.", + "emailexists": "Email is already in use! Please choose another one." + } + } + } +} diff --git a/jhipster/jhipster-uaa/gateway/src/main/webapp/i18n/en/reset.json b/jhipster/jhipster-uaa/gateway/src/main/webapp/i18n/en/reset.json new file mode 100644 index 0000000000..92edb191cd --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/webapp/i18n/en/reset.json @@ -0,0 +1,27 @@ +{ + "reset": { + "request": { + "title": "Reset your password", + "form": { + "button": "Reset password" + }, + "messages": { + "info": "Enter the email address you used to register", + "success": "Check your emails for details on how to reset your password.", + "notfound": "Email address isn't registered! Please check and try again" + } + }, + "finish" : { + "title": "Reset password", + "form": { + "button": "Validate new password" + }, + "messages": { + "info": "Choose a new password", + "success": "Your password has been reset. Please ", + "keymissing": "The reset key is missing.", + "error": "Your password couldn't be reset. Remember a password request is only valid for 24 hours." + } + } + } +} diff --git a/jhipster/jhipster-uaa/gateway/src/main/webapp/i18n/en/sessions.json b/jhipster/jhipster-uaa/gateway/src/main/webapp/i18n/en/sessions.json new file mode 100644 index 0000000000..d410035ee7 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/webapp/i18n/en/sessions.json @@ -0,0 +1,15 @@ +{ + "sessions": { + "title": "Active sessions for [{{username}}]", + "table": { + "ipaddress": "IP address", + "useragent": "User Agent", + "date": "Date", + "button": "Invalidate" + }, + "messages": { + "success": "Session invalidated!", + "error": "An error has occurred! The session could not be invalidated." + } + } +} diff --git a/jhipster/jhipster-uaa/gateway/src/main/webapp/i18n/en/settings.json b/jhipster/jhipster-uaa/gateway/src/main/webapp/i18n/en/settings.json new file mode 100644 index 0000000000..d941381969 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/webapp/i18n/en/settings.json @@ -0,0 +1,32 @@ +{ + "settings": { + "title": "User settings for [{{username}}]", + "form": { + "firstname": "First Name", + "firstname.placeholder": "Your first name", + "lastname": "Last Name", + "lastname.placeholder": "Your last name", + "language": "Language", + "button": "Save" + }, + "messages": { + "error": { + "fail": "An error has occurred! Settings could not be saved.", + "emailexists": "Email is already in use! Please choose another one." + }, + "success": "Settings saved!", + "validate": { + "firstname": { + "required": "Your first name is required.", + "minlength": "Your first name is required to be at least 1 character", + "maxlength": "Your first name cannot be longer than 50 characters" + }, + "lastname": { + "required": "Your last name is required.", + "minlength": "Your last name is required to be at least 1 character", + "maxlength": "Your last name cannot be longer than 50 characters" + } + } + } + } +} diff --git a/jhipster/jhipster-uaa/gateway/src/main/webapp/i18n/en/user-management.json b/jhipster/jhipster-uaa/gateway/src/main/webapp/i18n/en/user-management.json new file mode 100644 index 0000000000..30c125b6d0 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/webapp/i18n/en/user-management.json @@ -0,0 +1,30 @@ +{ + "userManagement": { + "home": { + "title": "Users", + "createLabel": "Create a new user", + "createOrEditLabel": "Create or edit a user" + }, + "created": "A new user is created with identifier {{ param }}", + "updated": "An user is updated with identifier {{ param }}", + "deleted": "An user is deleted with identifier {{ param }}", + "delete": { + "question": "Are you sure you want to delete user {{ login }}?" + }, + "detail": { + "title": "User" + }, + "login": "Login", + "firstName": "First name", + "lastName": "Last name", + "email": "Email", + "activated": "Activated", + "deactivated": "Deactivated", + "profiles": "Profiles", + "langKey": "Language", + "createdBy": "Created by", + "createdDate": "Created date", + "lastModifiedBy": "Modified by", + "lastModifiedDate": "Modified date" + } +} diff --git a/jhipster/jhipster-uaa/gateway/src/main/webapp/i18n/fr/activate.json b/jhipster/jhipster-uaa/gateway/src/main/webapp/i18n/fr/activate.json new file mode 100644 index 0000000000..d9a3de0b24 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/webapp/i18n/fr/activate.json @@ -0,0 +1,9 @@ +{ + "activate": { + "title": "Activation", + "messages": { + "success": "Votre compte utilisateur a été activé. Merci de vous ", + "error": "Votre compte utilisateur n'a pas pu être activé. Utilisez le formulaire d'enregistrement pour en créer un nouveau." + } + } +} diff --git a/jhipster/jhipster-uaa/gateway/src/main/webapp/i18n/fr/audits.json b/jhipster/jhipster-uaa/gateway/src/main/webapp/i18n/fr/audits.json new file mode 100644 index 0000000000..d4c4e06ab7 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/webapp/i18n/fr/audits.json @@ -0,0 +1,27 @@ +{ + "audits": { + "title": "Audits", + "filter": { + "title": "Filtrer par date", + "from": "De", + "to": "à", + "button": { + "weeks": "Semaines", + "today": "Aujourd'hui", + "clear": "Effacer", + "close": "Fermer" + } + }, + "table": { + "header": { + "principal": "Utilisateur", + "date": "Date", + "status": "Status", + "data": "Autres données" + }, + "data": { + "remoteAddress": "Adresse Distante :" + } + } + } +} diff --git a/jhipster/jhipster-uaa/gateway/src/main/webapp/i18n/fr/configuration.json b/jhipster/jhipster-uaa/gateway/src/main/webapp/i18n/fr/configuration.json new file mode 100644 index 0000000000..2b2ae1297f --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/webapp/i18n/fr/configuration.json @@ -0,0 +1,10 @@ +{ + "configuration": { + "title": "Configuration", + "filter": "Filtrer (par préfixe)", + "table": { + "prefix": "Préfixe", + "properties": "Propriétés" + } + } +} diff --git a/jhipster/jhipster-uaa/gateway/src/main/webapp/i18n/fr/error.json b/jhipster/jhipster-uaa/gateway/src/main/webapp/i18n/fr/error.json new file mode 100644 index 0000000000..71a601a381 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/webapp/i18n/fr/error.json @@ -0,0 +1,13 @@ +{ + "error": { + "title": "Page d'erreur !", + "http": { + "400": "Mauvaise requête.", + "403": "Vous n'avez pas les droits pour accéder à cette page.", + "405": "Le verbe HTTP que vous avez utilisé n'est pas reconnu par cet URL.", + "500": "Erreur interne du serveur." + }, + "concurrencyFailure": "Un autre utilisateur a modifié ces données en même temps que vous. Vos changements n'ont pas été sauvegardés.", + "validation": "Erreur de validation côté serveur." + } +} diff --git a/jhipster/jhipster-uaa/gateway/src/main/webapp/i18n/fr/gateway.json b/jhipster/jhipster-uaa/gateway/src/main/webapp/i18n/fr/gateway.json new file mode 100644 index 0000000000..31abf02831 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/webapp/i18n/fr/gateway.json @@ -0,0 +1,15 @@ +{ + "gateway": { + "title": "Gateway", + "routes": { + "title": "Routes actuelles", + "url": "URL", + "service": "Service", + "servers": "Serveurs disponibles", + "error": "Attention : aucun serveur disponible !" + }, + "refresh": { + "button": "Rafraîchir" + } + } +} diff --git a/jhipster/jhipster-uaa/gateway/src/main/webapp/i18n/fr/global.json b/jhipster/jhipster-uaa/gateway/src/main/webapp/i18n/fr/global.json new file mode 100644 index 0000000000..2143410005 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/webapp/i18n/fr/global.json @@ -0,0 +1,137 @@ +{ + "global": { + "title": "Gateway", + "browsehappy": "Vous utilisez un ancien navigateur. Veuillez mettre à jour votre navigateur pour une meilleure expérience.", + "menu": { + "home": "Accueil", + "jhipster-needle-menu-add-element": "JHipster will add additional menu entries here (do not translate!)", + "entities": { + "main": "Entités", + "quotesQuote": "Quote", + "jhipster-needle-menu-add-entry": "JHipster will add additional entities here (do not translate!)" + }, + "account": { + "main": "Compte", + "settings": "Profil", + "password": "Mot de passe", + "sessions": "Sessions", + "login": "S'authentifier", + "logout": "Déconnexion", + "register": "Créer un compte" + }, + "admin": { + "main": "Administration", + "gateway": "Gateway", + "userManagement": "Gestion des utilisateurs", + "tracker": "Suivi des utilisateurs", + "metrics": "Métriques", + "health": "Diagnostics", + "configuration": "Configuration", + "logs": "Logs", + "audits": "Audits", + "apidocs": "API", + "database": "Base de données", + "jhipster-needle-menu-add-admin-element": "JHipster will add additional menu entries here (do not translate!)" + }, + "language": "Langue" + }, + "form": { + "username": "Nom d'utilisateur", + "username.placeholder": "Votre nom d'utilisateur", + "currentpassword": "Current password", + "currentpassword.placeholder": "Current password", + "newpassword": "Nouveau mot de passe", + "newpassword.placeholder": "Nouveau mot de passe", + "confirmpassword": "Confirmation du nouveau mot de passe", + "confirmpassword.placeholder": "Confirmation du nouveau mot de passe", + "email": "Email", + "email.placeholder": "Votre email" + }, + "messages": { + "info": { + "authenticated": { + "prefix": "Si vous voulez vous ", + "link": "connecter", + "suffix": ", vous pouvez utiliser les comptes par défaut :
- Administrateur (nom d'utilisateur=\"admin\" et mot de passe =\"admin\")
- Utilisateur (nom d'utilisateur=\"user\" et mot de passe =\"user\")." + }, + "register": { + "noaccount": "Vous n'avez pas encore de compte ?", + "link": "Créer un compte" + } + }, + "error": { + "dontmatch": "Le nouveau mot de passe et sa confirmation ne sont pas égaux !" + }, + "validate": { + "newpassword": { + "required": "Votre mot de passe est requis.", + "minlength": "Votre mot de passe doit comporter au moins 5 caractères.", + "maxlength": "Votre mot de passe ne doit pas comporter plus de 50 caractères.", + "strength": "Robustesse du mot de passe :" + }, + "confirmpassword": { + "required": "Votre confirmation du mot de passe est requise.", + "minlength": "Votre confirmation du mot de passe doit comporter au moins 5 caractères.", + "maxlength": "Votre confirmation du mot de passe ne doit pas comporter plus de 50 caractères." + }, + "email": { + "required": "Votre email est requis.", + "minlength": "Votre email doit comporter au moins 5 caractères.", + "maxlength": "Votre email ne doit pas comporter plus de 50 caractères.", + "invalid": "Votre email n'est pas valide." + } + } + }, + "field": { + "id": "ID" + }, + "ribbon": { + "dev":"Développement" + }, + "item-count": "Affichage {{first}} - {{second}} de {{total}} items." + }, + "entity": { + "action": { + "addblob": "Ajouter blob", + "addimage": "Ajouter image", + "back": "Retour", + "cancel": "Annuler", + "edit": "Editer", + "delete": "Supprimer", + "open": "Ouvrir", + "save": "Sauvegarder", + "view": "Voir" + }, + "detail": { + "field": "Champs", + "value": "Valeur" + }, + "delete": { + "title": "Confirmation de suppression" + }, + "validation": { + "required": "Ce champ est obligatoire.", + "minlength": "Ce champ doit faire au minimum {{min}} caractères.", + "maxlength": "Ce champ doit faire moins de {{max}} caractères.", + "min": "Ce champ doit être supérieur à {{min}}.", + "max": "Ce champ doit être inférieur à {{max}}.", + "minbytes": "Ce champ doit être supérieur à {{min}} bytes.", + "maxbytes": "Ce champ doit être inférieur à {{max}} bytes.", + "pattern": "Ce champ doit suivre l'expression régulière {{pattern}}.", + "number": "Ce champ doit être un nombre.", + "datetimelocal": "Ce champ doit être une date et une heure." + } + }, + "error": { + "internalServerError": "Erreur interne du serveur", + "server.not.reachable": "Serveur inaccessible", + "url.not.found": "Non trouvé", + "NotNull": "Le champ {{fieldName}} ne peut pas être vide !", + "Size": "Le champ {{fieldName}} ne respecte pas les critères minimum et maximum !", + "userexists": "Login déjà utilisé !", + "emailexists": "Email déjà utilisé !", + "idexists": "Une nouvelle entité {{entityName}} ne peut pas avoir d'ID !", + "idnull": "Invalid ID" + }, + "footer": "Ceci est votre pied de page" +} diff --git a/jhipster/jhipster-uaa/gateway/src/main/webapp/i18n/fr/health.json b/jhipster/jhipster-uaa/gateway/src/main/webapp/i18n/fr/health.json new file mode 100644 index 0000000000..ec52f4c421 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/webapp/i18n/fr/health.json @@ -0,0 +1,32 @@ +{ + "health": { + "title": "Diagnostics", + "refresh.button": "Rafraichir", + "stacktrace": "Stacktrace", + "details": { + "details": "Détails", + "properties": "Propriétés", + "name": "Nom", + "value": "Valeur", + "error": "Erreur" + }, + "indicator": { + "discoveryComposite": "Discovery Composite", + "refreshScope": "Microservice Refresh Scope", + "configServer": "Microservice Config Server", + "hystrix": "Hystrix", + "diskSpace": "Espace disque", + "mail": "Email", + "db": "Base de données" + }, + "table": { + "service": "Nom du service", + "status": "Etat" + }, + "status": { + "UNKNOWN": "UNKNOWN", + "UP": "DISPONIBLE", + "DOWN": "HORS SERVICE" + } + } +} diff --git a/jhipster/jhipster-uaa/gateway/src/main/webapp/i18n/fr/home.json b/jhipster/jhipster-uaa/gateway/src/main/webapp/i18n/fr/home.json new file mode 100644 index 0000000000..634a6e9816 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/webapp/i18n/fr/home.json @@ -0,0 +1,19 @@ +{ + "home": { + "title": "Bienvenue, Java Hipster !", + "subtitle": "Ceci est votre page d'accueil", + "logged": { + "message": "Vous êtes connecté en tant que \"{{username}}\"." + }, + "question": "Si vous avez des questions à propos de JHipster :", + "link": { + "homepage": "Page d'accueil de JHipster", + "stackoverflow": "JHipster sur Stack Overflow", + "bugtracker": "JHipster bug tracker", + "chat": "JHipster public chat room", + "follow": "Suivez @java_hipster sur Twitter" + }, + "like": "Si vous aimez JHipster, donnez nous une étoile sur", + "github": "GitHub " + } +} diff --git a/jhipster/jhipster-uaa/gateway/src/main/webapp/i18n/fr/login.json b/jhipster/jhipster-uaa/gateway/src/main/webapp/i18n/fr/login.json new file mode 100644 index 0000000000..31e6138b66 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/webapp/i18n/fr/login.json @@ -0,0 +1,19 @@ +{ + "login": { + "title": "Authentification", + "form": { + "password": "Mot de passe", + "password.placeholder": "Votre mot de passe", + "rememberme": "Garder la session ouverte", + "button": "Connexion" + }, + "messages": { + "error": { + "authentication": "Erreur d'authentification ! Veuillez vérifier vos identifiants de connexion." + } + }, + "password" : { + "forgot": "Avez-vous oublié votre mot de passe ?" + } + } +} diff --git a/jhipster/jhipster-uaa/gateway/src/main/webapp/i18n/fr/logs.json b/jhipster/jhipster-uaa/gateway/src/main/webapp/i18n/fr/logs.json new file mode 100644 index 0000000000..c87c6e4b61 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/webapp/i18n/fr/logs.json @@ -0,0 +1,11 @@ +{ + "logs": { + "title": "Logs", + "nbloggers": "Total de {{ total }} \"loggers\".", + "filter": "Filtrer", + "table": { + "name": "Nom", + "level": "Niveau" + } + } +} diff --git a/jhipster/jhipster-uaa/gateway/src/main/webapp/i18n/fr/metrics.json b/jhipster/jhipster-uaa/gateway/src/main/webapp/i18n/fr/metrics.json new file mode 100644 index 0000000000..e2006488c4 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/webapp/i18n/fr/metrics.json @@ -0,0 +1,101 @@ +{ + "metrics": { + "title": "Métriques de l'application", + "refresh.button": "Rafraîchir", + "updating": "Mise à jour...", + "jvm": { + "title": "Métriques de la JVM", + "memory": { + "title": "Mémoire", + "total": "Mémoire totale", + "heap": "Mémoire \"Heap\"", + "nonheap": "Mémoire \"Non-Heap\"" + }, + "threads": { + "title": "Threads", + "all": "Tous", + "runnable": "Exécutable", + "timedwaiting": "Temps d'attente", + "waiting": "En attente", + "blocked": "Bloqué", + "dump": { + "title": "Threads dump", + "id": "Id :", + "blockedtime": "Temps bloqué", + "blockedcount": "Nb fois bloqué", + "waitedtime": "Temps d'attente", + "waitedcount": "Nb fois en attente", + "lockname": "Nom du process bloquant", + "stacktrace": "Stacktrace", + "show": "Afficher", + "hide": "Cacher" + } + }, + "gc": { + "title": "Garbage collections", + "marksweepcount": "Total de \"Mark Sweep\"", + "marksweeptime": "Temps \"Mark Sweep\"", + "scavengecount": "Total \"Scavenge\"", + "scavengetime": "Temps \"Scavenge\"" + }, + "http": { + "title": "Requêtes HTTP (évènements par seconde)", + "active": "Requêtes actives :", + "total": "Requêtes totales :", + "table": { + "code": "Code", + "count": "Total", + "mean": "Médian", + "average": "Moyenne" + }, + "code": { + "ok": "Ok", + "notfound": "Non trouvé", + "servererror": "Erreur serveur" + } + } + }, + "servicesstats": { + "title": "Statistiques des services (temps en millisecondes)", + "table": { + "name": "Nom du server", + "count": "Total", + "mean": "Médian", + "min": "Min", + "max": "Max", + "p50": "p50", + "p75": "p75", + "p95": "p95", + "p99": "p99" + } + }, + "cache": { + "title": "Statistiques de cache", + "cachename": "Nom du cache", + "hits": "Données existantes", + "misses": "Données non existantes", + "gets": "Lectures", + "puts": "Écritures", + "removals": "Suppressions", + "evictions": "Évictions", + "hitPercent": "% données existantes", + "missPercent": "% données non existantes", + "averageGetTime": "Temps de lecture moyen (µs)", + "averagePutTime": "Temps d'écriture moyen (µs)", + "averageRemoveTime": "Temps de suppression moyen (µs)" + }, + "datasource": { + "usage": "Usage", + "title": "Statistiques du pool de connexions (temps en millisecondes)", + "name": "Utilisation du pool", + "count": "Total", + "mean": "Médian", + "min": "Min", + "max": "Max", + "p50": "p50", + "p75": "p75", + "p95": "p95", + "p99": "p99" + } + } +} diff --git a/jhipster/jhipster-uaa/gateway/src/main/webapp/i18n/fr/password.json b/jhipster/jhipster-uaa/gateway/src/main/webapp/i18n/fr/password.json new file mode 100644 index 0000000000..755cc15173 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/webapp/i18n/fr/password.json @@ -0,0 +1,12 @@ +{ + "password": { + "title": "Changer le mot de passe pour [{{username}}]", + "form": { + "button": "Sauvegarder" + }, + "messages": { + "error": "Une erreur est survenue ! Le mot de passe n'a pas pu être modifié.", + "success": "Le mot de passe a été modifié !" + } + } +} diff --git a/jhipster/jhipster-uaa/gateway/src/main/webapp/i18n/fr/quotesQuote.json b/jhipster/jhipster-uaa/gateway/src/main/webapp/i18n/fr/quotesQuote.json new file mode 100644 index 0000000000..afe91e2686 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/webapp/i18n/fr/quotesQuote.json @@ -0,0 +1,28 @@ + +{ + "gatewayApp": { + "quotesQuote" : { + "home": { + "title": "Quotes", + "createLabel": "Créer un nouveau Quote", + "createOrEditLabel": "Créer ou éditer un Quote" + }, + "delete": { + "question": "Etes-vous certain de vouloir supprimer le Quote {{ id }} ?" + }, + "detail": { + "title": "Quote" + }, + "symbol": "Symbol", + "price": "Price", + "lastTrade": "Last Trade" + } + }, + "quotesApp": { + "quotesQuote" : { + "created": "Un nouveau Quote a été créé avec l'identifiant {{ param }}", + "updated": "Le Quote avec l'identifiant {{ param }} a été mis à jour", + "deleted": "Le Quote avec l'identifiant {{ param }} a été supprimé" + } + } +} diff --git a/jhipster/jhipster-uaa/gateway/src/main/webapp/i18n/fr/register.json b/jhipster/jhipster-uaa/gateway/src/main/webapp/i18n/fr/register.json new file mode 100644 index 0000000000..a8dd74684a --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/webapp/i18n/fr/register.json @@ -0,0 +1,24 @@ +{ + "register": { + "title": "Création de compte utilisateur", + "form": { + "button": "Enregistrement" + }, + "messages": { + "validate": { + "login": { + "required": "Votre nom d'utilisateur est obligatoire.", + "minlength": "Votre nom d'utilisateur doit contenir plus d'un caractère.", + "maxlength": "Votre nom d'utilisateur ne peut pas contenir plus de 50 caractères.", + "pattern": "Votre nom d'utilisateur ne peut contenir que des lettres minuscules ou des nombres." + } + }, + "success": "Compte enregistré ! Merci de vérifier votre email de confirmation.", + "error": { + "fail": "Compte non créé ! Merci d'essayer à nouveau plus tard.", + "userexists": "Ce compte utilisateur existe déjà ! Veuillez en choisir un autre.", + "emailexists": "Cet email est déjà utilisé ! Veuillez en choisir un autre." + } + } + } +} diff --git a/jhipster/jhipster-uaa/gateway/src/main/webapp/i18n/fr/reset.json b/jhipster/jhipster-uaa/gateway/src/main/webapp/i18n/fr/reset.json new file mode 100644 index 0000000000..d9376b836a --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/webapp/i18n/fr/reset.json @@ -0,0 +1,27 @@ +{ + "reset": { + "request": { + "title": "Réinitialiser son mot de passe", + "form": { + "button": "Réinitialiser le mot de passe" + }, + "messages": { + "info": "Veuillez renseigner l'adresse email utilisée pour vous enregistrer", + "success": "Veuillez vérifier vos nouveaux emails et suivre les instructions pour réinitialiser votre mot de passe.", + "notfound": "L'adresse email n'existe pas ! Merci de la vérifier et de réessayer." + } + }, + "finish" : { + "title": "Réinitialisation du mot de passe", + "form": { + "button": "Réinitialiser le mot de passe" + }, + "messages": { + "info": "Choisir un nouveau mot de passe", + "success": "Votre mot de passe a été réinitialisé. Merci de ", + "keymissing": "La clef de réinitilisation est manquante", + "error": "Votre mot de passe n'a pas pu être réinitialisé. La demande de réinitialisation n'est valable que 24 heures." + } + } + } +} diff --git a/jhipster/jhipster-uaa/gateway/src/main/webapp/i18n/fr/sessions.json b/jhipster/jhipster-uaa/gateway/src/main/webapp/i18n/fr/sessions.json new file mode 100644 index 0000000000..b2d45dcc48 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/webapp/i18n/fr/sessions.json @@ -0,0 +1,15 @@ +{ + "sessions": { + "title": "Sessions actives de [{{username}}]", + "table": { + "ipaddress": "Adresse IP", + "useragent": "User Agent", + "date": "Date", + "button": "Invalider" + }, + "messages": { + "success": "La session a été invalidée !", + "error": "Une erreur est survenue ! La session ne peut pas être invalidée." + } + } +} diff --git a/jhipster/jhipster-uaa/gateway/src/main/webapp/i18n/fr/settings.json b/jhipster/jhipster-uaa/gateway/src/main/webapp/i18n/fr/settings.json new file mode 100644 index 0000000000..78e74c8b2c --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/webapp/i18n/fr/settings.json @@ -0,0 +1,32 @@ +{ + "settings": { + "title": "Profil de l'utilisateur [{{username}}]", + "form": { + "firstname": "Prénom", + "firstname.placeholder": "Votre prénom", + "lastname": "Nom", + "lastname.placeholder": "Votre nom", + "language": "Langue", + "button": "Sauvegarder" + }, + "messages": { + "error": { + "fail": "Une erreur est survenue ! Votre profil n'a pas été sauvegardé.", + "emailexists": "Cet email est déjà utilisé ! Veuillez en choisir un autre." + }, + "success": "Votre profil a été sauvegardé !", + "validate": { + "firstname": { + "required": "Votre prénom est requis.", + "minlength": "Votre prénom doit comporter au moins un caractère.", + "maxlength": "Votre prénom ne doit pas comporter plus de 50 caractères." + }, + "lastname": { + "required": "Votre nom est requis.", + "minlength": "Votre nom doit comporter au moins un caractère.", + "maxlength": "Votre nom ne doit pas comporter plus de 50 caractères." + } + } + } + } +} diff --git a/jhipster/jhipster-uaa/gateway/src/main/webapp/i18n/fr/user-management.json b/jhipster/jhipster-uaa/gateway/src/main/webapp/i18n/fr/user-management.json new file mode 100644 index 0000000000..03fb1632c4 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/webapp/i18n/fr/user-management.json @@ -0,0 +1,30 @@ +{ + "userManagement": { + "home": { + "title": "Utilisateurs", + "createLabel": "Créer un nouvel utilisateur", + "createOrEditLabel": "Créer ou éditer un utilisateur" + }, + "created": "L'utilisateur {{ param }} a été créé.", + "updated": "L'utilisateur {{ param }} a été mis à jour.", + "deleted": "L'utilisateur {{ param }} a été supprimé.", + "delete": { + "question": "Etes-vous certain de vouloir supprimer l'utilisateur {{ login }} ?" + }, + "detail": { + "title": "Utilisateur" + }, + "login": "Login", + "firstName": "Prénom", + "lastName": "Nom", + "email": "Email", + "activated": "Activé", + "deactivated": "Désactivé", + "profiles": "Droits", + "langKey": "Langue", + "createdBy": "Créé par", + "createdDate": "Créé le", + "lastModifiedBy": "Modifié par", + "lastModifiedDate": "Modifié le" + } +} diff --git a/jhipster/jhipster-uaa/gateway/src/main/webapp/i18n/pt-br/activate.json b/jhipster/jhipster-uaa/gateway/src/main/webapp/i18n/pt-br/activate.json new file mode 100644 index 0000000000..b526a9e3cf --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/webapp/i18n/pt-br/activate.json @@ -0,0 +1,9 @@ +{ + "activate": { + "title": "Ativação", + "messages": { + "success": "Usuário ativado com sucesso. Favor ", + "error": "O usuário não pode ser ativado. Favor utilizar o formulário de cadastro para criar uma nova conta." + } + } +} diff --git a/jhipster/jhipster-uaa/gateway/src/main/webapp/i18n/pt-br/audits.json b/jhipster/jhipster-uaa/gateway/src/main/webapp/i18n/pt-br/audits.json new file mode 100644 index 0000000000..845dcbb437 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/webapp/i18n/pt-br/audits.json @@ -0,0 +1,27 @@ +{ + "audits": { + "title": "Auditorias", + "filter": { + "title": "Filtro por data", + "from": "de", + "to": "até", + "button": { + "weeks": "Semanas", + "today": "hoje", + "clear": "limpar", + "close": "fechar" + } + }, + "table": { + "header": { + "principal": "Usuário", + "date": "Data", + "status": "Estado", + "data": "Informações extras" + }, + "data": { + "remoteAddress": "Endereço remoto:" + } + } + } +} diff --git a/jhipster/jhipster-uaa/gateway/src/main/webapp/i18n/pt-br/configuration.json b/jhipster/jhipster-uaa/gateway/src/main/webapp/i18n/pt-br/configuration.json new file mode 100644 index 0000000000..6f80c59028 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/webapp/i18n/pt-br/configuration.json @@ -0,0 +1,10 @@ +{ + "configuration": { + "title": "Configuração", + "filter": "Filtro", + "table": { + "prefix": "Prefixo", + "properties": "Propriedades" + } + } +} diff --git a/jhipster/jhipster-uaa/gateway/src/main/webapp/i18n/pt-br/error.json b/jhipster/jhipster-uaa/gateway/src/main/webapp/i18n/pt-br/error.json new file mode 100644 index 0000000000..92fdff4f11 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/webapp/i18n/pt-br/error.json @@ -0,0 +1,13 @@ +{ + "error": { + "title": "Página de erro!", + "http": { + "400": "Bad request.", + "403": "Você não tem autorização para acessar esta página.", + "405": "The HTTP verb you used is not supported for this URL.", + "500": "Internal server error." + }, + "concurrencyFailure": "Another user modified this data at the same time as you. Your changes were rejected.", + "validation": "Validation error on the server." + } +} diff --git a/jhipster/jhipster-uaa/gateway/src/main/webapp/i18n/pt-br/gateway.json b/jhipster/jhipster-uaa/gateway/src/main/webapp/i18n/pt-br/gateway.json new file mode 100644 index 0000000000..8c8bbd7e98 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/webapp/i18n/pt-br/gateway.json @@ -0,0 +1,15 @@ +{ + "gateway": { + "title": "Gateway", + "routes": { + "title": "Current routes", + "url": "URL", + "service": "service", + "servers": "Available servers", + "error": "Warning: no server available!" + }, + "refresh": { + "button": "Refresh" + } + } +} diff --git a/jhipster/jhipster-uaa/gateway/src/main/webapp/i18n/pt-br/global.json b/jhipster/jhipster-uaa/gateway/src/main/webapp/i18n/pt-br/global.json new file mode 100644 index 0000000000..e40f936589 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/webapp/i18n/pt-br/global.json @@ -0,0 +1,137 @@ +{ + "global": { + "title": "Gateway", + "browsehappy": "Você está usando um navegador desatualizado. Favor atualizar o seu navegador para ter uma experiência melhor.", + "menu": { + "home": "Início", + "jhipster-needle-menu-add-element": "JHipster will add additional menu entries here (do not translate!)", + "entities": { + "main": "Entidades", + "quotesQuote": "Quote", + "jhipster-needle-menu-add-entry": "JHipster will add additional entities here (do not translate!)" + }, + "account": { + "main": "Conta", + "settings": "Configuração", + "password": "Senha", + "sessions": "Sessões", + "login": "Entrar", + "logout": "Sair", + "register": "Registrar" + }, + "admin": { + "main": "Administração", + "gateway": "Gateway", + "userManagement": "Gerenciamento de usuário", + "tracker": "Rastreamento de usuário", + "metrics": "Métricas", + "health": "Estado do Sistema", + "configuration": "Configuração", + "logs": "Logs", + "audits": "Auditorias", + "apidocs": "API", + "database": "Banco de dados", + "jhipster-needle-menu-add-admin-element": "JHipster will add additional menu entries here (do not translate!)" + }, + "language": "Idioma" + }, + "form": { + "username": "Usuário", + "username.placeholder": "Seu usuário", + "currentpassword": "Current password", + "currentpassword.placeholder": "Current password", + "newpassword": "Nova senha", + "newpassword.placeholder": "Nova senha", + "confirmpassword": "Confirmação de nova senha", + "confirmpassword.placeholder": "Confirme a nova senha", + "email": "Email", + "email.placeholder": "Seu email" + }, + "messages": { + "info": { + "authenticated": { + "prefix": "Para ", + "link": "entrar", + "suffix": ", utilize as seguintes contas padrões:
- Administrador (usuário=\"admin\" and senha=\"admin\")
- Usuário (usuário=\"user\" and senha=\"user\")." + }, + "register": { + "noaccount": "Não possui uma conta ainda?", + "link": "Crie uma nova conta" + } + }, + "error": { + "dontmatch" : "A senha e sua confirmação devem ser iguais!" + }, + "validate": { + "newpassword": { + "required": "A senha é obrigatória.", + "minlength": "A senha deve ter pelo menos 5 caracteres", + "maxlength": "A senha não pode ter mais de 50 caracteres", + "strength": "Nível de dificuldade da senha:" + }, + "confirmpassword": { + "required": "A confirmação da senha é obrigatória.", + "minlength": "A confirmação da senha deve ter pelo menos 5 caracteres", + "maxlength": "A confirmação da senha não pode ter mais de 50 caracteres" + }, + "email": { + "required": "O email é obrigatório.", + "invalid": "Email inválido.", + "minlength": "O email deve ter pelo menos 5 caracteres", + "maxlength": "O email não pode ter mais de 50 caracteres" + } + } + }, + "field": { + "id" : "Código" + }, + "ribbon": { + "dev":"Development" + }, + "item-count": "Mostrando {{first}} - {{second}} de {{total}} resultados." + }, + "entity": { + "action": { + "addblob": "Adicionar blob", + "addimage": "Adicionar imagem", + "back": "Voltar", + "cancel": "Cancelar", + "delete": "Excluir", + "edit": "Editar", + "open": "Open", + "save": "Salvar", + "view": "Visualizar" + }, + "detail": { + "field": "Campo", + "value": "Valor" + }, + "delete": { + "title": "Confirme a exclusão" + }, + "validation": { + "required": "O campo é obrigatório.", + "minlength": "Este campo deve ter ao menos {{min}} caracteres.", + "maxlength": "Este campo não pode ter mais que {{max}} caracteres.", + "min": "Este campo deve ser maior que {{min}}.", + "max": "Este campo não pode ser maior que {{max}}.", + "minbytes": "Este campo deve ter ao menos {{min}} bytes.", + "maxbytes": "Este campo não pode ter mais que {{max}} bytes.", + "pattern": "Este campo deve estar dentro do seguinte padrão {{pattern}}.", + "number": "Este campo é do tipo número.", + "datetimelocal": "Este campo é do tipo data/hora." + } + }, + "error": { + "internalServerError": "Internal server error", + "server.not.reachable": "Servidor indisponível", + "url.not.found": "Not found", + "NotNull": "O Campo {{fieldName}} não pode ser vazio!", + "Size": "O campo {{fieldName}} não obedece os requisitos de tamanho mínimo ou máximo!", + "userexists": "Usuário já existente!", + "emailexists": "Este email já está cadastrado!", + "idexists": "Novo(a) {{entityName}} não pode ter uma ID", + "idnull": "Invalid ID" + }, + "footer": "Este é o seu rodapé" +} diff --git a/jhipster/jhipster-uaa/gateway/src/main/webapp/i18n/pt-br/health.json b/jhipster/jhipster-uaa/gateway/src/main/webapp/i18n/pt-br/health.json new file mode 100644 index 0000000000..e74a4e87e2 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/webapp/i18n/pt-br/health.json @@ -0,0 +1,32 @@ +{ + "health": { + "title": "Estado do Sistema", + "refresh.button": "Atualizar", + "stacktrace": "Stacktrace", + "details": { + "details": "Details", + "properties": "Properties", + "name": "Name", + "value": "Value", + "error": "Error" + }, + "indicator": { + "discoveryComposite": "Discovery Composite", + "refreshScope": "Microservice Refresh Scope", + "configServer": "Microservice Config Server", + "hystrix": "Hystrix", + "diskSpace": "Espaço em disco", + "mail": "Email", + "db": "Banco de dados" + }, + "table": { + "service": "Nome do Serviço", + "status": "Estado" + }, + "status": { + "UNKNOWN": "UNKNOWN", + "UP": "UP", + "DOWN": "DOWN" + } + } +} diff --git a/jhipster/jhipster-uaa/gateway/src/main/webapp/i18n/pt-br/home.json b/jhipster/jhipster-uaa/gateway/src/main/webapp/i18n/pt-br/home.json new file mode 100644 index 0000000000..efa2736361 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/webapp/i18n/pt-br/home.json @@ -0,0 +1,19 @@ +{ + "home": { + "title": "Bem vindo, Java Hipster!", + "subtitle": "Esta é a página principal", + "logged": { + "message": "Você está logado como \"{{username}}\"." + }, + "question": "Em caso de dúvida sobre o JHipster:", + "link": { + "homepage": "JHipster homepage", + "stackoverflow": "JHipster no Stack Overflow", + "bugtracker": "JHipster bug tracker", + "chat": "JHipster public chat room", + "follow": "contate @java_hipster on Twitter" + }, + "like": "Se você gosta do JHipster, não se esqueça de avaliar no", + "github": "GitHub" + } +} diff --git a/jhipster/jhipster-uaa/gateway/src/main/webapp/i18n/pt-br/login.json b/jhipster/jhipster-uaa/gateway/src/main/webapp/i18n/pt-br/login.json new file mode 100644 index 0000000000..4453845af2 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/webapp/i18n/pt-br/login.json @@ -0,0 +1,19 @@ +{ + "login": { + "title": "Autenticação", + "form": { + "password": "Senha", + "password.placeholder": "Sua senha", + "rememberme": "Manter-me logado", + "button": "Entrar" + }, + "messages": { + "error": { + "authentication": "Erro de autenticação! Por favor verifique suas credenciais e tente novamente." + } + }, + "password" : { + "forgot": "Esqueceu sua senha?" + } + } +} diff --git a/jhipster/jhipster-uaa/gateway/src/main/webapp/i18n/pt-br/logs.json b/jhipster/jhipster-uaa/gateway/src/main/webapp/i18n/pt-br/logs.json new file mode 100644 index 0000000000..50a07fa996 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/webapp/i18n/pt-br/logs.json @@ -0,0 +1,11 @@ +{ + "logs": { + "title": "Logs", + "nbloggers": "Existem {{ total }} loggers.", + "filter": "Filtro", + "table": { + "name": "Nome", + "level": "Nível" + } + } +} diff --git a/jhipster/jhipster-uaa/gateway/src/main/webapp/i18n/pt-br/metrics.json b/jhipster/jhipster-uaa/gateway/src/main/webapp/i18n/pt-br/metrics.json new file mode 100644 index 0000000000..a00bc96cd7 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/webapp/i18n/pt-br/metrics.json @@ -0,0 +1,93 @@ +{ + "metrics": { + "title": "Métricas da aplicação", + "refresh.button": "Atualizar", + "updating": "Atualização...", + "jvm": { + "title": "Métricas da JVM", + "memory": { + "title": "Memória", + "total": "Memória Total", + "heap": "Memória Heap", + "nonheap": "Memória não Heap" + }, + "threads": { + "title": "Threads", + "all": "Tudo", + "runnable": "Runnable", + "timedwaiting": "Tempo de espera", + "waiting": "Aguardando", + "blocked": "Bloqueado", + "dump": { + "title": "Threads dump", + "id": "Id: ", + "blockedtime": "Tempo bloqueado", + "blockedcount": "Número de bloqueios", + "waitedtime": "Tempo de espera", + "waitedcount": "Número de esperas", + "lockname": "Nome do Lock", + "stacktrace": "Stacktrace", + "show": "Mostrar", + "hide": "Esconder" + } + }, + "gc": { + "title": "Coletas de lixo", + "marksweepcount": "Número de marcados para coleta", + "marksweeptime": "Tempo de marcação para coleta", + "scavengecount": "Número de varreduras", + "scavengetime": "Tempo de varreduras" + }, + "http": { + "title": "Requisições HTTP (eventos por segundo)", + "active": "Requisições ativas:", + "total": "Total de requisições:", + "table": { + "code": "Código", + "count": "Contagem", + "mean": "Mediana", + "average": "Média" + }, + "code": { + "ok": "Ok", + "notfound": "Não encontrado", + "servererror": "Erro do servidor" + } + } + }, + "servicesstats": { + "title": "Estatísticas dos serviços (tempo em milisegundos)", + "table": { + "name": "Nome do serviço", + "count": "Contagem", + "mean": "Mediana", + "min": "Min", + "max": "Max", + "p50": "p50", + "p75": "p75", + "p95": "p95", + "p99": "p99" + } + }, + "cache": { + "title": "Estatísticas da cache", + "cachename": "Nome da cache", + "hits": "Hits", + "misses": "Misses", + "evictions": "Número de despejos" + }, + "datasource": { + "usage": "Utilização", + "title": "Estatísticas do datasource (tempo em milisegundos)", + "name": "Utilização do pool", + "count": "Contagem", + "mean": "Mediana", + "min": "Min", + "max": "Max", + "p50": "p50", + "p75": "p75", + "p95": "p95", + "p99": "p99" + } + } +} diff --git a/jhipster/jhipster-uaa/gateway/src/main/webapp/i18n/pt-br/password.json b/jhipster/jhipster-uaa/gateway/src/main/webapp/i18n/pt-br/password.json new file mode 100644 index 0000000000..4ecdcc136f --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/webapp/i18n/pt-br/password.json @@ -0,0 +1,12 @@ +{ + "password": { + "title": "Senha para [{{username}}]", + "form": { + "button": "Salvar" + }, + "messages": { + "error": "Ocorreu um erro! A senha não pode ser alterada.", + "success": "Senha alterada com sucesso!" + } + } +} diff --git a/jhipster/jhipster-uaa/gateway/src/main/webapp/i18n/pt-br/quotesQuote.json b/jhipster/jhipster-uaa/gateway/src/main/webapp/i18n/pt-br/quotesQuote.json new file mode 100644 index 0000000000..6f89dfa411 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/webapp/i18n/pt-br/quotesQuote.json @@ -0,0 +1,28 @@ + +{ + "gatewayApp": { + "quotesQuote" : { + "home": { + "title": "Quotes", + "createLabel": "Criar novo Quote", + "createOrEditLabel": "Criar ou editar Quote" + }, + "delete": { + "question": "Tem certeza de que deseja excluir Quote {{ id }}?" + }, + "detail": { + "title": "Quote" + }, + "symbol": "Symbol", + "price": "Price", + "lastTrade": "Last Trade" + } + }, + "quotesApp": { + "quotesQuote" : { + "created": "Um novo Quote foi criado com o identificador {{ param }}", + "updated": "Um Quote foi atualizado com o identificador {{ param }}", + "deleted": "Um Quote foi deletado com o identificador {{ param }}" + } + } +} diff --git a/jhipster/jhipster-uaa/gateway/src/main/webapp/i18n/pt-br/register.json b/jhipster/jhipster-uaa/gateway/src/main/webapp/i18n/pt-br/register.json new file mode 100644 index 0000000000..a19994c09f --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/webapp/i18n/pt-br/register.json @@ -0,0 +1,24 @@ +{ + "register": { + "title": "Cadastro", + "form": { + "button": "Cadastre" + }, + "messages": { + "validate": { + "login": { + "required": "O usuário é obrigatório.", + "minlength": "O usuário deve ter pelo menos 1 caractere", + "maxlength": "O usuário não pode ter mais de 50 caracteres", + "pattern": "Your login can only contain lower-case letters and digits" + } + }, + "success": "Cadstro salvo com sucesso! Favor verificar seu email para confirmar a conta.", + "error": { + "fail": "Erro ao realizar o cadastro! Favor tentar novamente mais tarde.", + "userexists": "Usuário já registrado! Favor escolher outro.", + "emailexists": "Email já está em uso! Por favor informe outro." + } + } + } +} diff --git a/jhipster/jhipster-uaa/gateway/src/main/webapp/i18n/pt-br/reset.json b/jhipster/jhipster-uaa/gateway/src/main/webapp/i18n/pt-br/reset.json new file mode 100644 index 0000000000..56bba46692 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/webapp/i18n/pt-br/reset.json @@ -0,0 +1,30 @@ +{ + "reset": { + "request": { + "title": "Nova senha", + "form": { + "button": "Criar nova senha" + }, + "messages": { + "info": "Informe endereço de email utilizado no cadastro.", + "success": "Verifique seu email para detalhes sobre a criação de uma nova senha.", + "notfound": "Endereço de email não cadastrado! Por favor verifique e tente novamente" + + } + + }, + "finish" : { + "title": "Criar nova senha", + "form": { + "button": "Validar nova senha" + }, + "messages": { + "info": "Escolha uma nova senha", + "success": "Sua senha foi alterada com sucesso! Por favor ", + "keymissing": "Chave de reestabelecimento não encontrada.", + "error": "Sua senha não pôde ser trocada. Lembre-se, requisição de troca de senha é válida apenas por 24h." + } + } + } + +} diff --git a/jhipster/jhipster-uaa/gateway/src/main/webapp/i18n/pt-br/sessions.json b/jhipster/jhipster-uaa/gateway/src/main/webapp/i18n/pt-br/sessions.json new file mode 100644 index 0000000000..007a4dd93b --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/webapp/i18n/pt-br/sessions.json @@ -0,0 +1,15 @@ +{ + "sessions": { + "title": "Sessões ativas para [{{username}}]", + "table": { + "ipaddress": "IP", + "useragent": "Agente", + "date": "Data", + "button": "Invalidar" + }, + "messages": { + "success": "Sessão invalidada com sucesso!", + "error": "Ocorreu um erro! A sessão não pode ser invalidada." + } + } +} diff --git a/jhipster/jhipster-uaa/gateway/src/main/webapp/i18n/pt-br/settings.json b/jhipster/jhipster-uaa/gateway/src/main/webapp/i18n/pt-br/settings.json new file mode 100644 index 0000000000..7e01c2b829 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/webapp/i18n/pt-br/settings.json @@ -0,0 +1,32 @@ +{ + "settings": { + "title": "Configurações para o usuário [{{username}}]", + "form": { + "firstname": "Primeiro nome", + "firstname.placeholder": "Seu primeiro nome", + "lastname": "Sobrenome", + "lastname.placeholder": "Seu sobrenome", + "language": "Idioma", + "button": "Salvar" + }, + "messages": { + "error": { + "fail": "Ocorreu um erro! As configurações não foram salvas.", + "emailexists": "Email is already in use! Please choose another one." + }, + "success": "Configurações salvas com sucesso!", + "validate": { + "firstname": { + "required": "O primeiro nome é obrigatório.", + "minlength": "O primeiro nome deve ter pelo menos 1 caractere", + "maxlength": "O primeiro nome não pode ter mais de 50 caracteres" + }, + "lastname": { + "required": "O sobrenome é obrigatório.", + "minlength": "O sobrenome deve ter pelo menos 1 caractere", + "maxlength": "O sobrenome não pode ter mais de 50 caracteres" + } + } + } + } +} diff --git a/jhipster/jhipster-uaa/gateway/src/main/webapp/i18n/pt-br/user-management.json b/jhipster/jhipster-uaa/gateway/src/main/webapp/i18n/pt-br/user-management.json new file mode 100644 index 0000000000..59cc4b89f2 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/webapp/i18n/pt-br/user-management.json @@ -0,0 +1,30 @@ +{ + "userManagement": { + "home": { + "title": "Usuários", + "createLabel": "Adicionar", + "createOrEditLabel": "Criar ou editar usuário" + }, + "created": "Novo usuário foi criado com a identificação {{ param }}", + "updated": "Usuário com a identificação {{ param }} foi atualizado ", + "deleted": "Usuário com a identificação {{ param }} foi removido", + "delete": { + "question": "Você tem certeza que deseja excluir o usuário {{ login }}?" + }, + "detail": { + "title": "Usuário" + }, + "login": "Login", + "firstName": "Primeiro nome", + "lastName": "Último nome", + "email": "Email", + "activated": "Ativo", + "deactivated": "Inativo", + "profiles": "Perfis", + "langKey": "Idioma", + "createdBy": "Criado por", + "createdDate": "Criado em", + "lastModifiedBy": "Alterado por", + "lastModifiedDate": "Alterado em" + } +} diff --git a/jhipster/jhipster-uaa/gateway/src/main/webapp/index.html b/jhipster/jhipster-uaa/gateway/src/main/webapp/index.html new file mode 100644 index 0000000000..30f3a81557 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/webapp/index.html @@ -0,0 +1,46 @@ + + + + + + + gateway + + + + + + + + + + + + + + + + diff --git a/jhipster/jhipster-uaa/gateway/src/main/webapp/manifest.webapp b/jhipster/jhipster-uaa/gateway/src/main/webapp/manifest.webapp new file mode 100644 index 0000000000..e448079a5c --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/webapp/manifest.webapp @@ -0,0 +1,31 @@ +{ + "name": "Gateway", + "short_name": "Gateway", + "icons": [ + { + "src": "./content/images/hipster192.png", + "sizes": "192x192", + "type": "image/png" + }, + { + "src": "./content/images/hipster256.png", + "sizes": "256x256", + "type": "image/png" + }, + { + "src": "./content/images/hipster384.png", + "sizes": "384x384", + "type": "image/png" + }, + { + "src": "./content/images/hipster512.png", + "sizes": "512x512", + "type": "image/png" + } + ], + "theme_color": "#000000", + "background_color": "#e0e0e0", + "start_url": "/index.html", + "display": "standalone", + "orientation": "portrait" +} diff --git a/jhipster/jhipster-uaa/gateway/src/main/webapp/robots.txt b/jhipster/jhipster-uaa/gateway/src/main/webapp/robots.txt new file mode 100644 index 0000000000..7cda27477d --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/webapp/robots.txt @@ -0,0 +1,11 @@ +# robotstxt.org/ + +User-agent: * +Disallow: /api/account +Disallow: /api/account/change-password +Disallow: /api/account/sessions +Disallow: /api/audits/ +Disallow: /api/logs/ +Disallow: /api/users/ +Disallow: /management/ +Disallow: /v2/api-docs/ diff --git a/jhipster/jhipster-uaa/gateway/src/main/webapp/swagger-ui/index.html b/jhipster/jhipster-uaa/gateway/src/main/webapp/swagger-ui/index.html new file mode 100644 index 0000000000..7bdc777eb3 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/main/webapp/swagger-ui/index.html @@ -0,0 +1,175 @@ + + + + + Swagger UI + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
 
+
+ + diff --git a/jhipster/jhipster-uaa/gateway/src/test/java/com/baeldung/jhipster/gateway/config/SecurityBeanOverrideConfiguration.java b/jhipster/jhipster-uaa/gateway/src/test/java/com/baeldung/jhipster/gateway/config/SecurityBeanOverrideConfiguration.java new file mode 100644 index 0000000000..c5925cde03 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/test/java/com/baeldung/jhipster/gateway/config/SecurityBeanOverrideConfiguration.java @@ -0,0 +1,35 @@ +package com.baeldung.jhipster.gateway.config; + +import org.springframework.cloud.client.loadbalancer.RestTemplateCustomizer; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.Primary; +import org.springframework.security.oauth2.provider.token.TokenStore; +import org.springframework.security.oauth2.provider.token.store.JwtAccessTokenConverter; +import org.springframework.web.client.RestTemplate; + +/** + * Overrides UAA specific beans, so they do not interfere the testing + * This configuration must be included in @SpringBootTest in order to take effect. + */ +@Configuration +public class SecurityBeanOverrideConfiguration { + + @Bean + @Primary + public TokenStore tokenStore() { + return null; + } + + @Bean + @Primary + public JwtAccessTokenConverter jwtAccessTokenConverter() { + return null; + } + + @Bean + @Primary + public RestTemplate loadBalancedRestTemplate(RestTemplateCustomizer customizer) { + return null; + } +} diff --git a/jhipster/jhipster-uaa/gateway/src/test/java/com/baeldung/jhipster/gateway/config/WebConfigurerTest.java b/jhipster/jhipster-uaa/gateway/src/test/java/com/baeldung/jhipster/gateway/config/WebConfigurerTest.java new file mode 100644 index 0000000000..c1f6062c51 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/test/java/com/baeldung/jhipster/gateway/config/WebConfigurerTest.java @@ -0,0 +1,204 @@ +package com.baeldung.jhipster.gateway.config; + +import com.codahale.metrics.MetricRegistry; +import com.codahale.metrics.servlet.InstrumentedFilter; +import com.codahale.metrics.servlets.MetricsServlet; +import io.github.jhipster.config.JHipsterConstants; +import io.github.jhipster.config.JHipsterProperties; +import io.github.jhipster.web.filter.CachingHttpHeadersFilter; +import io.undertow.Undertow; +import io.undertow.Undertow.Builder; +import io.undertow.UndertowOptions; +import org.apache.commons.io.FilenameUtils; + +import org.h2.server.web.WebServlet; +import org.junit.Before; +import org.junit.Test; +import org.springframework.boot.web.embedded.undertow.UndertowServletWebServerFactory; +import org.springframework.http.HttpHeaders; +import org.springframework.mock.env.MockEnvironment; +import org.springframework.mock.web.MockServletContext; +import org.springframework.test.util.ReflectionTestUtils; +import org.springframework.test.web.servlet.MockMvc; +import org.springframework.test.web.servlet.setup.MockMvcBuilders; +import org.xnio.OptionMap; + +import javax.servlet.*; +import java.util.*; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.anyString; +import static org.mockito.Mockito.*; +import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; +import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.options; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.header; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; + +/** + * Unit tests for the WebConfigurer class. + * + * @see WebConfigurer + */ +public class WebConfigurerTest { + + private WebConfigurer webConfigurer; + + private MockServletContext servletContext; + + private MockEnvironment env; + + private JHipsterProperties props; + + private MetricRegistry metricRegistry; + + @Before + public void setup() { + servletContext = spy(new MockServletContext()); + doReturn(mock(FilterRegistration.Dynamic.class)) + .when(servletContext).addFilter(anyString(), any(Filter.class)); + doReturn(mock(ServletRegistration.Dynamic.class)) + .when(servletContext).addServlet(anyString(), any(Servlet.class)); + + env = new MockEnvironment(); + props = new JHipsterProperties(); + + webConfigurer = new WebConfigurer(env, props); + metricRegistry = new MetricRegistry(); + webConfigurer.setMetricRegistry(metricRegistry); + } + + @Test + public void testStartUpProdServletContext() throws ServletException { + env.setActiveProfiles(JHipsterConstants.SPRING_PROFILE_PRODUCTION); + webConfigurer.onStartup(servletContext); + + assertThat(servletContext.getAttribute(InstrumentedFilter.REGISTRY_ATTRIBUTE)).isEqualTo(metricRegistry); + assertThat(servletContext.getAttribute(MetricsServlet.METRICS_REGISTRY)).isEqualTo(metricRegistry); + verify(servletContext).addFilter(eq("webappMetricsFilter"), any(InstrumentedFilter.class)); + verify(servletContext).addServlet(eq("metricsServlet"), any(MetricsServlet.class)); + verify(servletContext).addFilter(eq("cachingHttpHeadersFilter"), any(CachingHttpHeadersFilter.class)); + verify(servletContext, never()).addServlet(eq("H2Console"), any(WebServlet.class)); + } + + @Test + public void testStartUpDevServletContext() throws ServletException { + env.setActiveProfiles(JHipsterConstants.SPRING_PROFILE_DEVELOPMENT); + webConfigurer.onStartup(servletContext); + + assertThat(servletContext.getAttribute(InstrumentedFilter.REGISTRY_ATTRIBUTE)).isEqualTo(metricRegistry); + assertThat(servletContext.getAttribute(MetricsServlet.METRICS_REGISTRY)).isEqualTo(metricRegistry); + verify(servletContext).addFilter(eq("webappMetricsFilter"), any(InstrumentedFilter.class)); + verify(servletContext).addServlet(eq("metricsServlet"), any(MetricsServlet.class)); + verify(servletContext, never()).addFilter(eq("cachingHttpHeadersFilter"), any(CachingHttpHeadersFilter.class)); + verify(servletContext).addServlet(eq("H2Console"), any(WebServlet.class)); + } + + @Test + public void testCustomizeServletContainer() { + env.setActiveProfiles(JHipsterConstants.SPRING_PROFILE_PRODUCTION); + UndertowServletWebServerFactory container = new UndertowServletWebServerFactory(); + webConfigurer.customize(container); + assertThat(container.getMimeMappings().get("abs")).isEqualTo("audio/x-mpeg"); + assertThat(container.getMimeMappings().get("html")).isEqualTo("text/html;charset=utf-8"); + assertThat(container.getMimeMappings().get("json")).isEqualTo("text/html;charset=utf-8"); + if (container.getDocumentRoot() != null) { + assertThat(container.getDocumentRoot().getPath()).isEqualTo(FilenameUtils.separatorsToSystem("target/www")); + } + + Builder builder = Undertow.builder(); + container.getBuilderCustomizers().forEach(c -> c.customize(builder)); + OptionMap.Builder serverOptions = (OptionMap.Builder) ReflectionTestUtils.getField(builder, "serverOptions"); + assertThat(serverOptions.getMap().get(UndertowOptions.ENABLE_HTTP2)).isNull(); + } + + @Test + public void testUndertowHttp2Enabled() { + props.getHttp().setVersion(JHipsterProperties.Http.Version.V_2_0); + UndertowServletWebServerFactory container = new UndertowServletWebServerFactory(); + webConfigurer.customize(container); + Builder builder = Undertow.builder(); + container.getBuilderCustomizers().forEach(c -> c.customize(builder)); + OptionMap.Builder serverOptions = (OptionMap.Builder) ReflectionTestUtils.getField(builder, "serverOptions"); + assertThat(serverOptions.getMap().get(UndertowOptions.ENABLE_HTTP2)).isTrue(); + } + + @Test + public void testCorsFilterOnApiPath() throws Exception { + props.getCors().setAllowedOrigins(Collections.singletonList("*")); + props.getCors().setAllowedMethods(Arrays.asList("GET", "POST", "PUT", "DELETE")); + props.getCors().setAllowedHeaders(Collections.singletonList("*")); + props.getCors().setMaxAge(1800L); + props.getCors().setAllowCredentials(true); + + MockMvc mockMvc = MockMvcBuilders.standaloneSetup(new WebConfigurerTestController()) + .addFilters(webConfigurer.corsFilter()) + .build(); + + mockMvc.perform( + options("/api/test-cors") + .header(HttpHeaders.ORIGIN, "other.domain.com") + .header(HttpHeaders.ACCESS_CONTROL_REQUEST_METHOD, "POST")) + .andExpect(status().isOk()) + .andExpect(header().string(HttpHeaders.ACCESS_CONTROL_ALLOW_ORIGIN, "other.domain.com")) + .andExpect(header().string(HttpHeaders.VARY, "Origin")) + .andExpect(header().string(HttpHeaders.ACCESS_CONTROL_ALLOW_METHODS, "GET,POST,PUT,DELETE")) + .andExpect(header().string(HttpHeaders.ACCESS_CONTROL_ALLOW_CREDENTIALS, "true")) + .andExpect(header().string(HttpHeaders.ACCESS_CONTROL_MAX_AGE, "1800")); + + mockMvc.perform( + get("/api/test-cors") + .header(HttpHeaders.ORIGIN, "other.domain.com")) + .andExpect(status().isOk()) + .andExpect(header().string(HttpHeaders.ACCESS_CONTROL_ALLOW_ORIGIN, "other.domain.com")); + } + + @Test + public void testCorsFilterOnOtherPath() throws Exception { + props.getCors().setAllowedOrigins(Collections.singletonList("*")); + props.getCors().setAllowedMethods(Arrays.asList("GET", "POST", "PUT", "DELETE")); + props.getCors().setAllowedHeaders(Collections.singletonList("*")); + props.getCors().setMaxAge(1800L); + props.getCors().setAllowCredentials(true); + + MockMvc mockMvc = MockMvcBuilders.standaloneSetup(new WebConfigurerTestController()) + .addFilters(webConfigurer.corsFilter()) + .build(); + + mockMvc.perform( + get("/test/test-cors") + .header(HttpHeaders.ORIGIN, "other.domain.com")) + .andExpect(status().isOk()) + .andExpect(header().doesNotExist(HttpHeaders.ACCESS_CONTROL_ALLOW_ORIGIN)); + } + + @Test + public void testCorsFilterDeactivated() throws Exception { + props.getCors().setAllowedOrigins(null); + + MockMvc mockMvc = MockMvcBuilders.standaloneSetup(new WebConfigurerTestController()) + .addFilters(webConfigurer.corsFilter()) + .build(); + + mockMvc.perform( + get("/api/test-cors") + .header(HttpHeaders.ORIGIN, "other.domain.com")) + .andExpect(status().isOk()) + .andExpect(header().doesNotExist(HttpHeaders.ACCESS_CONTROL_ALLOW_ORIGIN)); + } + + @Test + public void testCorsFilterDeactivated2() throws Exception { + props.getCors().setAllowedOrigins(new ArrayList<>()); + + MockMvc mockMvc = MockMvcBuilders.standaloneSetup(new WebConfigurerTestController()) + .addFilters(webConfigurer.corsFilter()) + .build(); + + mockMvc.perform( + get("/api/test-cors") + .header(HttpHeaders.ORIGIN, "other.domain.com")) + .andExpect(status().isOk()) + .andExpect(header().doesNotExist(HttpHeaders.ACCESS_CONTROL_ALLOW_ORIGIN)); + } +} diff --git a/jhipster/jhipster-uaa/gateway/src/test/java/com/baeldung/jhipster/gateway/config/WebConfigurerTestController.java b/jhipster/jhipster-uaa/gateway/src/test/java/com/baeldung/jhipster/gateway/config/WebConfigurerTestController.java new file mode 100644 index 0000000000..87d997afb1 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/test/java/com/baeldung/jhipster/gateway/config/WebConfigurerTestController.java @@ -0,0 +1,16 @@ +package com.baeldung.jhipster.gateway.config; + +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RestController; + +@RestController +public class WebConfigurerTestController { + + @GetMapping("/api/test-cors") + public void testCorsOnApiPath() { + } + + @GetMapping("/test/test-cors") + public void testCorsOnOtherPath() { + } +} diff --git a/jhipster/jhipster-uaa/gateway/src/test/java/com/baeldung/jhipster/gateway/gateway/responserewriting/SwaggerBasePathRewritingFilterTest.java b/jhipster/jhipster-uaa/gateway/src/test/java/com/baeldung/jhipster/gateway/gateway/responserewriting/SwaggerBasePathRewritingFilterTest.java new file mode 100644 index 0000000000..893c446922 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/test/java/com/baeldung/jhipster/gateway/gateway/responserewriting/SwaggerBasePathRewritingFilterTest.java @@ -0,0 +1,95 @@ +package com.baeldung.jhipster.gateway.gateway.responserewriting; + +import com.netflix.zuul.context.RequestContext; +import org.apache.commons.io.IOUtils; +import org.junit.Test; +import org.springframework.mock.web.MockHttpServletRequest; +import org.springframework.mock.web.MockHttpServletResponse; + +import java.io.ByteArrayInputStream; +import java.io.InputStream; +import java.nio.charset.StandardCharsets; +import java.util.zip.GZIPInputStream; + +import static com.baeldung.jhipster.gateway.gateway.responserewriting.SwaggerBasePathRewritingFilter.gzipData; +import static org.junit.Assert.*; +import static springfox.documentation.swagger2.web.Swagger2Controller.DEFAULT_URL; + +/** + * Tests SwaggerBasePathRewritingFilter class. + */ +public class SwaggerBasePathRewritingFilterTest { + + private SwaggerBasePathRewritingFilter filter = new SwaggerBasePathRewritingFilter(); + + @Test + public void shouldFilter_on_default_swagger_url() { + + MockHttpServletRequest request = new MockHttpServletRequest("GET", DEFAULT_URL); + RequestContext.getCurrentContext().setRequest(request); + + assertTrue(filter.shouldFilter()); + } + + /** + * Zuul DebugFilter can be triggered by "deug" parameter. + */ + @Test + public void shouldFilter_on_default_swagger_url_with_param() { + + MockHttpServletRequest request = new MockHttpServletRequest("GET", DEFAULT_URL); + request.setParameter("debug", "true"); + RequestContext.getCurrentContext().setRequest(request); + + assertTrue(filter.shouldFilter()); + } + + @Test + public void shouldNotFilter_on_wrong_url() { + + MockHttpServletRequest request = new MockHttpServletRequest("GET", "/management/info"); + RequestContext.getCurrentContext().setRequest(request); + + assertFalse(filter.shouldFilter()); + } + + @Test + public void run_on_valid_response() throws Exception { + MockHttpServletRequest request = new MockHttpServletRequest("GET", "/service1" + DEFAULT_URL); + RequestContext context = RequestContext.getCurrentContext(); + context.setRequest(request); + + MockHttpServletResponse response = new MockHttpServletResponse(); + context.setResponseGZipped(false); + context.setResponse(response); + + InputStream in = IOUtils.toInputStream("{\"basePath\":\"/\"}", StandardCharsets.UTF_8); + context.setResponseDataStream(in); + + filter.run(); + + assertEquals("UTF-8", response.getCharacterEncoding()); + assertEquals("{\"basePath\":\"/service1\"}", context.getResponseBody()); + } + + @Test + public void run_on_valid_response_gzip() throws Exception { + MockHttpServletRequest request = new MockHttpServletRequest("GET", "/service1" + DEFAULT_URL); + RequestContext context = RequestContext.getCurrentContext(); + context.setRequest(request); + + MockHttpServletResponse response = new MockHttpServletResponse(); + context.setResponseGZipped(true); + context.setResponse(response); + + context.setResponseDataStream(new ByteArrayInputStream(gzipData("{\"basePath\":\"/\"}"))); + + filter.run(); + + assertEquals("UTF-8", response.getCharacterEncoding()); + + InputStream responseDataStream = new GZIPInputStream(context.getResponseDataStream()); + String responseBody = IOUtils.toString(responseDataStream, StandardCharsets.UTF_8); + assertEquals("{\"basePath\":\"/service1\"}", responseBody); + } +} diff --git a/jhipster/jhipster-uaa/gateway/src/test/java/com/baeldung/jhipster/gateway/security/OAuth2TokenMockUtil.java b/jhipster/jhipster-uaa/gateway/src/test/java/com/baeldung/jhipster/gateway/security/OAuth2TokenMockUtil.java new file mode 100644 index 0000000000..2a3d103d45 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/test/java/com/baeldung/jhipster/gateway/security/OAuth2TokenMockUtil.java @@ -0,0 +1,83 @@ +package com.baeldung.jhipster.gateway.security; + +import org.springframework.boot.test.mock.mockito.MockBean; +import org.springframework.mock.web.MockHttpServletRequest; +import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; +import org.springframework.security.core.Authentication; +import org.springframework.security.core.GrantedAuthority; +import org.springframework.security.core.authority.SimpleGrantedAuthority; +import org.springframework.security.core.userdetails.User; +import org.springframework.security.oauth2.common.DefaultOAuth2AccessToken; +import org.springframework.security.oauth2.provider.OAuth2Authentication; +import org.springframework.security.oauth2.provider.OAuth2Request; +import org.springframework.security.oauth2.provider.token.ResourceServerTokenServices; +import org.springframework.stereotype.Component; +import org.springframework.test.web.servlet.request.RequestPostProcessor; + +import java.util.Collections; +import java.util.List; +import java.util.Set; +import java.util.UUID; +import java.util.stream.Collectors; + +import static org.mockito.BDDMockito.given; + +/** + * A bean providing simple mocking of OAuth2 access tokens for security integration tests. + */ +@Component +public class OAuth2TokenMockUtil { + + @MockBean + private ResourceServerTokenServices tokenServices; + + private OAuth2Authentication createAuthentication(String username, Set scopes, Set roles) { + List authorities = roles.stream() + .map(SimpleGrantedAuthority::new) + .collect(Collectors.toList()); + + User principal = new User(username, "test", true, true, true, true, authorities); + Authentication authentication = new UsernamePasswordAuthenticationToken(principal, principal.getPassword(), + principal.getAuthorities()); + + // Create the authorization request and OAuth2Authentication object + OAuth2Request authRequest = new OAuth2Request(null, "testClient", null, true, scopes, null, null, null, + null); + return new OAuth2Authentication(authRequest, authentication); + } + + public RequestPostProcessor oauth2Authentication(String username, Set scopes, Set roles) { + String uuid = String.valueOf(UUID.randomUUID()); + + given(tokenServices.loadAuthentication(uuid)) + .willReturn(createAuthentication(username, scopes, roles)); + + given(tokenServices.readAccessToken(uuid)).willReturn(new DefaultOAuth2AccessToken(uuid)); + + return new OAuth2PostProcessor(uuid); + } + + public RequestPostProcessor oauth2Authentication(String username, Set scopes) { + return oauth2Authentication(username, scopes, Collections.emptySet()); + } + + public RequestPostProcessor oauth2Authentication(String username) { + return oauth2Authentication(username, Collections.emptySet()); + } + + public static class OAuth2PostProcessor implements RequestPostProcessor { + + private String token; + + public OAuth2PostProcessor(String token) { + this.token = token; + } + + @Override + public MockHttpServletRequest postProcessRequest(MockHttpServletRequest mockHttpServletRequest) { + mockHttpServletRequest.addHeader("Authorization", "Bearer " + token); + + return mockHttpServletRequest; + } + } +} diff --git a/jhipster/jhipster-uaa/gateway/src/test/java/com/baeldung/jhipster/gateway/security/oauth2/CookieCollectionTest.java b/jhipster/jhipster-uaa/gateway/src/test/java/com/baeldung/jhipster/gateway/security/oauth2/CookieCollectionTest.java new file mode 100644 index 0000000000..1b2a22dd90 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/test/java/com/baeldung/jhipster/gateway/security/oauth2/CookieCollectionTest.java @@ -0,0 +1,191 @@ +package com.baeldung.jhipster.gateway.security.oauth2; + +import org.junit.After; +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; + +import javax.servlet.http.Cookie; +import java.util.Arrays; +import java.util.Collections; +import java.util.Iterator; +import java.util.List; + +/** + * Test the CookieCollection. + * + * @see CookieCollection + */ +public class CookieCollectionTest { + public static final String COOKIE_NAME = "chocolate"; + public static final String COOKIE_VALUE = "yummy"; + public static final String BROWNIE_NAME = "brownie"; + private Cookie cookie; + private Cookie cupsCookie; + private Cookie brownieCookie; + + @Before + public void setUp() throws Exception { + cookie = new Cookie(COOKIE_NAME, COOKIE_VALUE); + cupsCookie = new Cookie("cups", "delicious"); + brownieCookie = new Cookie(BROWNIE_NAME, "mmh"); + } + + @After + public void tearDown() throws Exception { + } + + @Test + public void size() throws Exception { + CookieCollection cookies = new CookieCollection(); + Assert.assertEquals(0, cookies.size()); + cookies.add(cookie); + Assert.assertEquals(1, cookies.size()); + } + + @Test + public void isEmpty() throws Exception { + CookieCollection cookies = new CookieCollection(); + Assert.assertTrue(cookies.isEmpty()); + cookies.add(cookie); + Assert.assertFalse(cookies.isEmpty()); + } + + @Test + public void contains() throws Exception { + CookieCollection cookies = new CookieCollection(cookie); + Assert.assertTrue(cookies.contains(cookie)); + Assert.assertTrue(cookies.contains(COOKIE_NAME)); + Assert.assertFalse(cookies.contains("yuck")); + } + + @Test + public void iterator() throws Exception { + CookieCollection cookies = new CookieCollection(cookie); + Iterator it = cookies.iterator(); + Assert.assertTrue(it.hasNext()); + Assert.assertEquals(cookie, it.next()); + Assert.assertFalse(it.hasNext()); + } + + @Test + public void toArray() throws Exception { + CookieCollection cookies = new CookieCollection(cookie); + Cookie[] array = cookies.toArray(); + Assert.assertEquals(cookies.size(), array.length); + Assert.assertEquals(cookie, array[0]); + } + + @Test + public void toArray1() throws Exception { + CookieCollection cookies = new CookieCollection(cookie); + Cookie[] array = new Cookie[cookies.size()]; + cookies.toArray(array); + Assert.assertEquals(cookies.size(), array.length); + Assert.assertEquals(cookie, array[0]); + } + + @Test + public void add() throws Exception { + CookieCollection cookies = new CookieCollection(cookie); + Cookie newCookie = new Cookie(BROWNIE_NAME, "mmh"); + cookies.add(newCookie); + Assert.assertEquals(2, cookies.size()); + Assert.assertTrue(cookies.contains(newCookie)); + Assert.assertTrue(cookies.contains(BROWNIE_NAME)); + } + + @Test + public void addAgain() { + CookieCollection cookies = new CookieCollection(cookie, brownieCookie, cupsCookie); + Cookie white = new Cookie(COOKIE_NAME, "white"); + boolean modified = cookies.add(white); + Assert.assertTrue(modified); + Assert.assertEquals(white, cookies.get(COOKIE_NAME)); + Assert.assertTrue(cookies.contains(white)); + Assert.assertFalse(cookies.contains(cookie)); + Assert.assertTrue(cookies.contains(COOKIE_NAME)); + } + + @Test + public void get() { + CookieCollection cookies = new CookieCollection(cookie, brownieCookie, cupsCookie); + Cookie c = cookies.get(COOKIE_NAME); + Assert.assertNotNull(c); + Assert.assertEquals(cookie, c); + } + + @Test + public void remove() throws Exception { + CookieCollection cookies = new CookieCollection(cookie, brownieCookie, cupsCookie); + cookies.remove(cookie); + Assert.assertEquals(2, cookies.size()); + Assert.assertFalse(cookies.contains(cookie)); + Assert.assertFalse(cookies.contains(COOKIE_NAME)); + Assert.assertTrue(cookies.contains(brownieCookie)); + Assert.assertTrue(cookies.contains(BROWNIE_NAME)); + } + + @Test + public void containsAll() throws Exception { + List content = Arrays.asList(cookie, brownieCookie); + CookieCollection cookies = new CookieCollection(content); + Assert.assertTrue(cookies.containsAll(content)); + Assert.assertTrue(cookies.containsAll(Collections.singletonList(cookie))); + Assert.assertFalse(cookies.containsAll(Arrays.asList(cookie, brownieCookie, cupsCookie))); + Assert.assertTrue(cookies.containsAll(Arrays.asList(COOKIE_NAME, BROWNIE_NAME))); + } + + @Test + @SuppressWarnings("unchecked") + public void addAll() throws Exception { + CookieCollection cookies = new CookieCollection(); + List content = Arrays.asList(cookie, brownieCookie, cupsCookie); + boolean modified = cookies.addAll(content); + Assert.assertTrue(modified); + Assert.assertEquals(3, cookies.size()); + Assert.assertTrue(cookies.containsAll(content)); + Assert.assertFalse(cookies.addAll(Collections.EMPTY_LIST)); + } + + @Test + public void removeAll() throws Exception { + CookieCollection cookies = new CookieCollection(cookie, brownieCookie, cupsCookie); + boolean modified = cookies.removeAll(Arrays.asList(brownieCookie, cupsCookie)); + Assert.assertTrue(modified); + Assert.assertEquals(1, cookies.size()); + Assert.assertFalse(cookies.contains(brownieCookie)); + Assert.assertFalse(cookies.contains(cupsCookie)); + Assert.assertFalse(cookies.removeAll(Collections.EMPTY_LIST)); + } + + @Test + public void removeAllByName() throws Exception { + CookieCollection cookies = new CookieCollection(cookie, brownieCookie, cupsCookie); + boolean modified = cookies.removeAll(Arrays.asList(COOKIE_NAME, BROWNIE_NAME)); + Assert.assertTrue(modified); + Assert.assertEquals(1, cookies.size()); + Assert.assertFalse(cookies.contains(brownieCookie)); + Assert.assertFalse(cookies.contains(cookie)); + Assert.assertFalse(cookies.removeAll(Collections.EMPTY_LIST)); + } + + @Test + public void retainAll() throws Exception { + CookieCollection cookies = new CookieCollection(cookie, brownieCookie, cupsCookie); + List content = Arrays.asList(cookie, brownieCookie); + boolean modified = cookies.retainAll(content); + Assert.assertTrue(modified); + Assert.assertEquals(2, cookies.size()); + Assert.assertTrue(cookies.containsAll(content)); + Assert.assertFalse(cookies.contains(cupsCookie)); + Assert.assertFalse(cookies.retainAll(content)); + } + + @Test + public void clear() throws Exception { + CookieCollection cookies = new CookieCollection(cookie); + cookies.clear(); + Assert.assertTrue(cookies.isEmpty()); + } +} diff --git a/jhipster/jhipster-uaa/gateway/src/test/java/com/baeldung/jhipster/gateway/security/oauth2/CookieTokenExtractorTest.java b/jhipster/jhipster-uaa/gateway/src/test/java/com/baeldung/jhipster/gateway/security/oauth2/CookieTokenExtractorTest.java new file mode 100644 index 0000000000..af7dec99c4 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/test/java/com/baeldung/jhipster/gateway/security/oauth2/CookieTokenExtractorTest.java @@ -0,0 +1,45 @@ +package com.baeldung.jhipster.gateway.security.oauth2; + +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; +import org.springframework.http.HttpMethod; +import org.springframework.mock.web.MockHttpServletRequest; +import org.springframework.security.core.Authentication; +import org.springframework.security.oauth2.common.OAuth2AccessToken; + +/** + * Test whether the CookieTokenExtractor can properly extract access tokens from + * Cookies and Headers. + */ +public class CookieTokenExtractorTest { + private CookieTokenExtractor cookieTokenExtractor; + + @Before + public void init() { + cookieTokenExtractor = new CookieTokenExtractor(); + } + + @Test + public void testExtractTokenCookie() { + MockHttpServletRequest request = OAuth2AuthenticationServiceTest.createMockHttpServletRequest(); + Authentication authentication = cookieTokenExtractor.extract(request); + Assert.assertEquals(OAuth2AuthenticationServiceTest.ACCESS_TOKEN_VALUE, authentication.getPrincipal().toString()); + } + + @Test + public void testExtractTokenHeader() { + MockHttpServletRequest request = new MockHttpServletRequest(HttpMethod.GET.name(), "http://www.test.com"); + request.addHeader("Authorization", OAuth2AccessToken.BEARER_TYPE + " " + OAuth2AuthenticationServiceTest.ACCESS_TOKEN_VALUE); + Authentication authentication = cookieTokenExtractor.extract(request); + Assert.assertEquals(OAuth2AuthenticationServiceTest.ACCESS_TOKEN_VALUE, authentication.getPrincipal().toString()); + } + + @Test + public void testExtractTokenParam() { + MockHttpServletRequest request = new MockHttpServletRequest(HttpMethod.GET.name(), "http://www.test.com"); + request.addParameter(OAuth2AccessToken.ACCESS_TOKEN, OAuth2AuthenticationServiceTest.ACCESS_TOKEN_VALUE); + Authentication authentication = cookieTokenExtractor.extract(request); + Assert.assertEquals(OAuth2AuthenticationServiceTest.ACCESS_TOKEN_VALUE, authentication.getPrincipal().toString()); + } +} diff --git a/jhipster/jhipster-uaa/gateway/src/test/java/com/baeldung/jhipster/gateway/security/oauth2/OAuth2AuthenticationServiceTest.java b/jhipster/jhipster-uaa/gateway/src/test/java/com/baeldung/jhipster/gateway/security/oauth2/OAuth2AuthenticationServiceTest.java new file mode 100644 index 0000000000..4902b5306e --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/test/java/com/baeldung/jhipster/gateway/security/oauth2/OAuth2AuthenticationServiceTest.java @@ -0,0 +1,252 @@ +package com.baeldung.jhipster.gateway.security.oauth2; + +import com.baeldung.jhipster.gateway.config.oauth2.OAuth2Properties; +import com.baeldung.jhipster.gateway.web.filter.RefreshTokenFilter; +import com.baeldung.jhipster.gateway.web.rest.errors.InvalidPasswordException; +import io.github.jhipster.config.JHipsterProperties; +import org.junit.Assert; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.ExpectedException; +import org.junit.runner.RunWith; +import org.mockito.Mock; +import org.mockito.junit.MockitoJUnitRunner; +import org.springframework.http.*; +import org.springframework.mock.web.MockHttpServletRequest; +import org.springframework.mock.web.MockHttpServletResponse; +import org.springframework.security.oauth2.common.DefaultOAuth2AccessToken; +import org.springframework.security.oauth2.common.DefaultOAuth2RefreshToken; +import org.springframework.security.oauth2.common.OAuth2AccessToken; +import org.springframework.security.oauth2.common.exceptions.InvalidTokenException; +import org.springframework.security.oauth2.provider.token.TokenStore; +import org.springframework.util.LinkedMultiValueMap; +import org.springframework.util.MultiValueMap; +import org.springframework.web.client.HttpClientErrorException; +import org.springframework.web.client.RestTemplate; + +import javax.servlet.http.Cookie; +import javax.servlet.http.HttpServletRequest; +import java.util.Date; +import java.util.HashMap; +import java.util.Map; + +import static org.mockito.Mockito.when; + +/** + * Test password and refresh token grants. + * + * @see OAuth2AuthenticationService + */ +@RunWith(MockitoJUnitRunner.class) +public class OAuth2AuthenticationServiceTest { + public static final String CLIENT_AUTHORIZATION = "Basic d2ViX2FwcDpjaGFuZ2VpdA=="; + public static final String ACCESS_TOKEN_VALUE = "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE0OTQyNzI4NDQsInVzZXJfbmFtZSI6InVzZXIiLCJhdXRob3JpdGllcyI6WyJST0xFX1VTRVIiXSwianRpIjoiNzc1ZTJkYWUtYWYzZi00YTdhLWExOTktNzNiZTU1MmIxZDVkIiwiY2xpZW50X2lkIjoid2ViX2FwcCIsInNjb3BlIjpbIm9wZW5pZCJdfQ.gEK0YcX2IpkpxnkxXXHQ4I0xzTjcy7edqb89ukYE0LPe7xUcZVwkkCJF_nBxsGJh2jtA6NzNLfY5zuL6nP7uoAq3fmvsyrcyR2qPk8JuuNzGtSkICx3kPDRjAT4ST8SZdeh7XCbPVbySJ7ZmPlRWHyedzLA1wXN0NUf8yZYS4ELdUwVBYIXSjkNoKqfWm88cwuNr0g0teypjPtjDqCnXFt1pibwdfIXn479Y1neNAdvSpHcI4Ost-c7APCNxW2gqX-0BItZQearxRgKDdBQ7CGPAIky7dA0gPuKUpp_VCoqowKCXqkE9yKtRQGIISewtj2UkDRZePmzmYrUBXRzfYw"; + public static final String REFRESH_TOKEN_VALUE = "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX25hbWUiOiJ1c2VyIiwic2NvcGUiOlsib3BlbmlkIl0sImF0aSI6Ijc3NWUyZGFlLWFmM2YtNGE3YS1hMTk5LTczYmU1NTJiMWQ1ZCIsImV4cCI6MTQ5Njg2NDc0MywiYXV0aG9yaXRpZXMiOlsiUk9MRV9VU0VSIl0sImp0aSI6IjhmYjI2YTllLTdjYzQtNDFlMi1hNzBjLTk4MDc0N2U2YWFiOSIsImNsaWVudF9pZCI6IndlYl9hcHAifQ.q1-Df9_AFO6TJNiLKV2YwTjRbnd7qcXv52skXYnog5siHYRoR6cPtm6TNQ04iDAoIHljTSTNnD6DS3bHk41mV55gsSVxGReL8VCb_R8ZmhVL4-5yr90sfms0wFp6lgD2bPmZ-TXiS2Oe9wcbNWagy5RsEplZ-sbXu3tjmDao4FN35ojPsXmUs84XnNQH3Y_-PY9GjZG0JEfLQIvE0J5BkXS18Z015GKyA6GBIoLhAGBQQYyG9m10ld_a9fD5SmCyCF72Jad_pfP1u8Z_WyvO-wrlBvm2x-zBthreVrXU5mOb9795wJEP-xaw3dXYGjht_grcW4vKUFtj61JgZk98CQ"; + public static final String EXPIRED_SESSION_TOKEN_VALUE = "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX25hbWUiOiJ1c2VyIiwic2NvcGUiOlsib3BlbmlkIl0sImF0aSI6IjE0NTkwYzdkLTQ5M2YtNDU0NS05MzlmLTg1ODM4ZjRmNzNmNSIsImV4cCI6MTQ5NTU3Mjg5MywiaWF0IjoxNDk1MzIwODkzLCJhdXRob3JpdGllcyI6WyJST0xFX1VTRVIiXSwianRpIjoiNzVhYTIxNzEtMzFmNi00MWJmLWExZGUtYWU0YTg1ZjZiMjEyIiwiY2xpZW50X2lkIjoid2ViX2FwcCJ9.gAH-yly7WAslQUeGhyHmjYXwQN3dluvoT84iOJ2mVWYGVlnDRsoxN3_d1ozqtiso9UM7dWpAr80o3gK7AyK-cO1GGBXa3lg0ETsbucFoqHLivgGZA2qVOsFlDq8E7DZENAbOWmywmhFUOogCfZ-BqsuFSi8waMLL-1qlhehBPuK1KzGxIZbjSVUFFFYTxoWPKi2NNTBzYSwwCV0ixj-gHyFC6Gl5ByA4EvYygGUZF2pACxs4tIRkmT90pXWCjWeKS9k9MlxZ7C4UHqyTRW-IYzqAm8OHdwsnXeu0GkFYc08gxoUuPcjMby8ziYLG5uWj0Ua0msmiSjoafzs-5xfH-Q"; + public static final String NEW_ACCESS_TOKEN_VALUE = "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE0OTQyNzY2NDEsInVzZXJfbmFtZSI6InVzZXIiLCJhdXRob3JpdGllcyI6WyJST0xFX1VTRVIiXSwianRpIjoiYzIyY2YzMDgtZTIyYi00YzNjLWI5MjctOTYwYzA2YmY1ZmU0IiwiY2xpZW50X2lkIjoid2ViX2FwcCIsInNjb3BlIjpbIm9wZW5pZCJdfQ.IAhE39GCqWRUuXdWy-raOcE9NYXRhGiqkeJH649501LeqNPH5HtRUNWmudVRgwT52Bj7HcbJapMLGetKIMEASqC1-WARfcZ_PR0r7Kfg3OlFALWOH_oVT5kvi2H-QCoSAF9mRYK6abCh_tPk5KryVB5c7YxTMIXDT2nTsSexD8eNQOMBWRCg0RaLHZ9bKfeyVgncQJsu7-vTo1xJyh-keYpdNZ0TA2SjYJgezmB7gwW1Kmc7_83htr8VycG7XA_PuD9--yRNlrN0LtNHEBqNypZsOe6NvpKiNlodFYHlsU1CaumzcF9U7dpVanjIUKJ5VRWVUlSFY6JJ755W29VCTw"; + public static final String NEW_REFRESH_TOKEN_VALUE = "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX25hbWUiOiJ1c2VyIiwic2NvcGUiOlsib3BlbmlkIl0sImF0aSI6ImMyMmNmMzA4LWUyMmItNGMzYy1iOTI3LTk2MGMwNmJmNWZlNCIsImV4cCI6MTQ5Njg2ODU4MSwiYXV0aG9yaXRpZXMiOlsiUk9MRV9VU0VSIl0sImp0aSI6ImU4YmZhZWJlLWYzMDItNGNjZS1hZGY1LWQ4MzE5OWM1MjBlOSIsImNsaWVudF9pZCI6IndlYl9hcHAifQ.OemWBUfc-2rl4t4VVqolYxul3L527PbSbX2Xvo7oyy3Vy5nmmblqp4hVGdTEjivrlldGVQX03ERbrA-oFkpmfWbBzLvnKS6AUq1MGjut6dXZJeiEqNYmiAABn6jSgK26S0k6b2ADgmf7mxJO8EBypb5sT1DMAbY5cbOe7r4ZG7zMTVSvlvjHTXp_FM8Y9i6nehLD4XDYY57cb_ZA89vAXNzvTAjoopDliExgR0bApG6nvvDEhEYgTS65lccEQocoev6bISJ3RvNYNPJxWcNPftKDp4HrEt2E2WP28K5IivRtQgDQNlQeormf1tp6AG-Oj__NXyAPM7yhAKXNy2zWdQ"; + @Mock + private RestTemplate restTemplate; + @Mock + private TokenStore tokenStore; + private OAuth2TokenEndpointClient authorizationClient; + private OAuth2AuthenticationService authenticationService; + private RefreshTokenFilter refreshTokenFilter; + @Rule + public ExpectedException expectedException = ExpectedException.none(); + private OAuth2Properties oAuth2Properties; + private JHipsterProperties jHipsterProperties; + + @Before + public void init() { + oAuth2Properties = new OAuth2Properties(); + jHipsterProperties = new JHipsterProperties(); + jHipsterProperties.getSecurity().getClientAuthorization().setAccessTokenUri("http://uaa/oauth/token"); + OAuth2CookieHelper cookieHelper = new OAuth2CookieHelper(oAuth2Properties); + OAuth2AccessToken accessToken = createAccessToken(ACCESS_TOKEN_VALUE, REFRESH_TOKEN_VALUE); + + mockInvalidPassword(); + mockPasswordGrant(accessToken); + mockRefreshGrant(); + + authorizationClient = new UaaTokenEndpointClient(restTemplate, jHipsterProperties, oAuth2Properties); + authenticationService = new OAuth2AuthenticationService(authorizationClient, cookieHelper); + when(tokenStore.readAccessToken(ACCESS_TOKEN_VALUE)).thenReturn(accessToken); + refreshTokenFilter = new RefreshTokenFilter(authenticationService, tokenStore); + } + + public static OAuth2AccessToken createAccessToken(String accessTokenValue, String refreshTokenValue) { + DefaultOAuth2AccessToken accessToken = new DefaultOAuth2AccessToken(accessTokenValue); + accessToken.setExpiration(new Date()); //token expires now + DefaultOAuth2RefreshToken refreshToken = new DefaultOAuth2RefreshToken(refreshTokenValue); + accessToken.setRefreshToken(refreshToken); + return accessToken; + } + + public static MockHttpServletRequest createMockHttpServletRequest() { + MockHttpServletRequest request = new MockHttpServletRequest(HttpMethod.GET.name(), "http://www.test.com"); + Cookie accessTokenCookie = new Cookie(OAuth2CookieHelper.ACCESS_TOKEN_COOKIE, ACCESS_TOKEN_VALUE); + Cookie refreshTokenCookie = new Cookie(OAuth2CookieHelper.REFRESH_TOKEN_COOKIE, REFRESH_TOKEN_VALUE); + request.setCookies(accessTokenCookie, refreshTokenCookie); + return request; + } + + private void mockInvalidPassword() { + HttpHeaders reqHeaders = new HttpHeaders(); + reqHeaders.setContentType(MediaType.APPLICATION_FORM_URLENCODED); + reqHeaders.add("Authorization", CLIENT_AUTHORIZATION); //take over Authorization header from client request to UAA request + MultiValueMap formParams = new LinkedMultiValueMap<>(); + formParams.set("username", "user"); + formParams.set("password", "user2"); + formParams.add("grant_type", "password"); + HttpEntity> entity = new HttpEntity<>(formParams, reqHeaders); + when(restTemplate.postForEntity("http://uaa/oauth/token", entity, OAuth2AccessToken.class)) + .thenThrow(new HttpClientErrorException(HttpStatus.BAD_REQUEST)); + } + + private void mockPasswordGrant(OAuth2AccessToken accessToken) { + HttpHeaders reqHeaders = new HttpHeaders(); + reqHeaders.setContentType(MediaType.APPLICATION_FORM_URLENCODED); + reqHeaders.add("Authorization", CLIENT_AUTHORIZATION); //take over Authorization header from client request to UAA request + MultiValueMap formParams = new LinkedMultiValueMap<>(); + formParams.set("username", "user"); + formParams.set("password", "user"); + formParams.add("grant_type", "password"); + HttpEntity> entity = new HttpEntity<>(formParams, reqHeaders); + when(restTemplate.postForEntity("http://uaa/oauth/token", entity, OAuth2AccessToken.class)) + .thenReturn(new ResponseEntity(accessToken, HttpStatus.OK)); + } + + private void mockRefreshGrant() { + MultiValueMap params = new LinkedMultiValueMap<>(); + params.add("grant_type", "refresh_token"); + params.add("refresh_token", REFRESH_TOKEN_VALUE); + //we must authenticate with the UAA server via HTTP basic authentication using the browser's client_id with no client secret + HttpHeaders headers = new HttpHeaders(); + headers.add("Authorization", CLIENT_AUTHORIZATION); + HttpEntity> entity = new HttpEntity<>(params, headers); + OAuth2AccessToken newAccessToken = createAccessToken(NEW_ACCESS_TOKEN_VALUE, NEW_REFRESH_TOKEN_VALUE); + when(restTemplate.postForEntity("http://uaa/oauth/token", entity, OAuth2AccessToken.class)) + .thenReturn(new ResponseEntity(newAccessToken, HttpStatus.OK)); + } + + @Test + public void testAuthenticationCookies() { + MockHttpServletRequest request = new MockHttpServletRequest(); + request.setServerName("www.test.com"); + request.addHeader("Authorization", CLIENT_AUTHORIZATION); + Map params = new HashMap<>(); + params.put("username", "user"); + params.put("password", "user"); + params.put("rememberMe", "true"); + MockHttpServletResponse response = new MockHttpServletResponse(); + authenticationService.authenticate(request, response, params); + //check that cookies are set correctly + Cookie accessTokenCookie = response.getCookie(OAuth2CookieHelper.ACCESS_TOKEN_COOKIE); + Assert.assertEquals(ACCESS_TOKEN_VALUE, accessTokenCookie.getValue()); + Cookie refreshTokenCookie = response.getCookie(OAuth2CookieHelper.REFRESH_TOKEN_COOKIE); + Assert.assertEquals(REFRESH_TOKEN_VALUE, OAuth2CookieHelper.getRefreshTokenValue(refreshTokenCookie)); + Assert.assertTrue(OAuth2CookieHelper.isRememberMe(refreshTokenCookie)); + } + + @Test + public void testAuthenticationNoRememberMe() { + MockHttpServletRequest request = new MockHttpServletRequest(); + request.setServerName("www.test.com"); + Map params = new HashMap<>(); + params.put("username", "user"); + params.put("password", "user"); + params.put("rememberMe", "false"); + MockHttpServletResponse response = new MockHttpServletResponse(); + authenticationService.authenticate(request, response, params); + //check that cookies are set correctly + Cookie accessTokenCookie = response.getCookie(OAuth2CookieHelper.ACCESS_TOKEN_COOKIE); + Assert.assertEquals(ACCESS_TOKEN_VALUE, accessTokenCookie.getValue()); + Cookie refreshTokenCookie = response.getCookie(OAuth2CookieHelper.SESSION_TOKEN_COOKIE); + Assert.assertEquals(REFRESH_TOKEN_VALUE, OAuth2CookieHelper.getRefreshTokenValue(refreshTokenCookie)); + Assert.assertFalse(OAuth2CookieHelper.isRememberMe(refreshTokenCookie)); + } + + @Test + public void testInvalidPassword() { + MockHttpServletRequest request = new MockHttpServletRequest(); + request.setServerName("www.test.com"); + Map params = new HashMap<>(); + params.put("username", "user"); + params.put("password", "user2"); + params.put("rememberMe", "false"); + MockHttpServletResponse response = new MockHttpServletResponse(); + expectedException.expect(InvalidPasswordException.class); + authenticationService.authenticate(request, response, params); + } + + @Test + public void testRefreshGrant() { + MockHttpServletRequest request = createMockHttpServletRequest(); + MockHttpServletResponse response = new MockHttpServletResponse(); + HttpServletRequest newRequest = refreshTokenFilter.refreshTokensIfExpiring(request, response); + Cookie newAccessTokenCookie = response.getCookie(OAuth2CookieHelper.ACCESS_TOKEN_COOKIE); + Assert.assertEquals(NEW_ACCESS_TOKEN_VALUE, newAccessTokenCookie.getValue()); + Cookie newRefreshTokenCookie = response.getCookie(OAuth2CookieHelper.REFRESH_TOKEN_COOKIE); + Assert.assertEquals(NEW_REFRESH_TOKEN_VALUE, newRefreshTokenCookie.getValue()); + Cookie requestAccessTokenCookie = OAuth2CookieHelper.getAccessTokenCookie(newRequest); + Assert.assertEquals(NEW_ACCESS_TOKEN_VALUE, requestAccessTokenCookie.getValue()); + } + + @Test + public void testSessionExpired() { + MockHttpServletRequest request = new MockHttpServletRequest(HttpMethod.GET.name(), "http://www.test.com"); + Cookie accessTokenCookie = new Cookie(OAuth2CookieHelper.ACCESS_TOKEN_COOKIE, ACCESS_TOKEN_VALUE); + Cookie refreshTokenCookie = new Cookie(OAuth2CookieHelper.SESSION_TOKEN_COOKIE, EXPIRED_SESSION_TOKEN_VALUE); + request.setCookies(accessTokenCookie, refreshTokenCookie); + MockHttpServletResponse response = new MockHttpServletResponse(); + HttpServletRequest newRequest = refreshTokenFilter.refreshTokensIfExpiring(request, response); + //cookies in response are deleted + Cookie newAccessTokenCookie = response.getCookie(OAuth2CookieHelper.ACCESS_TOKEN_COOKIE); + Assert.assertEquals(0, newAccessTokenCookie.getMaxAge()); + Cookie newRefreshTokenCookie = response.getCookie(OAuth2CookieHelper.REFRESH_TOKEN_COOKIE); + Assert.assertEquals(0, newRefreshTokenCookie.getMaxAge()); + //request no longer contains cookies + Cookie requestAccessTokenCookie = OAuth2CookieHelper.getAccessTokenCookie(newRequest); + Assert.assertNull(requestAccessTokenCookie); + Cookie requestRefreshTokenCookie = OAuth2CookieHelper.getRefreshTokenCookie(newRequest); + Assert.assertNull(requestRefreshTokenCookie); + } + + /** + * If no refresh token is found and the access token has expired, then expect an exception. + */ + @Test + public void testRefreshGrantNoRefreshToken() { + MockHttpServletRequest request = new MockHttpServletRequest(HttpMethod.GET.name(), "http://www.test.com"); + Cookie accessTokenCookie = new Cookie(OAuth2CookieHelper.ACCESS_TOKEN_COOKIE, ACCESS_TOKEN_VALUE); + request.setCookies(accessTokenCookie); + MockHttpServletResponse response = new MockHttpServletResponse(); + expectedException.expect(InvalidTokenException.class); + refreshTokenFilter.refreshTokensIfExpiring(request, response); + } + + @Test + public void testLogout() { + MockHttpServletRequest request = new MockHttpServletRequest(); + Cookie accessTokenCookie = new Cookie(OAuth2CookieHelper.ACCESS_TOKEN_COOKIE, ACCESS_TOKEN_VALUE); + Cookie refreshTokenCookie = new Cookie(OAuth2CookieHelper.REFRESH_TOKEN_COOKIE, REFRESH_TOKEN_VALUE); + request.setCookies(accessTokenCookie, refreshTokenCookie); + MockHttpServletResponse response = new MockHttpServletResponse(); + authenticationService.logout(request, response); + Cookie newAccessTokenCookie = response.getCookie(OAuth2CookieHelper.ACCESS_TOKEN_COOKIE); + Assert.assertEquals(0, newAccessTokenCookie.getMaxAge()); + Cookie newRefreshTokenCookie = response.getCookie(OAuth2CookieHelper.REFRESH_TOKEN_COOKIE); + Assert.assertEquals(0, newRefreshTokenCookie.getMaxAge()); + } + + @Test + public void testStripTokens() { + MockHttpServletRequest request = createMockHttpServletRequest(); + HttpServletRequest newRequest = authenticationService.stripTokens(request); + CookieCollection cookies = new CookieCollection(newRequest.getCookies()); + Assert.assertFalse(cookies.contains(OAuth2CookieHelper.ACCESS_TOKEN_COOKIE)); + Assert.assertFalse(cookies.contains(OAuth2CookieHelper.REFRESH_TOKEN_COOKIE)); + } +} diff --git a/jhipster/jhipster-uaa/gateway/src/test/java/com/baeldung/jhipster/gateway/security/oauth2/OAuth2CookieHelperTest.java b/jhipster/jhipster-uaa/gateway/src/test/java/com/baeldung/jhipster/gateway/security/oauth2/OAuth2CookieHelperTest.java new file mode 100644 index 0000000000..d36a67bf66 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/test/java/com/baeldung/jhipster/gateway/security/oauth2/OAuth2CookieHelperTest.java @@ -0,0 +1,98 @@ +package com.baeldung.jhipster.gateway.security.oauth2; + +import com.baeldung.jhipster.gateway.config.oauth2.OAuth2Properties; +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; +import org.springframework.mock.web.MockHttpServletRequest; +import org.springframework.test.util.ReflectionTestUtils; + +/** + * Tests helper functions around OAuth2 Cookies. + * + * @see OAuth2CookieHelper + */ +public class OAuth2CookieHelperTest { + public static final String GET_COOKIE_DOMAIN_METHOD = "getCookieDomain"; + private OAuth2Properties oAuth2Properties; + private OAuth2CookieHelper cookieHelper; + + @Before + public void setUp() throws NoSuchMethodException { + oAuth2Properties = new OAuth2Properties(); + cookieHelper = new OAuth2CookieHelper(oAuth2Properties); + } + + @Test + public void testLocalhostDomain() { + MockHttpServletRequest request = new MockHttpServletRequest(); + request.setServerName("localhost"); + String name = ReflectionTestUtils.invokeMethod(cookieHelper, GET_COOKIE_DOMAIN_METHOD, request); + Assert.assertNull(name); + } + + @Test + public void testComDomain() { + MockHttpServletRequest request = new MockHttpServletRequest(); + request.setServerName("test.com"); + String name = ReflectionTestUtils.invokeMethod(cookieHelper, GET_COOKIE_DOMAIN_METHOD, request); + Assert.assertNull(name); //already top-level domain + } + + @Test + public void testWwwDomainCom() { + MockHttpServletRequest request = new MockHttpServletRequest(); + request.setServerName("www.test.com"); + String name = ReflectionTestUtils.invokeMethod(cookieHelper, GET_COOKIE_DOMAIN_METHOD, request); + Assert.assertNull(name); + } + + @Test + public void testComSubDomain() { + MockHttpServletRequest request = new MockHttpServletRequest(); + request.setServerName("abc.test.com"); + String name = ReflectionTestUtils.invokeMethod(cookieHelper, GET_COOKIE_DOMAIN_METHOD, request); + Assert.assertEquals(".test.com", name); + } + + @Test + public void testWwwSubDomainCom() { + MockHttpServletRequest request = new MockHttpServletRequest(); + request.setServerName("www.abc.test.com"); + String name = ReflectionTestUtils.invokeMethod(cookieHelper, GET_COOKIE_DOMAIN_METHOD, request); + Assert.assertEquals(".test.com", name); + } + + + @Test + public void testCoUkDomain() { + MockHttpServletRequest request = new MockHttpServletRequest(); + request.setServerName("test.co.uk"); + String name = ReflectionTestUtils.invokeMethod(cookieHelper, GET_COOKIE_DOMAIN_METHOD, request); + Assert.assertNull(name); //already top-level domain + } + + @Test + public void testCoUkSubDomain() { + MockHttpServletRequest request = new MockHttpServletRequest(); + request.setServerName("abc.test.co.uk"); + String name = ReflectionTestUtils.invokeMethod(cookieHelper, GET_COOKIE_DOMAIN_METHOD, request); + Assert.assertEquals(".test.co.uk", name); + } + + @Test + public void testNestedDomain() { + MockHttpServletRequest request = new MockHttpServletRequest(); + request.setServerName("abc.xyu.test.co.uk"); + String name = ReflectionTestUtils.invokeMethod(cookieHelper, GET_COOKIE_DOMAIN_METHOD, request); + Assert.assertEquals(".test.co.uk", name); + } + + @Test + public void testIpAddress() { + MockHttpServletRequest request = new MockHttpServletRequest(); + request.setServerName("127.0.0.1"); + String name = ReflectionTestUtils.invokeMethod(cookieHelper, GET_COOKIE_DOMAIN_METHOD, request); + Assert.assertNull(name); + } +} diff --git a/jhipster/jhipster-uaa/gateway/src/test/java/com/baeldung/jhipster/gateway/web/rest/LogsResourceIntTest.java b/jhipster/jhipster-uaa/gateway/src/test/java/com/baeldung/jhipster/gateway/web/rest/LogsResourceIntTest.java new file mode 100644 index 0000000000..2e52eabbca --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/test/java/com/baeldung/jhipster/gateway/web/rest/LogsResourceIntTest.java @@ -0,0 +1,67 @@ +package com.baeldung.jhipster.gateway.web.rest; + +import com.baeldung.jhipster.gateway.GatewayApp; +import com.baeldung.jhipster.gateway.config.SecurityBeanOverrideConfiguration; +import com.baeldung.jhipster.gateway.web.rest.vm.LoggerVM; +import ch.qos.logback.classic.AsyncAppender; +import ch.qos.logback.classic.LoggerContext; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.slf4j.LoggerFactory; +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.setup.MockMvcBuilders; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; +import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.put; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; + +/** + * Test class for the LogsResource REST controller. + * + * @see LogsResource + */ +@RunWith(SpringRunner.class) +@SpringBootTest(classes = {SecurityBeanOverrideConfiguration.class, GatewayApp.class}) +public class LogsResourceIntTest { + + private MockMvc restLogsMockMvc; + + @Before + public void setup() { + LogsResource logsResource = new LogsResource(); + this.restLogsMockMvc = MockMvcBuilders + .standaloneSetup(logsResource) + .build(); + } + + @Test + public void getAllLogs() throws Exception { + restLogsMockMvc.perform(get("/management/logs")) + .andExpect(status().isOk()) + .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE)); + } + + @Test + public void changeLogs() throws Exception { + LoggerVM logger = new LoggerVM(); + logger.setLevel("INFO"); + logger.setName("ROOT"); + + restLogsMockMvc.perform(put("/management/logs") + .contentType(TestUtil.APPLICATION_JSON_UTF8) + .content(TestUtil.convertObjectToJsonBytes(logger))) + .andExpect(status().isNoContent()); + } + + @Test + public void testLogstashAppender() { + LoggerContext context = (LoggerContext) LoggerFactory.getILoggerFactory(); + assertThat(context.getLogger("ROOT").getAppender("ASYNC_LOGSTASH")).isInstanceOf(AsyncAppender.class); + } +} diff --git a/jhipster/jhipster-uaa/gateway/src/test/java/com/baeldung/jhipster/gateway/web/rest/TestUtil.java b/jhipster/jhipster-uaa/gateway/src/test/java/com/baeldung/jhipster/gateway/web/rest/TestUtil.java new file mode 100644 index 0000000000..88795b3f2c --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/test/java/com/baeldung/jhipster/gateway/web/rest/TestUtil.java @@ -0,0 +1,135 @@ +package com.baeldung.jhipster.gateway.web.rest; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; +import org.hamcrest.Description; +import org.hamcrest.TypeSafeDiagnosingMatcher; +import org.springframework.format.datetime.standard.DateTimeFormatterRegistrar; +import org.springframework.format.support.DefaultFormattingConversionService; +import org.springframework.format.support.FormattingConversionService; +import org.springframework.http.MediaType; + +import java.io.IOException; +import java.nio.charset.StandardCharsets; +import java.time.ZonedDateTime; +import java.time.format.DateTimeParseException; + +import static org.assertj.core.api.Assertions.assertThat; + +/** + * Utility class for testing REST controllers. + */ +public class TestUtil { + + /** MediaType for JSON UTF8 */ + public static final MediaType APPLICATION_JSON_UTF8 = new MediaType( + MediaType.APPLICATION_JSON.getType(), + MediaType.APPLICATION_JSON.getSubtype(), StandardCharsets.UTF_8); + + /** + * Convert an object to JSON byte array. + * + * @param object + * the object to convert + * @return the JSON byte array + * @throws IOException + */ + public static byte[] convertObjectToJsonBytes(Object object) + throws IOException { + ObjectMapper mapper = new ObjectMapper(); + mapper.setSerializationInclusion(JsonInclude.Include.NON_EMPTY); + + JavaTimeModule module = new JavaTimeModule(); + mapper.registerModule(module); + + return mapper.writeValueAsBytes(object); + } + + /** + * Create a byte array with a specific size filled with specified data. + * + * @param size the size of the byte array + * @param data the data to put in the byte array + * @return the JSON byte array + */ + public static byte[] createByteArray(int size, String data) { + byte[] byteArray = new byte[size]; + for (int i = 0; i < size; i++) { + byteArray[i] = Byte.parseByte(data, 2); + } + return byteArray; + } + + /** + * A matcher that tests that the examined string represents the same instant as the reference datetime. + */ + public static class ZonedDateTimeMatcher extends TypeSafeDiagnosingMatcher { + + private final ZonedDateTime date; + + public ZonedDateTimeMatcher(ZonedDateTime date) { + this.date = date; + } + + @Override + protected boolean matchesSafely(String item, Description mismatchDescription) { + try { + if (!date.isEqual(ZonedDateTime.parse(item))) { + mismatchDescription.appendText("was ").appendValue(item); + return false; + } + return true; + } catch (DateTimeParseException e) { + mismatchDescription.appendText("was ").appendValue(item) + .appendText(", which could not be parsed as a ZonedDateTime"); + return false; + } + + } + + @Override + public void describeTo(Description description) { + description.appendText("a String representing the same Instant as ").appendValue(date); + } + } + + /** + * Creates a matcher that matches when the examined string reprensents the same instant as the reference datetime + * @param date the reference datetime against which the examined string is checked + */ + public static ZonedDateTimeMatcher sameInstant(ZonedDateTime date) { + return new ZonedDateTimeMatcher(date); + } + + /** + * Verifies the equals/hashcode contract on the domain object. + */ + public static void equalsVerifier(Class clazz) throws Exception { + T domainObject1 = clazz.getConstructor().newInstance(); + assertThat(domainObject1.toString()).isNotNull(); + assertThat(domainObject1).isEqualTo(domainObject1); + assertThat(domainObject1.hashCode()).isEqualTo(domainObject1.hashCode()); + // Test with an instance of another class + Object testOtherObject = new Object(); + assertThat(domainObject1).isNotEqualTo(testOtherObject); + assertThat(domainObject1).isNotEqualTo(null); + // Test with an instance of the same class + T domainObject2 = clazz.getConstructor().newInstance(); + assertThat(domainObject1).isNotEqualTo(domainObject2); + // HashCodes are equals because the objects are not persisted yet + assertThat(domainObject1.hashCode()).isEqualTo(domainObject2.hashCode()); + } + + /** + * Create a FormattingConversionService which use ISO date format, instead of the localized one. + * @return the FormattingConversionService + */ + public static FormattingConversionService createFormattingConversionService() { + DefaultFormattingConversionService dfcs = new DefaultFormattingConversionService (); + DateTimeFormatterRegistrar registrar = new DateTimeFormatterRegistrar(); + registrar.setUseIsoFormat(true); + registrar.registerFormatters(dfcs); + return dfcs; + } +} diff --git a/jhipster/jhipster-uaa/gateway/src/test/java/com/baeldung/jhipster/gateway/web/rest/errors/ExceptionTranslatorIntTest.java b/jhipster/jhipster-uaa/gateway/src/test/java/com/baeldung/jhipster/gateway/web/rest/errors/ExceptionTranslatorIntTest.java new file mode 100644 index 0000000000..3a453b1179 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/test/java/com/baeldung/jhipster/gateway/web/rest/errors/ExceptionTranslatorIntTest.java @@ -0,0 +1,151 @@ +package com.baeldung.jhipster.gateway.web.rest.errors; + +import com.baeldung.jhipster.gateway.GatewayApp; +import com.baeldung.jhipster.gateway.config.SecurityBeanOverrideConfiguration; +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.http.MediaType; +import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter; +import org.springframework.test.context.junit4.SpringRunner; +import org.springframework.test.web.servlet.MockMvc; +import org.springframework.test.web.servlet.setup.MockMvcBuilders; + +import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; +import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; + +/** + * Test class for the ExceptionTranslator controller advice. + * + * @see ExceptionTranslator + */ +@RunWith(SpringRunner.class) +@SpringBootTest(classes = {SecurityBeanOverrideConfiguration.class, GatewayApp.class}) +public class ExceptionTranslatorIntTest { + + @Autowired + private ExceptionTranslatorTestController controller; + + @Autowired + private ExceptionTranslator exceptionTranslator; + + @Autowired + private MappingJackson2HttpMessageConverter jacksonMessageConverter; + + private MockMvc mockMvc; + + @Before + public void setup() { + mockMvc = MockMvcBuilders.standaloneSetup(controller) + .setControllerAdvice(exceptionTranslator) + .setMessageConverters(jacksonMessageConverter) + .build(); + } + + @Test + public void testConcurrencyFailure() throws Exception { + mockMvc.perform(get("/test/concurrency-failure")) + .andExpect(status().isConflict()) + .andExpect(content().contentType(MediaType.APPLICATION_PROBLEM_JSON)) + .andExpect(jsonPath("$.message").value(ErrorConstants.ERR_CONCURRENCY_FAILURE)); + } + + @Test + public void testMethodArgumentNotValid() throws Exception { + mockMvc.perform(post("/test/method-argument").content("{}").contentType(MediaType.APPLICATION_JSON)) + .andExpect(status().isBadRequest()) + .andExpect(content().contentType(MediaType.APPLICATION_PROBLEM_JSON)) + .andExpect(jsonPath("$.message").value(ErrorConstants.ERR_VALIDATION)) + .andExpect(jsonPath("$.fieldErrors.[0].objectName").value("testDTO")) + .andExpect(jsonPath("$.fieldErrors.[0].field").value("test")) + .andExpect(jsonPath("$.fieldErrors.[0].message").value("NotNull")); + } + + @Test + public void testParameterizedError() throws Exception { + mockMvc.perform(get("/test/parameterized-error")) + .andExpect(status().isBadRequest()) + .andExpect(content().contentType(MediaType.APPLICATION_PROBLEM_JSON)) + .andExpect(jsonPath("$.message").value("test parameterized error")) + .andExpect(jsonPath("$.params.param0").value("param0_value")) + .andExpect(jsonPath("$.params.param1").value("param1_value")); + } + + @Test + public void testParameterizedError2() throws Exception { + mockMvc.perform(get("/test/parameterized-error2")) + .andExpect(status().isBadRequest()) + .andExpect(content().contentType(MediaType.APPLICATION_PROBLEM_JSON)) + .andExpect(jsonPath("$.message").value("test parameterized error")) + .andExpect(jsonPath("$.params.foo").value("foo_value")) + .andExpect(jsonPath("$.params.bar").value("bar_value")); + } + + @Test + public void testMissingServletRequestPartException() throws Exception { + mockMvc.perform(get("/test/missing-servlet-request-part")) + .andExpect(status().isBadRequest()) + .andExpect(content().contentType(MediaType.APPLICATION_PROBLEM_JSON)) + .andExpect(jsonPath("$.message").value("error.http.400")); + } + + @Test + public void testMissingServletRequestParameterException() throws Exception { + mockMvc.perform(get("/test/missing-servlet-request-parameter")) + .andExpect(status().isBadRequest()) + .andExpect(content().contentType(MediaType.APPLICATION_PROBLEM_JSON)) + .andExpect(jsonPath("$.message").value("error.http.400")); + } + + @Test + public void testAccessDenied() throws Exception { + mockMvc.perform(get("/test/access-denied")) + .andExpect(status().isForbidden()) + .andExpect(content().contentType(MediaType.APPLICATION_PROBLEM_JSON)) + .andExpect(jsonPath("$.message").value("error.http.403")) + .andExpect(jsonPath("$.detail").value("test access denied!")); + } + + @Test + public void testUnauthorized() throws Exception { + mockMvc.perform(get("/test/unauthorized")) + .andExpect(status().isUnauthorized()) + .andExpect(content().contentType(MediaType.APPLICATION_PROBLEM_JSON)) + .andExpect(jsonPath("$.message").value("error.http.401")) + .andExpect(jsonPath("$.path").value("/test/unauthorized")) + .andExpect(jsonPath("$.detail").value("test authentication failed!")); + } + + @Test + public void testMethodNotSupported() throws Exception { + mockMvc.perform(post("/test/access-denied")) + .andExpect(status().isMethodNotAllowed()) + .andExpect(content().contentType(MediaType.APPLICATION_PROBLEM_JSON)) + .andExpect(jsonPath("$.message").value("error.http.405")) + .andExpect(jsonPath("$.detail").value("Request method 'POST' not supported")); + } + + @Test + public void testExceptionWithResponseStatus() throws Exception { + mockMvc.perform(get("/test/response-status")) + .andExpect(status().isBadRequest()) + .andExpect(content().contentType(MediaType.APPLICATION_PROBLEM_JSON)) + .andExpect(jsonPath("$.message").value("error.http.400")) + .andExpect(jsonPath("$.title").value("test response status")); + } + + @Test + public void testInternalServerError() throws Exception { + mockMvc.perform(get("/test/internal-server-error")) + .andExpect(status().isInternalServerError()) + .andExpect(content().contentType(MediaType.APPLICATION_PROBLEM_JSON)) + .andExpect(jsonPath("$.message").value("error.http.500")) + .andExpect(jsonPath("$.title").value("Internal Server Error")); + } + +} diff --git a/jhipster/jhipster-uaa/gateway/src/test/java/com/baeldung/jhipster/gateway/web/rest/errors/ExceptionTranslatorTestController.java b/jhipster/jhipster-uaa/gateway/src/test/java/com/baeldung/jhipster/gateway/web/rest/errors/ExceptionTranslatorTestController.java new file mode 100644 index 0000000000..dfad64b0d6 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/test/java/com/baeldung/jhipster/gateway/web/rest/errors/ExceptionTranslatorTestController.java @@ -0,0 +1,86 @@ +package com.baeldung.jhipster.gateway.web.rest.errors; + +import org.springframework.dao.ConcurrencyFailureException; +import org.springframework.http.HttpStatus; +import org.springframework.security.access.AccessDeniedException; +import org.springframework.security.authentication.BadCredentialsException; +import org.springframework.web.bind.annotation.*; + +import javax.validation.Valid; +import javax.validation.constraints.NotNull; +import java.util.HashMap; +import java.util.Map; + +@RestController +public class ExceptionTranslatorTestController { + + @GetMapping("/test/concurrency-failure") + public void concurrencyFailure() { + throw new ConcurrencyFailureException("test concurrency failure"); + } + + @PostMapping("/test/method-argument") + public void methodArgument(@Valid @RequestBody TestDTO testDTO) { + } + + @GetMapping("/test/parameterized-error") + public void parameterizedError() { + throw new CustomParameterizedException("test parameterized error", "param0_value", "param1_value"); + } + + @GetMapping("/test/parameterized-error2") + public void parameterizedError2() { + Map params = new HashMap<>(); + params.put("foo", "foo_value"); + params.put("bar", "bar_value"); + throw new CustomParameterizedException("test parameterized error", params); + } + + @GetMapping("/test/missing-servlet-request-part") + public void missingServletRequestPartException(@RequestPart String part) { + } + + @GetMapping("/test/missing-servlet-request-parameter") + public void missingServletRequestParameterException(@RequestParam String param) { + } + + @GetMapping("/test/access-denied") + public void accessdenied() { + throw new AccessDeniedException("test access denied!"); + } + + @GetMapping("/test/unauthorized") + public void unauthorized() { + throw new BadCredentialsException("test authentication failed!"); + } + + @GetMapping("/test/response-status") + public void exceptionWithReponseStatus() { + throw new TestResponseStatusException(); + } + + @GetMapping("/test/internal-server-error") + public void internalServerError() { + throw new RuntimeException(); + } + + public static class TestDTO { + + @NotNull + private String test; + + public String getTest() { + return test; + } + + public void setTest(String test) { + this.test = test; + } + } + + @ResponseStatus(value = HttpStatus.BAD_REQUEST, reason = "test response status") + @SuppressWarnings("serial") + public static class TestResponseStatusException extends RuntimeException { + } + +} diff --git a/jhipster/jhipster-uaa/gateway/src/test/java/com/baeldung/jhipster/gateway/web/rest/util/PaginationUtilUnitTest.java b/jhipster/jhipster-uaa/gateway/src/test/java/com/baeldung/jhipster/gateway/web/rest/util/PaginationUtilUnitTest.java new file mode 100644 index 0000000000..07b343403a --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/test/java/com/baeldung/jhipster/gateway/web/rest/util/PaginationUtilUnitTest.java @@ -0,0 +1,44 @@ +package com.baeldung.jhipster.gateway.web.rest.util; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; + +import java.util.ArrayList; +import java.util.List; + +import org.junit.Test; +import org.springframework.data.domain.Page; +import org.springframework.data.domain.PageImpl; +import org.springframework.data.domain.PageRequest; +import org.springframework.http.HttpHeaders; + +/** + * Tests based on parsing algorithm in app/components/util/pagination-util.service.js + * + * @see PaginationUtil + */ +public class PaginationUtilUnitTest { + + @Test + public void generatePaginationHttpHeadersTest() { + String baseUrl = "/api/_search/example"; + List content = new ArrayList<>(); + Page page = new PageImpl<>(content, PageRequest.of(6, 50), 400L); + HttpHeaders headers = PaginationUtil.generatePaginationHttpHeaders(page, baseUrl); + List strHeaders = headers.get(HttpHeaders.LINK); + assertNotNull(strHeaders); + assertTrue(strHeaders.size() == 1); + String headerData = strHeaders.get(0); + assertTrue(headerData.split(",").length == 4); + String expectedData = "; rel=\"next\"," + + "; rel=\"prev\"," + + "; rel=\"last\"," + + "; rel=\"first\""; + assertEquals(expectedData, headerData); + List xTotalCountHeaders = headers.get("X-Total-Count"); + assertTrue(xTotalCountHeaders.size() == 1); + assertTrue(Long.valueOf(xTotalCountHeaders.get(0)).equals(400L)); + } + +} diff --git a/jhipster/jhipster-uaa/gateway/src/test/javascript/jest-global-mocks.ts b/jhipster/jhipster-uaa/gateway/src/test/javascript/jest-global-mocks.ts new file mode 100644 index 0000000000..a998259857 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/test/javascript/jest-global-mocks.ts @@ -0,0 +1,15 @@ +const mock = () => { + let storage = {}; + return { + getItem: key => (key in storage ? storage[key] : null), + setItem: (key, value) => (storage[key] = value || ''), + removeItem: key => delete storage[key], + clear: () => (storage = {}) + }; +}; + +Object.defineProperty(window, 'localStorage', { value: mock() }); +Object.defineProperty(window, 'sessionStorage', { value: mock() }); +Object.defineProperty(window, 'getComputedStyle', { + value: () => ['-webkit-appearance'] +}); diff --git a/jhipster/jhipster-uaa/gateway/src/test/javascript/jest.conf.js b/jhipster/jhipster-uaa/gateway/src/test/javascript/jest.conf.js new file mode 100644 index 0000000000..80948154fd --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/test/javascript/jest.conf.js @@ -0,0 +1,23 @@ +module.exports = { + preset: 'jest-preset-angular', + setupTestFrameworkScriptFile: '/src/test/javascript/jest.ts', + coverageDirectory: '/target/test-results/', + globals: { + 'ts-jest': { + tsConfigFile: 'tsconfig.json' + }, + __TRANSFORM_HTML__: true + }, + moduleNameMapper: { + 'app/(.*)': '/src/main/webapp/app/$1' + }, + reporters: [ + 'default', + [ 'jest-junit', { output: './target/test-results/jest/TESTS-results.xml' } ] + ], + testResultsProcessor: 'jest-sonar-reporter', + transformIgnorePatterns: ['node_modules/(?!@angular/common/locales)'], + testMatch: ['/src/test/javascript/spec/**/+(*.)+(spec.ts)'], + rootDir: '../../../', + testURL: "http://localhost/" +}; diff --git a/jhipster/jhipster-uaa/gateway/src/test/javascript/jest.ts b/jhipster/jhipster-uaa/gateway/src/test/javascript/jest.ts new file mode 100644 index 0000000000..904329f538 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/test/javascript/jest.ts @@ -0,0 +1,2 @@ +import 'jest-preset-angular'; +import './jest-global-mocks'; diff --git a/jhipster/jhipster-uaa/gateway/src/test/javascript/spec/app/account/activate/activate.component.spec.ts b/jhipster/jhipster-uaa/gateway/src/test/javascript/spec/app/account/activate/activate.component.spec.ts new file mode 100644 index 0000000000..a67e03db43 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/test/javascript/spec/app/account/activate/activate.component.spec.ts @@ -0,0 +1,83 @@ +import { TestBed, async, tick, fakeAsync, inject } from '@angular/core/testing'; +import { ActivatedRoute } from '@angular/router'; +import { Observable, of, throwError } from 'rxjs'; + +import { GatewayTestModule } from '../../../test.module'; +import { MockActivatedRoute } from '../../../helpers/mock-route.service'; +import { ActivateService } from 'app/account/activate/activate.service'; +import { ActivateComponent } from 'app/account/activate/activate.component'; + +describe('Component Tests', () => { + describe('ActivateComponent', () => { + let comp: ActivateComponent; + + beforeEach( + async(() => { + TestBed.configureTestingModule({ + imports: [GatewayTestModule], + declarations: [ActivateComponent], + providers: [ + { + provide: ActivatedRoute, + useValue: new MockActivatedRoute({ key: 'ABC123' }) + } + ] + }) + .overrideTemplate(ActivateComponent, '') + .compileComponents(); + }) + ); + + beforeEach(() => { + const fixture = TestBed.createComponent(ActivateComponent); + comp = fixture.componentInstance; + }); + + it( + 'calls activate.get with the key from params', + inject( + [ActivateService], + fakeAsync((service: ActivateService) => { + spyOn(service, 'get').and.returnValue(of()); + + comp.ngOnInit(); + tick(); + + expect(service.get).toHaveBeenCalledWith('ABC123'); + }) + ) + ); + + it( + 'should set set success to OK upon successful activation', + inject( + [ActivateService], + fakeAsync((service: ActivateService) => { + spyOn(service, 'get').and.returnValue(of({})); + + comp.ngOnInit(); + tick(); + + expect(comp.error).toBe(null); + expect(comp.success).toEqual('OK'); + }) + ) + ); + + it( + 'should set set error to ERROR upon activation failure', + inject( + [ActivateService], + fakeAsync((service: ActivateService) => { + spyOn(service, 'get').and.returnValue(throwError('ERROR')); + + comp.ngOnInit(); + tick(); + + expect(comp.error).toBe('ERROR'); + expect(comp.success).toEqual(null); + }) + ) + ); + }); +}); diff --git a/jhipster/jhipster-uaa/gateway/src/test/javascript/spec/app/account/password-reset/finish/password-reset-finish.component.spec.ts b/jhipster/jhipster-uaa/gateway/src/test/javascript/spec/app/account/password-reset/finish/password-reset-finish.component.spec.ts new file mode 100644 index 0000000000..cc17dcd3e0 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/test/javascript/spec/app/account/password-reset/finish/password-reset-finish.component.spec.ts @@ -0,0 +1,128 @@ +import { ComponentFixture, TestBed, inject, tick, fakeAsync } from '@angular/core/testing'; +import { Observable, of, throwError } from 'rxjs'; +import { Renderer, ElementRef } from '@angular/core'; +import { ActivatedRoute } from '@angular/router'; + +import { GatewayTestModule } from '../../../../test.module'; +import { PasswordResetFinishComponent } from 'app/account/password-reset/finish/password-reset-finish.component'; +import { PasswordResetFinishService } from 'app/account/password-reset/finish/password-reset-finish.service'; +import { MockActivatedRoute } from '../../../../helpers/mock-route.service'; + +describe('Component Tests', () => { + describe('PasswordResetFinishComponent', () => { + let fixture: ComponentFixture; + let comp: PasswordResetFinishComponent; + + beforeEach(() => { + fixture = TestBed.configureTestingModule({ + imports: [GatewayTestModule], + declarations: [PasswordResetFinishComponent], + providers: [ + { + provide: ActivatedRoute, + useValue: new MockActivatedRoute({ key: 'XYZPDQ' }) + }, + { + provide: Renderer, + useValue: { + invokeElementMethod(renderElement: any, methodName: string, args?: any[]) {} + } + }, + { + provide: ElementRef, + useValue: new ElementRef(null) + } + ] + }) + .overrideTemplate(PasswordResetFinishComponent, '') + .createComponent(PasswordResetFinishComponent); + }); + + beforeEach(() => { + fixture = TestBed.createComponent(PasswordResetFinishComponent); + comp = fixture.componentInstance; + comp.ngOnInit(); + }); + + it('should define its initial state', () => { + comp.ngOnInit(); + + expect(comp.keyMissing).toBeFalsy(); + expect(comp.key).toEqual('XYZPDQ'); + expect(comp.resetAccount).toEqual({}); + }); + + it( + 'sets focus after the view has been initialized', + inject([ElementRef], (elementRef: ElementRef) => { + const element = fixture.nativeElement; + const node = { + focus() {} + }; + + elementRef.nativeElement = element; + spyOn(element, 'querySelector').and.returnValue(node); + spyOn(node, 'focus'); + + comp.ngAfterViewInit(); + + expect(element.querySelector).toHaveBeenCalledWith('#password'); + expect(node.focus).toHaveBeenCalled(); + }) + ); + + it('should ensure the two passwords entered match', () => { + comp.resetAccount.password = 'password'; + comp.confirmPassword = 'non-matching'; + + comp.finishReset(); + + expect(comp.doNotMatch).toEqual('ERROR'); + }); + + it( + 'should update success to OK after resetting password', + inject( + [PasswordResetFinishService], + fakeAsync((service: PasswordResetFinishService) => { + spyOn(service, 'save').and.returnValue(of({})); + + comp.resetAccount.password = 'password'; + comp.confirmPassword = 'password'; + + comp.finishReset(); + tick(); + + expect(service.save).toHaveBeenCalledWith({ + key: 'XYZPDQ', + newPassword: 'password' + }); + expect(comp.success).toEqual('OK'); + }) + ) + ); + + it( + 'should notify of generic error', + inject( + [PasswordResetFinishService], + fakeAsync((service: PasswordResetFinishService) => { + spyOn(service, 'save').and.returnValue(throwError('ERROR')); + + comp.resetAccount.password = 'password'; + comp.confirmPassword = 'password'; + + comp.finishReset(); + tick(); + + expect(service.save).toHaveBeenCalledWith({ + key: 'XYZPDQ', + newPassword: 'password' + }); + expect(comp.success).toBeNull(); + expect(comp.error).toEqual('ERROR'); + }) + ) + ); + }); +}); diff --git a/jhipster/jhipster-uaa/gateway/src/test/javascript/spec/app/account/password-reset/init/password-reset-init.component.spec.ts b/jhipster/jhipster-uaa/gateway/src/test/javascript/spec/app/account/password-reset/init/password-reset-init.component.spec.ts new file mode 100644 index 0000000000..9a4300ae9a --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/test/javascript/spec/app/account/password-reset/init/password-reset-init.component.spec.ts @@ -0,0 +1,119 @@ +import { ComponentFixture, TestBed, inject } from '@angular/core/testing'; +import { Renderer, ElementRef } from '@angular/core'; +import { Observable, of, throwError } from 'rxjs'; + +import { GatewayTestModule } from '../../../../test.module'; +import { PasswordResetInitComponent } from 'app/account/password-reset/init/password-reset-init.component'; +import { PasswordResetInitService } from 'app/account/password-reset/init/password-reset-init.service'; +import { EMAIL_NOT_FOUND_TYPE } from 'app/shared'; + +describe('Component Tests', () => { + describe('PasswordResetInitComponent', () => { + let fixture: ComponentFixture; + let comp: PasswordResetInitComponent; + + beforeEach(() => { + fixture = TestBed.configureTestingModule({ + imports: [GatewayTestModule], + declarations: [PasswordResetInitComponent], + providers: [ + { + provide: Renderer, + useValue: { + invokeElementMethod(renderElement: any, methodName: string, args?: any[]) {} + } + }, + { + provide: ElementRef, + useValue: new ElementRef(null) + } + ] + }) + .overrideTemplate(PasswordResetInitComponent, '') + .createComponent(PasswordResetInitComponent); + comp = fixture.componentInstance; + comp.ngOnInit(); + }); + + it('should define its initial state', () => { + expect(comp.success).toBeUndefined(); + expect(comp.error).toBeUndefined(); + expect(comp.errorEmailNotExists).toBeUndefined(); + expect(comp.resetAccount).toEqual({}); + }); + + it( + 'sets focus after the view has been initialized', + inject([ElementRef], (elementRef: ElementRef) => { + const element = fixture.nativeElement; + const node = { + focus() {} + }; + + elementRef.nativeElement = element; + spyOn(element, 'querySelector').and.returnValue(node); + spyOn(node, 'focus'); + + comp.ngAfterViewInit(); + + expect(element.querySelector).toHaveBeenCalledWith('#email'); + expect(node.focus).toHaveBeenCalled(); + }) + ); + + it( + 'notifies of success upon successful requestReset', + inject([PasswordResetInitService], (service: PasswordResetInitService) => { + spyOn(service, 'save').and.returnValue(of({})); + comp.resetAccount.email = 'user@domain.com'; + + comp.requestReset(); + + expect(service.save).toHaveBeenCalledWith('user@domain.com'); + expect(comp.success).toEqual('OK'); + expect(comp.error).toBeNull(); + expect(comp.errorEmailNotExists).toBeNull(); + }) + ); + + it( + 'notifies of unknown email upon email address not registered/400', + inject([PasswordResetInitService], (service: PasswordResetInitService) => { + spyOn(service, 'save').and.returnValue( + throwError({ + status: 400, + error: { type: EMAIL_NOT_FOUND_TYPE } + }) + ); + comp.resetAccount.email = 'user@domain.com'; + + comp.requestReset(); + + expect(service.save).toHaveBeenCalledWith('user@domain.com'); + expect(comp.success).toBeNull(); + expect(comp.error).toBeNull(); + expect(comp.errorEmailNotExists).toEqual('ERROR'); + }) + ); + + it( + 'notifies of error upon error response', + inject([PasswordResetInitService], (service: PasswordResetInitService) => { + spyOn(service, 'save').and.returnValue( + throwError({ + status: 503, + data: 'something else' + }) + ); + comp.resetAccount.email = 'user@domain.com'; + + comp.requestReset(); + + expect(service.save).toHaveBeenCalledWith('user@domain.com'); + expect(comp.success).toBeNull(); + expect(comp.errorEmailNotExists).toBeNull(); + expect(comp.error).toEqual('ERROR'); + }) + ); + }); +}); diff --git a/jhipster/jhipster-uaa/gateway/src/test/javascript/spec/app/account/password/password-strength-bar.component.spec.ts b/jhipster/jhipster-uaa/gateway/src/test/javascript/spec/app/account/password/password-strength-bar.component.spec.ts new file mode 100644 index 0000000000..b856cf4fd7 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/test/javascript/spec/app/account/password/password-strength-bar.component.spec.ts @@ -0,0 +1,50 @@ +import { ComponentFixture, TestBed, async } from '@angular/core/testing'; + +import { PasswordStrengthBarComponent } from 'app/account/password/password-strength-bar.component'; + +describe('Component Tests', () => { + describe('PasswordStrengthBarComponent', () => { + let comp: PasswordStrengthBarComponent; + let fixture: ComponentFixture; + + beforeEach( + async(() => { + TestBed.configureTestingModule({ + declarations: [PasswordStrengthBarComponent] + }) + .overrideTemplate(PasswordStrengthBarComponent, '') + .compileComponents(); + }) + ); + + beforeEach(() => { + fixture = TestBed.createComponent(PasswordStrengthBarComponent); + comp = fixture.componentInstance; + }); + + describe('PasswordStrengthBarComponents', () => { + it('should initialize with default values', () => { + expect(comp.measureStrength('')).toBe(0); + expect(comp.colors).toEqual(['#F00', '#F90', '#FF0', '#9F0', '#0F0']); + expect(comp.getColor(0).idx).toBe(1); + expect(comp.getColor(0).col).toBe(comp.colors[0]); + }); + + it('should increase strength upon password value change', () => { + expect(comp.measureStrength('')).toBe(0); + expect(comp.measureStrength('aa')).toBeGreaterThanOrEqual(comp.measureStrength('')); + expect(comp.measureStrength('aa^6')).toBeGreaterThanOrEqual(comp.measureStrength('aa')); + expect(comp.measureStrength('Aa090(**)')).toBeGreaterThanOrEqual(comp.measureStrength('aa^6')); + expect(comp.measureStrength('Aa090(**)+-07365')).toBeGreaterThanOrEqual(comp.measureStrength('Aa090(**)')); + }); + + it('should change the color based on strength', () => { + expect(comp.getColor(0).col).toBe(comp.colors[0]); + expect(comp.getColor(11).col).toBe(comp.colors[1]); + expect(comp.getColor(22).col).toBe(comp.colors[2]); + expect(comp.getColor(33).col).toBe(comp.colors[3]); + expect(comp.getColor(44).col).toBe(comp.colors[4]); + }); + }); + }); +}); diff --git a/jhipster/jhipster-uaa/gateway/src/test/javascript/spec/app/account/password/password.component.spec.ts b/jhipster/jhipster-uaa/gateway/src/test/javascript/spec/app/account/password/password.component.spec.ts new file mode 100644 index 0000000000..7665cc3a12 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/test/javascript/spec/app/account/password/password.component.spec.ts @@ -0,0 +1,91 @@ +import { ComponentFixture, TestBed, async } from '@angular/core/testing'; +import { HttpResponse } from '@angular/common/http'; +import { Observable, of, throwError } from 'rxjs'; + +import { GatewayTestModule } from '../../../test.module'; +import { PasswordComponent } from 'app/account/password/password.component'; +import { PasswordService } from 'app/account/password/password.service'; + +describe('Component Tests', () => { + describe('PasswordComponent', () => { + let comp: PasswordComponent; + let fixture: ComponentFixture; + let service: PasswordService; + + beforeEach( + async(() => { + TestBed.configureTestingModule({ + imports: [GatewayTestModule], + declarations: [PasswordComponent], + providers: [] + }) + .overrideTemplate(PasswordComponent, '') + .compileComponents(); + }) + ); + + beforeEach(() => { + fixture = TestBed.createComponent(PasswordComponent); + comp = fixture.componentInstance; + service = fixture.debugElement.injector.get(PasswordService); + }); + + it('should show error if passwords do not match', () => { + // GIVEN + comp.newPassword = 'password1'; + comp.confirmPassword = 'password2'; + // WHEN + comp.changePassword(); + // THEN + expect(comp.doNotMatch).toBe('ERROR'); + expect(comp.error).toBeNull(); + expect(comp.success).toBeNull(); + }); + + it('should call Auth.changePassword when passwords match', () => { + // GIVEN + const passwordValues = { + currentPassword: 'oldPassword', + newPassword: 'myPassword' + }; + + spyOn(service, 'save').and.returnValue(of(new HttpResponse({ body: true }))); + comp.currentPassword = passwordValues.currentPassword; + comp.newPassword = comp.confirmPassword = passwordValues.newPassword; + + // WHEN + comp.changePassword(); + + // THEN + expect(service.save).toHaveBeenCalledWith(passwordValues.newPassword, passwordValues.currentPassword); + }); + + it('should set success to OK upon success', function() { + // GIVEN + spyOn(service, 'save').and.returnValue(of(new HttpResponse({ body: true }))); + comp.newPassword = comp.confirmPassword = 'myPassword'; + + // WHEN + comp.changePassword(); + + // THEN + expect(comp.doNotMatch).toBeNull(); + expect(comp.error).toBeNull(); + expect(comp.success).toBe('OK'); + }); + + it('should notify of error if change password fails', function() { + // GIVEN + spyOn(service, 'save').and.returnValue(throwError('ERROR')); + comp.newPassword = comp.confirmPassword = 'myPassword'; + + // WHEN + comp.changePassword(); + + // THEN + expect(comp.doNotMatch).toBeNull(); + expect(comp.success).toBeNull(); + expect(comp.error).toBe('ERROR'); + }); + }); +}); diff --git a/jhipster/jhipster-uaa/gateway/src/test/javascript/spec/app/account/register/register.component.spec.ts b/jhipster/jhipster-uaa/gateway/src/test/javascript/spec/app/account/register/register.component.spec.ts new file mode 100644 index 0000000000..89793ae6b3 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/test/javascript/spec/app/account/register/register.component.spec.ts @@ -0,0 +1,135 @@ +import { ComponentFixture, TestBed, async, inject, tick, fakeAsync } from '@angular/core/testing'; +import { Observable, of, throwError } from 'rxjs'; + +import { JhiLanguageService } from 'ng-jhipster'; +import { MockLanguageService } from '../../../helpers/mock-language.service'; +import { GatewayTestModule } from '../../../test.module'; +import { EMAIL_ALREADY_USED_TYPE, LOGIN_ALREADY_USED_TYPE } from 'app/shared'; +import { Register } from 'app/account/register/register.service'; +import { RegisterComponent } from 'app/account/register/register.component'; + +describe('Component Tests', () => { + describe('RegisterComponent', () => { + let fixture: ComponentFixture; + let comp: RegisterComponent; + + beforeEach( + async(() => { + TestBed.configureTestingModule({ + imports: [GatewayTestModule], + declarations: [RegisterComponent] + }) + .overrideTemplate(RegisterComponent, '') + .compileComponents(); + }) + ); + + beforeEach(() => { + fixture = TestBed.createComponent(RegisterComponent); + comp = fixture.componentInstance; + comp.ngOnInit(); + }); + + it('should ensure the two passwords entered match', () => { + comp.registerAccount.password = 'password'; + comp.confirmPassword = 'non-matching'; + + comp.register(); + + expect(comp.doNotMatch).toEqual('ERROR'); + }); + + it( + 'should update success to OK after creating an account', + inject( + [Register, JhiLanguageService], + fakeAsync((service: Register, mockTranslate: MockLanguageService) => { + spyOn(service, 'save').and.returnValue(of({})); + comp.registerAccount.password = comp.confirmPassword = 'password'; + + comp.register(); + tick(); + + expect(service.save).toHaveBeenCalledWith({ + password: 'password', + langKey: 'en' + }); + expect(comp.success).toEqual(true); + expect(comp.registerAccount.langKey).toEqual('en'); + expect(mockTranslate.getCurrentSpy).toHaveBeenCalled(); + expect(comp.errorUserExists).toBeNull(); + expect(comp.errorEmailExists).toBeNull(); + expect(comp.error).toBeNull(); + }) + ) + ); + + it( + 'should notify of user existence upon 400/login already in use', + inject( + [Register], + fakeAsync((service: Register) => { + spyOn(service, 'save').and.returnValue( + throwError({ + status: 400, + error: { type: LOGIN_ALREADY_USED_TYPE } + }) + ); + comp.registerAccount.password = comp.confirmPassword = 'password'; + + comp.register(); + tick(); + + expect(comp.errorUserExists).toEqual('ERROR'); + expect(comp.errorEmailExists).toBeNull(); + expect(comp.error).toBeNull(); + }) + ) + ); + + it( + 'should notify of email existence upon 400/email address already in use', + inject( + [Register], + fakeAsync((service: Register) => { + spyOn(service, 'save').and.returnValue( + throwError({ + status: 400, + error: { type: EMAIL_ALREADY_USED_TYPE } + }) + ); + comp.registerAccount.password = comp.confirmPassword = 'password'; + + comp.register(); + tick(); + + expect(comp.errorEmailExists).toEqual('ERROR'); + expect(comp.errorUserExists).toBeNull(); + expect(comp.error).toBeNull(); + }) + ) + ); + + it( + 'should notify of generic error', + inject( + [Register], + fakeAsync((service: Register) => { + spyOn(service, 'save').and.returnValue( + throwError({ + status: 503 + }) + ); + comp.registerAccount.password = comp.confirmPassword = 'password'; + + comp.register(); + tick(); + + expect(comp.errorUserExists).toBeNull(); + expect(comp.errorEmailExists).toBeNull(); + expect(comp.error).toEqual('ERROR'); + }) + ) + ); + }); +}); diff --git a/jhipster/jhipster-uaa/gateway/src/test/javascript/spec/app/account/settings/settings.component.spec.ts b/jhipster/jhipster-uaa/gateway/src/test/javascript/spec/app/account/settings/settings.component.spec.ts new file mode 100644 index 0000000000..253c2dd555 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/test/javascript/spec/app/account/settings/settings.component.spec.ts @@ -0,0 +1,85 @@ +import { ComponentFixture, TestBed, async } from '@angular/core/testing'; +import { Observable, throwError } from 'rxjs'; + +import { GatewayTestModule } from '../../../test.module'; +import { Principal, AccountService } from 'app/core'; +import { SettingsComponent } from 'app/account/settings/settings.component'; + +describe('Component Tests', () => { + describe('SettingsComponent', () => { + let comp: SettingsComponent; + let fixture: ComponentFixture; + let mockAuth: any; + let mockPrincipal: any; + + beforeEach( + async(() => { + TestBed.configureTestingModule({ + imports: [GatewayTestModule], + declarations: [SettingsComponent], + providers: [] + }) + .overrideTemplate(SettingsComponent, '') + .compileComponents(); + }) + ); + + beforeEach(() => { + fixture = TestBed.createComponent(SettingsComponent); + comp = fixture.componentInstance; + mockAuth = fixture.debugElement.injector.get(AccountService); + mockPrincipal = fixture.debugElement.injector.get(Principal); + }); + + it('should send the current identity upon save', () => { + // GIVEN + const accountValues = { + firstName: 'John', + lastName: 'Doe', + + activated: true, + email: 'john.doe@mail.com', + langKey: 'en', + login: 'john' + }; + mockPrincipal.setResponse(accountValues); + + // WHEN + comp.settingsAccount = accountValues; + comp.save(); + + // THEN + expect(mockPrincipal.identitySpy).toHaveBeenCalled(); + expect(mockAuth.saveSpy).toHaveBeenCalledWith(accountValues); + expect(comp.settingsAccount).toEqual(accountValues); + }); + + it('should notify of success upon successful save', () => { + // GIVEN + const accountValues = { + firstName: 'John', + lastName: 'Doe' + }; + mockPrincipal.setResponse(accountValues); + + // WHEN + comp.save(); + + // THEN + expect(comp.error).toBeNull(); + expect(comp.success).toBe('OK'); + }); + + it('should notify of error upon failed save', () => { + // GIVEN + mockAuth.saveSpy.and.returnValue(throwError('ERROR')); + + // WHEN + comp.save(); + + // THEN + expect(comp.error).toEqual('ERROR'); + expect(comp.success).toBeNull(); + }); + }); +}); diff --git a/jhipster/jhipster-uaa/gateway/src/test/javascript/spec/app/admin/audits/audits.component.spec.ts b/jhipster/jhipster-uaa/gateway/src/test/javascript/spec/app/admin/audits/audits.component.spec.ts new file mode 100644 index 0000000000..0a53aeddb3 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/test/javascript/spec/app/admin/audits/audits.component.spec.ts @@ -0,0 +1,135 @@ +import { ComponentFixture, TestBed, async } from '@angular/core/testing'; +import { Observable, of } from 'rxjs'; +import { HttpHeaders, HttpResponse } from '@angular/common/http'; + +import { GatewayTestModule } from '../../../test.module'; +import { AuditsComponent } from 'app/admin/audits/audits.component'; +import { AuditsService } from 'app/admin/audits/audits.service'; +import { Audit } from 'app/admin/audits/audit.model'; +import { ITEMS_PER_PAGE } from 'app/shared'; + +function build2DigitsDatePart(datePart: number) { + return `0${datePart}`.slice(-2); +} + +function getDate(isToday = true) { + let date: Date = new Date(); + if (isToday) { + // Today + 1 day - needed if the current day must be included + date.setDate(date.getDate() + 1); + } else { + // get last month + if (date.getMonth() === 0) { + date = new Date(date.getFullYear() - 1, 11, date.getDate()); + } else { + date = new Date(date.getFullYear(), date.getMonth() - 1, date.getDate()); + } + } + const monthString = build2DigitsDatePart(date.getMonth() + 1); + const dateString = build2DigitsDatePart(date.getDate()); + return `${date.getFullYear()}-${monthString}-${dateString}`; +} + +describe('Component Tests', () => { + describe('AuditsComponent', () => { + let comp: AuditsComponent; + let fixture: ComponentFixture; + let service: AuditsService; + + beforeEach( + async(() => { + TestBed.configureTestingModule({ + imports: [GatewayTestModule], + declarations: [AuditsComponent], + providers: [AuditsService] + }) + .overrideTemplate(AuditsComponent, '') + .compileComponents(); + }) + ); + + beforeEach(() => { + fixture = TestBed.createComponent(AuditsComponent); + comp = fixture.componentInstance; + service = fixture.debugElement.injector.get(AuditsService); + }); + + describe('today function ', () => { + it('should set toDate to current date', () => { + comp.today(); + expect(comp.toDate).toBe(getDate()); + }); + }); + + describe('previousMonth function ', () => { + it('should set fromDate to current date', () => { + comp.previousMonth(); + expect(comp.fromDate).toBe(getDate(false)); + }); + }); + + describe('By default, on init', () => { + it('should set all default values correctly', () => { + fixture.detectChanges(); + expect(comp.toDate).toBe(getDate()); + expect(comp.fromDate).toBe(getDate(false)); + expect(comp.itemsPerPage).toBe(ITEMS_PER_PAGE); + expect(comp.page).toBe(10); + expect(comp.reverse).toBeFalsy(); + expect(comp.predicate).toBe('id'); + }); + }); + + describe('OnInit', () => { + it('Should call load all on init', () => { + // GIVEN + const headers = new HttpHeaders().append('link', 'link;link'); + const audit = new Audit({ remoteAddress: '127.0.0.1', sessionId: '123' }, 'user', '20140101', 'AUTHENTICATION_SUCCESS'); + spyOn(service, 'query').and.returnValue( + of( + new HttpResponse({ + body: [audit], + headers + }) + ) + ); + + // WHEN + comp.ngOnInit(); + + // THEN + expect(service.query).toHaveBeenCalled(); + expect(comp.audits[0]).toEqual(jasmine.objectContaining(audit)); + }); + }); + + describe('Create sort object', () => { + it('Should sort only by id asc', () => { + // GIVEN + comp.predicate = 'id'; + comp.reverse = false; + + // WHEN + const sort = comp.sort(); + + // THEN + expect(sort.length).toEqual(1); + expect(sort[0]).toEqual('id,desc'); + }); + + it('Should sort by timestamp asc then by id', () => { + // GIVEN + comp.predicate = 'timestamp'; + comp.reverse = true; + + // WHEN + const sort = comp.sort(); + + // THEN + expect(sort.length).toEqual(2); + expect(sort[0]).toEqual('timestamp,asc'); + expect(sort[1]).toEqual('id'); + }); + }); + }); +}); diff --git a/jhipster/jhipster-uaa/gateway/src/test/javascript/spec/app/admin/audits/audits.service.spec.ts b/jhipster/jhipster-uaa/gateway/src/test/javascript/spec/app/admin/audits/audits.service.spec.ts new file mode 100644 index 0000000000..d03559108b --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/test/javascript/spec/app/admin/audits/audits.service.spec.ts @@ -0,0 +1,59 @@ +import { TestBed } from '@angular/core/testing'; + +import { AuditsService } from 'app/admin/audits/audits.service'; +import { Audit } from 'app/admin/audits/audit.model'; +import { SERVER_API_URL } from 'app/app.constants'; +import { HttpClientTestingModule, HttpTestingController } from '@angular/common/http/testing'; + +describe('Service Tests', () => { + describe('Audits Service', () => { + let service: AuditsService; + let httpMock; + + beforeEach(() => { + TestBed.configureTestingModule({ + imports: [HttpClientTestingModule] + }); + + service = TestBed.get(AuditsService); + httpMock = TestBed.get(HttpTestingController); + }); + + afterEach(() => { + httpMock.verify(); + }); + + describe('Service methods', () => { + it('should call correct URL', () => { + service.query({}).subscribe(() => {}); + + const req = httpMock.expectOne({ method: 'GET' }); + const resourceUrl = SERVER_API_URL + 'uaa/management/audits'; + expect(req.request.url).toEqual(resourceUrl); + }); + + it('should return Audits', () => { + const audit = new Audit({ remoteAddress: '127.0.0.1', sessionId: '123' }, 'user', '20140101', 'AUTHENTICATION_SUCCESS'); + + service.query({}).subscribe(received => { + expect(received.body[0]).toEqual(audit); + }); + + const req = httpMock.expectOne({ method: 'GET' }); + req.flush([audit]); + }); + + it('should propagate not found response', () => { + service.query({}).subscribe(null, (_error: any) => { + expect(_error.status).toEqual(404); + }); + + const req = httpMock.expectOne({ method: 'GET' }); + req.flush('Invalid request parameters', { + status: 404, + statusText: 'Bad Request' + }); + }); + }); + }); +}); diff --git a/jhipster/jhipster-uaa/gateway/src/test/javascript/spec/app/admin/configuration/configuration.component.spec.ts b/jhipster/jhipster-uaa/gateway/src/test/javascript/spec/app/admin/configuration/configuration.component.spec.ts new file mode 100644 index 0000000000..463c9373a9 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/test/javascript/spec/app/admin/configuration/configuration.component.spec.ts @@ -0,0 +1,73 @@ +import { ComponentFixture, TestBed, async } from '@angular/core/testing'; +import { of } from 'rxjs'; +import { HttpHeaders, HttpResponse } from '@angular/common/http'; + +import { GatewayTestModule } from '../../../test.module'; +import { JhiConfigurationComponent } from 'app/admin/configuration/configuration.component'; +import { JhiConfigurationService } from 'app/admin/configuration/configuration.service'; +import { ITEMS_PER_PAGE } from 'app/shared'; +import { Log } from 'app/admin'; + +describe('Component Tests', () => { + describe('JhiConfigurationComponent', () => { + let comp: JhiConfigurationComponent; + let fixture: ComponentFixture; + let service: JhiConfigurationService; + + beforeEach( + async(() => { + TestBed.configureTestingModule({ + imports: [GatewayTestModule], + declarations: [JhiConfigurationComponent], + providers: [JhiConfigurationService] + }) + .overrideTemplate(JhiConfigurationComponent, '') + .compileComponents(); + }) + ); + + beforeEach(() => { + fixture = TestBed.createComponent(JhiConfigurationComponent); + comp = fixture.componentInstance; + service = fixture.debugElement.injector.get(JhiConfigurationService); + }); + + describe('OnInit', () => { + it('should set all default values correctly', () => { + expect(comp.configKeys).toEqual([]); + expect(comp.filter).toBe(''); + expect(comp.orderProp).toBe('prefix'); + expect(comp.reverse).toBe(false); + }); + it('Should call load all on init', () => { + // GIVEN + const body = [{ config: 'test', properties: 'test' }, { config: 'test2' }]; + const envConfig = { envConfig: 'test' }; + spyOn(service, 'get').and.returnValue(of(body)); + spyOn(service, 'getEnv').and.returnValue(of(envConfig)); + + // WHEN + comp.ngOnInit(); + + // THEN + expect(service.get).toHaveBeenCalled(); + expect(service.getEnv).toHaveBeenCalled(); + expect(comp.configKeys).toEqual([['0', '1', '2', '3']]); + expect(comp.allConfiguration).toEqual(envConfig); + }); + }); + describe('keys method', () => { + it('should return the keys of an Object', () => { + // GIVEN + const data = { + key1: 'test', + key2: 'test2' + }; + + // THEN + expect(comp.keys(data)).toEqual(['key1', 'key2']); + expect(comp.keys(undefined)).toEqual([]); + }); + }); + }); +}); diff --git a/jhipster/jhipster-uaa/gateway/src/test/javascript/spec/app/admin/configuration/configuration.service.spec.ts b/jhipster/jhipster-uaa/gateway/src/test/javascript/spec/app/admin/configuration/configuration.service.spec.ts new file mode 100644 index 0000000000..6039044b7f --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/test/javascript/spec/app/admin/configuration/configuration.service.spec.ts @@ -0,0 +1,64 @@ +import { TestBed } from '@angular/core/testing'; + +import { JhiConfigurationService } from 'app/admin/configuration/configuration.service'; +import { SERVER_API_URL } from 'app/app.constants'; +import { HttpClientTestingModule, HttpTestingController } from '@angular/common/http/testing'; +import { HttpResponse } from '@angular/common/http'; + +describe('Service Tests', () => { + describe('Logs Service', () => { + let service: JhiConfigurationService; + let httpMock; + + beforeEach(() => { + TestBed.configureTestingModule({ + imports: [HttpClientTestingModule] + }); + + service = TestBed.get(JhiConfigurationService); + httpMock = TestBed.get(HttpTestingController); + }); + + afterEach(() => { + httpMock.verify(); + }); + + describe('Service methods', () => { + it('should call correct URL', () => { + service.get().subscribe(() => {}); + + const req = httpMock.expectOne({ method: 'GET' }); + const resourceUrl = SERVER_API_URL + 'management/configprops'; + expect(req.request.url).toEqual(resourceUrl); + }); + + it('should get the config', () => { + const angularConfig = { + contexts: { + angular: { + beans: ['test2'] + } + } + }; + service.get().subscribe(received => { + expect(received.body[0]).toEqual(angularConfig); + }); + + const req = httpMock.expectOne({ method: 'GET' }); + req.flush(angularConfig); + }); + + it('should get the env', () => { + const propertySources = new HttpResponse({ + body: [{ name: 'test1', properties: 'test1' }, { name: 'test2', properties: 'test2' }] + }); + service.get().subscribe(received => { + expect(received.body[0]).toEqual(propertySources); + }); + + const req = httpMock.expectOne({ method: 'GET' }); + req.flush(propertySources); + }); + }); + }); +}); diff --git a/jhipster/jhipster-uaa/gateway/src/test/javascript/spec/app/admin/health/health.component.spec.ts b/jhipster/jhipster-uaa/gateway/src/test/javascript/spec/app/admin/health/health.component.spec.ts new file mode 100644 index 0000000000..1ffe425fd5 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/test/javascript/spec/app/admin/health/health.component.spec.ts @@ -0,0 +1,323 @@ +import { ComponentFixture, TestBed, async } from '@angular/core/testing'; +import { HttpResponse, HttpErrorResponse } from '@angular/common/http'; +import { of, throwError } from 'rxjs'; + +import { GatewayTestModule } from '../../../test.module'; +import { JhiHealthCheckComponent } from 'app/admin/health/health.component'; +import { JhiHealthService } from 'app/admin/health/health.service'; + +describe('Component Tests', () => { + describe('JhiHealthCheckComponent', () => { + let comp: JhiHealthCheckComponent; + let fixture: ComponentFixture; + let service: JhiHealthService; + + beforeEach( + async(() => { + TestBed.configureTestingModule({ + imports: [GatewayTestModule], + declarations: [JhiHealthCheckComponent] + }) + .overrideTemplate(JhiHealthCheckComponent, '') + .compileComponents(); + }) + ); + + beforeEach(() => { + fixture = TestBed.createComponent(JhiHealthCheckComponent); + comp = fixture.componentInstance; + service = fixture.debugElement.injector.get(JhiHealthService); + }); + + describe('baseName and subSystemName', () => { + it('should return the basename when it has no sub system', () => { + expect(comp.baseName('base')).toBe('base'); + }); + + it('should return the basename when it has sub systems', () => { + expect(comp.baseName('base.subsystem.system')).toBe('base'); + }); + + it('should return the sub system name', () => { + expect(comp.subSystemName('subsystem')).toBe(''); + }); + + it('should return the subsystem when it has multiple keys', () => { + expect(comp.subSystemName('subsystem.subsystem.system')).toBe(' - subsystem.system'); + }); + }); + + describe('transformHealthData', () => { + it('should flatten empty health data', () => { + const data = {}; + const expected = []; + expect(service.transformHealthData(data)).toEqual(expected); + }); + + it('should flatten health data with no subsystems', () => { + const data = { + details: { + status: 'UP', + db: { + status: 'UP', + database: 'H2', + hello: '1' + }, + mail: { + status: 'UP', + error: 'mail.a.b.c' + } + } + }; + const expected = [ + { + name: 'db', + status: 'UP', + details: { + database: 'H2', + hello: '1' + } + }, + { + name: 'mail', + error: 'mail.a.b.c', + status: 'UP' + } + ]; + expect(service.transformHealthData(data)).toEqual(expected); + }); + + it('should flatten health data with subsystems at level 1, main system has no additional information', () => { + const data = { + details: { + status: 'UP', + db: { + status: 'UP', + database: 'H2', + hello: '1' + }, + mail: { + status: 'UP', + error: 'mail.a.b.c' + }, + system: { + status: 'DOWN', + subsystem1: { + status: 'UP', + property1: 'system.subsystem1.property1' + }, + subsystem2: { + status: 'DOWN', + error: 'system.subsystem1.error', + property2: 'system.subsystem2.property2' + } + } + } + }; + const expected = [ + { + name: 'db', + status: 'UP', + details: { + database: 'H2', + hello: '1' + } + }, + { + name: 'mail', + error: 'mail.a.b.c', + status: 'UP' + }, + { + name: 'system.subsystem1', + status: 'UP', + details: { + property1: 'system.subsystem1.property1' + } + }, + { + name: 'system.subsystem2', + error: 'system.subsystem1.error', + status: 'DOWN', + details: { + property2: 'system.subsystem2.property2' + } + } + ]; + expect(service.transformHealthData(data)).toEqual(expected); + }); + + it('should flatten health data with subsystems at level 1, main system has additional information', () => { + const data = { + details: { + status: 'UP', + db: { + status: 'UP', + database: 'H2', + hello: '1' + }, + mail: { + status: 'UP', + error: 'mail.a.b.c' + }, + system: { + status: 'DOWN', + property1: 'system.property1', + subsystem1: { + status: 'UP', + property1: 'system.subsystem1.property1' + }, + subsystem2: { + status: 'DOWN', + error: 'system.subsystem1.error', + property2: 'system.subsystem2.property2' + } + } + } + }; + const expected = [ + { + name: 'db', + status: 'UP', + details: { + database: 'H2', + hello: '1' + } + }, + { + name: 'mail', + error: 'mail.a.b.c', + status: 'UP' + }, + { + name: 'system', + status: 'DOWN', + details: { + property1: 'system.property1' + } + }, + { + name: 'system.subsystem1', + status: 'UP', + details: { + property1: 'system.subsystem1.property1' + } + }, + { + name: 'system.subsystem2', + error: 'system.subsystem1.error', + status: 'DOWN', + details: { + property2: 'system.subsystem2.property2' + } + } + ]; + expect(service.transformHealthData(data)).toEqual(expected); + }); + + it('should flatten health data with subsystems at level 1, main system has additional error', () => { + const data = { + details: { + status: 'UP', + db: { + status: 'UP', + database: 'H2', + hello: '1' + }, + mail: { + status: 'UP', + error: 'mail.a.b.c' + }, + system: { + status: 'DOWN', + error: 'show me', + subsystem1: { + status: 'UP', + property1: 'system.subsystem1.property1' + }, + subsystem2: { + status: 'DOWN', + error: 'system.subsystem1.error', + property2: 'system.subsystem2.property2' + } + } + } + }; + const expected = [ + { + name: 'db', + status: 'UP', + details: { + database: 'H2', + hello: '1' + } + }, + { + name: 'mail', + error: 'mail.a.b.c', + status: 'UP' + }, + { + name: 'system', + error: 'show me', + status: 'DOWN' + }, + { + name: 'system.subsystem1', + status: 'UP', + details: { + property1: 'system.subsystem1.property1' + } + }, + { + name: 'system.subsystem2', + error: 'system.subsystem1.error', + status: 'DOWN', + details: { + property2: 'system.subsystem2.property2' + } + } + ]; + expect(service.transformHealthData(data)).toEqual(expected); + }); + }); + + describe('getBadgeClass', () => { + it('should get badge class', () => { + const upBadgeClass = comp.getBadgeClass('UP'); + const downBadgeClass = comp.getBadgeClass('DOWN'); + expect(upBadgeClass).toEqual('badge-success'); + expect(downBadgeClass).toEqual('badge-danger'); + }); + }); + + describe('refresh', () => { + it('should call refresh on init', () => { + // GIVEN + spyOn(service, 'checkHealth').and.returnValue(of(new HttpResponse())); + spyOn(service, 'transformHealthData').and.returnValue(of({ data: 'test' })); + + // WHEN + comp.ngOnInit(); + + // THEN + expect(service.checkHealth).toHaveBeenCalled(); + expect(service.transformHealthData).toHaveBeenCalled(); + expect(comp.healthData.value).toEqual({ data: 'test' }); + }); + it('should handle a 503 on refreshing health data', () => { + // GIVEN + spyOn(service, 'checkHealth').and.returnValue(throwError(new HttpErrorResponse({ status: 503, error: 'Mail down' }))); + spyOn(service, 'transformHealthData').and.returnValue(of({ health: 'down' })); + + // WHEN + comp.refresh(); + + // THEN + expect(service.checkHealth).toHaveBeenCalled(); + expect(service.transformHealthData).toHaveBeenCalled(); + expect(comp.healthData.value).toEqual({ health: 'down' }); + }); + }); + }); +}); diff --git a/jhipster/jhipster-uaa/gateway/src/test/javascript/spec/app/admin/logs/logs.component.spec.ts b/jhipster/jhipster-uaa/gateway/src/test/javascript/spec/app/admin/logs/logs.component.spec.ts new file mode 100644 index 0000000000..77587271c9 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/test/javascript/spec/app/admin/logs/logs.component.spec.ts @@ -0,0 +1,79 @@ +import { ComponentFixture, TestBed, async } from '@angular/core/testing'; +import { of } from 'rxjs'; +import { HttpHeaders, HttpResponse } from '@angular/common/http'; + +import { GatewayTestModule } from '../../../test.module'; +import { LogsComponent } from 'app/admin/logs/logs.component'; +import { LogsService } from 'app/admin/logs/logs.service'; +import { ITEMS_PER_PAGE } from 'app/shared'; +import { Log } from 'app/admin'; + +describe('Component Tests', () => { + describe('LogsComponent', () => { + let comp: LogsComponent; + let fixture: ComponentFixture; + let service: LogsService; + + beforeEach( + async(() => { + TestBed.configureTestingModule({ + imports: [GatewayTestModule], + declarations: [LogsComponent], + providers: [LogsService] + }) + .overrideTemplate(LogsComponent, '') + .compileComponents(); + }) + ); + + beforeEach(() => { + fixture = TestBed.createComponent(LogsComponent); + comp = fixture.componentInstance; + service = fixture.debugElement.injector.get(LogsService); + }); + + describe('OnInit', () => { + it('should set all default values correctly', () => { + expect(comp.filter).toBe(''); + expect(comp.orderProp).toBe('name'); + expect(comp.reverse).toBe(false); + }); + it('Should call load all on init', () => { + // GIVEN + const headers = new HttpHeaders().append('link', 'link;link'); + const log = new Log('main', 'WARN'); + spyOn(service, 'findAll').and.returnValue( + of( + new HttpResponse({ + body: [log], + headers + }) + ) + ); + + // WHEN + comp.ngOnInit(); + + // THEN + expect(service.findAll).toHaveBeenCalled(); + expect(comp.loggers[0]).toEqual(jasmine.objectContaining(log)); + }); + }); + describe('change log level', () => { + it('should change log level correctly', () => { + // GIVEN + const log = new Log('main', 'ERROR'); + spyOn(service, 'changeLevel').and.returnValue(of(new HttpResponse())); + spyOn(service, 'findAll').and.returnValue(of(new HttpResponse({ body: [log] }))); + + // WHEN + comp.changeLevel('main', 'ERROR'); + + // THEN + expect(service.changeLevel).toHaveBeenCalled(); + expect(service.findAll).toHaveBeenCalled(); + expect(comp.loggers[0]).toEqual(jasmine.objectContaining(log)); + }); + }); + }); +}); diff --git a/jhipster/jhipster-uaa/gateway/src/test/javascript/spec/app/admin/logs/logs.service.spec.ts b/jhipster/jhipster-uaa/gateway/src/test/javascript/spec/app/admin/logs/logs.service.spec.ts new file mode 100644 index 0000000000..c34833922e --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/test/javascript/spec/app/admin/logs/logs.service.spec.ts @@ -0,0 +1,58 @@ +import { TestBed } from '@angular/core/testing'; + +import { LogsService } from 'app/admin/logs/logs.service'; +import { Log } from 'app/admin/logs/log.model'; +import { SERVER_API_URL } from 'app/app.constants'; +import { HttpClientTestingModule, HttpTestingController } from '@angular/common/http/testing'; + +describe('Service Tests', () => { + describe('Logs Service', () => { + let service: LogsService; + let httpMock; + + beforeEach(() => { + TestBed.configureTestingModule({ + imports: [HttpClientTestingModule] + }); + + service = TestBed.get(LogsService); + httpMock = TestBed.get(HttpTestingController); + }); + + afterEach(() => { + httpMock.verify(); + }); + + describe('Service methods', () => { + it('should call correct URL', () => { + service.findAll().subscribe(() => {}); + + const req = httpMock.expectOne({ method: 'GET' }); + const resourceUrl = SERVER_API_URL + 'management/logs'; + expect(req.request.url).toEqual(resourceUrl); + }); + + it('should return Logs', () => { + const log = new Log('main', 'ERROR'); + + service.findAll().subscribe(received => { + expect(received.body[0]).toEqual(log); + }); + + const req = httpMock.expectOne({ method: 'GET' }); + req.flush([log]); + }); + + it('should change log level', () => { + const log = new Log('main', 'ERROR'); + + service.changeLevel(log).subscribe(received => { + expect(received.body[0]).toEqual(log); + }); + + const req = httpMock.expectOne({ method: 'PUT' }); + req.flush([log]); + }); + }); + }); +}); diff --git a/jhipster/jhipster-uaa/gateway/src/test/javascript/spec/app/admin/metrics/metrics-modal.component.spec.ts b/jhipster/jhipster-uaa/gateway/src/test/javascript/spec/app/admin/metrics/metrics-modal.component.spec.ts new file mode 100644 index 0000000000..917d3e4f74 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/test/javascript/spec/app/admin/metrics/metrics-modal.component.spec.ts @@ -0,0 +1,90 @@ +import { ComponentFixture, TestBed, async } from '@angular/core/testing'; +import { HttpResponse, HttpErrorResponse } from '@angular/common/http'; +import { of, throwError } from 'rxjs'; + +import { GatewayTestModule } from '../../../test.module'; +import { JhiMetricsMonitoringModalComponent } from 'app/admin/metrics/metrics-modal.component'; +import { JhiMetricsService } from 'app/admin/metrics/metrics.service'; + +describe('Component Tests', () => { + describe('JhiMetricsMonitoringModalComponent', () => { + let comp: JhiMetricsMonitoringModalComponent; + let fixture: ComponentFixture; + let service: JhiMetricsService; + + beforeEach( + async(() => { + TestBed.configureTestingModule({ + imports: [GatewayTestModule], + declarations: [JhiMetricsMonitoringModalComponent] + }) + .overrideTemplate(JhiMetricsMonitoringModalComponent, '') + .compileComponents(); + }) + ); + + beforeEach(() => { + fixture = TestBed.createComponent(JhiMetricsMonitoringModalComponent); + comp = fixture.componentInstance; + service = fixture.debugElement.injector.get(JhiMetricsService); + }); + + describe('ngOnInit', () => { + it('should count the numbers of each thread type', () => { + comp.threadDump = [ + { name: 'test1', threadState: 'RUNNABLE' }, + { name: 'test2', threadState: 'WAITING' }, + { name: 'test3', threadState: 'TIMED_WAITING' }, + { name: 'test4', threadState: 'BLOCKED' }, + { name: 'test5', threadState: 'BLOCKED' }, + { name: 'test5', threadState: 'NONE' } + ]; + fixture.detectChanges(); + + expect(comp.threadDumpRunnable).toBe(1); + expect(comp.threadDumpWaiting).toBe(1); + expect(comp.threadDumpTimedWaiting).toBe(1); + expect(comp.threadDumpBlocked).toBe(2); + expect(comp.threadDumpAll).toBe(5); + }); + + it('should return badge-info for WAITING', () => { + expect(comp.getBadgeClass('WAITING')).toBe('badge-info'); + }); + + it('should return badge-warning for TIMED_WAITING', () => { + expect(comp.getBadgeClass('TIMED_WAITING')).toBe('badge-warning'); + }); + + it('should return badge-danger for BLOCKED', () => { + expect(comp.getBadgeClass('BLOCKED')).toBe('badge-danger'); + }); + + it('should return undefined for anything else', () => { + expect(comp.getBadgeClass('')).toBe(undefined); + }); + }); + + describe('getBadgeClass', () => { + it('should return badge-success for RUNNABLE', () => { + expect(comp.getBadgeClass('RUNNABLE')).toBe('badge-success'); + }); + + it('should return badge-info for WAITING', () => { + expect(comp.getBadgeClass('WAITING')).toBe('badge-info'); + }); + + it('should return badge-warning for TIMED_WAITING', () => { + expect(comp.getBadgeClass('TIMED_WAITING')).toBe('badge-warning'); + }); + + it('should return badge-danger for BLOCKED', () => { + expect(comp.getBadgeClass('BLOCKED')).toBe('badge-danger'); + }); + + it('should return undefined for anything else', () => { + expect(comp.getBadgeClass('')).toBe(undefined); + }); + }); + }); +}); diff --git a/jhipster/jhipster-uaa/gateway/src/test/javascript/spec/app/admin/metrics/metrics.component.spec.ts b/jhipster/jhipster-uaa/gateway/src/test/javascript/spec/app/admin/metrics/metrics.component.spec.ts new file mode 100644 index 0000000000..6acc877aa3 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/test/javascript/spec/app/admin/metrics/metrics.component.spec.ts @@ -0,0 +1,66 @@ +import { ComponentFixture, TestBed, async } from '@angular/core/testing'; +import { HttpResponse, HttpErrorResponse } from '@angular/common/http'; +import { of, throwError } from 'rxjs'; + +import { GatewayTestModule } from '../../../test.module'; +import { JhiMetricsMonitoringComponent } from 'app/admin/metrics/metrics.component'; +import { JhiMetricsService } from 'app/admin/metrics/metrics.service'; + +describe('Component Tests', () => { + describe('JhiMetricsMonitoringComponent', () => { + let comp: JhiMetricsMonitoringComponent; + let fixture: ComponentFixture; + let service: JhiMetricsService; + + beforeEach( + async(() => { + TestBed.configureTestingModule({ + imports: [GatewayTestModule], + declarations: [JhiMetricsMonitoringComponent] + }) + .overrideTemplate(JhiMetricsMonitoringComponent, '') + .compileComponents(); + }) + ); + + beforeEach(() => { + fixture = TestBed.createComponent(JhiMetricsMonitoringComponent); + comp = fixture.componentInstance; + service = fixture.debugElement.injector.get(JhiMetricsService); + }); + + describe('refresh', () => { + it('should call refresh on init', () => { + // GIVEN + const response = { + timers: { + service: 'test', + unrelatedKey: 'test' + }, + gauges: { + 'jcache.statistics': { + value: 2 + }, + unrelatedKey: 'test' + } + }; + spyOn(service, 'getMetrics').and.returnValue(of(response)); + + // WHEN + comp.ngOnInit(); + + // THEN + expect(service.getMetrics).toHaveBeenCalled(); + expect(comp.servicesStats).toEqual({ service: 'test' }); + expect(comp.cachesStats).toEqual({ jcache: { name: 17, value: 2 } }); + }); + }); + + describe('isNan', () => { + it('should return if a variable is NaN', () => { + expect(comp.filterNaN(1)).toBe(1); + expect(comp.filterNaN('test')).toBe(0); + }); + }); + }); +}); diff --git a/jhipster/jhipster-uaa/gateway/src/test/javascript/spec/app/admin/metrics/metrics.service.spec.ts b/jhipster/jhipster-uaa/gateway/src/test/javascript/spec/app/admin/metrics/metrics.service.spec.ts new file mode 100644 index 0000000000..62fab44ba8 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/test/javascript/spec/app/admin/metrics/metrics.service.spec.ts @@ -0,0 +1,57 @@ +import { TestBed } from '@angular/core/testing'; + +import { JhiMetricsService } from 'app/admin/metrics/metrics.service'; +import { SERVER_API_URL } from 'app/app.constants'; +import { HttpClientTestingModule, HttpTestingController } from '@angular/common/http/testing'; + +describe('Service Tests', () => { + describe('Logs Service', () => { + let service: JhiMetricsService; + let httpMock; + + beforeEach(() => { + TestBed.configureTestingModule({ + imports: [HttpClientTestingModule] + }); + + service = TestBed.get(JhiMetricsService); + httpMock = TestBed.get(HttpTestingController); + }); + + afterEach(() => { + httpMock.verify(); + }); + + describe('Service methods', () => { + it('should call correct URL', () => { + service.getMetrics().subscribe(() => {}); + + const req = httpMock.expectOne({ method: 'GET' }); + const resourceUrl = SERVER_API_URL + 'management/metrics'; + expect(req.request.url).toEqual(resourceUrl); + }); + + it('should return Metrics', () => { + const metrics = []; + + service.getMetrics().subscribe(received => { + expect(received.body[0]).toEqual(metrics); + }); + + const req = httpMock.expectOne({ method: 'GET' }); + req.flush([metrics]); + }); + + it('should return Thread Dump', () => { + const dump = [{ name: 'test1', threadState: 'RUNNABLE' }]; + + service.threadDump().subscribe(received => { + expect(received.body[0]).toEqual(dump); + }); + + const req = httpMock.expectOne({ method: 'GET' }); + req.flush([dump]); + }); + }); + }); +}); diff --git a/jhipster/jhipster-uaa/gateway/src/test/javascript/spec/app/admin/user-management/user-management-delete-dialog.component.spec.ts b/jhipster/jhipster-uaa/gateway/src/test/javascript/spec/app/admin/user-management/user-management-delete-dialog.component.spec.ts new file mode 100644 index 0000000000..72406e4a93 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/test/javascript/spec/app/admin/user-management/user-management-delete-dialog.component.spec.ts @@ -0,0 +1,59 @@ +import { ComponentFixture, TestBed, async, inject, fakeAsync, tick } from '@angular/core/testing'; +import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap'; +import { Observable, of } from 'rxjs'; +import { JhiEventManager } from 'ng-jhipster'; + +import { GatewayTestModule } from '../../../test.module'; +import { UserMgmtDeleteDialogComponent } from 'app/admin/user-management/user-management-delete-dialog.component'; +import { UserService } from 'app/core'; + +describe('Component Tests', () => { + describe('User Management Delete Component', () => { + let comp: UserMgmtDeleteDialogComponent; + let fixture: ComponentFixture; + let service: UserService; + let mockEventManager: any; + let mockActiveModal: any; + + beforeEach( + async(() => { + TestBed.configureTestingModule({ + imports: [GatewayTestModule], + declarations: [UserMgmtDeleteDialogComponent] + }) + .overrideTemplate(UserMgmtDeleteDialogComponent, '') + .compileComponents(); + }) + ); + + beforeEach(() => { + fixture = TestBed.createComponent(UserMgmtDeleteDialogComponent); + comp = fixture.componentInstance; + service = fixture.debugElement.injector.get(UserService); + mockEventManager = fixture.debugElement.injector.get(JhiEventManager); + mockActiveModal = fixture.debugElement.injector.get(NgbActiveModal); + }); + + describe('confirmDelete', () => { + it( + 'Should call delete service on confirmDelete', + inject( + [], + fakeAsync(() => { + // GIVEN + spyOn(service, 'delete').and.returnValue(of({})); + + // WHEN + comp.confirmDelete('user'); + tick(); + + // THEN + expect(service.delete).toHaveBeenCalledWith('user'); + expect(mockActiveModal.dismissSpy).toHaveBeenCalled(); + expect(mockEventManager.broadcastSpy).toHaveBeenCalled(); + }) + ) + ); + }); + }); +}); diff --git a/jhipster/jhipster-uaa/gateway/src/test/javascript/spec/app/admin/user-management/user-management-detail.component.spec.ts b/jhipster/jhipster-uaa/gateway/src/test/javascript/spec/app/admin/user-management/user-management-detail.component.spec.ts new file mode 100644 index 0000000000..c535523fe3 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/test/javascript/spec/app/admin/user-management/user-management-detail.component.spec.ts @@ -0,0 +1,67 @@ +import { ComponentFixture, TestBed, async } from '@angular/core/testing'; +import { ActivatedRoute } from '@angular/router'; +import { of } from 'rxjs'; + +import { GatewayTestModule } from '../../../test.module'; +import { UserMgmtDetailComponent } from 'app/admin/user-management/user-management-detail.component'; +import { User } from 'app/core'; + +describe('Component Tests', () => { + describe('User Management Detail Component', () => { + let comp: UserMgmtDetailComponent; + let fixture: ComponentFixture; + const route = ({ + data: of({ user: new User(1, 'user', 'first', 'last', 'first@last.com', true, 'en', ['ROLE_USER'], 'admin', null, null, null) }) + } as any) as ActivatedRoute; + + beforeEach( + async(() => { + TestBed.configureTestingModule({ + imports: [GatewayTestModule], + declarations: [UserMgmtDetailComponent], + providers: [ + { + provide: ActivatedRoute, + useValue: route + } + ] + }) + .overrideTemplate(UserMgmtDetailComponent, '') + .compileComponents(); + }) + ); + + beforeEach(() => { + fixture = TestBed.createComponent(UserMgmtDetailComponent); + comp = fixture.componentInstance; + }); + + describe('OnInit', () => { + it('Should call load all on init', () => { + // GIVEN + + // WHEN + comp.ngOnInit(); + + // THEN + expect(comp.user).toEqual( + jasmine.objectContaining({ + id: 1, + login: 'user', + firstName: 'first', + lastName: 'last', + email: 'first@last.com', + activated: true, + langKey: 'en', + authorities: ['ROLE_USER'], + createdBy: 'admin', + createdDate: null, + lastModifiedBy: null, + lastModifiedDate: null, + password: null + }) + ); + }); + }); + }); +}); diff --git a/jhipster/jhipster-uaa/gateway/src/test/javascript/spec/app/admin/user-management/user-management-update.component.spec.ts b/jhipster/jhipster-uaa/gateway/src/test/javascript/spec/app/admin/user-management/user-management-update.component.spec.ts new file mode 100644 index 0000000000..80c40f7b29 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/test/javascript/spec/app/admin/user-management/user-management-update.component.spec.ts @@ -0,0 +1,113 @@ +import { ComponentFixture, TestBed, async, inject, fakeAsync, tick } from '@angular/core/testing'; +import { HttpResponse } from '@angular/common/http'; +import { ActivatedRoute } from '@angular/router'; +import { Observable, of } from 'rxjs'; + +import { GatewayTestModule } from '../../../test.module'; +import { UserMgmtUpdateComponent } from 'app/admin/user-management/user-management-update.component'; +import { UserService, User, JhiLanguageHelper } from 'app/core'; + +describe('Component Tests', () => { + describe('User Management Update Component', () => { + let comp: UserMgmtUpdateComponent; + let fixture: ComponentFixture; + let service: UserService; + let mockLanguageHelper: any; + const route = ({ + data: of({ user: new User(1, 'user', 'first', 'last', 'first@last.com', true, 'en', ['ROLE_USER'], 'admin', null, null, null) }) + } as any) as ActivatedRoute; + + beforeEach( + async(() => { + TestBed.configureTestingModule({ + imports: [GatewayTestModule], + declarations: [UserMgmtUpdateComponent], + providers: [ + { + provide: ActivatedRoute, + useValue: route + } + ] + }) + .overrideTemplate(UserMgmtUpdateComponent, '') + .compileComponents(); + }) + ); + + beforeEach(() => { + fixture = TestBed.createComponent(UserMgmtUpdateComponent); + comp = fixture.componentInstance; + service = fixture.debugElement.injector.get(UserService); + mockLanguageHelper = fixture.debugElement.injector.get(JhiLanguageHelper); + }); + + describe('OnInit', () => { + it( + 'Should load authorities and language on init', + inject( + [], + fakeAsync(() => { + // GIVEN + spyOn(service, 'authorities').and.returnValue(of(['USER'])); + + // WHEN + comp.ngOnInit(); + + // THEN + expect(service.authorities).toHaveBeenCalled(); + expect(comp.authorities).toEqual(['USER']); + expect(mockLanguageHelper.getAllSpy).toHaveBeenCalled(); + }) + ) + ); + }); + + describe('save', () => { + it( + 'Should call update service on save for existing user', + inject( + [], + fakeAsync(() => { + // GIVEN + const entity = new User(123); + spyOn(service, 'update').and.returnValue( + of( + new HttpResponse({ + body: entity + }) + ) + ); + comp.user = entity; + // WHEN + comp.save(); + tick(); // simulate async + + // THEN + expect(service.update).toHaveBeenCalledWith(entity); + expect(comp.isSaving).toEqual(false); + }) + ) + ); + + it( + 'Should call create service on save for new user', + inject( + [], + fakeAsync(() => { + // GIVEN + const entity = new User(); + spyOn(service, 'create').and.returnValue(of(new HttpResponse({ body: entity }))); + comp.user = entity; + // WHEN + comp.save(); + tick(); // simulate async + + // THEN + expect(service.create).toHaveBeenCalledWith(entity); + expect(comp.isSaving).toEqual(false); + }) + ) + ); + }); + }); +}); diff --git a/jhipster/jhipster-uaa/gateway/src/test/javascript/spec/app/admin/user-management/user-management.component.spec.ts b/jhipster/jhipster-uaa/gateway/src/test/javascript/spec/app/admin/user-management/user-management.component.spec.ts new file mode 100644 index 0000000000..1088b6102f --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/test/javascript/spec/app/admin/user-management/user-management.component.spec.ts @@ -0,0 +1,93 @@ +import { ComponentFixture, TestBed, async, inject, fakeAsync, tick } from '@angular/core/testing'; +import { Observable, of } from 'rxjs'; +import { HttpHeaders, HttpResponse } from '@angular/common/http'; + +import { GatewayTestModule } from '../../../test.module'; +import { UserMgmtComponent } from 'app/admin/user-management/user-management.component'; +import { UserService, User } from 'app/core'; + +describe('Component Tests', () => { + describe('User Management Component', () => { + let comp: UserMgmtComponent; + let fixture: ComponentFixture; + let service: UserService; + + beforeEach( + async(() => { + TestBed.configureTestingModule({ + imports: [GatewayTestModule], + declarations: [UserMgmtComponent] + }) + .overrideTemplate(UserMgmtComponent, '') + .compileComponents(); + }) + ); + + beforeEach(() => { + fixture = TestBed.createComponent(UserMgmtComponent); + comp = fixture.componentInstance; + service = fixture.debugElement.injector.get(UserService); + }); + + describe('OnInit', () => { + it( + 'Should call load all on init', + inject( + [], + fakeAsync(() => { + // GIVEN + const headers = new HttpHeaders().append('link', 'link;link'); + spyOn(service, 'query').and.returnValue( + of( + new HttpResponse({ + body: [new User(123)], + headers + }) + ) + ); + + // WHEN + comp.ngOnInit(); + tick(); // simulate async + + // THEN + expect(service.query).toHaveBeenCalled(); + expect(comp.users[0]).toEqual(jasmine.objectContaining({ id: 123 })); + }) + ) + ); + }); + + describe('setActive', () => { + it( + 'Should update user and call load all', + inject( + [], + fakeAsync(() => { + // GIVEN + const headers = new HttpHeaders().append('link', 'link;link'); + const user = new User(123); + spyOn(service, 'query').and.returnValue( + of( + new HttpResponse({ + body: [user], + headers + }) + ) + ); + spyOn(service, 'update').and.returnValue(of(new HttpResponse({ status: 200 }))); + + // WHEN + comp.setActive(user, true); + tick(); // simulate async + + // THEN + expect(service.update).toHaveBeenCalledWith(user); + expect(service.query).toHaveBeenCalled(); + expect(comp.users[0]).toEqual(jasmine.objectContaining({ id: 123 })); + }) + ) + ); + }); + }); +}); diff --git a/jhipster/jhipster-uaa/gateway/src/test/javascript/spec/app/core/user/user.service.spec.ts b/jhipster/jhipster-uaa/gateway/src/test/javascript/spec/app/core/user/user.service.spec.ts new file mode 100644 index 0000000000..eeb97266d4 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/test/javascript/spec/app/core/user/user.service.spec.ts @@ -0,0 +1,66 @@ +import { TestBed } from '@angular/core/testing'; +import { JhiDateUtils } from 'ng-jhipster'; + +import { UserService, User } from 'app/core'; +import { SERVER_API_URL } from 'app/app.constants'; +import { HttpClientTestingModule, HttpTestingController } from '@angular/common/http/testing'; + +describe('Service Tests', () => { + describe('User Service', () => { + let service: UserService; + let httpMock; + + beforeEach(() => { + TestBed.configureTestingModule({ + imports: [HttpClientTestingModule], + providers: [JhiDateUtils] + }); + + service = TestBed.get(UserService); + httpMock = TestBed.get(HttpTestingController); + }); + + afterEach(() => { + httpMock.verify(); + }); + + describe('Service methods', () => { + it('should call correct URL', () => { + service.find('user').subscribe(() => {}); + + const req = httpMock.expectOne({ method: 'GET' }); + const resourceUrl = SERVER_API_URL + 'uaa/api/users'; + expect(req.request.url).toEqual(`${resourceUrl}/user`); + }); + it('should return User', () => { + service.find('user').subscribe(received => { + expect(received.body.login).toEqual('user'); + }); + + const req = httpMock.expectOne({ method: 'GET' }); + req.flush(new User(1, 'user')); + }); + + it('should return Authorities', () => { + service.authorities().subscribe(_authorities => { + expect(_authorities).toEqual(['ROLE_USER', 'ROLE_ADMIN']); + }); + const req = httpMock.expectOne({ method: 'GET' }); + + req.flush(['ROLE_USER', 'ROLE_ADMIN']); + }); + + it('should propagate not found response', () => { + service.find('user').subscribe(null, (_error: any) => { + expect(_error.status).toEqual(404); + }); + + const req = httpMock.expectOne({ method: 'GET' }); + req.flush('Invalid request parameters', { + status: 404, + statusText: 'Bad Request' + }); + }); + }); + }); +}); diff --git a/jhipster/jhipster-uaa/gateway/src/test/javascript/spec/app/entities/quotes/quote/quote-delete-dialog.component.spec.ts b/jhipster/jhipster-uaa/gateway/src/test/javascript/spec/app/entities/quotes/quote/quote-delete-dialog.component.spec.ts new file mode 100644 index 0000000000..3413992166 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/test/javascript/spec/app/entities/quotes/quote/quote-delete-dialog.component.spec.ts @@ -0,0 +1,55 @@ +/* tslint:disable max-line-length */ +import { ComponentFixture, TestBed, inject, fakeAsync, tick } from '@angular/core/testing'; +import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap'; +import { Observable, of } from 'rxjs'; +import { JhiEventManager } from 'ng-jhipster'; + +import { GatewayTestModule } from '../../../../test.module'; +import { QuoteDeleteDialogComponent } from 'app/entities/quotes/quote/quote-delete-dialog.component'; +import { QuoteService } from 'app/entities/quotes/quote/quote.service'; + +describe('Component Tests', () => { + describe('Quote Management Delete Component', () => { + let comp: QuoteDeleteDialogComponent; + let fixture: ComponentFixture; + let service: QuoteService; + let mockEventManager: any; + let mockActiveModal: any; + + beforeEach(() => { + TestBed.configureTestingModule({ + imports: [GatewayTestModule], + declarations: [QuoteDeleteDialogComponent] + }) + .overrideTemplate(QuoteDeleteDialogComponent, '') + .compileComponents(); + fixture = TestBed.createComponent(QuoteDeleteDialogComponent); + comp = fixture.componentInstance; + service = fixture.debugElement.injector.get(QuoteService); + mockEventManager = fixture.debugElement.injector.get(JhiEventManager); + mockActiveModal = fixture.debugElement.injector.get(NgbActiveModal); + }); + + describe('confirmDelete', () => { + it( + 'Should call delete service on confirmDelete', + inject( + [], + fakeAsync(() => { + // GIVEN + spyOn(service, 'delete').and.returnValue(of({})); + + // WHEN + comp.confirmDelete(123); + tick(); + + // THEN + expect(service.delete).toHaveBeenCalledWith(123); + expect(mockActiveModal.dismissSpy).toHaveBeenCalled(); + expect(mockEventManager.broadcastSpy).toHaveBeenCalled(); + }) + ) + ); + }); + }); +}); diff --git a/jhipster/jhipster-uaa/gateway/src/test/javascript/spec/app/entities/quotes/quote/quote-detail.component.spec.ts b/jhipster/jhipster-uaa/gateway/src/test/javascript/spec/app/entities/quotes/quote/quote-detail.component.spec.ts new file mode 100644 index 0000000000..446e7bde8e --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/test/javascript/spec/app/entities/quotes/quote/quote-detail.component.spec.ts @@ -0,0 +1,40 @@ +/* tslint:disable max-line-length */ +import { ComponentFixture, TestBed } from '@angular/core/testing'; +import { ActivatedRoute } from '@angular/router'; +import { of } from 'rxjs'; + +import { GatewayTestModule } from '../../../../test.module'; +import { QuoteDetailComponent } from 'app/entities/quotes/quote/quote-detail.component'; +import { Quote } from 'app/shared/model/quotes/quote.model'; + +describe('Component Tests', () => { + describe('Quote Management Detail Component', () => { + let comp: QuoteDetailComponent; + let fixture: ComponentFixture; + const route = ({ data: of({ quote: new Quote(123) }) } as any) as ActivatedRoute; + + beforeEach(() => { + TestBed.configureTestingModule({ + imports: [GatewayTestModule], + declarations: [QuoteDetailComponent], + providers: [{ provide: ActivatedRoute, useValue: route }] + }) + .overrideTemplate(QuoteDetailComponent, '') + .compileComponents(); + fixture = TestBed.createComponent(QuoteDetailComponent); + comp = fixture.componentInstance; + }); + + describe('OnInit', () => { + it('Should call load all on init', () => { + // GIVEN + + // WHEN + comp.ngOnInit(); + + // THEN + expect(comp.quote).toEqual(jasmine.objectContaining({ id: 123 })); + }); + }); + }); +}); diff --git a/jhipster/jhipster-uaa/gateway/src/test/javascript/spec/app/entities/quotes/quote/quote-update.component.spec.ts b/jhipster/jhipster-uaa/gateway/src/test/javascript/spec/app/entities/quotes/quote/quote-update.component.spec.ts new file mode 100644 index 0000000000..063d905ef6 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/test/javascript/spec/app/entities/quotes/quote/quote-update.component.spec.ts @@ -0,0 +1,66 @@ +/* tslint:disable max-line-length */ +import { ComponentFixture, TestBed, fakeAsync, tick } from '@angular/core/testing'; +import { HttpResponse } from '@angular/common/http'; +import { Observable, of } from 'rxjs'; + +import { GatewayTestModule } from '../../../../test.module'; +import { QuoteUpdateComponent } from 'app/entities/quotes/quote/quote-update.component'; +import { QuoteService } from 'app/entities/quotes/quote/quote.service'; +import { Quote } from 'app/shared/model/quotes/quote.model'; + +describe('Component Tests', () => { + describe('Quote Management Update Component', () => { + let comp: QuoteUpdateComponent; + let fixture: ComponentFixture; + let service: QuoteService; + + beforeEach(() => { + TestBed.configureTestingModule({ + imports: [GatewayTestModule], + declarations: [QuoteUpdateComponent] + }) + .overrideTemplate(QuoteUpdateComponent, '') + .compileComponents(); + + fixture = TestBed.createComponent(QuoteUpdateComponent); + comp = fixture.componentInstance; + service = fixture.debugElement.injector.get(QuoteService); + }); + + describe('save', () => { + it( + 'Should call update service on save for existing entity', + fakeAsync(() => { + // GIVEN + const entity = new Quote(123); + spyOn(service, 'update').and.returnValue(of(new HttpResponse({ body: entity }))); + comp.quote = entity; + // WHEN + comp.save(); + tick(); // simulate async + + // THEN + expect(service.update).toHaveBeenCalledWith(entity); + expect(comp.isSaving).toEqual(false); + }) + ); + + it( + 'Should call create service on save for new entity', + fakeAsync(() => { + // GIVEN + const entity = new Quote(); + spyOn(service, 'create').and.returnValue(of(new HttpResponse({ body: entity }))); + comp.quote = entity; + // WHEN + comp.save(); + tick(); // simulate async + + // THEN + expect(service.create).toHaveBeenCalledWith(entity); + expect(comp.isSaving).toEqual(false); + }) + ); + }); + }); +}); diff --git a/jhipster/jhipster-uaa/gateway/src/test/javascript/spec/app/entities/quotes/quote/quote.component.spec.ts b/jhipster/jhipster-uaa/gateway/src/test/javascript/spec/app/entities/quotes/quote/quote.component.spec.ts new file mode 100644 index 0000000000..efadc7a22c --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/test/javascript/spec/app/entities/quotes/quote/quote.component.spec.ts @@ -0,0 +1,138 @@ +/* tslint:disable max-line-length */ +import { ComponentFixture, TestBed } from '@angular/core/testing'; +import { Observable, of } from 'rxjs'; +import { HttpHeaders, HttpResponse } from '@angular/common/http'; +import { ActivatedRoute, Data } from '@angular/router'; + +import { GatewayTestModule } from '../../../../test.module'; +import { QuoteComponent } from 'app/entities/quotes/quote/quote.component'; +import { QuoteService } from 'app/entities/quotes/quote/quote.service'; +import { Quote } from 'app/shared/model/quotes/quote.model'; + +describe('Component Tests', () => { + describe('Quote Management Component', () => { + let comp: QuoteComponent; + let fixture: ComponentFixture; + let service: QuoteService; + + beforeEach(() => { + TestBed.configureTestingModule({ + imports: [GatewayTestModule], + declarations: [QuoteComponent], + providers: [ + { + provide: ActivatedRoute, + useValue: { + data: { + subscribe: (fn: (value: Data) => void) => + fn({ + pagingParams: { + predicate: 'id', + reverse: false, + page: 0 + } + }) + } + } + } + ] + }) + .overrideTemplate(QuoteComponent, '') + .compileComponents(); + + fixture = TestBed.createComponent(QuoteComponent); + comp = fixture.componentInstance; + service = fixture.debugElement.injector.get(QuoteService); + }); + + it('Should call load all on init', () => { + // GIVEN + const headers = new HttpHeaders().append('link', 'link;link'); + spyOn(service, 'query').and.returnValue( + of( + new HttpResponse({ + body: [new Quote(123)], + headers + }) + ) + ); + + // WHEN + comp.ngOnInit(); + + // THEN + expect(service.query).toHaveBeenCalled(); + expect(comp.quotes[0]).toEqual(jasmine.objectContaining({ id: 123 })); + }); + + it('should load a page', () => { + // GIVEN + const headers = new HttpHeaders().append('link', 'link;link'); + spyOn(service, 'query').and.returnValue( + of( + new HttpResponse({ + body: [new Quote(123)], + headers + }) + ) + ); + + // WHEN + comp.loadPage(1); + + // THEN + expect(service.query).toHaveBeenCalled(); + expect(comp.quotes[0]).toEqual(jasmine.objectContaining({ id: 123 })); + }); + + it('should not load a page is the page is the same as the previous page', () => { + spyOn(service, 'query').and.callThrough(); + + // WHEN + comp.loadPage(0); + + // THEN + expect(service.query).toHaveBeenCalledTimes(0); + }); + + it('should re-initialize the page', () => { + // GIVEN + const headers = new HttpHeaders().append('link', 'link;link'); + spyOn(service, 'query').and.returnValue( + of( + new HttpResponse({ + body: [new Quote(123)], + headers + }) + ) + ); + + // WHEN + comp.loadPage(1); + comp.clear(); + + // THEN + expect(comp.page).toEqual(0); + expect(service.query).toHaveBeenCalledTimes(2); + expect(comp.quotes[0]).toEqual(jasmine.objectContaining({ id: 123 })); + }); + it('should calculate the sort attribute for an id', () => { + // WHEN + const result = comp.sort(); + + // THEN + expect(result).toEqual(['id,desc']); + }); + + it('should calculate the sort attribute for a non-id attribute', () => { + // GIVEN + comp.predicate = 'name'; + + // WHEN + const result = comp.sort(); + + // THEN + expect(result).toEqual(['name,desc', 'id']); + }); + }); +}); diff --git a/jhipster/jhipster-uaa/gateway/src/test/javascript/spec/app/entities/quotes/quote/quote.service.spec.ts b/jhipster/jhipster-uaa/gateway/src/test/javascript/spec/app/entities/quotes/quote/quote.service.spec.ts new file mode 100644 index 0000000000..5cb5a57b98 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/test/javascript/spec/app/entities/quotes/quote/quote.service.spec.ts @@ -0,0 +1,130 @@ +/* tslint:disable max-line-length */ +import { TestBed, getTestBed } from '@angular/core/testing'; +import { HttpClientTestingModule, HttpTestingController } from '@angular/common/http/testing'; +import { HttpClient, HttpResponse } from '@angular/common/http'; +import { of } from 'rxjs'; +import { take, map } from 'rxjs/operators'; +import * as moment from 'moment'; +import { DATE_TIME_FORMAT } from 'app/shared/constants/input.constants'; +import { QuoteService } from 'app/entities/quotes/quote/quote.service'; +import { IQuote, Quote } from 'app/shared/model/quotes/quote.model'; + +describe('Service Tests', () => { + describe('Quote Service', () => { + let injector: TestBed; + let service: QuoteService; + let httpMock: HttpTestingController; + let elemDefault: IQuote; + let currentDate: moment.Moment; + beforeEach(() => { + TestBed.configureTestingModule({ + imports: [HttpClientTestingModule] + }); + injector = getTestBed(); + service = injector.get(QuoteService); + httpMock = injector.get(HttpTestingController); + currentDate = moment(); + + elemDefault = new Quote(0, 'AAAAAAA', 0, currentDate); + }); + + describe('Service methods', async () => { + it('should find an element', async () => { + const returnedFromService = Object.assign( + { + lastTrade: currentDate.format(DATE_TIME_FORMAT) + }, + elemDefault + ); + service + .find(123) + .pipe(take(1)) + .subscribe(resp => expect(resp).toMatchObject({ body: elemDefault })); + + const req = httpMock.expectOne({ method: 'GET' }); + req.flush(JSON.stringify(returnedFromService)); + }); + + it('should create a Quote', async () => { + const returnedFromService = Object.assign( + { + id: 0, + lastTrade: currentDate.format(DATE_TIME_FORMAT) + }, + elemDefault + ); + const expected = Object.assign( + { + lastTrade: currentDate + }, + returnedFromService + ); + service + .create(new Quote(null)) + .pipe(take(1)) + .subscribe(resp => expect(resp).toMatchObject({ body: expected })); + const req = httpMock.expectOne({ method: 'POST' }); + req.flush(JSON.stringify(returnedFromService)); + }); + + it('should update a Quote', async () => { + const returnedFromService = Object.assign( + { + symbol: 'BBBBBB', + price: 1, + lastTrade: currentDate.format(DATE_TIME_FORMAT) + }, + elemDefault + ); + + const expected = Object.assign( + { + lastTrade: currentDate + }, + returnedFromService + ); + service + .update(expected) + .pipe(take(1)) + .subscribe(resp => expect(resp).toMatchObject({ body: expected })); + const req = httpMock.expectOne({ method: 'PUT' }); + req.flush(JSON.stringify(returnedFromService)); + }); + + it('should return a list of Quote', async () => { + const returnedFromService = Object.assign( + { + symbol: 'BBBBBB', + price: 1, + lastTrade: currentDate.format(DATE_TIME_FORMAT) + }, + elemDefault + ); + const expected = Object.assign( + { + lastTrade: currentDate + }, + returnedFromService + ); + service + .query(expected) + .pipe(take(1), map(resp => resp.body)) + .subscribe(body => expect(body).toContainEqual(expected)); + const req = httpMock.expectOne({ method: 'GET' }); + req.flush(JSON.stringify([returnedFromService])); + httpMock.verify(); + }); + + it('should delete a Quote', async () => { + const rxPromise = service.delete(123).subscribe(resp => expect(resp.ok)); + + const req = httpMock.expectOne({ method: 'DELETE' }); + req.flush({ status: 200 }); + }); + }); + + afterEach(() => { + httpMock.verify(); + }); + }); +}); diff --git a/jhipster/jhipster-uaa/gateway/src/test/javascript/spec/app/shared/alert/alert-error.component.spec.ts b/jhipster/jhipster-uaa/gateway/src/test/javascript/spec/app/shared/alert/alert-error.component.spec.ts new file mode 100644 index 0000000000..9ffdd49165 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/test/javascript/spec/app/shared/alert/alert-error.component.spec.ts @@ -0,0 +1,137 @@ +import { ComponentFixture, TestBed, async, inject, fakeAsync, tick } from '@angular/core/testing'; +import { HttpErrorResponse, HttpHeaders } from '@angular/common/http'; +import { JhiAlertService, JhiEventManager } from 'ng-jhipster'; +import { TranslateModule } from '@ngx-translate/core'; + +import { GatewayTestModule } from '../../../test.module'; +import { JhiAlertErrorComponent } from 'app/shared/alert/alert-error.component'; +import { MockAlertService } from '../../../helpers/mock-alert.service'; + +describe('Component Tests', () => { + describe('Alert Error Component', () => { + let comp: JhiAlertErrorComponent; + let fixture: ComponentFixture; + let eventManager: JhiEventManager; + + beforeEach( + async(() => { + TestBed.configureTestingModule({ + imports: [GatewayTestModule, TranslateModule.forRoot()], + declarations: [JhiAlertErrorComponent], + providers: [ + JhiEventManager, + { + provide: JhiAlertService, + useClass: MockAlertService + } + ] + }) + .overrideTemplate(JhiAlertErrorComponent, '') + .compileComponents(); + }) + ); + + beforeEach(() => { + fixture = TestBed.createComponent(JhiAlertErrorComponent); + comp = fixture.componentInstance; + eventManager = fixture.debugElement.injector.get(JhiEventManager); + }); + + describe('Error Handling', () => { + it('Should display an alert on status 0', () => { + // GIVEN + eventManager.broadcast({ name: 'gatewayApp.httpError', content: { status: 0 } }); + // THEN + expect(comp.alerts.length).toBe(1); + expect(comp.alerts[0].msg).toBe('error.server.not.reachable'); + }); + it('Should display an alert on status 404', () => { + // GIVEN + eventManager.broadcast({ name: 'gatewayApp.httpError', content: { status: 404 } }); + // THEN + expect(comp.alerts.length).toBe(1); + expect(comp.alerts[0].msg).toBe('error.url.not.found'); + }); + it('Should display an alert on generic error', () => { + // GIVEN + eventManager.broadcast({ name: 'gatewayApp.httpError', content: { error: { message: 'Error Message' } } }); + eventManager.broadcast({ name: 'gatewayApp.httpError', content: { error: 'Second Error Message' } }); + // THEN + expect(comp.alerts.length).toBe(2); + expect(comp.alerts[0].msg).toBe('Error Message'); + expect(comp.alerts[1].msg).toBe('Second Error Message'); + }); + it('Should display an alert on status 400 for generic error', () => { + // GIVEN + const response = new HttpErrorResponse({ + url: 'http://localhost:8080/api/foos', + headers: new HttpHeaders(), + status: 400, + statusText: 'Bad Request', + error: { + type: 'https://www.jhipster.tech/problem/constraint-violation', + title: 'Bad Request', + status: 400, + path: '/api/foos', + message: 'error.validation' + } + }); + eventManager.broadcast({ name: 'gatewayApp.httpError', content: response }); + // THEN + expect(comp.alerts.length).toBe(1); + expect(comp.alerts[0].msg).toBe('error.validation'); + }); + it('Should display an alert on status 400 for generic error without message', () => { + // GIVEN + const response = new HttpErrorResponse({ + url: 'http://localhost:8080/api/foos', + headers: new HttpHeaders(), + status: 400, + error: 'Bad Request' + }); + eventManager.broadcast({ name: 'gatewayApp.httpError', content: response }); + // THEN + expect(comp.alerts.length).toBe(1); + expect(comp.alerts[0].msg).toBe('Bad Request'); + }); + it('Should display an alert on status 400 for invalid parameters', () => { + // GIVEN + const response = new HttpErrorResponse({ + url: 'http://localhost:8080/api/foos', + headers: new HttpHeaders(), + status: 400, + statusText: 'Bad Request', + error: { + type: 'https://www.jhipster.tech/problem/constraint-violation', + title: 'Method argument not valid', + status: 400, + path: '/api/foos', + message: 'error.validation', + fieldErrors: [{ objectName: 'foo', field: 'minField', message: 'Min' }] + } + }); + eventManager.broadcast({ name: 'gatewayApp.httpError', content: response }); + // THEN + expect(comp.alerts.length).toBe(1); + expect(comp.alerts[0].msg).toBe('error.Size'); + }); + it('Should display an alert on status 400 for error headers', () => { + // GIVEN + const response = new HttpErrorResponse({ + url: 'http://localhost:8080/api/foos', + headers: new HttpHeaders().append('app-error', 'Error Message').append('app-params', 'foo'), + status: 400, + statusText: 'Bad Request', + error: { + status: 400, + message: 'error.validation' + } + }); + eventManager.broadcast({ name: 'gatewayApp.httpError', content: response }); + // THEN + expect(comp.alerts.length).toBe(1); + expect(comp.alerts[0].msg).toBe('Error Message'); + }); + }); + }); +}); diff --git a/jhipster/jhipster-uaa/gateway/src/test/javascript/spec/app/shared/login/login.component.spec.ts b/jhipster/jhipster-uaa/gateway/src/test/javascript/spec/app/shared/login/login.component.spec.ts new file mode 100644 index 0000000000..1f4002563d --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/test/javascript/spec/app/shared/login/login.component.spec.ts @@ -0,0 +1,165 @@ +import { ComponentFixture, TestBed, async, inject, fakeAsync, tick } from '@angular/core/testing'; +import { Router } from '@angular/router'; +import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap'; +import { JhiEventManager } from 'ng-jhipster'; + +import { LoginService } from 'app/core/login/login.service'; +import { JhiLoginModalComponent } from 'app/shared/login/login.component'; +import { StateStorageService } from 'app/core/auth/state-storage.service'; +import { GatewayTestModule } from '../../../test.module'; +import { MockLoginService } from '../../../helpers/mock-login.service'; +import { MockStateStorageService } from '../../../helpers/mock-state-storage.service'; + +describe('Component Tests', () => { + describe('LoginComponent', () => { + let comp: JhiLoginModalComponent; + let fixture: ComponentFixture; + let mockLoginService: any; + let mockStateStorageService: any; + let mockRouter: any; + let mockEventManager: any; + let mockActiveModal: any; + + beforeEach( + async(() => { + TestBed.configureTestingModule({ + imports: [GatewayTestModule], + declarations: [JhiLoginModalComponent], + providers: [ + { + provide: LoginService, + useClass: MockLoginService + }, + { + provide: StateStorageService, + useClass: MockStateStorageService + } + ] + }) + .overrideTemplate(JhiLoginModalComponent, '') + .compileComponents(); + }) + ); + + beforeEach(() => { + fixture = TestBed.createComponent(JhiLoginModalComponent); + comp = fixture.componentInstance; + mockLoginService = fixture.debugElement.injector.get(LoginService); + mockStateStorageService = fixture.debugElement.injector.get(StateStorageService); + mockRouter = fixture.debugElement.injector.get(Router); + mockEventManager = fixture.debugElement.injector.get(JhiEventManager); + mockActiveModal = fixture.debugElement.injector.get(NgbActiveModal); + }); + + it( + 'should authenticate the user upon login when previous state was set', + inject( + [], + fakeAsync(() => { + // GIVEN + const credentials = { + username: 'admin', + password: 'admin', + rememberMe: true + }; + comp.username = 'admin'; + comp.password = 'admin'; + comp.rememberMe = true; + comp.credentials = credentials; + mockLoginService.setResponse({}); + mockStateStorageService.setResponse({ redirect: 'dummy' }); + + // WHEN/ + comp.login(); + tick(); // simulate async + + // THEN + expect(comp.authenticationError).toEqual(false); + expect(mockActiveModal.dismissSpy).toHaveBeenCalledWith('login success'); + expect(mockEventManager.broadcastSpy).toHaveBeenCalledTimes(1); + expect(mockLoginService.loginSpy).toHaveBeenCalledWith(credentials); + expect(mockStateStorageService.getUrlSpy).toHaveBeenCalledTimes(1); + expect(mockStateStorageService.storeUrlSpy).toHaveBeenCalledWith(null); + expect(mockRouter.navigateSpy).toHaveBeenCalledWith([{ redirect: 'dummy' }]); + }) + ) + ); + + it( + 'should authenticate the user upon login when previous state was not set', + inject( + [], + fakeAsync(() => { + // GIVEN + const credentials = { + username: 'admin', + password: 'admin', + rememberMe: true + }; + comp.username = 'admin'; + comp.password = 'admin'; + comp.rememberMe = true; + comp.credentials = credentials; + mockLoginService.setResponse({}); + mockStateStorageService.setResponse(null); + + // WHEN + comp.login(); + tick(); // simulate async + + // THEN + expect(comp.authenticationError).toEqual(false); + expect(mockActiveModal.dismissSpy).toHaveBeenCalledWith('login success'); + expect(mockEventManager.broadcastSpy).toHaveBeenCalledTimes(1); + expect(mockLoginService.loginSpy).toHaveBeenCalledWith(credentials); + expect(mockStateStorageService.getUrlSpy).toHaveBeenCalledTimes(1); + expect(mockStateStorageService.storeUrlSpy).not.toHaveBeenCalled(); + expect(mockRouter.navigateSpy).not.toHaveBeenCalled(); + }) + ) + ); + + it('should empty the credentials upon cancel', () => { + // GIVEN + const credentials = { + username: 'admin', + password: 'admin', + rememberMe: true + }; + + const expected = { + username: null, + password: null, + rememberMe: true + }; + + comp.credentials = credentials; + + // WHEN + comp.cancel(); + + // THEN + expect(comp.authenticationError).toEqual(false); + expect(comp.credentials).toEqual(expected); + expect(mockActiveModal.dismissSpy).toHaveBeenCalledWith('cancel'); + }); + + it('should redirect user when register', () => { + // WHEN + comp.register(); + + // THEN + expect(mockActiveModal.dismissSpy).toHaveBeenCalledWith('to state register'); + expect(mockRouter.navigateSpy).toHaveBeenCalledWith(['/register']); + }); + + it('should redirect user when request password', () => { + // WHEN + comp.requestResetPassword(); + + // THEN + expect(mockActiveModal.dismissSpy).toHaveBeenCalledWith('to state requestReset'); + expect(mockRouter.navigateSpy).toHaveBeenCalledWith(['/reset', 'request']); + }); + }); +}); diff --git a/jhipster/jhipster-uaa/gateway/src/test/javascript/spec/helpers/mock-account.service.ts b/jhipster/jhipster-uaa/gateway/src/test/javascript/spec/helpers/mock-account.service.ts new file mode 100644 index 0000000000..8b3965ff4c --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/test/javascript/spec/helpers/mock-account.service.ts @@ -0,0 +1,25 @@ +import { SpyObject } from './spyobject'; +import { AccountService } from 'app/core/auth/account.service'; +import Spy = jasmine.Spy; + +export class MockAccountService extends SpyObject { + getSpy: Spy; + saveSpy: Spy; + fakeResponse: any; + + constructor() { + super(AccountService); + + this.fakeResponse = null; + this.getSpy = this.spy('get').andReturn(this); + this.saveSpy = this.spy('save').andReturn(this); + } + + subscribe(callback: any) { + callback(this.fakeResponse); + } + + setResponse(json: any): void { + this.fakeResponse = json; + } +} diff --git a/jhipster/jhipster-uaa/gateway/src/test/javascript/spec/helpers/mock-active-modal.service.ts b/jhipster/jhipster-uaa/gateway/src/test/javascript/spec/helpers/mock-active-modal.service.ts new file mode 100644 index 0000000000..8bf0cc966f --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/test/javascript/spec/helpers/mock-active-modal.service.ts @@ -0,0 +1,12 @@ +import { SpyObject } from './spyobject'; +import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap'; +import Spy = jasmine.Spy; + +export class MockActiveModal extends SpyObject { + dismissSpy: Spy; + + constructor() { + super(NgbActiveModal); + this.dismissSpy = this.spy('dismiss').andReturn(this); + } +} diff --git a/jhipster/jhipster-uaa/gateway/src/test/javascript/spec/helpers/mock-alert.service.ts b/jhipster/jhipster-uaa/gateway/src/test/javascript/spec/helpers/mock-alert.service.ts new file mode 100644 index 0000000000..87f36c71e2 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/test/javascript/spec/helpers/mock-alert.service.ts @@ -0,0 +1,11 @@ +import { SpyObject } from './spyobject'; +import { JhiAlertService, JhiAlert } from 'ng-jhipster'; + +export class MockAlertService extends SpyObject { + constructor() { + super(JhiAlertService); + } + addAlert(alertOptions: JhiAlert) { + return alertOptions; + } +} diff --git a/jhipster/jhipster-uaa/gateway/src/test/javascript/spec/helpers/mock-event-manager.service.ts b/jhipster/jhipster-uaa/gateway/src/test/javascript/spec/helpers/mock-event-manager.service.ts new file mode 100644 index 0000000000..a71b5d9314 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/test/javascript/spec/helpers/mock-event-manager.service.ts @@ -0,0 +1,12 @@ +import { SpyObject } from './spyobject'; +import { JhiEventManager } from 'ng-jhipster'; +import Spy = jasmine.Spy; + +export class MockEventManager extends SpyObject { + broadcastSpy: Spy; + + constructor() { + super(JhiEventManager); + this.broadcastSpy = this.spy('broadcast').andReturn(this); + } +} diff --git a/jhipster/jhipster-uaa/gateway/src/test/javascript/spec/helpers/mock-language.service.ts b/jhipster/jhipster-uaa/gateway/src/test/javascript/spec/helpers/mock-language.service.ts new file mode 100644 index 0000000000..0dea7984d2 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/test/javascript/spec/helpers/mock-language.service.ts @@ -0,0 +1,36 @@ +import { SpyObject } from './spyobject'; +import { JhiLanguageService } from 'ng-jhipster'; +import { JhiLanguageHelper } from 'app/core/language/language.helper'; +import Spy = jasmine.Spy; + +export class MockLanguageService extends SpyObject { + getCurrentSpy: Spy; + fakeResponse: any; + + constructor() { + super(JhiLanguageService); + + this.fakeResponse = 'en'; + this.getCurrentSpy = this.spy('getCurrent').andReturn(Promise.resolve(this.fakeResponse)); + } + + init() {} + + changeLanguage(languageKey: string) {} + + setLocations(locations: string[]) {} + + addLocation(location: string) {} + + reload() {} +} + +export class MockLanguageHelper extends SpyObject { + getAllSpy: Spy; + + constructor() { + super(JhiLanguageHelper); + + this.getAllSpy = this.spy('getAll').andReturn(Promise.resolve(['en', 'fr'])); + } +} diff --git a/jhipster/jhipster-uaa/gateway/src/test/javascript/spec/helpers/mock-login.service.ts b/jhipster/jhipster-uaa/gateway/src/test/javascript/spec/helpers/mock-login.service.ts new file mode 100644 index 0000000000..93a8ca575f --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/test/javascript/spec/helpers/mock-login.service.ts @@ -0,0 +1,29 @@ +import { SpyObject } from './spyobject'; +import { LoginService } from 'app/core/login/login.service'; +import Spy = jasmine.Spy; + +export class MockLoginService extends SpyObject { + loginSpy: Spy; + logoutSpy: Spy; + registerSpy: Spy; + requestResetPasswordSpy: Spy; + cancelSpy: Spy; + + constructor() { + super(LoginService); + + this.setLoginSpy({}); + this.logoutSpy = this.spy('logout').andReturn(this); + this.registerSpy = this.spy('register').andReturn(this); + this.requestResetPasswordSpy = this.spy('requestResetPassword').andReturn(this); + this.cancelSpy = this.spy('cancel').andReturn(this); + } + + setLoginSpy(json: any) { + this.loginSpy = this.spy('login').andReturn(Promise.resolve(json)); + } + + setResponse(json: any): void { + this.setLoginSpy(json); + } +} diff --git a/jhipster/jhipster-uaa/gateway/src/test/javascript/spec/helpers/mock-principal.service.ts b/jhipster/jhipster-uaa/gateway/src/test/javascript/spec/helpers/mock-principal.service.ts new file mode 100644 index 0000000000..cb1f175cd3 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/test/javascript/spec/helpers/mock-principal.service.ts @@ -0,0 +1,20 @@ +import { SpyObject } from './spyobject'; +import { Principal } from 'app/core/auth/principal.service'; +import Spy = jasmine.Spy; + +export class MockPrincipal extends SpyObject { + identitySpy: Spy; + + constructor() { + super(Principal); + + this.setIdentitySpy({}); + } + setIdentitySpy(json: any): any { + this.identitySpy = this.spy('identity').andReturn(Promise.resolve(json)); + } + + setResponse(json: any): void { + this.setIdentitySpy(json); + } +} diff --git a/jhipster/jhipster-uaa/gateway/src/test/javascript/spec/helpers/mock-route.service.ts b/jhipster/jhipster-uaa/gateway/src/test/javascript/spec/helpers/mock-route.service.ts new file mode 100644 index 0000000000..3465e05524 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/test/javascript/spec/helpers/mock-route.service.ts @@ -0,0 +1,29 @@ +import { ActivatedRoute, Router } from '@angular/router'; +import { SpyObject } from './spyobject'; +import { Observable, of } from 'rxjs'; +import Spy = jasmine.Spy; + +export class MockActivatedRoute extends ActivatedRoute { + constructor(parameters?: any) { + super(); + this.queryParams = of(parameters); + this.params = of(parameters); + this.data = of({ + ...parameters, + pagingParams: { + page: 10, + ascending: false, + predicate: 'id' + } + }); + } +} + +export class MockRouter extends SpyObject { + navigateSpy: Spy; + + constructor() { + super(Router); + this.navigateSpy = this.spy('navigate'); + } +} diff --git a/jhipster/jhipster-uaa/gateway/src/test/javascript/spec/helpers/mock-state-storage.service.ts b/jhipster/jhipster-uaa/gateway/src/test/javascript/spec/helpers/mock-state-storage.service.ts new file mode 100644 index 0000000000..1398c7b28b --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/test/javascript/spec/helpers/mock-state-storage.service.ts @@ -0,0 +1,22 @@ +import { SpyObject } from './spyobject'; +import { StateStorageService } from 'app/core/auth/state-storage.service'; +import Spy = jasmine.Spy; + +export class MockStateStorageService extends SpyObject { + getUrlSpy: Spy; + storeUrlSpy: Spy; + + constructor() { + super(StateStorageService); + this.setUrlSpy({}); + this.storeUrlSpy = this.spy('storeUrl').andReturn(this); + } + + setUrlSpy(json) { + this.getUrlSpy = this.spy('getUrl').andReturn(json); + } + + setResponse(json: any): void { + this.setUrlSpy(json); + } +} diff --git a/jhipster/jhipster-uaa/gateway/src/test/javascript/spec/helpers/spyobject.ts b/jhipster/jhipster-uaa/gateway/src/test/javascript/spec/helpers/spyobject.ts new file mode 100644 index 0000000000..949e067ef5 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/test/javascript/spec/helpers/spyobject.ts @@ -0,0 +1,69 @@ +export interface GuinessCompatibleSpy extends jasmine.Spy { + /** By chaining the spy with and.returnValue, all calls to the function will return a specific + * value. */ + andReturn(val: any): void; + /** By chaining the spy with and.callFake, all calls to the spy will delegate to the supplied + * function. */ + andCallFake(fn: Function): GuinessCompatibleSpy; + /** removes all recorded calls */ + reset(); +} + +export class SpyObject { + static stub(object = null, config = null, overrides = null) { + if (!(object instanceof SpyObject)) { + overrides = config; + config = object; + object = new SpyObject(); + } + + const m = {}; + Object.keys(config).forEach(key => (m[key] = config[key])); + Object.keys(overrides).forEach(key => (m[key] = overrides[key])); + Object.keys(m).forEach(key => { + object.spy(key).andReturn(m[key]); + }); + return object; + } + + constructor(type = null) { + if (type) { + Object.keys(type.prototype).forEach(prop => { + let m = null; + try { + m = type.prototype[prop]; + } catch (e) { + // As we are creating spys for abstract classes, + // these classes might have getters that throw when they are accessed. + // As we are only auto creating spys for methods, this + // should not matter. + } + if (typeof m === 'function') { + this.spy(prop); + } + }); + } + } + + spy(name) { + if (!this[name]) { + this[name] = this._createGuinnessCompatibleSpy(name); + } + return this[name]; + } + + prop(name, value) { + this[name] = value; + } + + /** @internal */ + _createGuinnessCompatibleSpy(name): GuinessCompatibleSpy { + const newSpy: GuinessCompatibleSpy = jasmine.createSpy(name); + newSpy.andCallFake = newSpy.and.callFake; + newSpy.andReturn = newSpy.and.returnValue; + newSpy.reset = newSpy.calls.reset; + // revisit return null here (previously needed for rtts_assert). + newSpy.and.returnValue(null); + return newSpy; + } +} diff --git a/jhipster/jhipster-uaa/gateway/src/test/javascript/spec/test.module.ts b/jhipster/jhipster-uaa/gateway/src/test/javascript/spec/test.module.ts new file mode 100644 index 0000000000..0f5aa6ffb4 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/test/javascript/spec/test.module.ts @@ -0,0 +1,77 @@ +import { DatePipe } from '@angular/common'; +import { ActivatedRoute, Router } from '@angular/router'; +import { NgModule, ElementRef, Renderer } from '@angular/core'; +import { HttpClientTestingModule } from '@angular/common/http/testing'; +import { NgbActiveModal, NgbModal } from '@ng-bootstrap/ng-bootstrap'; +import { JhiLanguageService, JhiDataUtils, JhiDateUtils, JhiEventManager, JhiAlertService, JhiParseLinks } from 'ng-jhipster'; + +import { MockLanguageService, MockLanguageHelper } from './helpers/mock-language.service'; +import { JhiLanguageHelper, Principal, AccountService, LoginModalService } from 'app/core'; +import { MockPrincipal } from './helpers/mock-principal.service'; +import { MockAccountService } from './helpers/mock-account.service'; +import { MockActivatedRoute, MockRouter } from './helpers/mock-route.service'; +import { MockActiveModal } from './helpers/mock-active-modal.service'; +import { MockEventManager } from './helpers/mock-event-manager.service'; + +@NgModule({ + providers: [ + DatePipe, + JhiDataUtils, + JhiDateUtils, + JhiParseLinks, + { + provide: JhiLanguageService, + useClass: MockLanguageService + }, + { + provide: JhiLanguageHelper, + useClass: MockLanguageHelper + }, + { + provide: JhiEventManager, + useClass: MockEventManager + }, + { + provide: NgbActiveModal, + useClass: MockActiveModal + }, + { + provide: ActivatedRoute, + useValue: new MockActivatedRoute({ id: 123 }) + }, + { + provide: Router, + useClass: MockRouter + }, + { + provide: Principal, + useClass: MockPrincipal + }, + { + provide: AccountService, + useClass: MockAccountService + }, + { + provide: LoginModalService, + useValue: null + }, + { + provide: ElementRef, + useValue: null + }, + { + provide: Renderer, + useValue: null + }, + { + provide: JhiAlertService, + useValue: null + }, + { + provide: NgbModal, + useValue: null + } + ], + imports: [HttpClientTestingModule] +}) +export class GatewayTestModule {} diff --git a/jhipster/jhipster-uaa/gateway/src/test/resources/config/application.yml b/jhipster/jhipster-uaa/gateway/src/test/resources/config/application.yml new file mode 100644 index 0000000000..a8aaef6e43 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/test/resources/config/application.yml @@ -0,0 +1,114 @@ +# =================================================================== +# Spring Boot configuration. +# +# This configuration is used for unit/integration tests. +# +# More information on profiles: https://www.jhipster.tech/profiles/ +# More information on configuration properties: https://www.jhipster.tech/common-application-properties/ +# =================================================================== + +# =================================================================== +# Standard Spring Boot properties. +# Full reference is available at: +# http://docs.spring.io/spring-boot/docs/current/reference/html/common-application-properties.html +# =================================================================== + +eureka: + client: + enabled: false + instance: + appname: gateway + instanceId: gateway:${spring.application.instance-id:${random.value}} + +spring: + application: + name: gateway + cache: + type: simple + datasource: + type: com.zaxxer.hikari.HikariDataSource + url: jdbc:h2:mem:gateway;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE + name: + username: + password: + hikari: + auto-commit: false + jpa: + database-platform: io.github.jhipster.domain.util.FixedH2Dialect + database: H2 + open-in-view: false + show-sql: false + hibernate: + ddl-auto: none + naming: + physical-strategy: org.springframework.boot.orm.jpa.hibernate.SpringPhysicalNamingStrategy + implicit-strategy: org.springframework.boot.orm.jpa.hibernate.SpringImplicitNamingStrategy + properties: + hibernate.id.new_generator_mappings: true + hibernate.connection.provider_disables_autocommit: true + hibernate.cache.use_second_level_cache: false + hibernate.cache.use_query_cache: false + hibernate.generate_statistics: true + hibernate.hbm2ddl.auto: validate + liquibase: + contexts: test + mail: + host: localhost + messages: + basename: i18n/messages + mvc: + favicon: + enabled: false + thymeleaf: + mode: HTML + + +server: + port: 10344 + address: localhost + +info: + project: + version: #project.version# + +# =================================================================== +# JHipster specific properties +# +# Full reference is available at: https://www.jhipster.tech/common-application-properties/ +# =================================================================== + +jhipster: + async: + core-pool-size: 1 + max-pool-size: 50 + queue-capacity: 10000 + # To test logstash appender + logging: + logstash: + enabled: true + host: localhost + port: 5000 + queue-size: 512 + security: + authentication: + jwt: + # This token must be encoded using Base64 (you can type `echo 'secret-key'|base64` on your command line) + base64-secret: + # Token is valid 24 hours + token-validity-in-seconds: 86400 + metrics: # DropWizard Metrics configuration, used by MetricsConfiguration + jmx.enabled: true + logs: # Reports Dropwizard metrics in the logs + enabled: true + report-frequency: 60 # in seconds + +# =================================================================== +# Application specific properties +# Add your own application properties here, see the ApplicationProperties class +# to have type-safe configuration, like in the JHipsterProperties above +# +# More documentation is available at: +# https://www.jhipster.tech/common-application-properties/ +# =================================================================== + +# application: diff --git a/jhipster/jhipster-uaa/gateway/src/test/resources/config/bootstrap.yml b/jhipster/jhipster-uaa/gateway/src/test/resources/config/bootstrap.yml new file mode 100644 index 0000000000..11cd6af21c --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/test/resources/config/bootstrap.yml @@ -0,0 +1,4 @@ +spring: + cloud: + config: + enabled: false diff --git a/jhipster/jhipster-uaa/gateway/src/test/resources/logback.xml b/jhipster/jhipster-uaa/gateway/src/test/resources/logback.xml new file mode 100644 index 0000000000..266d1e88a4 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/src/test/resources/logback.xml @@ -0,0 +1,46 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/jhipster/jhipster-uaa/gateway/tsconfig-aot.json b/jhipster/jhipster-uaa/gateway/tsconfig-aot.json new file mode 100644 index 0000000000..16552d03a0 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/tsconfig-aot.json @@ -0,0 +1,30 @@ +{ + "compilerOptions": { + "target": "es5", + "module": "es2015", + "moduleResolution": "node", + "sourceMap": false, + "emitDecoratorMetadata": true, + "experimentalDecorators": true, + "removeComments": false, + "noImplicitAny": false, + "suppressImplicitAnyIndexErrors": true, + "skipLibCheck": true, + "outDir": "target/www/app", + "lib": ["es7", "dom"], + "typeRoots": [ + "node_modules/@types" + ], + "baseUrl": "./", + "paths": { + "app/*": ["src/main/webapp/app/*"] + }, + "importHelpers": true + }, + "angularCompilerOptions": { + "genDir": "target/aot", + "skipMetadataEmit" : true, + "fullTemplateTypeCheck": true, + "preserveWhitespaces": true + } +} diff --git a/jhipster/jhipster-uaa/gateway/tsconfig.json b/jhipster/jhipster-uaa/gateway/tsconfig.json new file mode 100644 index 0000000000..e9209830ee --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/tsconfig.json @@ -0,0 +1,32 @@ +{ + "compilerOptions": { + "target": "es5", + "module": "commonjs", + "moduleResolution": "node", + "sourceMap": true, + "emitDecoratorMetadata": true, + "experimentalDecorators": true, + "removeComments": false, + "noImplicitAny": false, + "skipLibCheck": true, + "suppressImplicitAnyIndexErrors": true, + "outDir": "target/www/app", + "lib": ["es7", "dom"], + "typeRoots": [ + "node_modules/@types" + ], + "baseUrl": "./", + "paths": { + "app/*": ["src/main/webapp/app/*"] + }, + "importHelpers": true, + "allowJs": true + }, + "include": [ + "src/main/webapp/app", + "src/test/javascript/" + ], + "exclude": [ + "node_modules" + ] +} diff --git a/jhipster/jhipster-uaa/gateway/tslint.json b/jhipster/jhipster-uaa/gateway/tslint.json new file mode 100644 index 0000000000..ece05c2c16 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/tslint.json @@ -0,0 +1,122 @@ +{ + "rulesDirectory": [ + "node_modules/codelyzer" + ], + "extends": [ + "tslint-config-prettier" + ], + "rules": { + "class-name": true, + "comment-format": [ + true, + "check-space" + ], + "curly": true, + "eofline": true, + "forin": true, + "indent": [ + true, + "spaces" + ], + "label-position": true, + "max-line-length": [ + true, + 180 + ], + "member-access": false, + "member-ordering": [ + true, + "static-before-instance", + "variables-before-functions" + ], + "no-arg": true, + "no-bitwise": true, + "no-console": [ + true, + "debug", + "info", + "time", + "timeEnd", + "trace" + ], + "no-construct": true, + "no-debugger": true, + "no-duplicate-variable": true, + "no-empty": false, + "no-eval": true, + "no-inferrable-types": [true], + "no-shadowed-variable": true, + "no-string-literal": false, + "no-switch-case-fall-through": true, + "no-trailing-whitespace": true, + "no-unused-expression": true, + "no-var-keyword": true, + "object-literal-sort-keys": false, + "one-line": [ + true, + "check-open-brace", + "check-catch", + "check-else", + "check-whitespace" + ], + "quotemark": [ + true, + "single", + "avoid-escape" + ], + "radix": true, + "semicolon": [ + true, + "always", + "ignore-bound-class-methods" + ], + "triple-equals": [ + true, + "allow-null-check" + ], + "typedef-whitespace": [ + true, + { + "call-signature": "nospace", + "index-signature": "nospace", + "parameter": "nospace", + "property-declaration": "nospace", + "variable-declaration": "nospace" + } + ], + "variable-name": false, + "whitespace": [ + true, + "check-branch", + "check-decl", + "check-operator", + "check-separator", + "check-type" + ], + "prefer-const": true, + "arrow-parens": [true, "ban-single-arg-parens"], + "arrow-return-shorthand": [true], + "import-spacing": true, + "no-consecutive-blank-lines": [true], + "object-literal-shorthand": true, + "space-before-function-paren": [true, { + "asyncArrow": "always", + "anonymous": "never", + "constructor": "never", + "method": "never", + "named": "never" + }], + + "directive-selector": [true, "attribute", "jhi", "camelCase"], + "component-selector": [true, "element", "jhi", "kebab-case"], + "use-input-property-decorator": true, + "use-output-property-decorator": true, + "use-host-property-decorator": true, + "no-input-rename": true, + "no-output-rename": true, + "use-life-cycle-interface": true, + "use-pipe-transform-interface": false, + "component-class-suffix": true, + "directive-class-suffix": true + } +} diff --git a/jhipster/jhipster-uaa/gateway/webpack/logo-jhipster.png b/jhipster/jhipster-uaa/gateway/webpack/logo-jhipster.png new file mode 100644 index 0000000000..d8eb48da05 Binary files /dev/null and b/jhipster/jhipster-uaa/gateway/webpack/logo-jhipster.png differ diff --git a/jhipster/jhipster-uaa/gateway/webpack/utils.js b/jhipster/jhipster-uaa/gateway/webpack/utils.js new file mode 100644 index 0000000000..2fce772341 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/webpack/utils.js @@ -0,0 +1,44 @@ +const fs = require('fs'); +const path = require('path'); + +module.exports = { + parseVersion, + root, + isExternalLib +}; + +const parseString = require('xml2js').parseString; +// return the version number from `pom.xml` file +function parseVersion() { + let version = null; + const pomXml = fs.readFileSync('pom.xml', 'utf8'); + parseString(pomXml, (err, result) => { + if (err) { + throw new Error('Failed to parse pom.xml: ' + err); + } + if (result.project.version && result.project.version[0]) { + version = result.project.version[0]; + } else if (result.project.parent && result.project.parent[0] && result.project.parent[0].version && result.project.parent[0].version[0]) { + version = result.project.parent[0].version[0]; + } + }); + if (version === null) { + throw new Error('pom.xml is malformed. No version is defined'); + } + return version; +} + +const _root = path.resolve(__dirname, '..'); + +function root(args) { + args = Array.prototype.slice.call(arguments, 0); + return path.join.apply(path, [_root].concat(args)); +} + +function isExternalLib(module, check = /node_modules/) { + const req = module.userRequest; + if (typeof req !== 'string') { + return false; + } + return req.search(check) >= 0; +} diff --git a/jhipster/jhipster-uaa/gateway/webpack/webpack.common.js b/jhipster/jhipster-uaa/gateway/webpack/webpack.common.js new file mode 100644 index 0000000000..701aff702f --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/webpack/webpack.common.js @@ -0,0 +1,97 @@ +const webpack = require('webpack'); +const CopyWebpackPlugin = require('copy-webpack-plugin'); +const HtmlWebpackPlugin = require('html-webpack-plugin'); +const rxPaths = require('rxjs/_esm5/path-mapping'); +const MergeJsonWebpackPlugin = require("merge-jsons-webpack-plugin"); + +const utils = require('./utils.js'); + +module.exports = (options) => ({ + resolve: { + extensions: ['.ts', '.js'], + modules: ['node_modules'], + alias: { + app: utils.root('src/main/webapp/app/'), + ...rxPaths() + } + }, + stats: { + children: false + }, + module: { + rules: [ + { + test: /\.html$/, + loader: 'html-loader', + options: { + minimize: true, + caseSensitive: true, + removeAttributeQuotes:false, + minifyJS:false, + minifyCSS:false + }, + exclude: ['./src/main/webapp/index.html'] + }, + { + test: /\.(jpe?g|png|gif|svg|woff2?|ttf|eot)$/i, + loader: 'file-loader', + options: { + digest: 'hex', + hash: 'sha512', + name: 'content/[hash].[ext]' + } + }, + { + test: /manifest.webapp$/, + loader: 'file-loader', + options: { + name: 'manifest.webapp' + } + }, + // Ignore warnings about System.import in Angular + { test: /[\/\\]@angular[\/\\].+\.js$/, parser: { system: true } }, + ] + }, + plugins: [ + new webpack.DefinePlugin({ + 'process.env': { + NODE_ENV: `'${options.env}'`, + BUILD_TIMESTAMP: `'${new Date().getTime()}'`, + VERSION: `'${utils.parseVersion()}'`, + DEBUG_INFO_ENABLED: options.env === 'development', + // The root URL for API calls, ending with a '/' - for example: `"https://www.jhipster.tech:8081/myservice/"`. + // If this URL is left empty (""), then it will be relative to the current context. + // If you use an API server, in `prod` mode, you will need to enable CORS + // (see the `jhipster.cors` common JHipster property in the `application-*.yml` configurations) + SERVER_API_URL: `''` + } + }), + new CopyWebpackPlugin([ + { from: './node_modules/swagger-ui/dist/css', to: 'swagger-ui/dist/css' }, + { from: './node_modules/swagger-ui/dist/lib', to: 'swagger-ui/dist/lib' }, + { from: './node_modules/swagger-ui/dist/swagger-ui.min.js', to: 'swagger-ui/dist/swagger-ui.min.js' }, + { from: './src/main/webapp/swagger-ui/', to: 'swagger-ui' }, + { from: './src/main/webapp/content/', to: 'content' }, + { from: './src/main/webapp/favicon.ico', to: 'favicon.ico' }, + { from: './src/main/webapp/manifest.webapp', to: 'manifest.webapp' }, + // jhipster-needle-add-assets-to-webpack - JHipster will add/remove third-party resources in this array + { from: './src/main/webapp/robots.txt', to: 'robots.txt' } + ]), + new MergeJsonWebpackPlugin({ + output: { + groupBy: [ + { pattern: "./src/main/webapp/i18n/en/*.json", fileName: "./i18n/en.json" }, + { pattern: "./src/main/webapp/i18n/fr/*.json", fileName: "./i18n/fr.json" }, + { pattern: "./src/main/webapp/i18n/pt-br/*.json", fileName: "./i18n/pt-br.json" } + // jhipster-needle-i18n-language-webpack - JHipster will add/remove languages in this array + ] + } + }), + new HtmlWebpackPlugin({ + template: './src/main/webapp/index.html', + chunks: ['vendors', 'polyfills', 'global', 'main'], + chunksSortMode: 'manual', + inject: 'body' + }) + ] +}); diff --git a/jhipster/jhipster-uaa/gateway/webpack/webpack.dev.js b/jhipster/jhipster-uaa/gateway/webpack/webpack.dev.js new file mode 100644 index 0000000000..ed3c981706 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/webpack/webpack.dev.js @@ -0,0 +1,150 @@ +const webpack = require('webpack'); +const writeFilePlugin = require('write-file-webpack-plugin'); +const webpackMerge = require('webpack-merge'); +const BrowserSyncPlugin = require('browser-sync-webpack-plugin'); +const ForkTsCheckerWebpackPlugin = require('fork-ts-checker-webpack-plugin'); +const FriendlyErrorsWebpackPlugin = require('friendly-errors-webpack-plugin'); +const SimpleProgressWebpackPlugin = require('simple-progress-webpack-plugin'); +const WebpackNotifierPlugin = require('webpack-notifier'); +const path = require('path'); +const sass = require('sass'); + +const utils = require('./utils.js'); +const commonConfig = require('./webpack.common.js'); + +const ENV = 'development'; + +module.exports = (options) => webpackMerge(commonConfig({ env: ENV }), { + devtool: 'eval-source-map', + devServer: { + contentBase: './target/www', + proxy: [{ + context: [ + '/uaa', + '/quotes', + /* jhipster-needle-add-entity-to-webpack - JHipster will add entity api paths here */ + '/api', + '/management', + '/swagger-resources', + '/v2/api-docs', + '/h2-console', + '/auth' + ], + target: `http${options.tls ? 's' : ''}://127.0.0.1:8080`, + secure: false, + changeOrigin: options.tls, + headers: { host: 'localhost:9000' } + }], + stats: options.stats, + watchOptions: { + ignored: /node_modules/ + } + }, + entry: { + polyfills: './src/main/webapp/app/polyfills', + global: './src/main/webapp/content/scss/global.scss', + main: './src/main/webapp/app/app.main' + }, + output: { + path: utils.root('target/www'), + filename: 'app/[name].bundle.js', + chunkFilename: 'app/[id].chunk.js' + }, + module: { + rules: [{ + test: /\.ts$/, + enforce: 'pre', + loader: 'tslint-loader', + exclude: ['node_modules', new RegExp('reflect-metadata\\' + path.sep + 'Reflect\\.ts')] + }, + { + test: /\.ts$/, + use: [ + 'angular2-template-loader', + { + loader: 'cache-loader', + options: { + cacheDirectory: path.resolve('target/cache-loader') + } + }, + { + loader: 'thread-loader', + options: { + // there should be 1 cpu for the fork-ts-checker-webpack-plugin + workers: require('os').cpus().length - 1 + } + }, + { + loader: 'ts-loader', + options: { + transpileOnly: true, + happyPackMode: true + } + }, + 'angular-router-loader' + ], + exclude: ['node_modules'] + }, + { + test: /\.scss$/, + use: ['to-string-loader', 'css-loader', { + loader: 'sass-loader', + options: { implementation: sass } + }], + exclude: /(vendor\.scss|global\.scss)/ + }, + { + test: /(vendor\.scss|global\.scss)/, + use: ['style-loader', 'css-loader', 'postcss-loader', { + loader: 'sass-loader', + options: { implementation: sass } + }] + }, + { + test: /\.css$/, + use: ['to-string-loader', 'css-loader'], + exclude: /(vendor\.css|global\.css)/ + }, + { + test: /(vendor\.css|global\.css)/, + use: ['style-loader', 'css-loader'] + }] + }, + stats: process.env.JHI_DISABLE_WEBPACK_LOGS ? 'none' : options.stats, + plugins: [ + process.env.JHI_DISABLE_WEBPACK_LOGS + ? null + : new SimpleProgressWebpackPlugin({ + format: options.stats === 'minimal' ? 'compact' : 'expanded' + }), + new FriendlyErrorsWebpackPlugin(), + new ForkTsCheckerWebpackPlugin(), + new BrowserSyncPlugin({ + host: 'localhost', + port: 9000, + proxy: { + target: 'http://localhost:9060' + }, + socket: { + clients: { + heartbeatTimeout: 60000 + } + } + }, { + reload: false + }), + new webpack.ContextReplacementPlugin( + /angular(\\|\/)core(\\|\/)/, + path.resolve(__dirname, './src/main/webapp') + ), + new writeFilePlugin(), + new webpack.WatchIgnorePlugin([ + utils.root('src/test'), + ]), + new WebpackNotifierPlugin({ + title: 'JHipster', + contentImage: path.join(__dirname, 'logo-jhipster.png') + }) + ].filter(Boolean), + mode: 'development' +}); diff --git a/jhipster/jhipster-uaa/gateway/webpack/webpack.prod.js b/jhipster/jhipster-uaa/gateway/webpack/webpack.prod.js new file mode 100644 index 0000000000..a9f9627772 --- /dev/null +++ b/jhipster/jhipster-uaa/gateway/webpack/webpack.prod.js @@ -0,0 +1,147 @@ +const webpack = require('webpack'); +const webpackMerge = require('webpack-merge'); +const MiniCssExtractPlugin = require('mini-css-extract-plugin'); +const OptimizeCSSAssetsPlugin = require("optimize-css-assets-webpack-plugin"); +const Visualizer = require('webpack-visualizer-plugin'); +const MomentLocalesPlugin = require('moment-locales-webpack-plugin'); +const TerserPlugin = require('terser-webpack-plugin'); +const WorkboxPlugin = require('workbox-webpack-plugin'); +const AngularCompilerPlugin = require('@ngtools/webpack').AngularCompilerPlugin; +const path = require('path'); + +const utils = require('./utils.js'); +const commonConfig = require('./webpack.common.js'); + +const ENV = 'production'; +const sass = require('sass'); + +module.exports = webpackMerge(commonConfig({ env: ENV }), { + // Enable source maps. Please note that this will slow down the build. + // You have to enable it in UglifyJSPlugin config below and in tsconfig-aot.json as well + // devtool: 'source-map', + entry: { + polyfills: './src/main/webapp/app/polyfills', + global: './src/main/webapp/content/scss/global.scss', + main: './src/main/webapp/app/app.main' + }, + output: { + path: utils.root('target/classes/public'), + filename: 'app/[name].[hash].bundle.js', + chunkFilename: 'app/[id].[hash].chunk.js' + }, + module: { + rules: [{ + test: /(?:\.ngfactory\.js|\.ngstyle\.js|\.ts)$/, + loader: '@ngtools/webpack' + }, + { + test: /\.scss$/, + use: ['to-string-loader', 'css-loader', { + loader: 'sass-loader', + options: { implementation: sass } + }], + exclude: /(vendor\.scss|global\.scss)/ + }, + { + test: /(vendor\.scss|global\.scss)/, + use: [ + MiniCssExtractPlugin.loader, + 'css-loader', + 'postcss-loader', + { + loader: 'sass-loader', + options: { implementation: sass } + } + ] + }, + { + test: /\.css$/, + use: ['to-string-loader', 'css-loader'], + exclude: /(vendor\.css|global\.css)/ + }, + { + test: /(vendor\.css|global\.css)/, + use: [ + MiniCssExtractPlugin.loader, + 'css-loader', + 'postcss-loader' + ] + }] + }, + optimization: { + runtimeChunk: false, + splitChunks: { + cacheGroups: { + commons: { + test: /[\\/]node_modules[\\/]/, + name: 'vendors', + chunks: 'all' + } + } + }, + minimizer: [ + new TerserPlugin({ + parallel: true, + cache: true, + terserOptions: { + ie8: false, + // sourceMap: true, // Enable source maps. Please note that this will slow down the build + compress: { + dead_code: true, + warnings: false, + properties: true, + drop_debugger: true, + conditionals: true, + booleans: true, + loops: true, + unused: true, + toplevel: true, + if_return: true, + inline: true, + join_vars: true + }, + output: { + comments: false, + beautify: false, + indent_level: 2 + } + } + }), + new OptimizeCSSAssetsPlugin({}) + ] + }, + plugins: [ + new MiniCssExtractPlugin({ + // Options similar to the same options in webpackOptions.output + // both options are optional + filename: '[name].[contenthash].css', + chunkFilename: '[id].css' + }), + new MomentLocalesPlugin({ + localesToKeep: [ + 'en', + 'fr', + 'pt-br' + // jhipster-needle-i18n-language-moment-webpack - JHipster will add/remove languages in this array + ] + }), + new Visualizer({ + // Webpack statistics in target folder + filename: '../stats.html' + }), + new AngularCompilerPlugin({ + mainPath: utils.root('src/main/webapp/app/app.main.ts'), + tsConfigPath: utils.root('tsconfig-aot.json'), + sourceMap: true + }), + new webpack.LoaderOptionsPlugin({ + minimize: true, + debug: false + }), + new WorkboxPlugin.GenerateSW({ + clientsClaim: true, + skipWaiting: true, + }) + ], + mode: 'production' +}); diff --git a/jhipster/jhipster-uaa/quotes/.editorconfig b/jhipster/jhipster-uaa/quotes/.editorconfig new file mode 100644 index 0000000000..a03599dd04 --- /dev/null +++ b/jhipster/jhipster-uaa/quotes/.editorconfig @@ -0,0 +1,24 @@ +# EditorConfig helps developers define and maintain consistent +# coding styles between different editors and IDEs +# editorconfig.org + +root = true + +[*] + +# Change these settings to your own preference +indent_style = space +indent_size = 4 + +# We recommend you to keep these unchanged +end_of_line = lf +charset = utf-8 +trim_trailing_whitespace = true +insert_final_newline = true + +[*.md] +trim_trailing_whitespace = false + +[{package,bower}.json] +indent_style = space +indent_size = 2 diff --git a/jhipster/jhipster-uaa/quotes/.gitattributes b/jhipster/jhipster-uaa/quotes/.gitattributes new file mode 100644 index 0000000000..8ab72fe637 --- /dev/null +++ b/jhipster/jhipster-uaa/quotes/.gitattributes @@ -0,0 +1,149 @@ +# This file is inspired by https://github.com/alexkaratarakis/gitattributes +# +# Auto detect text files and perform LF normalization +# http://davidlaing.com/2012/09/19/customise-your-gitattributes-to-become-a-git-ninja/ +* text=auto + +# The above will handle all files NOT found below +# These files are text and should be normalized (Convert crlf => lf) + +*.bat text eol=crlf +*.coffee text +*.css text +*.cql text +*.df text +*.ejs text +*.html text +*.java text +*.js text +*.json text +*.less text +*.properties text +*.sass text +*.scss text +*.sh text eol=lf +*.sql text +*.txt text +*.ts text +*.xml text +*.yaml text +*.yml text + +# Documents +*.doc diff=astextplain +*.DOC diff=astextplain +*.docx diff=astextplain +*.DOCX diff=astextplain +*.dot diff=astextplain +*.DOT diff=astextplain +*.pdf diff=astextplain +*.PDF diff=astextplain +*.rtf diff=astextplain +*.RTF diff=astextplain +*.markdown text +*.md text +*.adoc text +*.textile text +*.mustache text +*.csv text +*.tab text +*.tsv text +*.txt text +AUTHORS text +CHANGELOG text +CHANGES text +CONTRIBUTING text +COPYING text +copyright text +*COPYRIGHT* text +INSTALL text +license text +LICENSE text +NEWS text +readme text +*README* text +TODO text + +# Graphics +*.png binary +*.jpg binary +*.jpeg binary +*.gif binary +*.tif binary +*.tiff binary +*.ico binary +# SVG treated as an asset (binary) by default. If you want to treat it as text, +# comment-out the following line and uncomment the line after. +*.svg binary +#*.svg text +*.eps binary + +# These files are binary and should be left untouched +# (binary is a macro for -text -diff) +*.class binary +*.jar binary +*.war binary + +## LINTERS +.csslintrc text +.eslintrc text +.jscsrc text +.jshintrc text +.jshintignore text +.stylelintrc text + +## CONFIGS +*.bowerrc text +*.conf text +*.config text +.editorconfig text +.gitattributes text +.gitconfig text +.gitignore text +.htaccess text +*.npmignore text + +## HEROKU +Procfile text +.slugignore text + +## AUDIO +*.kar binary +*.m4a binary +*.mid binary +*.midi binary +*.mp3 binary +*.ogg binary +*.ra binary + +## VIDEO +*.3gpp binary +*.3gp binary +*.as binary +*.asf binary +*.asx binary +*.fla binary +*.flv binary +*.m4v binary +*.mng binary +*.mov binary +*.mp4 binary +*.mpeg binary +*.mpg binary +*.swc binary +*.swf binary +*.webm binary + +## ARCHIVES +*.7z binary +*.gz binary +*.rar binary +*.tar binary +*.zip binary + +## FONTS +*.ttf binary +*.eot binary +*.otf binary +*.woff binary +*.woff2 binary diff --git a/jhipster/jhipster-uaa/quotes/.gitignore b/jhipster/jhipster-uaa/quotes/.gitignore new file mode 100644 index 0000000000..e746b25ae6 --- /dev/null +++ b/jhipster/jhipster-uaa/quotes/.gitignore @@ -0,0 +1,144 @@ +###################### +# Project Specific +###################### +/target/www/** +/src/test/javascript/coverage/ + +###################### +# Node +###################### +/node/ +node_tmp/ +node_modules/ +npm-debug.log.* +/.awcache/* +/.cache-loader/* + +###################### +# SASS +###################### +.sass-cache/ + +###################### +# Eclipse +###################### +*.pydevproject +.project +.metadata +tmp/ +tmp/**/* +*.tmp +*.bak +*.swp +*~.nib +local.properties +.classpath +.settings/ +.loadpath +.factorypath +/src/main/resources/rebel.xml + +# External tool builders +.externalToolBuilders/** + +# Locally stored "Eclipse launch configurations" +*.launch + +# CDT-specific +.cproject + +# PDT-specific +.buildpath + +###################### +# Intellij +###################### +.idea/ +*.iml +*.iws +*.ipr +*.ids +*.orig +classes/ +out/ + +###################### +# Visual Studio Code +###################### +.vscode/ + +###################### +# Maven +###################### +/log/ +/target/ + +###################### +# Gradle +###################### +.gradle/ +/build/ + +###################### +# Package Files +###################### +*.jar +*.war +*.ear +*.db + +###################### +# Windows +###################### +# Windows image file caches +Thumbs.db + +# Folder config file +Desktop.ini + +###################### +# Mac OSX +###################### +.DS_Store +.svn + +# Thumbnails +._* + +# Files that might appear on external disk +.Spotlight-V100 +.Trashes + +###################### +# Directories +###################### +/bin/ +/deploy/ + +###################### +# Logs +###################### +*.log* + +###################### +# Others +###################### +*.class +*.*~ +*~ +.merge_file* + +###################### +# Gradle Wrapper +###################### +!gradle/wrapper/gradle-wrapper.jar + +###################### +# Maven Wrapper +###################### +!.mvn/wrapper/maven-wrapper.jar + +###################### +# ESLint +###################### +.eslintcache diff --git a/jhipster/jhipster-uaa/quotes/.jhipster/Quote.json b/jhipster/jhipster-uaa/quotes/.jhipster/Quote.json new file mode 100644 index 0000000000..a5305270a1 --- /dev/null +++ b/jhipster/jhipster-uaa/quotes/.jhipster/Quote.json @@ -0,0 +1,37 @@ +{ + "fluentMethods": true, + "clientRootFolder": "quotes", + "relationships": [], + "fields": [ + { + "fieldName": "symbol", + "fieldType": "String", + "fieldValidateRules": [ + "required", + "unique" + ] + }, + { + "fieldName": "price", + "fieldType": "BigDecimal", + "fieldValidateRules": [ + "required" + ] + }, + { + "fieldName": "lastTrade", + "fieldType": "ZonedDateTime", + "fieldValidateRules": [ + "required" + ] + } + ], + "changelogDate": "20181019033648", + "dto": "mapstruct", + "searchEngine": false, + "service": "serviceImpl", + "entityTableName": "quote", + "jpaMetamodelFiltering": true, + "pagination": "pagination", + "microserviceName": "quotes" +} diff --git a/jhipster/jhipster-uaa/quotes/.mvn/wrapper/MavenWrapperDownloader.java b/jhipster/jhipster-uaa/quotes/.mvn/wrapper/MavenWrapperDownloader.java new file mode 100644 index 0000000000..fa4f7b499f --- /dev/null +++ b/jhipster/jhipster-uaa/quotes/.mvn/wrapper/MavenWrapperDownloader.java @@ -0,0 +1,110 @@ +/* +Licensed to the Apache Software Foundation (ASF) under one +or more contributor license agreements. See the NOTICE file +distributed with this work for additional information +regarding copyright ownership. The ASF licenses this file +to you under the Apache License, Version 2.0 (the +"License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, +software distributed under the License is distributed on an +"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, either express or implied. See the License for the +specific language governing permissions and limitations +under the License. +*/ + +import java.net.*; +import java.io.*; +import java.nio.channels.*; +import java.util.Properties; + +public class MavenWrapperDownloader { + + /** + * Default URL to download the maven-wrapper.jar from, if no 'downloadUrl' is provided. + */ + private static final String DEFAULT_DOWNLOAD_URL = + "https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.4.2/maven-wrapper-0.4.2.jar"; + + /** + * Path to the maven-wrapper.properties file, which might contain a downloadUrl property to + * use instead of the default one. + */ + private static final String MAVEN_WRAPPER_PROPERTIES_PATH = + ".mvn/wrapper/maven-wrapper.properties"; + + /** + * Path where the maven-wrapper.jar will be saved to. + */ + private static final String MAVEN_WRAPPER_JAR_PATH = + ".mvn/wrapper/maven-wrapper.jar"; + + /** + * Name of the property which should be used to override the default download url for the wrapper. + */ + private static final String PROPERTY_NAME_WRAPPER_URL = "wrapperUrl"; + + public static void main(String args[]) { + System.out.println("- Downloader started"); + File baseDirectory = new File(args[0]); + System.out.println("- Using base directory: " + baseDirectory.getAbsolutePath()); + + // If the maven-wrapper.properties exists, read it and check if it contains a custom + // wrapperUrl parameter. + File mavenWrapperPropertyFile = new File(baseDirectory, MAVEN_WRAPPER_PROPERTIES_PATH); + String url = DEFAULT_DOWNLOAD_URL; + if(mavenWrapperPropertyFile.exists()) { + FileInputStream mavenWrapperPropertyFileInputStream = null; + try { + mavenWrapperPropertyFileInputStream = new FileInputStream(mavenWrapperPropertyFile); + Properties mavenWrapperProperties = new Properties(); + mavenWrapperProperties.load(mavenWrapperPropertyFileInputStream); + url = mavenWrapperProperties.getProperty(PROPERTY_NAME_WRAPPER_URL, url); + } catch (IOException e) { + System.out.println("- ERROR loading '" + MAVEN_WRAPPER_PROPERTIES_PATH + "'"); + } finally { + try { + if(mavenWrapperPropertyFileInputStream != null) { + mavenWrapperPropertyFileInputStream.close(); + } + } catch (IOException e) { + // Ignore ... + } + } + } + System.out.println("- Downloading from: : " + url); + + File outputFile = new File(baseDirectory.getAbsolutePath(), MAVEN_WRAPPER_JAR_PATH); + if(!outputFile.getParentFile().exists()) { + if(!outputFile.getParentFile().mkdirs()) { + System.out.println( + "- ERROR creating output direcrory '" + outputFile.getParentFile().getAbsolutePath() + "'"); + } + } + System.out.println("- Downloading to: " + outputFile.getAbsolutePath()); + try { + downloadFileFromURL(url, outputFile); + System.out.println("Done"); + System.exit(0); + } catch (Throwable e) { + System.out.println("- Error downloading"); + e.printStackTrace(); + System.exit(1); + } + } + + private static void downloadFileFromURL(String urlString, File destination) throws Exception { + URL website = new URL(urlString); + ReadableByteChannel rbc; + rbc = Channels.newChannel(website.openStream()); + FileOutputStream fos = new FileOutputStream(destination); + fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE); + fos.close(); + rbc.close(); + } + +} diff --git a/jhipster/jhipster-uaa/quotes/.mvn/wrapper/maven-wrapper.jar b/jhipster/jhipster-uaa/quotes/.mvn/wrapper/maven-wrapper.jar new file mode 100644 index 0000000000..01e6799737 Binary files /dev/null and b/jhipster/jhipster-uaa/quotes/.mvn/wrapper/maven-wrapper.jar differ diff --git a/jhipster/jhipster-uaa/quotes/.mvn/wrapper/maven-wrapper.properties b/jhipster/jhipster-uaa/quotes/.mvn/wrapper/maven-wrapper.properties new file mode 100644 index 0000000000..00d32aab1d --- /dev/null +++ b/jhipster/jhipster-uaa/quotes/.mvn/wrapper/maven-wrapper.properties @@ -0,0 +1 @@ +distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.5.4/apache-maven-3.5.4-bin.zip \ No newline at end of file diff --git a/jhipster/jhipster-uaa/quotes/.yo-rc.json b/jhipster/jhipster-uaa/quotes/.yo-rc.json new file mode 100644 index 0000000000..fb9c05f786 --- /dev/null +++ b/jhipster/jhipster-uaa/quotes/.yo-rc.json @@ -0,0 +1,38 @@ +{ + "generator-jhipster": { + "promptValues": { + "packageName": "com.baeldung.jhipster.quotes", + "nativeLanguage": "en" + }, + "jhipsterVersion": "5.4.2", + "applicationType": "microservice", + "baseName": "quotes", + "packageName": "com.baeldung.jhipster.quotes", + "packageFolder": "com/baeldung/jhipster/quotes", + "serverPort": "8081", + "authenticationType": "uaa", + "uaaBaseName": "uaa", + "cacheProvider": "hazelcast", + "enableHibernateCache": true, + "websocket": false, + "databaseType": "sql", + "devDatabaseType": "h2Disk", + "prodDatabaseType": "mysql", + "searchEngine": false, + "messageBroker": false, + "serviceDiscoveryType": "eureka", + "buildTool": "maven", + "enableSwaggerCodegen": false, + "jwtSecretKey": "YTQzODg4YTM4NDU3YTJjMDZiZDczYTI5NThmNGU5Y2Y4ZDcxMjUxMzI1MmI4MmQwM2RmMzYxMzVjYzljN2MzNjcyYjhiNzk3NTVhN2M2NjY1YjVhZjk1YTkyMTI0MGJlODczZDZkNzA5YjAxZThhMDMyMDFkMTgyZjBhYjJkM2Y=", + "enableTranslation": true, + "languages": [ + "en" + ], + "testFrameworks": [], + "jhiPrefix": "jhi", + "clientPackageManager": "npm", + "nativeLanguage": "en", + "skipClient": true, + "skipUserManagement": true + } +} \ No newline at end of file diff --git a/jhipster/jhipster-uaa/quotes/README.md b/jhipster/jhipster-uaa/quotes/README.md new file mode 100644 index 0000000000..7a985ae786 --- /dev/null +++ b/jhipster/jhipster-uaa/quotes/README.md @@ -0,0 +1,94 @@ +# quotes +This application was generated using JHipster 5.4.2, you can find documentation and help at [https://www.jhipster.tech/documentation-archive/v5.4.2](https://www.jhipster.tech/documentation-archive/v5.4.2). + +This is a "microservice" application intended to be part of a microservice architecture, please refer to the [Doing microservices with JHipster][] page of the documentation for more information. + +This application is configured for Service Discovery and Configuration with the JHipster-Registry. On launch, it will refuse to start if it is not able to connect to the JHipster-Registry at [http://localhost:8761](http://localhost:8761). For more information, read our documentation on [Service Discovery and Configuration with the JHipster-Registry][]. + +## Development + +To start your application in the dev profile, simply run: + + ./mvnw + + +For further instructions on how to develop with JHipster, have a look at [Using JHipster in development][]. + + + +## Building for production + +To optimize the quotes application for production, run: + + ./mvnw -Pprod clean package + +To ensure everything worked, run: + + java -jar target/*.war + + +Refer to [Using JHipster in production][] for more details. + +## Testing + +To launch your application's tests, run: + + ./mvnw clean test + +For more information, refer to the [Running tests page][]. + +### Code quality + +Sonar is used to analyse code quality. You can start a local Sonar server (accessible on http://localhost:9001) with: + +``` +docker-compose -f src/main/docker/sonar.yml up -d +``` + +Then, run a Sonar analysis: + +``` +./mvnw -Pprod clean test sonar:sonar +``` + +For more information, refer to the [Code quality page][]. + +## Using Docker to simplify development (optional) + +You can use Docker to improve your JHipster development experience. A number of docker-compose configuration are available in the [src/main/docker](src/main/docker) folder to launch required third party services. + +For example, to start a mysql database in a docker container, run: + + docker-compose -f src/main/docker/mysql.yml up -d + +To stop it and remove the container, run: + + docker-compose -f src/main/docker/mysql.yml down + +You can also fully dockerize your application and all the services that it depends on. +To achieve this, first build a docker image of your app by running: + + ./mvnw package -Pprod jib:dockerBuild + +Then run: + + docker-compose -f src/main/docker/app.yml up -d + +For more information refer to [Using Docker and Docker-Compose][], this page also contains information on the docker-compose sub-generator (`jhipster docker-compose`), which is able to generate docker configurations for one or several JHipster applications. + +## Continuous Integration (optional) + +To configure CI for your project, run the ci-cd sub-generator (`jhipster ci-cd`), this will let you generate configuration files for a number of Continuous Integration systems. Consult the [Setting up Continuous Integration][] page for more information. + +[JHipster Homepage and latest documentation]: https://www.jhipster.tech +[JHipster 5.4.2 archive]: https://www.jhipster.tech/documentation-archive/v5.4.2 +[Doing microservices with JHipster]: https://www.jhipster.tech/documentation-archive/v5.4.2/microservices-architecture/ +[Using JHipster in development]: https://www.jhipster.tech/documentation-archive/v5.4.2/development/ +[Service Discovery and Configuration with the JHipster-Registry]: https://www.jhipster.tech/documentation-archive/v5.4.2/microservices-architecture/#jhipster-registry +[Using Docker and Docker-Compose]: https://www.jhipster.tech/documentation-archive/v5.4.2/docker-compose +[Using JHipster in production]: https://www.jhipster.tech/documentation-archive/v5.4.2/production/ +[Running tests page]: https://www.jhipster.tech/documentation-archive/v5.4.2/running-tests/ +[Code quality page]: https://www.jhipster.tech/documentation-archive/v5.4.2/code-quality/ +[Setting up Continuous Integration]: https://www.jhipster.tech/documentation-archive/v5.4.2/setting-up-ci/ + + diff --git a/jhipster/jhipster-uaa/quotes/mvnw b/jhipster/jhipster-uaa/quotes/mvnw new file mode 100644 index 0000000000..5551fde8e7 --- /dev/null +++ b/jhipster/jhipster-uaa/quotes/mvnw @@ -0,0 +1,286 @@ +#!/bin/sh +# ---------------------------------------------------------------------------- +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# ---------------------------------------------------------------------------- + +# ---------------------------------------------------------------------------- +# Maven2 Start Up Batch script +# +# Required ENV vars: +# ------------------ +# JAVA_HOME - location of a JDK home dir +# +# Optional ENV vars +# ----------------- +# M2_HOME - location of maven2's installed home dir +# MAVEN_OPTS - parameters passed to the Java VM when running Maven +# e.g. to debug Maven itself, use +# set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 +# MAVEN_SKIP_RC - flag to disable loading of mavenrc files +# ---------------------------------------------------------------------------- + +if [ -z "$MAVEN_SKIP_RC" ] ; then + + if [ -f /etc/mavenrc ] ; then + . /etc/mavenrc + fi + + if [ -f "$HOME/.mavenrc" ] ; then + . "$HOME/.mavenrc" + fi + +fi + +# OS specific support. $var _must_ be set to either true or false. +cygwin=false; +darwin=false; +mingw=false +case "`uname`" in + CYGWIN*) cygwin=true ;; + MINGW*) mingw=true;; + Darwin*) darwin=true + # Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home + # See https://developer.apple.com/library/mac/qa/qa1170/_index.html + if [ -z "$JAVA_HOME" ]; then + if [ -x "/usr/libexec/java_home" ]; then + export JAVA_HOME="`/usr/libexec/java_home`" + else + export JAVA_HOME="/Library/Java/Home" + fi + fi + ;; +esac + +if [ -z "$JAVA_HOME" ] ; then + if [ -r /etc/gentoo-release ] ; then + JAVA_HOME=`java-config --jre-home` + fi +fi + +if [ -z "$M2_HOME" ] ; then + ## resolve links - $0 may be a link to maven's home + PRG="$0" + + # need this for relative symlinks + while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG="`dirname "$PRG"`/$link" + fi + done + + saveddir=`pwd` + + M2_HOME=`dirname "$PRG"`/.. + + # make it fully qualified + M2_HOME=`cd "$M2_HOME" && pwd` + + cd "$saveddir" + # echo Using m2 at $M2_HOME +fi + +# For Cygwin, ensure paths are in UNIX format before anything is touched +if $cygwin ; then + [ -n "$M2_HOME" ] && + M2_HOME=`cygpath --unix "$M2_HOME"` + [ -n "$JAVA_HOME" ] && + JAVA_HOME=`cygpath --unix "$JAVA_HOME"` + [ -n "$CLASSPATH" ] && + CLASSPATH=`cygpath --path --unix "$CLASSPATH"` +fi + +# For Mingw, ensure paths are in UNIX format before anything is touched +if $mingw ; then + [ -n "$M2_HOME" ] && + M2_HOME="`(cd "$M2_HOME"; pwd)`" + [ -n "$JAVA_HOME" ] && + JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`" + # TODO classpath? +fi + +if [ -z "$JAVA_HOME" ]; then + javaExecutable="`which javac`" + if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then + # readlink(1) is not available as standard on Solaris 10. + readLink=`which readlink` + if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then + if $darwin ; then + javaHome="`dirname \"$javaExecutable\"`" + javaExecutable="`cd \"$javaHome\" && pwd -P`/javac" + else + javaExecutable="`readlink -f \"$javaExecutable\"`" + fi + javaHome="`dirname \"$javaExecutable\"`" + javaHome=`expr "$javaHome" : '\(.*\)/bin'` + JAVA_HOME="$javaHome" + export JAVA_HOME + fi + fi +fi + +if [ -z "$JAVACMD" ] ; then + if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + else + JAVACMD="`which java`" + fi +fi + +if [ ! -x "$JAVACMD" ] ; then + echo "Error: JAVA_HOME is not defined correctly." >&2 + echo " We cannot execute $JAVACMD" >&2 + exit 1 +fi + +if [ -z "$JAVA_HOME" ] ; then + echo "Warning: JAVA_HOME environment variable is not set." +fi + +CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher + +# traverses directory structure from process work directory to filesystem root +# first directory with .mvn subdirectory is considered project base directory +find_maven_basedir() { + + if [ -z "$1" ] + then + echo "Path not specified to find_maven_basedir" + return 1 + fi + + basedir="$1" + wdir="$1" + while [ "$wdir" != '/' ] ; do + if [ -d "$wdir"/.mvn ] ; then + basedir=$wdir + break + fi + # workaround for JBEAP-8937 (on Solaris 10/Sparc) + if [ -d "${wdir}" ]; then + wdir=`cd "$wdir/.."; pwd` + fi + # end of workaround + done + echo "${basedir}" +} + +# concatenates all lines of a file +concat_lines() { + if [ -f "$1" ]; then + echo "$(tr -s '\n' ' ' < "$1")" + fi +} + +BASE_DIR=`find_maven_basedir "$(pwd)"` +if [ -z "$BASE_DIR" ]; then + exit 1; +fi + +########################################################################################## +# Extension to allow automatically downloading the maven-wrapper.jar from Maven-central +# This allows using the maven wrapper in projects that prohibit checking in binary data. +########################################################################################## +if [ -r "$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" ]; then + if [ "$MVNW_VERBOSE" = true ]; then + echo "Found .mvn/wrapper/maven-wrapper.jar" + fi +else + if [ "$MVNW_VERBOSE" = true ]; then + echo "Couldn't find .mvn/wrapper/maven-wrapper.jar, downloading it ..." + fi + jarUrl="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.4.2/maven-wrapper-0.4.2.jar" + while IFS="=" read key value; do + case "$key" in (wrapperUrl) jarUrl="$value"; break ;; + esac + done < "$BASE_DIR/.mvn/wrapper/maven-wrapper.properties" + if [ "$MVNW_VERBOSE" = true ]; then + echo "Downloading from: $jarUrl" + fi + wrapperJarPath="$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" + + if command -v wget > /dev/null; then + if [ "$MVNW_VERBOSE" = true ]; then + echo "Found wget ... using wget" + fi + wget "$jarUrl" -O "$wrapperJarPath" + elif command -v curl > /dev/null; then + if [ "$MVNW_VERBOSE" = true ]; then + echo "Found curl ... using curl" + fi + curl -o "$wrapperJarPath" "$jarUrl" + else + if [ "$MVNW_VERBOSE" = true ]; then + echo "Falling back to using Java to download" + fi + javaClass="$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.java" + if [ -e "$javaClass" ]; then + if [ ! -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then + if [ "$MVNW_VERBOSE" = true ]; then + echo " - Compiling MavenWrapperDownloader.java ..." + fi + # Compiling the Java class + ("$JAVA_HOME/bin/javac" "$javaClass") + fi + if [ -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then + # Running the downloader + if [ "$MVNW_VERBOSE" = true ]; then + echo " - Running MavenWrapperDownloader.java ..." + fi + ("$JAVA_HOME/bin/java" -cp .mvn/wrapper MavenWrapperDownloader "$MAVEN_PROJECTBASEDIR") + fi + fi + fi +fi +########################################################################################## +# End of extension +########################################################################################## + +export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"} +if [ "$MVNW_VERBOSE" = true ]; then + echo $MAVEN_PROJECTBASEDIR +fi +MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS" + +# For Cygwin, switch paths to Windows format before running java +if $cygwin; then + [ -n "$M2_HOME" ] && + M2_HOME=`cygpath --path --windows "$M2_HOME"` + [ -n "$JAVA_HOME" ] && + JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"` + [ -n "$CLASSPATH" ] && + CLASSPATH=`cygpath --path --windows "$CLASSPATH"` + [ -n "$MAVEN_PROJECTBASEDIR" ] && + MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"` +fi + +WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain + +exec "$JAVACMD" \ + $MAVEN_OPTS \ + -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \ + "-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \ + ${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@" diff --git a/jhipster/jhipster-uaa/quotes/mvnw.cmd b/jhipster/jhipster-uaa/quotes/mvnw.cmd new file mode 100644 index 0000000000..e5cfb0ae9e --- /dev/null +++ b/jhipster/jhipster-uaa/quotes/mvnw.cmd @@ -0,0 +1,161 @@ +@REM ---------------------------------------------------------------------------- +@REM Licensed to the Apache Software Foundation (ASF) under one +@REM or more contributor license agreements. See the NOTICE file +@REM distributed with this work for additional information +@REM regarding copyright ownership. The ASF licenses this file +@REM to you under the Apache License, Version 2.0 (the +@REM "License"); you may not use this file except in compliance +@REM with the License. You may obtain a copy of the License at +@REM +@REM http://www.apache.org/licenses/LICENSE-2.0 +@REM +@REM Unless required by applicable law or agreed to in writing, +@REM software distributed under the License is distributed on an +@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +@REM KIND, either express or implied. See the License for the +@REM specific language governing permissions and limitations +@REM under the License. +@REM ---------------------------------------------------------------------------- + +@REM ---------------------------------------------------------------------------- +@REM Maven2 Start Up Batch script +@REM +@REM Required ENV vars: +@REM JAVA_HOME - location of a JDK home dir +@REM +@REM Optional ENV vars +@REM M2_HOME - location of maven2's installed home dir +@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands +@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a key stroke before ending +@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven +@REM e.g. to debug Maven itself, use +@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 +@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files +@REM ---------------------------------------------------------------------------- + +@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on' +@echo off +@REM set title of command window +title %0 +@REM enable echoing my setting MAVEN_BATCH_ECHO to 'on' +@if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO% + +@REM set %HOME% to equivalent of $HOME +if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%") + +@REM Execute a user defined script before this one +if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre +@REM check for pre script, once with legacy .bat ending and once with .cmd ending +if exist "%HOME%\mavenrc_pre.bat" call "%HOME%\mavenrc_pre.bat" +if exist "%HOME%\mavenrc_pre.cmd" call "%HOME%\mavenrc_pre.cmd" +:skipRcPre + +@setlocal + +set ERROR_CODE=0 + +@REM To isolate internal variables from possible post scripts, we use another setlocal +@setlocal + +@REM ==== START VALIDATION ==== +if not "%JAVA_HOME%" == "" goto OkJHome + +echo. +echo Error: JAVA_HOME not found in your environment. >&2 +echo Please set the JAVA_HOME variable in your environment to match the >&2 +echo location of your Java installation. >&2 +echo. +goto error + +:OkJHome +if exist "%JAVA_HOME%\bin\java.exe" goto init + +echo. +echo Error: JAVA_HOME is set to an invalid directory. >&2 +echo JAVA_HOME = "%JAVA_HOME%" >&2 +echo Please set the JAVA_HOME variable in your environment to match the >&2 +echo location of your Java installation. >&2 +echo. +goto error + +@REM ==== END VALIDATION ==== + +:init + +@REM Find the project base dir, i.e. the directory that contains the folder ".mvn". +@REM Fallback to current working directory if not found. + +set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR% +IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir + +set EXEC_DIR=%CD% +set WDIR=%EXEC_DIR% +:findBaseDir +IF EXIST "%WDIR%"\.mvn goto baseDirFound +cd .. +IF "%WDIR%"=="%CD%" goto baseDirNotFound +set WDIR=%CD% +goto findBaseDir + +:baseDirFound +set MAVEN_PROJECTBASEDIR=%WDIR% +cd "%EXEC_DIR%" +goto endDetectBaseDir + +:baseDirNotFound +set MAVEN_PROJECTBASEDIR=%EXEC_DIR% +cd "%EXEC_DIR%" + +:endDetectBaseDir + +IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig + +@setlocal EnableExtensions EnableDelayedExpansion +for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a +@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS% + +:endReadAdditionalConfig + +SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe" +set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar" +set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain + +set DOWNLOAD_URL="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.4.2/maven-wrapper-0.4.2.jar" +FOR /F "tokens=1,2 delims==" %%A IN (%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties) DO ( + IF "%%A"=="wrapperUrl" SET DOWNLOAD_URL=%%B +) + +@REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central +@REM This allows using the maven wrapper in projects that prohibit checking in binary data. +if exist %WRAPPER_JAR% ( + echo Found %WRAPPER_JAR% +) else ( + echo Couldn't find %WRAPPER_JAR%, downloading it ... + echo Downloading from: %DOWNLOAD_URL% + powershell -Command "(New-Object Net.WebClient).DownloadFile('%DOWNLOAD_URL%', '%WRAPPER_JAR%')" + echo Finished downloading %WRAPPER_JAR% +) +@REM End of extension + +%MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %* +if ERRORLEVEL 1 goto error +goto end + +:error +set ERROR_CODE=1 + +:end +@endlocal & set ERROR_CODE=%ERROR_CODE% + +if not "%MAVEN_SKIP_RC%" == "" goto skipRcPost +@REM check for post script, once with legacy .bat ending and once with .cmd ending +if exist "%HOME%\mavenrc_post.bat" call "%HOME%\mavenrc_post.bat" +if exist "%HOME%\mavenrc_post.cmd" call "%HOME%\mavenrc_post.cmd" +:skipRcPost + +@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on' +if "%MAVEN_BATCH_PAUSE%" == "on" pause + +if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE% + +exit /B %ERROR_CODE% diff --git a/jhipster/jhipster-uaa/quotes/package-lock.json b/jhipster/jhipster-uaa/quotes/package-lock.json new file mode 100644 index 0000000000..aea41979a7 --- /dev/null +++ b/jhipster/jhipster-uaa/quotes/package-lock.json @@ -0,0 +1,4409 @@ +{ + "name": "quotes", + "version": "0.0.0", + "lockfileVersion": 1, + "requires": true, + "dependencies": { + "@mrmlnc/readdir-enhanced": { + "version": "2.2.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/@mrmlnc/readdir-enhanced/-/readdir-enhanced-2.2.1.tgz", + "integrity": "sha512-bPHp6Ji8b41szTOcaP63VlnbbO5Ny6dwAATtY6JTjh5N2OLrb5Qk/Th5cRkRQhkWCt+EJsYrNB0MiL+Gpn6e3g==", + "dev": true, + "requires": { + "call-me-maybe": "^1.0.1", + "glob-to-regexp": "^0.3.0" + } + }, + "@nodelib/fs.stat": { + "version": "1.1.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/@nodelib/fs.stat/-/fs.stat-1.1.2.tgz", + "integrity": "sha512-yprFYuno9FtNsSHVlSWd+nRlmGoAbqbeCwOryP6sC/zoCjhpArcRMYp19EvpSUSizJAlsXEwJv+wcWS9XaXdMw==", + "dev": true + }, + "ajv": { + "version": "5.5.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/ajv/-/ajv-5.5.2.tgz", + "integrity": "sha1-c7Xuyj+rZT49P5Qis0GtQiBdyWU=", + "dev": true, + "requires": { + "co": "^4.6.0", + "fast-deep-equal": "^1.0.0", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.3.0" + } + }, + "ansi": { + "version": "0.3.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/ansi/-/ansi-0.3.1.tgz", + "integrity": "sha1-DELU+xcWDVqa8eSEus4cZpIsGyE=", + "dev": true + }, + "ansi-cyan": { + "version": "0.1.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/ansi-cyan/-/ansi-cyan-0.1.1.tgz", + "integrity": "sha1-U4rlKK+JgvKK4w2G8vF0VtJgmHM=", + "dev": true, + "requires": { + "ansi-wrap": "0.1.0" + } + }, + "ansi-escapes": { + "version": "3.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/ansi-escapes/-/ansi-escapes-3.1.0.tgz", + "integrity": "sha512-UgAb8H9D41AQnu/PbWlCofQVcnV4Gs2bBJi9eZPxfU/hgglFh3SMDMENRIqdr7H6XFnXdoknctFByVsCOotTVw==", + "dev": true + }, + "ansi-red": { + "version": "0.1.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/ansi-red/-/ansi-red-0.1.1.tgz", + "integrity": "sha1-jGOPnRCAgAo1PJwoyKgcpHBdlGw=", + "dev": true, + "requires": { + "ansi-wrap": "0.1.0" + } + }, + "ansi-regex": { + "version": "3.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/ansi-regex/-/ansi-regex-3.0.0.tgz", + "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", + "dev": true + }, + "ansi-styles": { + "version": "3.2.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, + "requires": { + "color-convert": "^1.9.0" + } + }, + "ansi-wrap": { + "version": "0.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/ansi-wrap/-/ansi-wrap-0.1.0.tgz", + "integrity": "sha1-qCJQ3bABXponyoLoLqYDu/pF768=", + "dev": true + }, + "are-we-there-yet": { + "version": "1.1.5", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/are-we-there-yet/-/are-we-there-yet-1.1.5.tgz", + "integrity": "sha512-5hYdAkZlcG8tOLujVDTgCT+uPX0VnpAH28gWsLfzpXYm7wP6mp5Q/gYyR7YQ0cKVJcXJnl3j2kpBan13PtQf6w==", + "dev": true, + "requires": { + "delegates": "^1.0.0", + "readable-stream": "^2.0.6" + } + }, + "argparse": { + "version": "1.0.10", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/argparse/-/argparse-1.0.10.tgz", + "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", + "dev": true, + "requires": { + "sprintf-js": "~1.0.2" + } + }, + "arr-diff": { + "version": "1.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/arr-diff/-/arr-diff-1.1.0.tgz", + "integrity": "sha1-aHwydYFjWI/vfeezb6vklesaOZo=", + "dev": true, + "requires": { + "arr-flatten": "^1.0.1", + "array-slice": "^0.2.3" + } + }, + "arr-flatten": { + "version": "1.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/arr-flatten/-/arr-flatten-1.1.0.tgz", + "integrity": "sha512-L3hKV5R/p5o81R7O02IGnwpDmkp6E982XhtbuwSe3O4qOtMMMtodicASA1Cny2U+aCXcNpml+m4dPsvsJ3jatg==", + "dev": true + }, + "arr-union": { + "version": "2.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/arr-union/-/arr-union-2.1.0.tgz", + "integrity": "sha1-IPnqtexw9cfSFbEHexw5Fh0pLH0=", + "dev": true + }, + "array-differ": { + "version": "1.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/array-differ/-/array-differ-1.0.0.tgz", + "integrity": "sha1-7/UuN1gknTO+QCuLuOVkuytdQDE=", + "dev": true + }, + "array-find-index": { + "version": "1.0.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/array-find-index/-/array-find-index-1.0.2.tgz", + "integrity": "sha1-3wEKoSh+Fku9pvlyOwqWoexBh6E=", + "dev": true + }, + "array-slice": { + "version": "0.2.3", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/array-slice/-/array-slice-0.2.3.tgz", + "integrity": "sha1-3Tz7gO15c6dRF82sabC5nshhhvU=", + "dev": true + }, + "array-union": { + "version": "1.0.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/array-union/-/array-union-1.0.2.tgz", + "integrity": "sha1-mjRBDk9OPaI96jdb5b5w8kd47Dk=", + "dev": true, + "requires": { + "array-uniq": "^1.0.1" + } + }, + "array-uniq": { + "version": "1.0.3", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/array-uniq/-/array-uniq-1.0.3.tgz", + "integrity": "sha1-r2rId6Jcx/dOBYiUdThY39sk/bY=", + "dev": true + }, + "array-unique": { + "version": "0.3.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/array-unique/-/array-unique-0.3.2.tgz", + "integrity": "sha1-qJS3XUvE9s1nnvMkSp/Y9Gri1Cg=", + "dev": true + }, + "arrify": { + "version": "1.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/arrify/-/arrify-1.0.1.tgz", + "integrity": "sha1-iYUI2iIm84DfkEcoRWhJwVAaSw0=", + "dev": true + }, + "asn1": { + "version": "0.2.4", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/asn1/-/asn1-0.2.4.tgz", + "integrity": "sha512-jxwzQpLQjSmWXgwaCZE9Nz+glAG01yF1QnWgbhGwHI5A6FRIEY6IVqtHhIepHqI7/kyEyQEagBC5mBEFlIYvdg==", + "dev": true, + "requires": { + "safer-buffer": "~2.1.0" + } + }, + "assert-plus": { + "version": "1.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/assert-plus/-/assert-plus-1.0.0.tgz", + "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=", + "dev": true + }, + "assign-symbols": { + "version": "1.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/assign-symbols/-/assign-symbols-1.0.0.tgz", + "integrity": "sha1-WWZ/QfrdTyDMvCu5a41Pf3jsA2c=", + "dev": true + }, + "async": { + "version": "2.6.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/async/-/async-2.6.1.tgz", + "integrity": "sha512-fNEiL2+AZt6AlAw/29Cr0UDe4sRAHCpEHh54WMz+Bb7QfNcFw4h3loofyJpLeQs4Yx7yuqu/2dLgM5hKOs6HlQ==", + "dev": true, + "requires": { + "lodash": "^4.17.10" + } + }, + "asynckit": { + "version": "0.4.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/asynckit/-/asynckit-0.4.0.tgz", + "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=", + "dev": true + }, + "atob": { + "version": "2.1.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/atob/-/atob-2.1.2.tgz", + "integrity": "sha512-Wm6ukoaOGJi/73p/cl2GvLjTI5JM1k/O14isD73YML8StrH/7/lRFgmg8nICZgD3bZZvjwCGxtMOD3wWNAu8cg==", + "dev": true + }, + "aws-sign2": { + "version": "0.7.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/aws-sign2/-/aws-sign2-0.7.0.tgz", + "integrity": "sha1-tG6JCTSpWR8tL2+G1+ap8bP+dqg=", + "dev": true + }, + "aws4": { + "version": "1.8.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/aws4/-/aws4-1.8.0.tgz", + "integrity": "sha512-ReZxvNHIOv88FlT7rxcXIIC0fPt4KZqZbOlivyWtXLt8ESx84zd3kMC6iK5jVeS2qt+g7ftS7ye4fi06X5rtRQ==", + "dev": true + }, + "axios": { + "version": "0.18.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/axios/-/axios-0.18.0.tgz", + "integrity": "sha1-MtU+SFHv3AoRmTts0AB4nXDAUQI=", + "dev": true, + "requires": { + "follow-redirects": "^1.3.0", + "is-buffer": "^1.1.5" + } + }, + "balanced-match": { + "version": "1.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/balanced-match/-/balanced-match-1.0.0.tgz", + "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=", + "dev": true + }, + "base": { + "version": "0.11.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/base/-/base-0.11.2.tgz", + "integrity": "sha512-5T6P4xPgpp0YDFvSWwEZ4NoE3aM4QBQXDzmVbraCkFj8zHM+mba8SyqB5DbZWyR7mYHo6Y7BdQo3MoA4m0TeQg==", + "dev": true, + "requires": { + "cache-base": "^1.0.1", + "class-utils": "^0.3.5", + "component-emitter": "^1.2.1", + "define-property": "^1.0.0", + "isobject": "^3.0.1", + "mixin-deep": "^1.2.0", + "pascalcase": "^0.1.1" + }, + "dependencies": { + "define-property": { + "version": "1.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/define-property/-/define-property-1.0.0.tgz", + "integrity": "sha1-dp66rz9KY6rTr56NMEybvnm/sOY=", + "dev": true, + "requires": { + "is-descriptor": "^1.0.0" + } + }, + "is-accessor-descriptor": { + "version": "1.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz", + "integrity": "sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ==", + "dev": true, + "requires": { + "kind-of": "^6.0.0" + } + }, + "is-data-descriptor": { + "version": "1.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz", + "integrity": "sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ==", + "dev": true, + "requires": { + "kind-of": "^6.0.0" + } + }, + "is-descriptor": { + "version": "1.0.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/is-descriptor/-/is-descriptor-1.0.2.tgz", + "integrity": "sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg==", + "dev": true, + "requires": { + "is-accessor-descriptor": "^1.0.0", + "is-data-descriptor": "^1.0.0", + "kind-of": "^6.0.2" + } + }, + "kind-of": { + "version": "6.0.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/kind-of/-/kind-of-6.0.2.tgz", + "integrity": "sha512-s5kLOcnH0XqDO+FvuaLX8DDjZ18CGFk7VygH40QoKPUQhW4e2rvM0rwUq0t8IQDOwYSeLK01U90OjzBTme2QqA==", + "dev": true + } + } + }, + "bcrypt-pbkdf": { + "version": "1.0.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz", + "integrity": "sha1-pDAdOJtqQ/m2f/PKEaP2Y342Dp4=", + "dev": true, + "requires": { + "tweetnacl": "^0.14.3" + } + }, + "binaryextensions": { + "version": "2.1.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/binaryextensions/-/binaryextensions-2.1.1.tgz", + "integrity": "sha512-XBaoWE9RW8pPdPQNibZsW2zh8TW6gcarXp1FZPwT8Uop8ScSNldJEWf2k9l3HeTqdrEwsOsFcq74RiJECW34yA==", + "dev": true + }, + "brace-expansion": { + "version": "1.1.11", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dev": true, + "requires": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "braces": { + "version": "2.3.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/braces/-/braces-2.3.2.tgz", + "integrity": "sha512-aNdbnj9P8PjdXU4ybaWLK2IF3jc/EoDYbC7AazW6to3TRsfXxscC9UXOB5iDiEQrkyIbWp2SLQda4+QAa7nc3w==", + "dev": true, + "requires": { + "arr-flatten": "^1.1.0", + "array-unique": "^0.3.2", + "extend-shallow": "^2.0.1", + "fill-range": "^4.0.0", + "isobject": "^3.0.1", + "repeat-element": "^1.1.2", + "snapdragon": "^0.8.1", + "snapdragon-node": "^2.0.1", + "split-string": "^3.0.2", + "to-regex": "^3.0.1" + }, + "dependencies": { + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "dev": true, + "requires": { + "is-extendable": "^0.1.0" + } + } + } + }, + "buffer-alloc": { + "version": "1.2.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/buffer-alloc/-/buffer-alloc-1.2.0.tgz", + "integrity": "sha512-CFsHQgjtW1UChdXgbyJGtnm+O/uLQeZdtbDo8mfUgYXCHSM1wgrVxXm6bSyrUuErEb+4sYVGCzASBRot7zyrow==", + "dev": true, + "requires": { + "buffer-alloc-unsafe": "^1.1.0", + "buffer-fill": "^1.0.0" + } + }, + "buffer-alloc-unsafe": { + "version": "1.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/buffer-alloc-unsafe/-/buffer-alloc-unsafe-1.1.0.tgz", + "integrity": "sha512-TEM2iMIEQdJ2yjPJoSIsldnleVaAk1oW3DBVUykyOLsEsFmEc9kn+SFFPz+gl54KQNxlDnAwCXosOS9Okx2xAg==", + "dev": true + }, + "buffer-fill": { + "version": "1.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/buffer-fill/-/buffer-fill-1.0.0.tgz", + "integrity": "sha1-+PeLdniYiO858gXNY39o5wISKyw=", + "dev": true + }, + "buffer-from": { + "version": "1.1.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/buffer-from/-/buffer-from-1.1.1.tgz", + "integrity": "sha512-MQcXEUbCKtEo7bhqEs6560Hyd4XaovZlO/k9V3hjVUF/zwW7KBVdSK4gIt/bzwS9MbR5qob+F5jusZsb0YQK2A==", + "dev": true + }, + "builtin-modules": { + "version": "1.1.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/builtin-modules/-/builtin-modules-1.1.1.tgz", + "integrity": "sha1-Jw8HbFpywC9bZaR9+Uxf46J4iS8=", + "dev": true + }, + "cache-base": { + "version": "1.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/cache-base/-/cache-base-1.0.1.tgz", + "integrity": "sha512-AKcdTnFSWATd5/GCPRxr2ChwIJ85CeyrEyjRHlKxQ56d4XJMGym0uAiKn0xbLOGOl3+yRpOTi484dVCEc5AUzQ==", + "dev": true, + "requires": { + "collection-visit": "^1.0.0", + "component-emitter": "^1.2.1", + "get-value": "^2.0.6", + "has-value": "^1.0.0", + "isobject": "^3.0.1", + "set-value": "^2.0.0", + "to-object-path": "^0.3.0", + "union-value": "^1.0.0", + "unset-value": "^1.0.0" + } + }, + "call-me-maybe": { + "version": "1.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/call-me-maybe/-/call-me-maybe-1.0.1.tgz", + "integrity": "sha1-JtII6onje1y95gJQoV8DHBak1ms=", + "dev": true + }, + "camelcase": { + "version": "4.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/camelcase/-/camelcase-4.1.0.tgz", + "integrity": "sha1-1UVjW+HjPFQmScaRc+Xeas+uNN0=", + "dev": true + }, + "camelcase-keys": { + "version": "4.2.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/camelcase-keys/-/camelcase-keys-4.2.0.tgz", + "integrity": "sha1-oqpfsa9oh1glnDLBQUJteJI7m3c=", + "dev": true, + "requires": { + "camelcase": "^4.1.0", + "map-obj": "^2.0.0", + "quick-lru": "^1.0.0" + } + }, + "caseless": { + "version": "0.12.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/caseless/-/caseless-0.12.0.tgz", + "integrity": "sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw=", + "dev": true + }, + "chalk": { + "version": "2.4.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/chalk/-/chalk-2.4.1.tgz", + "integrity": "sha512-ObN6h1v2fTJSmUXoS3nMQ92LbDK9be4TV+6G+omQlGJFdcUX5heKi1LZ1YnRMIgwTLEj3E24bT6tYni50rlCfQ==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + } + }, + "chardet": { + "version": "0.4.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/chardet/-/chardet-0.4.2.tgz", + "integrity": "sha1-tUc7M9yXxCTl2Y3IfVXU2KKci/I=", + "dev": true + }, + "chevrotain": { + "version": "4.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/chevrotain/-/chevrotain-4.1.0.tgz", + "integrity": "sha512-iwuK4FOV+vZlvKonoXVw6G+rXJm4jWk17aJFkm6FloVYcVSrAaJLdCdQo+IIyX98jm0WJVcdK9cllRZQpNBnBg==", + "dev": true, + "requires": { + "regexp-to-ast": "0.3.5" + } + }, + "class-utils": { + "version": "0.3.6", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/class-utils/-/class-utils-0.3.6.tgz", + "integrity": "sha512-qOhPa/Fj7s6TY8H8esGu5QNpMMQxz79h+urzrNYN6mn+9BnxlDGf5QZ+XeCDsxSjPqsSR56XOZOJmpeurnLMeg==", + "dev": true, + "requires": { + "arr-union": "^3.1.0", + "define-property": "^0.2.5", + "isobject": "^3.0.0", + "static-extend": "^0.1.1" + }, + "dependencies": { + "arr-union": { + "version": "3.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/arr-union/-/arr-union-3.1.0.tgz", + "integrity": "sha1-45sJrqne+Gao8gbiiK9jkZuuOcQ=", + "dev": true + }, + "define-property": { + "version": "0.2.5", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/define-property/-/define-property-0.2.5.tgz", + "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", + "dev": true, + "requires": { + "is-descriptor": "^0.1.0" + } + } + } + }, + "cli-cursor": { + "version": "2.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/cli-cursor/-/cli-cursor-2.1.0.tgz", + "integrity": "sha1-s12sN2R5+sw+lHR9QdDQ9SOP/LU=", + "dev": true, + "requires": { + "restore-cursor": "^2.0.0" + } + }, + "cli-table": { + "version": "0.3.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/cli-table/-/cli-table-0.3.1.tgz", + "integrity": "sha1-9TsFJmqLGguTSz0IIebi3FkUriM=", + "dev": true, + "requires": { + "colors": "1.0.3" + }, + "dependencies": { + "colors": { + "version": "1.0.3", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/colors/-/colors-1.0.3.tgz", + "integrity": "sha1-BDP0TYCWgP3rYO0mDxsMJi6CpAs=", + "dev": true + } + } + }, + "cli-width": { + "version": "2.2.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/cli-width/-/cli-width-2.2.0.tgz", + "integrity": "sha1-/xnt6Kml5XkyQUewwR8PvLq+1jk=", + "dev": true + }, + "clone": { + "version": "1.0.4", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/clone/-/clone-1.0.4.tgz", + "integrity": "sha1-2jCcwmPfFZlMaIypAheco8fNfH4=", + "dev": true + }, + "clone-buffer": { + "version": "1.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/clone-buffer/-/clone-buffer-1.0.0.tgz", + "integrity": "sha1-4+JbIHrE5wGvch4staFnksrD3Fg=", + "dev": true + }, + "clone-stats": { + "version": "0.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/clone-stats/-/clone-stats-0.0.1.tgz", + "integrity": "sha1-uI+UqCzzi4eR1YBG6kAprYjKmdE=", + "dev": true + }, + "cloneable-readable": { + "version": "1.1.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/cloneable-readable/-/cloneable-readable-1.1.2.tgz", + "integrity": "sha512-Bq6+4t+lbM8vhTs/Bef5c5AdEMtapp/iFb6+s4/Hh9MVTt8OLKH7ZOOZSCT+Ys7hsHvqv0GuMPJ1lnQJVHvxpg==", + "dev": true, + "requires": { + "inherits": "^2.0.1", + "process-nextick-args": "^2.0.0", + "readable-stream": "^2.3.5" + } + }, + "co": { + "version": "4.6.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/co/-/co-4.6.0.tgz", + "integrity": "sha1-bqa989hTrlTMuOR7+gvz+QMfsYQ=", + "dev": true + }, + "code-point-at": { + "version": "1.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/code-point-at/-/code-point-at-1.1.0.tgz", + "integrity": "sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c=", + "dev": true + }, + "collection-visit": { + "version": "1.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/collection-visit/-/collection-visit-1.0.0.tgz", + "integrity": "sha1-S8A3PBZLwykbTTaMgpzxqApZ3KA=", + "dev": true, + "requires": { + "map-visit": "^1.0.0", + "object-visit": "^1.0.0" + } + }, + "color": { + "version": "3.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/color/-/color-3.0.0.tgz", + "integrity": "sha512-jCpd5+s0s0t7p3pHQKpnJ0TpQKKdleP71LWcA0aqiljpiuAkOSUFN/dyH8ZwF0hRmFlrIuRhufds1QyEP9EB+w==", + "dev": true, + "requires": { + "color-convert": "^1.9.1", + "color-string": "^1.5.2" + } + }, + "color-convert": { + "version": "1.9.3", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/color-convert/-/color-convert-1.9.3.tgz", + "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", + "dev": true, + "requires": { + "color-name": "1.1.3" + } + }, + "color-name": { + "version": "1.1.3", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/color-name/-/color-name-1.1.3.tgz", + "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=", + "dev": true + }, + "color-string": { + "version": "1.5.3", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/color-string/-/color-string-1.5.3.tgz", + "integrity": "sha512-dC2C5qeWoYkxki5UAXapdjqO672AM4vZuPGRQfO8b5HKuKGBbKWpITyDYN7TOFKvRW7kOgAn3746clDBMDJyQw==", + "dev": true, + "requires": { + "color-name": "^1.0.0", + "simple-swizzle": "^0.2.2" + } + }, + "colornames": { + "version": "1.1.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/colornames/-/colornames-1.1.1.tgz", + "integrity": "sha1-+IiQMGhcfE/54qVZ9Qd+t2qBb5Y=", + "dev": true + }, + "colors": { + "version": "1.3.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/colors/-/colors-1.3.2.tgz", + "integrity": "sha512-rhP0JSBGYvpcNQj4s5AdShMeE5ahMop96cTeDl/v9qQQm2fYClE2QXZRi8wLzc+GmXSxdIqqbOIAhyObEXDbfQ==", + "dev": true + }, + "colorspace": { + "version": "1.1.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/colorspace/-/colorspace-1.1.1.tgz", + "integrity": "sha512-pI3btWyiuz7Ken0BWh9Elzsmv2bM9AhA7psXib4anUXy/orfZ/E0MbQwhSOG/9L8hLlalqrU0UhOuqxW1YjmVw==", + "dev": true, + "requires": { + "color": "3.0.x", + "text-hex": "1.0.x" + } + }, + "combined-stream": { + "version": "1.0.7", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/combined-stream/-/combined-stream-1.0.7.tgz", + "integrity": "sha512-brWl9y6vOB1xYPZcpZde3N9zDByXTosAeMDo4p1wzo6UMOX4vumB+TP1RZ76sfE6Md68Q0NJSrE/gbezd4Ul+w==", + "dev": true, + "requires": { + "delayed-stream": "~1.0.0" + } + }, + "commander": { + "version": "2.16.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/commander/-/commander-2.16.0.tgz", + "integrity": "sha512-sVXqklSaotK9at437sFlFpyOcJonxe0yST/AG9DkQKUdIE6IqGIMv4SfAQSKaJbSdVEJYItASCrBiVQHq1HQew==", + "dev": true + }, + "commondir": { + "version": "1.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/commondir/-/commondir-1.0.1.tgz", + "integrity": "sha1-3dgA2gxmEnOTzKWVDqloo6rxJTs=", + "dev": true + }, + "component-emitter": { + "version": "1.2.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/component-emitter/-/component-emitter-1.2.1.tgz", + "integrity": "sha1-E3kY1teCg/ffemt8WmPhQOaUJeY=", + "dev": true + }, + "concat-map": { + "version": "0.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", + "dev": true + }, + "concat-stream": { + "version": "1.6.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/concat-stream/-/concat-stream-1.6.2.tgz", + "integrity": "sha512-27HBghJxjiZtIk3Ycvn/4kbJk/1uZuJFfuPEns6LaEvpvG1f0hTea8lilrouyo9mVc2GWdcEZ8OLoGmSADlrCw==", + "dev": true, + "requires": { + "buffer-from": "^1.0.0", + "inherits": "^2.0.3", + "readable-stream": "^2.2.2", + "typedarray": "^0.0.6" + } + }, + "conf": { + "version": "2.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/conf/-/conf-2.0.0.tgz", + "integrity": "sha512-iCLzBsGFi8S73EANsEJZz0JnJ/e5VZef/kSaxydYZLAvw0rFNAUx5R7K5leC/CXXR2mZfXWhUvcZOO/dM2D5xg==", + "dev": true, + "requires": { + "dot-prop": "^4.1.0", + "env-paths": "^1.0.0", + "make-dir": "^1.0.0", + "pkg-up": "^2.0.0", + "write-file-atomic": "^2.3.0" + } + }, + "copy-descriptor": { + "version": "0.1.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/copy-descriptor/-/copy-descriptor-0.1.1.tgz", + "integrity": "sha1-Z29us8OZl8LuGsOpJP1hJHSPV40=", + "dev": true + }, + "core-util-is": { + "version": "1.0.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/core-util-is/-/core-util-is-1.0.2.tgz", + "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=", + "dev": true + }, + "cross-spawn": { + "version": "5.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/cross-spawn/-/cross-spawn-5.1.0.tgz", + "integrity": "sha1-6L0O/uWPz/b4+UUQoKVUu/ojVEk=", + "dev": true, + "requires": { + "lru-cache": "^4.0.1", + "shebang-command": "^1.2.0", + "which": "^1.2.9" + } + }, + "currently-unhandled": { + "version": "0.4.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/currently-unhandled/-/currently-unhandled-0.4.1.tgz", + "integrity": "sha1-mI3zP+qxke95mmE2nddsF635V+o=", + "dev": true, + "requires": { + "array-find-index": "^1.0.1" + } + }, + "dargs": { + "version": "6.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/dargs/-/dargs-6.0.0.tgz", + "integrity": "sha512-6lJauzNaI7MiM8EHQWmGj+s3rP5/i1nYs8GAvKrLAx/9dpc9xS/4seFb1ioR39A+kcfu4v3jnEa/EE5qWYnitQ==", + "dev": true + }, + "dashdash": { + "version": "1.14.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/dashdash/-/dashdash-1.14.1.tgz", + "integrity": "sha1-hTz6D3y+L+1d4gMmuN1YEDX24vA=", + "dev": true, + "requires": { + "assert-plus": "^1.0.0" + } + }, + "dateformat": { + "version": "3.0.3", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/dateformat/-/dateformat-3.0.3.tgz", + "integrity": "sha512-jyCETtSl3VMZMWeRo7iY1FL19ges1t55hMo5yaam4Jrsm5EPL89UQkoQRyiI+Yf4k8r2ZpdngkV8hr1lIdjb3Q==", + "dev": true + }, + "debug": { + "version": "3.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/debug/-/debug-3.1.0.tgz", + "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", + "dev": true, + "requires": { + "ms": "2.0.0" + } + }, + "decamelize": { + "version": "1.2.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/decamelize/-/decamelize-1.2.0.tgz", + "integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=", + "dev": true + }, + "decamelize-keys": { + "version": "1.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/decamelize-keys/-/decamelize-keys-1.1.0.tgz", + "integrity": "sha1-0XGoeTMlKAfrPLYdwcFEXQeN8tk=", + "dev": true, + "requires": { + "decamelize": "^1.1.0", + "map-obj": "^1.0.0" + }, + "dependencies": { + "map-obj": { + "version": "1.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/map-obj/-/map-obj-1.0.1.tgz", + "integrity": "sha1-2TPOuSBdgr3PSIb2dCvcK03qFG0=", + "dev": true + } + } + }, + "decode-uri-component": { + "version": "0.2.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/decode-uri-component/-/decode-uri-component-0.2.0.tgz", + "integrity": "sha1-6zkTMzRYd1y4TNGh+uBiEGu4dUU=", + "dev": true + }, + "decompress-response": { + "version": "3.3.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/decompress-response/-/decompress-response-3.3.0.tgz", + "integrity": "sha1-gKTdMjdIOEv6JICDYirt7Jgq3/M=", + "dev": true, + "requires": { + "mimic-response": "^1.0.0" + } + }, + "deep-extend": { + "version": "0.6.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/deep-extend/-/deep-extend-0.6.0.tgz", + "integrity": "sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA==", + "dev": true + }, + "define-property": { + "version": "2.0.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/define-property/-/define-property-2.0.2.tgz", + "integrity": "sha512-jwK2UV4cnPpbcG7+VRARKTZPUWowwXA8bzH5NP6ud0oeAxyYPuGZUAC7hMugpCdz4BeSZl2Dl9k66CHJ/46ZYQ==", + "dev": true, + "requires": { + "is-descriptor": "^1.0.2", + "isobject": "^3.0.1" + }, + "dependencies": { + "is-accessor-descriptor": { + "version": "1.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz", + "integrity": "sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ==", + "dev": true, + "requires": { + "kind-of": "^6.0.0" + } + }, + "is-data-descriptor": { + "version": "1.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz", + "integrity": "sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ==", + "dev": true, + "requires": { + "kind-of": "^6.0.0" + } + }, + "is-descriptor": { + "version": "1.0.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/is-descriptor/-/is-descriptor-1.0.2.tgz", + "integrity": "sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg==", + "dev": true, + "requires": { + "is-accessor-descriptor": "^1.0.0", + "is-data-descriptor": "^1.0.0", + "kind-of": "^6.0.2" + } + }, + "kind-of": { + "version": "6.0.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/kind-of/-/kind-of-6.0.2.tgz", + "integrity": "sha512-s5kLOcnH0XqDO+FvuaLX8DDjZ18CGFk7VygH40QoKPUQhW4e2rvM0rwUq0t8IQDOwYSeLK01U90OjzBTme2QqA==", + "dev": true + } + } + }, + "delayed-stream": { + "version": "1.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/delayed-stream/-/delayed-stream-1.0.0.tgz", + "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=", + "dev": true + }, + "delegates": { + "version": "1.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/delegates/-/delegates-1.0.0.tgz", + "integrity": "sha1-hMbhWbgZBP3KWaDvRM2HDTElD5o=", + "dev": true + }, + "detect-conflict": { + "version": "1.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/detect-conflict/-/detect-conflict-1.0.1.tgz", + "integrity": "sha1-CIZXpmqWHAUBnbfEIwiDsca0F24=", + "dev": true + }, + "diagnostics": { + "version": "1.1.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/diagnostics/-/diagnostics-1.1.1.tgz", + "integrity": "sha512-8wn1PmdunLJ9Tqbx+Fx/ZEuHfJf4NKSN2ZBj7SJC/OWRWha843+WsTjqMe1B5E3p28jqBlp+mJ2fPVxPyNgYKQ==", + "dev": true, + "requires": { + "colorspace": "1.1.x", + "enabled": "1.0.x", + "kuler": "1.0.x" + } + }, + "didyoumean": { + "version": "1.2.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/didyoumean/-/didyoumean-1.2.1.tgz", + "integrity": "sha1-6S7f2tplN9SE1zwBcv0eugxJdv8=", + "dev": true + }, + "diff": { + "version": "3.5.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/diff/-/diff-3.5.0.tgz", + "integrity": "sha512-A46qtFgd+g7pDZinpnwiRJtxbC1hpgf0uzP3iG89scHk0AUC7A1TGxf5OiiOUv/JMZR8GOt8hL900hV0bOy5xA==", + "dev": true + }, + "dir-glob": { + "version": "2.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/dir-glob/-/dir-glob-2.0.0.tgz", + "integrity": "sha512-37qirFDz8cA5fimp9feo43fSuRo2gHwaIn6dXL8Ber1dGwUosDrGZeCCXq57WnIqE4aQ+u3eQZzsk1yOzhdwag==", + "dev": true, + "requires": { + "arrify": "^1.0.1", + "path-type": "^3.0.0" + } + }, + "dot-prop": { + "version": "4.2.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/dot-prop/-/dot-prop-4.2.0.tgz", + "integrity": "sha512-tUMXrxlExSW6U2EXiiKGSBVdYgtV8qlHL+C10TsW4PURY/ic+eaysnSkwB4kA/mBlCyy/IKDJ+Lc3wbWeaXtuQ==", + "dev": true, + "requires": { + "is-obj": "^1.0.0" + } + }, + "drange": { + "version": "1.1.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/drange/-/drange-1.1.1.tgz", + "integrity": "sha512-pYxfDYpued//QpnLIm4Avk7rsNtAtQkUES2cwAYSvD/wd2pKD71gN2Ebj3e7klzXwjocvE8c5vx/1fxwpqmSxA==", + "dev": true + }, + "duplexer3": { + "version": "0.1.4", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/duplexer3/-/duplexer3-0.1.4.tgz", + "integrity": "sha1-7gHdHKwO08vH/b6jfcCo8c4ALOI=", + "dev": true + }, + "ecc-jsbn": { + "version": "0.1.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz", + "integrity": "sha1-OoOpBOVDUyh4dMVkt1SThoSamMk=", + "dev": true, + "requires": { + "jsbn": "~0.1.0", + "safer-buffer": "^2.1.0" + } + }, + "editions": { + "version": "1.3.4", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/editions/-/editions-1.3.4.tgz", + "integrity": "sha512-gzao+mxnYDzIysXKMQi/+M1mjy/rjestjg6OPoYTtI+3Izp23oiGZitsl9lPDPiTGXbcSIk1iJWhliSaglxnUg==", + "dev": true + }, + "ejs": { + "version": "2.6.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/ejs/-/ejs-2.6.1.tgz", + "integrity": "sha512-0xy4A/twfrRCnkhfk8ErDi5DqdAsAqeGxht4xkCUrsvhhbQNs7E+4jV0CN7+NKIY0aHE72+XvqtBIXzD31ZbXQ==", + "dev": true + }, + "enabled": { + "version": "1.0.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/enabled/-/enabled-1.0.2.tgz", + "integrity": "sha1-ll9lE9LC0cX0ZStkouM5ZGf8L5M=", + "dev": true, + "requires": { + "env-variable": "0.0.x" + } + }, + "env-paths": { + "version": "1.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/env-paths/-/env-paths-1.0.0.tgz", + "integrity": "sha1-QWgTO0K7BcOKNbGuQ5fIKYqzaeA=", + "dev": true + }, + "env-variable": { + "version": "0.0.5", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/env-variable/-/env-variable-0.0.5.tgz", + "integrity": "sha512-zoB603vQReOFvTg5xMl9I1P2PnHsHQQKTEowsKKD7nseUfJq6UWzK+4YtlWUO1nhiQUxe6XMkk+JleSZD1NZFA==", + "dev": true + }, + "error": { + "version": "7.0.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/error/-/error-7.0.2.tgz", + "integrity": "sha1-pfdf/02ZJhJt2sDqXcOOaJFTywI=", + "dev": true, + "requires": { + "string-template": "~0.2.1", + "xtend": "~4.0.0" + } + }, + "error-ex": { + "version": "1.3.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/error-ex/-/error-ex-1.3.2.tgz", + "integrity": "sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g==", + "dev": true, + "requires": { + "is-arrayish": "^0.2.1" + }, + "dependencies": { + "is-arrayish": { + "version": "0.2.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/is-arrayish/-/is-arrayish-0.2.1.tgz", + "integrity": "sha1-d8mYQFJ6qOyxqLppe4BkWnqSap0=", + "dev": true + } + } + }, + "escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=", + "dev": true + }, + "esprima": { + "version": "4.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/esprima/-/esprima-4.0.1.tgz", + "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==", + "dev": true + }, + "execa": { + "version": "0.7.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/execa/-/execa-0.7.0.tgz", + "integrity": "sha1-lEvs00zEHuMqY6n68nrVpl/Fl3c=", + "dev": true, + "requires": { + "cross-spawn": "^5.0.1", + "get-stream": "^3.0.0", + "is-stream": "^1.1.0", + "npm-run-path": "^2.0.0", + "p-finally": "^1.0.0", + "signal-exit": "^3.0.0", + "strip-eof": "^1.0.0" + } + }, + "exit-hook": { + "version": "1.1.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/exit-hook/-/exit-hook-1.1.1.tgz", + "integrity": "sha1-8FyiM7SMBdVP/wd2XfhQfpXAL/g=", + "dev": true + }, + "expand-brackets": { + "version": "2.1.4", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/expand-brackets/-/expand-brackets-2.1.4.tgz", + "integrity": "sha1-t3c14xXOMPa27/D4OwQVGiJEliI=", + "dev": true, + "requires": { + "debug": "^2.3.3", + "define-property": "^0.2.5", + "extend-shallow": "^2.0.1", + "posix-character-classes": "^0.1.0", + "regex-not": "^1.0.0", + "snapdragon": "^0.8.1", + "to-regex": "^3.0.1" + }, + "dependencies": { + "debug": { + "version": "2.6.9", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "dev": true, + "requires": { + "ms": "2.0.0" + } + }, + "define-property": { + "version": "0.2.5", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/define-property/-/define-property-0.2.5.tgz", + "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", + "dev": true, + "requires": { + "is-descriptor": "^0.1.0" + } + }, + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "dev": true, + "requires": { + "is-extendable": "^0.1.0" + } + } + } + }, + "extend": { + "version": "3.0.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/extend/-/extend-3.0.2.tgz", + "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==", + "dev": true + }, + "extend-shallow": { + "version": "1.1.4", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/extend-shallow/-/extend-shallow-1.1.4.tgz", + "integrity": "sha1-Gda/lN/AnXa6cR85uHLSH/TdkHE=", + "dev": true, + "requires": { + "kind-of": "^1.1.0" + } + }, + "external-editor": { + "version": "2.2.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/external-editor/-/external-editor-2.2.0.tgz", + "integrity": "sha512-bSn6gvGxKt+b7+6TKEv1ZycHleA7aHhRHyAqJyp5pbUFuYYNIzpZnQDk7AsYckyWdEnTeAnay0aCy2aV6iTk9A==", + "dev": true, + "requires": { + "chardet": "^0.4.0", + "iconv-lite": "^0.4.17", + "tmp": "^0.0.33" + } + }, + "extglob": { + "version": "2.0.4", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/extglob/-/extglob-2.0.4.tgz", + "integrity": "sha512-Nmb6QXkELsuBr24CJSkilo6UHHgbekK5UiZgfE6UHD3Eb27YC6oD+bhcT+tJ6cl8dmsgdQxnWlcry8ksBIBLpw==", + "dev": true, + "requires": { + "array-unique": "^0.3.2", + "define-property": "^1.0.0", + "expand-brackets": "^2.1.4", + "extend-shallow": "^2.0.1", + "fragment-cache": "^0.2.1", + "regex-not": "^1.0.0", + "snapdragon": "^0.8.1", + "to-regex": "^3.0.1" + }, + "dependencies": { + "define-property": { + "version": "1.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/define-property/-/define-property-1.0.0.tgz", + "integrity": "sha1-dp66rz9KY6rTr56NMEybvnm/sOY=", + "dev": true, + "requires": { + "is-descriptor": "^1.0.0" + } + }, + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "dev": true, + "requires": { + "is-extendable": "^0.1.0" + } + }, + "is-accessor-descriptor": { + "version": "1.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz", + "integrity": "sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ==", + "dev": true, + "requires": { + "kind-of": "^6.0.0" + } + }, + "is-data-descriptor": { + "version": "1.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz", + "integrity": "sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ==", + "dev": true, + "requires": { + "kind-of": "^6.0.0" + } + }, + "is-descriptor": { + "version": "1.0.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/is-descriptor/-/is-descriptor-1.0.2.tgz", + "integrity": "sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg==", + "dev": true, + "requires": { + "is-accessor-descriptor": "^1.0.0", + "is-data-descriptor": "^1.0.0", + "kind-of": "^6.0.2" + } + }, + "kind-of": { + "version": "6.0.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/kind-of/-/kind-of-6.0.2.tgz", + "integrity": "sha512-s5kLOcnH0XqDO+FvuaLX8DDjZ18CGFk7VygH40QoKPUQhW4e2rvM0rwUq0t8IQDOwYSeLK01U90OjzBTme2QqA==", + "dev": true + } + } + }, + "extsprintf": { + "version": "1.3.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/extsprintf/-/extsprintf-1.3.0.tgz", + "integrity": "sha1-lpGEQOMEGnpBT4xS48V06zw+HgU=", + "dev": true + }, + "fast-deep-equal": { + "version": "1.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/fast-deep-equal/-/fast-deep-equal-1.1.0.tgz", + "integrity": "sha1-wFNHeBfIa1HaqFPIHgWbcz0CNhQ=", + "dev": true + }, + "fast-glob": { + "version": "2.2.3", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/fast-glob/-/fast-glob-2.2.3.tgz", + "integrity": "sha512-NiX+JXjnx43RzvVFwRWfPKo4U+1BrK5pJPsHQdKMlLoFHrrGktXglQhHliSihWAq+m1z6fHk3uwGHrtRbS9vLA==", + "dev": true, + "requires": { + "@mrmlnc/readdir-enhanced": "^2.2.1", + "@nodelib/fs.stat": "^1.0.1", + "glob-parent": "^3.1.0", + "is-glob": "^4.0.0", + "merge2": "^1.2.1", + "micromatch": "^3.1.10" + } + }, + "fast-json-stable-stringify": { + "version": "2.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz", + "integrity": "sha1-1RQsDK7msRifh9OnYREGT4bIu/I=", + "dev": true + }, + "fast-safe-stringify": { + "version": "2.0.6", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/fast-safe-stringify/-/fast-safe-stringify-2.0.6.tgz", + "integrity": "sha512-q8BZ89jjc+mz08rSxROs8VsrBBcn1SIw1kq9NjolL509tkABRk9io01RAjSaEv1Xb2uFLt8VtRiZbGp5H8iDtg==", + "dev": true + }, + "fecha": { + "version": "2.3.3", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/fecha/-/fecha-2.3.3.tgz", + "integrity": "sha512-lUGBnIamTAwk4znq5BcqsDaxSmZ9nDVJaij6NvRt/Tg4R69gERA+otPKbS86ROw9nxVMw2/mp1fnaiWqbs6Sdg==", + "dev": true + }, + "figures": { + "version": "2.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/figures/-/figures-2.0.0.tgz", + "integrity": "sha1-OrGi0qYsi/tDGgyUy3l6L84nyWI=", + "dev": true, + "requires": { + "escape-string-regexp": "^1.0.5" + } + }, + "fill-range": { + "version": "4.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/fill-range/-/fill-range-4.0.0.tgz", + "integrity": "sha1-1USBHUKPmOsGpj3EAtJAPDKMOPc=", + "dev": true, + "requires": { + "extend-shallow": "^2.0.1", + "is-number": "^3.0.0", + "repeat-string": "^1.6.1", + "to-regex-range": "^2.1.0" + }, + "dependencies": { + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "dev": true, + "requires": { + "is-extendable": "^0.1.0" + } + } + } + }, + "find-up": { + "version": "2.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/find-up/-/find-up-2.1.0.tgz", + "integrity": "sha1-RdG35QbHF93UgndaK3eSCjwMV6c=", + "dev": true, + "requires": { + "locate-path": "^2.0.0" + } + }, + "first-chunk-stream": { + "version": "2.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/first-chunk-stream/-/first-chunk-stream-2.0.0.tgz", + "integrity": "sha1-G97NuOCDwGZLkZRVgVd6Q6nzHXA=", + "dev": true, + "requires": { + "readable-stream": "^2.0.2" + } + }, + "follow-redirects": { + "version": "1.5.9", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/follow-redirects/-/follow-redirects-1.5.9.tgz", + "integrity": "sha512-Bh65EZI/RU8nx0wbYF9shkFZlqLP+6WT/5FnA3cE/djNSuKNHJEinGGZgu/cQEkeeb2GdFOgenAmn8qaqYke2w==", + "dev": true, + "requires": { + "debug": "=3.1.0" + } + }, + "for-in": { + "version": "1.0.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/for-in/-/for-in-1.0.2.tgz", + "integrity": "sha1-gQaNKVqBQuwKxybG4iAMMPttXoA=", + "dev": true + }, + "forever-agent": { + "version": "0.6.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/forever-agent/-/forever-agent-0.6.1.tgz", + "integrity": "sha1-+8cfDEGt6zf5bFd60e1C2P2sypE=", + "dev": true + }, + "form-data": { + "version": "2.3.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/form-data/-/form-data-2.3.2.tgz", + "integrity": "sha1-SXBJi+YEwgwAXU9cI67NIda0kJk=", + "dev": true, + "requires": { + "asynckit": "^0.4.0", + "combined-stream": "1.0.6", + "mime-types": "^2.1.12" + }, + "dependencies": { + "combined-stream": { + "version": "1.0.6", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/combined-stream/-/combined-stream-1.0.6.tgz", + "integrity": "sha1-cj599ugBrFYTETp+RFqbactjKBg=", + "dev": true, + "requires": { + "delayed-stream": "~1.0.0" + } + } + } + }, + "fragment-cache": { + "version": "0.2.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/fragment-cache/-/fragment-cache-0.2.1.tgz", + "integrity": "sha1-QpD60n8T6Jvn8zeZxrxaCr//DRk=", + "dev": true, + "requires": { + "map-cache": "^0.2.2" + } + }, + "fs-extra": { + "version": "7.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/fs-extra/-/fs-extra-7.0.0.tgz", + "integrity": "sha512-EglNDLRpmaTWiD/qraZn6HREAEAHJcJOmxNEYwq6xeMKnVMAy3GUcFB+wXt2C6k4CNvB/mP1y/U3dzvKKj5OtQ==", + "dev": true, + "requires": { + "graceful-fs": "^4.1.2", + "jsonfile": "^4.0.0", + "universalify": "^0.1.0" + } + }, + "fs.realpath": { + "version": "1.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", + "dev": true + }, + "gauge": { + "version": "1.2.7", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/gauge/-/gauge-1.2.7.tgz", + "integrity": "sha1-6c7FSD09TuDvRLYKfZnkk14TbZM=", + "dev": true, + "requires": { + "ansi": "^0.3.0", + "has-unicode": "^2.0.0", + "lodash.pad": "^4.1.0", + "lodash.padend": "^4.1.0", + "lodash.padstart": "^4.1.0" + } + }, + "generator-jhipster": { + "version": "5.4.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/generator-jhipster/-/generator-jhipster-5.4.2.tgz", + "integrity": "sha512-iuTZGPonlMFWrabTC7x27UnCa8sckWFKD7HiwMp2JOYLlLU+BPt0WJWlQ9hJv5JHHx+pe0pUxwEHbi0fSu0Ljw==", + "dev": true, + "requires": { + "axios": "0.18.0", + "chalk": "2.4.1", + "commander": "2.16.0", + "conf": "2.0.0", + "didyoumean": "1.2.1", + "ejs": "2.6.1", + "glob": "7.1.2", + "gulp-filter": "5.1.0", + "insight": "0.10.1", + "jhipster-core": "3.4.0", + "js-object-pretty-print": "0.3.0", + "js-yaml": "3.12.0", + "lodash": "4.17.10", + "meow": "5.0.0", + "mkdirp": "0.5.1", + "os-locale": "2.1.0", + "parse-gitignore": "1.0.1", + "pluralize": "7.0.0", + "prettier": "1.13.7", + "randexp": "0.4.9", + "semver": "5.5.0", + "shelljs": "0.8.2", + "tabtab": "2.2.2", + "through2": "2.0.3", + "uuid": "3.3.2", + "yeoman-environment": "2.3.0", + "yeoman-generator": "3.0.0" + } + }, + "get-stream": { + "version": "3.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/get-stream/-/get-stream-3.0.0.tgz", + "integrity": "sha1-jpQ9E1jcN1VQVOy+LtsFqhdO3hQ=", + "dev": true + }, + "get-value": { + "version": "2.0.6", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/get-value/-/get-value-2.0.6.tgz", + "integrity": "sha1-3BXKHGcjh8p2vTesCjlbogQqLCg=", + "dev": true + }, + "getpass": { + "version": "0.1.7", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/getpass/-/getpass-0.1.7.tgz", + "integrity": "sha1-Xv+OPmhNVprkyysSgmBOi6YhSfo=", + "dev": true, + "requires": { + "assert-plus": "^1.0.0" + } + }, + "gh-got": { + "version": "6.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/gh-got/-/gh-got-6.0.0.tgz", + "integrity": "sha512-F/mS+fsWQMo1zfgG9MD8KWvTWPPzzhuVwY++fhQ5Ggd+0P+CAMHtzMZhNxG+TqGfHDChJKsbh6otfMGqO2AKBw==", + "dev": true, + "requires": { + "got": "^7.0.0", + "is-plain-obj": "^1.1.0" + } + }, + "github-username": { + "version": "4.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/github-username/-/github-username-4.1.0.tgz", + "integrity": "sha1-y+KABBiDIG2kISrp5LXxacML9Bc=", + "dev": true, + "requires": { + "gh-got": "^6.0.0" + } + }, + "glob": { + "version": "7.1.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/glob/-/glob-7.1.2.tgz", + "integrity": "sha512-MJTUg1kjuLeQCJ+ccE4Vpa6kKVXkPYJ2mOCQyUuKLcLQsdrMCpBPUi8qVE6+YuaJkozeA9NusTAw3hLr8Xe5EQ==", + "dev": true, + "requires": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + } + }, + "glob-parent": { + "version": "3.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/glob-parent/-/glob-parent-3.1.0.tgz", + "integrity": "sha1-nmr2KZ2NO9K9QEMIMr0RPfkGxa4=", + "dev": true, + "requires": { + "is-glob": "^3.1.0", + "path-dirname": "^1.0.0" + }, + "dependencies": { + "is-glob": { + "version": "3.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/is-glob/-/is-glob-3.1.0.tgz", + "integrity": "sha1-e6WuJCF4BKxwcHuWkiVnSGzD6Eo=", + "dev": true, + "requires": { + "is-extglob": "^2.1.0" + } + } + } + }, + "glob-to-regexp": { + "version": "0.3.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/glob-to-regexp/-/glob-to-regexp-0.3.0.tgz", + "integrity": "sha1-jFoUlNIGbFcMw7/kSWF1rMTVAqs=", + "dev": true + }, + "globby": { + "version": "8.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/globby/-/globby-8.0.1.tgz", + "integrity": "sha512-oMrYrJERnKBLXNLVTqhm3vPEdJ/b2ZE28xN4YARiix1NOIOBPEpOUnm844K1iu/BkphCaf2WNFwMszv8Soi1pw==", + "dev": true, + "requires": { + "array-union": "^1.0.1", + "dir-glob": "^2.0.0", + "fast-glob": "^2.0.2", + "glob": "^7.1.2", + "ignore": "^3.3.5", + "pify": "^3.0.0", + "slash": "^1.0.0" + } + }, + "got": { + "version": "7.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/got/-/got-7.1.0.tgz", + "integrity": "sha512-Y5WMo7xKKq1muPsxD+KmrR8DH5auG7fBdDVueZwETwV6VytKyU9OX/ddpq2/1hp1vIPvVb4T81dKQz3BivkNLw==", + "dev": true, + "requires": { + "decompress-response": "^3.2.0", + "duplexer3": "^0.1.4", + "get-stream": "^3.0.0", + "is-plain-obj": "^1.1.0", + "is-retry-allowed": "^1.0.0", + "is-stream": "^1.0.0", + "isurl": "^1.0.0-alpha5", + "lowercase-keys": "^1.0.0", + "p-cancelable": "^0.3.0", + "p-timeout": "^1.1.1", + "safe-buffer": "^5.0.1", + "timed-out": "^4.0.0", + "url-parse-lax": "^1.0.0", + "url-to-options": "^1.0.1" + } + }, + "graceful-fs": { + "version": "4.1.11", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/graceful-fs/-/graceful-fs-4.1.11.tgz", + "integrity": "sha1-Dovf5NHduIVNZOBOp8AOKgJuVlg=", + "dev": true + }, + "grouped-queue": { + "version": "0.3.3", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/grouped-queue/-/grouped-queue-0.3.3.tgz", + "integrity": "sha1-wWfSpTGcWg4JZO9qJbfC34mWyFw=", + "dev": true, + "requires": { + "lodash": "^4.17.2" + } + }, + "gulp-filter": { + "version": "5.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/gulp-filter/-/gulp-filter-5.1.0.tgz", + "integrity": "sha1-oF4Rr/sHz33PQafeHLe2OsN4PnM=", + "dev": true, + "requires": { + "multimatch": "^2.0.0", + "plugin-error": "^0.1.2", + "streamfilter": "^1.0.5" + } + }, + "har-schema": { + "version": "2.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/har-schema/-/har-schema-2.0.0.tgz", + "integrity": "sha1-qUwiJOvKwEeCoNkDVSHyRzW37JI=", + "dev": true + }, + "har-validator": { + "version": "5.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/har-validator/-/har-validator-5.1.0.tgz", + "integrity": "sha512-+qnmNjI4OfH2ipQ9VQOw23bBd/ibtfbVdK2fYbY4acTDqKTW/YDp9McimZdDbG8iV9fZizUqQMD5xvriB146TA==", + "dev": true, + "requires": { + "ajv": "^5.3.0", + "har-schema": "^2.0.0" + } + }, + "has-ansi": { + "version": "2.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/has-ansi/-/has-ansi-2.0.0.tgz", + "integrity": "sha1-NPUEnOHs3ysGSa8+8k5F7TVBbZE=", + "dev": true, + "requires": { + "ansi-regex": "^2.0.0" + }, + "dependencies": { + "ansi-regex": { + "version": "2.1.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/ansi-regex/-/ansi-regex-2.1.1.tgz", + "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=", + "dev": true + } + } + }, + "has-flag": { + "version": "3.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", + "dev": true + }, + "has-symbol-support-x": { + "version": "1.4.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/has-symbol-support-x/-/has-symbol-support-x-1.4.2.tgz", + "integrity": "sha512-3ToOva++HaW+eCpgqZrCfN51IPB+7bJNVT6CUATzueB5Heb8o6Nam0V3HG5dlDvZU1Gn5QLcbahiKw/XVk5JJw==", + "dev": true + }, + "has-to-string-tag-x": { + "version": "1.4.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/has-to-string-tag-x/-/has-to-string-tag-x-1.4.1.tgz", + "integrity": "sha512-vdbKfmw+3LoOYVr+mtxHaX5a96+0f3DljYd8JOqvOLsf5mw2Otda2qCDT9qRqLAhrjyQ0h7ual5nOiASpsGNFw==", + "dev": true, + "requires": { + "has-symbol-support-x": "^1.4.1" + } + }, + "has-unicode": { + "version": "2.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/has-unicode/-/has-unicode-2.0.1.tgz", + "integrity": "sha1-4Ob+aijPUROIVeCG0Wkedx3iqLk=", + "dev": true + }, + "has-value": { + "version": "1.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/has-value/-/has-value-1.0.0.tgz", + "integrity": "sha1-GLKB2lhbHFxR3vJMkw7SmgvmsXc=", + "dev": true, + "requires": { + "get-value": "^2.0.6", + "has-values": "^1.0.0", + "isobject": "^3.0.0" + } + }, + "has-values": { + "version": "1.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/has-values/-/has-values-1.0.0.tgz", + "integrity": "sha1-lbC2P+whRmGab+V/51Yo1aOe/k8=", + "dev": true, + "requires": { + "is-number": "^3.0.0", + "kind-of": "^4.0.0" + }, + "dependencies": { + "kind-of": { + "version": "4.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/kind-of/-/kind-of-4.0.0.tgz", + "integrity": "sha1-IIE989cSkosgc3hpGkUGb65y3Vc=", + "dev": true, + "requires": { + "is-buffer": "^1.1.5" + } + } + } + }, + "hosted-git-info": { + "version": "2.7.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/hosted-git-info/-/hosted-git-info-2.7.1.tgz", + "integrity": "sha512-7T/BxH19zbcCTa8XkMlbK5lTo1WtgkFi3GvdWEyNuc4Vex7/9Dqbnpsf4JMydcfj9HCg4zUWFTL3Za6lapg5/w==", + "dev": true + }, + "http-signature": { + "version": "1.2.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/http-signature/-/http-signature-1.2.0.tgz", + "integrity": "sha1-muzZJRFHcvPZW2WmCruPfBj7rOE=", + "dev": true, + "requires": { + "assert-plus": "^1.0.0", + "jsprim": "^1.2.2", + "sshpk": "^1.7.0" + } + }, + "iconv-lite": { + "version": "0.4.24", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/iconv-lite/-/iconv-lite-0.4.24.tgz", + "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", + "dev": true, + "requires": { + "safer-buffer": ">= 2.1.2 < 3" + } + }, + "ignore": { + "version": "3.3.10", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/ignore/-/ignore-3.3.10.tgz", + "integrity": "sha512-Pgs951kaMm5GXP7MOvxERINe3gsaVjUWFm+UZPSq9xYriQAksyhg0csnS0KXSNRD5NmNdapXEpjxG49+AKh/ug==", + "dev": true + }, + "imurmurhash": { + "version": "0.1.4", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/imurmurhash/-/imurmurhash-0.1.4.tgz", + "integrity": "sha1-khi5srkoojixPcT7a21XbyMUU+o=", + "dev": true + }, + "indent-string": { + "version": "3.2.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/indent-string/-/indent-string-3.2.0.tgz", + "integrity": "sha1-Sl/W0nzDMvN+VBmlBNu4NxBckok=", + "dev": true + }, + "inflight": { + "version": "1.0.6", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", + "dev": true, + "requires": { + "once": "^1.3.0", + "wrappy": "1" + } + }, + "inherits": { + "version": "2.0.3", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/inherits/-/inherits-2.0.3.tgz", + "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=", + "dev": true + }, + "inquirer": { + "version": "5.2.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/inquirer/-/inquirer-5.2.0.tgz", + "integrity": "sha512-E9BmnJbAKLPGonz0HeWHtbKf+EeSP93paWO3ZYoUpq/aowXvYGjjCSuashhXPpzbArIjBbji39THkxTz9ZeEUQ==", + "dev": true, + "requires": { + "ansi-escapes": "^3.0.0", + "chalk": "^2.0.0", + "cli-cursor": "^2.1.0", + "cli-width": "^2.0.0", + "external-editor": "^2.1.0", + "figures": "^2.0.0", + "lodash": "^4.3.0", + "mute-stream": "0.0.7", + "run-async": "^2.2.0", + "rxjs": "^5.5.2", + "string-width": "^2.1.0", + "strip-ansi": "^4.0.0", + "through": "^2.3.6" + } + }, + "insight": { + "version": "0.10.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/insight/-/insight-0.10.1.tgz", + "integrity": "sha512-kLGeYQkh18f8KuC68QKdi0iwUcIaayJVB/STpX7x452/7pAUm1yfG4giJwcxbrTh0zNYtc8kBR+6maLMOzglOQ==", + "dev": true, + "requires": { + "async": "^2.1.4", + "chalk": "^2.3.0", + "conf": "^1.3.1", + "inquirer": "^5.0.0", + "lodash.debounce": "^4.0.8", + "os-name": "^2.0.1", + "request": "^2.74.0", + "tough-cookie": "^2.0.0", + "uuid": "^3.0.0" + }, + "dependencies": { + "conf": { + "version": "1.4.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/conf/-/conf-1.4.0.tgz", + "integrity": "sha512-bzlVWS2THbMetHqXKB8ypsXN4DQ/1qopGwNJi1eYbpwesJcd86FBjFciCQX/YwAhp9bM7NVnPFqZ5LpV7gP0Dg==", + "dev": true, + "requires": { + "dot-prop": "^4.1.0", + "env-paths": "^1.0.0", + "make-dir": "^1.0.0", + "pkg-up": "^2.0.0", + "write-file-atomic": "^2.3.0" + } + } + } + }, + "interpret": { + "version": "1.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/interpret/-/interpret-1.1.0.tgz", + "integrity": "sha1-ftGxQQxqDg94z5XTuEQMY/eLhhQ=", + "dev": true + }, + "invert-kv": { + "version": "1.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/invert-kv/-/invert-kv-1.0.0.tgz", + "integrity": "sha1-EEqOSqym09jNFXqO+L+rLXo//bY=", + "dev": true + }, + "is-accessor-descriptor": { + "version": "0.1.6", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/is-accessor-descriptor/-/is-accessor-descriptor-0.1.6.tgz", + "integrity": "sha1-qeEss66Nh2cn7u84Q/igiXtcmNY=", + "dev": true, + "requires": { + "kind-of": "^3.0.2" + }, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true, + "requires": { + "is-buffer": "^1.1.5" + } + } + } + }, + "is-arrayish": { + "version": "0.3.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/is-arrayish/-/is-arrayish-0.3.2.tgz", + "integrity": "sha512-eVRqCvVlZbuw3GrM63ovNSNAeA1K16kaR/LRY/92w0zxQ5/1YzwblUX652i4Xs9RwAGjW9d9y6X88t8OaAJfWQ==", + "dev": true + }, + "is-buffer": { + "version": "1.1.6", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/is-buffer/-/is-buffer-1.1.6.tgz", + "integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==", + "dev": true + }, + "is-builtin-module": { + "version": "1.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/is-builtin-module/-/is-builtin-module-1.0.0.tgz", + "integrity": "sha1-VAVy0096wxGfj3bDDLwbHgN6/74=", + "dev": true, + "requires": { + "builtin-modules": "^1.0.0" + } + }, + "is-data-descriptor": { + "version": "0.1.4", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/is-data-descriptor/-/is-data-descriptor-0.1.4.tgz", + "integrity": "sha1-C17mSDiOLIYCgueT8YVv7D8wG1Y=", + "dev": true, + "requires": { + "kind-of": "^3.0.2" + }, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true, + "requires": { + "is-buffer": "^1.1.5" + } + } + } + }, + "is-descriptor": { + "version": "0.1.6", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/is-descriptor/-/is-descriptor-0.1.6.tgz", + "integrity": "sha512-avDYr0SB3DwO9zsMov0gKCESFYqCnE4hq/4z3TdUlukEy5t9C0YRq7HLrsN52NAcqXKaepeCD0n+B0arnVG3Hg==", + "dev": true, + "requires": { + "is-accessor-descriptor": "^0.1.6", + "is-data-descriptor": "^0.1.4", + "kind-of": "^5.0.0" + }, + "dependencies": { + "kind-of": { + "version": "5.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/kind-of/-/kind-of-5.1.0.tgz", + "integrity": "sha512-NGEErnH6F2vUuXDh+OlbcKW7/wOcfdRHaZ7VWtqCztfHri/++YKmP51OdWeGPuqCOba6kk2OTe5d02VmTB80Pw==", + "dev": true + } + } + }, + "is-extendable": { + "version": "0.1.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/is-extendable/-/is-extendable-0.1.1.tgz", + "integrity": "sha1-YrEQ4omkcUGOPsNqYX1HLjAd/Ik=", + "dev": true + }, + "is-extglob": { + "version": "2.1.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/is-extglob/-/is-extglob-2.1.1.tgz", + "integrity": "sha1-qIwCU1eR8C7TfHahueqXc8gz+MI=", + "dev": true + }, + "is-fullwidth-code-point": { + "version": "2.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", + "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", + "dev": true + }, + "is-glob": { + "version": "4.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/is-glob/-/is-glob-4.0.0.tgz", + "integrity": "sha1-lSHHaEXMJhCoUgPd8ICpWML/q8A=", + "dev": true, + "requires": { + "is-extglob": "^2.1.1" + } + }, + "is-number": { + "version": "3.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/is-number/-/is-number-3.0.0.tgz", + "integrity": "sha1-JP1iAaR4LPUFYcgQJ2r8fRLXEZU=", + "dev": true, + "requires": { + "kind-of": "^3.0.2" + }, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true, + "requires": { + "is-buffer": "^1.1.5" + } + } + } + }, + "is-obj": { + "version": "1.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/is-obj/-/is-obj-1.0.1.tgz", + "integrity": "sha1-PkcprB9f3gJc19g6iW2rn09n2w8=", + "dev": true + }, + "is-object": { + "version": "1.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/is-object/-/is-object-1.0.1.tgz", + "integrity": "sha1-iVJojF7C/9awPsyF52ngKQMINHA=", + "dev": true + }, + "is-plain-obj": { + "version": "1.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/is-plain-obj/-/is-plain-obj-1.1.0.tgz", + "integrity": "sha1-caUMhCnfync8kqOQpKA7OfzVHT4=", + "dev": true + }, + "is-plain-object": { + "version": "2.0.4", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/is-plain-object/-/is-plain-object-2.0.4.tgz", + "integrity": "sha512-h5PpgXkWitc38BBMYawTYMWJHFZJVnBquFE57xFpjB8pJFiF6gZ+bU+WyI/yqXiFR5mdLsgYNaPe8uao6Uv9Og==", + "dev": true, + "requires": { + "isobject": "^3.0.1" + } + }, + "is-promise": { + "version": "2.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/is-promise/-/is-promise-2.1.0.tgz", + "integrity": "sha1-eaKp7OfwlugPNtKy87wWwf9L8/o=", + "dev": true + }, + "is-retry-allowed": { + "version": "1.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/is-retry-allowed/-/is-retry-allowed-1.1.0.tgz", + "integrity": "sha1-EaBgVotnM5REAz0BJaYaINVk+zQ=", + "dev": true + }, + "is-scoped": { + "version": "1.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/is-scoped/-/is-scoped-1.0.0.tgz", + "integrity": "sha1-RJypgpnnEwOCViieyytUDcQ3yzA=", + "dev": true, + "requires": { + "scoped-regex": "^1.0.0" + } + }, + "is-stream": { + "version": "1.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/is-stream/-/is-stream-1.1.0.tgz", + "integrity": "sha1-EtSj3U5o4Lec6428hBc66A2RykQ=", + "dev": true + }, + "is-typedarray": { + "version": "1.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/is-typedarray/-/is-typedarray-1.0.0.tgz", + "integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=", + "dev": true + }, + "is-utf8": { + "version": "0.2.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/is-utf8/-/is-utf8-0.2.1.tgz", + "integrity": "sha1-Sw2hRCEE0bM2NA6AeX6GXPOffXI=", + "dev": true + }, + "is-windows": { + "version": "1.0.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/is-windows/-/is-windows-1.0.2.tgz", + "integrity": "sha512-eXK1UInq2bPmjyX6e3VHIzMLobc4J94i4AWn+Hpq3OU5KkrRC96OAcR3PRJ/pGu6m8TRnBHP9dkXQVsT/COVIA==", + "dev": true + }, + "isarray": { + "version": "1.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/isarray/-/isarray-1.0.0.tgz", + "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", + "dev": true + }, + "isbinaryfile": { + "version": "3.0.3", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/isbinaryfile/-/isbinaryfile-3.0.3.tgz", + "integrity": "sha512-8cJBL5tTd2OS0dM4jz07wQd5g0dCCqIhUxPIGtZfa5L6hWlvV5MHTITy/DBAsF+Oe2LS1X3krBUhNwaGUWpWxw==", + "dev": true, + "requires": { + "buffer-alloc": "^1.2.0" + } + }, + "isexe": { + "version": "2.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=", + "dev": true + }, + "isobject": { + "version": "3.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/isobject/-/isobject-3.0.1.tgz", + "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", + "dev": true + }, + "isstream": { + "version": "0.1.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/isstream/-/isstream-0.1.2.tgz", + "integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo=", + "dev": true + }, + "istextorbinary": { + "version": "2.2.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/istextorbinary/-/istextorbinary-2.2.1.tgz", + "integrity": "sha512-TS+hoFl8Z5FAFMK38nhBkdLt44CclNRgDHWeMgsV8ko3nDlr/9UI2Sf839sW7enijf8oKsZYXRvM8g0it9Zmcw==", + "dev": true, + "requires": { + "binaryextensions": "2", + "editions": "^1.3.3", + "textextensions": "2" + } + }, + "isurl": { + "version": "1.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/isurl/-/isurl-1.0.0.tgz", + "integrity": "sha512-1P/yWsxPlDtn7QeRD+ULKQPaIaN6yF368GZ2vDfv0AL0NwpStafjWCDDdn0k8wgFMWpVAqG7oJhxHnlud42i9w==", + "dev": true, + "requires": { + "has-to-string-tag-x": "^1.2.0", + "is-object": "^1.0.1" + } + }, + "jhipster-core": { + "version": "3.4.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/jhipster-core/-/jhipster-core-3.4.0.tgz", + "integrity": "sha512-iVJ6MF4jlpvtVL5gbn9t4Jw27RodjY04SXYSGfTLAzHyQRMmehHLvNq/3DBjVwHgBrDn1u2k17oLGouJus9MhA==", + "dev": true, + "requires": { + "chevrotain": "4.1.0", + "fs-extra": "7.0.0", + "lodash": "4.17.11", + "winston": "3.1.0" + }, + "dependencies": { + "lodash": { + "version": "4.17.11", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/lodash/-/lodash-4.17.11.tgz", + "integrity": "sha512-cQKh8igo5QUhZ7lg38DYWAxMvjSAKG0A8wGSVimP07SIUEK2UO+arSRKbRZWtelMtN5V0Hkwh5ryOto/SshYIg==", + "dev": true + } + } + }, + "js-object-pretty-print": { + "version": "0.3.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/js-object-pretty-print/-/js-object-pretty-print-0.3.0.tgz", + "integrity": "sha1-RnDkUAZu4ezPNRdMfRl/WqOLz3Q=", + "dev": true + }, + "js-yaml": { + "version": "3.12.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/js-yaml/-/js-yaml-3.12.0.tgz", + "integrity": "sha512-PIt2cnwmPfL4hKNwqeiuz4bKfnzHTBv6HyVgjahA6mPLwPDzjDWrplJBMjHUFxku/N3FlmrbyPclad+I+4mJ3A==", + "dev": true, + "requires": { + "argparse": "^1.0.7", + "esprima": "^4.0.0" + } + }, + "jsbn": { + "version": "0.1.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/jsbn/-/jsbn-0.1.1.tgz", + "integrity": "sha1-peZUwuWi3rXyAdls77yoDA7y9RM=", + "dev": true + }, + "json-parse-better-errors": { + "version": "1.0.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/json-parse-better-errors/-/json-parse-better-errors-1.0.2.tgz", + "integrity": "sha512-mrqyZKfX5EhL7hvqcV6WG1yYjnjeuYDzDhhcAAUrq8Po85NBQBJP+ZDUT75qZQ98IkUoBqdkExkukOU7Ts2wrw==", + "dev": true + }, + "json-schema": { + "version": "0.2.3", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/json-schema/-/json-schema-0.2.3.tgz", + "integrity": "sha1-tIDIkuWaLwWVTOcnvT8qTogvnhM=", + "dev": true + }, + "json-schema-traverse": { + "version": "0.3.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/json-schema-traverse/-/json-schema-traverse-0.3.1.tgz", + "integrity": "sha1-NJptRMU6Ud6JtAgFxdXlm0F9M0A=", + "dev": true + }, + "json-stringify-safe": { + "version": "5.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", + "integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus=", + "dev": true + }, + "jsonfile": { + "version": "4.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/jsonfile/-/jsonfile-4.0.0.tgz", + "integrity": "sha1-h3Gq4HmbZAdrdmQPygWPnBDjPss=", + "dev": true, + "requires": { + "graceful-fs": "^4.1.6" + } + }, + "jsprim": { + "version": "1.4.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/jsprim/-/jsprim-1.4.1.tgz", + "integrity": "sha1-MT5mvB5cwG5Di8G3SZwuXFastqI=", + "dev": true, + "requires": { + "assert-plus": "1.0.0", + "extsprintf": "1.3.0", + "json-schema": "0.2.3", + "verror": "1.10.0" + } + }, + "kind-of": { + "version": "1.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/kind-of/-/kind-of-1.1.0.tgz", + "integrity": "sha1-FAo9LUGjbS78+pN3tiwk+ElaXEQ=", + "dev": true + }, + "kuler": { + "version": "1.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/kuler/-/kuler-1.0.1.tgz", + "integrity": "sha512-J9nVUucG1p/skKul6DU3PUZrhs0LPulNaeUOox0IyXDi8S4CztTHs1gQphhuZmzXG7VOQSf6NJfKuzteQLv9gQ==", + "dev": true, + "requires": { + "colornames": "^1.1.1" + } + }, + "lcid": { + "version": "1.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/lcid/-/lcid-1.0.0.tgz", + "integrity": "sha1-MIrMr6C8SDo4Z7S28rlQYlHRuDU=", + "dev": true, + "requires": { + "invert-kv": "^1.0.0" + } + }, + "load-json-file": { + "version": "4.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/load-json-file/-/load-json-file-4.0.0.tgz", + "integrity": "sha1-L19Fq5HjMhYjT9U62rZo607AmTs=", + "dev": true, + "requires": { + "graceful-fs": "^4.1.2", + "parse-json": "^4.0.0", + "pify": "^3.0.0", + "strip-bom": "^3.0.0" + } + }, + "locate-path": { + "version": "2.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/locate-path/-/locate-path-2.0.0.tgz", + "integrity": "sha1-K1aLJl7slExtnA3pw9u7ygNUzY4=", + "dev": true, + "requires": { + "p-locate": "^2.0.0", + "path-exists": "^3.0.0" + } + }, + "lodash": { + "version": "4.17.10", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/lodash/-/lodash-4.17.10.tgz", + "integrity": "sha512-UejweD1pDoXu+AD825lWwp4ZGtSwgnpZxb3JDViD7StjQz+Nb/6l093lx4OQ0foGWNRoc19mWy7BzL+UAK2iVg==", + "dev": true + }, + "lodash.debounce": { + "version": "4.0.8", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/lodash.debounce/-/lodash.debounce-4.0.8.tgz", + "integrity": "sha1-gteb/zCmfEAF/9XiUVMArZyk168=", + "dev": true + }, + "lodash.difference": { + "version": "4.5.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/lodash.difference/-/lodash.difference-4.5.0.tgz", + "integrity": "sha1-nMtOUF1Ia5FlE0V3KIWi3yf9AXw=", + "dev": true + }, + "lodash.pad": { + "version": "4.5.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/lodash.pad/-/lodash.pad-4.5.1.tgz", + "integrity": "sha1-QzCUmoM6fI2iLMIPaibE1Z3runA=", + "dev": true + }, + "lodash.padend": { + "version": "4.6.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/lodash.padend/-/lodash.padend-4.6.1.tgz", + "integrity": "sha1-U8y6BH0G4VjTEfRdpiX05J5vFm4=", + "dev": true + }, + "lodash.padstart": { + "version": "4.6.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/lodash.padstart/-/lodash.padstart-4.6.1.tgz", + "integrity": "sha1-0uPuv/DZ05rVD1y9G1KnvOa7YRs=", + "dev": true + }, + "lodash.uniq": { + "version": "4.5.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/lodash.uniq/-/lodash.uniq-4.5.0.tgz", + "integrity": "sha1-0CJTc662Uq3BvILklFM5qEJ1R3M=", + "dev": true + }, + "log-symbols": { + "version": "2.2.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/log-symbols/-/log-symbols-2.2.0.tgz", + "integrity": "sha512-VeIAFslyIerEJLXHziedo2basKbMKtTw3vfn5IzG0XTjhAVEJyNHnL2p7vc+wBDSdQuUpNw3M2u6xb9QsAY5Eg==", + "dev": true, + "requires": { + "chalk": "^2.0.1" + } + }, + "logform": { + "version": "1.10.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/logform/-/logform-1.10.0.tgz", + "integrity": "sha512-em5ojIhU18fIMOw/333mD+ZLE2fis0EzXl1ZwHx4iQzmpQi6odNiY/t+ITNr33JZhT9/KEaH+UPIipr6a9EjWg==", + "dev": true, + "requires": { + "colors": "^1.2.1", + "fast-safe-stringify": "^2.0.4", + "fecha": "^2.3.3", + "ms": "^2.1.1", + "triple-beam": "^1.2.0" + }, + "dependencies": { + "ms": { + "version": "2.1.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/ms/-/ms-2.1.1.tgz", + "integrity": "sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg==", + "dev": true + } + } + }, + "loud-rejection": { + "version": "1.6.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/loud-rejection/-/loud-rejection-1.6.0.tgz", + "integrity": "sha1-W0b4AUft7leIcPCG0Eghz5mOVR8=", + "dev": true, + "requires": { + "currently-unhandled": "^0.4.1", + "signal-exit": "^3.0.0" + } + }, + "lowercase-keys": { + "version": "1.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/lowercase-keys/-/lowercase-keys-1.0.1.tgz", + "integrity": "sha512-G2Lj61tXDnVFFOi8VZds+SoQjtQC3dgokKdDG2mTm1tx4m50NUHBOZSBwQQHyy0V12A0JTG4icfZQH+xPyh8VA==", + "dev": true + }, + "lru-cache": { + "version": "4.1.3", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/lru-cache/-/lru-cache-4.1.3.tgz", + "integrity": "sha512-fFEhvcgzuIoJVUF8fYr5KR0YqxD238zgObTps31YdADwPPAp82a4M8TrckkWyx7ekNlf9aBcVn81cFwwXngrJA==", + "dev": true, + "requires": { + "pseudomap": "^1.0.2", + "yallist": "^2.1.2" + } + }, + "macos-release": { + "version": "1.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/macos-release/-/macos-release-1.1.0.tgz", + "integrity": "sha512-mmLbumEYMi5nXReB9js3WGsB8UE6cDBWyIO62Z4DNx6GbRhDxHNjA1MlzSpJ2S2KM1wyiPRA0d19uHWYYvMHjA==", + "dev": true + }, + "make-dir": { + "version": "1.3.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/make-dir/-/make-dir-1.3.0.tgz", + "integrity": "sha512-2w31R7SJtieJJnQtGc7RVL2StM2vGYVfqUOvUDxH6bC6aJTxPxTF0GnIgCyu7tjockiUWAYQRbxa7vKn34s5sQ==", + "dev": true, + "requires": { + "pify": "^3.0.0" + } + }, + "map-cache": { + "version": "0.2.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/map-cache/-/map-cache-0.2.2.tgz", + "integrity": "sha1-wyq9C9ZSXZsFFkW7TyasXcmKDb8=", + "dev": true + }, + "map-obj": { + "version": "2.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/map-obj/-/map-obj-2.0.0.tgz", + "integrity": "sha1-plzSkIepJZi4eRJXpSPgISIqwfk=", + "dev": true + }, + "map-visit": { + "version": "1.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/map-visit/-/map-visit-1.0.0.tgz", + "integrity": "sha1-7Nyo8TFE5mDxtb1B8S80edmN+48=", + "dev": true, + "requires": { + "object-visit": "^1.0.0" + } + }, + "mem": { + "version": "1.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/mem/-/mem-1.1.0.tgz", + "integrity": "sha1-Xt1StIXKHZAP5kiVUFOZoN+kX3Y=", + "dev": true, + "requires": { + "mimic-fn": "^1.0.0" + } + }, + "mem-fs": { + "version": "1.1.3", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/mem-fs/-/mem-fs-1.1.3.tgz", + "integrity": "sha1-uK6NLj/Lb10/kWXBLUVRoGXZicw=", + "dev": true, + "requires": { + "through2": "^2.0.0", + "vinyl": "^1.1.0", + "vinyl-file": "^2.0.0" + } + }, + "mem-fs-editor": { + "version": "5.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/mem-fs-editor/-/mem-fs-editor-5.1.0.tgz", + "integrity": "sha512-2Yt2GCYEbcotYbIJagmow4gEtHDqzpq5XN94+yAx/NT5+bGqIjkXnm3KCUQfE6kRfScGp9IZknScoGRKu8L78w==", + "dev": true, + "requires": { + "commondir": "^1.0.1", + "deep-extend": "^0.6.0", + "ejs": "^2.5.9", + "glob": "^7.0.3", + "globby": "^8.0.1", + "isbinaryfile": "^3.0.2", + "mkdirp": "^0.5.0", + "multimatch": "^2.0.0", + "rimraf": "^2.2.8", + "through2": "^2.0.0", + "vinyl": "^2.0.1" + }, + "dependencies": { + "clone": { + "version": "2.1.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/clone/-/clone-2.1.2.tgz", + "integrity": "sha1-G39Ln1kfHo+DZwQBYANFoCiHQ18=", + "dev": true + }, + "clone-stats": { + "version": "1.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/clone-stats/-/clone-stats-1.0.0.tgz", + "integrity": "sha1-s3gt/4u1R04Yuba/D9/ngvh3doA=", + "dev": true + }, + "replace-ext": { + "version": "1.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/replace-ext/-/replace-ext-1.0.0.tgz", + "integrity": "sha1-3mMSg3P8v3w8z6TeWkgMRaZ5WOs=", + "dev": true + }, + "vinyl": { + "version": "2.2.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/vinyl/-/vinyl-2.2.0.tgz", + "integrity": "sha512-MBH+yP0kC/GQ5GwBqrTPTzEfiiLjta7hTtvQtbxBgTeSXsmKQRQecjibMbxIXzVT3Y9KJK+drOz1/k+vsu8Nkg==", + "dev": true, + "requires": { + "clone": "^2.1.1", + "clone-buffer": "^1.0.0", + "clone-stats": "^1.0.0", + "cloneable-readable": "^1.0.0", + "remove-trailing-separator": "^1.0.1", + "replace-ext": "^1.0.0" + } + } + } + }, + "meow": { + "version": "5.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/meow/-/meow-5.0.0.tgz", + "integrity": "sha512-CbTqYU17ABaLefO8vCU153ZZlprKYWDljcndKKDCFcYQITzWCXZAVk4QMFZPgvzrnUQ3uItnIE/LoUOwrT15Ig==", + "dev": true, + "requires": { + "camelcase-keys": "^4.0.0", + "decamelize-keys": "^1.0.0", + "loud-rejection": "^1.0.0", + "minimist-options": "^3.0.1", + "normalize-package-data": "^2.3.4", + "read-pkg-up": "^3.0.0", + "redent": "^2.0.0", + "trim-newlines": "^2.0.0", + "yargs-parser": "^10.0.0" + } + }, + "merge2": { + "version": "1.2.3", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/merge2/-/merge2-1.2.3.tgz", + "integrity": "sha512-gdUU1Fwj5ep4kplwcmftruWofEFt6lfpkkr3h860CXbAB9c3hGb55EOL2ali0Td5oebvW0E1+3Sr+Ur7XfKpRA==", + "dev": true + }, + "micromatch": { + "version": "3.1.10", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/micromatch/-/micromatch-3.1.10.tgz", + "integrity": "sha512-MWikgl9n9M3w+bpsY3He8L+w9eF9338xRl8IAO5viDizwSzziFEyUzo2xrrloB64ADbTf8uA8vRqqttDTOmccg==", + "dev": true, + "requires": { + "arr-diff": "^4.0.0", + "array-unique": "^0.3.2", + "braces": "^2.3.1", + "define-property": "^2.0.2", + "extend-shallow": "^3.0.2", + "extglob": "^2.0.4", + "fragment-cache": "^0.2.1", + "kind-of": "^6.0.2", + "nanomatch": "^1.2.9", + "object.pick": "^1.3.0", + "regex-not": "^1.0.0", + "snapdragon": "^0.8.1", + "to-regex": "^3.0.2" + }, + "dependencies": { + "arr-diff": { + "version": "4.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/arr-diff/-/arr-diff-4.0.0.tgz", + "integrity": "sha1-1kYQdP6/7HHn4VI1dhoyml3HxSA=", + "dev": true + }, + "extend-shallow": { + "version": "3.0.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/extend-shallow/-/extend-shallow-3.0.2.tgz", + "integrity": "sha1-Jqcarwc7OfshJxcnRhMcJwQCjbg=", + "dev": true, + "requires": { + "assign-symbols": "^1.0.0", + "is-extendable": "^1.0.1" + } + }, + "is-extendable": { + "version": "1.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/is-extendable/-/is-extendable-1.0.1.tgz", + "integrity": "sha512-arnXMxT1hhoKo9k1LZdmlNyJdDDfy2v0fXjFlmok4+i8ul/6WlbVge9bhM74OpNPQPMGUToDtz+KXa1PneJxOA==", + "dev": true, + "requires": { + "is-plain-object": "^2.0.4" + } + }, + "kind-of": { + "version": "6.0.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/kind-of/-/kind-of-6.0.2.tgz", + "integrity": "sha512-s5kLOcnH0XqDO+FvuaLX8DDjZ18CGFk7VygH40QoKPUQhW4e2rvM0rwUq0t8IQDOwYSeLK01U90OjzBTme2QqA==", + "dev": true + } + } + }, + "mime-db": { + "version": "1.36.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/mime-db/-/mime-db-1.36.0.tgz", + "integrity": "sha512-L+xvyD9MkoYMXb1jAmzI/lWYAxAMCPvIBSWur0PZ5nOf5euahRLVqH//FKW9mWp2lkqUgYiXPgkzfMUFi4zVDw==", + "dev": true + }, + "mime-types": { + "version": "2.1.20", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/mime-types/-/mime-types-2.1.20.tgz", + "integrity": "sha512-HrkrPaP9vGuWbLK1B1FfgAkbqNjIuy4eHlIYnFi7kamZyLLrGlo2mpcx0bBmNpKqBtYtAfGbodDddIgddSJC2A==", + "dev": true, + "requires": { + "mime-db": "~1.36.0" + } + }, + "mimic-fn": { + "version": "1.2.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/mimic-fn/-/mimic-fn-1.2.0.tgz", + "integrity": "sha512-jf84uxzwiuiIVKiOLpfYk7N46TSy8ubTonmneY9vrpHNAnp0QBt2BxWV9dO3/j+BoVAb+a5G6YDPW3M5HOdMWQ==", + "dev": true + }, + "mimic-response": { + "version": "1.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/mimic-response/-/mimic-response-1.0.1.tgz", + "integrity": "sha512-j5EctnkH7amfV/q5Hgmoal1g2QHFJRraOtmx0JpIqkxhBhI/lJSl1nMpQ45hVarwNETOoWEimndZ4QK0RHxuxQ==", + "dev": true + }, + "minimatch": { + "version": "3.0.4", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/minimatch/-/minimatch-3.0.4.tgz", + "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", + "dev": true, + "requires": { + "brace-expansion": "^1.1.7" + } + }, + "minimist": { + "version": "0.0.8", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/minimist/-/minimist-0.0.8.tgz", + "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=", + "dev": true + }, + "minimist-options": { + "version": "3.0.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/minimist-options/-/minimist-options-3.0.2.tgz", + "integrity": "sha512-FyBrT/d0d4+uiZRbqznPXqw3IpZZG3gl3wKWiX784FycUKVwBt0uLBFkQrtE4tZOrgo78nZp2jnKz3L65T5LdQ==", + "dev": true, + "requires": { + "arrify": "^1.0.1", + "is-plain-obj": "^1.1.0" + } + }, + "mixin-deep": { + "version": "1.3.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/mixin-deep/-/mixin-deep-1.3.1.tgz", + "integrity": "sha512-8ZItLHeEgaqEvd5lYBXfm4EZSFCX29Jb9K+lAHhDKzReKBQKj3R+7NOF6tjqYi9t4oI8VUfaWITJQm86wnXGNQ==", + "dev": true, + "requires": { + "for-in": "^1.0.2", + "is-extendable": "^1.0.1" + }, + "dependencies": { + "is-extendable": { + "version": "1.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/is-extendable/-/is-extendable-1.0.1.tgz", + "integrity": "sha512-arnXMxT1hhoKo9k1LZdmlNyJdDDfy2v0fXjFlmok4+i8ul/6WlbVge9bhM74OpNPQPMGUToDtz+KXa1PneJxOA==", + "dev": true, + "requires": { + "is-plain-object": "^2.0.4" + } + } + } + }, + "mkdirp": { + "version": "0.5.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/mkdirp/-/mkdirp-0.5.1.tgz", + "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", + "dev": true, + "requires": { + "minimist": "0.0.8" + } + }, + "ms": { + "version": "2.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/ms/-/ms-2.0.0.tgz", + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", + "dev": true + }, + "multimatch": { + "version": "2.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/multimatch/-/multimatch-2.1.0.tgz", + "integrity": "sha1-nHkGoi+0wCkZ4vX3UWG0zb1LKis=", + "dev": true, + "requires": { + "array-differ": "^1.0.0", + "array-union": "^1.0.1", + "arrify": "^1.0.0", + "minimatch": "^3.0.0" + } + }, + "mute-stream": { + "version": "0.0.7", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/mute-stream/-/mute-stream-0.0.7.tgz", + "integrity": "sha1-MHXOk7whuPq0PhvE2n6BFe0ee6s=", + "dev": true + }, + "nanomatch": { + "version": "1.2.13", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/nanomatch/-/nanomatch-1.2.13.tgz", + "integrity": "sha512-fpoe2T0RbHwBTBUOftAfBPaDEi06ufaUai0mE6Yn1kacc3SnTErfb/h+X94VXzI64rKFHYImXSvdwGGCmwOqCA==", + "dev": true, + "requires": { + "arr-diff": "^4.0.0", + "array-unique": "^0.3.2", + "define-property": "^2.0.2", + "extend-shallow": "^3.0.2", + "fragment-cache": "^0.2.1", + "is-windows": "^1.0.2", + "kind-of": "^6.0.2", + "object.pick": "^1.3.0", + "regex-not": "^1.0.0", + "snapdragon": "^0.8.1", + "to-regex": "^3.0.1" + }, + "dependencies": { + "arr-diff": { + "version": "4.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/arr-diff/-/arr-diff-4.0.0.tgz", + "integrity": "sha1-1kYQdP6/7HHn4VI1dhoyml3HxSA=", + "dev": true + }, + "extend-shallow": { + "version": "3.0.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/extend-shallow/-/extend-shallow-3.0.2.tgz", + "integrity": "sha1-Jqcarwc7OfshJxcnRhMcJwQCjbg=", + "dev": true, + "requires": { + "assign-symbols": "^1.0.0", + "is-extendable": "^1.0.1" + } + }, + "is-extendable": { + "version": "1.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/is-extendable/-/is-extendable-1.0.1.tgz", + "integrity": "sha512-arnXMxT1hhoKo9k1LZdmlNyJdDDfy2v0fXjFlmok4+i8ul/6WlbVge9bhM74OpNPQPMGUToDtz+KXa1PneJxOA==", + "dev": true, + "requires": { + "is-plain-object": "^2.0.4" + } + }, + "kind-of": { + "version": "6.0.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/kind-of/-/kind-of-6.0.2.tgz", + "integrity": "sha512-s5kLOcnH0XqDO+FvuaLX8DDjZ18CGFk7VygH40QoKPUQhW4e2rvM0rwUq0t8IQDOwYSeLK01U90OjzBTme2QqA==", + "dev": true + } + } + }, + "nice-try": { + "version": "1.0.5", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/nice-try/-/nice-try-1.0.5.tgz", + "integrity": "sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ==", + "dev": true + }, + "normalize-package-data": { + "version": "2.4.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/normalize-package-data/-/normalize-package-data-2.4.0.tgz", + "integrity": "sha512-9jjUFbTPfEy3R/ad/2oNbKtW9Hgovl5O1FvFWKkKblNXoN/Oou6+9+KKohPK13Yc3/TyunyWhJp6gvRNR/PPAw==", + "dev": true, + "requires": { + "hosted-git-info": "^2.1.4", + "is-builtin-module": "^1.0.0", + "semver": "2 || 3 || 4 || 5", + "validate-npm-package-license": "^3.0.1" + } + }, + "npm-run-path": { + "version": "2.0.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/npm-run-path/-/npm-run-path-2.0.2.tgz", + "integrity": "sha1-NakjLfo11wZ7TLLd8jV7GHFTbF8=", + "dev": true, + "requires": { + "path-key": "^2.0.0" + } + }, + "npmlog": { + "version": "2.0.4", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/npmlog/-/npmlog-2.0.4.tgz", + "integrity": "sha1-mLUlMPJRTKkNCexbIsiEZyI3VpI=", + "dev": true, + "requires": { + "ansi": "~0.3.1", + "are-we-there-yet": "~1.1.2", + "gauge": "~1.2.5" + } + }, + "number-is-nan": { + "version": "1.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/number-is-nan/-/number-is-nan-1.0.1.tgz", + "integrity": "sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0=", + "dev": true + }, + "oauth-sign": { + "version": "0.9.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/oauth-sign/-/oauth-sign-0.9.0.tgz", + "integrity": "sha512-fexhUFFPTGV8ybAtSIGbV6gOkSv8UtRbDBnAyLQw4QPKkgNlsH2ByPGtMUqdWkos6YCRmAqViwgZrJc/mRDzZQ==", + "dev": true + }, + "object-assign": { + "version": "4.1.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/object-assign/-/object-assign-4.1.1.tgz", + "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=", + "dev": true + }, + "object-copy": { + "version": "0.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/object-copy/-/object-copy-0.1.0.tgz", + "integrity": "sha1-fn2Fi3gb18mRpBupde04EnVOmYw=", + "dev": true, + "requires": { + "copy-descriptor": "^0.1.0", + "define-property": "^0.2.5", + "kind-of": "^3.0.3" + }, + "dependencies": { + "define-property": { + "version": "0.2.5", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/define-property/-/define-property-0.2.5.tgz", + "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", + "dev": true, + "requires": { + "is-descriptor": "^0.1.0" + } + }, + "kind-of": { + "version": "3.2.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true, + "requires": { + "is-buffer": "^1.1.5" + } + } + } + }, + "object-visit": { + "version": "1.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/object-visit/-/object-visit-1.0.1.tgz", + "integrity": "sha1-95xEk68MU3e1n+OdOV5BBC3QRbs=", + "dev": true, + "requires": { + "isobject": "^3.0.0" + } + }, + "object.pick": { + "version": "1.3.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/object.pick/-/object.pick-1.3.0.tgz", + "integrity": "sha1-h6EKxMFpS9Lhy/U1kaZhQftd10c=", + "dev": true, + "requires": { + "isobject": "^3.0.1" + } + }, + "once": { + "version": "1.4.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/once/-/once-1.4.0.tgz", + "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", + "dev": true, + "requires": { + "wrappy": "1" + } + }, + "one-time": { + "version": "0.0.4", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/one-time/-/one-time-0.0.4.tgz", + "integrity": "sha1-+M33eISCb+Tf+T46nMN7HkSAdC4=", + "dev": true + }, + "onetime": { + "version": "2.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/onetime/-/onetime-2.0.1.tgz", + "integrity": "sha1-BnQoIw/WdEOyeUsiu6UotoZ5YtQ=", + "dev": true, + "requires": { + "mimic-fn": "^1.0.0" + } + }, + "os-locale": { + "version": "2.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/os-locale/-/os-locale-2.1.0.tgz", + "integrity": "sha512-3sslG3zJbEYcaC4YVAvDorjGxc7tv6KVATnLPZONiljsUncvihe9BQoVCEs0RZ1kmf4Hk9OBqlZfJZWI4GanKA==", + "dev": true, + "requires": { + "execa": "^0.7.0", + "lcid": "^1.0.0", + "mem": "^1.1.0" + } + }, + "os-name": { + "version": "2.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/os-name/-/os-name-2.0.1.tgz", + "integrity": "sha1-uaOGNhwXrjohc27wWZQFyajF3F4=", + "dev": true, + "requires": { + "macos-release": "^1.0.0", + "win-release": "^1.0.0" + } + }, + "os-shim": { + "version": "0.1.3", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/os-shim/-/os-shim-0.1.3.tgz", + "integrity": "sha1-a2LDeRz3kJ6jXtRuF2WLtBfLORc=", + "dev": true + }, + "os-tmpdir": { + "version": "1.0.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/os-tmpdir/-/os-tmpdir-1.0.2.tgz", + "integrity": "sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ=", + "dev": true + }, + "p-cancelable": { + "version": "0.3.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/p-cancelable/-/p-cancelable-0.3.0.tgz", + "integrity": "sha512-RVbZPLso8+jFeq1MfNvgXtCRED2raz/dKpacfTNxsx6pLEpEomM7gah6VeHSYV3+vo0OAi4MkArtQcWWXuQoyw==", + "dev": true + }, + "p-finally": { + "version": "1.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/p-finally/-/p-finally-1.0.0.tgz", + "integrity": "sha1-P7z7FbiZpEEjs0ttzBi3JDNqLK4=", + "dev": true + }, + "p-limit": { + "version": "1.3.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/p-limit/-/p-limit-1.3.0.tgz", + "integrity": "sha512-vvcXsLAJ9Dr5rQOPk7toZQZJApBl2K4J6dANSsEuh6QI41JYcsS/qhTGa9ErIUUgK3WNQoJYvylxvjqmiqEA9Q==", + "dev": true, + "requires": { + "p-try": "^1.0.0" + } + }, + "p-locate": { + "version": "2.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/p-locate/-/p-locate-2.0.0.tgz", + "integrity": "sha1-IKAQOyIqcMj9OcwuWAaA893l7EM=", + "dev": true, + "requires": { + "p-limit": "^1.1.0" + } + }, + "p-timeout": { + "version": "1.2.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/p-timeout/-/p-timeout-1.2.1.tgz", + "integrity": "sha1-XrOzU7f86Z8QGhA4iAuwVOu+o4Y=", + "dev": true, + "requires": { + "p-finally": "^1.0.0" + } + }, + "p-try": { + "version": "1.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/p-try/-/p-try-1.0.0.tgz", + "integrity": "sha1-y8ec26+P1CKOE/Yh8rGiN8GyB7M=", + "dev": true + }, + "parse-gitignore": { + "version": "1.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/parse-gitignore/-/parse-gitignore-1.0.1.tgz", + "integrity": "sha512-UGyowyjtx26n65kdAMWhm6/3uy5uSrpcuH7tt+QEVudiBoVS+eqHxD5kbi9oWVRwj7sCzXqwuM+rUGw7earl6A==", + "dev": true + }, + "parse-json": { + "version": "4.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/parse-json/-/parse-json-4.0.0.tgz", + "integrity": "sha1-vjX1Qlvh9/bHRxhPmKeIy5lHfuA=", + "dev": true, + "requires": { + "error-ex": "^1.3.1", + "json-parse-better-errors": "^1.0.1" + } + }, + "pascalcase": { + "version": "0.1.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/pascalcase/-/pascalcase-0.1.1.tgz", + "integrity": "sha1-s2PlXoAGym/iF4TS2yK9FdeRfxQ=", + "dev": true + }, + "path-dirname": { + "version": "1.0.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/path-dirname/-/path-dirname-1.0.2.tgz", + "integrity": "sha1-zDPSTVJeCZpTiMAzbG4yuRYGCeA=", + "dev": true + }, + "path-exists": { + "version": "3.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/path-exists/-/path-exists-3.0.0.tgz", + "integrity": "sha1-zg6+ql94yxiSXqfYENe1mwEP1RU=", + "dev": true + }, + "path-is-absolute": { + "version": "1.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", + "dev": true + }, + "path-key": { + "version": "2.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/path-key/-/path-key-2.0.1.tgz", + "integrity": "sha1-QRyttXTFoUDTpLGRDUDYDMn0C0A=", + "dev": true + }, + "path-parse": { + "version": "1.0.6", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/path-parse/-/path-parse-1.0.6.tgz", + "integrity": "sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw==", + "dev": true + }, + "path-type": { + "version": "3.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/path-type/-/path-type-3.0.0.tgz", + "integrity": "sha512-T2ZUsdZFHgA3u4e5PfPbjd7HDDpxPnQb5jN0SrDsjNSuVXHJqtwTnWqG0B1jZrgmJ/7lj1EmVIByWt1gxGkWvg==", + "dev": true, + "requires": { + "pify": "^3.0.0" + } + }, + "performance-now": { + "version": "2.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/performance-now/-/performance-now-2.1.0.tgz", + "integrity": "sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns=", + "dev": true + }, + "pify": { + "version": "3.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/pify/-/pify-3.0.0.tgz", + "integrity": "sha1-5aSs0sEB/fPZpNB/DbxNtJ3SgXY=", + "dev": true + }, + "pinkie": { + "version": "2.0.4", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/pinkie/-/pinkie-2.0.4.tgz", + "integrity": "sha1-clVrgM+g1IqXToDnckjoDtT3+HA=", + "dev": true + }, + "pinkie-promise": { + "version": "2.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/pinkie-promise/-/pinkie-promise-2.0.1.tgz", + "integrity": "sha1-ITXW36ejWMBprJsXh3YogihFD/o=", + "dev": true, + "requires": { + "pinkie": "^2.0.0" + } + }, + "pkg-up": { + "version": "2.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/pkg-up/-/pkg-up-2.0.0.tgz", + "integrity": "sha1-yBmscoBZpGHKscOImivjxJoATX8=", + "dev": true, + "requires": { + "find-up": "^2.1.0" + } + }, + "plugin-error": { + "version": "0.1.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/plugin-error/-/plugin-error-0.1.2.tgz", + "integrity": "sha1-O5uzM1zPAPQl4HQ34ZJ2ln2kes4=", + "dev": true, + "requires": { + "ansi-cyan": "^0.1.1", + "ansi-red": "^0.1.1", + "arr-diff": "^1.0.1", + "arr-union": "^2.0.1", + "extend-shallow": "^1.1.2" + } + }, + "pluralize": { + "version": "7.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/pluralize/-/pluralize-7.0.0.tgz", + "integrity": "sha512-ARhBOdzS3e41FbkW/XWrTEtukqqLoK5+Z/4UeDaLuSW+39JPeFgs4gCGqsrJHVZX0fUrx//4OF0K1CUGwlIFow==", + "dev": true + }, + "posix-character-classes": { + "version": "0.1.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/posix-character-classes/-/posix-character-classes-0.1.1.tgz", + "integrity": "sha1-AerA/jta9xoqbAL+q7jB/vfgDqs=", + "dev": true + }, + "prepend-http": { + "version": "1.0.4", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/prepend-http/-/prepend-http-1.0.4.tgz", + "integrity": "sha1-1PRWKwzjaW5BrFLQ4ALlemNdxtw=", + "dev": true + }, + "prettier": { + "version": "1.13.7", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/prettier/-/prettier-1.13.7.tgz", + "integrity": "sha512-KIU72UmYPGk4MujZGYMFwinB7lOf2LsDNGSOC8ufevsrPLISrZbNJlWstRi3m0AMuszbH+EFSQ/r6w56RSPK6w==", + "dev": true + }, + "pretty-bytes": { + "version": "5.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/pretty-bytes/-/pretty-bytes-5.1.0.tgz", + "integrity": "sha512-wa5+qGVg9Yt7PB6rYm3kXlKzgzgivYTLRandezh43jjRqgyDyP+9YxfJpJiLs9yKD1WeU8/OvtToWpW7255FtA==", + "dev": true + }, + "process-nextick-args": { + "version": "2.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/process-nextick-args/-/process-nextick-args-2.0.0.tgz", + "integrity": "sha512-MtEC1TqN0EU5nephaJ4rAtThHtC86dNN9qCuEhtshvpVBkAW5ZO7BASN9REnF9eoXGcRub+pFuKEpOHE+HbEMw==", + "dev": true + }, + "pseudomap": { + "version": "1.0.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/pseudomap/-/pseudomap-1.0.2.tgz", + "integrity": "sha1-8FKijacOYYkX7wqKw0wa5aaChrM=", + "dev": true + }, + "psl": { + "version": "1.1.29", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/psl/-/psl-1.1.29.tgz", + "integrity": "sha512-AeUmQ0oLN02flVHXWh9sSJF7mcdFq0ppid/JkErufc3hGIV/AMa8Fo9VgDo/cT2jFdOWoFvHp90qqBH54W+gjQ==", + "dev": true + }, + "punycode": { + "version": "1.4.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/punycode/-/punycode-1.4.1.tgz", + "integrity": "sha1-wNWmOycYgArY4esPpSachN1BhF4=", + "dev": true + }, + "qs": { + "version": "6.5.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/qs/-/qs-6.5.2.tgz", + "integrity": "sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA==", + "dev": true + }, + "quick-lru": { + "version": "1.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/quick-lru/-/quick-lru-1.1.0.tgz", + "integrity": "sha1-Q2CxfGETatOAeDl/8RQW4Ybc+7g=", + "dev": true + }, + "randexp": { + "version": "0.4.9", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/randexp/-/randexp-0.4.9.tgz", + "integrity": "sha512-maAX1cnBkzIZ89O4tSQUOF098xjGMC8N+9vuY/WfHwg87THw6odD2Br35donlj5e6KnB1SB0QBHhTQhhDHuTPQ==", + "dev": true, + "requires": { + "drange": "^1.0.0", + "ret": "^0.2.0" + } + }, + "read-chunk": { + "version": "2.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/read-chunk/-/read-chunk-2.1.0.tgz", + "integrity": "sha1-agTAkoAF7Z1C4aasVgDhnLx/9lU=", + "dev": true, + "requires": { + "pify": "^3.0.0", + "safe-buffer": "^5.1.1" + } + }, + "read-pkg": { + "version": "3.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/read-pkg/-/read-pkg-3.0.0.tgz", + "integrity": "sha1-nLxoaXj+5l0WwA4rGcI3/Pbjg4k=", + "dev": true, + "requires": { + "load-json-file": "^4.0.0", + "normalize-package-data": "^2.3.2", + "path-type": "^3.0.0" + } + }, + "read-pkg-up": { + "version": "3.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/read-pkg-up/-/read-pkg-up-3.0.0.tgz", + "integrity": "sha1-PtSWaF26D4/hGNBpHcUfSh/5bwc=", + "dev": true, + "requires": { + "find-up": "^2.0.0", + "read-pkg": "^3.0.0" + } + }, + "readable-stream": { + "version": "2.3.6", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/readable-stream/-/readable-stream-2.3.6.tgz", + "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", + "dev": true, + "requires": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" + } + }, + "rechoir": { + "version": "0.6.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/rechoir/-/rechoir-0.6.2.tgz", + "integrity": "sha1-hSBLVNuoLVdC4oyWdW70OvUOM4Q=", + "dev": true, + "requires": { + "resolve": "^1.1.6" + } + }, + "redent": { + "version": "2.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/redent/-/redent-2.0.0.tgz", + "integrity": "sha1-wbIAe0LVfrE4kHmzyDM2OdXhzKo=", + "dev": true, + "requires": { + "indent-string": "^3.0.0", + "strip-indent": "^2.0.0" + } + }, + "regex-not": { + "version": "1.0.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/regex-not/-/regex-not-1.0.2.tgz", + "integrity": "sha512-J6SDjUgDxQj5NusnOtdFxDwN/+HWykR8GELwctJ7mdqhcyy1xEc4SRFHUXvxTp661YaVKAjfRLZ9cCqS6tn32A==", + "dev": true, + "requires": { + "extend-shallow": "^3.0.2", + "safe-regex": "^1.1.0" + }, + "dependencies": { + "extend-shallow": { + "version": "3.0.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/extend-shallow/-/extend-shallow-3.0.2.tgz", + "integrity": "sha1-Jqcarwc7OfshJxcnRhMcJwQCjbg=", + "dev": true, + "requires": { + "assign-symbols": "^1.0.0", + "is-extendable": "^1.0.1" + } + }, + "is-extendable": { + "version": "1.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/is-extendable/-/is-extendable-1.0.1.tgz", + "integrity": "sha512-arnXMxT1hhoKo9k1LZdmlNyJdDDfy2v0fXjFlmok4+i8ul/6WlbVge9bhM74OpNPQPMGUToDtz+KXa1PneJxOA==", + "dev": true, + "requires": { + "is-plain-object": "^2.0.4" + } + } + } + }, + "regexp-to-ast": { + "version": "0.3.5", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/regexp-to-ast/-/regexp-to-ast-0.3.5.tgz", + "integrity": "sha512-1CJygtdvsfNFwiyjaMLBWtg2tfEqx/jSZ8S6TV+GlNL8kiH8rb4cm5Pb7A/C2BpyM/fA8ZJEudlCwi/jvAY+Ow==", + "dev": true + }, + "remove-trailing-separator": { + "version": "1.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/remove-trailing-separator/-/remove-trailing-separator-1.1.0.tgz", + "integrity": "sha1-wkvOKig62tW8P1jg1IJJuSN52O8=", + "dev": true + }, + "repeat-element": { + "version": "1.1.3", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/repeat-element/-/repeat-element-1.1.3.tgz", + "integrity": "sha512-ahGq0ZnV5m5XtZLMb+vP76kcAM5nkLqk0lpqAuojSKGgQtn4eRi4ZZGm2olo2zKFH+sMsWaqOCW1dqAnOru72g==", + "dev": true + }, + "repeat-string": { + "version": "1.6.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/repeat-string/-/repeat-string-1.6.1.tgz", + "integrity": "sha1-jcrkcOHIirwtYA//Sndihtp15jc=", + "dev": true + }, + "replace-ext": { + "version": "0.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/replace-ext/-/replace-ext-0.0.1.tgz", + "integrity": "sha1-KbvZIHinOfC8zitO5B6DeVNSKSQ=", + "dev": true + }, + "request": { + "version": "2.88.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/request/-/request-2.88.0.tgz", + "integrity": "sha512-NAqBSrijGLZdM0WZNsInLJpkJokL72XYjUpnB0iwsRgxh7dB6COrHnTBNwN0E+lHDAJzu7kLAkDeY08z2/A0hg==", + "dev": true, + "requires": { + "aws-sign2": "~0.7.0", + "aws4": "^1.8.0", + "caseless": "~0.12.0", + "combined-stream": "~1.0.6", + "extend": "~3.0.2", + "forever-agent": "~0.6.1", + "form-data": "~2.3.2", + "har-validator": "~5.1.0", + "http-signature": "~1.2.0", + "is-typedarray": "~1.0.0", + "isstream": "~0.1.2", + "json-stringify-safe": "~5.0.1", + "mime-types": "~2.1.19", + "oauth-sign": "~0.9.0", + "performance-now": "^2.1.0", + "qs": "~6.5.2", + "safe-buffer": "^5.1.2", + "tough-cookie": "~2.4.3", + "tunnel-agent": "^0.6.0", + "uuid": "^3.3.2" + } + }, + "resolve": { + "version": "1.8.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/resolve/-/resolve-1.8.1.tgz", + "integrity": "sha512-AicPrAC7Qu1JxPCZ9ZgCZlY35QgFnNqc+0LtbRNxnVw4TXvjQ72wnuL9JQcEBgXkI9JM8MsT9kaQoHcpCRJOYA==", + "dev": true, + "requires": { + "path-parse": "^1.0.5" + } + }, + "resolve-url": { + "version": "0.2.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/resolve-url/-/resolve-url-0.2.1.tgz", + "integrity": "sha1-LGN/53yJOv0qZj/iGqkIAGjiBSo=", + "dev": true + }, + "restore-cursor": { + "version": "2.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/restore-cursor/-/restore-cursor-2.0.0.tgz", + "integrity": "sha1-n37ih/gv0ybU/RYpI9YhKe7g368=", + "dev": true, + "requires": { + "onetime": "^2.0.0", + "signal-exit": "^3.0.2" + } + }, + "ret": { + "version": "0.2.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/ret/-/ret-0.2.2.tgz", + "integrity": "sha512-M0b3YWQs7R3Z917WRQy1HHA7Ba7D8hvZg6UE5mLykJxQVE2ju0IXbGlaHPPlkY+WN7wFP+wUMXmBFA0aV6vYGQ==", + "dev": true + }, + "rimraf": { + "version": "2.6.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/rimraf/-/rimraf-2.6.2.tgz", + "integrity": "sha512-lreewLK/BlghmxtfH36YYVg1i8IAce4TI7oao75I1g245+6BctqTVQiBP3YUJ9C6DQOXJmkYR9X9fCLtCOJc5w==", + "dev": true, + "requires": { + "glob": "^7.0.5" + } + }, + "run-async": { + "version": "2.3.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/run-async/-/run-async-2.3.0.tgz", + "integrity": "sha1-A3GrSuC91yDUFm19/aZP96RFpsA=", + "dev": true, + "requires": { + "is-promise": "^2.1.0" + } + }, + "rx": { + "version": "4.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/rx/-/rx-4.1.0.tgz", + "integrity": "sha1-pfE/957zt0D+MKqAP7CfmIBdR4I=", + "dev": true + }, + "rxjs": { + "version": "5.5.12", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/rxjs/-/rxjs-5.5.12.tgz", + "integrity": "sha512-xx2itnL5sBbqeeiVgNPVuQQ1nC8Jp2WfNJhXWHmElW9YmrpS9UVnNzhP3EH3HFqexO5Tlp8GhYY+WEcqcVMvGw==", + "dev": true, + "requires": { + "symbol-observable": "1.0.1" + } + }, + "safe-buffer": { + "version": "5.1.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", + "dev": true + }, + "safe-regex": { + "version": "1.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/safe-regex/-/safe-regex-1.1.0.tgz", + "integrity": "sha1-QKNmnzsHfR6UPURinhV91IAjvy4=", + "dev": true, + "requires": { + "ret": "~0.1.10" + }, + "dependencies": { + "ret": { + "version": "0.1.15", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/ret/-/ret-0.1.15.tgz", + "integrity": "sha512-TTlYpa+OL+vMMNG24xSlQGEJ3B/RzEfUlLct7b5G/ytav+wPrplCpVMFuwzXbkecJrb6IYo1iFb0S9v37754mg==", + "dev": true + } + } + }, + "safer-buffer": { + "version": "2.1.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/safer-buffer/-/safer-buffer-2.1.2.tgz", + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", + "dev": true + }, + "scoped-regex": { + "version": "1.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/scoped-regex/-/scoped-regex-1.0.0.tgz", + "integrity": "sha1-o0a7Gs1CB65wvXwMfKnlZra63bg=", + "dev": true + }, + "semver": { + "version": "5.5.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/semver/-/semver-5.5.0.tgz", + "integrity": "sha512-4SJ3dm0WAwWy/NVeioZh5AntkdJoWKxHxcmyP622fOkgHa4z3R0TdBJICINyaSDE6uNwVc8gZr+ZinwZAH4xIA==", + "dev": true + }, + "set-value": { + "version": "2.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/set-value/-/set-value-2.0.0.tgz", + "integrity": "sha512-hw0yxk9GT/Hr5yJEYnHNKYXkIA8mVJgd9ditYZCe16ZczcaELYYcfvaXesNACk2O8O0nTiPQcQhGUQj8JLzeeg==", + "dev": true, + "requires": { + "extend-shallow": "^2.0.1", + "is-extendable": "^0.1.1", + "is-plain-object": "^2.0.3", + "split-string": "^3.0.1" + }, + "dependencies": { + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "dev": true, + "requires": { + "is-extendable": "^0.1.0" + } + } + } + }, + "shebang-command": { + "version": "1.2.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/shebang-command/-/shebang-command-1.2.0.tgz", + "integrity": "sha1-RKrGW2lbAzmJaMOfNj/uXer98eo=", + "dev": true, + "requires": { + "shebang-regex": "^1.0.0" + } + }, + "shebang-regex": { + "version": "1.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/shebang-regex/-/shebang-regex-1.0.0.tgz", + "integrity": "sha1-2kL0l0DAtC2yypcoVxyxkMmO/qM=", + "dev": true + }, + "shelljs": { + "version": "0.8.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/shelljs/-/shelljs-0.8.2.tgz", + "integrity": "sha512-pRXeNrCA2Wd9itwhvLp5LZQvPJ0wU6bcjaTMywHHGX5XWhVN2nzSu7WV0q+oUY7mGK3mgSkDDzP3MgjqdyIgbQ==", + "dev": true, + "requires": { + "glob": "^7.0.0", + "interpret": "^1.0.0", + "rechoir": "^0.6.2" + } + }, + "signal-exit": { + "version": "3.0.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/signal-exit/-/signal-exit-3.0.2.tgz", + "integrity": "sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0=", + "dev": true + }, + "simple-swizzle": { + "version": "0.2.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/simple-swizzle/-/simple-swizzle-0.2.2.tgz", + "integrity": "sha1-pNprY1/8zMoz9w0Xy5JZLeleVXo=", + "dev": true, + "requires": { + "is-arrayish": "^0.3.1" + } + }, + "slash": { + "version": "1.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/slash/-/slash-1.0.0.tgz", + "integrity": "sha1-xB8vbDn8FtHNF61LXYlhFK5HDVU=", + "dev": true + }, + "snapdragon": { + "version": "0.8.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/snapdragon/-/snapdragon-0.8.2.tgz", + "integrity": "sha512-FtyOnWN/wCHTVXOMwvSv26d+ko5vWlIDD6zoUJ7LW8vh+ZBC8QdljveRP+crNrtBwioEUWy/4dMtbBjA4ioNlg==", + "dev": true, + "requires": { + "base": "^0.11.1", + "debug": "^2.2.0", + "define-property": "^0.2.5", + "extend-shallow": "^2.0.1", + "map-cache": "^0.2.2", + "source-map": "^0.5.6", + "source-map-resolve": "^0.5.0", + "use": "^3.1.0" + }, + "dependencies": { + "debug": { + "version": "2.6.9", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "dev": true, + "requires": { + "ms": "2.0.0" + } + }, + "define-property": { + "version": "0.2.5", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/define-property/-/define-property-0.2.5.tgz", + "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", + "dev": true, + "requires": { + "is-descriptor": "^0.1.0" + } + }, + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "dev": true, + "requires": { + "is-extendable": "^0.1.0" + } + } + } + }, + "snapdragon-node": { + "version": "2.1.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/snapdragon-node/-/snapdragon-node-2.1.1.tgz", + "integrity": "sha512-O27l4xaMYt/RSQ5TR3vpWCAB5Kb/czIcqUFOM/C4fYcLnbZUc1PkjTAMjof2pBWaSTwOUd6qUHcFGVGj7aIwnw==", + "dev": true, + "requires": { + "define-property": "^1.0.0", + "isobject": "^3.0.0", + "snapdragon-util": "^3.0.1" + }, + "dependencies": { + "define-property": { + "version": "1.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/define-property/-/define-property-1.0.0.tgz", + "integrity": "sha1-dp66rz9KY6rTr56NMEybvnm/sOY=", + "dev": true, + "requires": { + "is-descriptor": "^1.0.0" + } + }, + "is-accessor-descriptor": { + "version": "1.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz", + "integrity": "sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ==", + "dev": true, + "requires": { + "kind-of": "^6.0.0" + } + }, + "is-data-descriptor": { + "version": "1.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz", + "integrity": "sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ==", + "dev": true, + "requires": { + "kind-of": "^6.0.0" + } + }, + "is-descriptor": { + "version": "1.0.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/is-descriptor/-/is-descriptor-1.0.2.tgz", + "integrity": "sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg==", + "dev": true, + "requires": { + "is-accessor-descriptor": "^1.0.0", + "is-data-descriptor": "^1.0.0", + "kind-of": "^6.0.2" + } + }, + "kind-of": { + "version": "6.0.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/kind-of/-/kind-of-6.0.2.tgz", + "integrity": "sha512-s5kLOcnH0XqDO+FvuaLX8DDjZ18CGFk7VygH40QoKPUQhW4e2rvM0rwUq0t8IQDOwYSeLK01U90OjzBTme2QqA==", + "dev": true + } + } + }, + "snapdragon-util": { + "version": "3.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/snapdragon-util/-/snapdragon-util-3.0.1.tgz", + "integrity": "sha512-mbKkMdQKsjX4BAL4bRYTj21edOf8cN7XHdYUJEe+Zn99hVEYcMvKPct1IqNe7+AZPirn8BCDOQBHQZknqmKlZQ==", + "dev": true, + "requires": { + "kind-of": "^3.2.0" + }, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true, + "requires": { + "is-buffer": "^1.1.5" + } + } + } + }, + "source-map": { + "version": "0.5.7", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/source-map/-/source-map-0.5.7.tgz", + "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=", + "dev": true + }, + "source-map-resolve": { + "version": "0.5.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/source-map-resolve/-/source-map-resolve-0.5.2.tgz", + "integrity": "sha512-MjqsvNwyz1s0k81Goz/9vRBe9SZdB09Bdw+/zYyO+3CuPk6fouTaxscHkgtE8jKvf01kVfl8riHzERQ/kefaSA==", + "dev": true, + "requires": { + "atob": "^2.1.1", + "decode-uri-component": "^0.2.0", + "resolve-url": "^0.2.1", + "source-map-url": "^0.4.0", + "urix": "^0.1.0" + } + }, + "source-map-url": { + "version": "0.4.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/source-map-url/-/source-map-url-0.4.0.tgz", + "integrity": "sha1-PpNdfd1zYxuXZZlW1VEo6HtQhKM=", + "dev": true + }, + "spawn-sync": { + "version": "1.0.15", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/spawn-sync/-/spawn-sync-1.0.15.tgz", + "integrity": "sha1-sAeZVX63+wyDdsKdROih6mfldHY=", + "dev": true, + "requires": { + "concat-stream": "^1.4.7", + "os-shim": "^0.1.2" + } + }, + "spdx-correct": { + "version": "3.0.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/spdx-correct/-/spdx-correct-3.0.2.tgz", + "integrity": "sha512-q9hedtzyXHr5S0A1vEPoK/7l8NpfkFYTq6iCY+Pno2ZbdZR6WexZFtqeVGkGxW3TEJMN914Z55EnAGMmenlIQQ==", + "dev": true, + "requires": { + "spdx-expression-parse": "^3.0.0", + "spdx-license-ids": "^3.0.0" + } + }, + "spdx-exceptions": { + "version": "2.2.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/spdx-exceptions/-/spdx-exceptions-2.2.0.tgz", + "integrity": "sha512-2XQACfElKi9SlVb1CYadKDXvoajPgBVPn/gOQLrTvHdElaVhr7ZEbqJaRnJLVNeaI4cMEAgVCeBMKF6MWRDCRA==", + "dev": true + }, + "spdx-expression-parse": { + "version": "3.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/spdx-expression-parse/-/spdx-expression-parse-3.0.0.tgz", + "integrity": "sha512-Yg6D3XpRD4kkOmTpdgbUiEJFKghJH03fiC1OPll5h/0sO6neh2jqRDVHOQ4o/LMea0tgCkbMgea5ip/e+MkWyg==", + "dev": true, + "requires": { + "spdx-exceptions": "^2.1.0", + "spdx-license-ids": "^3.0.0" + } + }, + "spdx-license-ids": { + "version": "3.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/spdx-license-ids/-/spdx-license-ids-3.0.1.tgz", + "integrity": "sha512-TfOfPcYGBB5sDuPn3deByxPhmfegAhpDYKSOXZQN81Oyrrif8ZCodOLzK3AesELnCx03kikhyDwh0pfvvQvF8w==", + "dev": true + }, + "split-string": { + "version": "3.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/split-string/-/split-string-3.1.0.tgz", + "integrity": "sha512-NzNVhJDYpwceVVii8/Hu6DKfD2G+NrQHlS/V/qgv763EYudVwEcMQNxd2lh+0VrUByXN/oJkl5grOhYWvQUYiw==", + "dev": true, + "requires": { + "extend-shallow": "^3.0.0" + }, + "dependencies": { + "extend-shallow": { + "version": "3.0.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/extend-shallow/-/extend-shallow-3.0.2.tgz", + "integrity": "sha1-Jqcarwc7OfshJxcnRhMcJwQCjbg=", + "dev": true, + "requires": { + "assign-symbols": "^1.0.0", + "is-extendable": "^1.0.1" + } + }, + "is-extendable": { + "version": "1.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/is-extendable/-/is-extendable-1.0.1.tgz", + "integrity": "sha512-arnXMxT1hhoKo9k1LZdmlNyJdDDfy2v0fXjFlmok4+i8ul/6WlbVge9bhM74OpNPQPMGUToDtz+KXa1PneJxOA==", + "dev": true, + "requires": { + "is-plain-object": "^2.0.4" + } + } + } + }, + "sprintf-js": { + "version": "1.0.3", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/sprintf-js/-/sprintf-js-1.0.3.tgz", + "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=", + "dev": true + }, + "sshpk": { + "version": "1.15.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/sshpk/-/sshpk-1.15.1.tgz", + "integrity": "sha512-mSdgNUaidk+dRU5MhYtN9zebdzF2iG0cNPWy8HG+W8y+fT1JnSkh0fzzpjOa0L7P8i1Rscz38t0h4gPcKz43xA==", + "dev": true, + "requires": { + "asn1": "~0.2.3", + "assert-plus": "^1.0.0", + "bcrypt-pbkdf": "^1.0.0", + "dashdash": "^1.12.0", + "ecc-jsbn": "~0.1.1", + "getpass": "^0.1.1", + "jsbn": "~0.1.0", + "safer-buffer": "^2.0.2", + "tweetnacl": "~0.14.0" + } + }, + "stack-trace": { + "version": "0.0.10", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/stack-trace/-/stack-trace-0.0.10.tgz", + "integrity": "sha1-VHxws0fo0ytOEI6hoqFZ5f3eGcA=", + "dev": true + }, + "static-extend": { + "version": "0.1.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/static-extend/-/static-extend-0.1.2.tgz", + "integrity": "sha1-YICcOcv/VTNyJv1eC1IPNB8ftcY=", + "dev": true, + "requires": { + "define-property": "^0.2.5", + "object-copy": "^0.1.0" + }, + "dependencies": { + "define-property": { + "version": "0.2.5", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/define-property/-/define-property-0.2.5.tgz", + "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", + "dev": true, + "requires": { + "is-descriptor": "^0.1.0" + } + } + } + }, + "streamfilter": { + "version": "1.0.7", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/streamfilter/-/streamfilter-1.0.7.tgz", + "integrity": "sha512-Gk6KZM+yNA1JpW0KzlZIhjo3EaBJDkYfXtYSbOwNIQ7Zd6006E6+sCFlW1NDvFG/vnXhKmw6TJJgiEQg/8lXfQ==", + "dev": true, + "requires": { + "readable-stream": "^2.0.2" + } + }, + "string-template": { + "version": "0.2.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/string-template/-/string-template-0.2.1.tgz", + "integrity": "sha1-QpMuWYo1LQH8IuwzZ9nYTuxsmt0=", + "dev": true + }, + "string-width": { + "version": "2.1.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/string-width/-/string-width-2.1.1.tgz", + "integrity": "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==", + "dev": true, + "requires": { + "is-fullwidth-code-point": "^2.0.0", + "strip-ansi": "^4.0.0" + } + }, + "string_decoder": { + "version": "1.1.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/string_decoder/-/string_decoder-1.1.1.tgz", + "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", + "dev": true, + "requires": { + "safe-buffer": "~5.1.0" + } + }, + "strip-ansi": { + "version": "4.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/strip-ansi/-/strip-ansi-4.0.0.tgz", + "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", + "dev": true, + "requires": { + "ansi-regex": "^3.0.0" + } + }, + "strip-bom": { + "version": "3.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/strip-bom/-/strip-bom-3.0.0.tgz", + "integrity": "sha1-IzTBjpx1n3vdVv3vfprj1YjmjtM=", + "dev": true + }, + "strip-bom-stream": { + "version": "2.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/strip-bom-stream/-/strip-bom-stream-2.0.0.tgz", + "integrity": "sha1-+H217yYT9paKpUWr/h7HKLaoKco=", + "dev": true, + "requires": { + "first-chunk-stream": "^2.0.0", + "strip-bom": "^2.0.0" + }, + "dependencies": { + "strip-bom": { + "version": "2.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/strip-bom/-/strip-bom-2.0.0.tgz", + "integrity": "sha1-YhmoVhZSBJHzV4i9vxRHqZx+aw4=", + "dev": true, + "requires": { + "is-utf8": "^0.2.0" + } + } + } + }, + "strip-eof": { + "version": "1.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/strip-eof/-/strip-eof-1.0.0.tgz", + "integrity": "sha1-u0P/VZim6wXYm1n80SnJgzE2Br8=", + "dev": true + }, + "strip-indent": { + "version": "2.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/strip-indent/-/strip-indent-2.0.0.tgz", + "integrity": "sha1-XvjbKV0B5u1sv3qrlpmNeCJSe2g=", + "dev": true + }, + "supports-color": { + "version": "5.5.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } + }, + "symbol-observable": { + "version": "1.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/symbol-observable/-/symbol-observable-1.0.1.tgz", + "integrity": "sha1-g0D8RwLDEi310iKI+IKD9RPT/dQ=", + "dev": true + }, + "tabtab": { + "version": "2.2.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/tabtab/-/tabtab-2.2.2.tgz", + "integrity": "sha1-egR/FDsBC0y9MfhX6ClhUSy/ThQ=", + "dev": true, + "requires": { + "debug": "^2.2.0", + "inquirer": "^1.0.2", + "lodash.difference": "^4.5.0", + "lodash.uniq": "^4.5.0", + "minimist": "^1.2.0", + "mkdirp": "^0.5.1", + "npmlog": "^2.0.3", + "object-assign": "^4.1.0" + }, + "dependencies": { + "ansi-escapes": { + "version": "1.4.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/ansi-escapes/-/ansi-escapes-1.4.0.tgz", + "integrity": "sha1-06ioOzGapneTZisT52HHkRQiMG4=", + "dev": true + }, + "ansi-regex": { + "version": "2.1.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/ansi-regex/-/ansi-regex-2.1.1.tgz", + "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=", + "dev": true + }, + "ansi-styles": { + "version": "2.2.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/ansi-styles/-/ansi-styles-2.2.1.tgz", + "integrity": "sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4=", + "dev": true + }, + "chalk": { + "version": "1.1.3", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/chalk/-/chalk-1.1.3.tgz", + "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", + "dev": true, + "requires": { + "ansi-styles": "^2.2.1", + "escape-string-regexp": "^1.0.2", + "has-ansi": "^2.0.0", + "strip-ansi": "^3.0.0", + "supports-color": "^2.0.0" + } + }, + "cli-cursor": { + "version": "1.0.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/cli-cursor/-/cli-cursor-1.0.2.tgz", + "integrity": "sha1-ZNo/fValRBLll5S9Ytw1KV6PKYc=", + "dev": true, + "requires": { + "restore-cursor": "^1.0.1" + } + }, + "debug": { + "version": "2.6.9", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "dev": true, + "requires": { + "ms": "2.0.0" + } + }, + "external-editor": { + "version": "1.1.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/external-editor/-/external-editor-1.1.1.tgz", + "integrity": "sha1-Etew24UPf/fnCBuvQAVwAGDEYAs=", + "dev": true, + "requires": { + "extend": "^3.0.0", + "spawn-sync": "^1.0.15", + "tmp": "^0.0.29" + } + }, + "figures": { + "version": "1.7.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/figures/-/figures-1.7.0.tgz", + "integrity": "sha1-y+Hjr/zxzUS4DK3+0o3Hk6lwHS4=", + "dev": true, + "requires": { + "escape-string-regexp": "^1.0.5", + "object-assign": "^4.1.0" + } + }, + "inquirer": { + "version": "1.2.3", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/inquirer/-/inquirer-1.2.3.tgz", + "integrity": "sha1-TexvMvN+97sLLtPx0aXD9UUHSRg=", + "dev": true, + "requires": { + "ansi-escapes": "^1.1.0", + "chalk": "^1.0.0", + "cli-cursor": "^1.0.1", + "cli-width": "^2.0.0", + "external-editor": "^1.1.0", + "figures": "^1.3.5", + "lodash": "^4.3.0", + "mute-stream": "0.0.6", + "pinkie-promise": "^2.0.0", + "run-async": "^2.2.0", + "rx": "^4.1.0", + "string-width": "^1.0.1", + "strip-ansi": "^3.0.0", + "through": "^2.3.6" + } + }, + "is-fullwidth-code-point": { + "version": "1.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz", + "integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=", + "dev": true, + "requires": { + "number-is-nan": "^1.0.0" + } + }, + "minimist": { + "version": "1.2.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/minimist/-/minimist-1.2.0.tgz", + "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=", + "dev": true + }, + "mute-stream": { + "version": "0.0.6", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/mute-stream/-/mute-stream-0.0.6.tgz", + "integrity": "sha1-SJYrGeFp/R38JAs/HnMXYnu8R9s=", + "dev": true + }, + "onetime": { + "version": "1.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/onetime/-/onetime-1.1.0.tgz", + "integrity": "sha1-ofeDj4MUxRbwXs78vEzP4EtO14k=", + "dev": true + }, + "restore-cursor": { + "version": "1.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/restore-cursor/-/restore-cursor-1.0.1.tgz", + "integrity": "sha1-NGYfRohjJ/7SmRR5FSJS35LapUE=", + "dev": true, + "requires": { + "exit-hook": "^1.0.0", + "onetime": "^1.0.0" + } + }, + "string-width": { + "version": "1.0.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/string-width/-/string-width-1.0.2.tgz", + "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", + "dev": true, + "requires": { + "code-point-at": "^1.0.0", + "is-fullwidth-code-point": "^1.0.0", + "strip-ansi": "^3.0.0" + } + }, + "strip-ansi": { + "version": "3.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/strip-ansi/-/strip-ansi-3.0.1.tgz", + "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", + "dev": true, + "requires": { + "ansi-regex": "^2.0.0" + } + }, + "supports-color": { + "version": "2.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/supports-color/-/supports-color-2.0.0.tgz", + "integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc=", + "dev": true + }, + "tmp": { + "version": "0.0.29", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/tmp/-/tmp-0.0.29.tgz", + "integrity": "sha1-8lEl/w3Z2jzLDC3Tce4SiLuRKMA=", + "dev": true, + "requires": { + "os-tmpdir": "~1.0.1" + } + } + } + }, + "text-hex": { + "version": "1.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/text-hex/-/text-hex-1.0.0.tgz", + "integrity": "sha512-uuVGNWzgJ4yhRaNSiubPY7OjISw4sw4E5Uv0wbjp+OzcbmVU/rsT8ujgcXJhn9ypzsgr5vlzpPqP+MBBKcGvbg==", + "dev": true + }, + "text-table": { + "version": "0.2.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/text-table/-/text-table-0.2.0.tgz", + "integrity": "sha1-f17oI66AUgfACvLfSoTsP8+lcLQ=", + "dev": true + }, + "textextensions": { + "version": "2.2.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/textextensions/-/textextensions-2.2.0.tgz", + "integrity": "sha512-j5EMxnryTvKxwH2Cq+Pb43tsf6sdEgw6Pdwxk83mPaq0ToeFJt6WE4J3s5BqY7vmjlLgkgXvhtXUxo80FyBhCA==", + "dev": true + }, + "through": { + "version": "2.3.8", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/through/-/through-2.3.8.tgz", + "integrity": "sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU=", + "dev": true + }, + "through2": { + "version": "2.0.3", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/through2/-/through2-2.0.3.tgz", + "integrity": "sha1-AARWmzfHx0ujnEPzzteNGtlBQL4=", + "dev": true, + "requires": { + "readable-stream": "^2.1.5", + "xtend": "~4.0.1" + } + }, + "timed-out": { + "version": "4.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/timed-out/-/timed-out-4.0.1.tgz", + "integrity": "sha1-8y6srFoXW+ol1/q1Zas+2HQe9W8=", + "dev": true + }, + "tmp": { + "version": "0.0.33", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/tmp/-/tmp-0.0.33.tgz", + "integrity": "sha512-jRCJlojKnZ3addtTOjdIqoRuPEKBvNXcGYqzO6zWZX8KfKEpnGY5jfggJQ3EjKuu8D4bJRr0y+cYJFmYbImXGw==", + "dev": true, + "requires": { + "os-tmpdir": "~1.0.2" + } + }, + "to-object-path": { + "version": "0.3.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/to-object-path/-/to-object-path-0.3.0.tgz", + "integrity": "sha1-KXWIt7Dn4KwI4E5nL4XB9JmeF68=", + "dev": true, + "requires": { + "kind-of": "^3.0.2" + }, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true, + "requires": { + "is-buffer": "^1.1.5" + } + } + } + }, + "to-regex": { + "version": "3.0.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/to-regex/-/to-regex-3.0.2.tgz", + "integrity": "sha512-FWtleNAtZ/Ki2qtqej2CXTOayOH9bHDQF+Q48VpWyDXjbYxA4Yz8iDB31zXOBUlOHHKidDbqGVrTUvQMPmBGBw==", + "dev": true, + "requires": { + "define-property": "^2.0.2", + "extend-shallow": "^3.0.2", + "regex-not": "^1.0.2", + "safe-regex": "^1.1.0" + }, + "dependencies": { + "extend-shallow": { + "version": "3.0.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/extend-shallow/-/extend-shallow-3.0.2.tgz", + "integrity": "sha1-Jqcarwc7OfshJxcnRhMcJwQCjbg=", + "dev": true, + "requires": { + "assign-symbols": "^1.0.0", + "is-extendable": "^1.0.1" + } + }, + "is-extendable": { + "version": "1.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/is-extendable/-/is-extendable-1.0.1.tgz", + "integrity": "sha512-arnXMxT1hhoKo9k1LZdmlNyJdDDfy2v0fXjFlmok4+i8ul/6WlbVge9bhM74OpNPQPMGUToDtz+KXa1PneJxOA==", + "dev": true, + "requires": { + "is-plain-object": "^2.0.4" + } + } + } + }, + "to-regex-range": { + "version": "2.1.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/to-regex-range/-/to-regex-range-2.1.1.tgz", + "integrity": "sha1-fIDBe53+vlmeJzZ+DU3VWQFB2zg=", + "dev": true, + "requires": { + "is-number": "^3.0.0", + "repeat-string": "^1.6.1" + } + }, + "tough-cookie": { + "version": "2.4.3", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/tough-cookie/-/tough-cookie-2.4.3.tgz", + "integrity": "sha512-Q5srk/4vDM54WJsJio3XNn6K2sCG+CQ8G5Wz6bZhRZoAe/+TxjWB/GlFAnYEbkYVlON9FMk/fE3h2RLpPXo4lQ==", + "dev": true, + "requires": { + "psl": "^1.1.24", + "punycode": "^1.4.1" + } + }, + "trim-newlines": { + "version": "2.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/trim-newlines/-/trim-newlines-2.0.0.tgz", + "integrity": "sha1-tAPQuRvlDDMd/EuC7s6yLD3hbSA=", + "dev": true + }, + "triple-beam": { + "version": "1.3.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/triple-beam/-/triple-beam-1.3.0.tgz", + "integrity": "sha512-XrHUvV5HpdLmIj4uVMxHggLbFSZYIn7HEWsqePZcI50pco+MPqJ50wMGY794X7AOOhxOBAjbkqfAbEe/QMp2Lw==", + "dev": true + }, + "tunnel-agent": { + "version": "0.6.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/tunnel-agent/-/tunnel-agent-0.6.0.tgz", + "integrity": "sha1-J6XeoGs2sEoKmWZ3SykIaPD8QP0=", + "dev": true, + "requires": { + "safe-buffer": "^5.0.1" + } + }, + "tweetnacl": { + "version": "0.14.5", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/tweetnacl/-/tweetnacl-0.14.5.tgz", + "integrity": "sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q=", + "dev": true + }, + "typedarray": { + "version": "0.0.6", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/typedarray/-/typedarray-0.0.6.tgz", + "integrity": "sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=", + "dev": true + }, + "union-value": { + "version": "1.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/union-value/-/union-value-1.0.0.tgz", + "integrity": "sha1-XHHDTLW61dzr4+oM0IIHulqhrqQ=", + "dev": true, + "requires": { + "arr-union": "^3.1.0", + "get-value": "^2.0.6", + "is-extendable": "^0.1.1", + "set-value": "^0.4.3" + }, + "dependencies": { + "arr-union": { + "version": "3.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/arr-union/-/arr-union-3.1.0.tgz", + "integrity": "sha1-45sJrqne+Gao8gbiiK9jkZuuOcQ=", + "dev": true + }, + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "dev": true, + "requires": { + "is-extendable": "^0.1.0" + } + }, + "set-value": { + "version": "0.4.3", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/set-value/-/set-value-0.4.3.tgz", + "integrity": "sha1-fbCPnT0i3H945Trzw79GZuzfzPE=", + "dev": true, + "requires": { + "extend-shallow": "^2.0.1", + "is-extendable": "^0.1.1", + "is-plain-object": "^2.0.1", + "to-object-path": "^0.3.0" + } + } + } + }, + "universalify": { + "version": "0.1.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/universalify/-/universalify-0.1.2.tgz", + "integrity": "sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==", + "dev": true + }, + "unset-value": { + "version": "1.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/unset-value/-/unset-value-1.0.0.tgz", + "integrity": "sha1-g3aHP30jNRef+x5vw6jtDfyKtVk=", + "dev": true, + "requires": { + "has-value": "^0.3.1", + "isobject": "^3.0.0" + }, + "dependencies": { + "has-value": { + "version": "0.3.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/has-value/-/has-value-0.3.1.tgz", + "integrity": "sha1-ex9YutpiyoJ+wKIHgCVlSEWZXh8=", + "dev": true, + "requires": { + "get-value": "^2.0.3", + "has-values": "^0.1.4", + "isobject": "^2.0.0" + }, + "dependencies": { + "isobject": { + "version": "2.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/isobject/-/isobject-2.1.0.tgz", + "integrity": "sha1-8GVWEJaj8dou9GJy+BXIQNh+DIk=", + "dev": true, + "requires": { + "isarray": "1.0.0" + } + } + } + }, + "has-values": { + "version": "0.1.4", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/has-values/-/has-values-0.1.4.tgz", + "integrity": "sha1-bWHeldkd/Km5oCCJrThL/49it3E=", + "dev": true + } + } + }, + "untildify": { + "version": "3.0.3", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/untildify/-/untildify-3.0.3.tgz", + "integrity": "sha512-iSk/J8efr8uPT/Z4eSUywnqyrQU7DSdMfdqK4iWEaUVVmcP5JcnpRqmVMwcwcnmI1ATFNgC5V90u09tBynNFKA==", + "dev": true + }, + "urix": { + "version": "0.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/urix/-/urix-0.1.0.tgz", + "integrity": "sha1-2pN/emLiH+wf0Y1Js1wpNQZ6bHI=", + "dev": true + }, + "url-parse-lax": { + "version": "1.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/url-parse-lax/-/url-parse-lax-1.0.0.tgz", + "integrity": "sha1-evjzA2Rem9eaJy56FKxovAYJ2nM=", + "dev": true, + "requires": { + "prepend-http": "^1.0.1" + } + }, + "url-to-options": { + "version": "1.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/url-to-options/-/url-to-options-1.0.1.tgz", + "integrity": "sha1-FQWgOiiaSMvXpDTvuu7FBV9WM6k=", + "dev": true + }, + "use": { + "version": "3.1.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/use/-/use-3.1.1.tgz", + "integrity": "sha512-cwESVXlO3url9YWlFW/TA9cshCEhtu7IKJ/p5soJ/gGpj7vbvFrAY/eIioQ6Dw23KjZhYgiIo8HOs1nQ2vr/oQ==", + "dev": true + }, + "util-deprecate": { + "version": "1.0.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/util-deprecate/-/util-deprecate-1.0.2.tgz", + "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=", + "dev": true + }, + "uuid": { + "version": "3.3.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/uuid/-/uuid-3.3.2.tgz", + "integrity": "sha512-yXJmeNaw3DnnKAOKJE51sL/ZaYfWJRl1pK9dr19YFCu0ObS231AB1/LbqTKRAQ5kw8A90rA6fr4riOUpTZvQZA==", + "dev": true + }, + "validate-npm-package-license": { + "version": "3.0.4", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz", + "integrity": "sha512-DpKm2Ui/xN7/HQKCtpZxoRWBhZ9Z0kqtygG8XCgNQ8ZlDnxuQmWhj566j8fN4Cu3/JmbhsDo7fcAJq4s9h27Ew==", + "dev": true, + "requires": { + "spdx-correct": "^3.0.0", + "spdx-expression-parse": "^3.0.0" + } + }, + "verror": { + "version": "1.10.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/verror/-/verror-1.10.0.tgz", + "integrity": "sha1-OhBcoXBTr1XW4nDB+CiGguGNpAA=", + "dev": true, + "requires": { + "assert-plus": "^1.0.0", + "core-util-is": "1.0.2", + "extsprintf": "^1.2.0" + } + }, + "vinyl": { + "version": "1.2.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/vinyl/-/vinyl-1.2.0.tgz", + "integrity": "sha1-XIgDbPVl5d8FVYv8kR+GVt8hiIQ=", + "dev": true, + "requires": { + "clone": "^1.0.0", + "clone-stats": "^0.0.1", + "replace-ext": "0.0.1" + } + }, + "vinyl-file": { + "version": "2.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/vinyl-file/-/vinyl-file-2.0.0.tgz", + "integrity": "sha1-p+v1/779obfRjRQPyweyI++2dRo=", + "dev": true, + "requires": { + "graceful-fs": "^4.1.2", + "pify": "^2.3.0", + "pinkie-promise": "^2.0.0", + "strip-bom": "^2.0.0", + "strip-bom-stream": "^2.0.0", + "vinyl": "^1.1.0" + }, + "dependencies": { + "pify": { + "version": "2.3.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/pify/-/pify-2.3.0.tgz", + "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=", + "dev": true + }, + "strip-bom": { + "version": "2.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/strip-bom/-/strip-bom-2.0.0.tgz", + "integrity": "sha1-YhmoVhZSBJHzV4i9vxRHqZx+aw4=", + "dev": true, + "requires": { + "is-utf8": "^0.2.0" + } + } + } + }, + "which": { + "version": "1.3.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/which/-/which-1.3.1.tgz", + "integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==", + "dev": true, + "requires": { + "isexe": "^2.0.0" + } + }, + "win-release": { + "version": "1.1.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/win-release/-/win-release-1.1.1.tgz", + "integrity": "sha1-X6VeAr58qTTt/BJmVjLoSbcuUgk=", + "dev": true, + "requires": { + "semver": "^5.0.1" + } + }, + "winston": { + "version": "3.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/winston/-/winston-3.1.0.tgz", + "integrity": "sha512-FsQfEE+8YIEeuZEYhHDk5cILo1HOcWkGwvoidLrDgPog0r4bser1lEIOco2dN9zpDJ1M88hfDgZvxe5z4xNcwg==", + "dev": true, + "requires": { + "async": "^2.6.0", + "diagnostics": "^1.1.1", + "is-stream": "^1.1.0", + "logform": "^1.9.1", + "one-time": "0.0.4", + "readable-stream": "^2.3.6", + "stack-trace": "0.0.x", + "triple-beam": "^1.3.0", + "winston-transport": "^4.2.0" + } + }, + "winston-transport": { + "version": "4.2.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/winston-transport/-/winston-transport-4.2.0.tgz", + "integrity": "sha512-0R1bvFqxSlK/ZKTH86nymOuKv/cT1PQBMuDdA7k7f0S9fM44dNH6bXnuxwXPrN8lefJgtZq08BKdyZ0DZIy/rg==", + "dev": true, + "requires": { + "readable-stream": "^2.3.6", + "triple-beam": "^1.2.0" + } + }, + "wrappy": { + "version": "1.0.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", + "dev": true + }, + "write-file-atomic": { + "version": "2.3.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/write-file-atomic/-/write-file-atomic-2.3.0.tgz", + "integrity": "sha512-xuPeK4OdjWqtfi59ylvVL0Yn35SF3zgcAcv7rBPFHVaEapaDr4GdGgm3j7ckTwH9wHL7fGmgfAnb0+THrHb8tA==", + "dev": true, + "requires": { + "graceful-fs": "^4.1.11", + "imurmurhash": "^0.1.4", + "signal-exit": "^3.0.2" + } + }, + "xtend": { + "version": "4.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/xtend/-/xtend-4.0.1.tgz", + "integrity": "sha1-pcbVMr5lbiPbgg77lDofBJmNY68=", + "dev": true + }, + "yallist": { + "version": "2.1.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/yallist/-/yallist-2.1.2.tgz", + "integrity": "sha1-HBH5IY8HYImkfdUS+TxmmaaoHVI=", + "dev": true + }, + "yargs-parser": { + "version": "10.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/yargs-parser/-/yargs-parser-10.1.0.tgz", + "integrity": "sha512-VCIyR1wJoEBZUqk5PA+oOBF6ypbwh5aNB3I50guxAL/quggdfs4TtNHQrSazFA3fYZ+tEqfs0zIGlv0c/rgjbQ==", + "dev": true, + "requires": { + "camelcase": "^4.1.0" + } + }, + "yeoman-environment": { + "version": "2.3.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/yeoman-environment/-/yeoman-environment-2.3.0.tgz", + "integrity": "sha512-PHSAkVOqYdcR+C+Uht1SGC4eVD/9OhygYFkYaI66xF8vKIeS1RNYay+umj2ZrQeJ50tF5Q/RSO6qGDz9y3Ifug==", + "dev": true, + "requires": { + "chalk": "^2.1.0", + "cross-spawn": "^6.0.5", + "debug": "^3.1.0", + "diff": "^3.3.1", + "escape-string-regexp": "^1.0.2", + "globby": "^8.0.1", + "grouped-queue": "^0.3.3", + "inquirer": "^5.2.0", + "is-scoped": "^1.0.0", + "lodash": "^4.17.10", + "log-symbols": "^2.1.0", + "mem-fs": "^1.1.0", + "strip-ansi": "^4.0.0", + "text-table": "^0.2.0", + "untildify": "^3.0.2" + }, + "dependencies": { + "cross-spawn": { + "version": "6.0.5", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/cross-spawn/-/cross-spawn-6.0.5.tgz", + "integrity": "sha512-eTVLrBSt7fjbDygz805pMnstIs2VTBNkRm0qxZd+M7A5XDdxVRWO5MxGBXZhjY4cqLYLdtrGqRf8mBPmzwSpWQ==", + "dev": true, + "requires": { + "nice-try": "^1.0.4", + "path-key": "^2.0.1", + "semver": "^5.5.0", + "shebang-command": "^1.2.0", + "which": "^1.2.9" + } + } + } + }, + "yeoman-generator": { + "version": "3.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/yeoman-generator/-/yeoman-generator-3.0.0.tgz", + "integrity": "sha512-aHsNXzkdgAoakZTZsDX7T56wYWYd1O5E/GBIFAVMJLH7TKRr+1MiEJszZQbbCSA+J+lpT743/8L88j35yNdTLQ==", + "dev": true, + "requires": { + "async": "^2.6.0", + "chalk": "^2.3.0", + "cli-table": "^0.3.1", + "cross-spawn": "^6.0.5", + "dargs": "^6.0.0", + "dateformat": "^3.0.3", + "debug": "^3.1.0", + "detect-conflict": "^1.0.0", + "error": "^7.0.2", + "find-up": "^3.0.0", + "github-username": "^4.0.0", + "istextorbinary": "^2.2.1", + "lodash": "^4.17.10", + "make-dir": "^1.1.0", + "mem-fs-editor": "^5.0.0", + "minimist": "^1.2.0", + "pretty-bytes": "^5.1.0", + "read-chunk": "^2.1.0", + "read-pkg-up": "^4.0.0", + "rimraf": "^2.6.2", + "run-async": "^2.0.0", + "shelljs": "^0.8.0", + "text-table": "^0.2.0", + "through2": "^2.0.0", + "yeoman-environment": "^2.0.5" + }, + "dependencies": { + "cross-spawn": { + "version": "6.0.5", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/cross-spawn/-/cross-spawn-6.0.5.tgz", + "integrity": "sha512-eTVLrBSt7fjbDygz805pMnstIs2VTBNkRm0qxZd+M7A5XDdxVRWO5MxGBXZhjY4cqLYLdtrGqRf8mBPmzwSpWQ==", + "dev": true, + "requires": { + "nice-try": "^1.0.4", + "path-key": "^2.0.1", + "semver": "^5.5.0", + "shebang-command": "^1.2.0", + "which": "^1.2.9" + } + }, + "find-up": { + "version": "3.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/find-up/-/find-up-3.0.0.tgz", + "integrity": "sha512-1yD6RmLI1XBfxugvORwlck6f75tYL+iR0jqwsOrOxMZyGYqUuDhJ0l4AXdO1iX/FTs9cBAMEk1gWSEx1kSbylg==", + "dev": true, + "requires": { + "locate-path": "^3.0.0" + } + }, + "locate-path": { + "version": "3.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/locate-path/-/locate-path-3.0.0.tgz", + "integrity": "sha512-7AO748wWnIhNqAuaty2ZWHkQHRSNfPVIsPIfwEOWO22AmaoVrWavlOcMR5nzTLNYvp36X220/maaRsrec1G65A==", + "dev": true, + "requires": { + "p-locate": "^3.0.0", + "path-exists": "^3.0.0" + } + }, + "minimist": { + "version": "1.2.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/minimist/-/minimist-1.2.0.tgz", + "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=", + "dev": true + }, + "p-limit": { + "version": "2.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/p-limit/-/p-limit-2.0.0.tgz", + "integrity": "sha512-fl5s52lI5ahKCernzzIyAP0QAZbGIovtVHGwpcu1Jr/EpzLVDI2myISHwGqK7m8uQFugVWSrbxH7XnhGtvEc+A==", + "dev": true, + "requires": { + "p-try": "^2.0.0" + } + }, + "p-locate": { + "version": "3.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/p-locate/-/p-locate-3.0.0.tgz", + "integrity": "sha512-x+12w/To+4GFfgJhBEpiDcLozRJGegY+Ei7/z0tSLkMmxGZNybVMSfWj9aJn8Z5Fc7dBUNJOOVgPv2H7IwulSQ==", + "dev": true, + "requires": { + "p-limit": "^2.0.0" + } + }, + "p-try": { + "version": "2.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/p-try/-/p-try-2.0.0.tgz", + "integrity": "sha512-hMp0onDKIajHfIkdRk3P4CdCmErkYAxxDtP3Wx/4nZ3aGlau2VKh3mZpcuFkH27WQkL/3WBCPOktzA9ZOAnMQQ==", + "dev": true + }, + "read-pkg-up": { + "version": "4.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/read-pkg-up/-/read-pkg-up-4.0.0.tgz", + "integrity": "sha512-6etQSH7nJGsK0RbG/2TeDzZFa8shjQ1um+SwQQ5cwKy0dhSXdOncEhb1CPpvQG4h7FyOV6EB6YlV0yJvZQNAkA==", + "dev": true, + "requires": { + "find-up": "^3.0.0", + "read-pkg": "^3.0.0" + } + } + } + } + } +} diff --git a/jhipster/jhipster-uaa/quotes/package.json b/jhipster/jhipster-uaa/quotes/package.json new file mode 100644 index 0000000000..797077d9d2 --- /dev/null +++ b/jhipster/jhipster-uaa/quotes/package.json @@ -0,0 +1,16 @@ +{ + "name": "quotes", + "version": "0.0.0", + "description": "Description for quotes", + "private": true, + "license": "UNLICENSED", + "cacheDirectories": [ + "node_modules" + ], + "devDependencies": { + "generator-jhipster": "5.4.2" + }, + "engines": { + "node": ">=8.9.0" + } +} diff --git a/jhipster/jhipster-uaa/quotes/pom.xml b/jhipster/jhipster-uaa/quotes/pom.xml new file mode 100644 index 0000000000..9984f009ff --- /dev/null +++ b/jhipster/jhipster-uaa/quotes/pom.xml @@ -0,0 +1,915 @@ + + + 4.0.0 + + com.baeldung.jhipster.quotes + quotes + 0.0.1-SNAPSHOT + war + Quotes + + + + + + + + + + 3.0.0 + 1.8 + 2.12.6 + v8.12.0 + 6.4.1 + UTF-8 + UTF-8 + ${project.build.directory}/test-results + yyyyMMddHHmmss + ${java.version} + ${java.version} + -Djava.security.egd=file:/dev/./urandom -Xmx256m + jdt_apt + false + + + + + + + 2.0.25 + + 2.0.5.RELEASE + + 5.2.17.Final + + 3.22.0-GA + + 3.5.5 + 3.6 + 2.0.1.Final + 1.2.0.Final + + + 3.1.0 + 3.8.0 + 2.10 + 3.0.0-M2 + 3.1.0 + 2.22.0 + 3.2.2 + 0.9.11 + 0.8.2 + 3.4.2 + 3.5.0.1254 + 2.2.5 + + + http://localhost:9001 + src/main/webapp/content/**/*.*, src/main/webapp/i18n/*.js, target/www/**/*.* + S3437,S4684,UndocumentedApi,BoldAndItalicTagsCheck + + src/main/webapp/app/**/*.* + Web:BoldAndItalicTagsCheck + + src/main/java/**/* + squid:S3437 + + src/main/java/**/* + squid:UndocumentedApi + + src/main/java/**/* + squid:S4684 + ${project.testresult.directory}/coverage/jacoco/jacoco.exec + jacoco + ${project.testresult.directory}/lcov.info + ${project.basedir}/src/main/ + ${project.testresult.directory}/surefire-reports + ${project.basedir}/src/test/ + + + + + + + + io.github.jhipster + jhipster-dependencies + ${jhipster-dependencies.version} + pom + import + + + + + + + + io.github.jhipster + jhipster-framework + + + + org.springframework.boot + spring-boot-starter-cache + + + io.dropwizard.metrics + metrics-core + + + io.dropwizard.metrics + metrics-annotation + + + io.dropwizard.metrics + metrics-json + + + io.dropwizard.metrics + metrics-jvm + + + io.dropwizard.metrics + metrics-servlet + + + io.dropwizard.metrics + metrics-servlets + + + com.fasterxml.jackson.datatype + jackson-datatype-hibernate5 + + + com.fasterxml.jackson.datatype + jackson-datatype-hppc + + + com.fasterxml.jackson.datatype + jackson-datatype-jsr310 + + + com.fasterxml.jackson.module + jackson-module-afterburner + + + com.h2database + h2 + test + + + com.hazelcast + hazelcast + + + com.hazelcast + hazelcast-hibernate52 + + + com.hazelcast + hazelcast-spring + + + com.jayway.jsonpath + json-path + test + + + + io.springfox + springfox-swagger2 + + + io.springfox + springfox-bean-validators + + + com.mattbertolini + liquibase-slf4j + + + com.ryantenney.metrics + metrics-spring + + + com.zaxxer + HikariCP + + + commons-io + commons-io + + + org.apache.commons + commons-lang3 + + + javax.cache + cache-api + + + mysql + mysql-connector-java + + + org.assertj + assertj-core + test + + + org.hibernate + hibernate-jpamodelgen + ${hibernate.version} + provided + + + org.hibernate + hibernate-envers + + + org.hibernate.validator + hibernate-validator + + + org.liquibase + liquibase-core + + + net.logstash.logback + logstash-logback-encoder + + + org.mapstruct + mapstruct-jdk8 + ${mapstruct.version} + + + org.mapstruct + mapstruct-processor + ${mapstruct.version} + provided + + + org.springframework.boot + spring-boot-configuration-processor + provided + + + org.springframework.boot + spring-boot-loader-tools + + + org.springframework.boot + spring-boot-starter-actuator + + + org.springframework.boot + spring-boot-starter-aop + + + org.springframework.boot + spring-boot-starter-data-jpa + + + org.springframework.boot + spring-boot-starter-logging + + + org.springframework.boot + spring-boot-starter-mail + + + org.springframework.boot + spring-boot-starter-security + + + org.springframework.boot + spring-boot-starter-thymeleaf + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework.boot + spring-boot-starter-test + test + + + org.springframework.boot + spring-boot-test + test + + + org.springframework.security + spring-security-test + test + + + org.zalando + problem-spring-web + 0.24.0-RC.0 + + + org.springframework.security.oauth + spring-security-oauth2 + + + org.springframework.security + spring-security-jwt + + + + org.springframework.cloud + spring-cloud-starter + + + org.springframework.cloud + spring-cloud-starter-netflix-ribbon + + + org.springframework.cloud + spring-cloud-starter-netflix-hystrix + + + org.springframework.retry + spring-retry + + + org.springframework.cloud + spring-cloud-starter-netflix-eureka-client + + + org.springframework.cloud + spring-cloud-starter-config + + + org.springframework.cloud + spring-cloud-security + + + org.springframework.cloud + spring-cloud-starter-openfeign + + + org.springframework.cloud + spring-cloud-spring-service-connector + + + + org.springframework.security + spring-security-data + + + + + + spring-boot:run + + + org.apache.maven.plugins + maven-compiler-plugin + ${maven-compiler-plugin.version} + + + + org.mapstruct + mapstruct-processor + ${mapstruct.version} + + + + org.hibernate + hibernate-jpamodelgen + ${hibernate.version} + + + + + + + org.apache.maven.plugins + maven-eclipse-plugin + ${maven-eclipse-plugin.version} + + true + true + + + + org.apache.maven.plugins + maven-enforcer-plugin + ${maven-enforcer-plugin.version} + + + enforce-versions + + enforce + + + + + + + You are running an older version of Maven. JHipster requires at least Maven ${maven.version} + [${maven.version},) + + + + You are running an incompatible version of Java. JHipster requires JDK ${java.version} + [1.8,1.9) + + + + + + org.apache.maven.plugins + maven-resources-plugin + ${maven-resources-plugin.version} + + + default-resources + validate + + copy-resources + + + target/classes + false + + # + + + + src/main/resources/ + true + + config/*.yml + + + + src/main/resources/ + false + + config/*.yml + + + + + + + docker-resources + verify + + copy-resources + + + target/classes/static/ + + + target/www + false + + + + + + + + org.apache.maven.plugins + maven-surefire-plugin + ${maven-surefire-plugin.version} + + + alphabetical + + + + org.jacoco + jacoco-maven-plugin + ${jacoco-maven-plugin.version} + + + pre-unit-tests + + prepare-agent + + + + ${project.testresult.directory}/coverage/jacoco/jacoco.exec + + + + + post-unit-test + test + + report + + + ${project.testresult.directory}/coverage/jacoco/jacoco.exec + ${project.testresult.directory}/coverage/jacoco + + + + + + org.sonarsource.scanner.maven + sonar-maven-plugin + ${sonar-maven-plugin.version} + + + org.liquibase + liquibase-maven-plugin + ${liquibase.version} + + src/main/resources/config/liquibase/master.xml + src/main/resources/config/liquibase/changelog/${maven.build.timestamp}_changelog.xml + org.h2.Driver + jdbc:h2:file:./target/h2db/db/quotes + + quotes + + hibernate:spring:com.baeldung.jhipster.quotes.domain?dialect=org.hibernate.dialect.H2Dialect&hibernate.physical_naming_strategy=org.springframework.boot.orm.jpa.hibernate.SpringPhysicalNamingStrategy&hibernate.implicit_naming_strategy=org.springframework.boot.orm.jpa.hibernate.SpringImplicitNamingStrategy + true + debug + + + + org.javassist + javassist + ${javassist.version} + + + org.liquibase.ext + liquibase-hibernate5 + ${liquibase-hibernate5.version} + + + org.springframework.boot + spring-boot-starter-data-jpa + ${spring-boot.version} + + + javax.validation + validation-api + ${validation-api.version} + + + + + org.springframework.boot + spring-boot-maven-plugin + ${spring-boot.version} + + + + repackage + + + + + ${start-class} + true + true + + + + + com.google.cloud.tools + jib-maven-plugin + ${jib-maven-plugin.version} + + + openjdk:8-jre-alpine + + + quotes:latest + + + + sh + + chmod +x /entrypoint.sh && sync && /entrypoint.sh + + + 8081 + 5701/udp + + + ALWAYS + 0 + + true + + + + + + + + + + org.eclipse.m2e + lifecycle-mapping + 1.0.0 + + + + + + org.jacoco + + jacoco-maven-plugin + + + ${jacoco-maven-plugin.version} + + + prepare-agent + + + + + + + + + + + + + + + + no-liquibase + + ,no-liquibase + + + + swagger + + ,swagger + + + + tls + + ,tls + + + + dev + + true + + + + org.springframework.boot + spring-boot-starter-undertow + + + org.springframework.boot + spring-boot-devtools + true + + + com.h2database + h2 + + + + + + org.apache.maven.plugins + maven-war-plugin + ${maven-war-plugin.version} + + false + + + + + + + dev${profile.tls}${profile.no-liquibase} + + + + prod + + + org.springframework.boot + spring-boot-starter-undertow + + + + + + maven-clean-plugin + ${maven-clean-plugin.version} + + + + target/www/ + + + + + + org.apache.maven.plugins + maven-war-plugin + ${maven-war-plugin.version} + + false + + + + org.springframework.boot + spring-boot-maven-plugin + ${spring-boot.version} + + ${start-class} + true + + + + + build-info + + + + + + pl.project13.maven + git-commit-id-plugin + ${git-commit-id-plugin.version} + + + + revision + + + + + false + true + + ^git.commit.id.abbrev$ + ^git.commit.id.describe$ + ^git.branch$ + + + + + + + + prod${profile.swagger}${profile.no-liquibase} + + + + + cc + + + org.springframework.boot + spring-boot-starter-undertow + + + org.springframework.boot + spring-boot-devtools + true + + + + + + org.apache.maven.plugins + maven-war-plugin + ${maven-war-plugin.version} + + false + src/main/webapp/ + + + + org.springframework.boot + spring-boot-maven-plugin + ${spring-boot.version} + + ${start-class} + true + true + true + + + + + org.apache.maven.plugins + maven-compiler-plugin + ${maven-compiler-plugin.version} + + + default-compile + none + + + default-testCompile + none + + + + + net.alchim31.maven + scala-maven-plugin + ${scala-maven-plugin.version} + + + compile + compile + + add-source + compile + + + + test-compile + test-compile + + add-source + testCompile + + + + + incremental + true + ${scala.version} + + + + + + + dev,swagger + + + + + zipkin + + + org.springframework.cloud + spring-cloud-starter-zipkin + + + + + + IDE + + + org.mapstruct + mapstruct-processor + ${mapstruct.version} + + + org.hibernate + hibernate-jpamodelgen + ${hibernate.version} + + + + + + diff --git a/jhipster/jhipster-uaa/quotes/quotes.jh b/jhipster/jhipster-uaa/quotes/quotes.jh new file mode 100644 index 0000000000..daa5698fc4 --- /dev/null +++ b/jhipster/jhipster-uaa/quotes/quotes.jh @@ -0,0 +1,13 @@ +// JDL definition for application 'quotes' generated with command 'jhipster export-jdl' + +entity Quote { + symbol String required unique, + price BigDecimal required, + lastTrade ZonedDateTime required +} +dto Quote with mapstruct +paginate Quote with pagination +service Quote with serviceImpl +microservice Quote with quotes +filter Quote +clientRootFolder Quote with quotes diff --git a/jhipster/jhipster-uaa/quotes/src/main/docker/.dockerignore b/jhipster/jhipster-uaa/quotes/src/main/docker/.dockerignore new file mode 100644 index 0000000000..b03bdc71ee --- /dev/null +++ b/jhipster/jhipster-uaa/quotes/src/main/docker/.dockerignore @@ -0,0 +1,14 @@ +# https://docs.docker.com/engine/reference/builder/#dockerignore-file +classes/ +generated-sources/ +generated-test-sources/ +h2db/ +maven-archiver/ +maven-status/ +reports/ +surefire-reports/ +test-classes/ +test-results/ +www/ +!*.jar +!*.war diff --git a/jhipster/jhipster-uaa/quotes/src/main/docker/Dockerfile b/jhipster/jhipster-uaa/quotes/src/main/docker/Dockerfile new file mode 100644 index 0000000000..6c663a2919 --- /dev/null +++ b/jhipster/jhipster-uaa/quotes/src/main/docker/Dockerfile @@ -0,0 +1,20 @@ +FROM openjdk:8-jre-alpine + +ENV SPRING_OUTPUT_ANSI_ENABLED=ALWAYS \ + JHIPSTER_SLEEP=0 \ + JAVA_OPTS="" + +# Add a jhipster user to run our application so that it doesn't need to run as root +RUN adduser -D -s /bin/sh jhipster +WORKDIR /home/jhipster + +ADD entrypoint.sh entrypoint.sh +RUN chmod 755 entrypoint.sh && chown jhipster:jhipster entrypoint.sh +USER jhipster + +ENTRYPOINT ["./entrypoint.sh"] + +EXPOSE 8081 5701/udp + +ADD *.war app.war + diff --git a/jhipster/jhipster-uaa/quotes/src/main/docker/app.yml b/jhipster/jhipster-uaa/quotes/src/main/docker/app.yml new file mode 100644 index 0000000000..8c28c83011 --- /dev/null +++ b/jhipster/jhipster-uaa/quotes/src/main/docker/app.yml @@ -0,0 +1,22 @@ +version: '2' +services: + quotes-app: + image: quotes + environment: + # - _JAVA_OPTIONS=-Xmx512m -Xms256m + - SPRING_PROFILES_ACTIVE=prod,swagger + - EUREKA_CLIENT_SERVICE_URL_DEFAULTZONE=http://admin:$${jhipster.registry.password}@jhipster-registry:8761/eureka + - SPRING_CLOUD_CONFIG_URI=http://admin:$${jhipster.registry.password}@jhipster-registry:8761/config + - SPRING_DATASOURCE_URL=jdbc:mysql://quotes-mysql:3306/quotes?useUnicode=true&characterEncoding=utf8&useSSL=false + - JHIPSTER_SLEEP=30 # gives time for the JHipster Registry to boot before the application + quotes-mysql: + extends: + file: mysql.yml + service: quotes-mysql + jhipster-registry: + extends: + file: jhipster-registry.yml + service: jhipster-registry + environment: + - SPRING_CLOUD_CONFIG_SERVER_COMPOSITE_0_TYPE=native + - SPRING_CLOUD_CONFIG_SERVER_COMPOSITE_0_SEARCH_LOCATIONS=file:./central-config/docker-config/ diff --git a/jhipster/jhipster-uaa/quotes/src/main/docker/central-server-config/README.md b/jhipster/jhipster-uaa/quotes/src/main/docker/central-server-config/README.md new file mode 100644 index 0000000000..6aab9ffdd5 --- /dev/null +++ b/jhipster/jhipster-uaa/quotes/src/main/docker/central-server-config/README.md @@ -0,0 +1,7 @@ +# Central configuration sources details + +The JHipster-Registry will use the following directories as its configuration source : +- localhost-config : when running the registry in docker with the jhipster-registry.yml docker-compose file +- docker-config : when running the registry and the app both in docker with the app.yml docker-compose file + +For more info, refer to https://www.jhipster.tech/microservices-architecture/#registry_app_configuration diff --git a/jhipster/jhipster-uaa/quotes/src/main/docker/central-server-config/docker-config/application.yml b/jhipster/jhipster-uaa/quotes/src/main/docker/central-server-config/docker-config/application.yml new file mode 100644 index 0000000000..8a973c0a35 --- /dev/null +++ b/jhipster/jhipster-uaa/quotes/src/main/docker/central-server-config/docker-config/application.yml @@ -0,0 +1,15 @@ +# Common configuration shared between all applications +configserver: + name: Docker JHipster Registry + status: Connected to the JHipster Registry running in Docker + +jhipster: + security: + authentication: + jwt: + secret: my-secret-key-which-should-be-changed-in-production-and-be-base64-encoded + +eureka: + client: + service-url: + defaultZone: http://admin:${jhipster.registry.password}@jhipster-registry:8761/eureka/ diff --git a/jhipster/jhipster-uaa/quotes/src/main/docker/central-server-config/localhost-config/application.yml b/jhipster/jhipster-uaa/quotes/src/main/docker/central-server-config/localhost-config/application.yml new file mode 100644 index 0000000000..db4602e419 --- /dev/null +++ b/jhipster/jhipster-uaa/quotes/src/main/docker/central-server-config/localhost-config/application.yml @@ -0,0 +1,15 @@ +# Common configuration shared between all applications +configserver: + name: Docker JHipster Registry + status: Connected to the JHipster Registry running in Docker + +jhipster: + security: + authentication: + jwt: + secret: my-secret-key-which-should-be-changed-in-production-and-be-base64-encoded + +eureka: + client: + service-url: + defaultZone: http://admin:${jhipster.registry.password}@localhost:8761/eureka/ diff --git a/jhipster/jhipster-uaa/quotes/src/main/docker/entrypoint.sh b/jhipster/jhipster-uaa/quotes/src/main/docker/entrypoint.sh new file mode 100644 index 0000000000..ccffafb5a4 --- /dev/null +++ b/jhipster/jhipster-uaa/quotes/src/main/docker/entrypoint.sh @@ -0,0 +1,4 @@ +#!/bin/sh + +echo "The application will start in ${JHIPSTER_SLEEP}s..." && sleep ${JHIPSTER_SLEEP} +exec java ${JAVA_OPTS} -Djava.security.egd=file:/dev/./urandom -jar "${HOME}/app.war" "$@" diff --git a/jhipster/jhipster-uaa/quotes/src/main/docker/hazelcast-management-center.yml b/jhipster/jhipster-uaa/quotes/src/main/docker/hazelcast-management-center.yml new file mode 100644 index 0000000000..c7e342303d --- /dev/null +++ b/jhipster/jhipster-uaa/quotes/src/main/docker/hazelcast-management-center.yml @@ -0,0 +1,6 @@ +version: '2' +services: + quotes-hazelcast-management-center: + image: hazelcast/management-center:3.9.3 + ports: + - 8180:8080 diff --git a/jhipster/jhipster-uaa/quotes/src/main/docker/jhipster-registry.yml b/jhipster/jhipster-uaa/quotes/src/main/docker/jhipster-registry.yml new file mode 100644 index 0000000000..512bc54be6 --- /dev/null +++ b/jhipster/jhipster-uaa/quotes/src/main/docker/jhipster-registry.yml @@ -0,0 +1,22 @@ +version: '2' +services: + jhipster-registry: + image: jhipster/jhipster-registry:v4.0.4 + volumes: + - ./central-server-config:/central-config + # When run with the "dev" Spring profile, the JHipster Registry will + # read the config from the local filesystem (central-server-config directory) + # When run with the "prod" Spring profile, it will read the configuration from a Git repository + # See https://www.jhipster.tech/microservices-architecture/#registry_app_configuration + environment: + # - _JAVA_OPTIONS=-Xmx512m -Xms256m + - SPRING_PROFILES_ACTIVE=dev,swagger,uaa + - SPRING_SECURITY_USER_PASSWORD=admin + - JHIPSTER_REGISTRY_PASSWORD=admin + - SPRING_CLOUD_CONFIG_SERVER_COMPOSITE_0_TYPE=native + - SPRING_CLOUD_CONFIG_SERVER_COMPOSITE_0_SEARCH_LOCATIONS=file:./central-config/localhost-config/ + # - SPRING_CLOUD_CONFIG_SERVER_COMPOSITE_0_TYPE=git + # - SPRING_CLOUD_CONFIG_SERVER_COMPOSITE_0_URI=https://github.com/jhipster/jhipster-registry/ + # - SPRING_CLOUD_CONFIG_SERVER_COMPOSITE_0_SEARCH_PATHS=central-config + ports: + - 8761:8761 diff --git a/jhipster/jhipster-uaa/quotes/src/main/docker/mysql.yml b/jhipster/jhipster-uaa/quotes/src/main/docker/mysql.yml new file mode 100644 index 0000000000..0c6cccdaba --- /dev/null +++ b/jhipster/jhipster-uaa/quotes/src/main/docker/mysql.yml @@ -0,0 +1,13 @@ +version: '2' +services: + quotes-mysql: + image: mysql:5.7.20 + # volumes: + # - ~/volumes/jhipster/quotes/mysql/:/var/lib/mysql/ + environment: + - MYSQL_USER=root + - MYSQL_ALLOW_EMPTY_PASSWORD=yes + - MYSQL_DATABASE=quotes + ports: + - 3306:3306 + command: mysqld --lower_case_table_names=1 --skip-ssl --character_set_server=utf8mb4 --explicit_defaults_for_timestamp diff --git a/jhipster/jhipster-uaa/quotes/src/main/docker/sonar.yml b/jhipster/jhipster-uaa/quotes/src/main/docker/sonar.yml new file mode 100644 index 0000000000..075e5f17f6 --- /dev/null +++ b/jhipster/jhipster-uaa/quotes/src/main/docker/sonar.yml @@ -0,0 +1,7 @@ +version: '2' +services: + quotes-sonar: + image: sonarqube:7.1-alpine + ports: + - 9001:9000 + - 9092:9092 diff --git a/jhipster/jhipster-uaa/quotes/src/main/java/com/baeldung/jhipster/quotes/ApplicationWebXml.java b/jhipster/jhipster-uaa/quotes/src/main/java/com/baeldung/jhipster/quotes/ApplicationWebXml.java new file mode 100644 index 0000000000..24b9c098c7 --- /dev/null +++ b/jhipster/jhipster-uaa/quotes/src/main/java/com/baeldung/jhipster/quotes/ApplicationWebXml.java @@ -0,0 +1,21 @@ +package com.baeldung.jhipster.quotes; + +import com.baeldung.jhipster.quotes.config.DefaultProfileUtil; +import org.springframework.boot.builder.SpringApplicationBuilder; +import org.springframework.boot.web.servlet.support.SpringBootServletInitializer; + +/** + * This is a helper Java class that provides an alternative to creating a web.xml. + * This will be invoked only when the application is deployed to a Servlet container like Tomcat, JBoss etc. + */ +public class ApplicationWebXml extends SpringBootServletInitializer { + + @Override + protected SpringApplicationBuilder configure(SpringApplicationBuilder application) { + /** + * set a default to use when no profile is configured. + */ + DefaultProfileUtil.addDefaultProfile(application.application()); + return application.sources(QuotesApp.class); + } +} diff --git a/jhipster/jhipster-uaa/quotes/src/main/java/com/baeldung/jhipster/quotes/QuotesApp.java b/jhipster/jhipster-uaa/quotes/src/main/java/com/baeldung/jhipster/quotes/QuotesApp.java new file mode 100644 index 0000000000..7104bcd5fa --- /dev/null +++ b/jhipster/jhipster-uaa/quotes/src/main/java/com/baeldung/jhipster/quotes/QuotesApp.java @@ -0,0 +1,113 @@ +package com.baeldung.jhipster.quotes; + +import com.baeldung.jhipster.quotes.client.OAuth2InterceptedFeignConfiguration; +import com.baeldung.jhipster.quotes.config.ApplicationProperties; +import com.baeldung.jhipster.quotes.config.DefaultProfileUtil; + +import io.github.jhipster.config.JHipsterConstants; + +import org.apache.commons.lang3.StringUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.boot.autoconfigure.liquibase.LiquibaseProperties; +import org.springframework.boot.context.properties.EnableConfigurationProperties; +import org.springframework.cloud.client.discovery.EnableDiscoveryClient; +import org.springframework.context.annotation.ComponentScan; +import org.springframework.context.annotation.FilterType; +import org.springframework.core.env.Environment; + +import javax.annotation.PostConstruct; +import java.net.InetAddress; +import java.net.UnknownHostException; +import java.util.Arrays; +import java.util.Collection; + +@ComponentScan( + excludeFilters = @ComponentScan.Filter(type = FilterType.ASSIGNABLE_TYPE, classes = OAuth2InterceptedFeignConfiguration.class) +) +@SpringBootApplication +@EnableConfigurationProperties({LiquibaseProperties.class, ApplicationProperties.class}) +@EnableDiscoveryClient +public class QuotesApp { + + private static final Logger log = LoggerFactory.getLogger(QuotesApp.class); + + private final Environment env; + + public QuotesApp(Environment env) { + this.env = env; + } + + /** + * Initializes quotes. + *

+ * Spring profiles can be configured with a program argument --spring.profiles.active=your-active-profile + *

+ * You can find more information on how profiles work with JHipster on https://www.jhipster.tech/profiles/. + */ + @PostConstruct + public void initApplication() { + Collection activeProfiles = Arrays.asList(env.getActiveProfiles()); + if (activeProfiles.contains(JHipsterConstants.SPRING_PROFILE_DEVELOPMENT) && activeProfiles.contains(JHipsterConstants.SPRING_PROFILE_PRODUCTION)) { + log.error("You have misconfigured your application! It should not run " + + "with both the 'dev' and 'prod' profiles at the same time."); + } + if (activeProfiles.contains(JHipsterConstants.SPRING_PROFILE_DEVELOPMENT) && activeProfiles.contains(JHipsterConstants.SPRING_PROFILE_CLOUD)) { + log.error("You have misconfigured your application! It should not " + + "run with both the 'dev' and 'cloud' profiles at the same time."); + } + } + + /** + * Main method, used to run the application. + * + * @param args the command line arguments + */ + public static void main(String[] args) { + SpringApplication app = new SpringApplication(QuotesApp.class); + DefaultProfileUtil.addDefaultProfile(app); + Environment env = app.run(args).getEnvironment(); + logApplicationStartup(env); + } + + private static void logApplicationStartup(Environment env) { + String protocol = "http"; + if (env.getProperty("server.ssl.key-store") != null) { + protocol = "https"; + } + String serverPort = env.getProperty("server.port"); + String contextPath = env.getProperty("server.servlet.context-path"); + if (StringUtils.isBlank(contextPath)) { + contextPath = "/"; + } + String hostAddress = "localhost"; + try { + hostAddress = InetAddress.getLocalHost().getHostAddress(); + } catch (UnknownHostException e) { + log.warn("The host name could not be determined, using `localhost` as fallback"); + } + log.info("\n----------------------------------------------------------\n\t" + + "Application '{}' is running! Access URLs:\n\t" + + "Local: \t\t{}://localhost:{}{}\n\t" + + "External: \t{}://{}:{}{}\n\t" + + "Profile(s): \t{}\n----------------------------------------------------------", + env.getProperty("spring.application.name"), + protocol, + serverPort, + contextPath, + protocol, + hostAddress, + serverPort, + contextPath, + env.getActiveProfiles()); + + String configServerStatus = env.getProperty("configserver.status"); + if (configServerStatus == null) { + configServerStatus = "Not found or not setup for this application"; + } + log.info("\n----------------------------------------------------------\n\t" + + "Config Server: \t{}\n----------------------------------------------------------", configServerStatus); + } +} diff --git a/jhipster/jhipster-uaa/quotes/src/main/java/com/baeldung/jhipster/quotes/aop/logging/LoggingAspect.java b/jhipster/jhipster-uaa/quotes/src/main/java/com/baeldung/jhipster/quotes/aop/logging/LoggingAspect.java new file mode 100644 index 0000000000..1649384bac --- /dev/null +++ b/jhipster/jhipster-uaa/quotes/src/main/java/com/baeldung/jhipster/quotes/aop/logging/LoggingAspect.java @@ -0,0 +1,98 @@ +package com.baeldung.jhipster.quotes.aop.logging; + +import io.github.jhipster.config.JHipsterConstants; + +import org.aspectj.lang.JoinPoint; +import org.aspectj.lang.ProceedingJoinPoint; +import org.aspectj.lang.annotation.AfterThrowing; +import org.aspectj.lang.annotation.Around; +import org.aspectj.lang.annotation.Aspect; +import org.aspectj.lang.annotation.Pointcut; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.core.env.Environment; + +import java.util.Arrays; + +/** + * Aspect for logging execution of service and repository Spring components. + * + * By default, it only runs with the "dev" profile. + */ +@Aspect +public class LoggingAspect { + + private final Logger log = LoggerFactory.getLogger(this.getClass()); + + private final Environment env; + + public LoggingAspect(Environment env) { + this.env = env; + } + + /** + * Pointcut that matches all repositories, services and Web REST endpoints. + */ + @Pointcut("within(@org.springframework.stereotype.Repository *)" + + " || within(@org.springframework.stereotype.Service *)" + + " || within(@org.springframework.web.bind.annotation.RestController *)") + public void springBeanPointcut() { + // Method is empty as this is just a Pointcut, the implementations are in the advices. + } + + /** + * Pointcut that matches all Spring beans in the application's main packages. + */ + @Pointcut("within(com.baeldung.jhipster.quotes.repository..*)"+ + " || within(com.baeldung.jhipster.quotes.service..*)"+ + " || within(com.baeldung.jhipster.quotes.web.rest..*)") + public void applicationPackagePointcut() { + // Method is empty as this is just a Pointcut, the implementations are in the advices. + } + + /** + * Advice that logs methods throwing exceptions. + * + * @param joinPoint join point for advice + * @param e exception + */ + @AfterThrowing(pointcut = "applicationPackagePointcut() && springBeanPointcut()", throwing = "e") + public void logAfterThrowing(JoinPoint joinPoint, Throwable e) { + if (env.acceptsProfiles(JHipsterConstants.SPRING_PROFILE_DEVELOPMENT)) { + log.error("Exception in {}.{}() with cause = \'{}\' and exception = \'{}\'", joinPoint.getSignature().getDeclaringTypeName(), + joinPoint.getSignature().getName(), e.getCause() != null? e.getCause() : "NULL", e.getMessage(), e); + + } else { + log.error("Exception in {}.{}() with cause = {}", joinPoint.getSignature().getDeclaringTypeName(), + joinPoint.getSignature().getName(), e.getCause() != null? e.getCause() : "NULL"); + } + } + + /** + * Advice that logs when a method is entered and exited. + * + * @param joinPoint join point for advice + * @return result + * @throws Throwable throws IllegalArgumentException + */ + @Around("applicationPackagePointcut() && springBeanPointcut()") + public Object logAround(ProceedingJoinPoint joinPoint) throws Throwable { + if (log.isDebugEnabled()) { + log.debug("Enter: {}.{}() with argument[s] = {}", joinPoint.getSignature().getDeclaringTypeName(), + joinPoint.getSignature().getName(), Arrays.toString(joinPoint.getArgs())); + } + try { + Object result = joinPoint.proceed(); + if (log.isDebugEnabled()) { + log.debug("Exit: {}.{}() with result = {}", joinPoint.getSignature().getDeclaringTypeName(), + joinPoint.getSignature().getName(), result); + } + return result; + } catch (IllegalArgumentException e) { + log.error("Illegal argument: {} in {}.{}()", Arrays.toString(joinPoint.getArgs()), + joinPoint.getSignature().getDeclaringTypeName(), joinPoint.getSignature().getName()); + + throw e; + } + } +} diff --git a/jhipster/jhipster-uaa/quotes/src/main/java/com/baeldung/jhipster/quotes/client/AuthorizedFeignClient.java b/jhipster/jhipster-uaa/quotes/src/main/java/com/baeldung/jhipster/quotes/client/AuthorizedFeignClient.java new file mode 100644 index 0000000000..3fad4533a8 --- /dev/null +++ b/jhipster/jhipster-uaa/quotes/src/main/java/com/baeldung/jhipster/quotes/client/AuthorizedFeignClient.java @@ -0,0 +1,51 @@ +package com.baeldung.jhipster.quotes.client; + +import org.springframework.cloud.openfeign.FeignClient; +import org.springframework.cloud.openfeign.FeignClientsConfiguration; +import org.springframework.core.annotation.AliasFor; + +import java.lang.annotation.*; + +@Retention(RetentionPolicy.RUNTIME) +@Target(ElementType.TYPE) +@Documented +@FeignClient +public @interface AuthorizedFeignClient { + + @AliasFor(annotation = FeignClient.class, attribute = "name") + String name() default ""; + + /** + * A custom @Configuration for the feign client. + * + * Can contain override @Bean definition for the pieces that + * make up the client, for instance {@link feign.codec.Decoder}, + * {@link feign.codec.Encoder}, {@link feign.Contract}. + * + * @see FeignClientsConfiguration for the defaults + */ + @AliasFor(annotation = FeignClient.class, attribute = "configuration") + Class[] configuration() default OAuth2InterceptedFeignConfiguration.class; + + /** + * An absolute URL or resolvable hostname (the protocol is optional). + */ + String url() default ""; + + /** + * Whether 404s should be decoded instead of throwing FeignExceptions. + */ + boolean decode404() default false; + + /** + * Fallback class for the specified Feign client interface. The fallback class must + * implement the interface annotated by this annotation and be a valid Spring bean. + */ + Class fallback() default void.class; + + /** + * Path prefix to be used by all method-level mappings. Can be used with or without + * @RibbonClient. + */ + String path() default ""; +} diff --git a/jhipster/jhipster-uaa/quotes/src/main/java/com/baeldung/jhipster/quotes/client/AuthorizedUserFeignClient.java b/jhipster/jhipster-uaa/quotes/src/main/java/com/baeldung/jhipster/quotes/client/AuthorizedUserFeignClient.java new file mode 100644 index 0000000000..5f40c2257d --- /dev/null +++ b/jhipster/jhipster-uaa/quotes/src/main/java/com/baeldung/jhipster/quotes/client/AuthorizedUserFeignClient.java @@ -0,0 +1,49 @@ +package com.baeldung.jhipster.quotes.client; + +import java.lang.annotation.*; + +import org.springframework.cloud.openfeign.FeignClient; +import org.springframework.cloud.openfeign.FeignClientsConfiguration; +import org.springframework.core.annotation.AliasFor; + +@Retention(RetentionPolicy.RUNTIME) +@Target(ElementType.TYPE) +@Documented +@FeignClient +public @interface AuthorizedUserFeignClient { + + @AliasFor(annotation = FeignClient.class, attribute = "name") + String name() default ""; + + /** + * A custom @Configuration for the feign client. + * + * Can contain override @Bean definition for the pieces that make up the client, for instance {@link + * feign.codec.Decoder}, {@link feign.codec.Encoder}, {@link feign.Contract}. + * + * @see FeignClientsConfiguration for the defaults + */ + @AliasFor(annotation = FeignClient.class, attribute = "configuration") + Class[] configuration() default OAuth2UserClientFeignConfiguration.class; + + /** + * An absolute URL or resolvable hostname (the protocol is optional). + */ + String url() default ""; + + /** + * Whether 404s should be decoded instead of throwing FeignExceptions. + */ + boolean decode404() default false; + + /** + * Fallback class for the specified Feign client interface. The fallback class must implement the interface + * annotated by this annotation and be a valid Spring bean. + */ + Class fallback() default void.class; + + /** + * Path prefix to be used by all method-level mappings. Can be used with or without @RibbonClient. + */ + String path() default ""; +} diff --git a/jhipster/jhipster-uaa/quotes/src/main/java/com/baeldung/jhipster/quotes/client/OAuth2InterceptedFeignConfiguration.java b/jhipster/jhipster-uaa/quotes/src/main/java/com/baeldung/jhipster/quotes/client/OAuth2InterceptedFeignConfiguration.java new file mode 100644 index 0000000000..4f60051e3d --- /dev/null +++ b/jhipster/jhipster-uaa/quotes/src/main/java/com/baeldung/jhipster/quotes/client/OAuth2InterceptedFeignConfiguration.java @@ -0,0 +1,24 @@ +package com.baeldung.jhipster.quotes.client; + +import java.io.IOException; + +import org.springframework.cloud.security.oauth2.client.feign.OAuth2FeignRequestInterceptor; +import org.springframework.context.annotation.Bean; +import org.springframework.security.oauth2.client.DefaultOAuth2ClientContext; + +import feign.RequestInterceptor; +import io.github.jhipster.security.uaa.LoadBalancedResourceDetails; + +public class OAuth2InterceptedFeignConfiguration { + + private final LoadBalancedResourceDetails loadBalancedResourceDetails; + + public OAuth2InterceptedFeignConfiguration(LoadBalancedResourceDetails loadBalancedResourceDetails) { + this.loadBalancedResourceDetails = loadBalancedResourceDetails; + } + + @Bean(name = "oauth2RequestInterceptor") + public RequestInterceptor getOAuth2RequestInterceptor() throws IOException { + return new OAuth2FeignRequestInterceptor(new DefaultOAuth2ClientContext(), loadBalancedResourceDetails); + } +} diff --git a/jhipster/jhipster-uaa/quotes/src/main/java/com/baeldung/jhipster/quotes/client/OAuth2UserClientFeignConfiguration.java b/jhipster/jhipster-uaa/quotes/src/main/java/com/baeldung/jhipster/quotes/client/OAuth2UserClientFeignConfiguration.java new file mode 100644 index 0000000000..1b828ac4d2 --- /dev/null +++ b/jhipster/jhipster-uaa/quotes/src/main/java/com/baeldung/jhipster/quotes/client/OAuth2UserClientFeignConfiguration.java @@ -0,0 +1,15 @@ +package com.baeldung.jhipster.quotes.client; + +import java.io.IOException; + +import org.springframework.context.annotation.Bean; + +import feign.RequestInterceptor; + +public class OAuth2UserClientFeignConfiguration { + + @Bean(name = "userFeignClientInterceptor") + public RequestInterceptor getUserFeignClientInterceptor() throws IOException { + return new UserFeignClientInterceptor(); + } +} diff --git a/jhipster/jhipster-uaa/quotes/src/main/java/com/baeldung/jhipster/quotes/client/UserFeignClientInterceptor.java b/jhipster/jhipster-uaa/quotes/src/main/java/com/baeldung/jhipster/quotes/client/UserFeignClientInterceptor.java new file mode 100644 index 0000000000..541d1ebfd8 --- /dev/null +++ b/jhipster/jhipster-uaa/quotes/src/main/java/com/baeldung/jhipster/quotes/client/UserFeignClientInterceptor.java @@ -0,0 +1,29 @@ +package com.baeldung.jhipster.quotes.client; + +import org.springframework.security.core.Authentication; +import org.springframework.security.core.context.SecurityContext; +import org.springframework.security.core.context.SecurityContextHolder; +import org.springframework.security.oauth2.provider.authentication.OAuth2AuthenticationDetails; + +import feign.RequestInterceptor; +import feign.RequestTemplate; + +public class UserFeignClientInterceptor implements RequestInterceptor{ + + private static final String AUTHORIZATION_HEADER = "Authorization"; + + private static final String BEARER_TOKEN_TYPE = "Bearer"; + + @Override + public void apply(RequestTemplate template) { + + SecurityContext securityContext = SecurityContextHolder.getContext(); + Authentication authentication = securityContext.getAuthentication(); + + if (authentication != null && authentication.getDetails() instanceof OAuth2AuthenticationDetails) { + + OAuth2AuthenticationDetails details = (OAuth2AuthenticationDetails) authentication.getDetails(); + template.header(AUTHORIZATION_HEADER, String.format("%s %s", BEARER_TOKEN_TYPE, details.getTokenValue())); + } + } +} diff --git a/jhipster/jhipster-uaa/quotes/src/main/java/com/baeldung/jhipster/quotes/config/ApplicationProperties.java b/jhipster/jhipster-uaa/quotes/src/main/java/com/baeldung/jhipster/quotes/config/ApplicationProperties.java new file mode 100644 index 0000000000..fe6d0291ce --- /dev/null +++ b/jhipster/jhipster-uaa/quotes/src/main/java/com/baeldung/jhipster/quotes/config/ApplicationProperties.java @@ -0,0 +1,14 @@ +package com.baeldung.jhipster.quotes.config; + +import org.springframework.boot.context.properties.ConfigurationProperties; + +/** + * Properties specific to Quotes. + *

+ * Properties are configured in the application.yml file. + * See {@link io.github.jhipster.config.JHipsterProperties} for a good example. + */ +@ConfigurationProperties(prefix = "application", ignoreUnknownFields = false) +public class ApplicationProperties { + +} diff --git a/jhipster/jhipster-uaa/quotes/src/main/java/com/baeldung/jhipster/quotes/config/AsyncConfiguration.java b/jhipster/jhipster-uaa/quotes/src/main/java/com/baeldung/jhipster/quotes/config/AsyncConfiguration.java new file mode 100644 index 0000000000..8ab3139915 --- /dev/null +++ b/jhipster/jhipster-uaa/quotes/src/main/java/com/baeldung/jhipster/quotes/config/AsyncConfiguration.java @@ -0,0 +1,59 @@ +package com.baeldung.jhipster.quotes.config; + +import io.github.jhipster.async.ExceptionHandlingAsyncTaskExecutor; +import io.github.jhipster.config.JHipsterProperties; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.aop.interceptor.AsyncUncaughtExceptionHandler; +import org.springframework.aop.interceptor.SimpleAsyncUncaughtExceptionHandler; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.scheduling.annotation.*; +import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; +import org.springframework.scheduling.annotation.SchedulingConfigurer; +import org.springframework.scheduling.config.ScheduledTaskRegistrar; + +import java.util.concurrent.Executor; +import java.util.concurrent.Executors; + +@Configuration +@EnableAsync +@EnableScheduling +public class AsyncConfiguration implements AsyncConfigurer, SchedulingConfigurer { + + private final Logger log = LoggerFactory.getLogger(AsyncConfiguration.class); + + private final JHipsterProperties jHipsterProperties; + + public AsyncConfiguration(JHipsterProperties jHipsterProperties) { + this.jHipsterProperties = jHipsterProperties; + } + + @Override + @Bean(name = "taskExecutor") + public Executor getAsyncExecutor() { + log.debug("Creating Async Task Executor"); + ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor(); + executor.setCorePoolSize(jHipsterProperties.getAsync().getCorePoolSize()); + executor.setMaxPoolSize(jHipsterProperties.getAsync().getMaxPoolSize()); + executor.setQueueCapacity(jHipsterProperties.getAsync().getQueueCapacity()); + executor.setThreadNamePrefix("quotes-Executor-"); + return new ExceptionHandlingAsyncTaskExecutor(executor); + } + + @Override + public AsyncUncaughtExceptionHandler getAsyncUncaughtExceptionHandler() { + return new SimpleAsyncUncaughtExceptionHandler(); + } + + @Override + public void configureTasks(ScheduledTaskRegistrar taskRegistrar) { + taskRegistrar.setScheduler(scheduledTaskExecutor()); + } + + @Bean + public Executor scheduledTaskExecutor() { + return Executors.newScheduledThreadPool(jHipsterProperties.getAsync().getCorePoolSize()); + } +} diff --git a/jhipster/jhipster-uaa/quotes/src/main/java/com/baeldung/jhipster/quotes/config/CacheConfiguration.java b/jhipster/jhipster-uaa/quotes/src/main/java/com/baeldung/jhipster/quotes/config/CacheConfiguration.java new file mode 100644 index 0000000000..c8afb491c1 --- /dev/null +++ b/jhipster/jhipster-uaa/quotes/src/main/java/com/baeldung/jhipster/quotes/config/CacheConfiguration.java @@ -0,0 +1,155 @@ +package com.baeldung.jhipster.quotes.config; + +import io.github.jhipster.config.JHipsterConstants; +import io.github.jhipster.config.JHipsterProperties; + +import com.hazelcast.config.*; +import com.hazelcast.core.HazelcastInstance; +import com.hazelcast.core.Hazelcast; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.autoconfigure.web.ServerProperties; + +import org.springframework.cache.CacheManager; +import org.springframework.cache.annotation.EnableCaching; +import org.springframework.cloud.client.ServiceInstance; +import org.springframework.cloud.client.discovery.DiscoveryClient; +import org.springframework.cloud.client.serviceregistry.Registration; +import org.springframework.context.annotation.*; +import org.springframework.core.env.Environment; + +import javax.annotation.PreDestroy; + +@Configuration +@EnableCaching +public class CacheConfiguration { + + private final Logger log = LoggerFactory.getLogger(CacheConfiguration.class); + + private final Environment env; + + private final ServerProperties serverProperties; + + private final DiscoveryClient discoveryClient; + + private Registration registration; + + public CacheConfiguration(Environment env, ServerProperties serverProperties, DiscoveryClient discoveryClient) { + this.env = env; + this.serverProperties = serverProperties; + this.discoveryClient = discoveryClient; + } + + @Autowired(required = false) + public void setRegistration(Registration registration) { + this.registration = registration; + } + + @PreDestroy + public void destroy() { + log.info("Closing Cache Manager"); + Hazelcast.shutdownAll(); + } + + @Bean + public CacheManager cacheManager(HazelcastInstance hazelcastInstance) { + log.debug("Starting HazelcastCacheManager"); + CacheManager cacheManager = new com.hazelcast.spring.cache.HazelcastCacheManager(hazelcastInstance); + return cacheManager; + } + + @Bean + public HazelcastInstance hazelcastInstance(JHipsterProperties jHipsterProperties) { + log.debug("Configuring Hazelcast"); + HazelcastInstance hazelCastInstance = Hazelcast.getHazelcastInstanceByName("quotes"); + if (hazelCastInstance != null) { + log.debug("Hazelcast already initialized"); + return hazelCastInstance; + } + Config config = new Config(); + config.setInstanceName("quotes"); + config.getNetworkConfig().getJoin().getMulticastConfig().setEnabled(false); + if (this.registration == null) { + log.warn("No discovery service is set up, Hazelcast cannot create a cluster."); + } else { + // The serviceId is by default the application's name, + // see the "spring.application.name" standard Spring property + String serviceId = registration.getServiceId(); + log.debug("Configuring Hazelcast clustering for instanceId: {}", serviceId); + // In development, everything goes through 127.0.0.1, with a different port + if (env.acceptsProfiles(JHipsterConstants.SPRING_PROFILE_DEVELOPMENT)) { + log.debug("Application is running with the \"dev\" profile, Hazelcast " + + "cluster will only work with localhost instances"); + + System.setProperty("hazelcast.local.localAddress", "127.0.0.1"); + config.getNetworkConfig().setPort(serverProperties.getPort() + 5701); + config.getNetworkConfig().getJoin().getTcpIpConfig().setEnabled(true); + for (ServiceInstance instance : discoveryClient.getInstances(serviceId)) { + String clusterMember = "127.0.0.1:" + (instance.getPort() + 5701); + log.debug("Adding Hazelcast (dev) cluster member " + clusterMember); + config.getNetworkConfig().getJoin().getTcpIpConfig().addMember(clusterMember); + } + } else { // Production configuration, one host per instance all using port 5701 + config.getNetworkConfig().setPort(5701); + config.getNetworkConfig().getJoin().getTcpIpConfig().setEnabled(true); + for (ServiceInstance instance : discoveryClient.getInstances(serviceId)) { + String clusterMember = instance.getHost() + ":5701"; + log.debug("Adding Hazelcast (prod) cluster member " + clusterMember); + config.getNetworkConfig().getJoin().getTcpIpConfig().addMember(clusterMember); + } + } + } + config.getMapConfigs().put("default", initializeDefaultMapConfig(jHipsterProperties)); + + // Full reference is available at: http://docs.hazelcast.org/docs/management-center/3.9/manual/html/Deploying_and_Starting.html + config.setManagementCenterConfig(initializeDefaultManagementCenterConfig(jHipsterProperties)); + config.getMapConfigs().put("com.baeldung.jhipster.quotes.domain.*", initializeDomainMapConfig(jHipsterProperties)); + return Hazelcast.newHazelcastInstance(config); + } + + private ManagementCenterConfig initializeDefaultManagementCenterConfig(JHipsterProperties jHipsterProperties) { + ManagementCenterConfig managementCenterConfig = new ManagementCenterConfig(); + managementCenterConfig.setEnabled(jHipsterProperties.getCache().getHazelcast().getManagementCenter().isEnabled()); + managementCenterConfig.setUrl(jHipsterProperties.getCache().getHazelcast().getManagementCenter().getUrl()); + managementCenterConfig.setUpdateInterval(jHipsterProperties.getCache().getHazelcast().getManagementCenter().getUpdateInterval()); + return managementCenterConfig; + } + + private MapConfig initializeDefaultMapConfig(JHipsterProperties jHipsterProperties) { + MapConfig mapConfig = new MapConfig(); + + /* + Number of backups. If 1 is set as the backup-count for example, + then all entries of the map will be copied to another JVM for + fail-safety. Valid numbers are 0 (no backup), 1, 2, 3. + */ + mapConfig.setBackupCount(jHipsterProperties.getCache().getHazelcast().getBackupCount()); + + /* + Valid values are: + NONE (no eviction), + LRU (Least Recently Used), + LFU (Least Frequently Used). + NONE is the default. + */ + mapConfig.setEvictionPolicy(EvictionPolicy.LRU); + + /* + Maximum size of the map. When max size is reached, + map is evicted based on the policy defined. + Any integer between 0 and Integer.MAX_VALUE. 0 means + Integer.MAX_VALUE. Default is 0. + */ + mapConfig.setMaxSizeConfig(new MaxSizeConfig(0, MaxSizeConfig.MaxSizePolicy.USED_HEAP_SIZE)); + + return mapConfig; + } + + private MapConfig initializeDomainMapConfig(JHipsterProperties jHipsterProperties) { + MapConfig mapConfig = new MapConfig(); + mapConfig.setTimeToLiveSeconds(jHipsterProperties.getCache().getHazelcast().getTimeToLiveSeconds()); + return mapConfig; + } +} diff --git a/jhipster/jhipster-uaa/quotes/src/main/java/com/baeldung/jhipster/quotes/config/CloudDatabaseConfiguration.java b/jhipster/jhipster-uaa/quotes/src/main/java/com/baeldung/jhipster/quotes/config/CloudDatabaseConfiguration.java new file mode 100644 index 0000000000..32044187ab --- /dev/null +++ b/jhipster/jhipster-uaa/quotes/src/main/java/com/baeldung/jhipster/quotes/config/CloudDatabaseConfiguration.java @@ -0,0 +1,24 @@ +package com.baeldung.jhipster.quotes.config; + +import io.github.jhipster.config.JHipsterConstants; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.cache.CacheManager; +import org.springframework.cloud.config.java.AbstractCloudConfig; +import org.springframework.context.annotation.*; + +import javax.sql.DataSource; + +@Configuration +@Profile(JHipsterConstants.SPRING_PROFILE_CLOUD) +public class CloudDatabaseConfiguration extends AbstractCloudConfig { + + private final Logger log = LoggerFactory.getLogger(CloudDatabaseConfiguration.class); + + @Bean + public DataSource dataSource(CacheManager cacheManager) { + log.info("Configuring JDBC datasource from a cloud provider"); + return connectionFactory().dataSource(); + } +} diff --git a/jhipster/jhipster-uaa/quotes/src/main/java/com/baeldung/jhipster/quotes/config/Constants.java b/jhipster/jhipster-uaa/quotes/src/main/java/com/baeldung/jhipster/quotes/config/Constants.java new file mode 100644 index 0000000000..6be8ffcf95 --- /dev/null +++ b/jhipster/jhipster-uaa/quotes/src/main/java/com/baeldung/jhipster/quotes/config/Constants.java @@ -0,0 +1,17 @@ +package com.baeldung.jhipster.quotes.config; + +/** + * Application constants. + */ +public final class Constants { + + // Regex for acceptable logins + public static final String LOGIN_REGEX = "^[_.@A-Za-z0-9-]*$"; + + public static final String SYSTEM_ACCOUNT = "system"; + public static final String ANONYMOUS_USER = "anonymoususer"; + public static final String DEFAULT_LANGUAGE = "en"; + + private Constants() { + } +} diff --git a/jhipster/jhipster-uaa/quotes/src/main/java/com/baeldung/jhipster/quotes/config/DatabaseConfiguration.java b/jhipster/jhipster-uaa/quotes/src/main/java/com/baeldung/jhipster/quotes/config/DatabaseConfiguration.java new file mode 100644 index 0000000000..cb7012cfc8 --- /dev/null +++ b/jhipster/jhipster-uaa/quotes/src/main/java/com/baeldung/jhipster/quotes/config/DatabaseConfiguration.java @@ -0,0 +1,39 @@ +package com.baeldung.jhipster.quotes.config; + +import io.github.jhipster.config.JHipsterConstants; +import io.github.jhipster.config.h2.H2ConfigurationHelper; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.Profile; + +import org.springframework.data.jpa.repository.config.EnableJpaAuditing; +import org.springframework.data.jpa.repository.config.EnableJpaRepositories; +import org.springframework.transaction.annotation.EnableTransactionManagement; + +import java.sql.SQLException; + +@Configuration +@EnableJpaRepositories("com.baeldung.jhipster.quotes.repository") +@EnableJpaAuditing(auditorAwareRef = "springSecurityAuditorAware") +@EnableTransactionManagement +public class DatabaseConfiguration { + + private final Logger log = LoggerFactory.getLogger(DatabaseConfiguration.class); + + + /** + * Open the TCP port for the H2 database, so it is available remotely. + * + * @return the H2 database TCP server + * @throws SQLException if the server failed to start + */ + @Bean(initMethod = "start", destroyMethod = "stop") + @Profile(JHipsterConstants.SPRING_PROFILE_DEVELOPMENT) + public Object h2TCPServer() throws SQLException { + log.debug("Starting H2 database"); + return H2ConfigurationHelper.createServer(); + } + +} diff --git a/jhipster/jhipster-uaa/quotes/src/main/java/com/baeldung/jhipster/quotes/config/DateTimeFormatConfiguration.java b/jhipster/jhipster-uaa/quotes/src/main/java/com/baeldung/jhipster/quotes/config/DateTimeFormatConfiguration.java new file mode 100644 index 0000000000..1205fdf593 --- /dev/null +++ b/jhipster/jhipster-uaa/quotes/src/main/java/com/baeldung/jhipster/quotes/config/DateTimeFormatConfiguration.java @@ -0,0 +1,20 @@ +package com.baeldung.jhipster.quotes.config; + +import org.springframework.context.annotation.Configuration; +import org.springframework.format.FormatterRegistry; +import org.springframework.format.datetime.standard.DateTimeFormatterRegistrar; +import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; + +/** + * Configure the converters to use the ISO format for dates by default. + */ +@Configuration +public class DateTimeFormatConfiguration implements WebMvcConfigurer { + + @Override + public void addFormatters(FormatterRegistry registry) { + DateTimeFormatterRegistrar registrar = new DateTimeFormatterRegistrar(); + registrar.setUseIsoFormat(true); + registrar.registerFormatters(registry); + } +} diff --git a/jhipster/jhipster-uaa/quotes/src/main/java/com/baeldung/jhipster/quotes/config/DefaultProfileUtil.java b/jhipster/jhipster-uaa/quotes/src/main/java/com/baeldung/jhipster/quotes/config/DefaultProfileUtil.java new file mode 100644 index 0000000000..b029b31b67 --- /dev/null +++ b/jhipster/jhipster-uaa/quotes/src/main/java/com/baeldung/jhipster/quotes/config/DefaultProfileUtil.java @@ -0,0 +1,51 @@ +package com.baeldung.jhipster.quotes.config; + +import io.github.jhipster.config.JHipsterConstants; + +import org.springframework.boot.SpringApplication; +import org.springframework.core.env.Environment; + +import java.util.*; + +/** + * Utility class to load a Spring profile to be used as default + * when there is no spring.profiles.active set in the environment or as command line argument. + * If the value is not available in application.yml then dev profile will be used as default. + */ +public final class DefaultProfileUtil { + + private static final String SPRING_PROFILE_DEFAULT = "spring.profiles.default"; + + private DefaultProfileUtil() { + } + + /** + * Set a default to use when no profile is configured. + * + * @param app the Spring application + */ + public static void addDefaultProfile(SpringApplication app) { + Map defProperties = new HashMap<>(); + /* + * The default profile to use when no other profiles are defined + * This cannot be set in the application.yml file. + * See https://github.com/spring-projects/spring-boot/issues/1219 + */ + defProperties.put(SPRING_PROFILE_DEFAULT, JHipsterConstants.SPRING_PROFILE_DEVELOPMENT); + app.setDefaultProperties(defProperties); + } + + /** + * Get the profiles that are applied else get default profiles. + * + * @param env spring environment + * @return profiles + */ + public static String[] getActiveProfiles(Environment env) { + String[] profiles = env.getActiveProfiles(); + if (profiles.length == 0) { + return env.getDefaultProfiles(); + } + return profiles; + } +} diff --git a/jhipster/jhipster-uaa/quotes/src/main/java/com/baeldung/jhipster/quotes/config/FeignConfiguration.java b/jhipster/jhipster-uaa/quotes/src/main/java/com/baeldung/jhipster/quotes/config/FeignConfiguration.java new file mode 100644 index 0000000000..85c4784a00 --- /dev/null +++ b/jhipster/jhipster-uaa/quotes/src/main/java/com/baeldung/jhipster/quotes/config/FeignConfiguration.java @@ -0,0 +1,18 @@ +package com.baeldung.jhipster.quotes.config; + +import org.springframework.cloud.openfeign.EnableFeignClients; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +@Configuration +@EnableFeignClients(basePackages = "com.baeldung.jhipster.quotes") +public class FeignConfiguration { + + /** + * Set the Feign specific log level to log client REST requests + */ + @Bean + feign.Logger.Level feignLoggerLevel() { + return feign.Logger.Level.BASIC; + } +} diff --git a/jhipster/jhipster-uaa/quotes/src/main/java/com/baeldung/jhipster/quotes/config/JacksonConfiguration.java b/jhipster/jhipster-uaa/quotes/src/main/java/com/baeldung/jhipster/quotes/config/JacksonConfiguration.java new file mode 100644 index 0000000000..03747296a2 --- /dev/null +++ b/jhipster/jhipster-uaa/quotes/src/main/java/com/baeldung/jhipster/quotes/config/JacksonConfiguration.java @@ -0,0 +1,63 @@ +package com.baeldung.jhipster.quotes.config; + +import com.fasterxml.jackson.datatype.hibernate5.Hibernate5Module; +import com.fasterxml.jackson.datatype.jdk8.Jdk8Module; +import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; +import com.fasterxml.jackson.module.afterburner.AfterburnerModule; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.zalando.problem.ProblemModule; +import org.zalando.problem.violations.ConstraintViolationProblemModule; + +@Configuration +public class JacksonConfiguration { + + /** + * Support for Java date and time API. + * @return the corresponding Jackson module. + */ + @Bean + public JavaTimeModule javaTimeModule() { + return new JavaTimeModule(); + } + + @Bean + public Jdk8Module jdk8TimeModule() { + return new Jdk8Module(); + } + + + /* + * Support for Hibernate types in Jackson. + */ + @Bean + public Hibernate5Module hibernate5Module() { + return new Hibernate5Module(); + } + + /* + * Jackson Afterburner module to speed up serialization/deserialization. + */ + @Bean + public AfterburnerModule afterburnerModule() { + return new AfterburnerModule(); + } + + /* + * Module for serialization/deserialization of RFC7807 Problem. + */ + @Bean + ProblemModule problemModule() { + return new ProblemModule(); + } + + /* + * Module for serialization/deserialization of ConstraintViolationProblem. + */ + @Bean + ConstraintViolationProblemModule constraintViolationProblemModule() { + return new ConstraintViolationProblemModule(); + } + +} diff --git a/jhipster/jhipster-uaa/quotes/src/main/java/com/baeldung/jhipster/quotes/config/LiquibaseConfiguration.java b/jhipster/jhipster-uaa/quotes/src/main/java/com/baeldung/jhipster/quotes/config/LiquibaseConfiguration.java new file mode 100644 index 0000000000..686d6a221e --- /dev/null +++ b/jhipster/jhipster-uaa/quotes/src/main/java/com/baeldung/jhipster/quotes/config/LiquibaseConfiguration.java @@ -0,0 +1,53 @@ +package com.baeldung.jhipster.quotes.config; + +import javax.sql.DataSource; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.boot.autoconfigure.liquibase.LiquibaseProperties; +import org.springframework.cache.CacheManager; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.core.env.Environment; +import org.springframework.core.task.TaskExecutor; + +import io.github.jhipster.config.JHipsterConstants; +import io.github.jhipster.config.liquibase.AsyncSpringLiquibase; +import liquibase.integration.spring.SpringLiquibase; + +@Configuration +public class LiquibaseConfiguration { + + private final Logger log = LoggerFactory.getLogger(LiquibaseConfiguration.class); + + private final Environment env; + + private final CacheManager cacheManager; + + public LiquibaseConfiguration(Environment env, CacheManager cacheManager) { + this.env = env; + this.cacheManager = cacheManager; + } + + @Bean + public SpringLiquibase liquibase(@Qualifier("taskExecutor") TaskExecutor taskExecutor, + DataSource dataSource, LiquibaseProperties liquibaseProperties) { + + // Use liquibase.integration.spring.SpringLiquibase if you don't want Liquibase to start asynchronously + SpringLiquibase liquibase = new AsyncSpringLiquibase(taskExecutor, env); + liquibase.setDataSource(dataSource); + liquibase.setChangeLog("classpath:config/liquibase/master.xml"); + liquibase.setContexts(liquibaseProperties.getContexts()); + liquibase.setDefaultSchema(liquibaseProperties.getDefaultSchema()); + liquibase.setDropFirst(liquibaseProperties.isDropFirst()); + liquibase.setChangeLogParameters(liquibaseProperties.getParameters()); + if (env.acceptsProfiles(JHipsterConstants.SPRING_PROFILE_NO_LIQUIBASE)) { + liquibase.setShouldRun(false); + } else { + liquibase.setShouldRun(liquibaseProperties.isEnabled()); + log.debug("Configuring Liquibase"); + } + return liquibase; + } +} diff --git a/jhipster/jhipster-uaa/quotes/src/main/java/com/baeldung/jhipster/quotes/config/LocaleConfiguration.java b/jhipster/jhipster-uaa/quotes/src/main/java/com/baeldung/jhipster/quotes/config/LocaleConfiguration.java new file mode 100644 index 0000000000..46ab99a3ea --- /dev/null +++ b/jhipster/jhipster-uaa/quotes/src/main/java/com/baeldung/jhipster/quotes/config/LocaleConfiguration.java @@ -0,0 +1,27 @@ +package com.baeldung.jhipster.quotes.config; + +import io.github.jhipster.config.locale.AngularCookieLocaleResolver; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.web.servlet.LocaleResolver; +import org.springframework.web.servlet.config.annotation.*; +import org.springframework.web.servlet.i18n.LocaleChangeInterceptor; + +@Configuration +public class LocaleConfiguration implements WebMvcConfigurer { + + @Bean(name = "localeResolver") + public LocaleResolver localeResolver() { + AngularCookieLocaleResolver cookieLocaleResolver = new AngularCookieLocaleResolver(); + cookieLocaleResolver.setCookieName("NG_TRANSLATE_LANG_KEY"); + return cookieLocaleResolver; + } + + @Override + public void addInterceptors(InterceptorRegistry registry) { + LocaleChangeInterceptor localeChangeInterceptor = new LocaleChangeInterceptor(); + localeChangeInterceptor.setParamName("language"); + registry.addInterceptor(localeChangeInterceptor); + } +} diff --git a/jhipster/jhipster-uaa/quotes/src/main/java/com/baeldung/jhipster/quotes/config/LoggingAspectConfiguration.java b/jhipster/jhipster-uaa/quotes/src/main/java/com/baeldung/jhipster/quotes/config/LoggingAspectConfiguration.java new file mode 100644 index 0000000000..1a1eb93eeb --- /dev/null +++ b/jhipster/jhipster-uaa/quotes/src/main/java/com/baeldung/jhipster/quotes/config/LoggingAspectConfiguration.java @@ -0,0 +1,19 @@ +package com.baeldung.jhipster.quotes.config; + +import com.baeldung.jhipster.quotes.aop.logging.LoggingAspect; + +import io.github.jhipster.config.JHipsterConstants; + +import org.springframework.context.annotation.*; +import org.springframework.core.env.Environment; + +@Configuration +@EnableAspectJAutoProxy +public class LoggingAspectConfiguration { + + @Bean + @Profile(JHipsterConstants.SPRING_PROFILE_DEVELOPMENT) + public LoggingAspect loggingAspect(Environment env) { + return new LoggingAspect(env); + } +} diff --git a/jhipster/jhipster-uaa/quotes/src/main/java/com/baeldung/jhipster/quotes/config/LoggingConfiguration.java b/jhipster/jhipster-uaa/quotes/src/main/java/com/baeldung/jhipster/quotes/config/LoggingConfiguration.java new file mode 100644 index 0000000000..2739133ffe --- /dev/null +++ b/jhipster/jhipster-uaa/quotes/src/main/java/com/baeldung/jhipster/quotes/config/LoggingConfiguration.java @@ -0,0 +1,163 @@ +package com.baeldung.jhipster.quotes.config; + +import java.net.InetSocketAddress; +import java.util.Iterator; + +import io.github.jhipster.config.JHipsterProperties; + +import ch.qos.logback.classic.AsyncAppender; +import ch.qos.logback.classic.Level; +import ch.qos.logback.classic.LoggerContext; +import ch.qos.logback.classic.boolex.OnMarkerEvaluator; +import ch.qos.logback.classic.spi.ILoggingEvent; +import ch.qos.logback.classic.spi.LoggerContextListener; +import ch.qos.logback.core.Appender; +import ch.qos.logback.core.filter.EvaluatorFilter; +import ch.qos.logback.core.spi.ContextAwareBase; +import ch.qos.logback.core.spi.FilterReply; +import net.logstash.logback.appender.LogstashTcpSocketAppender; +import net.logstash.logback.encoder.LogstashEncoder; +import net.logstash.logback.stacktrace.ShortenedThrowableConverter; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.cloud.context.config.annotation.RefreshScope; +import org.springframework.context.annotation.Configuration; + +@Configuration +@RefreshScope +public class LoggingConfiguration { + + private static final String LOGSTASH_APPENDER_NAME = "LOGSTASH"; + + private static final String ASYNC_LOGSTASH_APPENDER_NAME = "ASYNC_LOGSTASH"; + + private final Logger log = LoggerFactory.getLogger(LoggingConfiguration.class); + + private LoggerContext context = (LoggerContext) LoggerFactory.getILoggerFactory(); + + private final String appName; + + private final String serverPort; + + private final String version; + + private final JHipsterProperties jHipsterProperties; + + public LoggingConfiguration(@Value("${spring.application.name}") String appName, @Value("${server.port}") String serverPort, + @Value("${info.project.version:}") String version, JHipsterProperties jHipsterProperties) { + this.appName = appName; + this.serverPort = serverPort; + this.version = version; + this.jHipsterProperties = jHipsterProperties; + if (jHipsterProperties.getLogging().getLogstash().isEnabled()) { + addLogstashAppender(context); + addContextListener(context); + } + if (jHipsterProperties.getMetrics().getLogs().isEnabled()) { + setMetricsMarkerLogbackFilter(context); + } + } + + private void addContextListener(LoggerContext context) { + LogbackLoggerContextListener loggerContextListener = new LogbackLoggerContextListener(); + loggerContextListener.setContext(context); + context.addListener(loggerContextListener); + } + + private void addLogstashAppender(LoggerContext context) { + log.info("Initializing Logstash logging"); + + LogstashTcpSocketAppender logstashAppender = new LogstashTcpSocketAppender(); + logstashAppender.setName(LOGSTASH_APPENDER_NAME); + logstashAppender.setContext(context); + String optionalFields = ""; + String customFields = "{\"app_name\":\"" + appName + "\",\"app_port\":\"" + serverPort + "\"," + + optionalFields + "\"version\":\"" + version + "\"}"; + + // More documentation is available at: https://github.com/logstash/logstash-logback-encoder + LogstashEncoder logstashEncoder = new LogstashEncoder(); + // Set the Logstash appender config from JHipster properties + logstashEncoder.setCustomFields(customFields); + // Set the Logstash appender config from JHipster properties + logstashAppender.addDestinations(new InetSocketAddress(jHipsterProperties.getLogging().getLogstash().getHost(), jHipsterProperties.getLogging().getLogstash().getPort())); + + ShortenedThrowableConverter throwableConverter = new ShortenedThrowableConverter(); + throwableConverter.setRootCauseFirst(true); + logstashEncoder.setThrowableConverter(throwableConverter); + logstashEncoder.setCustomFields(customFields); + + logstashAppender.setEncoder(logstashEncoder); + logstashAppender.start(); + + // Wrap the appender in an Async appender for performance + AsyncAppender asyncLogstashAppender = new AsyncAppender(); + asyncLogstashAppender.setContext(context); + asyncLogstashAppender.setName(ASYNC_LOGSTASH_APPENDER_NAME); + asyncLogstashAppender.setQueueSize(jHipsterProperties.getLogging().getLogstash().getQueueSize()); + asyncLogstashAppender.addAppender(logstashAppender); + asyncLogstashAppender.start(); + + context.getLogger("ROOT").addAppender(asyncLogstashAppender); + } + + // Configure a log filter to remove "metrics" logs from all appenders except the "LOGSTASH" appender + private void setMetricsMarkerLogbackFilter(LoggerContext context) { + log.info("Filtering metrics logs from all appenders except the {} appender", LOGSTASH_APPENDER_NAME); + OnMarkerEvaluator onMarkerMetricsEvaluator = new OnMarkerEvaluator(); + onMarkerMetricsEvaluator.setContext(context); + onMarkerMetricsEvaluator.addMarker("metrics"); + onMarkerMetricsEvaluator.start(); + EvaluatorFilter metricsFilter = new EvaluatorFilter<>(); + metricsFilter.setContext(context); + metricsFilter.setEvaluator(onMarkerMetricsEvaluator); + metricsFilter.setOnMatch(FilterReply.DENY); + metricsFilter.start(); + + for (ch.qos.logback.classic.Logger logger : context.getLoggerList()) { + for (Iterator> it = logger.iteratorForAppenders(); it.hasNext();) { + Appender appender = it.next(); + if (!appender.getName().equals(ASYNC_LOGSTASH_APPENDER_NAME)) { + log.debug("Filter metrics logs from the {} appender", appender.getName()); + appender.setContext(context); + appender.addFilter(metricsFilter); + appender.start(); + } + } + } + } + + /** + * Logback configuration is achieved by configuration file and API. + * When configuration file change is detected, the configuration is reset. + * This listener ensures that the programmatic configuration is also re-applied after reset. + */ + class LogbackLoggerContextListener extends ContextAwareBase implements LoggerContextListener { + + @Override + public boolean isResetResistant() { + return true; + } + + @Override + public void onStart(LoggerContext context) { + addLogstashAppender(context); + } + + @Override + public void onReset(LoggerContext context) { + addLogstashAppender(context); + } + + @Override + public void onStop(LoggerContext context) { + // Nothing to do. + } + + @Override + public void onLevelChange(ch.qos.logback.classic.Logger logger, Level level) { + // Nothing to do. + } + } + +} diff --git a/jhipster/jhipster-uaa/quotes/src/main/java/com/baeldung/jhipster/quotes/config/MetricsConfiguration.java b/jhipster/jhipster-uaa/quotes/src/main/java/com/baeldung/jhipster/quotes/config/MetricsConfiguration.java new file mode 100644 index 0000000000..8a83d5c31d --- /dev/null +++ b/jhipster/jhipster-uaa/quotes/src/main/java/com/baeldung/jhipster/quotes/config/MetricsConfiguration.java @@ -0,0 +1,99 @@ +package com.baeldung.jhipster.quotes.config; + +import io.github.jhipster.config.JHipsterProperties; + +import com.codahale.metrics.JmxReporter; +import com.codahale.metrics.JvmAttributeGaugeSet; +import com.codahale.metrics.MetricRegistry; +import com.codahale.metrics.Slf4jReporter; +import com.codahale.metrics.health.HealthCheckRegistry; +import com.codahale.metrics.jvm.*; +import com.ryantenney.metrics.spring.config.annotation.EnableMetrics; +import com.ryantenney.metrics.spring.config.annotation.MetricsConfigurerAdapter; +import com.zaxxer.hikari.HikariDataSource; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.slf4j.Marker; +import org.slf4j.MarkerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.*; + +import javax.annotation.PostConstruct; +import java.lang.management.ManagementFactory; +import java.util.concurrent.TimeUnit; + +@Configuration +@EnableMetrics(proxyTargetClass = true) +public class MetricsConfiguration extends MetricsConfigurerAdapter { + + private static final String PROP_METRIC_REG_JVM_MEMORY = "jvm.memory"; + private static final String PROP_METRIC_REG_JVM_GARBAGE = "jvm.garbage"; + private static final String PROP_METRIC_REG_JVM_THREADS = "jvm.threads"; + private static final String PROP_METRIC_REG_JVM_FILES = "jvm.files"; + private static final String PROP_METRIC_REG_JVM_BUFFERS = "jvm.buffers"; + private static final String PROP_METRIC_REG_JVM_ATTRIBUTE_SET = "jvm.attributes"; + + private final Logger log = LoggerFactory.getLogger(MetricsConfiguration.class); + + private MetricRegistry metricRegistry = new MetricRegistry(); + + private HealthCheckRegistry healthCheckRegistry = new HealthCheckRegistry(); + + private final JHipsterProperties jHipsterProperties; + + private HikariDataSource hikariDataSource; + + public MetricsConfiguration(JHipsterProperties jHipsterProperties) { + this.jHipsterProperties = jHipsterProperties; + } + + @Autowired(required = false) + public void setHikariDataSource(HikariDataSource hikariDataSource) { + this.hikariDataSource = hikariDataSource; + } + + @Override + @Bean + public MetricRegistry getMetricRegistry() { + return metricRegistry; + } + + @Override + @Bean + public HealthCheckRegistry getHealthCheckRegistry() { + return healthCheckRegistry; + } + + @PostConstruct + public void init() { + log.debug("Registering JVM gauges"); + metricRegistry.register(PROP_METRIC_REG_JVM_MEMORY, new MemoryUsageGaugeSet()); + metricRegistry.register(PROP_METRIC_REG_JVM_GARBAGE, new GarbageCollectorMetricSet()); + metricRegistry.register(PROP_METRIC_REG_JVM_THREADS, new ThreadStatesGaugeSet()); + metricRegistry.register(PROP_METRIC_REG_JVM_FILES, new FileDescriptorRatioGauge()); + metricRegistry.register(PROP_METRIC_REG_JVM_BUFFERS, new BufferPoolMetricSet(ManagementFactory.getPlatformMBeanServer())); + metricRegistry.register(PROP_METRIC_REG_JVM_ATTRIBUTE_SET, new JvmAttributeGaugeSet()); + if (hikariDataSource != null) { + log.debug("Monitoring the datasource"); + // remove the factory created by HikariDataSourceMetricsPostProcessor until JHipster migrate to Micrometer + hikariDataSource.setMetricsTrackerFactory(null); + hikariDataSource.setMetricRegistry(metricRegistry); + } + if (jHipsterProperties.getMetrics().getJmx().isEnabled()) { + log.debug("Initializing Metrics JMX reporting"); + JmxReporter jmxReporter = JmxReporter.forRegistry(metricRegistry).build(); + jmxReporter.start(); + } + if (jHipsterProperties.getMetrics().getLogs().isEnabled()) { + log.info("Initializing Metrics Log reporting"); + Marker metricsMarker = MarkerFactory.getMarker("metrics"); + final Slf4jReporter reporter = Slf4jReporter.forRegistry(metricRegistry) + .outputTo(LoggerFactory.getLogger("metrics")) + .markWith(metricsMarker) + .convertRatesTo(TimeUnit.SECONDS) + .convertDurationsTo(TimeUnit.MILLISECONDS) + .build(); + reporter.start(jHipsterProperties.getMetrics().getLogs().getReportFrequency(), TimeUnit.SECONDS); + } + } +} diff --git a/jhipster/jhipster-uaa/quotes/src/main/java/com/baeldung/jhipster/quotes/config/SecurityConfiguration.java b/jhipster/jhipster-uaa/quotes/src/main/java/com/baeldung/jhipster/quotes/config/SecurityConfiguration.java new file mode 100644 index 0000000000..8c95001dcc --- /dev/null +++ b/jhipster/jhipster-uaa/quotes/src/main/java/com/baeldung/jhipster/quotes/config/SecurityConfiguration.java @@ -0,0 +1,75 @@ +package com.baeldung.jhipster.quotes.config; + +import com.baeldung.jhipster.quotes.config.oauth2.OAuth2JwtAccessTokenConverter; +import com.baeldung.jhipster.quotes.config.oauth2.OAuth2Properties; +import com.baeldung.jhipster.quotes.security.oauth2.OAuth2SignatureVerifierClient; +import com.baeldung.jhipster.quotes.security.AuthoritiesConstants; + +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.cloud.client.loadbalancer.RestTemplateCustomizer; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity; +import org.springframework.security.config.annotation.web.builders.HttpSecurity; +import org.springframework.security.config.http.SessionCreationPolicy; +import org.springframework.security.oauth2.config.annotation.web.configuration.EnableResourceServer; +import org.springframework.security.oauth2.config.annotation.web.configuration.ResourceServerConfigurerAdapter; +import org.springframework.security.oauth2.provider.token.TokenStore; +import org.springframework.security.oauth2.provider.token.store.JwtAccessTokenConverter; +import org.springframework.security.oauth2.provider.token.store.JwtTokenStore; +import org.springframework.security.web.csrf.CookieCsrfTokenRepository; +import org.springframework.web.client.RestTemplate; + +@Configuration +@EnableResourceServer +@EnableGlobalMethodSecurity(prePostEnabled = true, securedEnabled = true) +public class SecurityConfiguration extends ResourceServerConfigurerAdapter { + private final OAuth2Properties oAuth2Properties; + + public SecurityConfiguration(OAuth2Properties oAuth2Properties) { + this.oAuth2Properties = oAuth2Properties; + } + + @Override + public void configure(HttpSecurity http) throws Exception { + http + .csrf() + .disable() + .headers() + .frameOptions() + .disable() + .and() + .sessionManagement() + .sessionCreationPolicy(SessionCreationPolicy.STATELESS) + .and() + .authorizeRequests() + .antMatchers("/api/**").authenticated() + .antMatchers("/management/health").permitAll() + .antMatchers("/management/info").permitAll() + .antMatchers("/management/**").hasAuthority(AuthoritiesConstants.ADMIN); + } + + @Bean + public TokenStore tokenStore(JwtAccessTokenConverter jwtAccessTokenConverter) { + return new JwtTokenStore(jwtAccessTokenConverter); + } + + @Bean + public JwtAccessTokenConverter jwtAccessTokenConverter(OAuth2SignatureVerifierClient signatureVerifierClient) { + return new OAuth2JwtAccessTokenConverter(oAuth2Properties, signatureVerifierClient); + } + + @Bean + @Qualifier("loadBalancedRestTemplate") + public RestTemplate loadBalancedRestTemplate(RestTemplateCustomizer customizer) { + RestTemplate restTemplate = new RestTemplate(); + customizer.customize(restTemplate); + return restTemplate; + } + + @Bean + @Qualifier("vanillaRestTemplate") + public RestTemplate vanillaRestTemplate() { + return new RestTemplate(); + } +} diff --git a/jhipster/jhipster-uaa/quotes/src/main/java/com/baeldung/jhipster/quotes/config/WebConfigurer.java b/jhipster/jhipster-uaa/quotes/src/main/java/com/baeldung/jhipster/quotes/config/WebConfigurer.java new file mode 100644 index 0000000000..4c2d0e4adc --- /dev/null +++ b/jhipster/jhipster-uaa/quotes/src/main/java/com/baeldung/jhipster/quotes/config/WebConfigurer.java @@ -0,0 +1,148 @@ +package com.baeldung.jhipster.quotes.config; + +import com.codahale.metrics.MetricRegistry; +import com.codahale.metrics.servlet.InstrumentedFilter; +import com.codahale.metrics.servlets.MetricsServlet; +import io.github.jhipster.config.JHipsterConstants; +import io.github.jhipster.config.JHipsterProperties; +import io.github.jhipster.config.h2.H2ConfigurationHelper; +import io.undertow.UndertowOptions; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.web.embedded.undertow.UndertowServletWebServerFactory; +import org.springframework.boot.web.server.*; +import org.springframework.boot.web.servlet.ServletContextInitializer; +import org.springframework.boot.web.servlet.server.ConfigurableServletWebServerFactory; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.core.env.Environment; +import org.springframework.http.MediaType; +import org.springframework.web.cors.CorsConfiguration; +import org.springframework.web.cors.UrlBasedCorsConfigurationSource; +import org.springframework.web.filter.CorsFilter; + +import javax.servlet.*; +import java.nio.charset.StandardCharsets; +import java.util.*; + + +/** + * Configuration of web application with Servlet 3.0 APIs. + */ +@Configuration +public class WebConfigurer implements ServletContextInitializer, WebServerFactoryCustomizer { + + private final Logger log = LoggerFactory.getLogger(WebConfigurer.class); + + private final Environment env; + + private final JHipsterProperties jHipsterProperties; + + private MetricRegistry metricRegistry; + + public WebConfigurer(Environment env, JHipsterProperties jHipsterProperties) { + + this.env = env; + this.jHipsterProperties = jHipsterProperties; + } + + @Override + public void onStartup(ServletContext servletContext) throws ServletException { + if (env.getActiveProfiles().length != 0) { + log.info("Web application configuration, using profiles: {}", (Object[]) env.getActiveProfiles()); + } + EnumSet disps = EnumSet.of(DispatcherType.REQUEST, DispatcherType.FORWARD, DispatcherType.ASYNC); + initMetrics(servletContext, disps); + if (env.acceptsProfiles(JHipsterConstants.SPRING_PROFILE_DEVELOPMENT)) { + initH2Console(servletContext); + } + log.info("Web application fully configured"); + } + + /** + * Customize the Servlet engine: Mime types, the document root, the cache. + */ + @Override + public void customize(WebServerFactory server) { + setMimeMappings(server); + + /* + * Enable HTTP/2 for Undertow - https://twitter.com/ankinson/status/829256167700492288 + * HTTP/2 requires HTTPS, so HTTP requests will fallback to HTTP/1.1. + * See the JHipsterProperties class and your application-*.yml configuration files + * for more information. + */ + if (jHipsterProperties.getHttp().getVersion().equals(JHipsterProperties.Http.Version.V_2_0) && + server instanceof UndertowServletWebServerFactory) { + + ((UndertowServletWebServerFactory) server) + .addBuilderCustomizers(builder -> + builder.setServerOption(UndertowOptions.ENABLE_HTTP2, true)); + } + } + + private void setMimeMappings(WebServerFactory server) { + if (server instanceof ConfigurableServletWebServerFactory) { + MimeMappings mappings = new MimeMappings(MimeMappings.DEFAULT); + // IE issue, see https://github.com/jhipster/generator-jhipster/pull/711 + mappings.add("html", MediaType.TEXT_HTML_VALUE + ";charset=" + StandardCharsets.UTF_8.name().toLowerCase()); + // CloudFoundry issue, see https://github.com/cloudfoundry/gorouter/issues/64 + mappings.add("json", MediaType.TEXT_HTML_VALUE + ";charset=" + StandardCharsets.UTF_8.name().toLowerCase()); + ConfigurableServletWebServerFactory servletWebServer = (ConfigurableServletWebServerFactory) server; + servletWebServer.setMimeMappings(mappings); + } + } + + /** + * Initializes Metrics. + */ + private void initMetrics(ServletContext servletContext, EnumSet disps) { + log.debug("Initializing Metrics registries"); + servletContext.setAttribute(InstrumentedFilter.REGISTRY_ATTRIBUTE, + metricRegistry); + servletContext.setAttribute(MetricsServlet.METRICS_REGISTRY, + metricRegistry); + + log.debug("Registering Metrics Filter"); + FilterRegistration.Dynamic metricsFilter = servletContext.addFilter("webappMetricsFilter", + new InstrumentedFilter()); + + metricsFilter.addMappingForUrlPatterns(disps, true, "/*"); + metricsFilter.setAsyncSupported(true); + + log.debug("Registering Metrics Servlet"); + ServletRegistration.Dynamic metricsAdminServlet = + servletContext.addServlet("metricsServlet", new MetricsServlet()); + + metricsAdminServlet.addMapping("/management/metrics/*"); + metricsAdminServlet.setAsyncSupported(true); + metricsAdminServlet.setLoadOnStartup(2); + } + + @Bean + public CorsFilter corsFilter() { + UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource(); + CorsConfiguration config = jHipsterProperties.getCors(); + if (config.getAllowedOrigins() != null && !config.getAllowedOrigins().isEmpty()) { + log.debug("Registering CORS filter"); + source.registerCorsConfiguration("/api/**", config); + source.registerCorsConfiguration("/management/**", config); + source.registerCorsConfiguration("/v2/api-docs", config); + } + return new CorsFilter(source); + } + + /** + * Initializes H2 console. + */ + private void initH2Console(ServletContext servletContext) { + log.debug("Initialize H2 console"); + H2ConfigurationHelper.initH2Console(servletContext); + } + + @Autowired(required = false) + public void setMetricRegistry(MetricRegistry metricRegistry) { + this.metricRegistry = metricRegistry; + } +} diff --git a/jhipster/jhipster-uaa/quotes/src/main/java/com/baeldung/jhipster/quotes/config/audit/AuditEventConverter.java b/jhipster/jhipster-uaa/quotes/src/main/java/com/baeldung/jhipster/quotes/config/audit/AuditEventConverter.java new file mode 100644 index 0000000000..4b5f60595f --- /dev/null +++ b/jhipster/jhipster-uaa/quotes/src/main/java/com/baeldung/jhipster/quotes/config/audit/AuditEventConverter.java @@ -0,0 +1,86 @@ +package com.baeldung.jhipster.quotes.config.audit; + +import com.baeldung.jhipster.quotes.domain.PersistentAuditEvent; + +import org.springframework.boot.actuate.audit.AuditEvent; +import org.springframework.security.web.authentication.WebAuthenticationDetails; +import org.springframework.stereotype.Component; + +import java.util.*; + +@Component +public class AuditEventConverter { + + /** + * Convert a list of PersistentAuditEvent to a list of AuditEvent + * + * @param persistentAuditEvents the list to convert + * @return the converted list. + */ + public List convertToAuditEvent(Iterable persistentAuditEvents) { + if (persistentAuditEvents == null) { + return Collections.emptyList(); + } + List auditEvents = new ArrayList<>(); + for (PersistentAuditEvent persistentAuditEvent : persistentAuditEvents) { + auditEvents.add(convertToAuditEvent(persistentAuditEvent)); + } + return auditEvents; + } + + /** + * Convert a PersistentAuditEvent to an AuditEvent + * + * @param persistentAuditEvent the event to convert + * @return the converted list. + */ + public AuditEvent convertToAuditEvent(PersistentAuditEvent persistentAuditEvent) { + if (persistentAuditEvent == null) { + return null; + } + return new AuditEvent(persistentAuditEvent.getAuditEventDate(), persistentAuditEvent.getPrincipal(), + persistentAuditEvent.getAuditEventType(), convertDataToObjects(persistentAuditEvent.getData())); + } + + /** + * Internal conversion. This is needed to support the current SpringBoot actuator AuditEventRepository interface + * + * @param data the data to convert + * @return a map of String, Object + */ + public Map convertDataToObjects(Map data) { + Map results = new HashMap<>(); + + if (data != null) { + for (Map.Entry entry : data.entrySet()) { + results.put(entry.getKey(), entry.getValue()); + } + } + return results; + } + + /** + * Internal conversion. This method will allow to save additional data. + * By default, it will save the object as string + * + * @param data the data to convert + * @return a map of String, String + */ + public Map convertDataToStrings(Map data) { + Map results = new HashMap<>(); + + if (data != null) { + for (Map.Entry entry : data.entrySet()) { + // Extract the data that will be saved. + if (entry.getValue() instanceof WebAuthenticationDetails) { + WebAuthenticationDetails authenticationDetails = (WebAuthenticationDetails) entry.getValue(); + results.put("remoteAddress", authenticationDetails.getRemoteAddress()); + results.put("sessionId", authenticationDetails.getSessionId()); + } else { + results.put(entry.getKey(), Objects.toString(entry.getValue())); + } + } + } + return results; + } +} diff --git a/jhipster/jhipster-uaa/quotes/src/main/java/com/baeldung/jhipster/quotes/config/audit/package-info.java b/jhipster/jhipster-uaa/quotes/src/main/java/com/baeldung/jhipster/quotes/config/audit/package-info.java new file mode 100644 index 0000000000..20cbbd0eb0 --- /dev/null +++ b/jhipster/jhipster-uaa/quotes/src/main/java/com/baeldung/jhipster/quotes/config/audit/package-info.java @@ -0,0 +1,4 @@ +/** + * Audit specific code. + */ +package com.baeldung.jhipster.quotes.config.audit; diff --git a/jhipster/jhipster-uaa/quotes/src/main/java/com/baeldung/jhipster/quotes/config/oauth2/OAuth2JwtAccessTokenConverter.java b/jhipster/jhipster-uaa/quotes/src/main/java/com/baeldung/jhipster/quotes/config/oauth2/OAuth2JwtAccessTokenConverter.java new file mode 100644 index 0000000000..6450e83034 --- /dev/null +++ b/jhipster/jhipster-uaa/quotes/src/main/java/com/baeldung/jhipster/quotes/config/oauth2/OAuth2JwtAccessTokenConverter.java @@ -0,0 +1,109 @@ +package com.baeldung.jhipster.quotes.config.oauth2; + +import com.baeldung.jhipster.quotes.security.oauth2.OAuth2SignatureVerifierClient; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.security.jwt.crypto.sign.SignatureVerifier; +import org.springframework.security.oauth2.common.exceptions.InvalidTokenException; +import org.springframework.security.oauth2.provider.token.store.JwtAccessTokenConverter; +import org.springframework.security.oauth2.provider.OAuth2Authentication; + +import java.util.Map; + +/** + * Improved JwtAccessTokenConverter that can handle lazy fetching of public verifier keys. + */ +public class OAuth2JwtAccessTokenConverter extends JwtAccessTokenConverter { + private final Logger log = LoggerFactory.getLogger(OAuth2JwtAccessTokenConverter.class); + + private final OAuth2Properties oAuth2Properties; + private final OAuth2SignatureVerifierClient signatureVerifierClient; + /** + * When did we last fetch the public key? + */ + private long lastKeyFetchTimestamp; + + public OAuth2JwtAccessTokenConverter(OAuth2Properties oAuth2Properties, OAuth2SignatureVerifierClient signatureVerifierClient) { + this.oAuth2Properties = oAuth2Properties; + this.signatureVerifierClient = signatureVerifierClient; + tryCreateSignatureVerifier(); + } + + /** + * Try to decode the token with the current public key. + * If it fails, contact the OAuth2 server to get a new public key, then try again. + * We might not have fetched it in the first place or it might have changed. + * + * @param token the JWT token to decode. + * @return the resulting claims. + * @throws InvalidTokenException if we cannot decode the token. + */ + @Override + protected Map decode(String token) { + try { + //check if our public key and thus SignatureVerifier have expired + long ttl = oAuth2Properties.getSignatureVerification().getTtl(); + if (ttl > 0 && System.currentTimeMillis() - lastKeyFetchTimestamp > ttl) { + throw new InvalidTokenException("public key expired"); + } + return super.decode(token); + } catch (InvalidTokenException ex) { + if (tryCreateSignatureVerifier()) { + return super.decode(token); + } + throw ex; + } + } + + /** + * Fetch a new public key from the AuthorizationServer. + * + * @return true, if we could fetch it; false, if we could not. + */ + private boolean tryCreateSignatureVerifier() { + long t = System.currentTimeMillis(); + if (t - lastKeyFetchTimestamp < oAuth2Properties.getSignatureVerification().getPublicKeyRefreshRateLimit()) { + return false; + } + try { + SignatureVerifier verifier = signatureVerifierClient.getSignatureVerifier(); + if (verifier != null) { + setVerifier(verifier); + lastKeyFetchTimestamp = t; + log.debug("Public key retrieved from OAuth2 server to create SignatureVerifier"); + return true; + } + } catch (Throwable ex) { + log.error("could not get public key from OAuth2 server to create SignatureVerifier", ex); + } + return false; + } + /** + * Extract JWT claims and set it to OAuth2Authentication decoded details. + * Here is how to get details: + * + *

+     * 
+     *  SecurityContext securityContext = SecurityContextHolder.getContext();
+     *  Authentication authentication = securityContext.getAuthentication();
+     *  if (authentication != null) {
+     *      Object details = authentication.getDetails();
+     *      if(details instanceof OAuth2AuthenticationDetails) {
+     *          Object decodedDetails = ((OAuth2AuthenticationDetails) details).getDecodedDetails();
+     *          if(decodedDetails != null && decodedDetails instanceof Map) {
+     *             String detailFoo = ((Map) decodedDetails).get("foo");
+     *          }
+     *      }
+     *  }
+     * 
+     *  
+ * @param claims OAuth2JWTToken claims + * @return OAuth2Authentication + */ + @Override + public OAuth2Authentication extractAuthentication(Map claims) { + OAuth2Authentication authentication = super.extractAuthentication(claims); + authentication.setDetails(claims); + return authentication; + } +} diff --git a/jhipster/jhipster-uaa/quotes/src/main/java/com/baeldung/jhipster/quotes/config/oauth2/OAuth2Properties.java b/jhipster/jhipster-uaa/quotes/src/main/java/com/baeldung/jhipster/quotes/config/oauth2/OAuth2Properties.java new file mode 100644 index 0000000000..32a76d4a21 --- /dev/null +++ b/jhipster/jhipster-uaa/quotes/src/main/java/com/baeldung/jhipster/quotes/config/oauth2/OAuth2Properties.java @@ -0,0 +1,118 @@ +package com.baeldung.jhipster.quotes.config.oauth2; + +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.stereotype.Component; + +/** + * OAuth2 properties define properties for OAuth2-based microservices. + */ +@Component +@ConfigurationProperties(prefix = "oauth2", ignoreUnknownFields = false) +public class OAuth2Properties { + private WebClientConfiguration webClientConfiguration = new WebClientConfiguration(); + + private SignatureVerification signatureVerification = new SignatureVerification(); + + public WebClientConfiguration getWebClientConfiguration() { + return webClientConfiguration; + } + + public SignatureVerification getSignatureVerification() { + return signatureVerification; + } + + public static class WebClientConfiguration { + private String clientId = "web_app"; + private String secret = "changeit"; + /** + * Holds the session timeout in seconds for non-remember-me sessions. + * After so many seconds of inactivity, the session will be terminated. + * Only checked during token refresh, so long access token validity may + * delay the session timeout accordingly. + */ + private int sessionTimeoutInSeconds = 1800; + /** + * Defines the cookie domain. If specified, cookies will be set on this domain. + * If not configured, then cookies will be set on the top-level domain of the + * request you sent, i.e. if you send a request to app1.your-domain.com, + * then cookies will be set on .your-domain.com, such that they + * are also valid for app2.your-domain.com. + */ + private String cookieDomain; + + public String getClientId() { + return clientId; + } + + public void setClientId(String clientId) { + this.clientId = clientId; + } + + public String getSecret() { + return secret; + } + + public void setSecret(String secret) { + this.secret = secret; + } + + public int getSessionTimeoutInSeconds() { + return sessionTimeoutInSeconds; + } + + public void setSessionTimeoutInSeconds(int sessionTimeoutInSeconds) { + this.sessionTimeoutInSeconds = sessionTimeoutInSeconds; + } + + public String getCookieDomain() { + return cookieDomain; + } + + public void setCookieDomain(String cookieDomain) { + this.cookieDomain = cookieDomain; + } + } + + public static class SignatureVerification { + /** + * Maximum refresh rate for public keys in ms. + * We won't fetch new public keys any faster than that to avoid spamming UAA in case + * we receive a lot of "illegal" tokens. + */ + private long publicKeyRefreshRateLimit = 10 * 1000L; + /** + * Maximum TTL for the public key in ms. + * The public key will be fetched again from UAA if it gets older than that. + * That way, we make sure that we get the newest keys always in case they are updated there. + */ + private long ttl = 24 * 60 * 60 * 1000L; + /** + * Endpoint where to retrieve the public key used to verify token signatures. + */ + private String publicKeyEndpointUri = "http://uaa/oauth/token_key"; + + public long getPublicKeyRefreshRateLimit() { + return publicKeyRefreshRateLimit; + } + + public void setPublicKeyRefreshRateLimit(long publicKeyRefreshRateLimit) { + this.publicKeyRefreshRateLimit = publicKeyRefreshRateLimit; + } + + public long getTtl() { + return ttl; + } + + public void setTtl(long ttl) { + this.ttl = ttl; + } + + public String getPublicKeyEndpointUri() { + return publicKeyEndpointUri; + } + + public void setPublicKeyEndpointUri(String publicKeyEndpointUri) { + this.publicKeyEndpointUri = publicKeyEndpointUri; + } + } +} diff --git a/jhipster/jhipster-uaa/quotes/src/main/java/com/baeldung/jhipster/quotes/config/package-info.java b/jhipster/jhipster-uaa/quotes/src/main/java/com/baeldung/jhipster/quotes/config/package-info.java new file mode 100644 index 0000000000..210bf685fb --- /dev/null +++ b/jhipster/jhipster-uaa/quotes/src/main/java/com/baeldung/jhipster/quotes/config/package-info.java @@ -0,0 +1,4 @@ +/** + * Spring Framework configuration files. + */ +package com.baeldung.jhipster.quotes.config; diff --git a/jhipster/jhipster-uaa/quotes/src/main/java/com/baeldung/jhipster/quotes/domain/AbstractAuditingEntity.java b/jhipster/jhipster-uaa/quotes/src/main/java/com/baeldung/jhipster/quotes/domain/AbstractAuditingEntity.java new file mode 100644 index 0000000000..c6e2635f98 --- /dev/null +++ b/jhipster/jhipster-uaa/quotes/src/main/java/com/baeldung/jhipster/quotes/domain/AbstractAuditingEntity.java @@ -0,0 +1,79 @@ +package com.baeldung.jhipster.quotes.domain; + +import com.fasterxml.jackson.annotation.JsonIgnore; +import org.hibernate.envers.Audited; +import org.springframework.data.annotation.CreatedBy; +import org.springframework.data.annotation.CreatedDate; +import org.springframework.data.annotation.LastModifiedBy; +import org.springframework.data.annotation.LastModifiedDate; +import org.springframework.data.jpa.domain.support.AuditingEntityListener; + +import java.io.Serializable; +import java.time.Instant; +import javax.persistence.Column; +import javax.persistence.EntityListeners; +import javax.persistence.MappedSuperclass; + +/** + * Base abstract class for entities which will hold definitions for created, last modified by and created, + * last modified by date. + */ +@MappedSuperclass +@Audited +@EntityListeners(AuditingEntityListener.class) +public abstract class AbstractAuditingEntity implements Serializable { + + private static final long serialVersionUID = 1L; + + @CreatedBy + @Column(name = "created_by", nullable = false, length = 50, updatable = false) + @JsonIgnore + private String createdBy; + + @CreatedDate + @Column(name = "created_date", nullable = false, updatable = false) + @JsonIgnore + private Instant createdDate = Instant.now(); + + @LastModifiedBy + @Column(name = "last_modified_by", length = 50) + @JsonIgnore + private String lastModifiedBy; + + @LastModifiedDate + @Column(name = "last_modified_date") + @JsonIgnore + private Instant lastModifiedDate = Instant.now(); + + public String getCreatedBy() { + return createdBy; + } + + public void setCreatedBy(String createdBy) { + this.createdBy = createdBy; + } + + public Instant getCreatedDate() { + return createdDate; + } + + public void setCreatedDate(Instant createdDate) { + this.createdDate = createdDate; + } + + public String getLastModifiedBy() { + return lastModifiedBy; + } + + public void setLastModifiedBy(String lastModifiedBy) { + this.lastModifiedBy = lastModifiedBy; + } + + public Instant getLastModifiedDate() { + return lastModifiedDate; + } + + public void setLastModifiedDate(Instant lastModifiedDate) { + this.lastModifiedDate = lastModifiedDate; + } +} diff --git a/jhipster/jhipster-uaa/quotes/src/main/java/com/baeldung/jhipster/quotes/domain/PersistentAuditEvent.java b/jhipster/jhipster-uaa/quotes/src/main/java/com/baeldung/jhipster/quotes/domain/PersistentAuditEvent.java new file mode 100644 index 0000000000..c4ead3a122 --- /dev/null +++ b/jhipster/jhipster-uaa/quotes/src/main/java/com/baeldung/jhipster/quotes/domain/PersistentAuditEvent.java @@ -0,0 +1,81 @@ +package com.baeldung.jhipster.quotes.domain; + +import javax.persistence.*; +import javax.validation.constraints.NotNull; +import java.io.Serializable; +import java.time.Instant; +import java.util.HashMap; +import java.util.Map; + +/** + * Persist AuditEvent managed by the Spring Boot actuator. + * + * @see org.springframework.boot.actuate.audit.AuditEvent + */ +@Entity +@Table(name = "jhi_persistent_audit_event") +public class PersistentAuditEvent implements Serializable { + + private static final long serialVersionUID = 1L; + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Column(name = "event_id") + private Long id; + + @NotNull + @Column(nullable = false) + private String principal; + + @Column(name = "event_date") + private Instant auditEventDate; + + @Column(name = "event_type") + private String auditEventType; + + @ElementCollection + @MapKeyColumn(name = "name") + @Column(name = "value") + @CollectionTable(name = "jhi_persistent_audit_evt_data", joinColumns=@JoinColumn(name="event_id")) + private Map data = new HashMap<>(); + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getPrincipal() { + return principal; + } + + public void setPrincipal(String principal) { + this.principal = principal; + } + + public Instant getAuditEventDate() { + return auditEventDate; + } + + public void setAuditEventDate(Instant auditEventDate) { + this.auditEventDate = auditEventDate; + } + + public String getAuditEventType() { + return auditEventType; + } + + public void setAuditEventType(String auditEventType) { + this.auditEventType = auditEventType; + } + + public Map getData() { + return data; + } + + public void setData(Map data) { + this.data = data; + } +} diff --git a/jhipster/jhipster-uaa/quotes/src/main/java/com/baeldung/jhipster/quotes/domain/Quote.java b/jhipster/jhipster-uaa/quotes/src/main/java/com/baeldung/jhipster/quotes/domain/Quote.java new file mode 100644 index 0000000000..7d9d0aa93e --- /dev/null +++ b/jhipster/jhipster-uaa/quotes/src/main/java/com/baeldung/jhipster/quotes/domain/Quote.java @@ -0,0 +1,118 @@ +package com.baeldung.jhipster.quotes.domain; + +import org.hibernate.annotations.Cache; +import org.hibernate.annotations.CacheConcurrencyStrategy; + +import javax.persistence.*; +import javax.validation.constraints.*; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.ZonedDateTime; +import java.util.Objects; + +/** + * A Quote. + */ +@Entity +@Table(name = "quote") +@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE) +public class Quote implements Serializable { + + private static final long serialVersionUID = 1L; + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + private Long id; + + @NotNull + @Column(name = "symbol", nullable = false) + private String symbol; + + @NotNull + @Column(name = "price", precision = 10, scale = 2, nullable = false) + private BigDecimal price; + + @NotNull + @Column(name = "last_trade", nullable = false) + private ZonedDateTime lastTrade; + + // jhipster-needle-entity-add-field - JHipster will add fields here, do not remove + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getSymbol() { + return symbol; + } + + public Quote symbol(String symbol) { + this.symbol = symbol; + return this; + } + + public void setSymbol(String symbol) { + this.symbol = symbol; + } + + public BigDecimal getPrice() { + return price; + } + + public Quote price(BigDecimal price) { + this.price = price; + return this; + } + + public void setPrice(BigDecimal price) { + this.price = price; + } + + public ZonedDateTime getLastTrade() { + return lastTrade; + } + + public Quote lastTrade(ZonedDateTime lastTrade) { + this.lastTrade = lastTrade; + return this; + } + + public void setLastTrade(ZonedDateTime lastTrade) { + this.lastTrade = lastTrade; + } + // jhipster-needle-entity-add-getters-setters - JHipster will add getters and setters here, do not remove + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Quote quote = (Quote) o; + if (quote.getId() == null || getId() == null) { + return false; + } + return Objects.equals(getId(), quote.getId()); + } + + @Override + public int hashCode() { + return Objects.hashCode(getId()); + } + + @Override + public String toString() { + return "Quote{" + + "id=" + getId() + + ", symbol='" + getSymbol() + "'" + + ", price=" + getPrice() + + ", lastTrade='" + getLastTrade() + "'" + + "}"; + } +} diff --git a/jhipster/jhipster-uaa/quotes/src/main/java/com/baeldung/jhipster/quotes/domain/package-info.java b/jhipster/jhipster-uaa/quotes/src/main/java/com/baeldung/jhipster/quotes/domain/package-info.java new file mode 100644 index 0000000000..03404faf86 --- /dev/null +++ b/jhipster/jhipster-uaa/quotes/src/main/java/com/baeldung/jhipster/quotes/domain/package-info.java @@ -0,0 +1,4 @@ +/** + * JPA domain objects. + */ +package com.baeldung.jhipster.quotes.domain; diff --git a/jhipster/jhipster-uaa/quotes/src/main/java/com/baeldung/jhipster/quotes/repository/QuoteRepository.java b/jhipster/jhipster-uaa/quotes/src/main/java/com/baeldung/jhipster/quotes/repository/QuoteRepository.java new file mode 100644 index 0000000000..714c57d0d6 --- /dev/null +++ b/jhipster/jhipster-uaa/quotes/src/main/java/com/baeldung/jhipster/quotes/repository/QuoteRepository.java @@ -0,0 +1,15 @@ +package com.baeldung.jhipster.quotes.repository; + +import com.baeldung.jhipster.quotes.domain.Quote; +import org.springframework.data.jpa.repository.*; +import org.springframework.stereotype.Repository; + + +/** + * Spring Data repository for the Quote entity. + */ +@SuppressWarnings("unused") +@Repository +public interface QuoteRepository extends JpaRepository, JpaSpecificationExecutor { + +} diff --git a/jhipster/jhipster-uaa/quotes/src/main/java/com/baeldung/jhipster/quotes/repository/package-info.java b/jhipster/jhipster-uaa/quotes/src/main/java/com/baeldung/jhipster/quotes/repository/package-info.java new file mode 100644 index 0000000000..c7edddfb4b --- /dev/null +++ b/jhipster/jhipster-uaa/quotes/src/main/java/com/baeldung/jhipster/quotes/repository/package-info.java @@ -0,0 +1,4 @@ +/** + * Spring Data JPA repositories. + */ +package com.baeldung.jhipster.quotes.repository; diff --git a/jhipster/jhipster-uaa/quotes/src/main/java/com/baeldung/jhipster/quotes/security/AuthoritiesConstants.java b/jhipster/jhipster-uaa/quotes/src/main/java/com/baeldung/jhipster/quotes/security/AuthoritiesConstants.java new file mode 100644 index 0000000000..e33affbb10 --- /dev/null +++ b/jhipster/jhipster-uaa/quotes/src/main/java/com/baeldung/jhipster/quotes/security/AuthoritiesConstants.java @@ -0,0 +1,16 @@ +package com.baeldung.jhipster.quotes.security; + +/** + * Constants for Spring Security authorities. + */ +public final class AuthoritiesConstants { + + public static final String ADMIN = "ROLE_ADMIN"; + + public static final String USER = "ROLE_USER"; + + public static final String ANONYMOUS = "ROLE_ANONYMOUS"; + + private AuthoritiesConstants() { + } +} diff --git a/jhipster/jhipster-uaa/quotes/src/main/java/com/baeldung/jhipster/quotes/security/SecurityUtils.java b/jhipster/jhipster-uaa/quotes/src/main/java/com/baeldung/jhipster/quotes/security/SecurityUtils.java new file mode 100644 index 0000000000..613099ff45 --- /dev/null +++ b/jhipster/jhipster-uaa/quotes/src/main/java/com/baeldung/jhipster/quotes/security/SecurityUtils.java @@ -0,0 +1,64 @@ +package com.baeldung.jhipster.quotes.security; + +import org.springframework.security.core.context.SecurityContext; +import org.springframework.security.core.context.SecurityContextHolder; +import org.springframework.security.core.userdetails.UserDetails; + +import java.util.Optional; + +/** + * Utility class for Spring Security. + */ +public final class SecurityUtils { + + private SecurityUtils() { + } + + /** + * Get the login of the current user. + * + * @return the login of the current user + */ + public static Optional getCurrentUserLogin() { + SecurityContext securityContext = SecurityContextHolder.getContext(); + return Optional.ofNullable(securityContext.getAuthentication()) + .map(authentication -> { + if (authentication.getPrincipal() instanceof UserDetails) { + UserDetails springSecurityUser = (UserDetails) authentication.getPrincipal(); + return springSecurityUser.getUsername(); + } else if (authentication.getPrincipal() instanceof String) { + return (String) authentication.getPrincipal(); + } + return null; + }); + } + + /** + * Check if a user is authenticated. + * + * @return true if the user is authenticated, false otherwise + */ + public static boolean isAuthenticated() { + SecurityContext securityContext = SecurityContextHolder.getContext(); + return Optional.ofNullable(securityContext.getAuthentication()) + .map(authentication -> authentication.getAuthorities().stream() + .noneMatch(grantedAuthority -> grantedAuthority.getAuthority().equals(AuthoritiesConstants.ANONYMOUS))) + .orElse(false); + } + + /** + * If the current user has a specific authority (security role). + *

+ * The name of this method comes from the isUserInRole() method in the Servlet API + * + * @param authority the authority to check + * @return true if the current user has the authority, false otherwise + */ + public static boolean isCurrentUserInRole(String authority) { + SecurityContext securityContext = SecurityContextHolder.getContext(); + return Optional.ofNullable(securityContext.getAuthentication()) + .map(authentication -> authentication.getAuthorities().stream() + .anyMatch(grantedAuthority -> grantedAuthority.getAuthority().equals(authority))) + .orElse(false); + } +} diff --git a/jhipster/jhipster-uaa/quotes/src/main/java/com/baeldung/jhipster/quotes/security/SpringSecurityAuditorAware.java b/jhipster/jhipster-uaa/quotes/src/main/java/com/baeldung/jhipster/quotes/security/SpringSecurityAuditorAware.java new file mode 100644 index 0000000000..12464f25f0 --- /dev/null +++ b/jhipster/jhipster-uaa/quotes/src/main/java/com/baeldung/jhipster/quotes/security/SpringSecurityAuditorAware.java @@ -0,0 +1,20 @@ +package com.baeldung.jhipster.quotes.security; + +import com.baeldung.jhipster.quotes.config.Constants; + +import java.util.Optional; + +import org.springframework.data.domain.AuditorAware; +import org.springframework.stereotype.Component; + +/** + * Implementation of AuditorAware based on Spring Security. + */ +@Component +public class SpringSecurityAuditorAware implements AuditorAware { + + @Override + public Optional getCurrentAuditor() { + return Optional.of(SecurityUtils.getCurrentUserLogin().orElse(Constants.SYSTEM_ACCOUNT)); + } +} diff --git a/jhipster/jhipster-uaa/quotes/src/main/java/com/baeldung/jhipster/quotes/security/oauth2/OAuth2SignatureVerifierClient.java b/jhipster/jhipster-uaa/quotes/src/main/java/com/baeldung/jhipster/quotes/security/oauth2/OAuth2SignatureVerifierClient.java new file mode 100644 index 0000000000..9f495f45ee --- /dev/null +++ b/jhipster/jhipster-uaa/quotes/src/main/java/com/baeldung/jhipster/quotes/security/oauth2/OAuth2SignatureVerifierClient.java @@ -0,0 +1,23 @@ +package com.baeldung.jhipster.quotes.security.oauth2; + +import org.springframework.security.jwt.crypto.sign.SignatureVerifier; + +/** + * Abstracts how to create a SignatureVerifier to verify JWT tokens with a public key. + * Implementations will have to contact the OAuth2 authorization server to fetch the public key + * and use it to build a SignatureVerifier in a server specific way. + * + * @see UaaSignatureVerifierClient + */ +public interface OAuth2SignatureVerifierClient { + /** + * Returns the SignatureVerifier used to verify JWT tokens. + * Fetches the public key from the Authorization server to create + * this verifier. + * + * @return the new verifier used to verify JWT signatures. + * Will be null if we cannot contact the token endpoint. + * @throws Exception if we could not create a SignatureVerifier or contact the token endpoint. + */ + SignatureVerifier getSignatureVerifier() throws Exception; +} diff --git a/jhipster/jhipster-uaa/quotes/src/main/java/com/baeldung/jhipster/quotes/security/oauth2/UaaSignatureVerifierClient.java b/jhipster/jhipster-uaa/quotes/src/main/java/com/baeldung/jhipster/quotes/security/oauth2/UaaSignatureVerifierClient.java new file mode 100644 index 0000000000..49568ff71b --- /dev/null +++ b/jhipster/jhipster-uaa/quotes/src/main/java/com/baeldung/jhipster/quotes/security/oauth2/UaaSignatureVerifierClient.java @@ -0,0 +1,63 @@ +package com.baeldung.jhipster.quotes.security.oauth2; + +import com.baeldung.jhipster.quotes.config.oauth2.OAuth2Properties; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.cloud.client.discovery.DiscoveryClient; +import org.springframework.http.HttpEntity; +import org.springframework.http.HttpHeaders; +import org.springframework.http.HttpMethod; +import org.springframework.security.jwt.crypto.sign.RsaVerifier; +import org.springframework.security.jwt.crypto.sign.SignatureVerifier; +import org.springframework.security.oauth2.common.exceptions.InvalidClientException; +import org.springframework.stereotype.Component; +import org.springframework.web.client.RestTemplate; + +import java.util.Map; + +/** + * Client fetching the public key from UAA to create a SignatureVerifier. + */ +@Component +public class UaaSignatureVerifierClient implements OAuth2SignatureVerifierClient { + private final Logger log = LoggerFactory.getLogger(UaaSignatureVerifierClient.class); + private final RestTemplate restTemplate; + protected final OAuth2Properties oAuth2Properties; + + public UaaSignatureVerifierClient(DiscoveryClient discoveryClient, @Qualifier("loadBalancedRestTemplate") RestTemplate restTemplate, + OAuth2Properties oAuth2Properties) { + this.restTemplate = restTemplate; + this.oAuth2Properties = oAuth2Properties; + // Load available UAA servers + discoveryClient.getServices(); + } + + /** + * Fetches the public key from the UAA. + * + * @return the public key used to verify JWT tokens; or null. + */ + @Override + public SignatureVerifier getSignatureVerifier() throws Exception { + try { + HttpEntity request = new HttpEntity(new HttpHeaders()); + String key = (String) restTemplate + .exchange(getPublicKeyEndpoint(), HttpMethod.GET, request, Map.class).getBody() + .get("value"); + return new RsaVerifier(key); + } catch (IllegalStateException ex) { + log.warn("could not contact UAA to get public key"); + return null; + } + } + + /** Returns the configured endpoint URI to retrieve the public key. */ + private String getPublicKeyEndpoint() { + String tokenEndpointUrl = oAuth2Properties.getSignatureVerification().getPublicKeyEndpointUri(); + if (tokenEndpointUrl == null) { + throw new InvalidClientException("no token endpoint configured in application properties"); + } + return tokenEndpointUrl; + } +} diff --git a/jhipster/jhipster-uaa/quotes/src/main/java/com/baeldung/jhipster/quotes/security/package-info.java b/jhipster/jhipster-uaa/quotes/src/main/java/com/baeldung/jhipster/quotes/security/package-info.java new file mode 100644 index 0000000000..b598b92ff3 --- /dev/null +++ b/jhipster/jhipster-uaa/quotes/src/main/java/com/baeldung/jhipster/quotes/security/package-info.java @@ -0,0 +1,4 @@ +/** + * Spring Security configuration. + */ +package com.baeldung.jhipster.quotes.security; diff --git a/jhipster/jhipster-uaa/quotes/src/main/java/com/baeldung/jhipster/quotes/service/QuoteQueryService.java b/jhipster/jhipster-uaa/quotes/src/main/java/com/baeldung/jhipster/quotes/service/QuoteQueryService.java new file mode 100644 index 0000000000..bec9b9b218 --- /dev/null +++ b/jhipster/jhipster-uaa/quotes/src/main/java/com/baeldung/jhipster/quotes/service/QuoteQueryService.java @@ -0,0 +1,104 @@ +package com.baeldung.jhipster.quotes.service; + +import java.util.List; + +import javax.persistence.criteria.JoinType; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.data.domain.Page; +import org.springframework.data.domain.Pageable; +import org.springframework.data.jpa.domain.Specification; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import io.github.jhipster.service.QueryService; + +import com.baeldung.jhipster.quotes.domain.Quote; +import com.baeldung.jhipster.quotes.domain.*; // for static metamodels +import com.baeldung.jhipster.quotes.repository.QuoteRepository; +import com.baeldung.jhipster.quotes.service.dto.QuoteCriteria; +import com.baeldung.jhipster.quotes.service.dto.QuoteDTO; +import com.baeldung.jhipster.quotes.service.mapper.QuoteMapper; + +/** + * Service for executing complex queries for Quote entities in the database. + * The main input is a {@link QuoteCriteria} which gets converted to {@link Specification}, + * in a way that all the filters must apply. + * It returns a {@link List} of {@link QuoteDTO} or a {@link Page} of {@link QuoteDTO} which fulfills the criteria. + */ +@Service +@Transactional(readOnly = true) +public class QuoteQueryService extends QueryService { + + private final Logger log = LoggerFactory.getLogger(QuoteQueryService.class); + + private final QuoteRepository quoteRepository; + + private final QuoteMapper quoteMapper; + + public QuoteQueryService(QuoteRepository quoteRepository, QuoteMapper quoteMapper) { + this.quoteRepository = quoteRepository; + this.quoteMapper = quoteMapper; + } + + /** + * Return a {@link List} of {@link QuoteDTO} which matches the criteria from the database + * @param criteria The object which holds all the filters, which the entities should match. + * @return the matching entities. + */ + @Transactional(readOnly = true) + public List findByCriteria(QuoteCriteria criteria) { + log.debug("find by criteria : {}", criteria); + final Specification specification = createSpecification(criteria); + return quoteMapper.toDto(quoteRepository.findAll(specification)); + } + + /** + * Return a {@link Page} of {@link QuoteDTO} which matches the criteria from the database + * @param criteria The object which holds all the filters, which the entities should match. + * @param page The page, which should be returned. + * @return the matching entities. + */ + @Transactional(readOnly = true) + public Page findByCriteria(QuoteCriteria criteria, Pageable page) { + log.debug("find by criteria : {}, page: {}", criteria, page); + final Specification specification = createSpecification(criteria); + return quoteRepository.findAll(specification, page) + .map(quoteMapper::toDto); + } + + /** + * Return the number of matching entities in the database + * @param criteria The object which holds all the filters, which the entities should match. + * @return the number of matching entities. + */ + @Transactional(readOnly = true) + public long countByCriteria(QuoteCriteria criteria) { + log.debug("count by criteria : {}", criteria); + final Specification specification = createSpecification(criteria); + return quoteRepository.count(specification); + } + + /** + * Function to convert QuoteCriteria to a {@link Specification} + */ + private Specification createSpecification(QuoteCriteria criteria) { + Specification specification = Specification.where(null); + if (criteria != null) { + if (criteria.getId() != null) { + specification = specification.and(buildSpecification(criteria.getId(), Quote_.id)); + } + if (criteria.getSymbol() != null) { + specification = specification.and(buildStringSpecification(criteria.getSymbol(), Quote_.symbol)); + } + if (criteria.getPrice() != null) { + specification = specification.and(buildRangeSpecification(criteria.getPrice(), Quote_.price)); + } + if (criteria.getLastTrade() != null) { + specification = specification.and(buildRangeSpecification(criteria.getLastTrade(), Quote_.lastTrade)); + } + } + return specification; + } +} diff --git a/jhipster/jhipster-uaa/quotes/src/main/java/com/baeldung/jhipster/quotes/service/QuoteService.java b/jhipster/jhipster-uaa/quotes/src/main/java/com/baeldung/jhipster/quotes/service/QuoteService.java new file mode 100644 index 0000000000..f99c3e25db --- /dev/null +++ b/jhipster/jhipster-uaa/quotes/src/main/java/com/baeldung/jhipster/quotes/service/QuoteService.java @@ -0,0 +1,46 @@ +package com.baeldung.jhipster.quotes.service; + +import com.baeldung.jhipster.quotes.service.dto.QuoteDTO; + +import org.springframework.data.domain.Page; +import org.springframework.data.domain.Pageable; + +import java.util.Optional; + +/** + * Service Interface for managing Quote. + */ +public interface QuoteService { + + /** + * Save a quote. + * + * @param quoteDTO the entity to save + * @return the persisted entity + */ + QuoteDTO save(QuoteDTO quoteDTO); + + /** + * Get all the quotes. + * + * @param pageable the pagination information + * @return the list of entities + */ + Page findAll(Pageable pageable); + + + /** + * Get the "id" quote. + * + * @param id the id of the entity + * @return the entity + */ + Optional findOne(Long id); + + /** + * Delete the "id" quote. + * + * @param id the id of the entity + */ + void delete(Long id); +} diff --git a/jhipster/jhipster-uaa/quotes/src/main/java/com/baeldung/jhipster/quotes/service/dto/QuoteCriteria.java b/jhipster/jhipster-uaa/quotes/src/main/java/com/baeldung/jhipster/quotes/service/dto/QuoteCriteria.java new file mode 100644 index 0000000000..0400c1e5d4 --- /dev/null +++ b/jhipster/jhipster-uaa/quotes/src/main/java/com/baeldung/jhipster/quotes/service/dto/QuoteCriteria.java @@ -0,0 +1,107 @@ +package com.baeldung.jhipster.quotes.service.dto; + +import java.io.Serializable; +import java.util.Objects; +import io.github.jhipster.service.filter.BooleanFilter; +import io.github.jhipster.service.filter.DoubleFilter; +import io.github.jhipster.service.filter.Filter; +import io.github.jhipster.service.filter.FloatFilter; +import io.github.jhipster.service.filter.IntegerFilter; +import io.github.jhipster.service.filter.LongFilter; +import io.github.jhipster.service.filter.StringFilter; +import io.github.jhipster.service.filter.BigDecimalFilter; +import io.github.jhipster.service.filter.ZonedDateTimeFilter; + +/** + * Criteria class for the Quote entity. This class is used in QuoteResource to + * receive all the possible filtering options from the Http GET request parameters. + * For example the following could be a valid requests: + * /quotes?id.greaterThan=5&attr1.contains=something&attr2.specified=false + * As Spring is unable to properly convert the types, unless specific {@link Filter} class are used, we need to use + * fix type specific filters. + */ +public class QuoteCriteria implements Serializable { + + private static final long serialVersionUID = 1L; + + private LongFilter id; + + private StringFilter symbol; + + private BigDecimalFilter price; + + private ZonedDateTimeFilter lastTrade; + + public QuoteCriteria() { + } + + public LongFilter getId() { + return id; + } + + public void setId(LongFilter id) { + this.id = id; + } + + public StringFilter getSymbol() { + return symbol; + } + + public void setSymbol(StringFilter symbol) { + this.symbol = symbol; + } + + public BigDecimalFilter getPrice() { + return price; + } + + public void setPrice(BigDecimalFilter price) { + this.price = price; + } + + public ZonedDateTimeFilter getLastTrade() { + return lastTrade; + } + + public void setLastTrade(ZonedDateTimeFilter lastTrade) { + this.lastTrade = lastTrade; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + final QuoteCriteria that = (QuoteCriteria) o; + return + Objects.equals(id, that.id) && + Objects.equals(symbol, that.symbol) && + Objects.equals(price, that.price) && + Objects.equals(lastTrade, that.lastTrade); + } + + @Override + public int hashCode() { + return Objects.hash( + id, + symbol, + price, + lastTrade + ); + } + + @Override + public String toString() { + return "QuoteCriteria{" + + (id != null ? "id=" + id + ", " : "") + + (symbol != null ? "symbol=" + symbol + ", " : "") + + (price != null ? "price=" + price + ", " : "") + + (lastTrade != null ? "lastTrade=" + lastTrade + ", " : "") + + "}"; + } + +} diff --git a/jhipster/jhipster-uaa/quotes/src/main/java/com/baeldung/jhipster/quotes/service/dto/QuoteDTO.java b/jhipster/jhipster-uaa/quotes/src/main/java/com/baeldung/jhipster/quotes/service/dto/QuoteDTO.java new file mode 100644 index 0000000000..44042afe07 --- /dev/null +++ b/jhipster/jhipster-uaa/quotes/src/main/java/com/baeldung/jhipster/quotes/service/dto/QuoteDTO.java @@ -0,0 +1,87 @@ +package com.baeldung.jhipster.quotes.service.dto; + +import java.time.ZonedDateTime; +import javax.validation.constraints.*; +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Objects; + +/** + * A DTO for the Quote entity. + */ +public class QuoteDTO implements Serializable { + + private Long id; + + @NotNull + private String symbol; + + @NotNull + private BigDecimal price; + + @NotNull + private ZonedDateTime lastTrade; + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getSymbol() { + return symbol; + } + + public void setSymbol(String symbol) { + this.symbol = symbol; + } + + public BigDecimal getPrice() { + return price; + } + + public void setPrice(BigDecimal price) { + this.price = price; + } + + public ZonedDateTime getLastTrade() { + return lastTrade; + } + + public void setLastTrade(ZonedDateTime lastTrade) { + this.lastTrade = lastTrade; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + + QuoteDTO quoteDTO = (QuoteDTO) o; + if (quoteDTO.getId() == null || getId() == null) { + return false; + } + return Objects.equals(getId(), quoteDTO.getId()); + } + + @Override + public int hashCode() { + return Objects.hashCode(getId()); + } + + @Override + public String toString() { + return "QuoteDTO{" + + "id=" + getId() + + ", symbol='" + getSymbol() + "'" + + ", price=" + getPrice() + + ", lastTrade='" + getLastTrade() + "'" + + "}"; + } +} diff --git a/jhipster/jhipster-uaa/quotes/src/main/java/com/baeldung/jhipster/quotes/service/impl/QuoteServiceImpl.java b/jhipster/jhipster-uaa/quotes/src/main/java/com/baeldung/jhipster/quotes/service/impl/QuoteServiceImpl.java new file mode 100644 index 0000000000..91a868d0db --- /dev/null +++ b/jhipster/jhipster-uaa/quotes/src/main/java/com/baeldung/jhipster/quotes/service/impl/QuoteServiceImpl.java @@ -0,0 +1,90 @@ +package com.baeldung.jhipster.quotes.service.impl; + +import com.baeldung.jhipster.quotes.service.QuoteService; +import com.baeldung.jhipster.quotes.domain.Quote; +import com.baeldung.jhipster.quotes.repository.QuoteRepository; +import com.baeldung.jhipster.quotes.service.dto.QuoteDTO; +import com.baeldung.jhipster.quotes.service.mapper.QuoteMapper; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import org.springframework.data.domain.Page; +import org.springframework.data.domain.Pageable; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.Optional; + +/** + * Service Implementation for managing Quote. + */ +@Service +@Transactional +public class QuoteServiceImpl implements QuoteService { + + private final Logger log = LoggerFactory.getLogger(QuoteServiceImpl.class); + + private final QuoteRepository quoteRepository; + + private final QuoteMapper quoteMapper; + + public QuoteServiceImpl(QuoteRepository quoteRepository, QuoteMapper quoteMapper) { + this.quoteRepository = quoteRepository; + this.quoteMapper = quoteMapper; + } + + /** + * Save a quote. + * + * @param quoteDTO the entity to save + * @return the persisted entity + */ + @Override + public QuoteDTO save(QuoteDTO quoteDTO) { + log.debug("Request to save Quote : {}", quoteDTO); + + Quote quote = quoteMapper.toEntity(quoteDTO); + quote = quoteRepository.save(quote); + return quoteMapper.toDto(quote); + } + + /** + * Get all the quotes. + * + * @param pageable the pagination information + * @return the list of entities + */ + @Override + @Transactional(readOnly = true) + public Page findAll(Pageable pageable) { + log.debug("Request to get all Quotes"); + return quoteRepository.findAll(pageable) + .map(quoteMapper::toDto); + } + + + /** + * Get one quote by id. + * + * @param id the id of the entity + * @return the entity + */ + @Override + @Transactional(readOnly = true) + public Optional findOne(Long id) { + log.debug("Request to get Quote : {}", id); + return quoteRepository.findById(id) + .map(quoteMapper::toDto); + } + + /** + * Delete the quote by id. + * + * @param id the id of the entity + */ + @Override + public void delete(Long id) { + log.debug("Request to delete Quote : {}", id); + quoteRepository.deleteById(id); + } +} diff --git a/jhipster/jhipster-uaa/quotes/src/main/java/com/baeldung/jhipster/quotes/service/mapper/EntityMapper.java b/jhipster/jhipster-uaa/quotes/src/main/java/com/baeldung/jhipster/quotes/service/mapper/EntityMapper.java new file mode 100644 index 0000000000..219254a776 --- /dev/null +++ b/jhipster/jhipster-uaa/quotes/src/main/java/com/baeldung/jhipster/quotes/service/mapper/EntityMapper.java @@ -0,0 +1,21 @@ +package com.baeldung.jhipster.quotes.service.mapper; + +import java.util.List; + +/** + * Contract for a generic dto to entity mapper. + * + * @param - DTO type parameter. + * @param - Entity type parameter. + */ + +public interface EntityMapper { + + E toEntity(D dto); + + D toDto(E entity); + + List toEntity(List dtoList); + + List toDto(List entityList); +} diff --git a/jhipster/jhipster-uaa/quotes/src/main/java/com/baeldung/jhipster/quotes/service/mapper/QuoteMapper.java b/jhipster/jhipster-uaa/quotes/src/main/java/com/baeldung/jhipster/quotes/service/mapper/QuoteMapper.java new file mode 100644 index 0000000000..b8bb71d870 --- /dev/null +++ b/jhipster/jhipster-uaa/quotes/src/main/java/com/baeldung/jhipster/quotes/service/mapper/QuoteMapper.java @@ -0,0 +1,24 @@ +package com.baeldung.jhipster.quotes.service.mapper; + +import com.baeldung.jhipster.quotes.domain.*; +import com.baeldung.jhipster.quotes.service.dto.QuoteDTO; + +import org.mapstruct.*; + +/** + * Mapper for the entity Quote and its DTO QuoteDTO. + */ +@Mapper(componentModel = "spring", uses = {}) +public interface QuoteMapper extends EntityMapper { + + + + default Quote fromId(Long id) { + if (id == null) { + return null; + } + Quote quote = new Quote(); + quote.setId(id); + return quote; + } +} diff --git a/jhipster/jhipster-uaa/quotes/src/main/java/com/baeldung/jhipster/quotes/service/package-info.java b/jhipster/jhipster-uaa/quotes/src/main/java/com/baeldung/jhipster/quotes/service/package-info.java new file mode 100644 index 0000000000..082757bde9 --- /dev/null +++ b/jhipster/jhipster-uaa/quotes/src/main/java/com/baeldung/jhipster/quotes/service/package-info.java @@ -0,0 +1,4 @@ +/** + * Service layer beans. + */ +package com.baeldung.jhipster.quotes.service; diff --git a/jhipster/jhipster-uaa/quotes/src/main/java/com/baeldung/jhipster/quotes/web/rest/LogsResource.java b/jhipster/jhipster-uaa/quotes/src/main/java/com/baeldung/jhipster/quotes/web/rest/LogsResource.java new file mode 100644 index 0000000000..633bc9edf9 --- /dev/null +++ b/jhipster/jhipster-uaa/quotes/src/main/java/com/baeldung/jhipster/quotes/web/rest/LogsResource.java @@ -0,0 +1,39 @@ +package com.baeldung.jhipster.quotes.web.rest; + +import com.baeldung.jhipster.quotes.web.rest.vm.LoggerVM; + +import ch.qos.logback.classic.Level; +import ch.qos.logback.classic.LoggerContext; +import com.codahale.metrics.annotation.Timed; +import org.slf4j.LoggerFactory; +import org.springframework.http.HttpStatus; +import org.springframework.web.bind.annotation.*; + +import java.util.List; +import java.util.stream.Collectors; + +/** + * Controller for view and managing Log Level at runtime. + */ +@RestController +@RequestMapping("/management") +public class LogsResource { + + @GetMapping("/logs") + @Timed + public List getList() { + LoggerContext context = (LoggerContext) LoggerFactory.getILoggerFactory(); + return context.getLoggerList() + .stream() + .map(LoggerVM::new) + .collect(Collectors.toList()); + } + + @PutMapping("/logs") + @ResponseStatus(HttpStatus.NO_CONTENT) + @Timed + public void changeLevel(@RequestBody LoggerVM jsonLogger) { + LoggerContext context = (LoggerContext) LoggerFactory.getILoggerFactory(); + context.getLogger(jsonLogger.getName()).setLevel(Level.valueOf(jsonLogger.getLevel())); + } +} diff --git a/jhipster/jhipster-uaa/quotes/src/main/java/com/baeldung/jhipster/quotes/web/rest/QuoteResource.java b/jhipster/jhipster-uaa/quotes/src/main/java/com/baeldung/jhipster/quotes/web/rest/QuoteResource.java new file mode 100644 index 0000000000..0fdcf518ae --- /dev/null +++ b/jhipster/jhipster-uaa/quotes/src/main/java/com/baeldung/jhipster/quotes/web/rest/QuoteResource.java @@ -0,0 +1,146 @@ +package com.baeldung.jhipster.quotes.web.rest; + +import com.codahale.metrics.annotation.Timed; +import com.baeldung.jhipster.quotes.service.QuoteService; +import com.baeldung.jhipster.quotes.web.rest.errors.BadRequestAlertException; +import com.baeldung.jhipster.quotes.web.rest.util.HeaderUtil; +import com.baeldung.jhipster.quotes.web.rest.util.PaginationUtil; +import com.baeldung.jhipster.quotes.service.dto.QuoteDTO; +import com.baeldung.jhipster.quotes.service.dto.QuoteCriteria; +import com.baeldung.jhipster.quotes.service.QuoteQueryService; +import io.github.jhipster.web.util.ResponseUtil; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.data.domain.Page; +import org.springframework.data.domain.Pageable; +import org.springframework.http.HttpHeaders; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.*; + +import javax.validation.Valid; +import java.net.URI; +import java.net.URISyntaxException; + +import java.util.List; +import java.util.Optional; + +/** + * REST controller for managing Quote. + */ +@RestController +@RequestMapping("/api") +public class QuoteResource { + + private final Logger log = LoggerFactory.getLogger(QuoteResource.class); + + private static final String ENTITY_NAME = "quotesQuote"; + + private final QuoteService quoteService; + + private final QuoteQueryService quoteQueryService; + + public QuoteResource(QuoteService quoteService, QuoteQueryService quoteQueryService) { + this.quoteService = quoteService; + this.quoteQueryService = quoteQueryService; + } + + /** + * POST /quotes : Create a new quote. + * + * @param quoteDTO the quoteDTO to create + * @return the ResponseEntity with status 201 (Created) and with body the new quoteDTO, or with status 400 (Bad Request) if the quote has already an ID + * @throws URISyntaxException if the Location URI syntax is incorrect + */ + @PostMapping("/quotes") + @Timed + public ResponseEntity createQuote(@Valid @RequestBody QuoteDTO quoteDTO) throws URISyntaxException { + log.debug("REST request to save Quote : {}", quoteDTO); + if (quoteDTO.getId() != null) { + throw new BadRequestAlertException("A new quote cannot already have an ID", ENTITY_NAME, "idexists"); + } + QuoteDTO result = quoteService.save(quoteDTO); + return ResponseEntity.created(new URI("/api/quotes/" + result.getId())) + .headers(HeaderUtil.createEntityCreationAlert(ENTITY_NAME, result.getId().toString())) + .body(result); + } + + /** + * PUT /quotes : Updates an existing quote. + * + * @param quoteDTO the quoteDTO to update + * @return the ResponseEntity with status 200 (OK) and with body the updated quoteDTO, + * or with status 400 (Bad Request) if the quoteDTO is not valid, + * or with status 500 (Internal Server Error) if the quoteDTO couldn't be updated + * @throws URISyntaxException if the Location URI syntax is incorrect + */ + @PutMapping("/quotes") + @Timed + public ResponseEntity updateQuote(@Valid @RequestBody QuoteDTO quoteDTO) throws URISyntaxException { + log.debug("REST request to update Quote : {}", quoteDTO); + if (quoteDTO.getId() == null) { + throw new BadRequestAlertException("Invalid id", ENTITY_NAME, "idnull"); + } + QuoteDTO result = quoteService.save(quoteDTO); + return ResponseEntity.ok() + .headers(HeaderUtil.createEntityUpdateAlert(ENTITY_NAME, quoteDTO.getId().toString())) + .body(result); + } + + /** + * GET /quotes : get all the quotes. + * + * @param pageable the pagination information + * @param criteria the criterias which the requested entities should match + * @return the ResponseEntity with status 200 (OK) and the list of quotes in body + */ + @GetMapping("/quotes") + @Timed + public ResponseEntity> getAllQuotes(QuoteCriteria criteria, Pageable pageable) { + log.debug("REST request to get Quotes by criteria: {}", criteria); + Page page = quoteQueryService.findByCriteria(criteria, pageable); + HttpHeaders headers = PaginationUtil.generatePaginationHttpHeaders(page, "/api/quotes"); + return new ResponseEntity<>(page.getContent(), headers, HttpStatus.OK); + } + + /** + * GET /quotes/count : count all the quotes. + * + * @param criteria the criterias which the requested entities should match + * @return the ResponseEntity with status 200 (OK) and the count in body + */ + @GetMapping("/quotes/count") + @Timed + public ResponseEntity countQuotes (QuoteCriteria criteria) { + log.debug("REST request to count Quotes by criteria: {}", criteria); + return ResponseEntity.ok().body(quoteQueryService.countByCriteria(criteria)); + } + + /** + * GET /quotes/:id : get the "id" quote. + * + * @param id the id of the quoteDTO to retrieve + * @return the ResponseEntity with status 200 (OK) and with body the quoteDTO, or with status 404 (Not Found) + */ + @GetMapping("/quotes/{id}") + @Timed + public ResponseEntity getQuote(@PathVariable Long id) { + log.debug("REST request to get Quote : {}", id); + Optional quoteDTO = quoteService.findOne(id); + return ResponseUtil.wrapOrNotFound(quoteDTO); + } + + /** + * DELETE /quotes/:id : delete the "id" quote. + * + * @param id the id of the quoteDTO to delete + * @return the ResponseEntity with status 200 (OK) + */ + @DeleteMapping("/quotes/{id}") + @Timed + public ResponseEntity deleteQuote(@PathVariable Long id) { + log.debug("REST request to delete Quote : {}", id); + quoteService.delete(id); + return ResponseEntity.ok().headers(HeaderUtil.createEntityDeletionAlert(ENTITY_NAME, id.toString())).build(); + } +} diff --git a/jhipster/jhipster-uaa/quotes/src/main/java/com/baeldung/jhipster/quotes/web/rest/errors/BadRequestAlertException.java b/jhipster/jhipster-uaa/quotes/src/main/java/com/baeldung/jhipster/quotes/web/rest/errors/BadRequestAlertException.java new file mode 100644 index 0000000000..9a8574bddc --- /dev/null +++ b/jhipster/jhipster-uaa/quotes/src/main/java/com/baeldung/jhipster/quotes/web/rest/errors/BadRequestAlertException.java @@ -0,0 +1,42 @@ +package com.baeldung.jhipster.quotes.web.rest.errors; + +import org.zalando.problem.AbstractThrowableProblem; +import org.zalando.problem.Status; + +import java.net.URI; +import java.util.HashMap; +import java.util.Map; + +public class BadRequestAlertException extends AbstractThrowableProblem { + + private static final long serialVersionUID = 1L; + + private final String entityName; + + private final String errorKey; + + public BadRequestAlertException(String defaultMessage, String entityName, String errorKey) { + this(ErrorConstants.DEFAULT_TYPE, defaultMessage, entityName, errorKey); + } + + public BadRequestAlertException(URI type, String defaultMessage, String entityName, String errorKey) { + super(type, defaultMessage, Status.BAD_REQUEST, null, null, null, getAlertParameters(entityName, errorKey)); + this.entityName = entityName; + this.errorKey = errorKey; + } + + public String getEntityName() { + return entityName; + } + + public String getErrorKey() { + return errorKey; + } + + private static Map getAlertParameters(String entityName, String errorKey) { + Map parameters = new HashMap<>(); + parameters.put("message", "error." + errorKey); + parameters.put("params", entityName); + return parameters; + } +} diff --git a/jhipster/jhipster-uaa/quotes/src/main/java/com/baeldung/jhipster/quotes/web/rest/errors/CustomParameterizedException.java b/jhipster/jhipster-uaa/quotes/src/main/java/com/baeldung/jhipster/quotes/web/rest/errors/CustomParameterizedException.java new file mode 100644 index 0000000000..47b7d16247 --- /dev/null +++ b/jhipster/jhipster-uaa/quotes/src/main/java/com/baeldung/jhipster/quotes/web/rest/errors/CustomParameterizedException.java @@ -0,0 +1,54 @@ +package com.baeldung.jhipster.quotes.web.rest.errors; + +import org.zalando.problem.AbstractThrowableProblem; + +import java.util.HashMap; +import java.util.Map; + +import static org.zalando.problem.Status.BAD_REQUEST; + +/** + * Custom, parameterized exception, which can be translated on the client side. + * For example: + * + *

+ * throw new CustomParameterizedException("myCustomError", "hello", "world");
+ * 
+ * + * Can be translated with: + * + *
+ * "error.myCustomError" :  "The server says {{param0}} to {{param1}}"
+ * 
+ */ +public class CustomParameterizedException extends AbstractThrowableProblem { + + private static final long serialVersionUID = 1L; + + private static final String PARAM = "param"; + + public CustomParameterizedException(String message, String... params) { + this(message, toParamMap(params)); + } + + public CustomParameterizedException(String message, Map paramMap) { + super(ErrorConstants.PARAMETERIZED_TYPE, "Parameterized Exception", BAD_REQUEST, null, null, null, toProblemParameters(message, paramMap)); + } + + public static Map toParamMap(String... params) { + Map paramMap = new HashMap<>(); + if (params != null && params.length > 0) { + for (int i = 0; i < params.length; i++) { + paramMap.put(PARAM + i, params[i]); + } + } + return paramMap; + } + + public static Map toProblemParameters(String message, Map paramMap) { + Map parameters = new HashMap<>(); + parameters.put("message", message); + parameters.put("params", paramMap); + return parameters; + } +} diff --git a/jhipster/jhipster-uaa/quotes/src/main/java/com/baeldung/jhipster/quotes/web/rest/errors/EmailAlreadyUsedException.java b/jhipster/jhipster-uaa/quotes/src/main/java/com/baeldung/jhipster/quotes/web/rest/errors/EmailAlreadyUsedException.java new file mode 100644 index 0000000000..5d5a9103e3 --- /dev/null +++ b/jhipster/jhipster-uaa/quotes/src/main/java/com/baeldung/jhipster/quotes/web/rest/errors/EmailAlreadyUsedException.java @@ -0,0 +1,10 @@ +package com.baeldung.jhipster.quotes.web.rest.errors; + +public class EmailAlreadyUsedException extends BadRequestAlertException { + + private static final long serialVersionUID = 1L; + + public EmailAlreadyUsedException() { + super(ErrorConstants.EMAIL_ALREADY_USED_TYPE, "Email is already in use!", "userManagement", "emailexists"); + } +} diff --git a/jhipster/jhipster-uaa/quotes/src/main/java/com/baeldung/jhipster/quotes/web/rest/errors/EmailNotFoundException.java b/jhipster/jhipster-uaa/quotes/src/main/java/com/baeldung/jhipster/quotes/web/rest/errors/EmailNotFoundException.java new file mode 100644 index 0000000000..f92e7dd013 --- /dev/null +++ b/jhipster/jhipster-uaa/quotes/src/main/java/com/baeldung/jhipster/quotes/web/rest/errors/EmailNotFoundException.java @@ -0,0 +1,13 @@ +package com.baeldung.jhipster.quotes.web.rest.errors; + +import org.zalando.problem.AbstractThrowableProblem; +import org.zalando.problem.Status; + +public class EmailNotFoundException extends AbstractThrowableProblem { + + private static final long serialVersionUID = 1L; + + public EmailNotFoundException() { + super(ErrorConstants.EMAIL_NOT_FOUND_TYPE, "Email address not registered", Status.BAD_REQUEST); + } +} diff --git a/jhipster/jhipster-uaa/quotes/src/main/java/com/baeldung/jhipster/quotes/web/rest/errors/ErrorConstants.java b/jhipster/jhipster-uaa/quotes/src/main/java/com/baeldung/jhipster/quotes/web/rest/errors/ErrorConstants.java new file mode 100644 index 0000000000..c07bdbdb00 --- /dev/null +++ b/jhipster/jhipster-uaa/quotes/src/main/java/com/baeldung/jhipster/quotes/web/rest/errors/ErrorConstants.java @@ -0,0 +1,21 @@ +package com.baeldung.jhipster.quotes.web.rest.errors; + +import java.net.URI; + +public final class ErrorConstants { + + public static final String ERR_CONCURRENCY_FAILURE = "error.concurrencyFailure"; + public static final String ERR_VALIDATION = "error.validation"; + public static final String PROBLEM_BASE_URL = "https://www.jhipster.tech/problem"; + public static final URI DEFAULT_TYPE = URI.create(PROBLEM_BASE_URL + "/problem-with-message"); + public static final URI CONSTRAINT_VIOLATION_TYPE = URI.create(PROBLEM_BASE_URL + "/constraint-violation"); + public static final URI PARAMETERIZED_TYPE = URI.create(PROBLEM_BASE_URL + "/parameterized"); + public static final URI ENTITY_NOT_FOUND_TYPE = URI.create(PROBLEM_BASE_URL + "/entity-not-found"); + public static final URI INVALID_PASSWORD_TYPE = URI.create(PROBLEM_BASE_URL + "/invalid-password"); + public static final URI EMAIL_ALREADY_USED_TYPE = URI.create(PROBLEM_BASE_URL + "/email-already-used"); + public static final URI LOGIN_ALREADY_USED_TYPE = URI.create(PROBLEM_BASE_URL + "/login-already-used"); + public static final URI EMAIL_NOT_FOUND_TYPE = URI.create(PROBLEM_BASE_URL + "/email-not-found"); + + private ErrorConstants() { + } +} diff --git a/jhipster/jhipster-uaa/quotes/src/main/java/com/baeldung/jhipster/quotes/web/rest/errors/ExceptionTranslator.java b/jhipster/jhipster-uaa/quotes/src/main/java/com/baeldung/jhipster/quotes/web/rest/errors/ExceptionTranslator.java new file mode 100644 index 0000000000..18baa42736 --- /dev/null +++ b/jhipster/jhipster-uaa/quotes/src/main/java/com/baeldung/jhipster/quotes/web/rest/errors/ExceptionTranslator.java @@ -0,0 +1,107 @@ +package com.baeldung.jhipster.quotes.web.rest.errors; + +import com.baeldung.jhipster.quotes.web.rest.util.HeaderUtil; + +import org.springframework.dao.ConcurrencyFailureException; +import org.springframework.http.ResponseEntity; +import org.springframework.validation.BindingResult; +import org.springframework.web.bind.MethodArgumentNotValidException; +import org.springframework.web.bind.annotation.ControllerAdvice; +import org.springframework.web.bind.annotation.ExceptionHandler; +import org.springframework.web.context.request.NativeWebRequest; +import org.zalando.problem.DefaultProblem; +import org.zalando.problem.Problem; +import org.zalando.problem.ProblemBuilder; +import org.zalando.problem.Status; +import org.zalando.problem.spring.web.advice.ProblemHandling; +import org.zalando.problem.violations.ConstraintViolationProblem; + +import javax.annotation.Nonnull; +import javax.annotation.Nullable; +import javax.servlet.http.HttpServletRequest; +import java.util.List; +import java.util.NoSuchElementException; +import java.util.stream.Collectors; + +/** + * Controller advice to translate the server side exceptions to client-friendly json structures. + * The error response follows RFC7807 - Problem Details for HTTP APIs (https://tools.ietf.org/html/rfc7807) + */ +@ControllerAdvice +public class ExceptionTranslator implements ProblemHandling { + + /** + * Post-process the Problem payload to add the message key for the front-end if needed + */ + @Override + public ResponseEntity process(@Nullable ResponseEntity entity, NativeWebRequest request) { + if (entity == null) { + return entity; + } + Problem problem = entity.getBody(); + if (!(problem instanceof ConstraintViolationProblem || problem instanceof DefaultProblem)) { + return entity; + } + ProblemBuilder builder = Problem.builder() + .withType(Problem.DEFAULT_TYPE.equals(problem.getType()) ? ErrorConstants.DEFAULT_TYPE : problem.getType()) + .withStatus(problem.getStatus()) + .withTitle(problem.getTitle()) + .with("path", request.getNativeRequest(HttpServletRequest.class).getRequestURI()); + + if (problem instanceof ConstraintViolationProblem) { + builder + .with("violations", ((ConstraintViolationProblem) problem).getViolations()) + .with("message", ErrorConstants.ERR_VALIDATION); + } else { + builder + .withCause(((DefaultProblem) problem).getCause()) + .withDetail(problem.getDetail()) + .withInstance(problem.getInstance()); + problem.getParameters().forEach(builder::with); + if (!problem.getParameters().containsKey("message") && problem.getStatus() != null) { + builder.with("message", "error.http." + problem.getStatus().getStatusCode()); + } + } + return new ResponseEntity<>(builder.build(), entity.getHeaders(), entity.getStatusCode()); + } + + @Override + public ResponseEntity handleMethodArgumentNotValid(MethodArgumentNotValidException ex, @Nonnull NativeWebRequest request) { + BindingResult result = ex.getBindingResult(); + List fieldErrors = result.getFieldErrors().stream() + .map(f -> new FieldErrorVM(f.getObjectName(), f.getField(), f.getCode())) + .collect(Collectors.toList()); + + Problem problem = Problem.builder() + .withType(ErrorConstants.CONSTRAINT_VIOLATION_TYPE) + .withTitle("Method argument not valid") + .withStatus(defaultConstraintViolationStatus()) + .with("message", ErrorConstants.ERR_VALIDATION) + .with("fieldErrors", fieldErrors) + .build(); + return create(ex, problem, request); + } + + @ExceptionHandler + public ResponseEntity handleNoSuchElementException(NoSuchElementException ex, NativeWebRequest request) { + Problem problem = Problem.builder() + .withStatus(Status.NOT_FOUND) + .with("message", ErrorConstants.ENTITY_NOT_FOUND_TYPE) + .build(); + return create(ex, problem, request); + } + + @ExceptionHandler + public ResponseEntity handleBadRequestAlertException(BadRequestAlertException ex, NativeWebRequest request) { + return create(ex, request, HeaderUtil.createFailureAlert(ex.getEntityName(), ex.getErrorKey(), ex.getMessage())); + } + + @ExceptionHandler + public ResponseEntity handleConcurrencyFailure(ConcurrencyFailureException ex, NativeWebRequest request) { + Problem problem = Problem.builder() + .withStatus(Status.CONFLICT) + .with("message", ErrorConstants.ERR_CONCURRENCY_FAILURE) + .build(); + return create(ex, problem, request); + } +} diff --git a/jhipster/jhipster-uaa/quotes/src/main/java/com/baeldung/jhipster/quotes/web/rest/errors/FieldErrorVM.java b/jhipster/jhipster-uaa/quotes/src/main/java/com/baeldung/jhipster/quotes/web/rest/errors/FieldErrorVM.java new file mode 100644 index 0000000000..4e14b33d09 --- /dev/null +++ b/jhipster/jhipster-uaa/quotes/src/main/java/com/baeldung/jhipster/quotes/web/rest/errors/FieldErrorVM.java @@ -0,0 +1,33 @@ +package com.baeldung.jhipster.quotes.web.rest.errors; + +import java.io.Serializable; + +public class FieldErrorVM implements Serializable { + + private static final long serialVersionUID = 1L; + + private final String objectName; + + private final String field; + + private final String message; + + public FieldErrorVM(String dto, String field, String message) { + this.objectName = dto; + this.field = field; + this.message = message; + } + + public String getObjectName() { + return objectName; + } + + public String getField() { + return field; + } + + public String getMessage() { + return message; + } + +} diff --git a/jhipster/jhipster-uaa/quotes/src/main/java/com/baeldung/jhipster/quotes/web/rest/errors/InternalServerErrorException.java b/jhipster/jhipster-uaa/quotes/src/main/java/com/baeldung/jhipster/quotes/web/rest/errors/InternalServerErrorException.java new file mode 100644 index 0000000000..4744eee829 --- /dev/null +++ b/jhipster/jhipster-uaa/quotes/src/main/java/com/baeldung/jhipster/quotes/web/rest/errors/InternalServerErrorException.java @@ -0,0 +1,16 @@ +package com.baeldung.jhipster.quotes.web.rest.errors; + +import org.zalando.problem.AbstractThrowableProblem; +import org.zalando.problem.Status; + +/** + * Simple exception with a message, that returns an Internal Server Error code. + */ +public class InternalServerErrorException extends AbstractThrowableProblem { + + private static final long serialVersionUID = 1L; + + public InternalServerErrorException(String message) { + super(ErrorConstants.DEFAULT_TYPE, message, Status.INTERNAL_SERVER_ERROR); + } +} diff --git a/jhipster/jhipster-uaa/quotes/src/main/java/com/baeldung/jhipster/quotes/web/rest/errors/InvalidPasswordException.java b/jhipster/jhipster-uaa/quotes/src/main/java/com/baeldung/jhipster/quotes/web/rest/errors/InvalidPasswordException.java new file mode 100644 index 0000000000..fa258a1430 --- /dev/null +++ b/jhipster/jhipster-uaa/quotes/src/main/java/com/baeldung/jhipster/quotes/web/rest/errors/InvalidPasswordException.java @@ -0,0 +1,13 @@ +package com.baeldung.jhipster.quotes.web.rest.errors; + +import org.zalando.problem.AbstractThrowableProblem; +import org.zalando.problem.Status; + +public class InvalidPasswordException extends AbstractThrowableProblem { + + private static final long serialVersionUID = 1L; + + public InvalidPasswordException() { + super(ErrorConstants.INVALID_PASSWORD_TYPE, "Incorrect password", Status.BAD_REQUEST); + } +} diff --git a/jhipster/jhipster-uaa/quotes/src/main/java/com/baeldung/jhipster/quotes/web/rest/errors/LoginAlreadyUsedException.java b/jhipster/jhipster-uaa/quotes/src/main/java/com/baeldung/jhipster/quotes/web/rest/errors/LoginAlreadyUsedException.java new file mode 100644 index 0000000000..d52fcd4477 --- /dev/null +++ b/jhipster/jhipster-uaa/quotes/src/main/java/com/baeldung/jhipster/quotes/web/rest/errors/LoginAlreadyUsedException.java @@ -0,0 +1,10 @@ +package com.baeldung.jhipster.quotes.web.rest.errors; + +public class LoginAlreadyUsedException extends BadRequestAlertException { + + private static final long serialVersionUID = 1L; + + public LoginAlreadyUsedException() { + super(ErrorConstants.LOGIN_ALREADY_USED_TYPE, "Login name already used!", "userManagement", "userexists"); + } +} diff --git a/jhipster/jhipster-uaa/quotes/src/main/java/com/baeldung/jhipster/quotes/web/rest/errors/package-info.java b/jhipster/jhipster-uaa/quotes/src/main/java/com/baeldung/jhipster/quotes/web/rest/errors/package-info.java new file mode 100644 index 0000000000..bb1e69db80 --- /dev/null +++ b/jhipster/jhipster-uaa/quotes/src/main/java/com/baeldung/jhipster/quotes/web/rest/errors/package-info.java @@ -0,0 +1,6 @@ +/** + * Specific errors used with Zalando's "problem-spring-web" library. + * + * More information on https://github.com/zalando/problem-spring-web + */ +package com.baeldung.jhipster.quotes.web.rest.errors; diff --git a/jhipster/jhipster-uaa/quotes/src/main/java/com/baeldung/jhipster/quotes/web/rest/package-info.java b/jhipster/jhipster-uaa/quotes/src/main/java/com/baeldung/jhipster/quotes/web/rest/package-info.java new file mode 100644 index 0000000000..a7f972195b --- /dev/null +++ b/jhipster/jhipster-uaa/quotes/src/main/java/com/baeldung/jhipster/quotes/web/rest/package-info.java @@ -0,0 +1,4 @@ +/** + * Spring MVC REST controllers. + */ +package com.baeldung.jhipster.quotes.web.rest; diff --git a/jhipster/jhipster-uaa/quotes/src/main/java/com/baeldung/jhipster/quotes/web/rest/util/HeaderUtil.java b/jhipster/jhipster-uaa/quotes/src/main/java/com/baeldung/jhipster/quotes/web/rest/util/HeaderUtil.java new file mode 100644 index 0000000000..ef7baf0687 --- /dev/null +++ b/jhipster/jhipster-uaa/quotes/src/main/java/com/baeldung/jhipster/quotes/web/rest/util/HeaderUtil.java @@ -0,0 +1,45 @@ +package com.baeldung.jhipster.quotes.web.rest.util; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.http.HttpHeaders; + +/** + * Utility class for HTTP headers creation. + */ +public final class HeaderUtil { + + private static final Logger log = LoggerFactory.getLogger(HeaderUtil.class); + + private static final String APPLICATION_NAME = "quotesApp"; + + private HeaderUtil() { + } + + public static HttpHeaders createAlert(String message, String param) { + HttpHeaders headers = new HttpHeaders(); + headers.add("X-" + APPLICATION_NAME + "-alert", message); + headers.add("X-" + APPLICATION_NAME + "-params", param); + return headers; + } + + public static HttpHeaders createEntityCreationAlert(String entityName, String param) { + return createAlert(APPLICATION_NAME + "." + entityName + ".created", param); + } + + public static HttpHeaders createEntityUpdateAlert(String entityName, String param) { + return createAlert(APPLICATION_NAME + "." + entityName + ".updated", param); + } + + public static HttpHeaders createEntityDeletionAlert(String entityName, String param) { + return createAlert(APPLICATION_NAME + "." + entityName + ".deleted", param); + } + + public static HttpHeaders createFailureAlert(String entityName, String errorKey, String defaultMessage) { + log.error("Entity processing failed, {}", defaultMessage); + HttpHeaders headers = new HttpHeaders(); + headers.add("X-" + APPLICATION_NAME + "-error", "error." + errorKey); + headers.add("X-" + APPLICATION_NAME + "-params", entityName); + return headers; + } +} diff --git a/jhipster/jhipster-uaa/quotes/src/main/java/com/baeldung/jhipster/quotes/web/rest/util/PaginationUtil.java b/jhipster/jhipster-uaa/quotes/src/main/java/com/baeldung/jhipster/quotes/web/rest/util/PaginationUtil.java new file mode 100644 index 0000000000..fb74b16ab8 --- /dev/null +++ b/jhipster/jhipster-uaa/quotes/src/main/java/com/baeldung/jhipster/quotes/web/rest/util/PaginationUtil.java @@ -0,0 +1,45 @@ +package com.baeldung.jhipster.quotes.web.rest.util; + +import org.springframework.data.domain.Page; +import org.springframework.http.HttpHeaders; +import org.springframework.web.util.UriComponentsBuilder; + +/** + * Utility class for handling pagination. + * + *

+ * Pagination uses the same principles as the GitHub API, + * and follow RFC 5988 (Link header). + */ +public final class PaginationUtil { + + private PaginationUtil() { + } + + public static HttpHeaders generatePaginationHttpHeaders(Page page, String baseUrl) { + + HttpHeaders headers = new HttpHeaders(); + headers.add("X-Total-Count", Long.toString(page.getTotalElements())); + String link = ""; + if ((page.getNumber() + 1) < page.getTotalPages()) { + link = "<" + generateUri(baseUrl, page.getNumber() + 1, page.getSize()) + ">; rel=\"next\","; + } + // prev link + if ((page.getNumber()) > 0) { + link += "<" + generateUri(baseUrl, page.getNumber() - 1, page.getSize()) + ">; rel=\"prev\","; + } + // last and first link + int lastPage = 0; + if (page.getTotalPages() > 0) { + lastPage = page.getTotalPages() - 1; + } + link += "<" + generateUri(baseUrl, lastPage, page.getSize()) + ">; rel=\"last\","; + link += "<" + generateUri(baseUrl, 0, page.getSize()) + ">; rel=\"first\""; + headers.add(HttpHeaders.LINK, link); + return headers; + } + + private static String generateUri(String baseUrl, int page, int size) { + return UriComponentsBuilder.fromUriString(baseUrl).queryParam("page", page).queryParam("size", size).toUriString(); + } +} diff --git a/jhipster/jhipster-uaa/quotes/src/main/java/com/baeldung/jhipster/quotes/web/rest/vm/LoggerVM.java b/jhipster/jhipster-uaa/quotes/src/main/java/com/baeldung/jhipster/quotes/web/rest/vm/LoggerVM.java new file mode 100644 index 0000000000..6e6e8a7f99 --- /dev/null +++ b/jhipster/jhipster-uaa/quotes/src/main/java/com/baeldung/jhipster/quotes/web/rest/vm/LoggerVM.java @@ -0,0 +1,46 @@ +package com.baeldung.jhipster.quotes.web.rest.vm; + +import ch.qos.logback.classic.Logger; + +/** + * View Model object for storing a Logback logger. + */ +public class LoggerVM { + + private String name; + + private String level; + + public LoggerVM(Logger logger) { + this.name = logger.getName(); + this.level = logger.getEffectiveLevel().toString(); + } + + public LoggerVM() { + // Empty public constructor used by Jackson. + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getLevel() { + return level; + } + + public void setLevel(String level) { + this.level = level; + } + + @Override + public String toString() { + return "LoggerVM{" + + "name='" + name + '\'' + + ", level='" + level + '\'' + + '}'; + } +} diff --git a/jhipster/jhipster-uaa/quotes/src/main/java/com/baeldung/jhipster/quotes/web/rest/vm/package-info.java b/jhipster/jhipster-uaa/quotes/src/main/java/com/baeldung/jhipster/quotes/web/rest/vm/package-info.java new file mode 100644 index 0000000000..64bc8f241c --- /dev/null +++ b/jhipster/jhipster-uaa/quotes/src/main/java/com/baeldung/jhipster/quotes/web/rest/vm/package-info.java @@ -0,0 +1,4 @@ +/** + * View Models used by Spring MVC REST controllers. + */ +package com.baeldung.jhipster.quotes.web.rest.vm; diff --git a/jhipster/jhipster-uaa/quotes/src/main/jib/entrypoint.sh b/jhipster/jhipster-uaa/quotes/src/main/jib/entrypoint.sh new file mode 100644 index 0000000000..9a369e8cf8 --- /dev/null +++ b/jhipster/jhipster-uaa/quotes/src/main/jib/entrypoint.sh @@ -0,0 +1,4 @@ +#!/bin/sh + +echo "The application will start in ${JHIPSTER_SLEEP}s..." && sleep ${JHIPSTER_SLEEP} +exec java ${JAVA_OPTS} -Djava.security.egd=file:/dev/./urandom -cp /app/resources/:/app/classes/:/app/libs/* "com.baeldung.jhipster.quotes.QuotesApp" "$@" diff --git a/jhipster/jhipster-uaa/quotes/src/main/resources/.h2.server.properties b/jhipster/jhipster-uaa/quotes/src/main/resources/.h2.server.properties new file mode 100644 index 0000000000..c13694dfe9 --- /dev/null +++ b/jhipster/jhipster-uaa/quotes/src/main/resources/.h2.server.properties @@ -0,0 +1,5 @@ +#H2 Server Properties +0=JHipster H2 (Disk)|org.h2.Driver|jdbc\:h2\:file\:./target/h2db/db/quotes|quotes +webAllowOthers=true +webPort=8082 +webSSL=false diff --git a/jhipster/jhipster-uaa/quotes/src/main/resources/banner.txt b/jhipster/jhipster-uaa/quotes/src/main/resources/banner.txt new file mode 100644 index 0000000000..e0bc55aaff --- /dev/null +++ b/jhipster/jhipster-uaa/quotes/src/main/resources/banner.txt @@ -0,0 +1,10 @@ + + ${AnsiColor.GREEN} ██╗${AnsiColor.RED} ██╗ ██╗ ████████╗ ███████╗ ██████╗ ████████╗ ████████╗ ███████╗ + ${AnsiColor.GREEN} ██║${AnsiColor.RED} ██║ ██║ ╚══██╔══╝ ██╔═══██╗ ██╔════╝ ╚══██╔══╝ ██╔═════╝ ██╔═══██╗ + ${AnsiColor.GREEN} ██║${AnsiColor.RED} ████████║ ██║ ███████╔╝ ╚█████╗ ██║ ██████╗ ███████╔╝ + ${AnsiColor.GREEN}██╗ ██║${AnsiColor.RED} ██╔═══██║ ██║ ██╔════╝ ╚═══██╗ ██║ ██╔═══╝ ██╔══██║ + ${AnsiColor.GREEN}╚██████╔╝${AnsiColor.RED} ██║ ██║ ████████╗ ██║ ██████╔╝ ██║ ████████╗ ██║ ╚██╗ + ${AnsiColor.GREEN} ╚═════╝ ${AnsiColor.RED} ╚═╝ ╚═╝ ╚═══════╝ ╚═╝ ╚═════╝ ╚═╝ ╚═══════╝ ╚═╝ ╚═╝ + +${AnsiColor.BRIGHT_BLUE}:: JHipster 🤓 :: Running Spring Boot ${spring-boot.version} :: +:: https://www.jhipster.tech ::${AnsiColor.DEFAULT} diff --git a/jhipster/jhipster-uaa/quotes/src/main/resources/config/application-dev.yml b/jhipster/jhipster-uaa/quotes/src/main/resources/config/application-dev.yml new file mode 100644 index 0000000000..19a3192ef9 --- /dev/null +++ b/jhipster/jhipster-uaa/quotes/src/main/resources/config/application-dev.yml @@ -0,0 +1,159 @@ +# =================================================================== +# Spring Boot configuration for the "dev" profile. +# +# This configuration overrides the application.yml file. +# +# More information on profiles: https://www.jhipster.tech/profiles/ +# More information on configuration properties: https://www.jhipster.tech/common-application-properties/ +# =================================================================== + +# =================================================================== +# Standard Spring Boot properties. +# Full reference is available at: +# http://docs.spring.io/spring-boot/docs/current/reference/html/common-application-properties.html +# =================================================================== + +logging: + level: + ROOT: DEBUG + io.github.jhipster: DEBUG + com.baeldung.jhipster.quotes: DEBUG + +eureka: + instance: + prefer-ip-address: true + client: + service-url: + defaultZone: http://admin:${jhipster.registry.password}@localhost:8761/eureka/ + +spring: + profiles: + active: dev + include: + - swagger + # Uncomment to activate TLS for the dev profile + #- tls + devtools: + restart: + enabled: true + livereload: + enabled: false # we use Webpack dev server + BrowserSync for livereload + jackson: + serialization.indent_output: true + datasource: + type: com.zaxxer.hikari.HikariDataSource + url: jdbc:h2:file:./target/h2db/db/quotes;DB_CLOSE_DELAY=-1 + username: quotes + password: + hikari: + auto-commit: false + h2: + console: + enabled: false + jpa: + database-platform: io.github.jhipster.domain.util.FixedH2Dialect + database: H2 + show-sql: true + properties: + hibernate.id.new_generator_mappings: true + hibernate.connection.provider_disables_autocommit: true + hibernate.cache.use_second_level_cache: true + hibernate.cache.use_query_cache: false + hibernate.generate_statistics: true + hibernate.cache.region.factory_class: com.hazelcast.hibernate.HazelcastCacheRegionFactory + hibernate.cache.hazelcast.instance_name: quotes + hibernate.cache.use_minimal_puts: true + hibernate.cache.hazelcast.use_lite_member: true + liquibase: + contexts: dev + mail: + host: localhost + port: 25 + username: + password: + messages: + cache-duration: PT1S # 1 second, see the ISO 8601 standard + thymeleaf: + cache: false + sleuth: + sampler: + percentage: 1 # report 100% of traces + zipkin: # Use the "zipkin" Maven profile to have the Spring Cloud Zipkin dependencies + base-url: http://localhost:9411 + enabled: false + locator: + discovery: + enabled: true + +server: + port: 8081 + +# =================================================================== +# JHipster specific properties +# +# Full reference is available at: https://www.jhipster.tech/common-application-properties/ +# =================================================================== + +jhipster: + http: + version: V_1_1 # To use HTTP/2 you will need to activate TLS (see application-tls.yml) + cache: # Cache configuration + hazelcast: # Hazelcast distributed cache + time-to-live-seconds: 3600 + backup-count: 1 + management-center: # Full reference is available at: http://docs.hazelcast.org/docs/management-center/3.9/manual/html/Deploying_and_Starting.html + enabled: false + update-interval: 3 + url: http://localhost:8180/mancenter + # CORS is disabled by default on microservices, as you should access them through a gateway. + # If you want to enable it, please uncomment the configuration below. + # cors: + # allowed-origins: "*" + # allowed-methods: "*" + # allowed-headers: "*" + # exposed-headers: "Authorization,Link,X-Total-Count" + # allow-credentials: true + # max-age: 1800 + security: + client-authorization: + access-token-uri: http://uaa/oauth/token + token-service-id: uaa + client-id: internal + client-secret: internal + mail: # specific JHipster mail property, for standard properties see MailProperties + from: quotes@localhost + base-url: http://127.0.0.1:8081 + metrics: # DropWizard Metrics configuration, used by MetricsConfiguration + jmx: + enabled: true + logs: # Reports Dropwizard metrics in the logs + enabled: false + report-frequency: 60 # in seconds + logging: + logstash: # Forward logs to logstash over a socket, used by LoggingConfiguration + enabled: false + host: localhost + port: 5000 + queue-size: 512 +oauth2: + signature-verification: + public-key-endpoint-uri: http://uaa/oauth/token_key + #ttl for public keys to verify JWT tokens (in ms) + ttl: 3600000 + #max. rate at which public keys will be fetched (in ms) + public-key-refresh-rate-limit: 10000 + web-client-configuration: + #keep in sync with UAA configuration + client-id: web_app + secret: changeit + +# =================================================================== +# Application specific properties +# Add your own application properties here, see the ApplicationProperties class +# to have type-safe configuration, like in the JHipsterProperties above +# +# More documentation is available at: +# https://www.jhipster.tech/common-application-properties/ +# =================================================================== + +# application: diff --git a/jhipster/jhipster-uaa/quotes/src/main/resources/config/application-prod.yml b/jhipster/jhipster-uaa/quotes/src/main/resources/config/application-prod.yml new file mode 100644 index 0000000000..b9cd66ece3 --- /dev/null +++ b/jhipster/jhipster-uaa/quotes/src/main/resources/config/application-prod.yml @@ -0,0 +1,167 @@ +# =================================================================== +# Spring Boot configuration for the "prod" profile. +# +# This configuration overrides the application.yml file. +# +# More information on profiles: https://www.jhipster.tech/profiles/ +# More information on configuration properties: https://www.jhipster.tech/common-application-properties/ +# =================================================================== + +# =================================================================== +# Standard Spring Boot properties. +# Full reference is available at: +# http://docs.spring.io/spring-boot/docs/current/reference/html/common-application-properties.html +# =================================================================== + +logging: + level: + ROOT: INFO + com.baeldung.jhipster.quotes: INFO + io.github.jhipster: INFO + +eureka: + instance: + prefer-ip-address: true + client: + service-url: + defaultZone: http://admin:${jhipster.registry.password}@localhost:8761/eureka/ + +spring: + devtools: + restart: + enabled: false + livereload: + enabled: false + datasource: + type: com.zaxxer.hikari.HikariDataSource + url: jdbc:mysql://localhost:3306/quotes?useUnicode=true&characterEncoding=utf8&useSSL=false + username: root + password: + hikari: + auto-commit: false + data-source-properties: + cachePrepStmts: true + prepStmtCacheSize: 250 + prepStmtCacheSqlLimit: 2048 + useServerPrepStmts: true + jpa: + database-platform: org.hibernate.dialect.MySQL5InnoDBDialect + database: MYSQL + show-sql: false + properties: + hibernate.id.new_generator_mappings: true + hibernate.connection.provider_disables_autocommit: true + hibernate.cache.use_second_level_cache: true + hibernate.cache.use_query_cache: false + hibernate.generate_statistics: false + hibernate.cache.region.factory_class: com.hazelcast.hibernate.HazelcastCacheRegionFactory + hibernate.cache.hazelcast.instance_name: quotes + hibernate.cache.use_minimal_puts: true + hibernate.cache.hazelcast.use_lite_member: true + liquibase: + contexts: prod + mail: + host: localhost + port: 25 + username: + password: + thymeleaf: + cache: true + sleuth: + sampler: + percentage: 1 # report 100% of traces + zipkin: # Use the "zipkin" Maven profile to have the Spring Cloud Zipkin dependencies + base-url: http://localhost:9411 + enabled: false + locator: + discovery: + enabled: true + +# =================================================================== +# To enable TLS in production, generate a certificate using: +# keytool -genkey -alias quotes -storetype PKCS12 -keyalg RSA -keysize 2048 -keystore keystore.p12 -validity 3650 +# +# You can also use Let's Encrypt: +# https://maximilian-boehm.com/hp2121/Create-a-Java-Keystore-JKS-from-Let-s-Encrypt-Certificates.htm +# +# Then, modify the server.ssl properties so your "server" configuration looks like: +# +# server: +# port: 443 +# ssl: +# key-store: classpath:config/tls/keystore.p12 +# key-store-password: password +# key-store-type: PKCS12 +# key-alias: quotes +# # The ciphers suite enforce the security by deactivating some old and deprecated SSL cipher, this list was tested against SSL Labs (https://www.ssllabs.com/ssltest/) +# ciphers: TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA,TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA,TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 ,TLS_DHE_RSA_WITH_AES_128_GCM_SHA256 ,TLS_DHE_RSA_WITH_AES_256_GCM_SHA384 ,TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256,TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384,TLS_DHE_RSA_WITH_AES_128_CBC_SHA256,TLS_DHE_RSA_WITH_AES_128_CBC_SHA,TLS_DHE_RSA_WITH_AES_256_CBC_SHA256,TLS_DHE_RSA_WITH_AES_256_CBC_SHA,TLS_RSA_WITH_AES_128_GCM_SHA256,TLS_RSA_WITH_AES_256_GCM_SHA384,TLS_RSA_WITH_AES_128_CBC_SHA256,TLS_RSA_WITH_AES_256_CBC_SHA256,TLS_RSA_WITH_AES_128_CBC_SHA,TLS_RSA_WITH_AES_256_CBC_SHA,TLS_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA,TLS_RSA_WITH_CAMELLIA_256_CBC_SHA,TLS_DHE_RSA_WITH_CAMELLIA_128_CBC_SHA,TLS_RSA_WITH_CAMELLIA_128_CBC_SHA +# =================================================================== +server: + port: 8081 + compression: + enabled: true + mime-types: text/html,text/xml,text/plain,text/css, application/javascript, application/json + min-response-size: 1024 + +# =================================================================== +# JHipster specific properties +# +# Full reference is available at: https://www.jhipster.tech/common-application-properties/ +# =================================================================== + +jhipster: + http: + version: V_1_1 # To use HTTP/2 you will need SSL support (see above the "server.ssl" configuration) + cache: # Used by the CachingHttpHeadersFilter + timeToLiveInDays: 1461 + cache: # Cache configuration + hazelcast: # Hazelcast distributed cache + time-to-live-seconds: 3600 + backup-count: 1 + management-center: # Full reference is available at: http://docs.hazelcast.org/docs/management-center/3.9/manual/html/Deploying_and_Starting.html + enabled: false + update-interval: 3 + url: + security: + client-authorization: + access-token-uri: http://uaa/oauth/token + token-service-id: uaa + client-id: internal + client-secret: internal + mail: # specific JHipster mail property, for standard properties see MailProperties + from: quotes@localhost + base-url: http://my-server-url-to-change # Modify according to your server's URL + metrics: # DropWizard Metrics configuration, used by MetricsConfiguration + jmx: + enabled: true + logs: # Reports Dropwizard metrics in the logs + enabled: false + report-frequency: 60 # in seconds + logging: + logstash: # Forward logs to logstash over a socket, used by LoggingConfiguration + enabled: false + host: localhost + port: 5000 + queue-size: 512 +oauth2: + signature-verification: + public-key-endpoint-uri: http://uaa/oauth/token_key + #ttl for public keys to verify JWT tokens (in ms) + ttl: 3600000 + #max. rate at which public keys will be fetched (in ms) + public-key-refresh-rate-limit: 10000 + web-client-configuration: + #change client secret in production, keep in sync with UAA configuration + client-id: web_app + secret: changeit + +# =================================================================== +# Application specific properties +# Add your own application properties here, see the ApplicationProperties class +# to have type-safe configuration, like in the JHipsterProperties above +# +# More documentation is available at: +# https://www.jhipster.tech/common-application-properties/ +# =================================================================== + +# application: diff --git a/jhipster/jhipster-uaa/quotes/src/main/resources/config/application-tls.yml b/jhipster/jhipster-uaa/quotes/src/main/resources/config/application-tls.yml new file mode 100644 index 0000000000..e082c8f455 --- /dev/null +++ b/jhipster/jhipster-uaa/quotes/src/main/resources/config/application-tls.yml @@ -0,0 +1,18 @@ +# =================================================================== +# Activate this profile to enable TLS and HTTP/2. +# +# JHipster has generated a self-signed certificate, which will be used to encrypt traffic. +# As your browser will not understand this certificate, you will need to import it. +# +# Another (easiest) solution with Chrome is to enable the "allow-insecure-localhost" flag +# at chrome://flags/#allow-insecure-localhost +# =================================================================== +server: + ssl: + key-store: classpath:config/tls/keystore.p12 + key-store-password: password + key-store-type: PKCS12 + key-alias: selfsigned +jhipster: + http: + version: V_2_0 diff --git a/jhipster/jhipster-uaa/quotes/src/main/resources/config/application.yml b/jhipster/jhipster-uaa/quotes/src/main/resources/config/application.yml new file mode 100644 index 0000000000..66c52a622a --- /dev/null +++ b/jhipster/jhipster-uaa/quotes/src/main/resources/config/application.yml @@ -0,0 +1,160 @@ +# =================================================================== +# Spring Boot configuration. +# +# This configuration will be overridden by the Spring profile you use, +# for example application-dev.yml if you use the "dev" profile. +# +# More information on profiles: https://www.jhipster.tech/profiles/ +# More information on configuration properties: https://www.jhipster.tech/common-application-properties/ +# =================================================================== + +# =================================================================== +# Standard Spring Boot properties. +# Full reference is available at: +# http://docs.spring.io/spring-boot/docs/current/reference/html/common-application-properties.html +# =================================================================== + +eureka: + client: + enabled: true + healthcheck: + enabled: true + fetch-registry: true + register-with-eureka: true + instance-info-replication-interval-seconds: 10 + registry-fetch-interval-seconds: 10 + instance: + appname: quotes + instanceId: quotes:${spring.application.instance-id:${random.value}} + lease-renewal-interval-in-seconds: 5 + lease-expiration-duration-in-seconds: 10 + status-page-url-path: ${management.endpoints.web.base-path}/info + health-check-url-path: ${management.endpoints.web.base-path}/health + metadata-map: + zone: primary # This is needed for the load balancer + profile: ${spring.profiles.active} + version: ${info.project.version:} + git-version: ${git.commit.id.describe:} + git-commit: ${git.commit.id.abbrev:} + git-branch: ${git.branch:} +ribbon: + eureka: + enabled: true +feign: + hystrix: + enabled: true +# client: +# config: +# default: +# connectTimeout: 5000 +# readTimeout: 5000 + +# See https://github.com/Netflix/Hystrix/wiki/Configuration +hystrix: + command: + default: + execution: + isolation: + strategy: SEMAPHORE +# See https://github.com/spring-cloud/spring-cloud-netflix/issues/1330 +# thread: +# timeoutInMilliseconds: 10000 + shareSecurityContext: true + +management: + endpoints: + web: + base-path: /management + exposure: + include: ["configprops", "env", "health", "info", "threaddump", "logfile" ] + endpoint: + health: + show-details: when_authorized + info: + git: + mode: full + health: + mail: + enabled: false # When using the MailService, configure an SMTP server and set this to true + metrics: + enabled: false # http://micrometer.io/ is disabled by default, as we use http://metrics.dropwizard.io/ instead + +spring: + application: + name: quotes + jpa: + open-in-view: false + hibernate: + ddl-auto: none + naming: + physical-strategy: org.springframework.boot.orm.jpa.hibernate.SpringPhysicalNamingStrategy + implicit-strategy: org.springframework.boot.orm.jpa.hibernate.SpringImplicitNamingStrategy + messages: + basename: i18n/messages + mvc: + favicon: + enabled: false + thymeleaf: + mode: HTML +security: + oauth2: + resource: + filter-order: 3 + +server: + servlet: + session: + cookie: + http-only: true + +# Properties to be exposed on the /info management endpoint +info: + # Comma separated list of profiles that will trigger the ribbon to show + display-ribbon-on-profiles: "dev" + +# =================================================================== +# JHipster specific properties +# +# Full reference is available at: https://www.jhipster.tech/common-application-properties/ +# =================================================================== + +jhipster: + async: + core-pool-size: 2 + max-pool-size: 50 + queue-capacity: 10000 + # By default CORS is disabled. Uncomment to enable. + #cors: + #allowed-origins: "*" + #allowed-methods: "*" + #allowed-headers: "*" + #exposed-headers: "Authorization,Link,X-Total-Count" + #allow-credentials: true + #max-age: 1800 + mail: + from: quotes@localhost + swagger: + default-include-pattern: /api/.* + title: quotes API + description: quotes API documentation + version: 0.0.1 + terms-of-service-url: + contact-name: + contact-url: + contact-email: + license: + license-url: + +logging: + file: target/quotes.log + +# =================================================================== +# Application specific properties +# Add your own application properties here, see the ApplicationProperties class +# to have type-safe configuration, like in the JHipsterProperties above +# +# More documentation is available at: +# https://www.jhipster.tech/common-application-properties/ +# =================================================================== + +# application: diff --git a/jhipster/jhipster-uaa/quotes/src/main/resources/config/bootstrap-prod.yml b/jhipster/jhipster-uaa/quotes/src/main/resources/config/bootstrap-prod.yml new file mode 100644 index 0000000000..3a262f4f66 --- /dev/null +++ b/jhipster/jhipster-uaa/quotes/src/main/resources/config/bootstrap-prod.yml @@ -0,0 +1,22 @@ +# =================================================================== +# Spring Cloud Config bootstrap configuration for the "prod" profile +# =================================================================== + +spring: + cloud: + config: + fail-fast: true + retry: + initial-interval: 1000 + max-interval: 2000 + max-attempts: 100 + uri: http://admin:${jhipster.registry.password}@localhost:8761/config + # name of the config server's property source (file.yml) that we want to use + name: quotes + profile: prod # profile(s) of the property source + label: master # toggle to switch to a different version of the configuration as stored in git + # it can be set to any label, branch or commit of the configuration source Git repository + +jhipster: + registry: + password: admin diff --git a/jhipster/jhipster-uaa/quotes/src/main/resources/config/bootstrap.yml b/jhipster/jhipster-uaa/quotes/src/main/resources/config/bootstrap.yml new file mode 100644 index 0000000000..e981125e34 --- /dev/null +++ b/jhipster/jhipster-uaa/quotes/src/main/resources/config/bootstrap.yml @@ -0,0 +1,26 @@ +# =================================================================== +# Spring Cloud Config bootstrap configuration for the "dev" profile +# In prod profile, properties will be overwriten by the ones defined in bootstrap-prod.yml +# =================================================================== + +jhipster: + registry: + password: admin + +spring: + application: + name: quotes + profiles: + # The commented value for `active` can be replaced with valid Spring profiles to load. + # Otherwise, it will be filled in by maven when building the WAR file + # Either way, it can be overridden by `--spring.profiles.active` value passed in the commandline or `-Dspring.profiles.active` set in `JAVA_OPTS` + active: #spring.profiles.active# + cloud: + config: + fail-fast: false # if not in "prod" profile, do not force to use Spring Cloud Config + uri: http://admin:${jhipster.registry.password}@localhost:8761/config + # name of the config server's property source (file.yml) that we want to use + name: quotes + profile: dev # profile(s) of the property source + label: master # toggle to switch to a different version of the configuration as stored in git + # it can be set to any label, branch or commit of the configuration source Git repository diff --git a/jhipster/jhipster-uaa/quotes/src/main/resources/config/liquibase/changelog/00000000000000_initial_schema.xml b/jhipster/jhipster-uaa/quotes/src/main/resources/config/liquibase/changelog/00000000000000_initial_schema.xml new file mode 100644 index 0000000000..d75921613c --- /dev/null +++ b/jhipster/jhipster-uaa/quotes/src/main/resources/config/liquibase/changelog/00000000000000_initial_schema.xml @@ -0,0 +1,59 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/jhipster/jhipster-uaa/quotes/src/main/resources/config/liquibase/changelog/20181019033648_added_entity_Quote.xml b/jhipster/jhipster-uaa/quotes/src/main/resources/config/liquibase/changelog/20181019033648_added_entity_Quote.xml new file mode 100644 index 0000000000..d5b8fecc0d --- /dev/null +++ b/jhipster/jhipster-uaa/quotes/src/main/resources/config/liquibase/changelog/20181019033648_added_entity_Quote.xml @@ -0,0 +1,43 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/jhipster/jhipster-uaa/quotes/src/main/resources/config/liquibase/master.xml b/jhipster/jhipster-uaa/quotes/src/main/resources/config/liquibase/master.xml new file mode 100644 index 0000000000..e260e927a4 --- /dev/null +++ b/jhipster/jhipster-uaa/quotes/src/main/resources/config/liquibase/master.xml @@ -0,0 +1,11 @@ + + + + + + + + diff --git a/jhipster/jhipster-uaa/quotes/src/main/resources/config/tls/keystore.p12 b/jhipster/jhipster-uaa/quotes/src/main/resources/config/tls/keystore.p12 new file mode 100644 index 0000000000..92ec1f93f0 Binary files /dev/null and b/jhipster/jhipster-uaa/quotes/src/main/resources/config/tls/keystore.p12 differ diff --git a/jhipster/jhipster-uaa/quotes/src/main/resources/i18n/messages.properties b/jhipster/jhipster-uaa/quotes/src/main/resources/i18n/messages.properties new file mode 100644 index 0000000000..eb71dfa8e3 --- /dev/null +++ b/jhipster/jhipster-uaa/quotes/src/main/resources/i18n/messages.properties @@ -0,0 +1,21 @@ +# Error page +error.title=Your request cannot be processed +error.subtitle=Sorry, an error has occurred. +error.status=Status: +error.message=Message: + +# Activation email +email.activation.title=quotes account activation +email.activation.greeting=Dear {0} +email.activation.text1=Your quotes account has been created, please click on the URL below to activate it: +email.activation.text2=Regards, +email.signature=quotes Team. + +# Creation email +email.creation.text1=Your quotes account has been created, please click on the URL below to access it: + +# Reset email +email.reset.title=quotes password reset +email.reset.greeting=Dear {0} +email.reset.text1=For your quotes account a password reset was requested, please click on the URL below to reset it: +email.reset.text2=Regards, diff --git a/jhipster/jhipster-uaa/quotes/src/main/resources/i18n/messages_en.properties b/jhipster/jhipster-uaa/quotes/src/main/resources/i18n/messages_en.properties new file mode 100644 index 0000000000..eb71dfa8e3 --- /dev/null +++ b/jhipster/jhipster-uaa/quotes/src/main/resources/i18n/messages_en.properties @@ -0,0 +1,21 @@ +# Error page +error.title=Your request cannot be processed +error.subtitle=Sorry, an error has occurred. +error.status=Status: +error.message=Message: + +# Activation email +email.activation.title=quotes account activation +email.activation.greeting=Dear {0} +email.activation.text1=Your quotes account has been created, please click on the URL below to activate it: +email.activation.text2=Regards, +email.signature=quotes Team. + +# Creation email +email.creation.text1=Your quotes account has been created, please click on the URL below to access it: + +# Reset email +email.reset.title=quotes password reset +email.reset.greeting=Dear {0} +email.reset.text1=For your quotes account a password reset was requested, please click on the URL below to reset it: +email.reset.text2=Regards, diff --git a/jhipster/jhipster-uaa/quotes/src/main/resources/logback-spring.xml b/jhipster/jhipster-uaa/quotes/src/main/resources/logback-spring.xml new file mode 100644 index 0000000000..a30ab8c1d2 --- /dev/null +++ b/jhipster/jhipster-uaa/quotes/src/main/resources/logback-spring.xml @@ -0,0 +1,70 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + true + + + diff --git a/jhipster/jhipster-uaa/quotes/src/main/resources/static/index.html b/jhipster/jhipster-uaa/quotes/src/main/resources/static/index.html new file mode 100644 index 0000000000..46c264463c --- /dev/null +++ b/jhipster/jhipster-uaa/quotes/src/main/resources/static/index.html @@ -0,0 +1,103 @@ + + + + + JHipster microservice homepage + + + +

+

Welcome, Java Hipster!

+ +

This application is a microservice, which has been generated using JHipster.

+ +
    +
  • It does not have a front-end. The front-end should be generated on a JHipster gateway
  • +
  • It is serving REST APIs, under the '/api' URLs.
  • +
  • Swagger documentation endpoint for those APIs is at /v2/api-docs, but if you want access to the full Swagger UI, you should use a JHipster gateway, which will serve as an API developer portal
  • +
+ +

+ If you have any question on JHipster: +

+ + + +

+ If you like JHipster, don't forget to give us a star on GitHub! +

+ +
+ + diff --git a/jhipster/jhipster-uaa/quotes/src/main/resources/templates/error.html b/jhipster/jhipster-uaa/quotes/src/main/resources/templates/error.html new file mode 100644 index 0000000000..08616bcf1e --- /dev/null +++ b/jhipster/jhipster-uaa/quotes/src/main/resources/templates/error.html @@ -0,0 +1,163 @@ + + + + + + Your request cannot be processed + + + +
+

Your request cannot be processed :(

+ +

Sorry, an error has occurred.

+ + Status:  ()
+ + Message: 
+
+ + + +
+ + diff --git a/jhipster/jhipster-uaa/quotes/src/test/java/com/baeldung/jhipster/quotes/config/SecurityBeanOverrideConfiguration.java b/jhipster/jhipster-uaa/quotes/src/test/java/com/baeldung/jhipster/quotes/config/SecurityBeanOverrideConfiguration.java new file mode 100644 index 0000000000..f82b7fafe6 --- /dev/null +++ b/jhipster/jhipster-uaa/quotes/src/test/java/com/baeldung/jhipster/quotes/config/SecurityBeanOverrideConfiguration.java @@ -0,0 +1,35 @@ +package com.baeldung.jhipster.quotes.config; + +import org.springframework.cloud.client.loadbalancer.RestTemplateCustomizer; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.Primary; +import org.springframework.security.oauth2.provider.token.TokenStore; +import org.springframework.security.oauth2.provider.token.store.JwtAccessTokenConverter; +import org.springframework.web.client.RestTemplate; + +/** + * Overrides UAA specific beans, so they do not interfere the testing + * This configuration must be included in @SpringBootTest in order to take effect. + */ +@Configuration +public class SecurityBeanOverrideConfiguration { + + @Bean + @Primary + public TokenStore tokenStore() { + return null; + } + + @Bean + @Primary + public JwtAccessTokenConverter jwtAccessTokenConverter() { + return null; + } + + @Bean + @Primary + public RestTemplate loadBalancedRestTemplate(RestTemplateCustomizer customizer) { + return null; + } +} diff --git a/jhipster/jhipster-uaa/quotes/src/test/java/com/baeldung/jhipster/quotes/config/WebConfigurerTest.java b/jhipster/jhipster-uaa/quotes/src/test/java/com/baeldung/jhipster/quotes/config/WebConfigurerTest.java new file mode 100644 index 0000000000..5a80d9befb --- /dev/null +++ b/jhipster/jhipster-uaa/quotes/src/test/java/com/baeldung/jhipster/quotes/config/WebConfigurerTest.java @@ -0,0 +1,197 @@ +package com.baeldung.jhipster.quotes.config; + +import com.codahale.metrics.MetricRegistry; +import com.codahale.metrics.servlet.InstrumentedFilter; +import com.codahale.metrics.servlets.MetricsServlet; +import io.github.jhipster.config.JHipsterConstants; +import io.github.jhipster.config.JHipsterProperties; +import io.undertow.Undertow; +import io.undertow.Undertow.Builder; +import io.undertow.UndertowOptions; + +import org.h2.server.web.WebServlet; +import org.junit.Before; +import org.junit.Test; +import org.springframework.boot.web.embedded.undertow.UndertowServletWebServerFactory; +import org.springframework.http.HttpHeaders; +import org.springframework.mock.env.MockEnvironment; +import org.springframework.mock.web.MockServletContext; +import org.springframework.test.util.ReflectionTestUtils; +import org.springframework.test.web.servlet.MockMvc; +import org.springframework.test.web.servlet.setup.MockMvcBuilders; +import org.xnio.OptionMap; + +import javax.servlet.*; +import java.util.*; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.anyString; +import static org.mockito.Mockito.*; +import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; +import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.options; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.header; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; + +/** + * Unit tests for the WebConfigurer class. + * + * @see WebConfigurer + */ +public class WebConfigurerTest { + + private WebConfigurer webConfigurer; + + private MockServletContext servletContext; + + private MockEnvironment env; + + private JHipsterProperties props; + + private MetricRegistry metricRegistry; + + @Before + public void setup() { + servletContext = spy(new MockServletContext()); + doReturn(mock(FilterRegistration.Dynamic.class)) + .when(servletContext).addFilter(anyString(), any(Filter.class)); + doReturn(mock(ServletRegistration.Dynamic.class)) + .when(servletContext).addServlet(anyString(), any(Servlet.class)); + + env = new MockEnvironment(); + props = new JHipsterProperties(); + + webConfigurer = new WebConfigurer(env, props); + metricRegistry = new MetricRegistry(); + webConfigurer.setMetricRegistry(metricRegistry); + } + + @Test + public void testStartUpProdServletContext() throws ServletException { + env.setActiveProfiles(JHipsterConstants.SPRING_PROFILE_PRODUCTION); + webConfigurer.onStartup(servletContext); + + assertThat(servletContext.getAttribute(InstrumentedFilter.REGISTRY_ATTRIBUTE)).isEqualTo(metricRegistry); + assertThat(servletContext.getAttribute(MetricsServlet.METRICS_REGISTRY)).isEqualTo(metricRegistry); + verify(servletContext).addFilter(eq("webappMetricsFilter"), any(InstrumentedFilter.class)); + verify(servletContext).addServlet(eq("metricsServlet"), any(MetricsServlet.class)); + verify(servletContext, never()).addServlet(eq("H2Console"), any(WebServlet.class)); + } + + @Test + public void testStartUpDevServletContext() throws ServletException { + env.setActiveProfiles(JHipsterConstants.SPRING_PROFILE_DEVELOPMENT); + webConfigurer.onStartup(servletContext); + + assertThat(servletContext.getAttribute(InstrumentedFilter.REGISTRY_ATTRIBUTE)).isEqualTo(metricRegistry); + assertThat(servletContext.getAttribute(MetricsServlet.METRICS_REGISTRY)).isEqualTo(metricRegistry); + verify(servletContext).addFilter(eq("webappMetricsFilter"), any(InstrumentedFilter.class)); + verify(servletContext).addServlet(eq("metricsServlet"), any(MetricsServlet.class)); + verify(servletContext).addServlet(eq("H2Console"), any(WebServlet.class)); + } + + @Test + public void testCustomizeServletContainer() { + env.setActiveProfiles(JHipsterConstants.SPRING_PROFILE_PRODUCTION); + UndertowServletWebServerFactory container = new UndertowServletWebServerFactory(); + webConfigurer.customize(container); + assertThat(container.getMimeMappings().get("abs")).isEqualTo("audio/x-mpeg"); + assertThat(container.getMimeMappings().get("html")).isEqualTo("text/html;charset=utf-8"); + assertThat(container.getMimeMappings().get("json")).isEqualTo("text/html;charset=utf-8"); + + Builder builder = Undertow.builder(); + container.getBuilderCustomizers().forEach(c -> c.customize(builder)); + OptionMap.Builder serverOptions = (OptionMap.Builder) ReflectionTestUtils.getField(builder, "serverOptions"); + assertThat(serverOptions.getMap().get(UndertowOptions.ENABLE_HTTP2)).isNull(); + } + + @Test + public void testUndertowHttp2Enabled() { + props.getHttp().setVersion(JHipsterProperties.Http.Version.V_2_0); + UndertowServletWebServerFactory container = new UndertowServletWebServerFactory(); + webConfigurer.customize(container); + Builder builder = Undertow.builder(); + container.getBuilderCustomizers().forEach(c -> c.customize(builder)); + OptionMap.Builder serverOptions = (OptionMap.Builder) ReflectionTestUtils.getField(builder, "serverOptions"); + assertThat(serverOptions.getMap().get(UndertowOptions.ENABLE_HTTP2)).isTrue(); + } + + @Test + public void testCorsFilterOnApiPath() throws Exception { + props.getCors().setAllowedOrigins(Collections.singletonList("*")); + props.getCors().setAllowedMethods(Arrays.asList("GET", "POST", "PUT", "DELETE")); + props.getCors().setAllowedHeaders(Collections.singletonList("*")); + props.getCors().setMaxAge(1800L); + props.getCors().setAllowCredentials(true); + + MockMvc mockMvc = MockMvcBuilders.standaloneSetup(new WebConfigurerTestController()) + .addFilters(webConfigurer.corsFilter()) + .build(); + + mockMvc.perform( + options("/api/test-cors") + .header(HttpHeaders.ORIGIN, "other.domain.com") + .header(HttpHeaders.ACCESS_CONTROL_REQUEST_METHOD, "POST")) + .andExpect(status().isOk()) + .andExpect(header().string(HttpHeaders.ACCESS_CONTROL_ALLOW_ORIGIN, "other.domain.com")) + .andExpect(header().string(HttpHeaders.VARY, "Origin")) + .andExpect(header().string(HttpHeaders.ACCESS_CONTROL_ALLOW_METHODS, "GET,POST,PUT,DELETE")) + .andExpect(header().string(HttpHeaders.ACCESS_CONTROL_ALLOW_CREDENTIALS, "true")) + .andExpect(header().string(HttpHeaders.ACCESS_CONTROL_MAX_AGE, "1800")); + + mockMvc.perform( + get("/api/test-cors") + .header(HttpHeaders.ORIGIN, "other.domain.com")) + .andExpect(status().isOk()) + .andExpect(header().string(HttpHeaders.ACCESS_CONTROL_ALLOW_ORIGIN, "other.domain.com")); + } + + @Test + public void testCorsFilterOnOtherPath() throws Exception { + props.getCors().setAllowedOrigins(Collections.singletonList("*")); + props.getCors().setAllowedMethods(Arrays.asList("GET", "POST", "PUT", "DELETE")); + props.getCors().setAllowedHeaders(Collections.singletonList("*")); + props.getCors().setMaxAge(1800L); + props.getCors().setAllowCredentials(true); + + MockMvc mockMvc = MockMvcBuilders.standaloneSetup(new WebConfigurerTestController()) + .addFilters(webConfigurer.corsFilter()) + .build(); + + mockMvc.perform( + get("/test/test-cors") + .header(HttpHeaders.ORIGIN, "other.domain.com")) + .andExpect(status().isOk()) + .andExpect(header().doesNotExist(HttpHeaders.ACCESS_CONTROL_ALLOW_ORIGIN)); + } + + @Test + public void testCorsFilterDeactivated() throws Exception { + props.getCors().setAllowedOrigins(null); + + MockMvc mockMvc = MockMvcBuilders.standaloneSetup(new WebConfigurerTestController()) + .addFilters(webConfigurer.corsFilter()) + .build(); + + mockMvc.perform( + get("/api/test-cors") + .header(HttpHeaders.ORIGIN, "other.domain.com")) + .andExpect(status().isOk()) + .andExpect(header().doesNotExist(HttpHeaders.ACCESS_CONTROL_ALLOW_ORIGIN)); + } + + @Test + public void testCorsFilterDeactivated2() throws Exception { + props.getCors().setAllowedOrigins(new ArrayList<>()); + + MockMvc mockMvc = MockMvcBuilders.standaloneSetup(new WebConfigurerTestController()) + .addFilters(webConfigurer.corsFilter()) + .build(); + + mockMvc.perform( + get("/api/test-cors") + .header(HttpHeaders.ORIGIN, "other.domain.com")) + .andExpect(status().isOk()) + .andExpect(header().doesNotExist(HttpHeaders.ACCESS_CONTROL_ALLOW_ORIGIN)); + } +} diff --git a/jhipster/jhipster-uaa/quotes/src/test/java/com/baeldung/jhipster/quotes/config/WebConfigurerTestController.java b/jhipster/jhipster-uaa/quotes/src/test/java/com/baeldung/jhipster/quotes/config/WebConfigurerTestController.java new file mode 100644 index 0000000000..957a616048 --- /dev/null +++ b/jhipster/jhipster-uaa/quotes/src/test/java/com/baeldung/jhipster/quotes/config/WebConfigurerTestController.java @@ -0,0 +1,16 @@ +package com.baeldung.jhipster.quotes.config; + +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RestController; + +@RestController +public class WebConfigurerTestController { + + @GetMapping("/api/test-cors") + public void testCorsOnApiPath() { + } + + @GetMapping("/test/test-cors") + public void testCorsOnOtherPath() { + } +} diff --git a/jhipster/jhipster-uaa/quotes/src/test/java/com/baeldung/jhipster/quotes/security/OAuth2TokenMockUtil.java b/jhipster/jhipster-uaa/quotes/src/test/java/com/baeldung/jhipster/quotes/security/OAuth2TokenMockUtil.java new file mode 100644 index 0000000000..0c8e043678 --- /dev/null +++ b/jhipster/jhipster-uaa/quotes/src/test/java/com/baeldung/jhipster/quotes/security/OAuth2TokenMockUtil.java @@ -0,0 +1,83 @@ +package com.baeldung.jhipster.quotes.security; + +import org.springframework.boot.test.mock.mockito.MockBean; +import org.springframework.mock.web.MockHttpServletRequest; +import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; +import org.springframework.security.core.Authentication; +import org.springframework.security.core.GrantedAuthority; +import org.springframework.security.core.authority.SimpleGrantedAuthority; +import org.springframework.security.core.userdetails.User; +import org.springframework.security.oauth2.common.DefaultOAuth2AccessToken; +import org.springframework.security.oauth2.provider.OAuth2Authentication; +import org.springframework.security.oauth2.provider.OAuth2Request; +import org.springframework.security.oauth2.provider.token.ResourceServerTokenServices; +import org.springframework.stereotype.Component; +import org.springframework.test.web.servlet.request.RequestPostProcessor; + +import java.util.Collections; +import java.util.List; +import java.util.Set; +import java.util.UUID; +import java.util.stream.Collectors; + +import static org.mockito.BDDMockito.given; + +/** + * A bean providing simple mocking of OAuth2 access tokens for security integration tests. + */ +@Component +public class OAuth2TokenMockUtil { + + @MockBean + private ResourceServerTokenServices tokenServices; + + private OAuth2Authentication createAuthentication(String username, Set scopes, Set roles) { + List authorities = roles.stream() + .map(SimpleGrantedAuthority::new) + .collect(Collectors.toList()); + + User principal = new User(username, "test", true, true, true, true, authorities); + Authentication authentication = new UsernamePasswordAuthenticationToken(principal, principal.getPassword(), + principal.getAuthorities()); + + // Create the authorization request and OAuth2Authentication object + OAuth2Request authRequest = new OAuth2Request(null, "testClient", null, true, scopes, null, null, null, + null); + return new OAuth2Authentication(authRequest, authentication); + } + + public RequestPostProcessor oauth2Authentication(String username, Set scopes, Set roles) { + String uuid = String.valueOf(UUID.randomUUID()); + + given(tokenServices.loadAuthentication(uuid)) + .willReturn(createAuthentication(username, scopes, roles)); + + given(tokenServices.readAccessToken(uuid)).willReturn(new DefaultOAuth2AccessToken(uuid)); + + return new OAuth2PostProcessor(uuid); + } + + public RequestPostProcessor oauth2Authentication(String username, Set scopes) { + return oauth2Authentication(username, scopes, Collections.emptySet()); + } + + public RequestPostProcessor oauth2Authentication(String username) { + return oauth2Authentication(username, Collections.emptySet()); + } + + public static class OAuth2PostProcessor implements RequestPostProcessor { + + private String token; + + public OAuth2PostProcessor(String token) { + this.token = token; + } + + @Override + public MockHttpServletRequest postProcessRequest(MockHttpServletRequest mockHttpServletRequest) { + mockHttpServletRequest.addHeader("Authorization", "Bearer " + token); + + return mockHttpServletRequest; + } + } +} diff --git a/jhipster/jhipster-uaa/quotes/src/test/java/com/baeldung/jhipster/quotes/web/rest/LogsResourceIntTest.java b/jhipster/jhipster-uaa/quotes/src/test/java/com/baeldung/jhipster/quotes/web/rest/LogsResourceIntTest.java new file mode 100644 index 0000000000..56cda7d3d5 --- /dev/null +++ b/jhipster/jhipster-uaa/quotes/src/test/java/com/baeldung/jhipster/quotes/web/rest/LogsResourceIntTest.java @@ -0,0 +1,67 @@ +package com.baeldung.jhipster.quotes.web.rest; + +import com.baeldung.jhipster.quotes.QuotesApp; +import com.baeldung.jhipster.quotes.config.SecurityBeanOverrideConfiguration; +import com.baeldung.jhipster.quotes.web.rest.vm.LoggerVM; +import ch.qos.logback.classic.AsyncAppender; +import ch.qos.logback.classic.LoggerContext; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.slf4j.LoggerFactory; +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.setup.MockMvcBuilders; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; +import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.put; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; + +/** + * Test class for the LogsResource REST controller. + * + * @see LogsResource + */ +@RunWith(SpringRunner.class) +@SpringBootTest(classes = {SecurityBeanOverrideConfiguration.class, QuotesApp.class}) +public class LogsResourceIntTest { + + private MockMvc restLogsMockMvc; + + @Before + public void setup() { + LogsResource logsResource = new LogsResource(); + this.restLogsMockMvc = MockMvcBuilders + .standaloneSetup(logsResource) + .build(); + } + + @Test + public void getAllLogs() throws Exception { + restLogsMockMvc.perform(get("/management/logs")) + .andExpect(status().isOk()) + .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE)); + } + + @Test + public void changeLogs() throws Exception { + LoggerVM logger = new LoggerVM(); + logger.setLevel("INFO"); + logger.setName("ROOT"); + + restLogsMockMvc.perform(put("/management/logs") + .contentType(TestUtil.APPLICATION_JSON_UTF8) + .content(TestUtil.convertObjectToJsonBytes(logger))) + .andExpect(status().isNoContent()); + } + + @Test + public void testLogstashAppender() { + LoggerContext context = (LoggerContext) LoggerFactory.getILoggerFactory(); + assertThat(context.getLogger("ROOT").getAppender("ASYNC_LOGSTASH")).isInstanceOf(AsyncAppender.class); + } +} diff --git a/jhipster/jhipster-uaa/quotes/src/test/java/com/baeldung/jhipster/quotes/web/rest/QuoteResourceIntTest.java b/jhipster/jhipster-uaa/quotes/src/test/java/com/baeldung/jhipster/quotes/web/rest/QuoteResourceIntTest.java new file mode 100644 index 0000000000..587a273183 --- /dev/null +++ b/jhipster/jhipster-uaa/quotes/src/test/java/com/baeldung/jhipster/quotes/web/rest/QuoteResourceIntTest.java @@ -0,0 +1,546 @@ +package com.baeldung.jhipster.quotes.web.rest; + +import com.baeldung.jhipster.quotes.QuotesApp; + +import com.baeldung.jhipster.quotes.config.SecurityBeanOverrideConfiguration; + +import com.baeldung.jhipster.quotes.domain.Quote; +import com.baeldung.jhipster.quotes.repository.QuoteRepository; +import com.baeldung.jhipster.quotes.service.QuoteService; +import com.baeldung.jhipster.quotes.service.dto.QuoteDTO; +import com.baeldung.jhipster.quotes.service.mapper.QuoteMapper; +import com.baeldung.jhipster.quotes.web.rest.errors.ExceptionTranslator; +import com.baeldung.jhipster.quotes.service.dto.QuoteCriteria; +import com.baeldung.jhipster.quotes.service.QuoteQueryService; + +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.MockitoAnnotations; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.data.web.PageableHandlerMethodArgumentResolver; +import org.springframework.http.MediaType; +import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter; +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.transaction.annotation.Transactional; + +import javax.persistence.EntityManager; +import java.math.BigDecimal; +import java.time.Instant; +import java.time.ZonedDateTime; +import java.time.ZoneOffset; +import java.time.ZoneId; +import java.util.List; + + +import static com.baeldung.jhipster.quotes.web.rest.TestUtil.sameInstant; +import static com.baeldung.jhipster.quotes.web.rest.TestUtil.createFormattingConversionService; +import static org.assertj.core.api.Assertions.assertThat; +import static org.hamcrest.Matchers.hasItem; +import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*; + +/** + * Test class for the QuoteResource REST controller. + * + * @see QuoteResource + */ +@RunWith(SpringRunner.class) +@SpringBootTest(classes = {SecurityBeanOverrideConfiguration.class, QuotesApp.class}) +public class QuoteResourceIntTest { + + private static final String DEFAULT_SYMBOL = "AAAAAAAAAA"; + private static final String UPDATED_SYMBOL = "BBBBBBBBBB"; + + private static final BigDecimal DEFAULT_PRICE = new BigDecimal(1); + private static final BigDecimal UPDATED_PRICE = new BigDecimal(2); + + private static final ZonedDateTime DEFAULT_LAST_TRADE = ZonedDateTime.ofInstant(Instant.ofEpochMilli(0L), ZoneOffset.UTC); + private static final ZonedDateTime UPDATED_LAST_TRADE = ZonedDateTime.now(ZoneId.systemDefault()).withNano(0); + + @Autowired + private QuoteRepository quoteRepository; + + @Autowired + private QuoteMapper quoteMapper; + + @Autowired + private QuoteService quoteService; + + @Autowired + private QuoteQueryService quoteQueryService; + + @Autowired + private MappingJackson2HttpMessageConverter jacksonMessageConverter; + + @Autowired + private PageableHandlerMethodArgumentResolver pageableArgumentResolver; + + @Autowired + private ExceptionTranslator exceptionTranslator; + + @Autowired + private EntityManager em; + + private MockMvc restQuoteMockMvc; + + private Quote quote; + + @Before + public void setup() { + MockitoAnnotations.initMocks(this); + final QuoteResource quoteResource = new QuoteResource(quoteService, quoteQueryService); + this.restQuoteMockMvc = MockMvcBuilders.standaloneSetup(quoteResource) + .setCustomArgumentResolvers(pageableArgumentResolver) + .setControllerAdvice(exceptionTranslator) + .setConversionService(createFormattingConversionService()) + .setMessageConverters(jacksonMessageConverter).build(); + } + + /** + * Create an entity for this test. + * + * This is a static method, as tests for other entities might also need it, + * if they test an entity which requires the current entity. + */ + public static Quote createEntity(EntityManager em) { + Quote quote = new Quote() + .symbol(DEFAULT_SYMBOL) + .price(DEFAULT_PRICE) + .lastTrade(DEFAULT_LAST_TRADE); + return quote; + } + + @Before + public void initTest() { + quote = createEntity(em); + } + + @Test + @Transactional + public void createQuote() throws Exception { + int databaseSizeBeforeCreate = quoteRepository.findAll().size(); + + // Create the Quote + QuoteDTO quoteDTO = quoteMapper.toDto(quote); + restQuoteMockMvc.perform(post("/api/quotes") + .contentType(TestUtil.APPLICATION_JSON_UTF8) + .content(TestUtil.convertObjectToJsonBytes(quoteDTO))) + .andExpect(status().isCreated()); + + // Validate the Quote in the database + List quoteList = quoteRepository.findAll(); + assertThat(quoteList).hasSize(databaseSizeBeforeCreate + 1); + Quote testQuote = quoteList.get(quoteList.size() - 1); + assertThat(testQuote.getSymbol()).isEqualTo(DEFAULT_SYMBOL); + assertThat(testQuote.getPrice()).isEqualTo(DEFAULT_PRICE); + assertThat(testQuote.getLastTrade()).isEqualTo(DEFAULT_LAST_TRADE); + } + + @Test + @Transactional + public void createQuoteWithExistingId() throws Exception { + int databaseSizeBeforeCreate = quoteRepository.findAll().size(); + + // Create the Quote with an existing ID + quote.setId(1L); + QuoteDTO quoteDTO = quoteMapper.toDto(quote); + + // An entity with an existing ID cannot be created, so this API call must fail + restQuoteMockMvc.perform(post("/api/quotes") + .contentType(TestUtil.APPLICATION_JSON_UTF8) + .content(TestUtil.convertObjectToJsonBytes(quoteDTO))) + .andExpect(status().isBadRequest()); + + // Validate the Quote in the database + List quoteList = quoteRepository.findAll(); + assertThat(quoteList).hasSize(databaseSizeBeforeCreate); + } + + @Test + @Transactional + public void checkSymbolIsRequired() throws Exception { + int databaseSizeBeforeTest = quoteRepository.findAll().size(); + // set the field null + quote.setSymbol(null); + + // Create the Quote, which fails. + QuoteDTO quoteDTO = quoteMapper.toDto(quote); + + restQuoteMockMvc.perform(post("/api/quotes") + .contentType(TestUtil.APPLICATION_JSON_UTF8) + .content(TestUtil.convertObjectToJsonBytes(quoteDTO))) + .andExpect(status().isBadRequest()); + + List quoteList = quoteRepository.findAll(); + assertThat(quoteList).hasSize(databaseSizeBeforeTest); + } + + @Test + @Transactional + public void checkPriceIsRequired() throws Exception { + int databaseSizeBeforeTest = quoteRepository.findAll().size(); + // set the field null + quote.setPrice(null); + + // Create the Quote, which fails. + QuoteDTO quoteDTO = quoteMapper.toDto(quote); + + restQuoteMockMvc.perform(post("/api/quotes") + .contentType(TestUtil.APPLICATION_JSON_UTF8) + .content(TestUtil.convertObjectToJsonBytes(quoteDTO))) + .andExpect(status().isBadRequest()); + + List quoteList = quoteRepository.findAll(); + assertThat(quoteList).hasSize(databaseSizeBeforeTest); + } + + @Test + @Transactional + public void checkLastTradeIsRequired() throws Exception { + int databaseSizeBeforeTest = quoteRepository.findAll().size(); + // set the field null + quote.setLastTrade(null); + + // Create the Quote, which fails. + QuoteDTO quoteDTO = quoteMapper.toDto(quote); + + restQuoteMockMvc.perform(post("/api/quotes") + .contentType(TestUtil.APPLICATION_JSON_UTF8) + .content(TestUtil.convertObjectToJsonBytes(quoteDTO))) + .andExpect(status().isBadRequest()); + + List quoteList = quoteRepository.findAll(); + assertThat(quoteList).hasSize(databaseSizeBeforeTest); + } + + @Test + @Transactional + public void getAllQuotes() throws Exception { + // Initialize the database + quoteRepository.saveAndFlush(quote); + + // Get all the quoteList + restQuoteMockMvc.perform(get("/api/quotes?sort=id,desc")) + .andExpect(status().isOk()) + .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE)) + .andExpect(jsonPath("$.[*].id").value(hasItem(quote.getId().intValue()))) + .andExpect(jsonPath("$.[*].symbol").value(hasItem(DEFAULT_SYMBOL.toString()))) + .andExpect(jsonPath("$.[*].price").value(hasItem(DEFAULT_PRICE.intValue()))) + .andExpect(jsonPath("$.[*].lastTrade").value(hasItem(sameInstant(DEFAULT_LAST_TRADE)))); + } + + @Test + @Transactional + public void getQuote() throws Exception { + // Initialize the database + quoteRepository.saveAndFlush(quote); + + // Get the quote + restQuoteMockMvc.perform(get("/api/quotes/{id}", quote.getId())) + .andExpect(status().isOk()) + .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE)) + .andExpect(jsonPath("$.id").value(quote.getId().intValue())) + .andExpect(jsonPath("$.symbol").value(DEFAULT_SYMBOL.toString())) + .andExpect(jsonPath("$.price").value(DEFAULT_PRICE.intValue())) + .andExpect(jsonPath("$.lastTrade").value(sameInstant(DEFAULT_LAST_TRADE))); + } + + @Test + @Transactional + public void getAllQuotesBySymbolIsEqualToSomething() throws Exception { + // Initialize the database + quoteRepository.saveAndFlush(quote); + + // Get all the quoteList where symbol equals to DEFAULT_SYMBOL + defaultQuoteShouldBeFound("symbol.equals=" + DEFAULT_SYMBOL); + + // Get all the quoteList where symbol equals to UPDATED_SYMBOL + defaultQuoteShouldNotBeFound("symbol.equals=" + UPDATED_SYMBOL); + } + + @Test + @Transactional + public void getAllQuotesBySymbolIsInShouldWork() throws Exception { + // Initialize the database + quoteRepository.saveAndFlush(quote); + + // Get all the quoteList where symbol in DEFAULT_SYMBOL or UPDATED_SYMBOL + defaultQuoteShouldBeFound("symbol.in=" + DEFAULT_SYMBOL + "," + UPDATED_SYMBOL); + + // Get all the quoteList where symbol equals to UPDATED_SYMBOL + defaultQuoteShouldNotBeFound("symbol.in=" + UPDATED_SYMBOL); + } + + @Test + @Transactional + public void getAllQuotesBySymbolIsNullOrNotNull() throws Exception { + // Initialize the database + quoteRepository.saveAndFlush(quote); + + // Get all the quoteList where symbol is not null + defaultQuoteShouldBeFound("symbol.specified=true"); + + // Get all the quoteList where symbol is null + defaultQuoteShouldNotBeFound("symbol.specified=false"); + } + + @Test + @Transactional + public void getAllQuotesByPriceIsEqualToSomething() throws Exception { + // Initialize the database + quoteRepository.saveAndFlush(quote); + + // Get all the quoteList where price equals to DEFAULT_PRICE + defaultQuoteShouldBeFound("price.equals=" + DEFAULT_PRICE); + + // Get all the quoteList where price equals to UPDATED_PRICE + defaultQuoteShouldNotBeFound("price.equals=" + UPDATED_PRICE); + } + + @Test + @Transactional + public void getAllQuotesByPriceIsInShouldWork() throws Exception { + // Initialize the database + quoteRepository.saveAndFlush(quote); + + // Get all the quoteList where price in DEFAULT_PRICE or UPDATED_PRICE + defaultQuoteShouldBeFound("price.in=" + DEFAULT_PRICE + "," + UPDATED_PRICE); + + // Get all the quoteList where price equals to UPDATED_PRICE + defaultQuoteShouldNotBeFound("price.in=" + UPDATED_PRICE); + } + + @Test + @Transactional + public void getAllQuotesByPriceIsNullOrNotNull() throws Exception { + // Initialize the database + quoteRepository.saveAndFlush(quote); + + // Get all the quoteList where price is not null + defaultQuoteShouldBeFound("price.specified=true"); + + // Get all the quoteList where price is null + defaultQuoteShouldNotBeFound("price.specified=false"); + } + + @Test + @Transactional + public void getAllQuotesByLastTradeIsEqualToSomething() throws Exception { + // Initialize the database + quoteRepository.saveAndFlush(quote); + + // Get all the quoteList where lastTrade equals to DEFAULT_LAST_TRADE + defaultQuoteShouldBeFound("lastTrade.equals=" + DEFAULT_LAST_TRADE); + + // Get all the quoteList where lastTrade equals to UPDATED_LAST_TRADE + defaultQuoteShouldNotBeFound("lastTrade.equals=" + UPDATED_LAST_TRADE); + } + + @Test + @Transactional + public void getAllQuotesByLastTradeIsInShouldWork() throws Exception { + // Initialize the database + quoteRepository.saveAndFlush(quote); + + // Get all the quoteList where lastTrade in DEFAULT_LAST_TRADE or UPDATED_LAST_TRADE + defaultQuoteShouldBeFound("lastTrade.in=" + DEFAULT_LAST_TRADE + "," + UPDATED_LAST_TRADE); + + // Get all the quoteList where lastTrade equals to UPDATED_LAST_TRADE + defaultQuoteShouldNotBeFound("lastTrade.in=" + UPDATED_LAST_TRADE); + } + + @Test + @Transactional + public void getAllQuotesByLastTradeIsNullOrNotNull() throws Exception { + // Initialize the database + quoteRepository.saveAndFlush(quote); + + // Get all the quoteList where lastTrade is not null + defaultQuoteShouldBeFound("lastTrade.specified=true"); + + // Get all the quoteList where lastTrade is null + defaultQuoteShouldNotBeFound("lastTrade.specified=false"); + } + + @Test + @Transactional + public void getAllQuotesByLastTradeIsGreaterThanOrEqualToSomething() throws Exception { + // Initialize the database + quoteRepository.saveAndFlush(quote); + + // Get all the quoteList where lastTrade greater than or equals to DEFAULT_LAST_TRADE + defaultQuoteShouldBeFound("lastTrade.greaterOrEqualThan=" + DEFAULT_LAST_TRADE); + + // Get all the quoteList where lastTrade greater than or equals to UPDATED_LAST_TRADE + defaultQuoteShouldNotBeFound("lastTrade.greaterOrEqualThan=" + UPDATED_LAST_TRADE); + } + + @Test + @Transactional + public void getAllQuotesByLastTradeIsLessThanSomething() throws Exception { + // Initialize the database + quoteRepository.saveAndFlush(quote); + + // Get all the quoteList where lastTrade less than or equals to DEFAULT_LAST_TRADE + defaultQuoteShouldNotBeFound("lastTrade.lessThan=" + DEFAULT_LAST_TRADE); + + // Get all the quoteList where lastTrade less than or equals to UPDATED_LAST_TRADE + defaultQuoteShouldBeFound("lastTrade.lessThan=" + UPDATED_LAST_TRADE); + } + + /** + * Executes the search, and checks that the default entity is returned + */ + private void defaultQuoteShouldBeFound(String filter) throws Exception { + restQuoteMockMvc.perform(get("/api/quotes?sort=id,desc&" + filter)) + .andExpect(status().isOk()) + .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE)) + .andExpect(jsonPath("$.[*].id").value(hasItem(quote.getId().intValue()))) + .andExpect(jsonPath("$.[*].symbol").value(hasItem(DEFAULT_SYMBOL.toString()))) + .andExpect(jsonPath("$.[*].price").value(hasItem(DEFAULT_PRICE.intValue()))) + .andExpect(jsonPath("$.[*].lastTrade").value(hasItem(sameInstant(DEFAULT_LAST_TRADE)))); + + // Check, that the count call also returns 1 + restQuoteMockMvc.perform(get("/api/quotes/count?sort=id,desc&" + filter)) + .andExpect(status().isOk()) + .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE)) + .andExpect(content().string("1")); + } + + /** + * Executes the search, and checks that the default entity is not returned + */ + private void defaultQuoteShouldNotBeFound(String filter) throws Exception { + restQuoteMockMvc.perform(get("/api/quotes?sort=id,desc&" + filter)) + .andExpect(status().isOk()) + .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE)) + .andExpect(jsonPath("$").isArray()) + .andExpect(jsonPath("$").isEmpty()); + + // Check, that the count call also returns 0 + restQuoteMockMvc.perform(get("/api/quotes/count?sort=id,desc&" + filter)) + .andExpect(status().isOk()) + .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE)) + .andExpect(content().string("0")); + } + + + @Test + @Transactional + public void getNonExistingQuote() throws Exception { + // Get the quote + restQuoteMockMvc.perform(get("/api/quotes/{id}", Long.MAX_VALUE)) + .andExpect(status().isNotFound()); + } + + @Test + @Transactional + public void updateQuote() throws Exception { + // Initialize the database + quoteRepository.saveAndFlush(quote); + + int databaseSizeBeforeUpdate = quoteRepository.findAll().size(); + + // Update the quote + Quote updatedQuote = quoteRepository.findById(quote.getId()).get(); + // Disconnect from session so that the updates on updatedQuote are not directly saved in db + em.detach(updatedQuote); + updatedQuote + .symbol(UPDATED_SYMBOL) + .price(UPDATED_PRICE) + .lastTrade(UPDATED_LAST_TRADE); + QuoteDTO quoteDTO = quoteMapper.toDto(updatedQuote); + + restQuoteMockMvc.perform(put("/api/quotes") + .contentType(TestUtil.APPLICATION_JSON_UTF8) + .content(TestUtil.convertObjectToJsonBytes(quoteDTO))) + .andExpect(status().isOk()); + + // Validate the Quote in the database + List quoteList = quoteRepository.findAll(); + assertThat(quoteList).hasSize(databaseSizeBeforeUpdate); + Quote testQuote = quoteList.get(quoteList.size() - 1); + assertThat(testQuote.getSymbol()).isEqualTo(UPDATED_SYMBOL); + assertThat(testQuote.getPrice()).isEqualTo(UPDATED_PRICE); + assertThat(testQuote.getLastTrade()).isEqualTo(UPDATED_LAST_TRADE); + } + + @Test + @Transactional + public void updateNonExistingQuote() throws Exception { + int databaseSizeBeforeUpdate = quoteRepository.findAll().size(); + + // Create the Quote + QuoteDTO quoteDTO = quoteMapper.toDto(quote); + + // If the entity doesn't have an ID, it will throw BadRequestAlertException + restQuoteMockMvc.perform(put("/api/quotes") + .contentType(TestUtil.APPLICATION_JSON_UTF8) + .content(TestUtil.convertObjectToJsonBytes(quoteDTO))) + .andExpect(status().isBadRequest()); + + // Validate the Quote in the database + List quoteList = quoteRepository.findAll(); + assertThat(quoteList).hasSize(databaseSizeBeforeUpdate); + } + + @Test + @Transactional + public void deleteQuote() throws Exception { + // Initialize the database + quoteRepository.saveAndFlush(quote); + + int databaseSizeBeforeDelete = quoteRepository.findAll().size(); + + // Get the quote + restQuoteMockMvc.perform(delete("/api/quotes/{id}", quote.getId()) + .accept(TestUtil.APPLICATION_JSON_UTF8)) + .andExpect(status().isOk()); + + // Validate the database is empty + List quoteList = quoteRepository.findAll(); + assertThat(quoteList).hasSize(databaseSizeBeforeDelete - 1); + } + + @Test + @Transactional + public void equalsVerifier() throws Exception { + TestUtil.equalsVerifier(Quote.class); + Quote quote1 = new Quote(); + quote1.setId(1L); + Quote quote2 = new Quote(); + quote2.setId(quote1.getId()); + assertThat(quote1).isEqualTo(quote2); + quote2.setId(2L); + assertThat(quote1).isNotEqualTo(quote2); + quote1.setId(null); + assertThat(quote1).isNotEqualTo(quote2); + } + + @Test + @Transactional + public void dtoEqualsVerifier() throws Exception { + TestUtil.equalsVerifier(QuoteDTO.class); + QuoteDTO quoteDTO1 = new QuoteDTO(); + quoteDTO1.setId(1L); + QuoteDTO quoteDTO2 = new QuoteDTO(); + assertThat(quoteDTO1).isNotEqualTo(quoteDTO2); + quoteDTO2.setId(quoteDTO1.getId()); + assertThat(quoteDTO1).isEqualTo(quoteDTO2); + quoteDTO2.setId(2L); + assertThat(quoteDTO1).isNotEqualTo(quoteDTO2); + quoteDTO1.setId(null); + assertThat(quoteDTO1).isNotEqualTo(quoteDTO2); + } + + @Test + @Transactional + public void testEntityFromId() { + assertThat(quoteMapper.fromId(42L).getId()).isEqualTo(42); + assertThat(quoteMapper.fromId(null)).isNull(); + } +} diff --git a/jhipster/jhipster-uaa/quotes/src/test/java/com/baeldung/jhipster/quotes/web/rest/TestUtil.java b/jhipster/jhipster-uaa/quotes/src/test/java/com/baeldung/jhipster/quotes/web/rest/TestUtil.java new file mode 100644 index 0000000000..1fd2b1bd40 --- /dev/null +++ b/jhipster/jhipster-uaa/quotes/src/test/java/com/baeldung/jhipster/quotes/web/rest/TestUtil.java @@ -0,0 +1,135 @@ +package com.baeldung.jhipster.quotes.web.rest; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; +import org.hamcrest.Description; +import org.hamcrest.TypeSafeDiagnosingMatcher; +import org.springframework.format.datetime.standard.DateTimeFormatterRegistrar; +import org.springframework.format.support.DefaultFormattingConversionService; +import org.springframework.format.support.FormattingConversionService; +import org.springframework.http.MediaType; + +import java.io.IOException; +import java.nio.charset.StandardCharsets; +import java.time.ZonedDateTime; +import java.time.format.DateTimeParseException; + +import static org.assertj.core.api.Assertions.assertThat; + +/** + * Utility class for testing REST controllers. + */ +public class TestUtil { + + /** MediaType for JSON UTF8 */ + public static final MediaType APPLICATION_JSON_UTF8 = new MediaType( + MediaType.APPLICATION_JSON.getType(), + MediaType.APPLICATION_JSON.getSubtype(), StandardCharsets.UTF_8); + + /** + * Convert an object to JSON byte array. + * + * @param object + * the object to convert + * @return the JSON byte array + * @throws IOException + */ + public static byte[] convertObjectToJsonBytes(Object object) + throws IOException { + ObjectMapper mapper = new ObjectMapper(); + mapper.setSerializationInclusion(JsonInclude.Include.NON_EMPTY); + + JavaTimeModule module = new JavaTimeModule(); + mapper.registerModule(module); + + return mapper.writeValueAsBytes(object); + } + + /** + * Create a byte array with a specific size filled with specified data. + * + * @param size the size of the byte array + * @param data the data to put in the byte array + * @return the JSON byte array + */ + public static byte[] createByteArray(int size, String data) { + byte[] byteArray = new byte[size]; + for (int i = 0; i < size; i++) { + byteArray[i] = Byte.parseByte(data, 2); + } + return byteArray; + } + + /** + * A matcher that tests that the examined string represents the same instant as the reference datetime. + */ + public static class ZonedDateTimeMatcher extends TypeSafeDiagnosingMatcher { + + private final ZonedDateTime date; + + public ZonedDateTimeMatcher(ZonedDateTime date) { + this.date = date; + } + + @Override + protected boolean matchesSafely(String item, Description mismatchDescription) { + try { + if (!date.isEqual(ZonedDateTime.parse(item))) { + mismatchDescription.appendText("was ").appendValue(item); + return false; + } + return true; + } catch (DateTimeParseException e) { + mismatchDescription.appendText("was ").appendValue(item) + .appendText(", which could not be parsed as a ZonedDateTime"); + return false; + } + + } + + @Override + public void describeTo(Description description) { + description.appendText("a String representing the same Instant as ").appendValue(date); + } + } + + /** + * Creates a matcher that matches when the examined string reprensents the same instant as the reference datetime + * @param date the reference datetime against which the examined string is checked + */ + public static ZonedDateTimeMatcher sameInstant(ZonedDateTime date) { + return new ZonedDateTimeMatcher(date); + } + + /** + * Verifies the equals/hashcode contract on the domain object. + */ + public static void equalsVerifier(Class clazz) throws Exception { + T domainObject1 = clazz.getConstructor().newInstance(); + assertThat(domainObject1.toString()).isNotNull(); + assertThat(domainObject1).isEqualTo(domainObject1); + assertThat(domainObject1.hashCode()).isEqualTo(domainObject1.hashCode()); + // Test with an instance of another class + Object testOtherObject = new Object(); + assertThat(domainObject1).isNotEqualTo(testOtherObject); + assertThat(domainObject1).isNotEqualTo(null); + // Test with an instance of the same class + T domainObject2 = clazz.getConstructor().newInstance(); + assertThat(domainObject1).isNotEqualTo(domainObject2); + // HashCodes are equals because the objects are not persisted yet + assertThat(domainObject1.hashCode()).isEqualTo(domainObject2.hashCode()); + } + + /** + * Create a FormattingConversionService which use ISO date format, instead of the localized one. + * @return the FormattingConversionService + */ + public static FormattingConversionService createFormattingConversionService() { + DefaultFormattingConversionService dfcs = new DefaultFormattingConversionService (); + DateTimeFormatterRegistrar registrar = new DateTimeFormatterRegistrar(); + registrar.setUseIsoFormat(true); + registrar.registerFormatters(dfcs); + return dfcs; + } +} diff --git a/jhipster/jhipster-uaa/quotes/src/test/java/com/baeldung/jhipster/quotes/web/rest/errors/ExceptionTranslatorIntTest.java b/jhipster/jhipster-uaa/quotes/src/test/java/com/baeldung/jhipster/quotes/web/rest/errors/ExceptionTranslatorIntTest.java new file mode 100644 index 0000000000..f233293e35 --- /dev/null +++ b/jhipster/jhipster-uaa/quotes/src/test/java/com/baeldung/jhipster/quotes/web/rest/errors/ExceptionTranslatorIntTest.java @@ -0,0 +1,151 @@ +package com.baeldung.jhipster.quotes.web.rest.errors; + +import com.baeldung.jhipster.quotes.QuotesApp; +import com.baeldung.jhipster.quotes.config.SecurityBeanOverrideConfiguration; +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.http.MediaType; +import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter; +import org.springframework.test.context.junit4.SpringRunner; +import org.springframework.test.web.servlet.MockMvc; +import org.springframework.test.web.servlet.setup.MockMvcBuilders; + +import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; +import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; + +/** + * Test class for the ExceptionTranslator controller advice. + * + * @see ExceptionTranslator + */ +@RunWith(SpringRunner.class) +@SpringBootTest(classes = {SecurityBeanOverrideConfiguration.class, QuotesApp.class}) +public class ExceptionTranslatorIntTest { + + @Autowired + private ExceptionTranslatorTestController controller; + + @Autowired + private ExceptionTranslator exceptionTranslator; + + @Autowired + private MappingJackson2HttpMessageConverter jacksonMessageConverter; + + private MockMvc mockMvc; + + @Before + public void setup() { + mockMvc = MockMvcBuilders.standaloneSetup(controller) + .setControllerAdvice(exceptionTranslator) + .setMessageConverters(jacksonMessageConverter) + .build(); + } + + @Test + public void testConcurrencyFailure() throws Exception { + mockMvc.perform(get("/test/concurrency-failure")) + .andExpect(status().isConflict()) + .andExpect(content().contentType(MediaType.APPLICATION_PROBLEM_JSON)) + .andExpect(jsonPath("$.message").value(ErrorConstants.ERR_CONCURRENCY_FAILURE)); + } + + @Test + public void testMethodArgumentNotValid() throws Exception { + mockMvc.perform(post("/test/method-argument").content("{}").contentType(MediaType.APPLICATION_JSON)) + .andExpect(status().isBadRequest()) + .andExpect(content().contentType(MediaType.APPLICATION_PROBLEM_JSON)) + .andExpect(jsonPath("$.message").value(ErrorConstants.ERR_VALIDATION)) + .andExpect(jsonPath("$.fieldErrors.[0].objectName").value("testDTO")) + .andExpect(jsonPath("$.fieldErrors.[0].field").value("test")) + .andExpect(jsonPath("$.fieldErrors.[0].message").value("NotNull")); + } + + @Test + public void testParameterizedError() throws Exception { + mockMvc.perform(get("/test/parameterized-error")) + .andExpect(status().isBadRequest()) + .andExpect(content().contentType(MediaType.APPLICATION_PROBLEM_JSON)) + .andExpect(jsonPath("$.message").value("test parameterized error")) + .andExpect(jsonPath("$.params.param0").value("param0_value")) + .andExpect(jsonPath("$.params.param1").value("param1_value")); + } + + @Test + public void testParameterizedError2() throws Exception { + mockMvc.perform(get("/test/parameterized-error2")) + .andExpect(status().isBadRequest()) + .andExpect(content().contentType(MediaType.APPLICATION_PROBLEM_JSON)) + .andExpect(jsonPath("$.message").value("test parameterized error")) + .andExpect(jsonPath("$.params.foo").value("foo_value")) + .andExpect(jsonPath("$.params.bar").value("bar_value")); + } + + @Test + public void testMissingServletRequestPartException() throws Exception { + mockMvc.perform(get("/test/missing-servlet-request-part")) + .andExpect(status().isBadRequest()) + .andExpect(content().contentType(MediaType.APPLICATION_PROBLEM_JSON)) + .andExpect(jsonPath("$.message").value("error.http.400")); + } + + @Test + public void testMissingServletRequestParameterException() throws Exception { + mockMvc.perform(get("/test/missing-servlet-request-parameter")) + .andExpect(status().isBadRequest()) + .andExpect(content().contentType(MediaType.APPLICATION_PROBLEM_JSON)) + .andExpect(jsonPath("$.message").value("error.http.400")); + } + + @Test + public void testAccessDenied() throws Exception { + mockMvc.perform(get("/test/access-denied")) + .andExpect(status().isForbidden()) + .andExpect(content().contentType(MediaType.APPLICATION_PROBLEM_JSON)) + .andExpect(jsonPath("$.message").value("error.http.403")) + .andExpect(jsonPath("$.detail").value("test access denied!")); + } + + @Test + public void testUnauthorized() throws Exception { + mockMvc.perform(get("/test/unauthorized")) + .andExpect(status().isUnauthorized()) + .andExpect(content().contentType(MediaType.APPLICATION_PROBLEM_JSON)) + .andExpect(jsonPath("$.message").value("error.http.401")) + .andExpect(jsonPath("$.path").value("/test/unauthorized")) + .andExpect(jsonPath("$.detail").value("test authentication failed!")); + } + + @Test + public void testMethodNotSupported() throws Exception { + mockMvc.perform(post("/test/access-denied")) + .andExpect(status().isMethodNotAllowed()) + .andExpect(content().contentType(MediaType.APPLICATION_PROBLEM_JSON)) + .andExpect(jsonPath("$.message").value("error.http.405")) + .andExpect(jsonPath("$.detail").value("Request method 'POST' not supported")); + } + + @Test + public void testExceptionWithResponseStatus() throws Exception { + mockMvc.perform(get("/test/response-status")) + .andExpect(status().isBadRequest()) + .andExpect(content().contentType(MediaType.APPLICATION_PROBLEM_JSON)) + .andExpect(jsonPath("$.message").value("error.http.400")) + .andExpect(jsonPath("$.title").value("test response status")); + } + + @Test + public void testInternalServerError() throws Exception { + mockMvc.perform(get("/test/internal-server-error")) + .andExpect(status().isInternalServerError()) + .andExpect(content().contentType(MediaType.APPLICATION_PROBLEM_JSON)) + .andExpect(jsonPath("$.message").value("error.http.500")) + .andExpect(jsonPath("$.title").value("Internal Server Error")); + } + +} diff --git a/jhipster/jhipster-uaa/quotes/src/test/java/com/baeldung/jhipster/quotes/web/rest/errors/ExceptionTranslatorTestController.java b/jhipster/jhipster-uaa/quotes/src/test/java/com/baeldung/jhipster/quotes/web/rest/errors/ExceptionTranslatorTestController.java new file mode 100644 index 0000000000..b1937e5bec --- /dev/null +++ b/jhipster/jhipster-uaa/quotes/src/test/java/com/baeldung/jhipster/quotes/web/rest/errors/ExceptionTranslatorTestController.java @@ -0,0 +1,86 @@ +package com.baeldung.jhipster.quotes.web.rest.errors; + +import org.springframework.dao.ConcurrencyFailureException; +import org.springframework.http.HttpStatus; +import org.springframework.security.access.AccessDeniedException; +import org.springframework.security.authentication.BadCredentialsException; +import org.springframework.web.bind.annotation.*; + +import javax.validation.Valid; +import javax.validation.constraints.NotNull; +import java.util.HashMap; +import java.util.Map; + +@RestController +public class ExceptionTranslatorTestController { + + @GetMapping("/test/concurrency-failure") + public void concurrencyFailure() { + throw new ConcurrencyFailureException("test concurrency failure"); + } + + @PostMapping("/test/method-argument") + public void methodArgument(@Valid @RequestBody TestDTO testDTO) { + } + + @GetMapping("/test/parameterized-error") + public void parameterizedError() { + throw new CustomParameterizedException("test parameterized error", "param0_value", "param1_value"); + } + + @GetMapping("/test/parameterized-error2") + public void parameterizedError2() { + Map params = new HashMap<>(); + params.put("foo", "foo_value"); + params.put("bar", "bar_value"); + throw new CustomParameterizedException("test parameterized error", params); + } + + @GetMapping("/test/missing-servlet-request-part") + public void missingServletRequestPartException(@RequestPart String part) { + } + + @GetMapping("/test/missing-servlet-request-parameter") + public void missingServletRequestParameterException(@RequestParam String param) { + } + + @GetMapping("/test/access-denied") + public void accessdenied() { + throw new AccessDeniedException("test access denied!"); + } + + @GetMapping("/test/unauthorized") + public void unauthorized() { + throw new BadCredentialsException("test authentication failed!"); + } + + @GetMapping("/test/response-status") + public void exceptionWithReponseStatus() { + throw new TestResponseStatusException(); + } + + @GetMapping("/test/internal-server-error") + public void internalServerError() { + throw new RuntimeException(); + } + + public static class TestDTO { + + @NotNull + private String test; + + public String getTest() { + return test; + } + + public void setTest(String test) { + this.test = test; + } + } + + @ResponseStatus(value = HttpStatus.BAD_REQUEST, reason = "test response status") + @SuppressWarnings("serial") + public static class TestResponseStatusException extends RuntimeException { + } + +} diff --git a/jhipster/jhipster-uaa/quotes/src/test/java/com/baeldung/jhipster/quotes/web/rest/util/PaginationUtilUnitTest.java b/jhipster/jhipster-uaa/quotes/src/test/java/com/baeldung/jhipster/quotes/web/rest/util/PaginationUtilUnitTest.java new file mode 100644 index 0000000000..a21851044d --- /dev/null +++ b/jhipster/jhipster-uaa/quotes/src/test/java/com/baeldung/jhipster/quotes/web/rest/util/PaginationUtilUnitTest.java @@ -0,0 +1,44 @@ +package com.baeldung.jhipster.quotes.web.rest.util; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; + +import java.util.ArrayList; +import java.util.List; + +import org.junit.Test; +import org.springframework.data.domain.Page; +import org.springframework.data.domain.PageImpl; +import org.springframework.data.domain.PageRequest; +import org.springframework.http.HttpHeaders; + +/** + * Tests based on parsing algorithm in app/components/util/pagination-util.service.js + * + * @see PaginationUtil + */ +public class PaginationUtilUnitTest { + + @Test + public void generatePaginationHttpHeadersTest() { + String baseUrl = "/api/_search/example"; + List content = new ArrayList<>(); + Page page = new PageImpl<>(content, PageRequest.of(6, 50), 400L); + HttpHeaders headers = PaginationUtil.generatePaginationHttpHeaders(page, baseUrl); + List strHeaders = headers.get(HttpHeaders.LINK); + assertNotNull(strHeaders); + assertTrue(strHeaders.size() == 1); + String headerData = strHeaders.get(0); + assertTrue(headerData.split(",").length == 4); + String expectedData = "; rel=\"next\"," + + "; rel=\"prev\"," + + "; rel=\"last\"," + + "; rel=\"first\""; + assertEquals(expectedData, headerData); + List xTotalCountHeaders = headers.get("X-Total-Count"); + assertTrue(xTotalCountHeaders.size() == 1); + assertTrue(Long.valueOf(xTotalCountHeaders.get(0)).equals(400L)); + } + +} diff --git a/jhipster/jhipster-uaa/quotes/src/test/resources/config/application.yml b/jhipster/jhipster-uaa/quotes/src/test/resources/config/application.yml new file mode 100644 index 0000000000..337bdbde1c --- /dev/null +++ b/jhipster/jhipster-uaa/quotes/src/test/resources/config/application.yml @@ -0,0 +1,119 @@ +# =================================================================== +# Spring Boot configuration. +# +# This configuration is used for unit/integration tests. +# +# More information on profiles: https://www.jhipster.tech/profiles/ +# More information on configuration properties: https://www.jhipster.tech/common-application-properties/ +# =================================================================== + +# =================================================================== +# Standard Spring Boot properties. +# Full reference is available at: +# http://docs.spring.io/spring-boot/docs/current/reference/html/common-application-properties.html +# =================================================================== + +eureka: + client: + enabled: false + instance: + appname: quotes + instanceId: quotes:${spring.application.instance-id:${random.value}} + +spring: + application: + name: quotes + cache: + type: simple + datasource: + type: com.zaxxer.hikari.HikariDataSource + url: jdbc:h2:mem:quotes;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE + name: + username: + password: + hikari: + auto-commit: false + jpa: + database-platform: io.github.jhipster.domain.util.FixedH2Dialect + database: H2 + open-in-view: false + show-sql: false + hibernate: + ddl-auto: none + naming: + physical-strategy: org.springframework.boot.orm.jpa.hibernate.SpringPhysicalNamingStrategy + implicit-strategy: org.springframework.boot.orm.jpa.hibernate.SpringImplicitNamingStrategy + properties: + hibernate.id.new_generator_mappings: true + hibernate.connection.provider_disables_autocommit: true + hibernate.cache.use_second_level_cache: false + hibernate.cache.use_query_cache: false + hibernate.generate_statistics: true + hibernate.hbm2ddl.auto: validate + liquibase: + contexts: test + mail: + host: localhost + messages: + basename: i18n/messages + mvc: + favicon: + enabled: false + thymeleaf: + mode: HTML + + +server: + port: 10344 + address: localhost + +info: + project: + version: #project.version# + +# =================================================================== +# JHipster specific properties +# +# Full reference is available at: https://www.jhipster.tech/common-application-properties/ +# =================================================================== + +jhipster: + async: + core-pool-size: 1 + max-pool-size: 50 + queue-capacity: 10000 + # To test logstash appender + logging: + logstash: + enabled: true + host: localhost + port: 5000 + queue-size: 512 + security: + authentication: + jwt: + # This token must be encoded using Base64 (you can type `echo 'secret-key'|base64` on your command line) + base64-secret: YTQzODg4YTM4NDU3YTJjMDZiZDczYTI5NThmNGU5Y2Y4ZDcxMjUxMzI1MmI4MmQwM2RmMzYxMzVjYzljN2MzNjcyYjhiNzk3NTVhN2M2NjY1YjVhZjk1YTkyMTI0MGJlODczZDZkNzA5YjAxZThhMDMyMDFkMTgyZjBhYjJkM2Y= + # Token is valid 24 hours + token-validity-in-seconds: 86400 + client-authorization: + access-token-uri: http://uaa/oauth/token + token-service-id: uaa + client-id: internal + client-secret: internal + metrics: # DropWizard Metrics configuration, used by MetricsConfiguration + jmx.enabled: true + logs: # Reports Dropwizard metrics in the logs + enabled: true + report-frequency: 60 # in seconds + +# =================================================================== +# Application specific properties +# Add your own application properties here, see the ApplicationProperties class +# to have type-safe configuration, like in the JHipsterProperties above +# +# More documentation is available at: +# https://www.jhipster.tech/common-application-properties/ +# =================================================================== + +# application: diff --git a/jhipster/jhipster-uaa/quotes/src/test/resources/config/bootstrap.yml b/jhipster/jhipster-uaa/quotes/src/test/resources/config/bootstrap.yml new file mode 100644 index 0000000000..11cd6af21c --- /dev/null +++ b/jhipster/jhipster-uaa/quotes/src/test/resources/config/bootstrap.yml @@ -0,0 +1,4 @@ +spring: + cloud: + config: + enabled: false diff --git a/jhipster/jhipster-uaa/quotes/src/test/resources/logback.xml b/jhipster/jhipster-uaa/quotes/src/test/resources/logback.xml new file mode 100644 index 0000000000..2083a085ad --- /dev/null +++ b/jhipster/jhipster-uaa/quotes/src/test/resources/logback.xml @@ -0,0 +1,46 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/jhipster/jhipster-uaa/uaa/.editorconfig b/jhipster/jhipster-uaa/uaa/.editorconfig new file mode 100644 index 0000000000..a03599dd04 --- /dev/null +++ b/jhipster/jhipster-uaa/uaa/.editorconfig @@ -0,0 +1,24 @@ +# EditorConfig helps developers define and maintain consistent +# coding styles between different editors and IDEs +# editorconfig.org + +root = true + +[*] + +# Change these settings to your own preference +indent_style = space +indent_size = 4 + +# We recommend you to keep these unchanged +end_of_line = lf +charset = utf-8 +trim_trailing_whitespace = true +insert_final_newline = true + +[*.md] +trim_trailing_whitespace = false + +[{package,bower}.json] +indent_style = space +indent_size = 2 diff --git a/jhipster/jhipster-uaa/uaa/.gitattributes b/jhipster/jhipster-uaa/uaa/.gitattributes new file mode 100644 index 0000000000..8ab72fe637 --- /dev/null +++ b/jhipster/jhipster-uaa/uaa/.gitattributes @@ -0,0 +1,149 @@ +# This file is inspired by https://github.com/alexkaratarakis/gitattributes +# +# Auto detect text files and perform LF normalization +# http://davidlaing.com/2012/09/19/customise-your-gitattributes-to-become-a-git-ninja/ +* text=auto + +# The above will handle all files NOT found below +# These files are text and should be normalized (Convert crlf => lf) + +*.bat text eol=crlf +*.coffee text +*.css text +*.cql text +*.df text +*.ejs text +*.html text +*.java text +*.js text +*.json text +*.less text +*.properties text +*.sass text +*.scss text +*.sh text eol=lf +*.sql text +*.txt text +*.ts text +*.xml text +*.yaml text +*.yml text + +# Documents +*.doc diff=astextplain +*.DOC diff=astextplain +*.docx diff=astextplain +*.DOCX diff=astextplain +*.dot diff=astextplain +*.DOT diff=astextplain +*.pdf diff=astextplain +*.PDF diff=astextplain +*.rtf diff=astextplain +*.RTF diff=astextplain +*.markdown text +*.md text +*.adoc text +*.textile text +*.mustache text +*.csv text +*.tab text +*.tsv text +*.txt text +AUTHORS text +CHANGELOG text +CHANGES text +CONTRIBUTING text +COPYING text +copyright text +*COPYRIGHT* text +INSTALL text +license text +LICENSE text +NEWS text +readme text +*README* text +TODO text + +# Graphics +*.png binary +*.jpg binary +*.jpeg binary +*.gif binary +*.tif binary +*.tiff binary +*.ico binary +# SVG treated as an asset (binary) by default. If you want to treat it as text, +# comment-out the following line and uncomment the line after. +*.svg binary +#*.svg text +*.eps binary + +# These files are binary and should be left untouched +# (binary is a macro for -text -diff) +*.class binary +*.jar binary +*.war binary + +## LINTERS +.csslintrc text +.eslintrc text +.jscsrc text +.jshintrc text +.jshintignore text +.stylelintrc text + +## CONFIGS +*.bowerrc text +*.conf text +*.config text +.editorconfig text +.gitattributes text +.gitconfig text +.gitignore text +.htaccess text +*.npmignore text + +## HEROKU +Procfile text +.slugignore text + +## AUDIO +*.kar binary +*.m4a binary +*.mid binary +*.midi binary +*.mp3 binary +*.ogg binary +*.ra binary + +## VIDEO +*.3gpp binary +*.3gp binary +*.as binary +*.asf binary +*.asx binary +*.fla binary +*.flv binary +*.m4v binary +*.mng binary +*.mov binary +*.mp4 binary +*.mpeg binary +*.mpg binary +*.swc binary +*.swf binary +*.webm binary + +## ARCHIVES +*.7z binary +*.gz binary +*.rar binary +*.tar binary +*.zip binary + +## FONTS +*.ttf binary +*.eot binary +*.otf binary +*.woff binary +*.woff2 binary diff --git a/jhipster/jhipster-uaa/uaa/.gitignore b/jhipster/jhipster-uaa/uaa/.gitignore new file mode 100644 index 0000000000..e746b25ae6 --- /dev/null +++ b/jhipster/jhipster-uaa/uaa/.gitignore @@ -0,0 +1,144 @@ +###################### +# Project Specific +###################### +/target/www/** +/src/test/javascript/coverage/ + +###################### +# Node +###################### +/node/ +node_tmp/ +node_modules/ +npm-debug.log.* +/.awcache/* +/.cache-loader/* + +###################### +# SASS +###################### +.sass-cache/ + +###################### +# Eclipse +###################### +*.pydevproject +.project +.metadata +tmp/ +tmp/**/* +*.tmp +*.bak +*.swp +*~.nib +local.properties +.classpath +.settings/ +.loadpath +.factorypath +/src/main/resources/rebel.xml + +# External tool builders +.externalToolBuilders/** + +# Locally stored "Eclipse launch configurations" +*.launch + +# CDT-specific +.cproject + +# PDT-specific +.buildpath + +###################### +# Intellij +###################### +.idea/ +*.iml +*.iws +*.ipr +*.ids +*.orig +classes/ +out/ + +###################### +# Visual Studio Code +###################### +.vscode/ + +###################### +# Maven +###################### +/log/ +/target/ + +###################### +# Gradle +###################### +.gradle/ +/build/ + +###################### +# Package Files +###################### +*.jar +*.war +*.ear +*.db + +###################### +# Windows +###################### +# Windows image file caches +Thumbs.db + +# Folder config file +Desktop.ini + +###################### +# Mac OSX +###################### +.DS_Store +.svn + +# Thumbnails +._* + +# Files that might appear on external disk +.Spotlight-V100 +.Trashes + +###################### +# Directories +###################### +/bin/ +/deploy/ + +###################### +# Logs +###################### +*.log* + +###################### +# Others +###################### +*.class +*.*~ +*~ +.merge_file* + +###################### +# Gradle Wrapper +###################### +!gradle/wrapper/gradle-wrapper.jar + +###################### +# Maven Wrapper +###################### +!.mvn/wrapper/maven-wrapper.jar + +###################### +# ESLint +###################### +.eslintcache diff --git a/jhipster/jhipster-uaa/uaa/.mvn/wrapper/MavenWrapperDownloader.java b/jhipster/jhipster-uaa/uaa/.mvn/wrapper/MavenWrapperDownloader.java new file mode 100644 index 0000000000..fa4f7b499f --- /dev/null +++ b/jhipster/jhipster-uaa/uaa/.mvn/wrapper/MavenWrapperDownloader.java @@ -0,0 +1,110 @@ +/* +Licensed to the Apache Software Foundation (ASF) under one +or more contributor license agreements. See the NOTICE file +distributed with this work for additional information +regarding copyright ownership. The ASF licenses this file +to you under the Apache License, Version 2.0 (the +"License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, +software distributed under the License is distributed on an +"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, either express or implied. See the License for the +specific language governing permissions and limitations +under the License. +*/ + +import java.net.*; +import java.io.*; +import java.nio.channels.*; +import java.util.Properties; + +public class MavenWrapperDownloader { + + /** + * Default URL to download the maven-wrapper.jar from, if no 'downloadUrl' is provided. + */ + private static final String DEFAULT_DOWNLOAD_URL = + "https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.4.2/maven-wrapper-0.4.2.jar"; + + /** + * Path to the maven-wrapper.properties file, which might contain a downloadUrl property to + * use instead of the default one. + */ + private static final String MAVEN_WRAPPER_PROPERTIES_PATH = + ".mvn/wrapper/maven-wrapper.properties"; + + /** + * Path where the maven-wrapper.jar will be saved to. + */ + private static final String MAVEN_WRAPPER_JAR_PATH = + ".mvn/wrapper/maven-wrapper.jar"; + + /** + * Name of the property which should be used to override the default download url for the wrapper. + */ + private static final String PROPERTY_NAME_WRAPPER_URL = "wrapperUrl"; + + public static void main(String args[]) { + System.out.println("- Downloader started"); + File baseDirectory = new File(args[0]); + System.out.println("- Using base directory: " + baseDirectory.getAbsolutePath()); + + // If the maven-wrapper.properties exists, read it and check if it contains a custom + // wrapperUrl parameter. + File mavenWrapperPropertyFile = new File(baseDirectory, MAVEN_WRAPPER_PROPERTIES_PATH); + String url = DEFAULT_DOWNLOAD_URL; + if(mavenWrapperPropertyFile.exists()) { + FileInputStream mavenWrapperPropertyFileInputStream = null; + try { + mavenWrapperPropertyFileInputStream = new FileInputStream(mavenWrapperPropertyFile); + Properties mavenWrapperProperties = new Properties(); + mavenWrapperProperties.load(mavenWrapperPropertyFileInputStream); + url = mavenWrapperProperties.getProperty(PROPERTY_NAME_WRAPPER_URL, url); + } catch (IOException e) { + System.out.println("- ERROR loading '" + MAVEN_WRAPPER_PROPERTIES_PATH + "'"); + } finally { + try { + if(mavenWrapperPropertyFileInputStream != null) { + mavenWrapperPropertyFileInputStream.close(); + } + } catch (IOException e) { + // Ignore ... + } + } + } + System.out.println("- Downloading from: : " + url); + + File outputFile = new File(baseDirectory.getAbsolutePath(), MAVEN_WRAPPER_JAR_PATH); + if(!outputFile.getParentFile().exists()) { + if(!outputFile.getParentFile().mkdirs()) { + System.out.println( + "- ERROR creating output direcrory '" + outputFile.getParentFile().getAbsolutePath() + "'"); + } + } + System.out.println("- Downloading to: " + outputFile.getAbsolutePath()); + try { + downloadFileFromURL(url, outputFile); + System.out.println("Done"); + System.exit(0); + } catch (Throwable e) { + System.out.println("- Error downloading"); + e.printStackTrace(); + System.exit(1); + } + } + + private static void downloadFileFromURL(String urlString, File destination) throws Exception { + URL website = new URL(urlString); + ReadableByteChannel rbc; + rbc = Channels.newChannel(website.openStream()); + FileOutputStream fos = new FileOutputStream(destination); + fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE); + fos.close(); + rbc.close(); + } + +} diff --git a/jhipster/jhipster-uaa/uaa/.mvn/wrapper/maven-wrapper.jar b/jhipster/jhipster-uaa/uaa/.mvn/wrapper/maven-wrapper.jar new file mode 100644 index 0000000000..01e6799737 Binary files /dev/null and b/jhipster/jhipster-uaa/uaa/.mvn/wrapper/maven-wrapper.jar differ diff --git a/jhipster/jhipster-uaa/uaa/.mvn/wrapper/maven-wrapper.properties b/jhipster/jhipster-uaa/uaa/.mvn/wrapper/maven-wrapper.properties new file mode 100644 index 0000000000..00d32aab1d --- /dev/null +++ b/jhipster/jhipster-uaa/uaa/.mvn/wrapper/maven-wrapper.properties @@ -0,0 +1 @@ +distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.5.4/apache-maven-3.5.4-bin.zip \ No newline at end of file diff --git a/jhipster/jhipster-uaa/uaa/.yo-rc.json b/jhipster/jhipster-uaa/uaa/.yo-rc.json new file mode 100644 index 0000000000..3408ea052d --- /dev/null +++ b/jhipster/jhipster-uaa/uaa/.yo-rc.json @@ -0,0 +1,36 @@ +{ + "generator-jhipster": { + "promptValues": { + "packageName": "com.baeldung.jhipster.uaa", + "nativeLanguage": "en" + }, + "jhipsterVersion": "5.4.2", + "applicationType": "uaa", + "baseName": "uaa", + "packageName": "com.baeldung.jhipster.uaa", + "packageFolder": "com/baeldung/jhipster/uaa", + "serverPort": "9999", + "authenticationType": "uaa", + "cacheProvider": "hazelcast", + "enableHibernateCache": true, + "websocket": false, + "databaseType": "sql", + "devDatabaseType": "h2Disk", + "prodDatabaseType": "mysql", + "searchEngine": false, + "messageBroker": false, + "serviceDiscoveryType": "eureka", + "buildTool": "maven", + "enableSwaggerCodegen": false, + "jwtSecretKey": "ZTljMjA0NzA0OWE0MTVhM2Y2MjJkNzg2MzU4NDFhYTZhM2JlOGY4MmM0Y2M4ZTQ3NzdkNjVjZmJkMTFhOGU2MmY3MWMzNDg4OGY2OWI2Zjc4NTFhNDVkOTZlMDVhNzFkNDUyZjMzNDYxNGY5NWNmYTI4NzA2NzRkYzQ4Y2ZiZjU=", + "enableTranslation": true, + "languages": [ + "en" + ], + "testFrameworks": [], + "jhiPrefix": "jhi", + "clientPackageManager": "npm", + "nativeLanguage": "en", + "skipClient": true + } +} \ No newline at end of file diff --git a/jhipster/jhipster-uaa/uaa/README.md b/jhipster/jhipster-uaa/uaa/README.md new file mode 100644 index 0000000000..014c8ac5ad --- /dev/null +++ b/jhipster/jhipster-uaa/uaa/README.md @@ -0,0 +1,95 @@ +# uaa +This application was generated using JHipster 5.4.2, you can find documentation and help at [https://www.jhipster.tech/documentation-archive/v5.4.2](https://www.jhipster.tech/documentation-archive/v5.4.2). + +This is a "uaa" application intended to be part of a microservice architecture, please refer to the [Doing microservices with JHipster][] page of the documentation for more information. + +This is also a JHipster User Account and Authentication (UAA) Server, refer to [Using UAA for Microservice Security][] for details on how to secure JHipster microservices with OAuth2. +This application is configured for Service Discovery and Configuration with the JHipster-Registry. On launch, it will refuse to start if it is not able to connect to the JHipster-Registry at [http://localhost:8761](http://localhost:8761). For more information, read our documentation on [Service Discovery and Configuration with the JHipster-Registry][]. + +## Development + +To start your application in the dev profile, simply run: + + ./mvnw + + +For further instructions on how to develop with JHipster, have a look at [Using JHipster in development][]. + + + +## Building for production + +To optimize the uaa application for production, run: + + ./mvnw -Pprod clean package + +To ensure everything worked, run: + + java -jar target/*.war + + +Refer to [Using JHipster in production][] for more details. + +## Testing + +To launch your application's tests, run: + + ./mvnw clean test + +For more information, refer to the [Running tests page][]. + +### Code quality + +Sonar is used to analyse code quality. You can start a local Sonar server (accessible on http://localhost:9001) with: + +``` +docker-compose -f src/main/docker/sonar.yml up -d +``` + +Then, run a Sonar analysis: + +``` +./mvnw -Pprod clean test sonar:sonar +``` + +For more information, refer to the [Code quality page][]. + +## Using Docker to simplify development (optional) + +You can use Docker to improve your JHipster development experience. A number of docker-compose configuration are available in the [src/main/docker](src/main/docker) folder to launch required third party services. + +For example, to start a mysql database in a docker container, run: + + docker-compose -f src/main/docker/mysql.yml up -d + +To stop it and remove the container, run: + + docker-compose -f src/main/docker/mysql.yml down + +You can also fully dockerize your application and all the services that it depends on. +To achieve this, first build a docker image of your app by running: + + ./mvnw package -Pprod jib:dockerBuild + +Then run: + + docker-compose -f src/main/docker/app.yml up -d + +For more information refer to [Using Docker and Docker-Compose][], this page also contains information on the docker-compose sub-generator (`jhipster docker-compose`), which is able to generate docker configurations for one or several JHipster applications. + +## Continuous Integration (optional) + +To configure CI for your project, run the ci-cd sub-generator (`jhipster ci-cd`), this will let you generate configuration files for a number of Continuous Integration systems. Consult the [Setting up Continuous Integration][] page for more information. + +[JHipster Homepage and latest documentation]: https://www.jhipster.tech +[JHipster 5.4.2 archive]: https://www.jhipster.tech/documentation-archive/v5.4.2 +[Doing microservices with JHipster]: https://www.jhipster.tech/documentation-archive/v5.4.2/microservices-architecture/ +[Using UAA for Microservice Security]: https://www.jhipster.tech/documentation-archive/v5.4.2/using-uaa/[Using JHipster in development]: https://www.jhipster.tech/documentation-archive/v5.4.2/development/ +[Service Discovery and Configuration with the JHipster-Registry]: https://www.jhipster.tech/documentation-archive/v5.4.2/microservices-architecture/#jhipster-registry +[Using Docker and Docker-Compose]: https://www.jhipster.tech/documentation-archive/v5.4.2/docker-compose +[Using JHipster in production]: https://www.jhipster.tech/documentation-archive/v5.4.2/production/ +[Running tests page]: https://www.jhipster.tech/documentation-archive/v5.4.2/running-tests/ +[Code quality page]: https://www.jhipster.tech/documentation-archive/v5.4.2/code-quality/ +[Setting up Continuous Integration]: https://www.jhipster.tech/documentation-archive/v5.4.2/setting-up-ci/ + + diff --git a/jhipster/jhipster-uaa/uaa/mvnw b/jhipster/jhipster-uaa/uaa/mvnw new file mode 100644 index 0000000000..5551fde8e7 --- /dev/null +++ b/jhipster/jhipster-uaa/uaa/mvnw @@ -0,0 +1,286 @@ +#!/bin/sh +# ---------------------------------------------------------------------------- +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# ---------------------------------------------------------------------------- + +# ---------------------------------------------------------------------------- +# Maven2 Start Up Batch script +# +# Required ENV vars: +# ------------------ +# JAVA_HOME - location of a JDK home dir +# +# Optional ENV vars +# ----------------- +# M2_HOME - location of maven2's installed home dir +# MAVEN_OPTS - parameters passed to the Java VM when running Maven +# e.g. to debug Maven itself, use +# set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 +# MAVEN_SKIP_RC - flag to disable loading of mavenrc files +# ---------------------------------------------------------------------------- + +if [ -z "$MAVEN_SKIP_RC" ] ; then + + if [ -f /etc/mavenrc ] ; then + . /etc/mavenrc + fi + + if [ -f "$HOME/.mavenrc" ] ; then + . "$HOME/.mavenrc" + fi + +fi + +# OS specific support. $var _must_ be set to either true or false. +cygwin=false; +darwin=false; +mingw=false +case "`uname`" in + CYGWIN*) cygwin=true ;; + MINGW*) mingw=true;; + Darwin*) darwin=true + # Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home + # See https://developer.apple.com/library/mac/qa/qa1170/_index.html + if [ -z "$JAVA_HOME" ]; then + if [ -x "/usr/libexec/java_home" ]; then + export JAVA_HOME="`/usr/libexec/java_home`" + else + export JAVA_HOME="/Library/Java/Home" + fi + fi + ;; +esac + +if [ -z "$JAVA_HOME" ] ; then + if [ -r /etc/gentoo-release ] ; then + JAVA_HOME=`java-config --jre-home` + fi +fi + +if [ -z "$M2_HOME" ] ; then + ## resolve links - $0 may be a link to maven's home + PRG="$0" + + # need this for relative symlinks + while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG="`dirname "$PRG"`/$link" + fi + done + + saveddir=`pwd` + + M2_HOME=`dirname "$PRG"`/.. + + # make it fully qualified + M2_HOME=`cd "$M2_HOME" && pwd` + + cd "$saveddir" + # echo Using m2 at $M2_HOME +fi + +# For Cygwin, ensure paths are in UNIX format before anything is touched +if $cygwin ; then + [ -n "$M2_HOME" ] && + M2_HOME=`cygpath --unix "$M2_HOME"` + [ -n "$JAVA_HOME" ] && + JAVA_HOME=`cygpath --unix "$JAVA_HOME"` + [ -n "$CLASSPATH" ] && + CLASSPATH=`cygpath --path --unix "$CLASSPATH"` +fi + +# For Mingw, ensure paths are in UNIX format before anything is touched +if $mingw ; then + [ -n "$M2_HOME" ] && + M2_HOME="`(cd "$M2_HOME"; pwd)`" + [ -n "$JAVA_HOME" ] && + JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`" + # TODO classpath? +fi + +if [ -z "$JAVA_HOME" ]; then + javaExecutable="`which javac`" + if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then + # readlink(1) is not available as standard on Solaris 10. + readLink=`which readlink` + if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then + if $darwin ; then + javaHome="`dirname \"$javaExecutable\"`" + javaExecutable="`cd \"$javaHome\" && pwd -P`/javac" + else + javaExecutable="`readlink -f \"$javaExecutable\"`" + fi + javaHome="`dirname \"$javaExecutable\"`" + javaHome=`expr "$javaHome" : '\(.*\)/bin'` + JAVA_HOME="$javaHome" + export JAVA_HOME + fi + fi +fi + +if [ -z "$JAVACMD" ] ; then + if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + else + JAVACMD="`which java`" + fi +fi + +if [ ! -x "$JAVACMD" ] ; then + echo "Error: JAVA_HOME is not defined correctly." >&2 + echo " We cannot execute $JAVACMD" >&2 + exit 1 +fi + +if [ -z "$JAVA_HOME" ] ; then + echo "Warning: JAVA_HOME environment variable is not set." +fi + +CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher + +# traverses directory structure from process work directory to filesystem root +# first directory with .mvn subdirectory is considered project base directory +find_maven_basedir() { + + if [ -z "$1" ] + then + echo "Path not specified to find_maven_basedir" + return 1 + fi + + basedir="$1" + wdir="$1" + while [ "$wdir" != '/' ] ; do + if [ -d "$wdir"/.mvn ] ; then + basedir=$wdir + break + fi + # workaround for JBEAP-8937 (on Solaris 10/Sparc) + if [ -d "${wdir}" ]; then + wdir=`cd "$wdir/.."; pwd` + fi + # end of workaround + done + echo "${basedir}" +} + +# concatenates all lines of a file +concat_lines() { + if [ -f "$1" ]; then + echo "$(tr -s '\n' ' ' < "$1")" + fi +} + +BASE_DIR=`find_maven_basedir "$(pwd)"` +if [ -z "$BASE_DIR" ]; then + exit 1; +fi + +########################################################################################## +# Extension to allow automatically downloading the maven-wrapper.jar from Maven-central +# This allows using the maven wrapper in projects that prohibit checking in binary data. +########################################################################################## +if [ -r "$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" ]; then + if [ "$MVNW_VERBOSE" = true ]; then + echo "Found .mvn/wrapper/maven-wrapper.jar" + fi +else + if [ "$MVNW_VERBOSE" = true ]; then + echo "Couldn't find .mvn/wrapper/maven-wrapper.jar, downloading it ..." + fi + jarUrl="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.4.2/maven-wrapper-0.4.2.jar" + while IFS="=" read key value; do + case "$key" in (wrapperUrl) jarUrl="$value"; break ;; + esac + done < "$BASE_DIR/.mvn/wrapper/maven-wrapper.properties" + if [ "$MVNW_VERBOSE" = true ]; then + echo "Downloading from: $jarUrl" + fi + wrapperJarPath="$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" + + if command -v wget > /dev/null; then + if [ "$MVNW_VERBOSE" = true ]; then + echo "Found wget ... using wget" + fi + wget "$jarUrl" -O "$wrapperJarPath" + elif command -v curl > /dev/null; then + if [ "$MVNW_VERBOSE" = true ]; then + echo "Found curl ... using curl" + fi + curl -o "$wrapperJarPath" "$jarUrl" + else + if [ "$MVNW_VERBOSE" = true ]; then + echo "Falling back to using Java to download" + fi + javaClass="$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.java" + if [ -e "$javaClass" ]; then + if [ ! -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then + if [ "$MVNW_VERBOSE" = true ]; then + echo " - Compiling MavenWrapperDownloader.java ..." + fi + # Compiling the Java class + ("$JAVA_HOME/bin/javac" "$javaClass") + fi + if [ -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then + # Running the downloader + if [ "$MVNW_VERBOSE" = true ]; then + echo " - Running MavenWrapperDownloader.java ..." + fi + ("$JAVA_HOME/bin/java" -cp .mvn/wrapper MavenWrapperDownloader "$MAVEN_PROJECTBASEDIR") + fi + fi + fi +fi +########################################################################################## +# End of extension +########################################################################################## + +export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"} +if [ "$MVNW_VERBOSE" = true ]; then + echo $MAVEN_PROJECTBASEDIR +fi +MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS" + +# For Cygwin, switch paths to Windows format before running java +if $cygwin; then + [ -n "$M2_HOME" ] && + M2_HOME=`cygpath --path --windows "$M2_HOME"` + [ -n "$JAVA_HOME" ] && + JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"` + [ -n "$CLASSPATH" ] && + CLASSPATH=`cygpath --path --windows "$CLASSPATH"` + [ -n "$MAVEN_PROJECTBASEDIR" ] && + MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"` +fi + +WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain + +exec "$JAVACMD" \ + $MAVEN_OPTS \ + -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \ + "-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \ + ${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@" diff --git a/jhipster/jhipster-uaa/uaa/mvnw.cmd b/jhipster/jhipster-uaa/uaa/mvnw.cmd new file mode 100644 index 0000000000..e5cfb0ae9e --- /dev/null +++ b/jhipster/jhipster-uaa/uaa/mvnw.cmd @@ -0,0 +1,161 @@ +@REM ---------------------------------------------------------------------------- +@REM Licensed to the Apache Software Foundation (ASF) under one +@REM or more contributor license agreements. See the NOTICE file +@REM distributed with this work for additional information +@REM regarding copyright ownership. The ASF licenses this file +@REM to you under the Apache License, Version 2.0 (the +@REM "License"); you may not use this file except in compliance +@REM with the License. You may obtain a copy of the License at +@REM +@REM http://www.apache.org/licenses/LICENSE-2.0 +@REM +@REM Unless required by applicable law or agreed to in writing, +@REM software distributed under the License is distributed on an +@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +@REM KIND, either express or implied. See the License for the +@REM specific language governing permissions and limitations +@REM under the License. +@REM ---------------------------------------------------------------------------- + +@REM ---------------------------------------------------------------------------- +@REM Maven2 Start Up Batch script +@REM +@REM Required ENV vars: +@REM JAVA_HOME - location of a JDK home dir +@REM +@REM Optional ENV vars +@REM M2_HOME - location of maven2's installed home dir +@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands +@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a key stroke before ending +@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven +@REM e.g. to debug Maven itself, use +@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 +@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files +@REM ---------------------------------------------------------------------------- + +@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on' +@echo off +@REM set title of command window +title %0 +@REM enable echoing my setting MAVEN_BATCH_ECHO to 'on' +@if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO% + +@REM set %HOME% to equivalent of $HOME +if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%") + +@REM Execute a user defined script before this one +if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre +@REM check for pre script, once with legacy .bat ending and once with .cmd ending +if exist "%HOME%\mavenrc_pre.bat" call "%HOME%\mavenrc_pre.bat" +if exist "%HOME%\mavenrc_pre.cmd" call "%HOME%\mavenrc_pre.cmd" +:skipRcPre + +@setlocal + +set ERROR_CODE=0 + +@REM To isolate internal variables from possible post scripts, we use another setlocal +@setlocal + +@REM ==== START VALIDATION ==== +if not "%JAVA_HOME%" == "" goto OkJHome + +echo. +echo Error: JAVA_HOME not found in your environment. >&2 +echo Please set the JAVA_HOME variable in your environment to match the >&2 +echo location of your Java installation. >&2 +echo. +goto error + +:OkJHome +if exist "%JAVA_HOME%\bin\java.exe" goto init + +echo. +echo Error: JAVA_HOME is set to an invalid directory. >&2 +echo JAVA_HOME = "%JAVA_HOME%" >&2 +echo Please set the JAVA_HOME variable in your environment to match the >&2 +echo location of your Java installation. >&2 +echo. +goto error + +@REM ==== END VALIDATION ==== + +:init + +@REM Find the project base dir, i.e. the directory that contains the folder ".mvn". +@REM Fallback to current working directory if not found. + +set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR% +IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir + +set EXEC_DIR=%CD% +set WDIR=%EXEC_DIR% +:findBaseDir +IF EXIST "%WDIR%"\.mvn goto baseDirFound +cd .. +IF "%WDIR%"=="%CD%" goto baseDirNotFound +set WDIR=%CD% +goto findBaseDir + +:baseDirFound +set MAVEN_PROJECTBASEDIR=%WDIR% +cd "%EXEC_DIR%" +goto endDetectBaseDir + +:baseDirNotFound +set MAVEN_PROJECTBASEDIR=%EXEC_DIR% +cd "%EXEC_DIR%" + +:endDetectBaseDir + +IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig + +@setlocal EnableExtensions EnableDelayedExpansion +for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a +@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS% + +:endReadAdditionalConfig + +SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe" +set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar" +set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain + +set DOWNLOAD_URL="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.4.2/maven-wrapper-0.4.2.jar" +FOR /F "tokens=1,2 delims==" %%A IN (%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties) DO ( + IF "%%A"=="wrapperUrl" SET DOWNLOAD_URL=%%B +) + +@REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central +@REM This allows using the maven wrapper in projects that prohibit checking in binary data. +if exist %WRAPPER_JAR% ( + echo Found %WRAPPER_JAR% +) else ( + echo Couldn't find %WRAPPER_JAR%, downloading it ... + echo Downloading from: %DOWNLOAD_URL% + powershell -Command "(New-Object Net.WebClient).DownloadFile('%DOWNLOAD_URL%', '%WRAPPER_JAR%')" + echo Finished downloading %WRAPPER_JAR% +) +@REM End of extension + +%MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %* +if ERRORLEVEL 1 goto error +goto end + +:error +set ERROR_CODE=1 + +:end +@endlocal & set ERROR_CODE=%ERROR_CODE% + +if not "%MAVEN_SKIP_RC%" == "" goto skipRcPost +@REM check for post script, once with legacy .bat ending and once with .cmd ending +if exist "%HOME%\mavenrc_post.bat" call "%HOME%\mavenrc_post.bat" +if exist "%HOME%\mavenrc_post.cmd" call "%HOME%\mavenrc_post.cmd" +:skipRcPost + +@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on' +if "%MAVEN_BATCH_PAUSE%" == "on" pause + +if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE% + +exit /B %ERROR_CODE% diff --git a/jhipster/jhipster-uaa/uaa/package-lock.json b/jhipster/jhipster-uaa/uaa/package-lock.json new file mode 100644 index 0000000000..4ef0a226b9 --- /dev/null +++ b/jhipster/jhipster-uaa/uaa/package-lock.json @@ -0,0 +1,4409 @@ +{ + "name": "uaa", + "version": "0.0.0", + "lockfileVersion": 1, + "requires": true, + "dependencies": { + "@mrmlnc/readdir-enhanced": { + "version": "2.2.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/@mrmlnc/readdir-enhanced/-/readdir-enhanced-2.2.1.tgz", + "integrity": "sha512-bPHp6Ji8b41szTOcaP63VlnbbO5Ny6dwAATtY6JTjh5N2OLrb5Qk/Th5cRkRQhkWCt+EJsYrNB0MiL+Gpn6e3g==", + "dev": true, + "requires": { + "call-me-maybe": "^1.0.1", + "glob-to-regexp": "^0.3.0" + } + }, + "@nodelib/fs.stat": { + "version": "1.1.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/@nodelib/fs.stat/-/fs.stat-1.1.2.tgz", + "integrity": "sha512-yprFYuno9FtNsSHVlSWd+nRlmGoAbqbeCwOryP6sC/zoCjhpArcRMYp19EvpSUSizJAlsXEwJv+wcWS9XaXdMw==", + "dev": true + }, + "ajv": { + "version": "5.5.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/ajv/-/ajv-5.5.2.tgz", + "integrity": "sha1-c7Xuyj+rZT49P5Qis0GtQiBdyWU=", + "dev": true, + "requires": { + "co": "^4.6.0", + "fast-deep-equal": "^1.0.0", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.3.0" + } + }, + "ansi": { + "version": "0.3.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/ansi/-/ansi-0.3.1.tgz", + "integrity": "sha1-DELU+xcWDVqa8eSEus4cZpIsGyE=", + "dev": true + }, + "ansi-cyan": { + "version": "0.1.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/ansi-cyan/-/ansi-cyan-0.1.1.tgz", + "integrity": "sha1-U4rlKK+JgvKK4w2G8vF0VtJgmHM=", + "dev": true, + "requires": { + "ansi-wrap": "0.1.0" + } + }, + "ansi-escapes": { + "version": "3.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/ansi-escapes/-/ansi-escapes-3.1.0.tgz", + "integrity": "sha512-UgAb8H9D41AQnu/PbWlCofQVcnV4Gs2bBJi9eZPxfU/hgglFh3SMDMENRIqdr7H6XFnXdoknctFByVsCOotTVw==", + "dev": true + }, + "ansi-red": { + "version": "0.1.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/ansi-red/-/ansi-red-0.1.1.tgz", + "integrity": "sha1-jGOPnRCAgAo1PJwoyKgcpHBdlGw=", + "dev": true, + "requires": { + "ansi-wrap": "0.1.0" + } + }, + "ansi-regex": { + "version": "3.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/ansi-regex/-/ansi-regex-3.0.0.tgz", + "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", + "dev": true + }, + "ansi-styles": { + "version": "3.2.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, + "requires": { + "color-convert": "^1.9.0" + } + }, + "ansi-wrap": { + "version": "0.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/ansi-wrap/-/ansi-wrap-0.1.0.tgz", + "integrity": "sha1-qCJQ3bABXponyoLoLqYDu/pF768=", + "dev": true + }, + "are-we-there-yet": { + "version": "1.1.5", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/are-we-there-yet/-/are-we-there-yet-1.1.5.tgz", + "integrity": "sha512-5hYdAkZlcG8tOLujVDTgCT+uPX0VnpAH28gWsLfzpXYm7wP6mp5Q/gYyR7YQ0cKVJcXJnl3j2kpBan13PtQf6w==", + "dev": true, + "requires": { + "delegates": "^1.0.0", + "readable-stream": "^2.0.6" + } + }, + "argparse": { + "version": "1.0.10", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/argparse/-/argparse-1.0.10.tgz", + "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", + "dev": true, + "requires": { + "sprintf-js": "~1.0.2" + } + }, + "arr-diff": { + "version": "1.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/arr-diff/-/arr-diff-1.1.0.tgz", + "integrity": "sha1-aHwydYFjWI/vfeezb6vklesaOZo=", + "dev": true, + "requires": { + "arr-flatten": "^1.0.1", + "array-slice": "^0.2.3" + } + }, + "arr-flatten": { + "version": "1.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/arr-flatten/-/arr-flatten-1.1.0.tgz", + "integrity": "sha512-L3hKV5R/p5o81R7O02IGnwpDmkp6E982XhtbuwSe3O4qOtMMMtodicASA1Cny2U+aCXcNpml+m4dPsvsJ3jatg==", + "dev": true + }, + "arr-union": { + "version": "2.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/arr-union/-/arr-union-2.1.0.tgz", + "integrity": "sha1-IPnqtexw9cfSFbEHexw5Fh0pLH0=", + "dev": true + }, + "array-differ": { + "version": "1.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/array-differ/-/array-differ-1.0.0.tgz", + "integrity": "sha1-7/UuN1gknTO+QCuLuOVkuytdQDE=", + "dev": true + }, + "array-find-index": { + "version": "1.0.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/array-find-index/-/array-find-index-1.0.2.tgz", + "integrity": "sha1-3wEKoSh+Fku9pvlyOwqWoexBh6E=", + "dev": true + }, + "array-slice": { + "version": "0.2.3", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/array-slice/-/array-slice-0.2.3.tgz", + "integrity": "sha1-3Tz7gO15c6dRF82sabC5nshhhvU=", + "dev": true + }, + "array-union": { + "version": "1.0.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/array-union/-/array-union-1.0.2.tgz", + "integrity": "sha1-mjRBDk9OPaI96jdb5b5w8kd47Dk=", + "dev": true, + "requires": { + "array-uniq": "^1.0.1" + } + }, + "array-uniq": { + "version": "1.0.3", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/array-uniq/-/array-uniq-1.0.3.tgz", + "integrity": "sha1-r2rId6Jcx/dOBYiUdThY39sk/bY=", + "dev": true + }, + "array-unique": { + "version": "0.3.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/array-unique/-/array-unique-0.3.2.tgz", + "integrity": "sha1-qJS3XUvE9s1nnvMkSp/Y9Gri1Cg=", + "dev": true + }, + "arrify": { + "version": "1.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/arrify/-/arrify-1.0.1.tgz", + "integrity": "sha1-iYUI2iIm84DfkEcoRWhJwVAaSw0=", + "dev": true + }, + "asn1": { + "version": "0.2.4", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/asn1/-/asn1-0.2.4.tgz", + "integrity": "sha512-jxwzQpLQjSmWXgwaCZE9Nz+glAG01yF1QnWgbhGwHI5A6FRIEY6IVqtHhIepHqI7/kyEyQEagBC5mBEFlIYvdg==", + "dev": true, + "requires": { + "safer-buffer": "~2.1.0" + } + }, + "assert-plus": { + "version": "1.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/assert-plus/-/assert-plus-1.0.0.tgz", + "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=", + "dev": true + }, + "assign-symbols": { + "version": "1.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/assign-symbols/-/assign-symbols-1.0.0.tgz", + "integrity": "sha1-WWZ/QfrdTyDMvCu5a41Pf3jsA2c=", + "dev": true + }, + "async": { + "version": "2.6.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/async/-/async-2.6.1.tgz", + "integrity": "sha512-fNEiL2+AZt6AlAw/29Cr0UDe4sRAHCpEHh54WMz+Bb7QfNcFw4h3loofyJpLeQs4Yx7yuqu/2dLgM5hKOs6HlQ==", + "dev": true, + "requires": { + "lodash": "^4.17.10" + } + }, + "asynckit": { + "version": "0.4.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/asynckit/-/asynckit-0.4.0.tgz", + "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=", + "dev": true + }, + "atob": { + "version": "2.1.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/atob/-/atob-2.1.2.tgz", + "integrity": "sha512-Wm6ukoaOGJi/73p/cl2GvLjTI5JM1k/O14isD73YML8StrH/7/lRFgmg8nICZgD3bZZvjwCGxtMOD3wWNAu8cg==", + "dev": true + }, + "aws-sign2": { + "version": "0.7.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/aws-sign2/-/aws-sign2-0.7.0.tgz", + "integrity": "sha1-tG6JCTSpWR8tL2+G1+ap8bP+dqg=", + "dev": true + }, + "aws4": { + "version": "1.8.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/aws4/-/aws4-1.8.0.tgz", + "integrity": "sha512-ReZxvNHIOv88FlT7rxcXIIC0fPt4KZqZbOlivyWtXLt8ESx84zd3kMC6iK5jVeS2qt+g7ftS7ye4fi06X5rtRQ==", + "dev": true + }, + "axios": { + "version": "0.18.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/axios/-/axios-0.18.0.tgz", + "integrity": "sha1-MtU+SFHv3AoRmTts0AB4nXDAUQI=", + "dev": true, + "requires": { + "follow-redirects": "^1.3.0", + "is-buffer": "^1.1.5" + } + }, + "balanced-match": { + "version": "1.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/balanced-match/-/balanced-match-1.0.0.tgz", + "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=", + "dev": true + }, + "base": { + "version": "0.11.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/base/-/base-0.11.2.tgz", + "integrity": "sha512-5T6P4xPgpp0YDFvSWwEZ4NoE3aM4QBQXDzmVbraCkFj8zHM+mba8SyqB5DbZWyR7mYHo6Y7BdQo3MoA4m0TeQg==", + "dev": true, + "requires": { + "cache-base": "^1.0.1", + "class-utils": "^0.3.5", + "component-emitter": "^1.2.1", + "define-property": "^1.0.0", + "isobject": "^3.0.1", + "mixin-deep": "^1.2.0", + "pascalcase": "^0.1.1" + }, + "dependencies": { + "define-property": { + "version": "1.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/define-property/-/define-property-1.0.0.tgz", + "integrity": "sha1-dp66rz9KY6rTr56NMEybvnm/sOY=", + "dev": true, + "requires": { + "is-descriptor": "^1.0.0" + } + }, + "is-accessor-descriptor": { + "version": "1.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz", + "integrity": "sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ==", + "dev": true, + "requires": { + "kind-of": "^6.0.0" + } + }, + "is-data-descriptor": { + "version": "1.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz", + "integrity": "sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ==", + "dev": true, + "requires": { + "kind-of": "^6.0.0" + } + }, + "is-descriptor": { + "version": "1.0.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/is-descriptor/-/is-descriptor-1.0.2.tgz", + "integrity": "sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg==", + "dev": true, + "requires": { + "is-accessor-descriptor": "^1.0.0", + "is-data-descriptor": "^1.0.0", + "kind-of": "^6.0.2" + } + }, + "kind-of": { + "version": "6.0.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/kind-of/-/kind-of-6.0.2.tgz", + "integrity": "sha512-s5kLOcnH0XqDO+FvuaLX8DDjZ18CGFk7VygH40QoKPUQhW4e2rvM0rwUq0t8IQDOwYSeLK01U90OjzBTme2QqA==", + "dev": true + } + } + }, + "bcrypt-pbkdf": { + "version": "1.0.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz", + "integrity": "sha1-pDAdOJtqQ/m2f/PKEaP2Y342Dp4=", + "dev": true, + "requires": { + "tweetnacl": "^0.14.3" + } + }, + "binaryextensions": { + "version": "2.1.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/binaryextensions/-/binaryextensions-2.1.1.tgz", + "integrity": "sha512-XBaoWE9RW8pPdPQNibZsW2zh8TW6gcarXp1FZPwT8Uop8ScSNldJEWf2k9l3HeTqdrEwsOsFcq74RiJECW34yA==", + "dev": true + }, + "brace-expansion": { + "version": "1.1.11", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dev": true, + "requires": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "braces": { + "version": "2.3.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/braces/-/braces-2.3.2.tgz", + "integrity": "sha512-aNdbnj9P8PjdXU4ybaWLK2IF3jc/EoDYbC7AazW6to3TRsfXxscC9UXOB5iDiEQrkyIbWp2SLQda4+QAa7nc3w==", + "dev": true, + "requires": { + "arr-flatten": "^1.1.0", + "array-unique": "^0.3.2", + "extend-shallow": "^2.0.1", + "fill-range": "^4.0.0", + "isobject": "^3.0.1", + "repeat-element": "^1.1.2", + "snapdragon": "^0.8.1", + "snapdragon-node": "^2.0.1", + "split-string": "^3.0.2", + "to-regex": "^3.0.1" + }, + "dependencies": { + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "dev": true, + "requires": { + "is-extendable": "^0.1.0" + } + } + } + }, + "buffer-alloc": { + "version": "1.2.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/buffer-alloc/-/buffer-alloc-1.2.0.tgz", + "integrity": "sha512-CFsHQgjtW1UChdXgbyJGtnm+O/uLQeZdtbDo8mfUgYXCHSM1wgrVxXm6bSyrUuErEb+4sYVGCzASBRot7zyrow==", + "dev": true, + "requires": { + "buffer-alloc-unsafe": "^1.1.0", + "buffer-fill": "^1.0.0" + } + }, + "buffer-alloc-unsafe": { + "version": "1.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/buffer-alloc-unsafe/-/buffer-alloc-unsafe-1.1.0.tgz", + "integrity": "sha512-TEM2iMIEQdJ2yjPJoSIsldnleVaAk1oW3DBVUykyOLsEsFmEc9kn+SFFPz+gl54KQNxlDnAwCXosOS9Okx2xAg==", + "dev": true + }, + "buffer-fill": { + "version": "1.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/buffer-fill/-/buffer-fill-1.0.0.tgz", + "integrity": "sha1-+PeLdniYiO858gXNY39o5wISKyw=", + "dev": true + }, + "buffer-from": { + "version": "1.1.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/buffer-from/-/buffer-from-1.1.1.tgz", + "integrity": "sha512-MQcXEUbCKtEo7bhqEs6560Hyd4XaovZlO/k9V3hjVUF/zwW7KBVdSK4gIt/bzwS9MbR5qob+F5jusZsb0YQK2A==", + "dev": true + }, + "builtin-modules": { + "version": "1.1.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/builtin-modules/-/builtin-modules-1.1.1.tgz", + "integrity": "sha1-Jw8HbFpywC9bZaR9+Uxf46J4iS8=", + "dev": true + }, + "cache-base": { + "version": "1.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/cache-base/-/cache-base-1.0.1.tgz", + "integrity": "sha512-AKcdTnFSWATd5/GCPRxr2ChwIJ85CeyrEyjRHlKxQ56d4XJMGym0uAiKn0xbLOGOl3+yRpOTi484dVCEc5AUzQ==", + "dev": true, + "requires": { + "collection-visit": "^1.0.0", + "component-emitter": "^1.2.1", + "get-value": "^2.0.6", + "has-value": "^1.0.0", + "isobject": "^3.0.1", + "set-value": "^2.0.0", + "to-object-path": "^0.3.0", + "union-value": "^1.0.0", + "unset-value": "^1.0.0" + } + }, + "call-me-maybe": { + "version": "1.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/call-me-maybe/-/call-me-maybe-1.0.1.tgz", + "integrity": "sha1-JtII6onje1y95gJQoV8DHBak1ms=", + "dev": true + }, + "camelcase": { + "version": "4.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/camelcase/-/camelcase-4.1.0.tgz", + "integrity": "sha1-1UVjW+HjPFQmScaRc+Xeas+uNN0=", + "dev": true + }, + "camelcase-keys": { + "version": "4.2.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/camelcase-keys/-/camelcase-keys-4.2.0.tgz", + "integrity": "sha1-oqpfsa9oh1glnDLBQUJteJI7m3c=", + "dev": true, + "requires": { + "camelcase": "^4.1.0", + "map-obj": "^2.0.0", + "quick-lru": "^1.0.0" + } + }, + "caseless": { + "version": "0.12.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/caseless/-/caseless-0.12.0.tgz", + "integrity": "sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw=", + "dev": true + }, + "chalk": { + "version": "2.4.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/chalk/-/chalk-2.4.1.tgz", + "integrity": "sha512-ObN6h1v2fTJSmUXoS3nMQ92LbDK9be4TV+6G+omQlGJFdcUX5heKi1LZ1YnRMIgwTLEj3E24bT6tYni50rlCfQ==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + } + }, + "chardet": { + "version": "0.4.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/chardet/-/chardet-0.4.2.tgz", + "integrity": "sha1-tUc7M9yXxCTl2Y3IfVXU2KKci/I=", + "dev": true + }, + "chevrotain": { + "version": "4.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/chevrotain/-/chevrotain-4.1.0.tgz", + "integrity": "sha512-iwuK4FOV+vZlvKonoXVw6G+rXJm4jWk17aJFkm6FloVYcVSrAaJLdCdQo+IIyX98jm0WJVcdK9cllRZQpNBnBg==", + "dev": true, + "requires": { + "regexp-to-ast": "0.3.5" + } + }, + "class-utils": { + "version": "0.3.6", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/class-utils/-/class-utils-0.3.6.tgz", + "integrity": "sha512-qOhPa/Fj7s6TY8H8esGu5QNpMMQxz79h+urzrNYN6mn+9BnxlDGf5QZ+XeCDsxSjPqsSR56XOZOJmpeurnLMeg==", + "dev": true, + "requires": { + "arr-union": "^3.1.0", + "define-property": "^0.2.5", + "isobject": "^3.0.0", + "static-extend": "^0.1.1" + }, + "dependencies": { + "arr-union": { + "version": "3.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/arr-union/-/arr-union-3.1.0.tgz", + "integrity": "sha1-45sJrqne+Gao8gbiiK9jkZuuOcQ=", + "dev": true + }, + "define-property": { + "version": "0.2.5", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/define-property/-/define-property-0.2.5.tgz", + "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", + "dev": true, + "requires": { + "is-descriptor": "^0.1.0" + } + } + } + }, + "cli-cursor": { + "version": "2.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/cli-cursor/-/cli-cursor-2.1.0.tgz", + "integrity": "sha1-s12sN2R5+sw+lHR9QdDQ9SOP/LU=", + "dev": true, + "requires": { + "restore-cursor": "^2.0.0" + } + }, + "cli-table": { + "version": "0.3.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/cli-table/-/cli-table-0.3.1.tgz", + "integrity": "sha1-9TsFJmqLGguTSz0IIebi3FkUriM=", + "dev": true, + "requires": { + "colors": "1.0.3" + }, + "dependencies": { + "colors": { + "version": "1.0.3", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/colors/-/colors-1.0.3.tgz", + "integrity": "sha1-BDP0TYCWgP3rYO0mDxsMJi6CpAs=", + "dev": true + } + } + }, + "cli-width": { + "version": "2.2.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/cli-width/-/cli-width-2.2.0.tgz", + "integrity": "sha1-/xnt6Kml5XkyQUewwR8PvLq+1jk=", + "dev": true + }, + "clone": { + "version": "1.0.4", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/clone/-/clone-1.0.4.tgz", + "integrity": "sha1-2jCcwmPfFZlMaIypAheco8fNfH4=", + "dev": true + }, + "clone-buffer": { + "version": "1.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/clone-buffer/-/clone-buffer-1.0.0.tgz", + "integrity": "sha1-4+JbIHrE5wGvch4staFnksrD3Fg=", + "dev": true + }, + "clone-stats": { + "version": "0.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/clone-stats/-/clone-stats-0.0.1.tgz", + "integrity": "sha1-uI+UqCzzi4eR1YBG6kAprYjKmdE=", + "dev": true + }, + "cloneable-readable": { + "version": "1.1.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/cloneable-readable/-/cloneable-readable-1.1.2.tgz", + "integrity": "sha512-Bq6+4t+lbM8vhTs/Bef5c5AdEMtapp/iFb6+s4/Hh9MVTt8OLKH7ZOOZSCT+Ys7hsHvqv0GuMPJ1lnQJVHvxpg==", + "dev": true, + "requires": { + "inherits": "^2.0.1", + "process-nextick-args": "^2.0.0", + "readable-stream": "^2.3.5" + } + }, + "co": { + "version": "4.6.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/co/-/co-4.6.0.tgz", + "integrity": "sha1-bqa989hTrlTMuOR7+gvz+QMfsYQ=", + "dev": true + }, + "code-point-at": { + "version": "1.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/code-point-at/-/code-point-at-1.1.0.tgz", + "integrity": "sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c=", + "dev": true + }, + "collection-visit": { + "version": "1.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/collection-visit/-/collection-visit-1.0.0.tgz", + "integrity": "sha1-S8A3PBZLwykbTTaMgpzxqApZ3KA=", + "dev": true, + "requires": { + "map-visit": "^1.0.0", + "object-visit": "^1.0.0" + } + }, + "color": { + "version": "3.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/color/-/color-3.0.0.tgz", + "integrity": "sha512-jCpd5+s0s0t7p3pHQKpnJ0TpQKKdleP71LWcA0aqiljpiuAkOSUFN/dyH8ZwF0hRmFlrIuRhufds1QyEP9EB+w==", + "dev": true, + "requires": { + "color-convert": "^1.9.1", + "color-string": "^1.5.2" + } + }, + "color-convert": { + "version": "1.9.3", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/color-convert/-/color-convert-1.9.3.tgz", + "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", + "dev": true, + "requires": { + "color-name": "1.1.3" + } + }, + "color-name": { + "version": "1.1.3", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/color-name/-/color-name-1.1.3.tgz", + "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=", + "dev": true + }, + "color-string": { + "version": "1.5.3", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/color-string/-/color-string-1.5.3.tgz", + "integrity": "sha512-dC2C5qeWoYkxki5UAXapdjqO672AM4vZuPGRQfO8b5HKuKGBbKWpITyDYN7TOFKvRW7kOgAn3746clDBMDJyQw==", + "dev": true, + "requires": { + "color-name": "^1.0.0", + "simple-swizzle": "^0.2.2" + } + }, + "colornames": { + "version": "1.1.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/colornames/-/colornames-1.1.1.tgz", + "integrity": "sha1-+IiQMGhcfE/54qVZ9Qd+t2qBb5Y=", + "dev": true + }, + "colors": { + "version": "1.3.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/colors/-/colors-1.3.2.tgz", + "integrity": "sha512-rhP0JSBGYvpcNQj4s5AdShMeE5ahMop96cTeDl/v9qQQm2fYClE2QXZRi8wLzc+GmXSxdIqqbOIAhyObEXDbfQ==", + "dev": true + }, + "colorspace": { + "version": "1.1.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/colorspace/-/colorspace-1.1.1.tgz", + "integrity": "sha512-pI3btWyiuz7Ken0BWh9Elzsmv2bM9AhA7psXib4anUXy/orfZ/E0MbQwhSOG/9L8hLlalqrU0UhOuqxW1YjmVw==", + "dev": true, + "requires": { + "color": "3.0.x", + "text-hex": "1.0.x" + } + }, + "combined-stream": { + "version": "1.0.7", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/combined-stream/-/combined-stream-1.0.7.tgz", + "integrity": "sha512-brWl9y6vOB1xYPZcpZde3N9zDByXTosAeMDo4p1wzo6UMOX4vumB+TP1RZ76sfE6Md68Q0NJSrE/gbezd4Ul+w==", + "dev": true, + "requires": { + "delayed-stream": "~1.0.0" + } + }, + "commander": { + "version": "2.16.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/commander/-/commander-2.16.0.tgz", + "integrity": "sha512-sVXqklSaotK9at437sFlFpyOcJonxe0yST/AG9DkQKUdIE6IqGIMv4SfAQSKaJbSdVEJYItASCrBiVQHq1HQew==", + "dev": true + }, + "commondir": { + "version": "1.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/commondir/-/commondir-1.0.1.tgz", + "integrity": "sha1-3dgA2gxmEnOTzKWVDqloo6rxJTs=", + "dev": true + }, + "component-emitter": { + "version": "1.2.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/component-emitter/-/component-emitter-1.2.1.tgz", + "integrity": "sha1-E3kY1teCg/ffemt8WmPhQOaUJeY=", + "dev": true + }, + "concat-map": { + "version": "0.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", + "dev": true + }, + "concat-stream": { + "version": "1.6.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/concat-stream/-/concat-stream-1.6.2.tgz", + "integrity": "sha512-27HBghJxjiZtIk3Ycvn/4kbJk/1uZuJFfuPEns6LaEvpvG1f0hTea8lilrouyo9mVc2GWdcEZ8OLoGmSADlrCw==", + "dev": true, + "requires": { + "buffer-from": "^1.0.0", + "inherits": "^2.0.3", + "readable-stream": "^2.2.2", + "typedarray": "^0.0.6" + } + }, + "conf": { + "version": "2.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/conf/-/conf-2.0.0.tgz", + "integrity": "sha512-iCLzBsGFi8S73EANsEJZz0JnJ/e5VZef/kSaxydYZLAvw0rFNAUx5R7K5leC/CXXR2mZfXWhUvcZOO/dM2D5xg==", + "dev": true, + "requires": { + "dot-prop": "^4.1.0", + "env-paths": "^1.0.0", + "make-dir": "^1.0.0", + "pkg-up": "^2.0.0", + "write-file-atomic": "^2.3.0" + } + }, + "copy-descriptor": { + "version": "0.1.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/copy-descriptor/-/copy-descriptor-0.1.1.tgz", + "integrity": "sha1-Z29us8OZl8LuGsOpJP1hJHSPV40=", + "dev": true + }, + "core-util-is": { + "version": "1.0.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/core-util-is/-/core-util-is-1.0.2.tgz", + "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=", + "dev": true + }, + "cross-spawn": { + "version": "5.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/cross-spawn/-/cross-spawn-5.1.0.tgz", + "integrity": "sha1-6L0O/uWPz/b4+UUQoKVUu/ojVEk=", + "dev": true, + "requires": { + "lru-cache": "^4.0.1", + "shebang-command": "^1.2.0", + "which": "^1.2.9" + } + }, + "currently-unhandled": { + "version": "0.4.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/currently-unhandled/-/currently-unhandled-0.4.1.tgz", + "integrity": "sha1-mI3zP+qxke95mmE2nddsF635V+o=", + "dev": true, + "requires": { + "array-find-index": "^1.0.1" + } + }, + "dargs": { + "version": "6.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/dargs/-/dargs-6.0.0.tgz", + "integrity": "sha512-6lJauzNaI7MiM8EHQWmGj+s3rP5/i1nYs8GAvKrLAx/9dpc9xS/4seFb1ioR39A+kcfu4v3jnEa/EE5qWYnitQ==", + "dev": true + }, + "dashdash": { + "version": "1.14.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/dashdash/-/dashdash-1.14.1.tgz", + "integrity": "sha1-hTz6D3y+L+1d4gMmuN1YEDX24vA=", + "dev": true, + "requires": { + "assert-plus": "^1.0.0" + } + }, + "dateformat": { + "version": "3.0.3", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/dateformat/-/dateformat-3.0.3.tgz", + "integrity": "sha512-jyCETtSl3VMZMWeRo7iY1FL19ges1t55hMo5yaam4Jrsm5EPL89UQkoQRyiI+Yf4k8r2ZpdngkV8hr1lIdjb3Q==", + "dev": true + }, + "debug": { + "version": "3.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/debug/-/debug-3.1.0.tgz", + "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", + "dev": true, + "requires": { + "ms": "2.0.0" + } + }, + "decamelize": { + "version": "1.2.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/decamelize/-/decamelize-1.2.0.tgz", + "integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=", + "dev": true + }, + "decamelize-keys": { + "version": "1.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/decamelize-keys/-/decamelize-keys-1.1.0.tgz", + "integrity": "sha1-0XGoeTMlKAfrPLYdwcFEXQeN8tk=", + "dev": true, + "requires": { + "decamelize": "^1.1.0", + "map-obj": "^1.0.0" + }, + "dependencies": { + "map-obj": { + "version": "1.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/map-obj/-/map-obj-1.0.1.tgz", + "integrity": "sha1-2TPOuSBdgr3PSIb2dCvcK03qFG0=", + "dev": true + } + } + }, + "decode-uri-component": { + "version": "0.2.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/decode-uri-component/-/decode-uri-component-0.2.0.tgz", + "integrity": "sha1-6zkTMzRYd1y4TNGh+uBiEGu4dUU=", + "dev": true + }, + "decompress-response": { + "version": "3.3.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/decompress-response/-/decompress-response-3.3.0.tgz", + "integrity": "sha1-gKTdMjdIOEv6JICDYirt7Jgq3/M=", + "dev": true, + "requires": { + "mimic-response": "^1.0.0" + } + }, + "deep-extend": { + "version": "0.6.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/deep-extend/-/deep-extend-0.6.0.tgz", + "integrity": "sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA==", + "dev": true + }, + "define-property": { + "version": "2.0.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/define-property/-/define-property-2.0.2.tgz", + "integrity": "sha512-jwK2UV4cnPpbcG7+VRARKTZPUWowwXA8bzH5NP6ud0oeAxyYPuGZUAC7hMugpCdz4BeSZl2Dl9k66CHJ/46ZYQ==", + "dev": true, + "requires": { + "is-descriptor": "^1.0.2", + "isobject": "^3.0.1" + }, + "dependencies": { + "is-accessor-descriptor": { + "version": "1.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz", + "integrity": "sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ==", + "dev": true, + "requires": { + "kind-of": "^6.0.0" + } + }, + "is-data-descriptor": { + "version": "1.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz", + "integrity": "sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ==", + "dev": true, + "requires": { + "kind-of": "^6.0.0" + } + }, + "is-descriptor": { + "version": "1.0.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/is-descriptor/-/is-descriptor-1.0.2.tgz", + "integrity": "sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg==", + "dev": true, + "requires": { + "is-accessor-descriptor": "^1.0.0", + "is-data-descriptor": "^1.0.0", + "kind-of": "^6.0.2" + } + }, + "kind-of": { + "version": "6.0.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/kind-of/-/kind-of-6.0.2.tgz", + "integrity": "sha512-s5kLOcnH0XqDO+FvuaLX8DDjZ18CGFk7VygH40QoKPUQhW4e2rvM0rwUq0t8IQDOwYSeLK01U90OjzBTme2QqA==", + "dev": true + } + } + }, + "delayed-stream": { + "version": "1.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/delayed-stream/-/delayed-stream-1.0.0.tgz", + "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=", + "dev": true + }, + "delegates": { + "version": "1.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/delegates/-/delegates-1.0.0.tgz", + "integrity": "sha1-hMbhWbgZBP3KWaDvRM2HDTElD5o=", + "dev": true + }, + "detect-conflict": { + "version": "1.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/detect-conflict/-/detect-conflict-1.0.1.tgz", + "integrity": "sha1-CIZXpmqWHAUBnbfEIwiDsca0F24=", + "dev": true + }, + "diagnostics": { + "version": "1.1.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/diagnostics/-/diagnostics-1.1.1.tgz", + "integrity": "sha512-8wn1PmdunLJ9Tqbx+Fx/ZEuHfJf4NKSN2ZBj7SJC/OWRWha843+WsTjqMe1B5E3p28jqBlp+mJ2fPVxPyNgYKQ==", + "dev": true, + "requires": { + "colorspace": "1.1.x", + "enabled": "1.0.x", + "kuler": "1.0.x" + } + }, + "didyoumean": { + "version": "1.2.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/didyoumean/-/didyoumean-1.2.1.tgz", + "integrity": "sha1-6S7f2tplN9SE1zwBcv0eugxJdv8=", + "dev": true + }, + "diff": { + "version": "3.5.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/diff/-/diff-3.5.0.tgz", + "integrity": "sha512-A46qtFgd+g7pDZinpnwiRJtxbC1hpgf0uzP3iG89scHk0AUC7A1TGxf5OiiOUv/JMZR8GOt8hL900hV0bOy5xA==", + "dev": true + }, + "dir-glob": { + "version": "2.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/dir-glob/-/dir-glob-2.0.0.tgz", + "integrity": "sha512-37qirFDz8cA5fimp9feo43fSuRo2gHwaIn6dXL8Ber1dGwUosDrGZeCCXq57WnIqE4aQ+u3eQZzsk1yOzhdwag==", + "dev": true, + "requires": { + "arrify": "^1.0.1", + "path-type": "^3.0.0" + } + }, + "dot-prop": { + "version": "4.2.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/dot-prop/-/dot-prop-4.2.0.tgz", + "integrity": "sha512-tUMXrxlExSW6U2EXiiKGSBVdYgtV8qlHL+C10TsW4PURY/ic+eaysnSkwB4kA/mBlCyy/IKDJ+Lc3wbWeaXtuQ==", + "dev": true, + "requires": { + "is-obj": "^1.0.0" + } + }, + "drange": { + "version": "1.1.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/drange/-/drange-1.1.1.tgz", + "integrity": "sha512-pYxfDYpued//QpnLIm4Avk7rsNtAtQkUES2cwAYSvD/wd2pKD71gN2Ebj3e7klzXwjocvE8c5vx/1fxwpqmSxA==", + "dev": true + }, + "duplexer3": { + "version": "0.1.4", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/duplexer3/-/duplexer3-0.1.4.tgz", + "integrity": "sha1-7gHdHKwO08vH/b6jfcCo8c4ALOI=", + "dev": true + }, + "ecc-jsbn": { + "version": "0.1.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz", + "integrity": "sha1-OoOpBOVDUyh4dMVkt1SThoSamMk=", + "dev": true, + "requires": { + "jsbn": "~0.1.0", + "safer-buffer": "^2.1.0" + } + }, + "editions": { + "version": "1.3.4", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/editions/-/editions-1.3.4.tgz", + "integrity": "sha512-gzao+mxnYDzIysXKMQi/+M1mjy/rjestjg6OPoYTtI+3Izp23oiGZitsl9lPDPiTGXbcSIk1iJWhliSaglxnUg==", + "dev": true + }, + "ejs": { + "version": "2.6.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/ejs/-/ejs-2.6.1.tgz", + "integrity": "sha512-0xy4A/twfrRCnkhfk8ErDi5DqdAsAqeGxht4xkCUrsvhhbQNs7E+4jV0CN7+NKIY0aHE72+XvqtBIXzD31ZbXQ==", + "dev": true + }, + "enabled": { + "version": "1.0.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/enabled/-/enabled-1.0.2.tgz", + "integrity": "sha1-ll9lE9LC0cX0ZStkouM5ZGf8L5M=", + "dev": true, + "requires": { + "env-variable": "0.0.x" + } + }, + "env-paths": { + "version": "1.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/env-paths/-/env-paths-1.0.0.tgz", + "integrity": "sha1-QWgTO0K7BcOKNbGuQ5fIKYqzaeA=", + "dev": true + }, + "env-variable": { + "version": "0.0.5", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/env-variable/-/env-variable-0.0.5.tgz", + "integrity": "sha512-zoB603vQReOFvTg5xMl9I1P2PnHsHQQKTEowsKKD7nseUfJq6UWzK+4YtlWUO1nhiQUxe6XMkk+JleSZD1NZFA==", + "dev": true + }, + "error": { + "version": "7.0.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/error/-/error-7.0.2.tgz", + "integrity": "sha1-pfdf/02ZJhJt2sDqXcOOaJFTywI=", + "dev": true, + "requires": { + "string-template": "~0.2.1", + "xtend": "~4.0.0" + } + }, + "error-ex": { + "version": "1.3.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/error-ex/-/error-ex-1.3.2.tgz", + "integrity": "sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g==", + "dev": true, + "requires": { + "is-arrayish": "^0.2.1" + }, + "dependencies": { + "is-arrayish": { + "version": "0.2.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/is-arrayish/-/is-arrayish-0.2.1.tgz", + "integrity": "sha1-d8mYQFJ6qOyxqLppe4BkWnqSap0=", + "dev": true + } + } + }, + "escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=", + "dev": true + }, + "esprima": { + "version": "4.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/esprima/-/esprima-4.0.1.tgz", + "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==", + "dev": true + }, + "execa": { + "version": "0.7.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/execa/-/execa-0.7.0.tgz", + "integrity": "sha1-lEvs00zEHuMqY6n68nrVpl/Fl3c=", + "dev": true, + "requires": { + "cross-spawn": "^5.0.1", + "get-stream": "^3.0.0", + "is-stream": "^1.1.0", + "npm-run-path": "^2.0.0", + "p-finally": "^1.0.0", + "signal-exit": "^3.0.0", + "strip-eof": "^1.0.0" + } + }, + "exit-hook": { + "version": "1.1.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/exit-hook/-/exit-hook-1.1.1.tgz", + "integrity": "sha1-8FyiM7SMBdVP/wd2XfhQfpXAL/g=", + "dev": true + }, + "expand-brackets": { + "version": "2.1.4", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/expand-brackets/-/expand-brackets-2.1.4.tgz", + "integrity": "sha1-t3c14xXOMPa27/D4OwQVGiJEliI=", + "dev": true, + "requires": { + "debug": "^2.3.3", + "define-property": "^0.2.5", + "extend-shallow": "^2.0.1", + "posix-character-classes": "^0.1.0", + "regex-not": "^1.0.0", + "snapdragon": "^0.8.1", + "to-regex": "^3.0.1" + }, + "dependencies": { + "debug": { + "version": "2.6.9", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "dev": true, + "requires": { + "ms": "2.0.0" + } + }, + "define-property": { + "version": "0.2.5", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/define-property/-/define-property-0.2.5.tgz", + "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", + "dev": true, + "requires": { + "is-descriptor": "^0.1.0" + } + }, + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "dev": true, + "requires": { + "is-extendable": "^0.1.0" + } + } + } + }, + "extend": { + "version": "3.0.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/extend/-/extend-3.0.2.tgz", + "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==", + "dev": true + }, + "extend-shallow": { + "version": "1.1.4", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/extend-shallow/-/extend-shallow-1.1.4.tgz", + "integrity": "sha1-Gda/lN/AnXa6cR85uHLSH/TdkHE=", + "dev": true, + "requires": { + "kind-of": "^1.1.0" + } + }, + "external-editor": { + "version": "2.2.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/external-editor/-/external-editor-2.2.0.tgz", + "integrity": "sha512-bSn6gvGxKt+b7+6TKEv1ZycHleA7aHhRHyAqJyp5pbUFuYYNIzpZnQDk7AsYckyWdEnTeAnay0aCy2aV6iTk9A==", + "dev": true, + "requires": { + "chardet": "^0.4.0", + "iconv-lite": "^0.4.17", + "tmp": "^0.0.33" + } + }, + "extglob": { + "version": "2.0.4", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/extglob/-/extglob-2.0.4.tgz", + "integrity": "sha512-Nmb6QXkELsuBr24CJSkilo6UHHgbekK5UiZgfE6UHD3Eb27YC6oD+bhcT+tJ6cl8dmsgdQxnWlcry8ksBIBLpw==", + "dev": true, + "requires": { + "array-unique": "^0.3.2", + "define-property": "^1.0.0", + "expand-brackets": "^2.1.4", + "extend-shallow": "^2.0.1", + "fragment-cache": "^0.2.1", + "regex-not": "^1.0.0", + "snapdragon": "^0.8.1", + "to-regex": "^3.0.1" + }, + "dependencies": { + "define-property": { + "version": "1.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/define-property/-/define-property-1.0.0.tgz", + "integrity": "sha1-dp66rz9KY6rTr56NMEybvnm/sOY=", + "dev": true, + "requires": { + "is-descriptor": "^1.0.0" + } + }, + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "dev": true, + "requires": { + "is-extendable": "^0.1.0" + } + }, + "is-accessor-descriptor": { + "version": "1.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz", + "integrity": "sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ==", + "dev": true, + "requires": { + "kind-of": "^6.0.0" + } + }, + "is-data-descriptor": { + "version": "1.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz", + "integrity": "sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ==", + "dev": true, + "requires": { + "kind-of": "^6.0.0" + } + }, + "is-descriptor": { + "version": "1.0.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/is-descriptor/-/is-descriptor-1.0.2.tgz", + "integrity": "sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg==", + "dev": true, + "requires": { + "is-accessor-descriptor": "^1.0.0", + "is-data-descriptor": "^1.0.0", + "kind-of": "^6.0.2" + } + }, + "kind-of": { + "version": "6.0.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/kind-of/-/kind-of-6.0.2.tgz", + "integrity": "sha512-s5kLOcnH0XqDO+FvuaLX8DDjZ18CGFk7VygH40QoKPUQhW4e2rvM0rwUq0t8IQDOwYSeLK01U90OjzBTme2QqA==", + "dev": true + } + } + }, + "extsprintf": { + "version": "1.3.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/extsprintf/-/extsprintf-1.3.0.tgz", + "integrity": "sha1-lpGEQOMEGnpBT4xS48V06zw+HgU=", + "dev": true + }, + "fast-deep-equal": { + "version": "1.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/fast-deep-equal/-/fast-deep-equal-1.1.0.tgz", + "integrity": "sha1-wFNHeBfIa1HaqFPIHgWbcz0CNhQ=", + "dev": true + }, + "fast-glob": { + "version": "2.2.3", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/fast-glob/-/fast-glob-2.2.3.tgz", + "integrity": "sha512-NiX+JXjnx43RzvVFwRWfPKo4U+1BrK5pJPsHQdKMlLoFHrrGktXglQhHliSihWAq+m1z6fHk3uwGHrtRbS9vLA==", + "dev": true, + "requires": { + "@mrmlnc/readdir-enhanced": "^2.2.1", + "@nodelib/fs.stat": "^1.0.1", + "glob-parent": "^3.1.0", + "is-glob": "^4.0.0", + "merge2": "^1.2.1", + "micromatch": "^3.1.10" + } + }, + "fast-json-stable-stringify": { + "version": "2.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz", + "integrity": "sha1-1RQsDK7msRifh9OnYREGT4bIu/I=", + "dev": true + }, + "fast-safe-stringify": { + "version": "2.0.6", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/fast-safe-stringify/-/fast-safe-stringify-2.0.6.tgz", + "integrity": "sha512-q8BZ89jjc+mz08rSxROs8VsrBBcn1SIw1kq9NjolL509tkABRk9io01RAjSaEv1Xb2uFLt8VtRiZbGp5H8iDtg==", + "dev": true + }, + "fecha": { + "version": "2.3.3", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/fecha/-/fecha-2.3.3.tgz", + "integrity": "sha512-lUGBnIamTAwk4znq5BcqsDaxSmZ9nDVJaij6NvRt/Tg4R69gERA+otPKbS86ROw9nxVMw2/mp1fnaiWqbs6Sdg==", + "dev": true + }, + "figures": { + "version": "2.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/figures/-/figures-2.0.0.tgz", + "integrity": "sha1-OrGi0qYsi/tDGgyUy3l6L84nyWI=", + "dev": true, + "requires": { + "escape-string-regexp": "^1.0.5" + } + }, + "fill-range": { + "version": "4.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/fill-range/-/fill-range-4.0.0.tgz", + "integrity": "sha1-1USBHUKPmOsGpj3EAtJAPDKMOPc=", + "dev": true, + "requires": { + "extend-shallow": "^2.0.1", + "is-number": "^3.0.0", + "repeat-string": "^1.6.1", + "to-regex-range": "^2.1.0" + }, + "dependencies": { + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "dev": true, + "requires": { + "is-extendable": "^0.1.0" + } + } + } + }, + "find-up": { + "version": "2.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/find-up/-/find-up-2.1.0.tgz", + "integrity": "sha1-RdG35QbHF93UgndaK3eSCjwMV6c=", + "dev": true, + "requires": { + "locate-path": "^2.0.0" + } + }, + "first-chunk-stream": { + "version": "2.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/first-chunk-stream/-/first-chunk-stream-2.0.0.tgz", + "integrity": "sha1-G97NuOCDwGZLkZRVgVd6Q6nzHXA=", + "dev": true, + "requires": { + "readable-stream": "^2.0.2" + } + }, + "follow-redirects": { + "version": "1.5.9", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/follow-redirects/-/follow-redirects-1.5.9.tgz", + "integrity": "sha512-Bh65EZI/RU8nx0wbYF9shkFZlqLP+6WT/5FnA3cE/djNSuKNHJEinGGZgu/cQEkeeb2GdFOgenAmn8qaqYke2w==", + "dev": true, + "requires": { + "debug": "=3.1.0" + } + }, + "for-in": { + "version": "1.0.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/for-in/-/for-in-1.0.2.tgz", + "integrity": "sha1-gQaNKVqBQuwKxybG4iAMMPttXoA=", + "dev": true + }, + "forever-agent": { + "version": "0.6.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/forever-agent/-/forever-agent-0.6.1.tgz", + "integrity": "sha1-+8cfDEGt6zf5bFd60e1C2P2sypE=", + "dev": true + }, + "form-data": { + "version": "2.3.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/form-data/-/form-data-2.3.2.tgz", + "integrity": "sha1-SXBJi+YEwgwAXU9cI67NIda0kJk=", + "dev": true, + "requires": { + "asynckit": "^0.4.0", + "combined-stream": "1.0.6", + "mime-types": "^2.1.12" + }, + "dependencies": { + "combined-stream": { + "version": "1.0.6", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/combined-stream/-/combined-stream-1.0.6.tgz", + "integrity": "sha1-cj599ugBrFYTETp+RFqbactjKBg=", + "dev": true, + "requires": { + "delayed-stream": "~1.0.0" + } + } + } + }, + "fragment-cache": { + "version": "0.2.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/fragment-cache/-/fragment-cache-0.2.1.tgz", + "integrity": "sha1-QpD60n8T6Jvn8zeZxrxaCr//DRk=", + "dev": true, + "requires": { + "map-cache": "^0.2.2" + } + }, + "fs-extra": { + "version": "7.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/fs-extra/-/fs-extra-7.0.0.tgz", + "integrity": "sha512-EglNDLRpmaTWiD/qraZn6HREAEAHJcJOmxNEYwq6xeMKnVMAy3GUcFB+wXt2C6k4CNvB/mP1y/U3dzvKKj5OtQ==", + "dev": true, + "requires": { + "graceful-fs": "^4.1.2", + "jsonfile": "^4.0.0", + "universalify": "^0.1.0" + } + }, + "fs.realpath": { + "version": "1.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", + "dev": true + }, + "gauge": { + "version": "1.2.7", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/gauge/-/gauge-1.2.7.tgz", + "integrity": "sha1-6c7FSD09TuDvRLYKfZnkk14TbZM=", + "dev": true, + "requires": { + "ansi": "^0.3.0", + "has-unicode": "^2.0.0", + "lodash.pad": "^4.1.0", + "lodash.padend": "^4.1.0", + "lodash.padstart": "^4.1.0" + } + }, + "generator-jhipster": { + "version": "5.4.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/generator-jhipster/-/generator-jhipster-5.4.2.tgz", + "integrity": "sha512-iuTZGPonlMFWrabTC7x27UnCa8sckWFKD7HiwMp2JOYLlLU+BPt0WJWlQ9hJv5JHHx+pe0pUxwEHbi0fSu0Ljw==", + "dev": true, + "requires": { + "axios": "0.18.0", + "chalk": "2.4.1", + "commander": "2.16.0", + "conf": "2.0.0", + "didyoumean": "1.2.1", + "ejs": "2.6.1", + "glob": "7.1.2", + "gulp-filter": "5.1.0", + "insight": "0.10.1", + "jhipster-core": "3.4.0", + "js-object-pretty-print": "0.3.0", + "js-yaml": "3.12.0", + "lodash": "4.17.10", + "meow": "5.0.0", + "mkdirp": "0.5.1", + "os-locale": "2.1.0", + "parse-gitignore": "1.0.1", + "pluralize": "7.0.0", + "prettier": "1.13.7", + "randexp": "0.4.9", + "semver": "5.5.0", + "shelljs": "0.8.2", + "tabtab": "2.2.2", + "through2": "2.0.3", + "uuid": "3.3.2", + "yeoman-environment": "2.3.0", + "yeoman-generator": "3.0.0" + } + }, + "get-stream": { + "version": "3.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/get-stream/-/get-stream-3.0.0.tgz", + "integrity": "sha1-jpQ9E1jcN1VQVOy+LtsFqhdO3hQ=", + "dev": true + }, + "get-value": { + "version": "2.0.6", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/get-value/-/get-value-2.0.6.tgz", + "integrity": "sha1-3BXKHGcjh8p2vTesCjlbogQqLCg=", + "dev": true + }, + "getpass": { + "version": "0.1.7", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/getpass/-/getpass-0.1.7.tgz", + "integrity": "sha1-Xv+OPmhNVprkyysSgmBOi6YhSfo=", + "dev": true, + "requires": { + "assert-plus": "^1.0.0" + } + }, + "gh-got": { + "version": "6.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/gh-got/-/gh-got-6.0.0.tgz", + "integrity": "sha512-F/mS+fsWQMo1zfgG9MD8KWvTWPPzzhuVwY++fhQ5Ggd+0P+CAMHtzMZhNxG+TqGfHDChJKsbh6otfMGqO2AKBw==", + "dev": true, + "requires": { + "got": "^7.0.0", + "is-plain-obj": "^1.1.0" + } + }, + "github-username": { + "version": "4.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/github-username/-/github-username-4.1.0.tgz", + "integrity": "sha1-y+KABBiDIG2kISrp5LXxacML9Bc=", + "dev": true, + "requires": { + "gh-got": "^6.0.0" + } + }, + "glob": { + "version": "7.1.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/glob/-/glob-7.1.2.tgz", + "integrity": "sha512-MJTUg1kjuLeQCJ+ccE4Vpa6kKVXkPYJ2mOCQyUuKLcLQsdrMCpBPUi8qVE6+YuaJkozeA9NusTAw3hLr8Xe5EQ==", + "dev": true, + "requires": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + } + }, + "glob-parent": { + "version": "3.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/glob-parent/-/glob-parent-3.1.0.tgz", + "integrity": "sha1-nmr2KZ2NO9K9QEMIMr0RPfkGxa4=", + "dev": true, + "requires": { + "is-glob": "^3.1.0", + "path-dirname": "^1.0.0" + }, + "dependencies": { + "is-glob": { + "version": "3.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/is-glob/-/is-glob-3.1.0.tgz", + "integrity": "sha1-e6WuJCF4BKxwcHuWkiVnSGzD6Eo=", + "dev": true, + "requires": { + "is-extglob": "^2.1.0" + } + } + } + }, + "glob-to-regexp": { + "version": "0.3.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/glob-to-regexp/-/glob-to-regexp-0.3.0.tgz", + "integrity": "sha1-jFoUlNIGbFcMw7/kSWF1rMTVAqs=", + "dev": true + }, + "globby": { + "version": "8.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/globby/-/globby-8.0.1.tgz", + "integrity": "sha512-oMrYrJERnKBLXNLVTqhm3vPEdJ/b2ZE28xN4YARiix1NOIOBPEpOUnm844K1iu/BkphCaf2WNFwMszv8Soi1pw==", + "dev": true, + "requires": { + "array-union": "^1.0.1", + "dir-glob": "^2.0.0", + "fast-glob": "^2.0.2", + "glob": "^7.1.2", + "ignore": "^3.3.5", + "pify": "^3.0.0", + "slash": "^1.0.0" + } + }, + "got": { + "version": "7.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/got/-/got-7.1.0.tgz", + "integrity": "sha512-Y5WMo7xKKq1muPsxD+KmrR8DH5auG7fBdDVueZwETwV6VytKyU9OX/ddpq2/1hp1vIPvVb4T81dKQz3BivkNLw==", + "dev": true, + "requires": { + "decompress-response": "^3.2.0", + "duplexer3": "^0.1.4", + "get-stream": "^3.0.0", + "is-plain-obj": "^1.1.0", + "is-retry-allowed": "^1.0.0", + "is-stream": "^1.0.0", + "isurl": "^1.0.0-alpha5", + "lowercase-keys": "^1.0.0", + "p-cancelable": "^0.3.0", + "p-timeout": "^1.1.1", + "safe-buffer": "^5.0.1", + "timed-out": "^4.0.0", + "url-parse-lax": "^1.0.0", + "url-to-options": "^1.0.1" + } + }, + "graceful-fs": { + "version": "4.1.11", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/graceful-fs/-/graceful-fs-4.1.11.tgz", + "integrity": "sha1-Dovf5NHduIVNZOBOp8AOKgJuVlg=", + "dev": true + }, + "grouped-queue": { + "version": "0.3.3", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/grouped-queue/-/grouped-queue-0.3.3.tgz", + "integrity": "sha1-wWfSpTGcWg4JZO9qJbfC34mWyFw=", + "dev": true, + "requires": { + "lodash": "^4.17.2" + } + }, + "gulp-filter": { + "version": "5.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/gulp-filter/-/gulp-filter-5.1.0.tgz", + "integrity": "sha1-oF4Rr/sHz33PQafeHLe2OsN4PnM=", + "dev": true, + "requires": { + "multimatch": "^2.0.0", + "plugin-error": "^0.1.2", + "streamfilter": "^1.0.5" + } + }, + "har-schema": { + "version": "2.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/har-schema/-/har-schema-2.0.0.tgz", + "integrity": "sha1-qUwiJOvKwEeCoNkDVSHyRzW37JI=", + "dev": true + }, + "har-validator": { + "version": "5.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/har-validator/-/har-validator-5.1.0.tgz", + "integrity": "sha512-+qnmNjI4OfH2ipQ9VQOw23bBd/ibtfbVdK2fYbY4acTDqKTW/YDp9McimZdDbG8iV9fZizUqQMD5xvriB146TA==", + "dev": true, + "requires": { + "ajv": "^5.3.0", + "har-schema": "^2.0.0" + } + }, + "has-ansi": { + "version": "2.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/has-ansi/-/has-ansi-2.0.0.tgz", + "integrity": "sha1-NPUEnOHs3ysGSa8+8k5F7TVBbZE=", + "dev": true, + "requires": { + "ansi-regex": "^2.0.0" + }, + "dependencies": { + "ansi-regex": { + "version": "2.1.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/ansi-regex/-/ansi-regex-2.1.1.tgz", + "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=", + "dev": true + } + } + }, + "has-flag": { + "version": "3.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", + "dev": true + }, + "has-symbol-support-x": { + "version": "1.4.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/has-symbol-support-x/-/has-symbol-support-x-1.4.2.tgz", + "integrity": "sha512-3ToOva++HaW+eCpgqZrCfN51IPB+7bJNVT6CUATzueB5Heb8o6Nam0V3HG5dlDvZU1Gn5QLcbahiKw/XVk5JJw==", + "dev": true + }, + "has-to-string-tag-x": { + "version": "1.4.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/has-to-string-tag-x/-/has-to-string-tag-x-1.4.1.tgz", + "integrity": "sha512-vdbKfmw+3LoOYVr+mtxHaX5a96+0f3DljYd8JOqvOLsf5mw2Otda2qCDT9qRqLAhrjyQ0h7ual5nOiASpsGNFw==", + "dev": true, + "requires": { + "has-symbol-support-x": "^1.4.1" + } + }, + "has-unicode": { + "version": "2.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/has-unicode/-/has-unicode-2.0.1.tgz", + "integrity": "sha1-4Ob+aijPUROIVeCG0Wkedx3iqLk=", + "dev": true + }, + "has-value": { + "version": "1.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/has-value/-/has-value-1.0.0.tgz", + "integrity": "sha1-GLKB2lhbHFxR3vJMkw7SmgvmsXc=", + "dev": true, + "requires": { + "get-value": "^2.0.6", + "has-values": "^1.0.0", + "isobject": "^3.0.0" + } + }, + "has-values": { + "version": "1.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/has-values/-/has-values-1.0.0.tgz", + "integrity": "sha1-lbC2P+whRmGab+V/51Yo1aOe/k8=", + "dev": true, + "requires": { + "is-number": "^3.0.0", + "kind-of": "^4.0.0" + }, + "dependencies": { + "kind-of": { + "version": "4.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/kind-of/-/kind-of-4.0.0.tgz", + "integrity": "sha1-IIE989cSkosgc3hpGkUGb65y3Vc=", + "dev": true, + "requires": { + "is-buffer": "^1.1.5" + } + } + } + }, + "hosted-git-info": { + "version": "2.7.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/hosted-git-info/-/hosted-git-info-2.7.1.tgz", + "integrity": "sha512-7T/BxH19zbcCTa8XkMlbK5lTo1WtgkFi3GvdWEyNuc4Vex7/9Dqbnpsf4JMydcfj9HCg4zUWFTL3Za6lapg5/w==", + "dev": true + }, + "http-signature": { + "version": "1.2.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/http-signature/-/http-signature-1.2.0.tgz", + "integrity": "sha1-muzZJRFHcvPZW2WmCruPfBj7rOE=", + "dev": true, + "requires": { + "assert-plus": "^1.0.0", + "jsprim": "^1.2.2", + "sshpk": "^1.7.0" + } + }, + "iconv-lite": { + "version": "0.4.24", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/iconv-lite/-/iconv-lite-0.4.24.tgz", + "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", + "dev": true, + "requires": { + "safer-buffer": ">= 2.1.2 < 3" + } + }, + "ignore": { + "version": "3.3.10", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/ignore/-/ignore-3.3.10.tgz", + "integrity": "sha512-Pgs951kaMm5GXP7MOvxERINe3gsaVjUWFm+UZPSq9xYriQAksyhg0csnS0KXSNRD5NmNdapXEpjxG49+AKh/ug==", + "dev": true + }, + "imurmurhash": { + "version": "0.1.4", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/imurmurhash/-/imurmurhash-0.1.4.tgz", + "integrity": "sha1-khi5srkoojixPcT7a21XbyMUU+o=", + "dev": true + }, + "indent-string": { + "version": "3.2.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/indent-string/-/indent-string-3.2.0.tgz", + "integrity": "sha1-Sl/W0nzDMvN+VBmlBNu4NxBckok=", + "dev": true + }, + "inflight": { + "version": "1.0.6", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", + "dev": true, + "requires": { + "once": "^1.3.0", + "wrappy": "1" + } + }, + "inherits": { + "version": "2.0.3", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/inherits/-/inherits-2.0.3.tgz", + "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=", + "dev": true + }, + "inquirer": { + "version": "5.2.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/inquirer/-/inquirer-5.2.0.tgz", + "integrity": "sha512-E9BmnJbAKLPGonz0HeWHtbKf+EeSP93paWO3ZYoUpq/aowXvYGjjCSuashhXPpzbArIjBbji39THkxTz9ZeEUQ==", + "dev": true, + "requires": { + "ansi-escapes": "^3.0.0", + "chalk": "^2.0.0", + "cli-cursor": "^2.1.0", + "cli-width": "^2.0.0", + "external-editor": "^2.1.0", + "figures": "^2.0.0", + "lodash": "^4.3.0", + "mute-stream": "0.0.7", + "run-async": "^2.2.0", + "rxjs": "^5.5.2", + "string-width": "^2.1.0", + "strip-ansi": "^4.0.0", + "through": "^2.3.6" + } + }, + "insight": { + "version": "0.10.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/insight/-/insight-0.10.1.tgz", + "integrity": "sha512-kLGeYQkh18f8KuC68QKdi0iwUcIaayJVB/STpX7x452/7pAUm1yfG4giJwcxbrTh0zNYtc8kBR+6maLMOzglOQ==", + "dev": true, + "requires": { + "async": "^2.1.4", + "chalk": "^2.3.0", + "conf": "^1.3.1", + "inquirer": "^5.0.0", + "lodash.debounce": "^4.0.8", + "os-name": "^2.0.1", + "request": "^2.74.0", + "tough-cookie": "^2.0.0", + "uuid": "^3.0.0" + }, + "dependencies": { + "conf": { + "version": "1.4.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/conf/-/conf-1.4.0.tgz", + "integrity": "sha512-bzlVWS2THbMetHqXKB8ypsXN4DQ/1qopGwNJi1eYbpwesJcd86FBjFciCQX/YwAhp9bM7NVnPFqZ5LpV7gP0Dg==", + "dev": true, + "requires": { + "dot-prop": "^4.1.0", + "env-paths": "^1.0.0", + "make-dir": "^1.0.0", + "pkg-up": "^2.0.0", + "write-file-atomic": "^2.3.0" + } + } + } + }, + "interpret": { + "version": "1.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/interpret/-/interpret-1.1.0.tgz", + "integrity": "sha1-ftGxQQxqDg94z5XTuEQMY/eLhhQ=", + "dev": true + }, + "invert-kv": { + "version": "1.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/invert-kv/-/invert-kv-1.0.0.tgz", + "integrity": "sha1-EEqOSqym09jNFXqO+L+rLXo//bY=", + "dev": true + }, + "is-accessor-descriptor": { + "version": "0.1.6", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/is-accessor-descriptor/-/is-accessor-descriptor-0.1.6.tgz", + "integrity": "sha1-qeEss66Nh2cn7u84Q/igiXtcmNY=", + "dev": true, + "requires": { + "kind-of": "^3.0.2" + }, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true, + "requires": { + "is-buffer": "^1.1.5" + } + } + } + }, + "is-arrayish": { + "version": "0.3.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/is-arrayish/-/is-arrayish-0.3.2.tgz", + "integrity": "sha512-eVRqCvVlZbuw3GrM63ovNSNAeA1K16kaR/LRY/92w0zxQ5/1YzwblUX652i4Xs9RwAGjW9d9y6X88t8OaAJfWQ==", + "dev": true + }, + "is-buffer": { + "version": "1.1.6", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/is-buffer/-/is-buffer-1.1.6.tgz", + "integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==", + "dev": true + }, + "is-builtin-module": { + "version": "1.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/is-builtin-module/-/is-builtin-module-1.0.0.tgz", + "integrity": "sha1-VAVy0096wxGfj3bDDLwbHgN6/74=", + "dev": true, + "requires": { + "builtin-modules": "^1.0.0" + } + }, + "is-data-descriptor": { + "version": "0.1.4", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/is-data-descriptor/-/is-data-descriptor-0.1.4.tgz", + "integrity": "sha1-C17mSDiOLIYCgueT8YVv7D8wG1Y=", + "dev": true, + "requires": { + "kind-of": "^3.0.2" + }, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true, + "requires": { + "is-buffer": "^1.1.5" + } + } + } + }, + "is-descriptor": { + "version": "0.1.6", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/is-descriptor/-/is-descriptor-0.1.6.tgz", + "integrity": "sha512-avDYr0SB3DwO9zsMov0gKCESFYqCnE4hq/4z3TdUlukEy5t9C0YRq7HLrsN52NAcqXKaepeCD0n+B0arnVG3Hg==", + "dev": true, + "requires": { + "is-accessor-descriptor": "^0.1.6", + "is-data-descriptor": "^0.1.4", + "kind-of": "^5.0.0" + }, + "dependencies": { + "kind-of": { + "version": "5.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/kind-of/-/kind-of-5.1.0.tgz", + "integrity": "sha512-NGEErnH6F2vUuXDh+OlbcKW7/wOcfdRHaZ7VWtqCztfHri/++YKmP51OdWeGPuqCOba6kk2OTe5d02VmTB80Pw==", + "dev": true + } + } + }, + "is-extendable": { + "version": "0.1.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/is-extendable/-/is-extendable-0.1.1.tgz", + "integrity": "sha1-YrEQ4omkcUGOPsNqYX1HLjAd/Ik=", + "dev": true + }, + "is-extglob": { + "version": "2.1.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/is-extglob/-/is-extglob-2.1.1.tgz", + "integrity": "sha1-qIwCU1eR8C7TfHahueqXc8gz+MI=", + "dev": true + }, + "is-fullwidth-code-point": { + "version": "2.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", + "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", + "dev": true + }, + "is-glob": { + "version": "4.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/is-glob/-/is-glob-4.0.0.tgz", + "integrity": "sha1-lSHHaEXMJhCoUgPd8ICpWML/q8A=", + "dev": true, + "requires": { + "is-extglob": "^2.1.1" + } + }, + "is-number": { + "version": "3.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/is-number/-/is-number-3.0.0.tgz", + "integrity": "sha1-JP1iAaR4LPUFYcgQJ2r8fRLXEZU=", + "dev": true, + "requires": { + "kind-of": "^3.0.2" + }, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true, + "requires": { + "is-buffer": "^1.1.5" + } + } + } + }, + "is-obj": { + "version": "1.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/is-obj/-/is-obj-1.0.1.tgz", + "integrity": "sha1-PkcprB9f3gJc19g6iW2rn09n2w8=", + "dev": true + }, + "is-object": { + "version": "1.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/is-object/-/is-object-1.0.1.tgz", + "integrity": "sha1-iVJojF7C/9awPsyF52ngKQMINHA=", + "dev": true + }, + "is-plain-obj": { + "version": "1.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/is-plain-obj/-/is-plain-obj-1.1.0.tgz", + "integrity": "sha1-caUMhCnfync8kqOQpKA7OfzVHT4=", + "dev": true + }, + "is-plain-object": { + "version": "2.0.4", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/is-plain-object/-/is-plain-object-2.0.4.tgz", + "integrity": "sha512-h5PpgXkWitc38BBMYawTYMWJHFZJVnBquFE57xFpjB8pJFiF6gZ+bU+WyI/yqXiFR5mdLsgYNaPe8uao6Uv9Og==", + "dev": true, + "requires": { + "isobject": "^3.0.1" + } + }, + "is-promise": { + "version": "2.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/is-promise/-/is-promise-2.1.0.tgz", + "integrity": "sha1-eaKp7OfwlugPNtKy87wWwf9L8/o=", + "dev": true + }, + "is-retry-allowed": { + "version": "1.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/is-retry-allowed/-/is-retry-allowed-1.1.0.tgz", + "integrity": "sha1-EaBgVotnM5REAz0BJaYaINVk+zQ=", + "dev": true + }, + "is-scoped": { + "version": "1.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/is-scoped/-/is-scoped-1.0.0.tgz", + "integrity": "sha1-RJypgpnnEwOCViieyytUDcQ3yzA=", + "dev": true, + "requires": { + "scoped-regex": "^1.0.0" + } + }, + "is-stream": { + "version": "1.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/is-stream/-/is-stream-1.1.0.tgz", + "integrity": "sha1-EtSj3U5o4Lec6428hBc66A2RykQ=", + "dev": true + }, + "is-typedarray": { + "version": "1.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/is-typedarray/-/is-typedarray-1.0.0.tgz", + "integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=", + "dev": true + }, + "is-utf8": { + "version": "0.2.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/is-utf8/-/is-utf8-0.2.1.tgz", + "integrity": "sha1-Sw2hRCEE0bM2NA6AeX6GXPOffXI=", + "dev": true + }, + "is-windows": { + "version": "1.0.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/is-windows/-/is-windows-1.0.2.tgz", + "integrity": "sha512-eXK1UInq2bPmjyX6e3VHIzMLobc4J94i4AWn+Hpq3OU5KkrRC96OAcR3PRJ/pGu6m8TRnBHP9dkXQVsT/COVIA==", + "dev": true + }, + "isarray": { + "version": "1.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/isarray/-/isarray-1.0.0.tgz", + "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", + "dev": true + }, + "isbinaryfile": { + "version": "3.0.3", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/isbinaryfile/-/isbinaryfile-3.0.3.tgz", + "integrity": "sha512-8cJBL5tTd2OS0dM4jz07wQd5g0dCCqIhUxPIGtZfa5L6hWlvV5MHTITy/DBAsF+Oe2LS1X3krBUhNwaGUWpWxw==", + "dev": true, + "requires": { + "buffer-alloc": "^1.2.0" + } + }, + "isexe": { + "version": "2.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=", + "dev": true + }, + "isobject": { + "version": "3.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/isobject/-/isobject-3.0.1.tgz", + "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", + "dev": true + }, + "isstream": { + "version": "0.1.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/isstream/-/isstream-0.1.2.tgz", + "integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo=", + "dev": true + }, + "istextorbinary": { + "version": "2.2.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/istextorbinary/-/istextorbinary-2.2.1.tgz", + "integrity": "sha512-TS+hoFl8Z5FAFMK38nhBkdLt44CclNRgDHWeMgsV8ko3nDlr/9UI2Sf839sW7enijf8oKsZYXRvM8g0it9Zmcw==", + "dev": true, + "requires": { + "binaryextensions": "2", + "editions": "^1.3.3", + "textextensions": "2" + } + }, + "isurl": { + "version": "1.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/isurl/-/isurl-1.0.0.tgz", + "integrity": "sha512-1P/yWsxPlDtn7QeRD+ULKQPaIaN6yF368GZ2vDfv0AL0NwpStafjWCDDdn0k8wgFMWpVAqG7oJhxHnlud42i9w==", + "dev": true, + "requires": { + "has-to-string-tag-x": "^1.2.0", + "is-object": "^1.0.1" + } + }, + "jhipster-core": { + "version": "3.4.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/jhipster-core/-/jhipster-core-3.4.0.tgz", + "integrity": "sha512-iVJ6MF4jlpvtVL5gbn9t4Jw27RodjY04SXYSGfTLAzHyQRMmehHLvNq/3DBjVwHgBrDn1u2k17oLGouJus9MhA==", + "dev": true, + "requires": { + "chevrotain": "4.1.0", + "fs-extra": "7.0.0", + "lodash": "4.17.11", + "winston": "3.1.0" + }, + "dependencies": { + "lodash": { + "version": "4.17.11", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/lodash/-/lodash-4.17.11.tgz", + "integrity": "sha512-cQKh8igo5QUhZ7lg38DYWAxMvjSAKG0A8wGSVimP07SIUEK2UO+arSRKbRZWtelMtN5V0Hkwh5ryOto/SshYIg==", + "dev": true + } + } + }, + "js-object-pretty-print": { + "version": "0.3.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/js-object-pretty-print/-/js-object-pretty-print-0.3.0.tgz", + "integrity": "sha1-RnDkUAZu4ezPNRdMfRl/WqOLz3Q=", + "dev": true + }, + "js-yaml": { + "version": "3.12.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/js-yaml/-/js-yaml-3.12.0.tgz", + "integrity": "sha512-PIt2cnwmPfL4hKNwqeiuz4bKfnzHTBv6HyVgjahA6mPLwPDzjDWrplJBMjHUFxku/N3FlmrbyPclad+I+4mJ3A==", + "dev": true, + "requires": { + "argparse": "^1.0.7", + "esprima": "^4.0.0" + } + }, + "jsbn": { + "version": "0.1.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/jsbn/-/jsbn-0.1.1.tgz", + "integrity": "sha1-peZUwuWi3rXyAdls77yoDA7y9RM=", + "dev": true + }, + "json-parse-better-errors": { + "version": "1.0.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/json-parse-better-errors/-/json-parse-better-errors-1.0.2.tgz", + "integrity": "sha512-mrqyZKfX5EhL7hvqcV6WG1yYjnjeuYDzDhhcAAUrq8Po85NBQBJP+ZDUT75qZQ98IkUoBqdkExkukOU7Ts2wrw==", + "dev": true + }, + "json-schema": { + "version": "0.2.3", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/json-schema/-/json-schema-0.2.3.tgz", + "integrity": "sha1-tIDIkuWaLwWVTOcnvT8qTogvnhM=", + "dev": true + }, + "json-schema-traverse": { + "version": "0.3.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/json-schema-traverse/-/json-schema-traverse-0.3.1.tgz", + "integrity": "sha1-NJptRMU6Ud6JtAgFxdXlm0F9M0A=", + "dev": true + }, + "json-stringify-safe": { + "version": "5.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", + "integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus=", + "dev": true + }, + "jsonfile": { + "version": "4.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/jsonfile/-/jsonfile-4.0.0.tgz", + "integrity": "sha1-h3Gq4HmbZAdrdmQPygWPnBDjPss=", + "dev": true, + "requires": { + "graceful-fs": "^4.1.6" + } + }, + "jsprim": { + "version": "1.4.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/jsprim/-/jsprim-1.4.1.tgz", + "integrity": "sha1-MT5mvB5cwG5Di8G3SZwuXFastqI=", + "dev": true, + "requires": { + "assert-plus": "1.0.0", + "extsprintf": "1.3.0", + "json-schema": "0.2.3", + "verror": "1.10.0" + } + }, + "kind-of": { + "version": "1.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/kind-of/-/kind-of-1.1.0.tgz", + "integrity": "sha1-FAo9LUGjbS78+pN3tiwk+ElaXEQ=", + "dev": true + }, + "kuler": { + "version": "1.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/kuler/-/kuler-1.0.1.tgz", + "integrity": "sha512-J9nVUucG1p/skKul6DU3PUZrhs0LPulNaeUOox0IyXDi8S4CztTHs1gQphhuZmzXG7VOQSf6NJfKuzteQLv9gQ==", + "dev": true, + "requires": { + "colornames": "^1.1.1" + } + }, + "lcid": { + "version": "1.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/lcid/-/lcid-1.0.0.tgz", + "integrity": "sha1-MIrMr6C8SDo4Z7S28rlQYlHRuDU=", + "dev": true, + "requires": { + "invert-kv": "^1.0.0" + } + }, + "load-json-file": { + "version": "4.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/load-json-file/-/load-json-file-4.0.0.tgz", + "integrity": "sha1-L19Fq5HjMhYjT9U62rZo607AmTs=", + "dev": true, + "requires": { + "graceful-fs": "^4.1.2", + "parse-json": "^4.0.0", + "pify": "^3.0.0", + "strip-bom": "^3.0.0" + } + }, + "locate-path": { + "version": "2.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/locate-path/-/locate-path-2.0.0.tgz", + "integrity": "sha1-K1aLJl7slExtnA3pw9u7ygNUzY4=", + "dev": true, + "requires": { + "p-locate": "^2.0.0", + "path-exists": "^3.0.0" + } + }, + "lodash": { + "version": "4.17.10", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/lodash/-/lodash-4.17.10.tgz", + "integrity": "sha512-UejweD1pDoXu+AD825lWwp4ZGtSwgnpZxb3JDViD7StjQz+Nb/6l093lx4OQ0foGWNRoc19mWy7BzL+UAK2iVg==", + "dev": true + }, + "lodash.debounce": { + "version": "4.0.8", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/lodash.debounce/-/lodash.debounce-4.0.8.tgz", + "integrity": "sha1-gteb/zCmfEAF/9XiUVMArZyk168=", + "dev": true + }, + "lodash.difference": { + "version": "4.5.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/lodash.difference/-/lodash.difference-4.5.0.tgz", + "integrity": "sha1-nMtOUF1Ia5FlE0V3KIWi3yf9AXw=", + "dev": true + }, + "lodash.pad": { + "version": "4.5.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/lodash.pad/-/lodash.pad-4.5.1.tgz", + "integrity": "sha1-QzCUmoM6fI2iLMIPaibE1Z3runA=", + "dev": true + }, + "lodash.padend": { + "version": "4.6.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/lodash.padend/-/lodash.padend-4.6.1.tgz", + "integrity": "sha1-U8y6BH0G4VjTEfRdpiX05J5vFm4=", + "dev": true + }, + "lodash.padstart": { + "version": "4.6.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/lodash.padstart/-/lodash.padstart-4.6.1.tgz", + "integrity": "sha1-0uPuv/DZ05rVD1y9G1KnvOa7YRs=", + "dev": true + }, + "lodash.uniq": { + "version": "4.5.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/lodash.uniq/-/lodash.uniq-4.5.0.tgz", + "integrity": "sha1-0CJTc662Uq3BvILklFM5qEJ1R3M=", + "dev": true + }, + "log-symbols": { + "version": "2.2.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/log-symbols/-/log-symbols-2.2.0.tgz", + "integrity": "sha512-VeIAFslyIerEJLXHziedo2basKbMKtTw3vfn5IzG0XTjhAVEJyNHnL2p7vc+wBDSdQuUpNw3M2u6xb9QsAY5Eg==", + "dev": true, + "requires": { + "chalk": "^2.0.1" + } + }, + "logform": { + "version": "1.10.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/logform/-/logform-1.10.0.tgz", + "integrity": "sha512-em5ojIhU18fIMOw/333mD+ZLE2fis0EzXl1ZwHx4iQzmpQi6odNiY/t+ITNr33JZhT9/KEaH+UPIipr6a9EjWg==", + "dev": true, + "requires": { + "colors": "^1.2.1", + "fast-safe-stringify": "^2.0.4", + "fecha": "^2.3.3", + "ms": "^2.1.1", + "triple-beam": "^1.2.0" + }, + "dependencies": { + "ms": { + "version": "2.1.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/ms/-/ms-2.1.1.tgz", + "integrity": "sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg==", + "dev": true + } + } + }, + "loud-rejection": { + "version": "1.6.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/loud-rejection/-/loud-rejection-1.6.0.tgz", + "integrity": "sha1-W0b4AUft7leIcPCG0Eghz5mOVR8=", + "dev": true, + "requires": { + "currently-unhandled": "^0.4.1", + "signal-exit": "^3.0.0" + } + }, + "lowercase-keys": { + "version": "1.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/lowercase-keys/-/lowercase-keys-1.0.1.tgz", + "integrity": "sha512-G2Lj61tXDnVFFOi8VZds+SoQjtQC3dgokKdDG2mTm1tx4m50NUHBOZSBwQQHyy0V12A0JTG4icfZQH+xPyh8VA==", + "dev": true + }, + "lru-cache": { + "version": "4.1.3", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/lru-cache/-/lru-cache-4.1.3.tgz", + "integrity": "sha512-fFEhvcgzuIoJVUF8fYr5KR0YqxD238zgObTps31YdADwPPAp82a4M8TrckkWyx7ekNlf9aBcVn81cFwwXngrJA==", + "dev": true, + "requires": { + "pseudomap": "^1.0.2", + "yallist": "^2.1.2" + } + }, + "macos-release": { + "version": "1.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/macos-release/-/macos-release-1.1.0.tgz", + "integrity": "sha512-mmLbumEYMi5nXReB9js3WGsB8UE6cDBWyIO62Z4DNx6GbRhDxHNjA1MlzSpJ2S2KM1wyiPRA0d19uHWYYvMHjA==", + "dev": true + }, + "make-dir": { + "version": "1.3.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/make-dir/-/make-dir-1.3.0.tgz", + "integrity": "sha512-2w31R7SJtieJJnQtGc7RVL2StM2vGYVfqUOvUDxH6bC6aJTxPxTF0GnIgCyu7tjockiUWAYQRbxa7vKn34s5sQ==", + "dev": true, + "requires": { + "pify": "^3.0.0" + } + }, + "map-cache": { + "version": "0.2.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/map-cache/-/map-cache-0.2.2.tgz", + "integrity": "sha1-wyq9C9ZSXZsFFkW7TyasXcmKDb8=", + "dev": true + }, + "map-obj": { + "version": "2.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/map-obj/-/map-obj-2.0.0.tgz", + "integrity": "sha1-plzSkIepJZi4eRJXpSPgISIqwfk=", + "dev": true + }, + "map-visit": { + "version": "1.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/map-visit/-/map-visit-1.0.0.tgz", + "integrity": "sha1-7Nyo8TFE5mDxtb1B8S80edmN+48=", + "dev": true, + "requires": { + "object-visit": "^1.0.0" + } + }, + "mem": { + "version": "1.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/mem/-/mem-1.1.0.tgz", + "integrity": "sha1-Xt1StIXKHZAP5kiVUFOZoN+kX3Y=", + "dev": true, + "requires": { + "mimic-fn": "^1.0.0" + } + }, + "mem-fs": { + "version": "1.1.3", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/mem-fs/-/mem-fs-1.1.3.tgz", + "integrity": "sha1-uK6NLj/Lb10/kWXBLUVRoGXZicw=", + "dev": true, + "requires": { + "through2": "^2.0.0", + "vinyl": "^1.1.0", + "vinyl-file": "^2.0.0" + } + }, + "mem-fs-editor": { + "version": "5.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/mem-fs-editor/-/mem-fs-editor-5.1.0.tgz", + "integrity": "sha512-2Yt2GCYEbcotYbIJagmow4gEtHDqzpq5XN94+yAx/NT5+bGqIjkXnm3KCUQfE6kRfScGp9IZknScoGRKu8L78w==", + "dev": true, + "requires": { + "commondir": "^1.0.1", + "deep-extend": "^0.6.0", + "ejs": "^2.5.9", + "glob": "^7.0.3", + "globby": "^8.0.1", + "isbinaryfile": "^3.0.2", + "mkdirp": "^0.5.0", + "multimatch": "^2.0.0", + "rimraf": "^2.2.8", + "through2": "^2.0.0", + "vinyl": "^2.0.1" + }, + "dependencies": { + "clone": { + "version": "2.1.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/clone/-/clone-2.1.2.tgz", + "integrity": "sha1-G39Ln1kfHo+DZwQBYANFoCiHQ18=", + "dev": true + }, + "clone-stats": { + "version": "1.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/clone-stats/-/clone-stats-1.0.0.tgz", + "integrity": "sha1-s3gt/4u1R04Yuba/D9/ngvh3doA=", + "dev": true + }, + "replace-ext": { + "version": "1.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/replace-ext/-/replace-ext-1.0.0.tgz", + "integrity": "sha1-3mMSg3P8v3w8z6TeWkgMRaZ5WOs=", + "dev": true + }, + "vinyl": { + "version": "2.2.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/vinyl/-/vinyl-2.2.0.tgz", + "integrity": "sha512-MBH+yP0kC/GQ5GwBqrTPTzEfiiLjta7hTtvQtbxBgTeSXsmKQRQecjibMbxIXzVT3Y9KJK+drOz1/k+vsu8Nkg==", + "dev": true, + "requires": { + "clone": "^2.1.1", + "clone-buffer": "^1.0.0", + "clone-stats": "^1.0.0", + "cloneable-readable": "^1.0.0", + "remove-trailing-separator": "^1.0.1", + "replace-ext": "^1.0.0" + } + } + } + }, + "meow": { + "version": "5.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/meow/-/meow-5.0.0.tgz", + "integrity": "sha512-CbTqYU17ABaLefO8vCU153ZZlprKYWDljcndKKDCFcYQITzWCXZAVk4QMFZPgvzrnUQ3uItnIE/LoUOwrT15Ig==", + "dev": true, + "requires": { + "camelcase-keys": "^4.0.0", + "decamelize-keys": "^1.0.0", + "loud-rejection": "^1.0.0", + "minimist-options": "^3.0.1", + "normalize-package-data": "^2.3.4", + "read-pkg-up": "^3.0.0", + "redent": "^2.0.0", + "trim-newlines": "^2.0.0", + "yargs-parser": "^10.0.0" + } + }, + "merge2": { + "version": "1.2.3", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/merge2/-/merge2-1.2.3.tgz", + "integrity": "sha512-gdUU1Fwj5ep4kplwcmftruWofEFt6lfpkkr3h860CXbAB9c3hGb55EOL2ali0Td5oebvW0E1+3Sr+Ur7XfKpRA==", + "dev": true + }, + "micromatch": { + "version": "3.1.10", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/micromatch/-/micromatch-3.1.10.tgz", + "integrity": "sha512-MWikgl9n9M3w+bpsY3He8L+w9eF9338xRl8IAO5viDizwSzziFEyUzo2xrrloB64ADbTf8uA8vRqqttDTOmccg==", + "dev": true, + "requires": { + "arr-diff": "^4.0.0", + "array-unique": "^0.3.2", + "braces": "^2.3.1", + "define-property": "^2.0.2", + "extend-shallow": "^3.0.2", + "extglob": "^2.0.4", + "fragment-cache": "^0.2.1", + "kind-of": "^6.0.2", + "nanomatch": "^1.2.9", + "object.pick": "^1.3.0", + "regex-not": "^1.0.0", + "snapdragon": "^0.8.1", + "to-regex": "^3.0.2" + }, + "dependencies": { + "arr-diff": { + "version": "4.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/arr-diff/-/arr-diff-4.0.0.tgz", + "integrity": "sha1-1kYQdP6/7HHn4VI1dhoyml3HxSA=", + "dev": true + }, + "extend-shallow": { + "version": "3.0.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/extend-shallow/-/extend-shallow-3.0.2.tgz", + "integrity": "sha1-Jqcarwc7OfshJxcnRhMcJwQCjbg=", + "dev": true, + "requires": { + "assign-symbols": "^1.0.0", + "is-extendable": "^1.0.1" + } + }, + "is-extendable": { + "version": "1.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/is-extendable/-/is-extendable-1.0.1.tgz", + "integrity": "sha512-arnXMxT1hhoKo9k1LZdmlNyJdDDfy2v0fXjFlmok4+i8ul/6WlbVge9bhM74OpNPQPMGUToDtz+KXa1PneJxOA==", + "dev": true, + "requires": { + "is-plain-object": "^2.0.4" + } + }, + "kind-of": { + "version": "6.0.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/kind-of/-/kind-of-6.0.2.tgz", + "integrity": "sha512-s5kLOcnH0XqDO+FvuaLX8DDjZ18CGFk7VygH40QoKPUQhW4e2rvM0rwUq0t8IQDOwYSeLK01U90OjzBTme2QqA==", + "dev": true + } + } + }, + "mime-db": { + "version": "1.36.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/mime-db/-/mime-db-1.36.0.tgz", + "integrity": "sha512-L+xvyD9MkoYMXb1jAmzI/lWYAxAMCPvIBSWur0PZ5nOf5euahRLVqH//FKW9mWp2lkqUgYiXPgkzfMUFi4zVDw==", + "dev": true + }, + "mime-types": { + "version": "2.1.20", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/mime-types/-/mime-types-2.1.20.tgz", + "integrity": "sha512-HrkrPaP9vGuWbLK1B1FfgAkbqNjIuy4eHlIYnFi7kamZyLLrGlo2mpcx0bBmNpKqBtYtAfGbodDddIgddSJC2A==", + "dev": true, + "requires": { + "mime-db": "~1.36.0" + } + }, + "mimic-fn": { + "version": "1.2.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/mimic-fn/-/mimic-fn-1.2.0.tgz", + "integrity": "sha512-jf84uxzwiuiIVKiOLpfYk7N46TSy8ubTonmneY9vrpHNAnp0QBt2BxWV9dO3/j+BoVAb+a5G6YDPW3M5HOdMWQ==", + "dev": true + }, + "mimic-response": { + "version": "1.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/mimic-response/-/mimic-response-1.0.1.tgz", + "integrity": "sha512-j5EctnkH7amfV/q5Hgmoal1g2QHFJRraOtmx0JpIqkxhBhI/lJSl1nMpQ45hVarwNETOoWEimndZ4QK0RHxuxQ==", + "dev": true + }, + "minimatch": { + "version": "3.0.4", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/minimatch/-/minimatch-3.0.4.tgz", + "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", + "dev": true, + "requires": { + "brace-expansion": "^1.1.7" + } + }, + "minimist": { + "version": "0.0.8", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/minimist/-/minimist-0.0.8.tgz", + "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=", + "dev": true + }, + "minimist-options": { + "version": "3.0.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/minimist-options/-/minimist-options-3.0.2.tgz", + "integrity": "sha512-FyBrT/d0d4+uiZRbqznPXqw3IpZZG3gl3wKWiX784FycUKVwBt0uLBFkQrtE4tZOrgo78nZp2jnKz3L65T5LdQ==", + "dev": true, + "requires": { + "arrify": "^1.0.1", + "is-plain-obj": "^1.1.0" + } + }, + "mixin-deep": { + "version": "1.3.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/mixin-deep/-/mixin-deep-1.3.1.tgz", + "integrity": "sha512-8ZItLHeEgaqEvd5lYBXfm4EZSFCX29Jb9K+lAHhDKzReKBQKj3R+7NOF6tjqYi9t4oI8VUfaWITJQm86wnXGNQ==", + "dev": true, + "requires": { + "for-in": "^1.0.2", + "is-extendable": "^1.0.1" + }, + "dependencies": { + "is-extendable": { + "version": "1.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/is-extendable/-/is-extendable-1.0.1.tgz", + "integrity": "sha512-arnXMxT1hhoKo9k1LZdmlNyJdDDfy2v0fXjFlmok4+i8ul/6WlbVge9bhM74OpNPQPMGUToDtz+KXa1PneJxOA==", + "dev": true, + "requires": { + "is-plain-object": "^2.0.4" + } + } + } + }, + "mkdirp": { + "version": "0.5.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/mkdirp/-/mkdirp-0.5.1.tgz", + "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", + "dev": true, + "requires": { + "minimist": "0.0.8" + } + }, + "ms": { + "version": "2.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/ms/-/ms-2.0.0.tgz", + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", + "dev": true + }, + "multimatch": { + "version": "2.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/multimatch/-/multimatch-2.1.0.tgz", + "integrity": "sha1-nHkGoi+0wCkZ4vX3UWG0zb1LKis=", + "dev": true, + "requires": { + "array-differ": "^1.0.0", + "array-union": "^1.0.1", + "arrify": "^1.0.0", + "minimatch": "^3.0.0" + } + }, + "mute-stream": { + "version": "0.0.7", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/mute-stream/-/mute-stream-0.0.7.tgz", + "integrity": "sha1-MHXOk7whuPq0PhvE2n6BFe0ee6s=", + "dev": true + }, + "nanomatch": { + "version": "1.2.13", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/nanomatch/-/nanomatch-1.2.13.tgz", + "integrity": "sha512-fpoe2T0RbHwBTBUOftAfBPaDEi06ufaUai0mE6Yn1kacc3SnTErfb/h+X94VXzI64rKFHYImXSvdwGGCmwOqCA==", + "dev": true, + "requires": { + "arr-diff": "^4.0.0", + "array-unique": "^0.3.2", + "define-property": "^2.0.2", + "extend-shallow": "^3.0.2", + "fragment-cache": "^0.2.1", + "is-windows": "^1.0.2", + "kind-of": "^6.0.2", + "object.pick": "^1.3.0", + "regex-not": "^1.0.0", + "snapdragon": "^0.8.1", + "to-regex": "^3.0.1" + }, + "dependencies": { + "arr-diff": { + "version": "4.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/arr-diff/-/arr-diff-4.0.0.tgz", + "integrity": "sha1-1kYQdP6/7HHn4VI1dhoyml3HxSA=", + "dev": true + }, + "extend-shallow": { + "version": "3.0.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/extend-shallow/-/extend-shallow-3.0.2.tgz", + "integrity": "sha1-Jqcarwc7OfshJxcnRhMcJwQCjbg=", + "dev": true, + "requires": { + "assign-symbols": "^1.0.0", + "is-extendable": "^1.0.1" + } + }, + "is-extendable": { + "version": "1.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/is-extendable/-/is-extendable-1.0.1.tgz", + "integrity": "sha512-arnXMxT1hhoKo9k1LZdmlNyJdDDfy2v0fXjFlmok4+i8ul/6WlbVge9bhM74OpNPQPMGUToDtz+KXa1PneJxOA==", + "dev": true, + "requires": { + "is-plain-object": "^2.0.4" + } + }, + "kind-of": { + "version": "6.0.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/kind-of/-/kind-of-6.0.2.tgz", + "integrity": "sha512-s5kLOcnH0XqDO+FvuaLX8DDjZ18CGFk7VygH40QoKPUQhW4e2rvM0rwUq0t8IQDOwYSeLK01U90OjzBTme2QqA==", + "dev": true + } + } + }, + "nice-try": { + "version": "1.0.5", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/nice-try/-/nice-try-1.0.5.tgz", + "integrity": "sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ==", + "dev": true + }, + "normalize-package-data": { + "version": "2.4.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/normalize-package-data/-/normalize-package-data-2.4.0.tgz", + "integrity": "sha512-9jjUFbTPfEy3R/ad/2oNbKtW9Hgovl5O1FvFWKkKblNXoN/Oou6+9+KKohPK13Yc3/TyunyWhJp6gvRNR/PPAw==", + "dev": true, + "requires": { + "hosted-git-info": "^2.1.4", + "is-builtin-module": "^1.0.0", + "semver": "2 || 3 || 4 || 5", + "validate-npm-package-license": "^3.0.1" + } + }, + "npm-run-path": { + "version": "2.0.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/npm-run-path/-/npm-run-path-2.0.2.tgz", + "integrity": "sha1-NakjLfo11wZ7TLLd8jV7GHFTbF8=", + "dev": true, + "requires": { + "path-key": "^2.0.0" + } + }, + "npmlog": { + "version": "2.0.4", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/npmlog/-/npmlog-2.0.4.tgz", + "integrity": "sha1-mLUlMPJRTKkNCexbIsiEZyI3VpI=", + "dev": true, + "requires": { + "ansi": "~0.3.1", + "are-we-there-yet": "~1.1.2", + "gauge": "~1.2.5" + } + }, + "number-is-nan": { + "version": "1.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/number-is-nan/-/number-is-nan-1.0.1.tgz", + "integrity": "sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0=", + "dev": true + }, + "oauth-sign": { + "version": "0.9.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/oauth-sign/-/oauth-sign-0.9.0.tgz", + "integrity": "sha512-fexhUFFPTGV8ybAtSIGbV6gOkSv8UtRbDBnAyLQw4QPKkgNlsH2ByPGtMUqdWkos6YCRmAqViwgZrJc/mRDzZQ==", + "dev": true + }, + "object-assign": { + "version": "4.1.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/object-assign/-/object-assign-4.1.1.tgz", + "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=", + "dev": true + }, + "object-copy": { + "version": "0.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/object-copy/-/object-copy-0.1.0.tgz", + "integrity": "sha1-fn2Fi3gb18mRpBupde04EnVOmYw=", + "dev": true, + "requires": { + "copy-descriptor": "^0.1.0", + "define-property": "^0.2.5", + "kind-of": "^3.0.3" + }, + "dependencies": { + "define-property": { + "version": "0.2.5", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/define-property/-/define-property-0.2.5.tgz", + "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", + "dev": true, + "requires": { + "is-descriptor": "^0.1.0" + } + }, + "kind-of": { + "version": "3.2.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true, + "requires": { + "is-buffer": "^1.1.5" + } + } + } + }, + "object-visit": { + "version": "1.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/object-visit/-/object-visit-1.0.1.tgz", + "integrity": "sha1-95xEk68MU3e1n+OdOV5BBC3QRbs=", + "dev": true, + "requires": { + "isobject": "^3.0.0" + } + }, + "object.pick": { + "version": "1.3.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/object.pick/-/object.pick-1.3.0.tgz", + "integrity": "sha1-h6EKxMFpS9Lhy/U1kaZhQftd10c=", + "dev": true, + "requires": { + "isobject": "^3.0.1" + } + }, + "once": { + "version": "1.4.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/once/-/once-1.4.0.tgz", + "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", + "dev": true, + "requires": { + "wrappy": "1" + } + }, + "one-time": { + "version": "0.0.4", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/one-time/-/one-time-0.0.4.tgz", + "integrity": "sha1-+M33eISCb+Tf+T46nMN7HkSAdC4=", + "dev": true + }, + "onetime": { + "version": "2.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/onetime/-/onetime-2.0.1.tgz", + "integrity": "sha1-BnQoIw/WdEOyeUsiu6UotoZ5YtQ=", + "dev": true, + "requires": { + "mimic-fn": "^1.0.0" + } + }, + "os-locale": { + "version": "2.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/os-locale/-/os-locale-2.1.0.tgz", + "integrity": "sha512-3sslG3zJbEYcaC4YVAvDorjGxc7tv6KVATnLPZONiljsUncvihe9BQoVCEs0RZ1kmf4Hk9OBqlZfJZWI4GanKA==", + "dev": true, + "requires": { + "execa": "^0.7.0", + "lcid": "^1.0.0", + "mem": "^1.1.0" + } + }, + "os-name": { + "version": "2.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/os-name/-/os-name-2.0.1.tgz", + "integrity": "sha1-uaOGNhwXrjohc27wWZQFyajF3F4=", + "dev": true, + "requires": { + "macos-release": "^1.0.0", + "win-release": "^1.0.0" + } + }, + "os-shim": { + "version": "0.1.3", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/os-shim/-/os-shim-0.1.3.tgz", + "integrity": "sha1-a2LDeRz3kJ6jXtRuF2WLtBfLORc=", + "dev": true + }, + "os-tmpdir": { + "version": "1.0.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/os-tmpdir/-/os-tmpdir-1.0.2.tgz", + "integrity": "sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ=", + "dev": true + }, + "p-cancelable": { + "version": "0.3.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/p-cancelable/-/p-cancelable-0.3.0.tgz", + "integrity": "sha512-RVbZPLso8+jFeq1MfNvgXtCRED2raz/dKpacfTNxsx6pLEpEomM7gah6VeHSYV3+vo0OAi4MkArtQcWWXuQoyw==", + "dev": true + }, + "p-finally": { + "version": "1.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/p-finally/-/p-finally-1.0.0.tgz", + "integrity": "sha1-P7z7FbiZpEEjs0ttzBi3JDNqLK4=", + "dev": true + }, + "p-limit": { + "version": "1.3.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/p-limit/-/p-limit-1.3.0.tgz", + "integrity": "sha512-vvcXsLAJ9Dr5rQOPk7toZQZJApBl2K4J6dANSsEuh6QI41JYcsS/qhTGa9ErIUUgK3WNQoJYvylxvjqmiqEA9Q==", + "dev": true, + "requires": { + "p-try": "^1.0.0" + } + }, + "p-locate": { + "version": "2.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/p-locate/-/p-locate-2.0.0.tgz", + "integrity": "sha1-IKAQOyIqcMj9OcwuWAaA893l7EM=", + "dev": true, + "requires": { + "p-limit": "^1.1.0" + } + }, + "p-timeout": { + "version": "1.2.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/p-timeout/-/p-timeout-1.2.1.tgz", + "integrity": "sha1-XrOzU7f86Z8QGhA4iAuwVOu+o4Y=", + "dev": true, + "requires": { + "p-finally": "^1.0.0" + } + }, + "p-try": { + "version": "1.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/p-try/-/p-try-1.0.0.tgz", + "integrity": "sha1-y8ec26+P1CKOE/Yh8rGiN8GyB7M=", + "dev": true + }, + "parse-gitignore": { + "version": "1.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/parse-gitignore/-/parse-gitignore-1.0.1.tgz", + "integrity": "sha512-UGyowyjtx26n65kdAMWhm6/3uy5uSrpcuH7tt+QEVudiBoVS+eqHxD5kbi9oWVRwj7sCzXqwuM+rUGw7earl6A==", + "dev": true + }, + "parse-json": { + "version": "4.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/parse-json/-/parse-json-4.0.0.tgz", + "integrity": "sha1-vjX1Qlvh9/bHRxhPmKeIy5lHfuA=", + "dev": true, + "requires": { + "error-ex": "^1.3.1", + "json-parse-better-errors": "^1.0.1" + } + }, + "pascalcase": { + "version": "0.1.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/pascalcase/-/pascalcase-0.1.1.tgz", + "integrity": "sha1-s2PlXoAGym/iF4TS2yK9FdeRfxQ=", + "dev": true + }, + "path-dirname": { + "version": "1.0.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/path-dirname/-/path-dirname-1.0.2.tgz", + "integrity": "sha1-zDPSTVJeCZpTiMAzbG4yuRYGCeA=", + "dev": true + }, + "path-exists": { + "version": "3.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/path-exists/-/path-exists-3.0.0.tgz", + "integrity": "sha1-zg6+ql94yxiSXqfYENe1mwEP1RU=", + "dev": true + }, + "path-is-absolute": { + "version": "1.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", + "dev": true + }, + "path-key": { + "version": "2.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/path-key/-/path-key-2.0.1.tgz", + "integrity": "sha1-QRyttXTFoUDTpLGRDUDYDMn0C0A=", + "dev": true + }, + "path-parse": { + "version": "1.0.6", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/path-parse/-/path-parse-1.0.6.tgz", + "integrity": "sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw==", + "dev": true + }, + "path-type": { + "version": "3.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/path-type/-/path-type-3.0.0.tgz", + "integrity": "sha512-T2ZUsdZFHgA3u4e5PfPbjd7HDDpxPnQb5jN0SrDsjNSuVXHJqtwTnWqG0B1jZrgmJ/7lj1EmVIByWt1gxGkWvg==", + "dev": true, + "requires": { + "pify": "^3.0.0" + } + }, + "performance-now": { + "version": "2.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/performance-now/-/performance-now-2.1.0.tgz", + "integrity": "sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns=", + "dev": true + }, + "pify": { + "version": "3.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/pify/-/pify-3.0.0.tgz", + "integrity": "sha1-5aSs0sEB/fPZpNB/DbxNtJ3SgXY=", + "dev": true + }, + "pinkie": { + "version": "2.0.4", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/pinkie/-/pinkie-2.0.4.tgz", + "integrity": "sha1-clVrgM+g1IqXToDnckjoDtT3+HA=", + "dev": true + }, + "pinkie-promise": { + "version": "2.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/pinkie-promise/-/pinkie-promise-2.0.1.tgz", + "integrity": "sha1-ITXW36ejWMBprJsXh3YogihFD/o=", + "dev": true, + "requires": { + "pinkie": "^2.0.0" + } + }, + "pkg-up": { + "version": "2.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/pkg-up/-/pkg-up-2.0.0.tgz", + "integrity": "sha1-yBmscoBZpGHKscOImivjxJoATX8=", + "dev": true, + "requires": { + "find-up": "^2.1.0" + } + }, + "plugin-error": { + "version": "0.1.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/plugin-error/-/plugin-error-0.1.2.tgz", + "integrity": "sha1-O5uzM1zPAPQl4HQ34ZJ2ln2kes4=", + "dev": true, + "requires": { + "ansi-cyan": "^0.1.1", + "ansi-red": "^0.1.1", + "arr-diff": "^1.0.1", + "arr-union": "^2.0.1", + "extend-shallow": "^1.1.2" + } + }, + "pluralize": { + "version": "7.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/pluralize/-/pluralize-7.0.0.tgz", + "integrity": "sha512-ARhBOdzS3e41FbkW/XWrTEtukqqLoK5+Z/4UeDaLuSW+39JPeFgs4gCGqsrJHVZX0fUrx//4OF0K1CUGwlIFow==", + "dev": true + }, + "posix-character-classes": { + "version": "0.1.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/posix-character-classes/-/posix-character-classes-0.1.1.tgz", + "integrity": "sha1-AerA/jta9xoqbAL+q7jB/vfgDqs=", + "dev": true + }, + "prepend-http": { + "version": "1.0.4", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/prepend-http/-/prepend-http-1.0.4.tgz", + "integrity": "sha1-1PRWKwzjaW5BrFLQ4ALlemNdxtw=", + "dev": true + }, + "prettier": { + "version": "1.13.7", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/prettier/-/prettier-1.13.7.tgz", + "integrity": "sha512-KIU72UmYPGk4MujZGYMFwinB7lOf2LsDNGSOC8ufevsrPLISrZbNJlWstRi3m0AMuszbH+EFSQ/r6w56RSPK6w==", + "dev": true + }, + "pretty-bytes": { + "version": "5.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/pretty-bytes/-/pretty-bytes-5.1.0.tgz", + "integrity": "sha512-wa5+qGVg9Yt7PB6rYm3kXlKzgzgivYTLRandezh43jjRqgyDyP+9YxfJpJiLs9yKD1WeU8/OvtToWpW7255FtA==", + "dev": true + }, + "process-nextick-args": { + "version": "2.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/process-nextick-args/-/process-nextick-args-2.0.0.tgz", + "integrity": "sha512-MtEC1TqN0EU5nephaJ4rAtThHtC86dNN9qCuEhtshvpVBkAW5ZO7BASN9REnF9eoXGcRub+pFuKEpOHE+HbEMw==", + "dev": true + }, + "pseudomap": { + "version": "1.0.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/pseudomap/-/pseudomap-1.0.2.tgz", + "integrity": "sha1-8FKijacOYYkX7wqKw0wa5aaChrM=", + "dev": true + }, + "psl": { + "version": "1.1.29", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/psl/-/psl-1.1.29.tgz", + "integrity": "sha512-AeUmQ0oLN02flVHXWh9sSJF7mcdFq0ppid/JkErufc3hGIV/AMa8Fo9VgDo/cT2jFdOWoFvHp90qqBH54W+gjQ==", + "dev": true + }, + "punycode": { + "version": "1.4.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/punycode/-/punycode-1.4.1.tgz", + "integrity": "sha1-wNWmOycYgArY4esPpSachN1BhF4=", + "dev": true + }, + "qs": { + "version": "6.5.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/qs/-/qs-6.5.2.tgz", + "integrity": "sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA==", + "dev": true + }, + "quick-lru": { + "version": "1.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/quick-lru/-/quick-lru-1.1.0.tgz", + "integrity": "sha1-Q2CxfGETatOAeDl/8RQW4Ybc+7g=", + "dev": true + }, + "randexp": { + "version": "0.4.9", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/randexp/-/randexp-0.4.9.tgz", + "integrity": "sha512-maAX1cnBkzIZ89O4tSQUOF098xjGMC8N+9vuY/WfHwg87THw6odD2Br35donlj5e6KnB1SB0QBHhTQhhDHuTPQ==", + "dev": true, + "requires": { + "drange": "^1.0.0", + "ret": "^0.2.0" + } + }, + "read-chunk": { + "version": "2.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/read-chunk/-/read-chunk-2.1.0.tgz", + "integrity": "sha1-agTAkoAF7Z1C4aasVgDhnLx/9lU=", + "dev": true, + "requires": { + "pify": "^3.0.0", + "safe-buffer": "^5.1.1" + } + }, + "read-pkg": { + "version": "3.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/read-pkg/-/read-pkg-3.0.0.tgz", + "integrity": "sha1-nLxoaXj+5l0WwA4rGcI3/Pbjg4k=", + "dev": true, + "requires": { + "load-json-file": "^4.0.0", + "normalize-package-data": "^2.3.2", + "path-type": "^3.0.0" + } + }, + "read-pkg-up": { + "version": "3.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/read-pkg-up/-/read-pkg-up-3.0.0.tgz", + "integrity": "sha1-PtSWaF26D4/hGNBpHcUfSh/5bwc=", + "dev": true, + "requires": { + "find-up": "^2.0.0", + "read-pkg": "^3.0.0" + } + }, + "readable-stream": { + "version": "2.3.6", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/readable-stream/-/readable-stream-2.3.6.tgz", + "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", + "dev": true, + "requires": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" + } + }, + "rechoir": { + "version": "0.6.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/rechoir/-/rechoir-0.6.2.tgz", + "integrity": "sha1-hSBLVNuoLVdC4oyWdW70OvUOM4Q=", + "dev": true, + "requires": { + "resolve": "^1.1.6" + } + }, + "redent": { + "version": "2.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/redent/-/redent-2.0.0.tgz", + "integrity": "sha1-wbIAe0LVfrE4kHmzyDM2OdXhzKo=", + "dev": true, + "requires": { + "indent-string": "^3.0.0", + "strip-indent": "^2.0.0" + } + }, + "regex-not": { + "version": "1.0.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/regex-not/-/regex-not-1.0.2.tgz", + "integrity": "sha512-J6SDjUgDxQj5NusnOtdFxDwN/+HWykR8GELwctJ7mdqhcyy1xEc4SRFHUXvxTp661YaVKAjfRLZ9cCqS6tn32A==", + "dev": true, + "requires": { + "extend-shallow": "^3.0.2", + "safe-regex": "^1.1.0" + }, + "dependencies": { + "extend-shallow": { + "version": "3.0.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/extend-shallow/-/extend-shallow-3.0.2.tgz", + "integrity": "sha1-Jqcarwc7OfshJxcnRhMcJwQCjbg=", + "dev": true, + "requires": { + "assign-symbols": "^1.0.0", + "is-extendable": "^1.0.1" + } + }, + "is-extendable": { + "version": "1.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/is-extendable/-/is-extendable-1.0.1.tgz", + "integrity": "sha512-arnXMxT1hhoKo9k1LZdmlNyJdDDfy2v0fXjFlmok4+i8ul/6WlbVge9bhM74OpNPQPMGUToDtz+KXa1PneJxOA==", + "dev": true, + "requires": { + "is-plain-object": "^2.0.4" + } + } + } + }, + "regexp-to-ast": { + "version": "0.3.5", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/regexp-to-ast/-/regexp-to-ast-0.3.5.tgz", + "integrity": "sha512-1CJygtdvsfNFwiyjaMLBWtg2tfEqx/jSZ8S6TV+GlNL8kiH8rb4cm5Pb7A/C2BpyM/fA8ZJEudlCwi/jvAY+Ow==", + "dev": true + }, + "remove-trailing-separator": { + "version": "1.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/remove-trailing-separator/-/remove-trailing-separator-1.1.0.tgz", + "integrity": "sha1-wkvOKig62tW8P1jg1IJJuSN52O8=", + "dev": true + }, + "repeat-element": { + "version": "1.1.3", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/repeat-element/-/repeat-element-1.1.3.tgz", + "integrity": "sha512-ahGq0ZnV5m5XtZLMb+vP76kcAM5nkLqk0lpqAuojSKGgQtn4eRi4ZZGm2olo2zKFH+sMsWaqOCW1dqAnOru72g==", + "dev": true + }, + "repeat-string": { + "version": "1.6.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/repeat-string/-/repeat-string-1.6.1.tgz", + "integrity": "sha1-jcrkcOHIirwtYA//Sndihtp15jc=", + "dev": true + }, + "replace-ext": { + "version": "0.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/replace-ext/-/replace-ext-0.0.1.tgz", + "integrity": "sha1-KbvZIHinOfC8zitO5B6DeVNSKSQ=", + "dev": true + }, + "request": { + "version": "2.88.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/request/-/request-2.88.0.tgz", + "integrity": "sha512-NAqBSrijGLZdM0WZNsInLJpkJokL72XYjUpnB0iwsRgxh7dB6COrHnTBNwN0E+lHDAJzu7kLAkDeY08z2/A0hg==", + "dev": true, + "requires": { + "aws-sign2": "~0.7.0", + "aws4": "^1.8.0", + "caseless": "~0.12.0", + "combined-stream": "~1.0.6", + "extend": "~3.0.2", + "forever-agent": "~0.6.1", + "form-data": "~2.3.2", + "har-validator": "~5.1.0", + "http-signature": "~1.2.0", + "is-typedarray": "~1.0.0", + "isstream": "~0.1.2", + "json-stringify-safe": "~5.0.1", + "mime-types": "~2.1.19", + "oauth-sign": "~0.9.0", + "performance-now": "^2.1.0", + "qs": "~6.5.2", + "safe-buffer": "^5.1.2", + "tough-cookie": "~2.4.3", + "tunnel-agent": "^0.6.0", + "uuid": "^3.3.2" + } + }, + "resolve": { + "version": "1.8.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/resolve/-/resolve-1.8.1.tgz", + "integrity": "sha512-AicPrAC7Qu1JxPCZ9ZgCZlY35QgFnNqc+0LtbRNxnVw4TXvjQ72wnuL9JQcEBgXkI9JM8MsT9kaQoHcpCRJOYA==", + "dev": true, + "requires": { + "path-parse": "^1.0.5" + } + }, + "resolve-url": { + "version": "0.2.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/resolve-url/-/resolve-url-0.2.1.tgz", + "integrity": "sha1-LGN/53yJOv0qZj/iGqkIAGjiBSo=", + "dev": true + }, + "restore-cursor": { + "version": "2.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/restore-cursor/-/restore-cursor-2.0.0.tgz", + "integrity": "sha1-n37ih/gv0ybU/RYpI9YhKe7g368=", + "dev": true, + "requires": { + "onetime": "^2.0.0", + "signal-exit": "^3.0.2" + } + }, + "ret": { + "version": "0.2.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/ret/-/ret-0.2.2.tgz", + "integrity": "sha512-M0b3YWQs7R3Z917WRQy1HHA7Ba7D8hvZg6UE5mLykJxQVE2ju0IXbGlaHPPlkY+WN7wFP+wUMXmBFA0aV6vYGQ==", + "dev": true + }, + "rimraf": { + "version": "2.6.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/rimraf/-/rimraf-2.6.2.tgz", + "integrity": "sha512-lreewLK/BlghmxtfH36YYVg1i8IAce4TI7oao75I1g245+6BctqTVQiBP3YUJ9C6DQOXJmkYR9X9fCLtCOJc5w==", + "dev": true, + "requires": { + "glob": "^7.0.5" + } + }, + "run-async": { + "version": "2.3.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/run-async/-/run-async-2.3.0.tgz", + "integrity": "sha1-A3GrSuC91yDUFm19/aZP96RFpsA=", + "dev": true, + "requires": { + "is-promise": "^2.1.0" + } + }, + "rx": { + "version": "4.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/rx/-/rx-4.1.0.tgz", + "integrity": "sha1-pfE/957zt0D+MKqAP7CfmIBdR4I=", + "dev": true + }, + "rxjs": { + "version": "5.5.12", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/rxjs/-/rxjs-5.5.12.tgz", + "integrity": "sha512-xx2itnL5sBbqeeiVgNPVuQQ1nC8Jp2WfNJhXWHmElW9YmrpS9UVnNzhP3EH3HFqexO5Tlp8GhYY+WEcqcVMvGw==", + "dev": true, + "requires": { + "symbol-observable": "1.0.1" + } + }, + "safe-buffer": { + "version": "5.1.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", + "dev": true + }, + "safe-regex": { + "version": "1.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/safe-regex/-/safe-regex-1.1.0.tgz", + "integrity": "sha1-QKNmnzsHfR6UPURinhV91IAjvy4=", + "dev": true, + "requires": { + "ret": "~0.1.10" + }, + "dependencies": { + "ret": { + "version": "0.1.15", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/ret/-/ret-0.1.15.tgz", + "integrity": "sha512-TTlYpa+OL+vMMNG24xSlQGEJ3B/RzEfUlLct7b5G/ytav+wPrplCpVMFuwzXbkecJrb6IYo1iFb0S9v37754mg==", + "dev": true + } + } + }, + "safer-buffer": { + "version": "2.1.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/safer-buffer/-/safer-buffer-2.1.2.tgz", + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", + "dev": true + }, + "scoped-regex": { + "version": "1.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/scoped-regex/-/scoped-regex-1.0.0.tgz", + "integrity": "sha1-o0a7Gs1CB65wvXwMfKnlZra63bg=", + "dev": true + }, + "semver": { + "version": "5.5.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/semver/-/semver-5.5.0.tgz", + "integrity": "sha512-4SJ3dm0WAwWy/NVeioZh5AntkdJoWKxHxcmyP622fOkgHa4z3R0TdBJICINyaSDE6uNwVc8gZr+ZinwZAH4xIA==", + "dev": true + }, + "set-value": { + "version": "2.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/set-value/-/set-value-2.0.0.tgz", + "integrity": "sha512-hw0yxk9GT/Hr5yJEYnHNKYXkIA8mVJgd9ditYZCe16ZczcaELYYcfvaXesNACk2O8O0nTiPQcQhGUQj8JLzeeg==", + "dev": true, + "requires": { + "extend-shallow": "^2.0.1", + "is-extendable": "^0.1.1", + "is-plain-object": "^2.0.3", + "split-string": "^3.0.1" + }, + "dependencies": { + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "dev": true, + "requires": { + "is-extendable": "^0.1.0" + } + } + } + }, + "shebang-command": { + "version": "1.2.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/shebang-command/-/shebang-command-1.2.0.tgz", + "integrity": "sha1-RKrGW2lbAzmJaMOfNj/uXer98eo=", + "dev": true, + "requires": { + "shebang-regex": "^1.0.0" + } + }, + "shebang-regex": { + "version": "1.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/shebang-regex/-/shebang-regex-1.0.0.tgz", + "integrity": "sha1-2kL0l0DAtC2yypcoVxyxkMmO/qM=", + "dev": true + }, + "shelljs": { + "version": "0.8.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/shelljs/-/shelljs-0.8.2.tgz", + "integrity": "sha512-pRXeNrCA2Wd9itwhvLp5LZQvPJ0wU6bcjaTMywHHGX5XWhVN2nzSu7WV0q+oUY7mGK3mgSkDDzP3MgjqdyIgbQ==", + "dev": true, + "requires": { + "glob": "^7.0.0", + "interpret": "^1.0.0", + "rechoir": "^0.6.2" + } + }, + "signal-exit": { + "version": "3.0.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/signal-exit/-/signal-exit-3.0.2.tgz", + "integrity": "sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0=", + "dev": true + }, + "simple-swizzle": { + "version": "0.2.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/simple-swizzle/-/simple-swizzle-0.2.2.tgz", + "integrity": "sha1-pNprY1/8zMoz9w0Xy5JZLeleVXo=", + "dev": true, + "requires": { + "is-arrayish": "^0.3.1" + } + }, + "slash": { + "version": "1.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/slash/-/slash-1.0.0.tgz", + "integrity": "sha1-xB8vbDn8FtHNF61LXYlhFK5HDVU=", + "dev": true + }, + "snapdragon": { + "version": "0.8.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/snapdragon/-/snapdragon-0.8.2.tgz", + "integrity": "sha512-FtyOnWN/wCHTVXOMwvSv26d+ko5vWlIDD6zoUJ7LW8vh+ZBC8QdljveRP+crNrtBwioEUWy/4dMtbBjA4ioNlg==", + "dev": true, + "requires": { + "base": "^0.11.1", + "debug": "^2.2.0", + "define-property": "^0.2.5", + "extend-shallow": "^2.0.1", + "map-cache": "^0.2.2", + "source-map": "^0.5.6", + "source-map-resolve": "^0.5.0", + "use": "^3.1.0" + }, + "dependencies": { + "debug": { + "version": "2.6.9", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "dev": true, + "requires": { + "ms": "2.0.0" + } + }, + "define-property": { + "version": "0.2.5", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/define-property/-/define-property-0.2.5.tgz", + "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", + "dev": true, + "requires": { + "is-descriptor": "^0.1.0" + } + }, + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "dev": true, + "requires": { + "is-extendable": "^0.1.0" + } + } + } + }, + "snapdragon-node": { + "version": "2.1.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/snapdragon-node/-/snapdragon-node-2.1.1.tgz", + "integrity": "sha512-O27l4xaMYt/RSQ5TR3vpWCAB5Kb/czIcqUFOM/C4fYcLnbZUc1PkjTAMjof2pBWaSTwOUd6qUHcFGVGj7aIwnw==", + "dev": true, + "requires": { + "define-property": "^1.0.0", + "isobject": "^3.0.0", + "snapdragon-util": "^3.0.1" + }, + "dependencies": { + "define-property": { + "version": "1.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/define-property/-/define-property-1.0.0.tgz", + "integrity": "sha1-dp66rz9KY6rTr56NMEybvnm/sOY=", + "dev": true, + "requires": { + "is-descriptor": "^1.0.0" + } + }, + "is-accessor-descriptor": { + "version": "1.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz", + "integrity": "sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ==", + "dev": true, + "requires": { + "kind-of": "^6.0.0" + } + }, + "is-data-descriptor": { + "version": "1.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz", + "integrity": "sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ==", + "dev": true, + "requires": { + "kind-of": "^6.0.0" + } + }, + "is-descriptor": { + "version": "1.0.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/is-descriptor/-/is-descriptor-1.0.2.tgz", + "integrity": "sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg==", + "dev": true, + "requires": { + "is-accessor-descriptor": "^1.0.0", + "is-data-descriptor": "^1.0.0", + "kind-of": "^6.0.2" + } + }, + "kind-of": { + "version": "6.0.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/kind-of/-/kind-of-6.0.2.tgz", + "integrity": "sha512-s5kLOcnH0XqDO+FvuaLX8DDjZ18CGFk7VygH40QoKPUQhW4e2rvM0rwUq0t8IQDOwYSeLK01U90OjzBTme2QqA==", + "dev": true + } + } + }, + "snapdragon-util": { + "version": "3.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/snapdragon-util/-/snapdragon-util-3.0.1.tgz", + "integrity": "sha512-mbKkMdQKsjX4BAL4bRYTj21edOf8cN7XHdYUJEe+Zn99hVEYcMvKPct1IqNe7+AZPirn8BCDOQBHQZknqmKlZQ==", + "dev": true, + "requires": { + "kind-of": "^3.2.0" + }, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true, + "requires": { + "is-buffer": "^1.1.5" + } + } + } + }, + "source-map": { + "version": "0.5.7", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/source-map/-/source-map-0.5.7.tgz", + "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=", + "dev": true + }, + "source-map-resolve": { + "version": "0.5.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/source-map-resolve/-/source-map-resolve-0.5.2.tgz", + "integrity": "sha512-MjqsvNwyz1s0k81Goz/9vRBe9SZdB09Bdw+/zYyO+3CuPk6fouTaxscHkgtE8jKvf01kVfl8riHzERQ/kefaSA==", + "dev": true, + "requires": { + "atob": "^2.1.1", + "decode-uri-component": "^0.2.0", + "resolve-url": "^0.2.1", + "source-map-url": "^0.4.0", + "urix": "^0.1.0" + } + }, + "source-map-url": { + "version": "0.4.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/source-map-url/-/source-map-url-0.4.0.tgz", + "integrity": "sha1-PpNdfd1zYxuXZZlW1VEo6HtQhKM=", + "dev": true + }, + "spawn-sync": { + "version": "1.0.15", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/spawn-sync/-/spawn-sync-1.0.15.tgz", + "integrity": "sha1-sAeZVX63+wyDdsKdROih6mfldHY=", + "dev": true, + "requires": { + "concat-stream": "^1.4.7", + "os-shim": "^0.1.2" + } + }, + "spdx-correct": { + "version": "3.0.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/spdx-correct/-/spdx-correct-3.0.2.tgz", + "integrity": "sha512-q9hedtzyXHr5S0A1vEPoK/7l8NpfkFYTq6iCY+Pno2ZbdZR6WexZFtqeVGkGxW3TEJMN914Z55EnAGMmenlIQQ==", + "dev": true, + "requires": { + "spdx-expression-parse": "^3.0.0", + "spdx-license-ids": "^3.0.0" + } + }, + "spdx-exceptions": { + "version": "2.2.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/spdx-exceptions/-/spdx-exceptions-2.2.0.tgz", + "integrity": "sha512-2XQACfElKi9SlVb1CYadKDXvoajPgBVPn/gOQLrTvHdElaVhr7ZEbqJaRnJLVNeaI4cMEAgVCeBMKF6MWRDCRA==", + "dev": true + }, + "spdx-expression-parse": { + "version": "3.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/spdx-expression-parse/-/spdx-expression-parse-3.0.0.tgz", + "integrity": "sha512-Yg6D3XpRD4kkOmTpdgbUiEJFKghJH03fiC1OPll5h/0sO6neh2jqRDVHOQ4o/LMea0tgCkbMgea5ip/e+MkWyg==", + "dev": true, + "requires": { + "spdx-exceptions": "^2.1.0", + "spdx-license-ids": "^3.0.0" + } + }, + "spdx-license-ids": { + "version": "3.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/spdx-license-ids/-/spdx-license-ids-3.0.1.tgz", + "integrity": "sha512-TfOfPcYGBB5sDuPn3deByxPhmfegAhpDYKSOXZQN81Oyrrif8ZCodOLzK3AesELnCx03kikhyDwh0pfvvQvF8w==", + "dev": true + }, + "split-string": { + "version": "3.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/split-string/-/split-string-3.1.0.tgz", + "integrity": "sha512-NzNVhJDYpwceVVii8/Hu6DKfD2G+NrQHlS/V/qgv763EYudVwEcMQNxd2lh+0VrUByXN/oJkl5grOhYWvQUYiw==", + "dev": true, + "requires": { + "extend-shallow": "^3.0.0" + }, + "dependencies": { + "extend-shallow": { + "version": "3.0.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/extend-shallow/-/extend-shallow-3.0.2.tgz", + "integrity": "sha1-Jqcarwc7OfshJxcnRhMcJwQCjbg=", + "dev": true, + "requires": { + "assign-symbols": "^1.0.0", + "is-extendable": "^1.0.1" + } + }, + "is-extendable": { + "version": "1.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/is-extendable/-/is-extendable-1.0.1.tgz", + "integrity": "sha512-arnXMxT1hhoKo9k1LZdmlNyJdDDfy2v0fXjFlmok4+i8ul/6WlbVge9bhM74OpNPQPMGUToDtz+KXa1PneJxOA==", + "dev": true, + "requires": { + "is-plain-object": "^2.0.4" + } + } + } + }, + "sprintf-js": { + "version": "1.0.3", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/sprintf-js/-/sprintf-js-1.0.3.tgz", + "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=", + "dev": true + }, + "sshpk": { + "version": "1.15.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/sshpk/-/sshpk-1.15.1.tgz", + "integrity": "sha512-mSdgNUaidk+dRU5MhYtN9zebdzF2iG0cNPWy8HG+W8y+fT1JnSkh0fzzpjOa0L7P8i1Rscz38t0h4gPcKz43xA==", + "dev": true, + "requires": { + "asn1": "~0.2.3", + "assert-plus": "^1.0.0", + "bcrypt-pbkdf": "^1.0.0", + "dashdash": "^1.12.0", + "ecc-jsbn": "~0.1.1", + "getpass": "^0.1.1", + "jsbn": "~0.1.0", + "safer-buffer": "^2.0.2", + "tweetnacl": "~0.14.0" + } + }, + "stack-trace": { + "version": "0.0.10", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/stack-trace/-/stack-trace-0.0.10.tgz", + "integrity": "sha1-VHxws0fo0ytOEI6hoqFZ5f3eGcA=", + "dev": true + }, + "static-extend": { + "version": "0.1.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/static-extend/-/static-extend-0.1.2.tgz", + "integrity": "sha1-YICcOcv/VTNyJv1eC1IPNB8ftcY=", + "dev": true, + "requires": { + "define-property": "^0.2.5", + "object-copy": "^0.1.0" + }, + "dependencies": { + "define-property": { + "version": "0.2.5", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/define-property/-/define-property-0.2.5.tgz", + "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", + "dev": true, + "requires": { + "is-descriptor": "^0.1.0" + } + } + } + }, + "streamfilter": { + "version": "1.0.7", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/streamfilter/-/streamfilter-1.0.7.tgz", + "integrity": "sha512-Gk6KZM+yNA1JpW0KzlZIhjo3EaBJDkYfXtYSbOwNIQ7Zd6006E6+sCFlW1NDvFG/vnXhKmw6TJJgiEQg/8lXfQ==", + "dev": true, + "requires": { + "readable-stream": "^2.0.2" + } + }, + "string-template": { + "version": "0.2.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/string-template/-/string-template-0.2.1.tgz", + "integrity": "sha1-QpMuWYo1LQH8IuwzZ9nYTuxsmt0=", + "dev": true + }, + "string-width": { + "version": "2.1.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/string-width/-/string-width-2.1.1.tgz", + "integrity": "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==", + "dev": true, + "requires": { + "is-fullwidth-code-point": "^2.0.0", + "strip-ansi": "^4.0.0" + } + }, + "string_decoder": { + "version": "1.1.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/string_decoder/-/string_decoder-1.1.1.tgz", + "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", + "dev": true, + "requires": { + "safe-buffer": "~5.1.0" + } + }, + "strip-ansi": { + "version": "4.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/strip-ansi/-/strip-ansi-4.0.0.tgz", + "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", + "dev": true, + "requires": { + "ansi-regex": "^3.0.0" + } + }, + "strip-bom": { + "version": "3.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/strip-bom/-/strip-bom-3.0.0.tgz", + "integrity": "sha1-IzTBjpx1n3vdVv3vfprj1YjmjtM=", + "dev": true + }, + "strip-bom-stream": { + "version": "2.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/strip-bom-stream/-/strip-bom-stream-2.0.0.tgz", + "integrity": "sha1-+H217yYT9paKpUWr/h7HKLaoKco=", + "dev": true, + "requires": { + "first-chunk-stream": "^2.0.0", + "strip-bom": "^2.0.0" + }, + "dependencies": { + "strip-bom": { + "version": "2.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/strip-bom/-/strip-bom-2.0.0.tgz", + "integrity": "sha1-YhmoVhZSBJHzV4i9vxRHqZx+aw4=", + "dev": true, + "requires": { + "is-utf8": "^0.2.0" + } + } + } + }, + "strip-eof": { + "version": "1.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/strip-eof/-/strip-eof-1.0.0.tgz", + "integrity": "sha1-u0P/VZim6wXYm1n80SnJgzE2Br8=", + "dev": true + }, + "strip-indent": { + "version": "2.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/strip-indent/-/strip-indent-2.0.0.tgz", + "integrity": "sha1-XvjbKV0B5u1sv3qrlpmNeCJSe2g=", + "dev": true + }, + "supports-color": { + "version": "5.5.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } + }, + "symbol-observable": { + "version": "1.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/symbol-observable/-/symbol-observable-1.0.1.tgz", + "integrity": "sha1-g0D8RwLDEi310iKI+IKD9RPT/dQ=", + "dev": true + }, + "tabtab": { + "version": "2.2.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/tabtab/-/tabtab-2.2.2.tgz", + "integrity": "sha1-egR/FDsBC0y9MfhX6ClhUSy/ThQ=", + "dev": true, + "requires": { + "debug": "^2.2.0", + "inquirer": "^1.0.2", + "lodash.difference": "^4.5.0", + "lodash.uniq": "^4.5.0", + "minimist": "^1.2.0", + "mkdirp": "^0.5.1", + "npmlog": "^2.0.3", + "object-assign": "^4.1.0" + }, + "dependencies": { + "ansi-escapes": { + "version": "1.4.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/ansi-escapes/-/ansi-escapes-1.4.0.tgz", + "integrity": "sha1-06ioOzGapneTZisT52HHkRQiMG4=", + "dev": true + }, + "ansi-regex": { + "version": "2.1.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/ansi-regex/-/ansi-regex-2.1.1.tgz", + "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=", + "dev": true + }, + "ansi-styles": { + "version": "2.2.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/ansi-styles/-/ansi-styles-2.2.1.tgz", + "integrity": "sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4=", + "dev": true + }, + "chalk": { + "version": "1.1.3", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/chalk/-/chalk-1.1.3.tgz", + "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", + "dev": true, + "requires": { + "ansi-styles": "^2.2.1", + "escape-string-regexp": "^1.0.2", + "has-ansi": "^2.0.0", + "strip-ansi": "^3.0.0", + "supports-color": "^2.0.0" + } + }, + "cli-cursor": { + "version": "1.0.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/cli-cursor/-/cli-cursor-1.0.2.tgz", + "integrity": "sha1-ZNo/fValRBLll5S9Ytw1KV6PKYc=", + "dev": true, + "requires": { + "restore-cursor": "^1.0.1" + } + }, + "debug": { + "version": "2.6.9", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "dev": true, + "requires": { + "ms": "2.0.0" + } + }, + "external-editor": { + "version": "1.1.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/external-editor/-/external-editor-1.1.1.tgz", + "integrity": "sha1-Etew24UPf/fnCBuvQAVwAGDEYAs=", + "dev": true, + "requires": { + "extend": "^3.0.0", + "spawn-sync": "^1.0.15", + "tmp": "^0.0.29" + } + }, + "figures": { + "version": "1.7.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/figures/-/figures-1.7.0.tgz", + "integrity": "sha1-y+Hjr/zxzUS4DK3+0o3Hk6lwHS4=", + "dev": true, + "requires": { + "escape-string-regexp": "^1.0.5", + "object-assign": "^4.1.0" + } + }, + "inquirer": { + "version": "1.2.3", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/inquirer/-/inquirer-1.2.3.tgz", + "integrity": "sha1-TexvMvN+97sLLtPx0aXD9UUHSRg=", + "dev": true, + "requires": { + "ansi-escapes": "^1.1.0", + "chalk": "^1.0.0", + "cli-cursor": "^1.0.1", + "cli-width": "^2.0.0", + "external-editor": "^1.1.0", + "figures": "^1.3.5", + "lodash": "^4.3.0", + "mute-stream": "0.0.6", + "pinkie-promise": "^2.0.0", + "run-async": "^2.2.0", + "rx": "^4.1.0", + "string-width": "^1.0.1", + "strip-ansi": "^3.0.0", + "through": "^2.3.6" + } + }, + "is-fullwidth-code-point": { + "version": "1.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz", + "integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=", + "dev": true, + "requires": { + "number-is-nan": "^1.0.0" + } + }, + "minimist": { + "version": "1.2.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/minimist/-/minimist-1.2.0.tgz", + "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=", + "dev": true + }, + "mute-stream": { + "version": "0.0.6", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/mute-stream/-/mute-stream-0.0.6.tgz", + "integrity": "sha1-SJYrGeFp/R38JAs/HnMXYnu8R9s=", + "dev": true + }, + "onetime": { + "version": "1.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/onetime/-/onetime-1.1.0.tgz", + "integrity": "sha1-ofeDj4MUxRbwXs78vEzP4EtO14k=", + "dev": true + }, + "restore-cursor": { + "version": "1.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/restore-cursor/-/restore-cursor-1.0.1.tgz", + "integrity": "sha1-NGYfRohjJ/7SmRR5FSJS35LapUE=", + "dev": true, + "requires": { + "exit-hook": "^1.0.0", + "onetime": "^1.0.0" + } + }, + "string-width": { + "version": "1.0.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/string-width/-/string-width-1.0.2.tgz", + "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", + "dev": true, + "requires": { + "code-point-at": "^1.0.0", + "is-fullwidth-code-point": "^1.0.0", + "strip-ansi": "^3.0.0" + } + }, + "strip-ansi": { + "version": "3.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/strip-ansi/-/strip-ansi-3.0.1.tgz", + "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", + "dev": true, + "requires": { + "ansi-regex": "^2.0.0" + } + }, + "supports-color": { + "version": "2.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/supports-color/-/supports-color-2.0.0.tgz", + "integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc=", + "dev": true + }, + "tmp": { + "version": "0.0.29", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/tmp/-/tmp-0.0.29.tgz", + "integrity": "sha1-8lEl/w3Z2jzLDC3Tce4SiLuRKMA=", + "dev": true, + "requires": { + "os-tmpdir": "~1.0.1" + } + } + } + }, + "text-hex": { + "version": "1.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/text-hex/-/text-hex-1.0.0.tgz", + "integrity": "sha512-uuVGNWzgJ4yhRaNSiubPY7OjISw4sw4E5Uv0wbjp+OzcbmVU/rsT8ujgcXJhn9ypzsgr5vlzpPqP+MBBKcGvbg==", + "dev": true + }, + "text-table": { + "version": "0.2.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/text-table/-/text-table-0.2.0.tgz", + "integrity": "sha1-f17oI66AUgfACvLfSoTsP8+lcLQ=", + "dev": true + }, + "textextensions": { + "version": "2.2.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/textextensions/-/textextensions-2.2.0.tgz", + "integrity": "sha512-j5EMxnryTvKxwH2Cq+Pb43tsf6sdEgw6Pdwxk83mPaq0ToeFJt6WE4J3s5BqY7vmjlLgkgXvhtXUxo80FyBhCA==", + "dev": true + }, + "through": { + "version": "2.3.8", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/through/-/through-2.3.8.tgz", + "integrity": "sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU=", + "dev": true + }, + "through2": { + "version": "2.0.3", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/through2/-/through2-2.0.3.tgz", + "integrity": "sha1-AARWmzfHx0ujnEPzzteNGtlBQL4=", + "dev": true, + "requires": { + "readable-stream": "^2.1.5", + "xtend": "~4.0.1" + } + }, + "timed-out": { + "version": "4.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/timed-out/-/timed-out-4.0.1.tgz", + "integrity": "sha1-8y6srFoXW+ol1/q1Zas+2HQe9W8=", + "dev": true + }, + "tmp": { + "version": "0.0.33", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/tmp/-/tmp-0.0.33.tgz", + "integrity": "sha512-jRCJlojKnZ3addtTOjdIqoRuPEKBvNXcGYqzO6zWZX8KfKEpnGY5jfggJQ3EjKuu8D4bJRr0y+cYJFmYbImXGw==", + "dev": true, + "requires": { + "os-tmpdir": "~1.0.2" + } + }, + "to-object-path": { + "version": "0.3.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/to-object-path/-/to-object-path-0.3.0.tgz", + "integrity": "sha1-KXWIt7Dn4KwI4E5nL4XB9JmeF68=", + "dev": true, + "requires": { + "kind-of": "^3.0.2" + }, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true, + "requires": { + "is-buffer": "^1.1.5" + } + } + } + }, + "to-regex": { + "version": "3.0.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/to-regex/-/to-regex-3.0.2.tgz", + "integrity": "sha512-FWtleNAtZ/Ki2qtqej2CXTOayOH9bHDQF+Q48VpWyDXjbYxA4Yz8iDB31zXOBUlOHHKidDbqGVrTUvQMPmBGBw==", + "dev": true, + "requires": { + "define-property": "^2.0.2", + "extend-shallow": "^3.0.2", + "regex-not": "^1.0.2", + "safe-regex": "^1.1.0" + }, + "dependencies": { + "extend-shallow": { + "version": "3.0.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/extend-shallow/-/extend-shallow-3.0.2.tgz", + "integrity": "sha1-Jqcarwc7OfshJxcnRhMcJwQCjbg=", + "dev": true, + "requires": { + "assign-symbols": "^1.0.0", + "is-extendable": "^1.0.1" + } + }, + "is-extendable": { + "version": "1.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/is-extendable/-/is-extendable-1.0.1.tgz", + "integrity": "sha512-arnXMxT1hhoKo9k1LZdmlNyJdDDfy2v0fXjFlmok4+i8ul/6WlbVge9bhM74OpNPQPMGUToDtz+KXa1PneJxOA==", + "dev": true, + "requires": { + "is-plain-object": "^2.0.4" + } + } + } + }, + "to-regex-range": { + "version": "2.1.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/to-regex-range/-/to-regex-range-2.1.1.tgz", + "integrity": "sha1-fIDBe53+vlmeJzZ+DU3VWQFB2zg=", + "dev": true, + "requires": { + "is-number": "^3.0.0", + "repeat-string": "^1.6.1" + } + }, + "tough-cookie": { + "version": "2.4.3", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/tough-cookie/-/tough-cookie-2.4.3.tgz", + "integrity": "sha512-Q5srk/4vDM54WJsJio3XNn6K2sCG+CQ8G5Wz6bZhRZoAe/+TxjWB/GlFAnYEbkYVlON9FMk/fE3h2RLpPXo4lQ==", + "dev": true, + "requires": { + "psl": "^1.1.24", + "punycode": "^1.4.1" + } + }, + "trim-newlines": { + "version": "2.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/trim-newlines/-/trim-newlines-2.0.0.tgz", + "integrity": "sha1-tAPQuRvlDDMd/EuC7s6yLD3hbSA=", + "dev": true + }, + "triple-beam": { + "version": "1.3.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/triple-beam/-/triple-beam-1.3.0.tgz", + "integrity": "sha512-XrHUvV5HpdLmIj4uVMxHggLbFSZYIn7HEWsqePZcI50pco+MPqJ50wMGY794X7AOOhxOBAjbkqfAbEe/QMp2Lw==", + "dev": true + }, + "tunnel-agent": { + "version": "0.6.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/tunnel-agent/-/tunnel-agent-0.6.0.tgz", + "integrity": "sha1-J6XeoGs2sEoKmWZ3SykIaPD8QP0=", + "dev": true, + "requires": { + "safe-buffer": "^5.0.1" + } + }, + "tweetnacl": { + "version": "0.14.5", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/tweetnacl/-/tweetnacl-0.14.5.tgz", + "integrity": "sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q=", + "dev": true + }, + "typedarray": { + "version": "0.0.6", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/typedarray/-/typedarray-0.0.6.tgz", + "integrity": "sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=", + "dev": true + }, + "union-value": { + "version": "1.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/union-value/-/union-value-1.0.0.tgz", + "integrity": "sha1-XHHDTLW61dzr4+oM0IIHulqhrqQ=", + "dev": true, + "requires": { + "arr-union": "^3.1.0", + "get-value": "^2.0.6", + "is-extendable": "^0.1.1", + "set-value": "^0.4.3" + }, + "dependencies": { + "arr-union": { + "version": "3.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/arr-union/-/arr-union-3.1.0.tgz", + "integrity": "sha1-45sJrqne+Gao8gbiiK9jkZuuOcQ=", + "dev": true + }, + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "dev": true, + "requires": { + "is-extendable": "^0.1.0" + } + }, + "set-value": { + "version": "0.4.3", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/set-value/-/set-value-0.4.3.tgz", + "integrity": "sha1-fbCPnT0i3H945Trzw79GZuzfzPE=", + "dev": true, + "requires": { + "extend-shallow": "^2.0.1", + "is-extendable": "^0.1.1", + "is-plain-object": "^2.0.1", + "to-object-path": "^0.3.0" + } + } + } + }, + "universalify": { + "version": "0.1.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/universalify/-/universalify-0.1.2.tgz", + "integrity": "sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==", + "dev": true + }, + "unset-value": { + "version": "1.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/unset-value/-/unset-value-1.0.0.tgz", + "integrity": "sha1-g3aHP30jNRef+x5vw6jtDfyKtVk=", + "dev": true, + "requires": { + "has-value": "^0.3.1", + "isobject": "^3.0.0" + }, + "dependencies": { + "has-value": { + "version": "0.3.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/has-value/-/has-value-0.3.1.tgz", + "integrity": "sha1-ex9YutpiyoJ+wKIHgCVlSEWZXh8=", + "dev": true, + "requires": { + "get-value": "^2.0.3", + "has-values": "^0.1.4", + "isobject": "^2.0.0" + }, + "dependencies": { + "isobject": { + "version": "2.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/isobject/-/isobject-2.1.0.tgz", + "integrity": "sha1-8GVWEJaj8dou9GJy+BXIQNh+DIk=", + "dev": true, + "requires": { + "isarray": "1.0.0" + } + } + } + }, + "has-values": { + "version": "0.1.4", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/has-values/-/has-values-0.1.4.tgz", + "integrity": "sha1-bWHeldkd/Km5oCCJrThL/49it3E=", + "dev": true + } + } + }, + "untildify": { + "version": "3.0.3", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/untildify/-/untildify-3.0.3.tgz", + "integrity": "sha512-iSk/J8efr8uPT/Z4eSUywnqyrQU7DSdMfdqK4iWEaUVVmcP5JcnpRqmVMwcwcnmI1ATFNgC5V90u09tBynNFKA==", + "dev": true + }, + "urix": { + "version": "0.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/urix/-/urix-0.1.0.tgz", + "integrity": "sha1-2pN/emLiH+wf0Y1Js1wpNQZ6bHI=", + "dev": true + }, + "url-parse-lax": { + "version": "1.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/url-parse-lax/-/url-parse-lax-1.0.0.tgz", + "integrity": "sha1-evjzA2Rem9eaJy56FKxovAYJ2nM=", + "dev": true, + "requires": { + "prepend-http": "^1.0.1" + } + }, + "url-to-options": { + "version": "1.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/url-to-options/-/url-to-options-1.0.1.tgz", + "integrity": "sha1-FQWgOiiaSMvXpDTvuu7FBV9WM6k=", + "dev": true + }, + "use": { + "version": "3.1.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/use/-/use-3.1.1.tgz", + "integrity": "sha512-cwESVXlO3url9YWlFW/TA9cshCEhtu7IKJ/p5soJ/gGpj7vbvFrAY/eIioQ6Dw23KjZhYgiIo8HOs1nQ2vr/oQ==", + "dev": true + }, + "util-deprecate": { + "version": "1.0.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/util-deprecate/-/util-deprecate-1.0.2.tgz", + "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=", + "dev": true + }, + "uuid": { + "version": "3.3.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/uuid/-/uuid-3.3.2.tgz", + "integrity": "sha512-yXJmeNaw3DnnKAOKJE51sL/ZaYfWJRl1pK9dr19YFCu0ObS231AB1/LbqTKRAQ5kw8A90rA6fr4riOUpTZvQZA==", + "dev": true + }, + "validate-npm-package-license": { + "version": "3.0.4", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz", + "integrity": "sha512-DpKm2Ui/xN7/HQKCtpZxoRWBhZ9Z0kqtygG8XCgNQ8ZlDnxuQmWhj566j8fN4Cu3/JmbhsDo7fcAJq4s9h27Ew==", + "dev": true, + "requires": { + "spdx-correct": "^3.0.0", + "spdx-expression-parse": "^3.0.0" + } + }, + "verror": { + "version": "1.10.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/verror/-/verror-1.10.0.tgz", + "integrity": "sha1-OhBcoXBTr1XW4nDB+CiGguGNpAA=", + "dev": true, + "requires": { + "assert-plus": "^1.0.0", + "core-util-is": "1.0.2", + "extsprintf": "^1.2.0" + } + }, + "vinyl": { + "version": "1.2.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/vinyl/-/vinyl-1.2.0.tgz", + "integrity": "sha1-XIgDbPVl5d8FVYv8kR+GVt8hiIQ=", + "dev": true, + "requires": { + "clone": "^1.0.0", + "clone-stats": "^0.0.1", + "replace-ext": "0.0.1" + } + }, + "vinyl-file": { + "version": "2.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/vinyl-file/-/vinyl-file-2.0.0.tgz", + "integrity": "sha1-p+v1/779obfRjRQPyweyI++2dRo=", + "dev": true, + "requires": { + "graceful-fs": "^4.1.2", + "pify": "^2.3.0", + "pinkie-promise": "^2.0.0", + "strip-bom": "^2.0.0", + "strip-bom-stream": "^2.0.0", + "vinyl": "^1.1.0" + }, + "dependencies": { + "pify": { + "version": "2.3.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/pify/-/pify-2.3.0.tgz", + "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=", + "dev": true + }, + "strip-bom": { + "version": "2.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/strip-bom/-/strip-bom-2.0.0.tgz", + "integrity": "sha1-YhmoVhZSBJHzV4i9vxRHqZx+aw4=", + "dev": true, + "requires": { + "is-utf8": "^0.2.0" + } + } + } + }, + "which": { + "version": "1.3.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/which/-/which-1.3.1.tgz", + "integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==", + "dev": true, + "requires": { + "isexe": "^2.0.0" + } + }, + "win-release": { + "version": "1.1.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/win-release/-/win-release-1.1.1.tgz", + "integrity": "sha1-X6VeAr58qTTt/BJmVjLoSbcuUgk=", + "dev": true, + "requires": { + "semver": "^5.0.1" + } + }, + "winston": { + "version": "3.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/winston/-/winston-3.1.0.tgz", + "integrity": "sha512-FsQfEE+8YIEeuZEYhHDk5cILo1HOcWkGwvoidLrDgPog0r4bser1lEIOco2dN9zpDJ1M88hfDgZvxe5z4xNcwg==", + "dev": true, + "requires": { + "async": "^2.6.0", + "diagnostics": "^1.1.1", + "is-stream": "^1.1.0", + "logform": "^1.9.1", + "one-time": "0.0.4", + "readable-stream": "^2.3.6", + "stack-trace": "0.0.x", + "triple-beam": "^1.3.0", + "winston-transport": "^4.2.0" + } + }, + "winston-transport": { + "version": "4.2.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/winston-transport/-/winston-transport-4.2.0.tgz", + "integrity": "sha512-0R1bvFqxSlK/ZKTH86nymOuKv/cT1PQBMuDdA7k7f0S9fM44dNH6bXnuxwXPrN8lefJgtZq08BKdyZ0DZIy/rg==", + "dev": true, + "requires": { + "readable-stream": "^2.3.6", + "triple-beam": "^1.2.0" + } + }, + "wrappy": { + "version": "1.0.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", + "dev": true + }, + "write-file-atomic": { + "version": "2.3.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/write-file-atomic/-/write-file-atomic-2.3.0.tgz", + "integrity": "sha512-xuPeK4OdjWqtfi59ylvVL0Yn35SF3zgcAcv7rBPFHVaEapaDr4GdGgm3j7ckTwH9wHL7fGmgfAnb0+THrHb8tA==", + "dev": true, + "requires": { + "graceful-fs": "^4.1.11", + "imurmurhash": "^0.1.4", + "signal-exit": "^3.0.2" + } + }, + "xtend": { + "version": "4.0.1", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/xtend/-/xtend-4.0.1.tgz", + "integrity": "sha1-pcbVMr5lbiPbgg77lDofBJmNY68=", + "dev": true + }, + "yallist": { + "version": "2.1.2", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/yallist/-/yallist-2.1.2.tgz", + "integrity": "sha1-HBH5IY8HYImkfdUS+TxmmaaoHVI=", + "dev": true + }, + "yargs-parser": { + "version": "10.1.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/yargs-parser/-/yargs-parser-10.1.0.tgz", + "integrity": "sha512-VCIyR1wJoEBZUqk5PA+oOBF6ypbwh5aNB3I50guxAL/quggdfs4TtNHQrSazFA3fYZ+tEqfs0zIGlv0c/rgjbQ==", + "dev": true, + "requires": { + "camelcase": "^4.1.0" + } + }, + "yeoman-environment": { + "version": "2.3.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/yeoman-environment/-/yeoman-environment-2.3.0.tgz", + "integrity": "sha512-PHSAkVOqYdcR+C+Uht1SGC4eVD/9OhygYFkYaI66xF8vKIeS1RNYay+umj2ZrQeJ50tF5Q/RSO6qGDz9y3Ifug==", + "dev": true, + "requires": { + "chalk": "^2.1.0", + "cross-spawn": "^6.0.5", + "debug": "^3.1.0", + "diff": "^3.3.1", + "escape-string-regexp": "^1.0.2", + "globby": "^8.0.1", + "grouped-queue": "^0.3.3", + "inquirer": "^5.2.0", + "is-scoped": "^1.0.0", + "lodash": "^4.17.10", + "log-symbols": "^2.1.0", + "mem-fs": "^1.1.0", + "strip-ansi": "^4.0.0", + "text-table": "^0.2.0", + "untildify": "^3.0.2" + }, + "dependencies": { + "cross-spawn": { + "version": "6.0.5", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/cross-spawn/-/cross-spawn-6.0.5.tgz", + "integrity": "sha512-eTVLrBSt7fjbDygz805pMnstIs2VTBNkRm0qxZd+M7A5XDdxVRWO5MxGBXZhjY4cqLYLdtrGqRf8mBPmzwSpWQ==", + "dev": true, + "requires": { + "nice-try": "^1.0.4", + "path-key": "^2.0.1", + "semver": "^5.5.0", + "shebang-command": "^1.2.0", + "which": "^1.2.9" + } + } + } + }, + "yeoman-generator": { + "version": "3.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/yeoman-generator/-/yeoman-generator-3.0.0.tgz", + "integrity": "sha512-aHsNXzkdgAoakZTZsDX7T56wYWYd1O5E/GBIFAVMJLH7TKRr+1MiEJszZQbbCSA+J+lpT743/8L88j35yNdTLQ==", + "dev": true, + "requires": { + "async": "^2.6.0", + "chalk": "^2.3.0", + "cli-table": "^0.3.1", + "cross-spawn": "^6.0.5", + "dargs": "^6.0.0", + "dateformat": "^3.0.3", + "debug": "^3.1.0", + "detect-conflict": "^1.0.0", + "error": "^7.0.2", + "find-up": "^3.0.0", + "github-username": "^4.0.0", + "istextorbinary": "^2.2.1", + "lodash": "^4.17.10", + "make-dir": "^1.1.0", + "mem-fs-editor": "^5.0.0", + "minimist": "^1.2.0", + "pretty-bytes": "^5.1.0", + "read-chunk": "^2.1.0", + "read-pkg-up": "^4.0.0", + "rimraf": "^2.6.2", + "run-async": "^2.0.0", + "shelljs": "^0.8.0", + "text-table": "^0.2.0", + "through2": "^2.0.0", + "yeoman-environment": "^2.0.5" + }, + "dependencies": { + "cross-spawn": { + "version": "6.0.5", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/cross-spawn/-/cross-spawn-6.0.5.tgz", + "integrity": "sha512-eTVLrBSt7fjbDygz805pMnstIs2VTBNkRm0qxZd+M7A5XDdxVRWO5MxGBXZhjY4cqLYLdtrGqRf8mBPmzwSpWQ==", + "dev": true, + "requires": { + "nice-try": "^1.0.4", + "path-key": "^2.0.1", + "semver": "^5.5.0", + "shebang-command": "^1.2.0", + "which": "^1.2.9" + } + }, + "find-up": { + "version": "3.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/find-up/-/find-up-3.0.0.tgz", + "integrity": "sha512-1yD6RmLI1XBfxugvORwlck6f75tYL+iR0jqwsOrOxMZyGYqUuDhJ0l4AXdO1iX/FTs9cBAMEk1gWSEx1kSbylg==", + "dev": true, + "requires": { + "locate-path": "^3.0.0" + } + }, + "locate-path": { + "version": "3.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/locate-path/-/locate-path-3.0.0.tgz", + "integrity": "sha512-7AO748wWnIhNqAuaty2ZWHkQHRSNfPVIsPIfwEOWO22AmaoVrWavlOcMR5nzTLNYvp36X220/maaRsrec1G65A==", + "dev": true, + "requires": { + "p-locate": "^3.0.0", + "path-exists": "^3.0.0" + } + }, + "minimist": { + "version": "1.2.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/minimist/-/minimist-1.2.0.tgz", + "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=", + "dev": true + }, + "p-limit": { + "version": "2.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/p-limit/-/p-limit-2.0.0.tgz", + "integrity": "sha512-fl5s52lI5ahKCernzzIyAP0QAZbGIovtVHGwpcu1Jr/EpzLVDI2myISHwGqK7m8uQFugVWSrbxH7XnhGtvEc+A==", + "dev": true, + "requires": { + "p-try": "^2.0.0" + } + }, + "p-locate": { + "version": "3.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/p-locate/-/p-locate-3.0.0.tgz", + "integrity": "sha512-x+12w/To+4GFfgJhBEpiDcLozRJGegY+Ei7/z0tSLkMmxGZNybVMSfWj9aJn8Z5Fc7dBUNJOOVgPv2H7IwulSQ==", + "dev": true, + "requires": { + "p-limit": "^2.0.0" + } + }, + "p-try": { + "version": "2.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/p-try/-/p-try-2.0.0.tgz", + "integrity": "sha512-hMp0onDKIajHfIkdRk3P4CdCmErkYAxxDtP3Wx/4nZ3aGlau2VKh3mZpcuFkH27WQkL/3WBCPOktzA9ZOAnMQQ==", + "dev": true + }, + "read-pkg-up": { + "version": "4.0.0", + "resolved": "https://ssh.lighthouse.com.br/nexus/repository/npm-all/read-pkg-up/-/read-pkg-up-4.0.0.tgz", + "integrity": "sha512-6etQSH7nJGsK0RbG/2TeDzZFa8shjQ1um+SwQQ5cwKy0dhSXdOncEhb1CPpvQG4h7FyOV6EB6YlV0yJvZQNAkA==", + "dev": true, + "requires": { + "find-up": "^3.0.0", + "read-pkg": "^3.0.0" + } + } + } + } + } +} diff --git a/jhipster/jhipster-uaa/uaa/package.json b/jhipster/jhipster-uaa/uaa/package.json new file mode 100644 index 0000000000..7565e8783c --- /dev/null +++ b/jhipster/jhipster-uaa/uaa/package.json @@ -0,0 +1,16 @@ +{ + "name": "uaa", + "version": "0.0.0", + "description": "Description for uaa", + "private": true, + "license": "UNLICENSED", + "cacheDirectories": [ + "node_modules" + ], + "devDependencies": { + "generator-jhipster": "5.4.2" + }, + "engines": { + "node": ">=8.9.0" + } +} diff --git a/jhipster/jhipster-uaa/uaa/pom.xml b/jhipster/jhipster-uaa/uaa/pom.xml new file mode 100644 index 0000000000..9c4783747a --- /dev/null +++ b/jhipster/jhipster-uaa/uaa/pom.xml @@ -0,0 +1,915 @@ + + + 4.0.0 + + com.baeldung.jhipster.uaa + uaa + 0.0.1-SNAPSHOT + war + Uaa + + + + + + + + + + 3.0.0 + 1.8 + 2.12.6 + v8.12.0 + 6.4.1 + UTF-8 + UTF-8 + ${project.build.directory}/test-results + yyyyMMddHHmmss + ${java.version} + ${java.version} + -Djava.security.egd=file:/dev/./urandom -Xmx256m + jdt_apt + false + + + + + + + 2.0.25 + + 2.0.5.RELEASE + + 5.2.17.Final + + 3.22.0-GA + + 3.5.5 + 3.6 + 2.0.1.Final + 1.2.0.Final + + + 3.1.0 + 3.8.0 + 2.10 + 3.0.0-M2 + 3.1.0 + 2.22.0 + 3.2.2 + 0.9.11 + 0.8.2 + 3.4.2 + 3.5.0.1254 + 2.2.5 + + + http://localhost:9001 + src/main/webapp/content/**/*.*, src/main/webapp/i18n/*.js, target/www/**/*.* + S3437,S4684,UndocumentedApi,BoldAndItalicTagsCheck + + src/main/webapp/app/**/*.* + Web:BoldAndItalicTagsCheck + + src/main/java/**/* + squid:S3437 + + src/main/java/**/* + squid:UndocumentedApi + + src/main/java/**/* + squid:S4684 + ${project.testresult.directory}/coverage/jacoco/jacoco.exec + jacoco + ${project.testresult.directory}/lcov.info + ${project.basedir}/src/main/ + ${project.testresult.directory}/surefire-reports + ${project.basedir}/src/test/ + + + + + + + + io.github.jhipster + jhipster-dependencies + ${jhipster-dependencies.version} + pom + import + + + + + + + + io.github.jhipster + jhipster-framework + + + + org.springframework.boot + spring-boot-starter-cache + + + io.dropwizard.metrics + metrics-core + + + io.dropwizard.metrics + metrics-annotation + + + io.dropwizard.metrics + metrics-json + + + io.dropwizard.metrics + metrics-jvm + + + io.dropwizard.metrics + metrics-servlet + + + io.dropwizard.metrics + metrics-servlets + + + com.fasterxml.jackson.datatype + jackson-datatype-hibernate5 + + + com.fasterxml.jackson.datatype + jackson-datatype-hppc + + + com.fasterxml.jackson.datatype + jackson-datatype-jsr310 + + + com.fasterxml.jackson.module + jackson-module-afterburner + + + com.h2database + h2 + test + + + com.hazelcast + hazelcast + + + com.hazelcast + hazelcast-hibernate52 + + + com.hazelcast + hazelcast-spring + + + com.jayway.jsonpath + json-path + test + + + + io.springfox + springfox-swagger2 + + + io.springfox + springfox-bean-validators + + + com.mattbertolini + liquibase-slf4j + + + com.ryantenney.metrics + metrics-spring + + + com.zaxxer + HikariCP + + + commons-io + commons-io + + + org.apache.commons + commons-lang3 + + + javax.cache + cache-api + + + mysql + mysql-connector-java + + + org.assertj + assertj-core + test + + + org.hibernate + hibernate-jpamodelgen + ${hibernate.version} + provided + + + org.hibernate + hibernate-envers + + + org.hibernate.validator + hibernate-validator + + + org.liquibase + liquibase-core + + + net.logstash.logback + logstash-logback-encoder + + + org.mapstruct + mapstruct-jdk8 + ${mapstruct.version} + + + org.mapstruct + mapstruct-processor + ${mapstruct.version} + provided + + + org.springframework.boot + spring-boot-configuration-processor + provided + + + org.springframework.boot + spring-boot-loader-tools + + + org.springframework.boot + spring-boot-starter-actuator + + + org.springframework.boot + spring-boot-starter-aop + + + org.springframework.boot + spring-boot-starter-data-jpa + + + org.springframework.boot + spring-boot-starter-logging + + + org.springframework.boot + spring-boot-starter-mail + + + org.springframework.boot + spring-boot-starter-security + + + org.springframework.boot + spring-boot-starter-thymeleaf + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework.boot + spring-boot-starter-test + test + + + org.springframework.boot + spring-boot-test + test + + + org.springframework.security + spring-security-test + test + + + org.zalando + problem-spring-web + 0.24.0-RC.0 + + + org.springframework.security.oauth + spring-security-oauth2 + + + org.springframework.security + spring-security-jwt + + + + org.springframework.cloud + spring-cloud-starter + + + org.springframework.cloud + spring-cloud-starter-netflix-ribbon + + + org.springframework.cloud + spring-cloud-starter-netflix-hystrix + + + org.springframework.retry + spring-retry + + + org.springframework.cloud + spring-cloud-starter-netflix-eureka-client + + + org.springframework.cloud + spring-cloud-starter-config + + + org.springframework.cloud + spring-cloud-security + + + org.springframework.cloud + spring-cloud-starter-openfeign + + + org.springframework.cloud + spring-cloud-spring-service-connector + + + + org.springframework.security + spring-security-data + + + + + + spring-boot:run + + + org.apache.maven.plugins + maven-compiler-plugin + ${maven-compiler-plugin.version} + + + + org.mapstruct + mapstruct-processor + ${mapstruct.version} + + + + org.hibernate + hibernate-jpamodelgen + ${hibernate.version} + + + + + + + org.apache.maven.plugins + maven-eclipse-plugin + ${maven-eclipse-plugin.version} + + true + true + + + + org.apache.maven.plugins + maven-enforcer-plugin + ${maven-enforcer-plugin.version} + + + enforce-versions + + enforce + + + + + + + You are running an older version of Maven. JHipster requires at least Maven ${maven.version} + [${maven.version},) + + + + You are running an incompatible version of Java. JHipster requires JDK ${java.version} + [1.8,1.9) + + + + + + org.apache.maven.plugins + maven-resources-plugin + ${maven-resources-plugin.version} + + + default-resources + validate + + copy-resources + + + target/classes + false + + # + + + + src/main/resources/ + true + + config/*.yml + + + + src/main/resources/ + false + + config/*.yml + + + + + + + docker-resources + verify + + copy-resources + + + target/classes/static/ + + + target/www + false + + + + + + + + org.apache.maven.plugins + maven-surefire-plugin + ${maven-surefire-plugin.version} + + + alphabetical + + + + org.jacoco + jacoco-maven-plugin + ${jacoco-maven-plugin.version} + + + pre-unit-tests + + prepare-agent + + + + ${project.testresult.directory}/coverage/jacoco/jacoco.exec + + + + + post-unit-test + test + + report + + + ${project.testresult.directory}/coverage/jacoco/jacoco.exec + ${project.testresult.directory}/coverage/jacoco + + + + + + org.sonarsource.scanner.maven + sonar-maven-plugin + ${sonar-maven-plugin.version} + + + org.liquibase + liquibase-maven-plugin + ${liquibase.version} + + src/main/resources/config/liquibase/master.xml + src/main/resources/config/liquibase/changelog/${maven.build.timestamp}_changelog.xml + org.h2.Driver + jdbc:h2:file:./target/h2db/db/uaa + + uaa + + hibernate:spring:com.baeldung.jhipster.uaa.domain?dialect=org.hibernate.dialect.H2Dialect&hibernate.physical_naming_strategy=org.springframework.boot.orm.jpa.hibernate.SpringPhysicalNamingStrategy&hibernate.implicit_naming_strategy=org.springframework.boot.orm.jpa.hibernate.SpringImplicitNamingStrategy + true + debug + + + + org.javassist + javassist + ${javassist.version} + + + org.liquibase.ext + liquibase-hibernate5 + ${liquibase-hibernate5.version} + + + org.springframework.boot + spring-boot-starter-data-jpa + ${spring-boot.version} + + + javax.validation + validation-api + ${validation-api.version} + + + + + org.springframework.boot + spring-boot-maven-plugin + ${spring-boot.version} + + + + repackage + + + + + ${start-class} + true + true + + + + + com.google.cloud.tools + jib-maven-plugin + ${jib-maven-plugin.version} + + + openjdk:8-jre-alpine + + + uaa:latest + + + + sh + + chmod +x /entrypoint.sh && sync && /entrypoint.sh + + + 9999 + 5701/udp + + + ALWAYS + 0 + + true + + + + + + + + + + org.eclipse.m2e + lifecycle-mapping + 1.0.0 + + + + + + org.jacoco + + jacoco-maven-plugin + + + ${jacoco-maven-plugin.version} + + + prepare-agent + + + + + + + + + + + + + + + + no-liquibase + + ,no-liquibase + + + + swagger + + ,swagger + + + + tls + + ,tls + + + + dev + + true + + + + org.springframework.boot + spring-boot-starter-undertow + + + org.springframework.boot + spring-boot-devtools + true + + + com.h2database + h2 + + + + + + org.apache.maven.plugins + maven-war-plugin + ${maven-war-plugin.version} + + false + + + + + + + dev${profile.tls}${profile.no-liquibase} + + + + prod + + + org.springframework.boot + spring-boot-starter-undertow + + + + + + maven-clean-plugin + ${maven-clean-plugin.version} + + + + target/www/ + + + + + + org.apache.maven.plugins + maven-war-plugin + ${maven-war-plugin.version} + + false + + + + org.springframework.boot + spring-boot-maven-plugin + ${spring-boot.version} + + ${start-class} + true + + + + + build-info + + + + + + pl.project13.maven + git-commit-id-plugin + ${git-commit-id-plugin.version} + + + + revision + + + + + false + true + + ^git.commit.id.abbrev$ + ^git.commit.id.describe$ + ^git.branch$ + + + + + + + + prod${profile.swagger}${profile.no-liquibase} + + + + + cc + + + org.springframework.boot + spring-boot-starter-undertow + + + org.springframework.boot + spring-boot-devtools + true + + + + + + org.apache.maven.plugins + maven-war-plugin + ${maven-war-plugin.version} + + false + src/main/webapp/ + + + + org.springframework.boot + spring-boot-maven-plugin + ${spring-boot.version} + + ${start-class} + true + true + true + + + + + org.apache.maven.plugins + maven-compiler-plugin + ${maven-compiler-plugin.version} + + + default-compile + none + + + default-testCompile + none + + + + + net.alchim31.maven + scala-maven-plugin + ${scala-maven-plugin.version} + + + compile + compile + + add-source + compile + + + + test-compile + test-compile + + add-source + testCompile + + + + + incremental + true + ${scala.version} + + + + + + + dev,swagger + + + + + zipkin + + + org.springframework.cloud + spring-cloud-starter-zipkin + + + + + + IDE + + + org.mapstruct + mapstruct-processor + ${mapstruct.version} + + + org.hibernate + hibernate-jpamodelgen + ${hibernate.version} + + + + + + diff --git a/jhipster/jhipster-uaa/uaa/src/main/docker/.dockerignore b/jhipster/jhipster-uaa/uaa/src/main/docker/.dockerignore new file mode 100644 index 0000000000..b03bdc71ee --- /dev/null +++ b/jhipster/jhipster-uaa/uaa/src/main/docker/.dockerignore @@ -0,0 +1,14 @@ +# https://docs.docker.com/engine/reference/builder/#dockerignore-file +classes/ +generated-sources/ +generated-test-sources/ +h2db/ +maven-archiver/ +maven-status/ +reports/ +surefire-reports/ +test-classes/ +test-results/ +www/ +!*.jar +!*.war diff --git a/jhipster/jhipster-uaa/uaa/src/main/docker/Dockerfile b/jhipster/jhipster-uaa/uaa/src/main/docker/Dockerfile new file mode 100644 index 0000000000..f2bfb4d66a --- /dev/null +++ b/jhipster/jhipster-uaa/uaa/src/main/docker/Dockerfile @@ -0,0 +1,20 @@ +FROM openjdk:8-jre-alpine + +ENV SPRING_OUTPUT_ANSI_ENABLED=ALWAYS \ + JHIPSTER_SLEEP=0 \ + JAVA_OPTS="" + +# Add a jhipster user to run our application so that it doesn't need to run as root +RUN adduser -D -s /bin/sh jhipster +WORKDIR /home/jhipster + +ADD entrypoint.sh entrypoint.sh +RUN chmod 755 entrypoint.sh && chown jhipster:jhipster entrypoint.sh +USER jhipster + +ENTRYPOINT ["./entrypoint.sh"] + +EXPOSE 9999 5701/udp + +ADD *.war app.war + diff --git a/jhipster/jhipster-uaa/uaa/src/main/docker/app.yml b/jhipster/jhipster-uaa/uaa/src/main/docker/app.yml new file mode 100644 index 0000000000..6efdf61cf7 --- /dev/null +++ b/jhipster/jhipster-uaa/uaa/src/main/docker/app.yml @@ -0,0 +1,22 @@ +version: '2' +services: + uaa-app: + image: uaa + environment: + # - _JAVA_OPTIONS=-Xmx512m -Xms256m + - SPRING_PROFILES_ACTIVE=prod,swagger + - EUREKA_CLIENT_SERVICE_URL_DEFAULTZONE=http://admin:$${jhipster.registry.password}@jhipster-registry:8761/eureka + - SPRING_CLOUD_CONFIG_URI=http://admin:$${jhipster.registry.password}@jhipster-registry:8761/config + - SPRING_DATASOURCE_URL=jdbc:mysql://uaa-mysql:3306/uaa?useUnicode=true&characterEncoding=utf8&useSSL=false + - JHIPSTER_SLEEP=30 # gives time for the JHipster Registry to boot before the application + uaa-mysql: + extends: + file: mysql.yml + service: uaa-mysql + jhipster-registry: + extends: + file: jhipster-registry.yml + service: jhipster-registry + environment: + - SPRING_CLOUD_CONFIG_SERVER_COMPOSITE_0_TYPE=native + - SPRING_CLOUD_CONFIG_SERVER_COMPOSITE_0_SEARCH_LOCATIONS=file:./central-config/docker-config/ diff --git a/jhipster/jhipster-uaa/uaa/src/main/docker/central-server-config/README.md b/jhipster/jhipster-uaa/uaa/src/main/docker/central-server-config/README.md new file mode 100644 index 0000000000..6aab9ffdd5 --- /dev/null +++ b/jhipster/jhipster-uaa/uaa/src/main/docker/central-server-config/README.md @@ -0,0 +1,7 @@ +# Central configuration sources details + +The JHipster-Registry will use the following directories as its configuration source : +- localhost-config : when running the registry in docker with the jhipster-registry.yml docker-compose file +- docker-config : when running the registry and the app both in docker with the app.yml docker-compose file + +For more info, refer to https://www.jhipster.tech/microservices-architecture/#registry_app_configuration diff --git a/jhipster/jhipster-uaa/uaa/src/main/docker/central-server-config/docker-config/application.yml b/jhipster/jhipster-uaa/uaa/src/main/docker/central-server-config/docker-config/application.yml new file mode 100644 index 0000000000..8a973c0a35 --- /dev/null +++ b/jhipster/jhipster-uaa/uaa/src/main/docker/central-server-config/docker-config/application.yml @@ -0,0 +1,15 @@ +# Common configuration shared between all applications +configserver: + name: Docker JHipster Registry + status: Connected to the JHipster Registry running in Docker + +jhipster: + security: + authentication: + jwt: + secret: my-secret-key-which-should-be-changed-in-production-and-be-base64-encoded + +eureka: + client: + service-url: + defaultZone: http://admin:${jhipster.registry.password}@jhipster-registry:8761/eureka/ diff --git a/jhipster/jhipster-uaa/uaa/src/main/docker/central-server-config/localhost-config/application.yml b/jhipster/jhipster-uaa/uaa/src/main/docker/central-server-config/localhost-config/application.yml new file mode 100644 index 0000000000..db4602e419 --- /dev/null +++ b/jhipster/jhipster-uaa/uaa/src/main/docker/central-server-config/localhost-config/application.yml @@ -0,0 +1,15 @@ +# Common configuration shared between all applications +configserver: + name: Docker JHipster Registry + status: Connected to the JHipster Registry running in Docker + +jhipster: + security: + authentication: + jwt: + secret: my-secret-key-which-should-be-changed-in-production-and-be-base64-encoded + +eureka: + client: + service-url: + defaultZone: http://admin:${jhipster.registry.password}@localhost:8761/eureka/ diff --git a/jhipster/jhipster-uaa/uaa/src/main/docker/entrypoint.sh b/jhipster/jhipster-uaa/uaa/src/main/docker/entrypoint.sh new file mode 100644 index 0000000000..ccffafb5a4 --- /dev/null +++ b/jhipster/jhipster-uaa/uaa/src/main/docker/entrypoint.sh @@ -0,0 +1,4 @@ +#!/bin/sh + +echo "The application will start in ${JHIPSTER_SLEEP}s..." && sleep ${JHIPSTER_SLEEP} +exec java ${JAVA_OPTS} -Djava.security.egd=file:/dev/./urandom -jar "${HOME}/app.war" "$@" diff --git a/jhipster/jhipster-uaa/uaa/src/main/docker/hazelcast-management-center.yml b/jhipster/jhipster-uaa/uaa/src/main/docker/hazelcast-management-center.yml new file mode 100644 index 0000000000..dc6739d543 --- /dev/null +++ b/jhipster/jhipster-uaa/uaa/src/main/docker/hazelcast-management-center.yml @@ -0,0 +1,6 @@ +version: '2' +services: + uaa-hazelcast-management-center: + image: hazelcast/management-center:3.9.3 + ports: + - 8180:8080 diff --git a/jhipster/jhipster-uaa/uaa/src/main/docker/jhipster-registry.yml b/jhipster/jhipster-uaa/uaa/src/main/docker/jhipster-registry.yml new file mode 100644 index 0000000000..512bc54be6 --- /dev/null +++ b/jhipster/jhipster-uaa/uaa/src/main/docker/jhipster-registry.yml @@ -0,0 +1,22 @@ +version: '2' +services: + jhipster-registry: + image: jhipster/jhipster-registry:v4.0.4 + volumes: + - ./central-server-config:/central-config + # When run with the "dev" Spring profile, the JHipster Registry will + # read the config from the local filesystem (central-server-config directory) + # When run with the "prod" Spring profile, it will read the configuration from a Git repository + # See https://www.jhipster.tech/microservices-architecture/#registry_app_configuration + environment: + # - _JAVA_OPTIONS=-Xmx512m -Xms256m + - SPRING_PROFILES_ACTIVE=dev,swagger,uaa + - SPRING_SECURITY_USER_PASSWORD=admin + - JHIPSTER_REGISTRY_PASSWORD=admin + - SPRING_CLOUD_CONFIG_SERVER_COMPOSITE_0_TYPE=native + - SPRING_CLOUD_CONFIG_SERVER_COMPOSITE_0_SEARCH_LOCATIONS=file:./central-config/localhost-config/ + # - SPRING_CLOUD_CONFIG_SERVER_COMPOSITE_0_TYPE=git + # - SPRING_CLOUD_CONFIG_SERVER_COMPOSITE_0_URI=https://github.com/jhipster/jhipster-registry/ + # - SPRING_CLOUD_CONFIG_SERVER_COMPOSITE_0_SEARCH_PATHS=central-config + ports: + - 8761:8761 diff --git a/jhipster/jhipster-uaa/uaa/src/main/docker/mysql.yml b/jhipster/jhipster-uaa/uaa/src/main/docker/mysql.yml new file mode 100644 index 0000000000..52b44ac6d2 --- /dev/null +++ b/jhipster/jhipster-uaa/uaa/src/main/docker/mysql.yml @@ -0,0 +1,13 @@ +version: '2' +services: + uaa-mysql: + image: mysql:5.7.20 + # volumes: + # - ~/volumes/jhipster/uaa/mysql/:/var/lib/mysql/ + environment: + - MYSQL_USER=root + - MYSQL_ALLOW_EMPTY_PASSWORD=yes + - MYSQL_DATABASE=uaa + ports: + - 3306:3306 + command: mysqld --lower_case_table_names=1 --skip-ssl --character_set_server=utf8mb4 --explicit_defaults_for_timestamp diff --git a/jhipster/jhipster-uaa/uaa/src/main/docker/sonar.yml b/jhipster/jhipster-uaa/uaa/src/main/docker/sonar.yml new file mode 100644 index 0000000000..2e4ab78826 --- /dev/null +++ b/jhipster/jhipster-uaa/uaa/src/main/docker/sonar.yml @@ -0,0 +1,7 @@ +version: '2' +services: + uaa-sonar: + image: sonarqube:7.1-alpine + ports: + - 9001:9000 + - 9092:9092 diff --git a/jhipster/jhipster-uaa/uaa/src/main/java/com/baeldung/jhipster/uaa/ApplicationWebXml.java b/jhipster/jhipster-uaa/uaa/src/main/java/com/baeldung/jhipster/uaa/ApplicationWebXml.java new file mode 100644 index 0000000000..2bb237cdb7 --- /dev/null +++ b/jhipster/jhipster-uaa/uaa/src/main/java/com/baeldung/jhipster/uaa/ApplicationWebXml.java @@ -0,0 +1,21 @@ +package com.baeldung.jhipster.uaa; + +import com.baeldung.jhipster.uaa.config.DefaultProfileUtil; +import org.springframework.boot.builder.SpringApplicationBuilder; +import org.springframework.boot.web.servlet.support.SpringBootServletInitializer; + +/** + * This is a helper Java class that provides an alternative to creating a web.xml. + * This will be invoked only when the application is deployed to a Servlet container like Tomcat, JBoss etc. + */ +public class ApplicationWebXml extends SpringBootServletInitializer { + + @Override + protected SpringApplicationBuilder configure(SpringApplicationBuilder application) { + /** + * set a default to use when no profile is configured. + */ + DefaultProfileUtil.addDefaultProfile(application.application()); + return application.sources(UaaApp.class); + } +} diff --git a/jhipster/jhipster-uaa/uaa/src/main/java/com/baeldung/jhipster/uaa/UaaApp.java b/jhipster/jhipster-uaa/uaa/src/main/java/com/baeldung/jhipster/uaa/UaaApp.java new file mode 100644 index 0000000000..5ec5ee708d --- /dev/null +++ b/jhipster/jhipster-uaa/uaa/src/main/java/com/baeldung/jhipster/uaa/UaaApp.java @@ -0,0 +1,107 @@ +package com.baeldung.jhipster.uaa; + +import com.baeldung.jhipster.uaa.config.ApplicationProperties; +import com.baeldung.jhipster.uaa.config.DefaultProfileUtil; + +import io.github.jhipster.config.JHipsterConstants; + +import org.apache.commons.lang3.StringUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.boot.autoconfigure.liquibase.LiquibaseProperties; +import org.springframework.boot.context.properties.EnableConfigurationProperties; +import org.springframework.cloud.client.discovery.EnableDiscoveryClient; +import org.springframework.core.env.Environment; + +import javax.annotation.PostConstruct; +import java.net.InetAddress; +import java.net.UnknownHostException; +import java.util.Arrays; +import java.util.Collection; + +@SpringBootApplication +@EnableConfigurationProperties({LiquibaseProperties.class, ApplicationProperties.class}) +@EnableDiscoveryClient +public class UaaApp { + + private static final Logger log = LoggerFactory.getLogger(UaaApp.class); + + private final Environment env; + + public UaaApp(Environment env) { + this.env = env; + } + + /** + * Initializes uaa. + *

+ * Spring profiles can be configured with a program argument --spring.profiles.active=your-active-profile + *

+ * You can find more information on how profiles work with JHipster on https://www.jhipster.tech/profiles/. + */ + @PostConstruct + public void initApplication() { + Collection activeProfiles = Arrays.asList(env.getActiveProfiles()); + if (activeProfiles.contains(JHipsterConstants.SPRING_PROFILE_DEVELOPMENT) && activeProfiles.contains(JHipsterConstants.SPRING_PROFILE_PRODUCTION)) { + log.error("You have misconfigured your application! It should not run " + + "with both the 'dev' and 'prod' profiles at the same time."); + } + if (activeProfiles.contains(JHipsterConstants.SPRING_PROFILE_DEVELOPMENT) && activeProfiles.contains(JHipsterConstants.SPRING_PROFILE_CLOUD)) { + log.error("You have misconfigured your application! It should not " + + "run with both the 'dev' and 'cloud' profiles at the same time."); + } + } + + /** + * Main method, used to run the application. + * + * @param args the command line arguments + */ + public static void main(String[] args) { + SpringApplication app = new SpringApplication(UaaApp.class); + DefaultProfileUtil.addDefaultProfile(app); + Environment env = app.run(args).getEnvironment(); + logApplicationStartup(env); + } + + private static void logApplicationStartup(Environment env) { + String protocol = "http"; + if (env.getProperty("server.ssl.key-store") != null) { + protocol = "https"; + } + String serverPort = env.getProperty("server.port"); + String contextPath = env.getProperty("server.servlet.context-path"); + if (StringUtils.isBlank(contextPath)) { + contextPath = "/"; + } + String hostAddress = "localhost"; + try { + hostAddress = InetAddress.getLocalHost().getHostAddress(); + } catch (UnknownHostException e) { + log.warn("The host name could not be determined, using `localhost` as fallback"); + } + log.info("\n----------------------------------------------------------\n\t" + + "Application '{}' is running! Access URLs:\n\t" + + "Local: \t\t{}://localhost:{}{}\n\t" + + "External: \t{}://{}:{}{}\n\t" + + "Profile(s): \t{}\n----------------------------------------------------------", + env.getProperty("spring.application.name"), + protocol, + serverPort, + contextPath, + protocol, + hostAddress, + serverPort, + contextPath, + env.getActiveProfiles()); + + String configServerStatus = env.getProperty("configserver.status"); + if (configServerStatus == null) { + configServerStatus = "Not found or not setup for this application"; + } + log.info("\n----------------------------------------------------------\n\t" + + "Config Server: \t{}\n----------------------------------------------------------", configServerStatus); + } +} diff --git a/jhipster/jhipster-uaa/uaa/src/main/java/com/baeldung/jhipster/uaa/aop/logging/LoggingAspect.java b/jhipster/jhipster-uaa/uaa/src/main/java/com/baeldung/jhipster/uaa/aop/logging/LoggingAspect.java new file mode 100644 index 0000000000..c5eacb7b43 --- /dev/null +++ b/jhipster/jhipster-uaa/uaa/src/main/java/com/baeldung/jhipster/uaa/aop/logging/LoggingAspect.java @@ -0,0 +1,98 @@ +package com.baeldung.jhipster.uaa.aop.logging; + +import io.github.jhipster.config.JHipsterConstants; + +import org.aspectj.lang.JoinPoint; +import org.aspectj.lang.ProceedingJoinPoint; +import org.aspectj.lang.annotation.AfterThrowing; +import org.aspectj.lang.annotation.Around; +import org.aspectj.lang.annotation.Aspect; +import org.aspectj.lang.annotation.Pointcut; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.core.env.Environment; + +import java.util.Arrays; + +/** + * Aspect for logging execution of service and repository Spring components. + * + * By default, it only runs with the "dev" profile. + */ +@Aspect +public class LoggingAspect { + + private final Logger log = LoggerFactory.getLogger(this.getClass()); + + private final Environment env; + + public LoggingAspect(Environment env) { + this.env = env; + } + + /** + * Pointcut that matches all repositories, services and Web REST endpoints. + */ + @Pointcut("within(@org.springframework.stereotype.Repository *)" + + " || within(@org.springframework.stereotype.Service *)" + + " || within(@org.springframework.web.bind.annotation.RestController *)") + public void springBeanPointcut() { + // Method is empty as this is just a Pointcut, the implementations are in the advices. + } + + /** + * Pointcut that matches all Spring beans in the application's main packages. + */ + @Pointcut("within(com.baeldung.jhipster.uaa.repository..*)"+ + " || within(com.baeldung.jhipster.uaa.service..*)"+ + " || within(com.baeldung.jhipster.uaa.web.rest..*)") + public void applicationPackagePointcut() { + // Method is empty as this is just a Pointcut, the implementations are in the advices. + } + + /** + * Advice that logs methods throwing exceptions. + * + * @param joinPoint join point for advice + * @param e exception + */ + @AfterThrowing(pointcut = "applicationPackagePointcut() && springBeanPointcut()", throwing = "e") + public void logAfterThrowing(JoinPoint joinPoint, Throwable e) { + if (env.acceptsProfiles(JHipsterConstants.SPRING_PROFILE_DEVELOPMENT)) { + log.error("Exception in {}.{}() with cause = \'{}\' and exception = \'{}\'", joinPoint.getSignature().getDeclaringTypeName(), + joinPoint.getSignature().getName(), e.getCause() != null? e.getCause() : "NULL", e.getMessage(), e); + + } else { + log.error("Exception in {}.{}() with cause = {}", joinPoint.getSignature().getDeclaringTypeName(), + joinPoint.getSignature().getName(), e.getCause() != null? e.getCause() : "NULL"); + } + } + + /** + * Advice that logs when a method is entered and exited. + * + * @param joinPoint join point for advice + * @return result + * @throws Throwable throws IllegalArgumentException + */ + @Around("applicationPackagePointcut() && springBeanPointcut()") + public Object logAround(ProceedingJoinPoint joinPoint) throws Throwable { + if (log.isDebugEnabled()) { + log.debug("Enter: {}.{}() with argument[s] = {}", joinPoint.getSignature().getDeclaringTypeName(), + joinPoint.getSignature().getName(), Arrays.toString(joinPoint.getArgs())); + } + try { + Object result = joinPoint.proceed(); + if (log.isDebugEnabled()) { + log.debug("Exit: {}.{}() with result = {}", joinPoint.getSignature().getDeclaringTypeName(), + joinPoint.getSignature().getName(), result); + } + return result; + } catch (IllegalArgumentException e) { + log.error("Illegal argument: {} in {}.{}()", Arrays.toString(joinPoint.getArgs()), + joinPoint.getSignature().getDeclaringTypeName(), joinPoint.getSignature().getName()); + + throw e; + } + } +} diff --git a/jhipster/jhipster-uaa/uaa/src/main/java/com/baeldung/jhipster/uaa/config/ApplicationProperties.java b/jhipster/jhipster-uaa/uaa/src/main/java/com/baeldung/jhipster/uaa/config/ApplicationProperties.java new file mode 100644 index 0000000000..040bb68b03 --- /dev/null +++ b/jhipster/jhipster-uaa/uaa/src/main/java/com/baeldung/jhipster/uaa/config/ApplicationProperties.java @@ -0,0 +1,14 @@ +package com.baeldung.jhipster.uaa.config; + +import org.springframework.boot.context.properties.ConfigurationProperties; + +/** + * Properties specific to Uaa. + *

+ * Properties are configured in the application.yml file. + * See {@link io.github.jhipster.config.JHipsterProperties} for a good example. + */ +@ConfigurationProperties(prefix = "application", ignoreUnknownFields = false) +public class ApplicationProperties { + +} diff --git a/jhipster/jhipster-uaa/uaa/src/main/java/com/baeldung/jhipster/uaa/config/AsyncConfiguration.java b/jhipster/jhipster-uaa/uaa/src/main/java/com/baeldung/jhipster/uaa/config/AsyncConfiguration.java new file mode 100644 index 0000000000..ae7982ad84 --- /dev/null +++ b/jhipster/jhipster-uaa/uaa/src/main/java/com/baeldung/jhipster/uaa/config/AsyncConfiguration.java @@ -0,0 +1,59 @@ +package com.baeldung.jhipster.uaa.config; + +import io.github.jhipster.async.ExceptionHandlingAsyncTaskExecutor; +import io.github.jhipster.config.JHipsterProperties; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.aop.interceptor.AsyncUncaughtExceptionHandler; +import org.springframework.aop.interceptor.SimpleAsyncUncaughtExceptionHandler; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.scheduling.annotation.*; +import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; +import org.springframework.scheduling.annotation.SchedulingConfigurer; +import org.springframework.scheduling.config.ScheduledTaskRegistrar; + +import java.util.concurrent.Executor; +import java.util.concurrent.Executors; + +@Configuration +@EnableAsync +@EnableScheduling +public class AsyncConfiguration implements AsyncConfigurer, SchedulingConfigurer { + + private final Logger log = LoggerFactory.getLogger(AsyncConfiguration.class); + + private final JHipsterProperties jHipsterProperties; + + public AsyncConfiguration(JHipsterProperties jHipsterProperties) { + this.jHipsterProperties = jHipsterProperties; + } + + @Override + @Bean(name = "taskExecutor") + public Executor getAsyncExecutor() { + log.debug("Creating Async Task Executor"); + ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor(); + executor.setCorePoolSize(jHipsterProperties.getAsync().getCorePoolSize()); + executor.setMaxPoolSize(jHipsterProperties.getAsync().getMaxPoolSize()); + executor.setQueueCapacity(jHipsterProperties.getAsync().getQueueCapacity()); + executor.setThreadNamePrefix("uaa-Executor-"); + return new ExceptionHandlingAsyncTaskExecutor(executor); + } + + @Override + public AsyncUncaughtExceptionHandler getAsyncUncaughtExceptionHandler() { + return new SimpleAsyncUncaughtExceptionHandler(); + } + + @Override + public void configureTasks(ScheduledTaskRegistrar taskRegistrar) { + taskRegistrar.setScheduler(scheduledTaskExecutor()); + } + + @Bean + public Executor scheduledTaskExecutor() { + return Executors.newScheduledThreadPool(jHipsterProperties.getAsync().getCorePoolSize()); + } +} diff --git a/jhipster/jhipster-uaa/uaa/src/main/java/com/baeldung/jhipster/uaa/config/CacheConfiguration.java b/jhipster/jhipster-uaa/uaa/src/main/java/com/baeldung/jhipster/uaa/config/CacheConfiguration.java new file mode 100644 index 0000000000..c2113b7248 --- /dev/null +++ b/jhipster/jhipster-uaa/uaa/src/main/java/com/baeldung/jhipster/uaa/config/CacheConfiguration.java @@ -0,0 +1,155 @@ +package com.baeldung.jhipster.uaa.config; + +import io.github.jhipster.config.JHipsterConstants; +import io.github.jhipster.config.JHipsterProperties; + +import com.hazelcast.config.*; +import com.hazelcast.core.HazelcastInstance; +import com.hazelcast.core.Hazelcast; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.autoconfigure.web.ServerProperties; + +import org.springframework.cache.CacheManager; +import org.springframework.cache.annotation.EnableCaching; +import org.springframework.cloud.client.ServiceInstance; +import org.springframework.cloud.client.discovery.DiscoveryClient; +import org.springframework.cloud.client.serviceregistry.Registration; +import org.springframework.context.annotation.*; +import org.springframework.core.env.Environment; + +import javax.annotation.PreDestroy; + +@Configuration +@EnableCaching +public class CacheConfiguration { + + private final Logger log = LoggerFactory.getLogger(CacheConfiguration.class); + + private final Environment env; + + private final ServerProperties serverProperties; + + private final DiscoveryClient discoveryClient; + + private Registration registration; + + public CacheConfiguration(Environment env, ServerProperties serverProperties, DiscoveryClient discoveryClient) { + this.env = env; + this.serverProperties = serverProperties; + this.discoveryClient = discoveryClient; + } + + @Autowired(required = false) + public void setRegistration(Registration registration) { + this.registration = registration; + } + + @PreDestroy + public void destroy() { + log.info("Closing Cache Manager"); + Hazelcast.shutdownAll(); + } + + @Bean + public CacheManager cacheManager(HazelcastInstance hazelcastInstance) { + log.debug("Starting HazelcastCacheManager"); + CacheManager cacheManager = new com.hazelcast.spring.cache.HazelcastCacheManager(hazelcastInstance); + return cacheManager; + } + + @Bean + public HazelcastInstance hazelcastInstance(JHipsterProperties jHipsterProperties) { + log.debug("Configuring Hazelcast"); + HazelcastInstance hazelCastInstance = Hazelcast.getHazelcastInstanceByName("uaa"); + if (hazelCastInstance != null) { + log.debug("Hazelcast already initialized"); + return hazelCastInstance; + } + Config config = new Config(); + config.setInstanceName("uaa"); + config.getNetworkConfig().getJoin().getMulticastConfig().setEnabled(false); + if (this.registration == null) { + log.warn("No discovery service is set up, Hazelcast cannot create a cluster."); + } else { + // The serviceId is by default the application's name, + // see the "spring.application.name" standard Spring property + String serviceId = registration.getServiceId(); + log.debug("Configuring Hazelcast clustering for instanceId: {}", serviceId); + // In development, everything goes through 127.0.0.1, with a different port + if (env.acceptsProfiles(JHipsterConstants.SPRING_PROFILE_DEVELOPMENT)) { + log.debug("Application is running with the \"dev\" profile, Hazelcast " + + "cluster will only work with localhost instances"); + + System.setProperty("hazelcast.local.localAddress", "127.0.0.1"); + config.getNetworkConfig().setPort(serverProperties.getPort() + 5701); + config.getNetworkConfig().getJoin().getTcpIpConfig().setEnabled(true); + for (ServiceInstance instance : discoveryClient.getInstances(serviceId)) { + String clusterMember = "127.0.0.1:" + (instance.getPort() + 5701); + log.debug("Adding Hazelcast (dev) cluster member " + clusterMember); + config.getNetworkConfig().getJoin().getTcpIpConfig().addMember(clusterMember); + } + } else { // Production configuration, one host per instance all using port 5701 + config.getNetworkConfig().setPort(5701); + config.getNetworkConfig().getJoin().getTcpIpConfig().setEnabled(true); + for (ServiceInstance instance : discoveryClient.getInstances(serviceId)) { + String clusterMember = instance.getHost() + ":5701"; + log.debug("Adding Hazelcast (prod) cluster member " + clusterMember); + config.getNetworkConfig().getJoin().getTcpIpConfig().addMember(clusterMember); + } + } + } + config.getMapConfigs().put("default", initializeDefaultMapConfig(jHipsterProperties)); + + // Full reference is available at: http://docs.hazelcast.org/docs/management-center/3.9/manual/html/Deploying_and_Starting.html + config.setManagementCenterConfig(initializeDefaultManagementCenterConfig(jHipsterProperties)); + config.getMapConfigs().put("com.baeldung.jhipster.uaa.domain.*", initializeDomainMapConfig(jHipsterProperties)); + return Hazelcast.newHazelcastInstance(config); + } + + private ManagementCenterConfig initializeDefaultManagementCenterConfig(JHipsterProperties jHipsterProperties) { + ManagementCenterConfig managementCenterConfig = new ManagementCenterConfig(); + managementCenterConfig.setEnabled(jHipsterProperties.getCache().getHazelcast().getManagementCenter().isEnabled()); + managementCenterConfig.setUrl(jHipsterProperties.getCache().getHazelcast().getManagementCenter().getUrl()); + managementCenterConfig.setUpdateInterval(jHipsterProperties.getCache().getHazelcast().getManagementCenter().getUpdateInterval()); + return managementCenterConfig; + } + + private MapConfig initializeDefaultMapConfig(JHipsterProperties jHipsterProperties) { + MapConfig mapConfig = new MapConfig(); + + /* + Number of backups. If 1 is set as the backup-count for example, + then all entries of the map will be copied to another JVM for + fail-safety. Valid numbers are 0 (no backup), 1, 2, 3. + */ + mapConfig.setBackupCount(jHipsterProperties.getCache().getHazelcast().getBackupCount()); + + /* + Valid values are: + NONE (no eviction), + LRU (Least Recently Used), + LFU (Least Frequently Used). + NONE is the default. + */ + mapConfig.setEvictionPolicy(EvictionPolicy.LRU); + + /* + Maximum size of the map. When max size is reached, + map is evicted based on the policy defined. + Any integer between 0 and Integer.MAX_VALUE. 0 means + Integer.MAX_VALUE. Default is 0. + */ + mapConfig.setMaxSizeConfig(new MaxSizeConfig(0, MaxSizeConfig.MaxSizePolicy.USED_HEAP_SIZE)); + + return mapConfig; + } + + private MapConfig initializeDomainMapConfig(JHipsterProperties jHipsterProperties) { + MapConfig mapConfig = new MapConfig(); + mapConfig.setTimeToLiveSeconds(jHipsterProperties.getCache().getHazelcast().getTimeToLiveSeconds()); + return mapConfig; + } +} diff --git a/jhipster/jhipster-uaa/uaa/src/main/java/com/baeldung/jhipster/uaa/config/CloudDatabaseConfiguration.java b/jhipster/jhipster-uaa/uaa/src/main/java/com/baeldung/jhipster/uaa/config/CloudDatabaseConfiguration.java new file mode 100644 index 0000000000..397e571b64 --- /dev/null +++ b/jhipster/jhipster-uaa/uaa/src/main/java/com/baeldung/jhipster/uaa/config/CloudDatabaseConfiguration.java @@ -0,0 +1,24 @@ +package com.baeldung.jhipster.uaa.config; + +import io.github.jhipster.config.JHipsterConstants; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.cache.CacheManager; +import org.springframework.cloud.config.java.AbstractCloudConfig; +import org.springframework.context.annotation.*; + +import javax.sql.DataSource; + +@Configuration +@Profile(JHipsterConstants.SPRING_PROFILE_CLOUD) +public class CloudDatabaseConfiguration extends AbstractCloudConfig { + + private final Logger log = LoggerFactory.getLogger(CloudDatabaseConfiguration.class); + + @Bean + public DataSource dataSource(CacheManager cacheManager) { + log.info("Configuring JDBC datasource from a cloud provider"); + return connectionFactory().dataSource(); + } +} diff --git a/jhipster/jhipster-uaa/uaa/src/main/java/com/baeldung/jhipster/uaa/config/Constants.java b/jhipster/jhipster-uaa/uaa/src/main/java/com/baeldung/jhipster/uaa/config/Constants.java new file mode 100644 index 0000000000..b9e3af4abf --- /dev/null +++ b/jhipster/jhipster-uaa/uaa/src/main/java/com/baeldung/jhipster/uaa/config/Constants.java @@ -0,0 +1,17 @@ +package com.baeldung.jhipster.uaa.config; + +/** + * Application constants. + */ +public final class Constants { + + // Regex for acceptable logins + public static final String LOGIN_REGEX = "^[_.@A-Za-z0-9-]*$"; + + public static final String SYSTEM_ACCOUNT = "system"; + public static final String ANONYMOUS_USER = "anonymoususer"; + public static final String DEFAULT_LANGUAGE = "en"; + + private Constants() { + } +} diff --git a/jhipster/jhipster-uaa/uaa/src/main/java/com/baeldung/jhipster/uaa/config/DatabaseConfiguration.java b/jhipster/jhipster-uaa/uaa/src/main/java/com/baeldung/jhipster/uaa/config/DatabaseConfiguration.java new file mode 100644 index 0000000000..7cd6c3c635 --- /dev/null +++ b/jhipster/jhipster-uaa/uaa/src/main/java/com/baeldung/jhipster/uaa/config/DatabaseConfiguration.java @@ -0,0 +1,39 @@ +package com.baeldung.jhipster.uaa.config; + +import io.github.jhipster.config.JHipsterConstants; +import io.github.jhipster.config.h2.H2ConfigurationHelper; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.Profile; + +import org.springframework.data.jpa.repository.config.EnableJpaAuditing; +import org.springframework.data.jpa.repository.config.EnableJpaRepositories; +import org.springframework.transaction.annotation.EnableTransactionManagement; + +import java.sql.SQLException; + +@Configuration +@EnableJpaRepositories("com.baeldung.jhipster.uaa.repository") +@EnableJpaAuditing(auditorAwareRef = "springSecurityAuditorAware") +@EnableTransactionManagement +public class DatabaseConfiguration { + + private final Logger log = LoggerFactory.getLogger(DatabaseConfiguration.class); + + + /** + * Open the TCP port for the H2 database, so it is available remotely. + * + * @return the H2 database TCP server + * @throws SQLException if the server failed to start + */ + @Bean(initMethod = "start", destroyMethod = "stop") + @Profile(JHipsterConstants.SPRING_PROFILE_DEVELOPMENT) + public Object h2TCPServer() throws SQLException { + log.debug("Starting H2 database"); + return H2ConfigurationHelper.createServer(); + } + +} diff --git a/jhipster/jhipster-uaa/uaa/src/main/java/com/baeldung/jhipster/uaa/config/DateTimeFormatConfiguration.java b/jhipster/jhipster-uaa/uaa/src/main/java/com/baeldung/jhipster/uaa/config/DateTimeFormatConfiguration.java new file mode 100644 index 0000000000..67449284e1 --- /dev/null +++ b/jhipster/jhipster-uaa/uaa/src/main/java/com/baeldung/jhipster/uaa/config/DateTimeFormatConfiguration.java @@ -0,0 +1,20 @@ +package com.baeldung.jhipster.uaa.config; + +import org.springframework.context.annotation.Configuration; +import org.springframework.format.FormatterRegistry; +import org.springframework.format.datetime.standard.DateTimeFormatterRegistrar; +import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; + +/** + * Configure the converters to use the ISO format for dates by default. + */ +@Configuration +public class DateTimeFormatConfiguration implements WebMvcConfigurer { + + @Override + public void addFormatters(FormatterRegistry registry) { + DateTimeFormatterRegistrar registrar = new DateTimeFormatterRegistrar(); + registrar.setUseIsoFormat(true); + registrar.registerFormatters(registry); + } +} diff --git a/jhipster/jhipster-uaa/uaa/src/main/java/com/baeldung/jhipster/uaa/config/DefaultProfileUtil.java b/jhipster/jhipster-uaa/uaa/src/main/java/com/baeldung/jhipster/uaa/config/DefaultProfileUtil.java new file mode 100644 index 0000000000..6b4345c832 --- /dev/null +++ b/jhipster/jhipster-uaa/uaa/src/main/java/com/baeldung/jhipster/uaa/config/DefaultProfileUtil.java @@ -0,0 +1,51 @@ +package com.baeldung.jhipster.uaa.config; + +import io.github.jhipster.config.JHipsterConstants; + +import org.springframework.boot.SpringApplication; +import org.springframework.core.env.Environment; + +import java.util.*; + +/** + * Utility class to load a Spring profile to be used as default + * when there is no spring.profiles.active set in the environment or as command line argument. + * If the value is not available in application.yml then dev profile will be used as default. + */ +public final class DefaultProfileUtil { + + private static final String SPRING_PROFILE_DEFAULT = "spring.profiles.default"; + + private DefaultProfileUtil() { + } + + /** + * Set a default to use when no profile is configured. + * + * @param app the Spring application + */ + public static void addDefaultProfile(SpringApplication app) { + Map defProperties = new HashMap<>(); + /* + * The default profile to use when no other profiles are defined + * This cannot be set in the application.yml file. + * See https://github.com/spring-projects/spring-boot/issues/1219 + */ + defProperties.put(SPRING_PROFILE_DEFAULT, JHipsterConstants.SPRING_PROFILE_DEVELOPMENT); + app.setDefaultProperties(defProperties); + } + + /** + * Get the profiles that are applied else get default profiles. + * + * @param env spring environment + * @return profiles + */ + public static String[] getActiveProfiles(Environment env) { + String[] profiles = env.getActiveProfiles(); + if (profiles.length == 0) { + return env.getDefaultProfiles(); + } + return profiles; + } +} diff --git a/jhipster/jhipster-uaa/uaa/src/main/java/com/baeldung/jhipster/uaa/config/JacksonConfiguration.java b/jhipster/jhipster-uaa/uaa/src/main/java/com/baeldung/jhipster/uaa/config/JacksonConfiguration.java new file mode 100644 index 0000000000..1e596c1728 --- /dev/null +++ b/jhipster/jhipster-uaa/uaa/src/main/java/com/baeldung/jhipster/uaa/config/JacksonConfiguration.java @@ -0,0 +1,63 @@ +package com.baeldung.jhipster.uaa.config; + +import com.fasterxml.jackson.datatype.hibernate5.Hibernate5Module; +import com.fasterxml.jackson.datatype.jdk8.Jdk8Module; +import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; +import com.fasterxml.jackson.module.afterburner.AfterburnerModule; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.zalando.problem.ProblemModule; +import org.zalando.problem.violations.ConstraintViolationProblemModule; + +@Configuration +public class JacksonConfiguration { + + /** + * Support for Java date and time API. + * @return the corresponding Jackson module. + */ + @Bean + public JavaTimeModule javaTimeModule() { + return new JavaTimeModule(); + } + + @Bean + public Jdk8Module jdk8TimeModule() { + return new Jdk8Module(); + } + + + /* + * Support for Hibernate types in Jackson. + */ + @Bean + public Hibernate5Module hibernate5Module() { + return new Hibernate5Module(); + } + + /* + * Jackson Afterburner module to speed up serialization/deserialization. + */ + @Bean + public AfterburnerModule afterburnerModule() { + return new AfterburnerModule(); + } + + /* + * Module for serialization/deserialization of RFC7807 Problem. + */ + @Bean + ProblemModule problemModule() { + return new ProblemModule(); + } + + /* + * Module for serialization/deserialization of ConstraintViolationProblem. + */ + @Bean + ConstraintViolationProblemModule constraintViolationProblemModule() { + return new ConstraintViolationProblemModule(); + } + +} diff --git a/jhipster/jhipster-uaa/uaa/src/main/java/com/baeldung/jhipster/uaa/config/LiquibaseConfiguration.java b/jhipster/jhipster-uaa/uaa/src/main/java/com/baeldung/jhipster/uaa/config/LiquibaseConfiguration.java new file mode 100644 index 0000000000..393f377062 --- /dev/null +++ b/jhipster/jhipster-uaa/uaa/src/main/java/com/baeldung/jhipster/uaa/config/LiquibaseConfiguration.java @@ -0,0 +1,53 @@ +package com.baeldung.jhipster.uaa.config; + +import javax.sql.DataSource; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.boot.autoconfigure.liquibase.LiquibaseProperties; +import org.springframework.cache.CacheManager; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.core.env.Environment; +import org.springframework.core.task.TaskExecutor; + +import io.github.jhipster.config.JHipsterConstants; +import io.github.jhipster.config.liquibase.AsyncSpringLiquibase; +import liquibase.integration.spring.SpringLiquibase; + +@Configuration +public class LiquibaseConfiguration { + + private final Logger log = LoggerFactory.getLogger(LiquibaseConfiguration.class); + + private final Environment env; + + private final CacheManager cacheManager; + + public LiquibaseConfiguration(Environment env, CacheManager cacheManager) { + this.env = env; + this.cacheManager = cacheManager; + } + + @Bean + public SpringLiquibase liquibase(@Qualifier("taskExecutor") TaskExecutor taskExecutor, + DataSource dataSource, LiquibaseProperties liquibaseProperties) { + + // Use liquibase.integration.spring.SpringLiquibase if you don't want Liquibase to start asynchronously + SpringLiquibase liquibase = new AsyncSpringLiquibase(taskExecutor, env); + liquibase.setDataSource(dataSource); + liquibase.setChangeLog("classpath:config/liquibase/master.xml"); + liquibase.setContexts(liquibaseProperties.getContexts()); + liquibase.setDefaultSchema(liquibaseProperties.getDefaultSchema()); + liquibase.setDropFirst(liquibaseProperties.isDropFirst()); + liquibase.setChangeLogParameters(liquibaseProperties.getParameters()); + if (env.acceptsProfiles(JHipsterConstants.SPRING_PROFILE_NO_LIQUIBASE)) { + liquibase.setShouldRun(false); + } else { + liquibase.setShouldRun(liquibaseProperties.isEnabled()); + log.debug("Configuring Liquibase"); + } + return liquibase; + } +} diff --git a/jhipster/jhipster-uaa/uaa/src/main/java/com/baeldung/jhipster/uaa/config/LocaleConfiguration.java b/jhipster/jhipster-uaa/uaa/src/main/java/com/baeldung/jhipster/uaa/config/LocaleConfiguration.java new file mode 100644 index 0000000000..0ae32aaf1d --- /dev/null +++ b/jhipster/jhipster-uaa/uaa/src/main/java/com/baeldung/jhipster/uaa/config/LocaleConfiguration.java @@ -0,0 +1,27 @@ +package com.baeldung.jhipster.uaa.config; + +import io.github.jhipster.config.locale.AngularCookieLocaleResolver; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.web.servlet.LocaleResolver; +import org.springframework.web.servlet.config.annotation.*; +import org.springframework.web.servlet.i18n.LocaleChangeInterceptor; + +@Configuration +public class LocaleConfiguration implements WebMvcConfigurer { + + @Bean(name = "localeResolver") + public LocaleResolver localeResolver() { + AngularCookieLocaleResolver cookieLocaleResolver = new AngularCookieLocaleResolver(); + cookieLocaleResolver.setCookieName("NG_TRANSLATE_LANG_KEY"); + return cookieLocaleResolver; + } + + @Override + public void addInterceptors(InterceptorRegistry registry) { + LocaleChangeInterceptor localeChangeInterceptor = new LocaleChangeInterceptor(); + localeChangeInterceptor.setParamName("language"); + registry.addInterceptor(localeChangeInterceptor); + } +} diff --git a/jhipster/jhipster-uaa/uaa/src/main/java/com/baeldung/jhipster/uaa/config/LoggingAspectConfiguration.java b/jhipster/jhipster-uaa/uaa/src/main/java/com/baeldung/jhipster/uaa/config/LoggingAspectConfiguration.java new file mode 100644 index 0000000000..b0206bfea2 --- /dev/null +++ b/jhipster/jhipster-uaa/uaa/src/main/java/com/baeldung/jhipster/uaa/config/LoggingAspectConfiguration.java @@ -0,0 +1,19 @@ +package com.baeldung.jhipster.uaa.config; + +import com.baeldung.jhipster.uaa.aop.logging.LoggingAspect; + +import io.github.jhipster.config.JHipsterConstants; + +import org.springframework.context.annotation.*; +import org.springframework.core.env.Environment; + +@Configuration +@EnableAspectJAutoProxy +public class LoggingAspectConfiguration { + + @Bean + @Profile(JHipsterConstants.SPRING_PROFILE_DEVELOPMENT) + public LoggingAspect loggingAspect(Environment env) { + return new LoggingAspect(env); + } +} diff --git a/jhipster/jhipster-uaa/uaa/src/main/java/com/baeldung/jhipster/uaa/config/LoggingConfiguration.java b/jhipster/jhipster-uaa/uaa/src/main/java/com/baeldung/jhipster/uaa/config/LoggingConfiguration.java new file mode 100644 index 0000000000..dfef38f67d --- /dev/null +++ b/jhipster/jhipster-uaa/uaa/src/main/java/com/baeldung/jhipster/uaa/config/LoggingConfiguration.java @@ -0,0 +1,163 @@ +package com.baeldung.jhipster.uaa.config; + +import java.net.InetSocketAddress; +import java.util.Iterator; + +import io.github.jhipster.config.JHipsterProperties; + +import ch.qos.logback.classic.AsyncAppender; +import ch.qos.logback.classic.Level; +import ch.qos.logback.classic.LoggerContext; +import ch.qos.logback.classic.boolex.OnMarkerEvaluator; +import ch.qos.logback.classic.spi.ILoggingEvent; +import ch.qos.logback.classic.spi.LoggerContextListener; +import ch.qos.logback.core.Appender; +import ch.qos.logback.core.filter.EvaluatorFilter; +import ch.qos.logback.core.spi.ContextAwareBase; +import ch.qos.logback.core.spi.FilterReply; +import net.logstash.logback.appender.LogstashTcpSocketAppender; +import net.logstash.logback.encoder.LogstashEncoder; +import net.logstash.logback.stacktrace.ShortenedThrowableConverter; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.cloud.context.config.annotation.RefreshScope; +import org.springframework.context.annotation.Configuration; + +@Configuration +@RefreshScope +public class LoggingConfiguration { + + private static final String LOGSTASH_APPENDER_NAME = "LOGSTASH"; + + private static final String ASYNC_LOGSTASH_APPENDER_NAME = "ASYNC_LOGSTASH"; + + private final Logger log = LoggerFactory.getLogger(LoggingConfiguration.class); + + private LoggerContext context = (LoggerContext) LoggerFactory.getILoggerFactory(); + + private final String appName; + + private final String serverPort; + + private final String version; + + private final JHipsterProperties jHipsterProperties; + + public LoggingConfiguration(@Value("${spring.application.name}") String appName, @Value("${server.port}") String serverPort, + @Value("${info.project.version:}") String version, JHipsterProperties jHipsterProperties) { + this.appName = appName; + this.serverPort = serverPort; + this.version = version; + this.jHipsterProperties = jHipsterProperties; + if (jHipsterProperties.getLogging().getLogstash().isEnabled()) { + addLogstashAppender(context); + addContextListener(context); + } + if (jHipsterProperties.getMetrics().getLogs().isEnabled()) { + setMetricsMarkerLogbackFilter(context); + } + } + + private void addContextListener(LoggerContext context) { + LogbackLoggerContextListener loggerContextListener = new LogbackLoggerContextListener(); + loggerContextListener.setContext(context); + context.addListener(loggerContextListener); + } + + private void addLogstashAppender(LoggerContext context) { + log.info("Initializing Logstash logging"); + + LogstashTcpSocketAppender logstashAppender = new LogstashTcpSocketAppender(); + logstashAppender.setName(LOGSTASH_APPENDER_NAME); + logstashAppender.setContext(context); + String optionalFields = ""; + String customFields = "{\"app_name\":\"" + appName + "\",\"app_port\":\"" + serverPort + "\"," + + optionalFields + "\"version\":\"" + version + "\"}"; + + // More documentation is available at: https://github.com/logstash/logstash-logback-encoder + LogstashEncoder logstashEncoder = new LogstashEncoder(); + // Set the Logstash appender config from JHipster properties + logstashEncoder.setCustomFields(customFields); + // Set the Logstash appender config from JHipster properties + logstashAppender.addDestinations(new InetSocketAddress(jHipsterProperties.getLogging().getLogstash().getHost(), jHipsterProperties.getLogging().getLogstash().getPort())); + + ShortenedThrowableConverter throwableConverter = new ShortenedThrowableConverter(); + throwableConverter.setRootCauseFirst(true); + logstashEncoder.setThrowableConverter(throwableConverter); + logstashEncoder.setCustomFields(customFields); + + logstashAppender.setEncoder(logstashEncoder); + logstashAppender.start(); + + // Wrap the appender in an Async appender for performance + AsyncAppender asyncLogstashAppender = new AsyncAppender(); + asyncLogstashAppender.setContext(context); + asyncLogstashAppender.setName(ASYNC_LOGSTASH_APPENDER_NAME); + asyncLogstashAppender.setQueueSize(jHipsterProperties.getLogging().getLogstash().getQueueSize()); + asyncLogstashAppender.addAppender(logstashAppender); + asyncLogstashAppender.start(); + + context.getLogger("ROOT").addAppender(asyncLogstashAppender); + } + + // Configure a log filter to remove "metrics" logs from all appenders except the "LOGSTASH" appender + private void setMetricsMarkerLogbackFilter(LoggerContext context) { + log.info("Filtering metrics logs from all appenders except the {} appender", LOGSTASH_APPENDER_NAME); + OnMarkerEvaluator onMarkerMetricsEvaluator = new OnMarkerEvaluator(); + onMarkerMetricsEvaluator.setContext(context); + onMarkerMetricsEvaluator.addMarker("metrics"); + onMarkerMetricsEvaluator.start(); + EvaluatorFilter metricsFilter = new EvaluatorFilter<>(); + metricsFilter.setContext(context); + metricsFilter.setEvaluator(onMarkerMetricsEvaluator); + metricsFilter.setOnMatch(FilterReply.DENY); + metricsFilter.start(); + + for (ch.qos.logback.classic.Logger logger : context.getLoggerList()) { + for (Iterator> it = logger.iteratorForAppenders(); it.hasNext();) { + Appender appender = it.next(); + if (!appender.getName().equals(ASYNC_LOGSTASH_APPENDER_NAME)) { + log.debug("Filter metrics logs from the {} appender", appender.getName()); + appender.setContext(context); + appender.addFilter(metricsFilter); + appender.start(); + } + } + } + } + + /** + * Logback configuration is achieved by configuration file and API. + * When configuration file change is detected, the configuration is reset. + * This listener ensures that the programmatic configuration is also re-applied after reset. + */ + class LogbackLoggerContextListener extends ContextAwareBase implements LoggerContextListener { + + @Override + public boolean isResetResistant() { + return true; + } + + @Override + public void onStart(LoggerContext context) { + addLogstashAppender(context); + } + + @Override + public void onReset(LoggerContext context) { + addLogstashAppender(context); + } + + @Override + public void onStop(LoggerContext context) { + // Nothing to do. + } + + @Override + public void onLevelChange(ch.qos.logback.classic.Logger logger, Level level) { + // Nothing to do. + } + } + +} diff --git a/jhipster/jhipster-uaa/uaa/src/main/java/com/baeldung/jhipster/uaa/config/MetricsConfiguration.java b/jhipster/jhipster-uaa/uaa/src/main/java/com/baeldung/jhipster/uaa/config/MetricsConfiguration.java new file mode 100644 index 0000000000..4f98d0a3f1 --- /dev/null +++ b/jhipster/jhipster-uaa/uaa/src/main/java/com/baeldung/jhipster/uaa/config/MetricsConfiguration.java @@ -0,0 +1,99 @@ +package com.baeldung.jhipster.uaa.config; + +import io.github.jhipster.config.JHipsterProperties; + +import com.codahale.metrics.JmxReporter; +import com.codahale.metrics.JvmAttributeGaugeSet; +import com.codahale.metrics.MetricRegistry; +import com.codahale.metrics.Slf4jReporter; +import com.codahale.metrics.health.HealthCheckRegistry; +import com.codahale.metrics.jvm.*; +import com.ryantenney.metrics.spring.config.annotation.EnableMetrics; +import com.ryantenney.metrics.spring.config.annotation.MetricsConfigurerAdapter; +import com.zaxxer.hikari.HikariDataSource; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.slf4j.Marker; +import org.slf4j.MarkerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.*; + +import javax.annotation.PostConstruct; +import java.lang.management.ManagementFactory; +import java.util.concurrent.TimeUnit; + +@Configuration +@EnableMetrics(proxyTargetClass = true) +public class MetricsConfiguration extends MetricsConfigurerAdapter { + + private static final String PROP_METRIC_REG_JVM_MEMORY = "jvm.memory"; + private static final String PROP_METRIC_REG_JVM_GARBAGE = "jvm.garbage"; + private static final String PROP_METRIC_REG_JVM_THREADS = "jvm.threads"; + private static final String PROP_METRIC_REG_JVM_FILES = "jvm.files"; + private static final String PROP_METRIC_REG_JVM_BUFFERS = "jvm.buffers"; + private static final String PROP_METRIC_REG_JVM_ATTRIBUTE_SET = "jvm.attributes"; + + private final Logger log = LoggerFactory.getLogger(MetricsConfiguration.class); + + private MetricRegistry metricRegistry = new MetricRegistry(); + + private HealthCheckRegistry healthCheckRegistry = new HealthCheckRegistry(); + + private final JHipsterProperties jHipsterProperties; + + private HikariDataSource hikariDataSource; + + public MetricsConfiguration(JHipsterProperties jHipsterProperties) { + this.jHipsterProperties = jHipsterProperties; + } + + @Autowired(required = false) + public void setHikariDataSource(HikariDataSource hikariDataSource) { + this.hikariDataSource = hikariDataSource; + } + + @Override + @Bean + public MetricRegistry getMetricRegistry() { + return metricRegistry; + } + + @Override + @Bean + public HealthCheckRegistry getHealthCheckRegistry() { + return healthCheckRegistry; + } + + @PostConstruct + public void init() { + log.debug("Registering JVM gauges"); + metricRegistry.register(PROP_METRIC_REG_JVM_MEMORY, new MemoryUsageGaugeSet()); + metricRegistry.register(PROP_METRIC_REG_JVM_GARBAGE, new GarbageCollectorMetricSet()); + metricRegistry.register(PROP_METRIC_REG_JVM_THREADS, new ThreadStatesGaugeSet()); + metricRegistry.register(PROP_METRIC_REG_JVM_FILES, new FileDescriptorRatioGauge()); + metricRegistry.register(PROP_METRIC_REG_JVM_BUFFERS, new BufferPoolMetricSet(ManagementFactory.getPlatformMBeanServer())); + metricRegistry.register(PROP_METRIC_REG_JVM_ATTRIBUTE_SET, new JvmAttributeGaugeSet()); + if (hikariDataSource != null) { + log.debug("Monitoring the datasource"); + // remove the factory created by HikariDataSourceMetricsPostProcessor until JHipster migrate to Micrometer + hikariDataSource.setMetricsTrackerFactory(null); + hikariDataSource.setMetricRegistry(metricRegistry); + } + if (jHipsterProperties.getMetrics().getJmx().isEnabled()) { + log.debug("Initializing Metrics JMX reporting"); + JmxReporter jmxReporter = JmxReporter.forRegistry(metricRegistry).build(); + jmxReporter.start(); + } + if (jHipsterProperties.getMetrics().getLogs().isEnabled()) { + log.info("Initializing Metrics Log reporting"); + Marker metricsMarker = MarkerFactory.getMarker("metrics"); + final Slf4jReporter reporter = Slf4jReporter.forRegistry(metricRegistry) + .outputTo(LoggerFactory.getLogger("metrics")) + .markWith(metricsMarker) + .convertRatesTo(TimeUnit.SECONDS) + .convertDurationsTo(TimeUnit.MILLISECONDS) + .build(); + reporter.start(jHipsterProperties.getMetrics().getLogs().getReportFrequency(), TimeUnit.SECONDS); + } + } +} diff --git a/jhipster/jhipster-uaa/uaa/src/main/java/com/baeldung/jhipster/uaa/config/UaaConfiguration.java b/jhipster/jhipster-uaa/uaa/src/main/java/com/baeldung/jhipster/uaa/config/UaaConfiguration.java new file mode 100644 index 0000000000..ce1ab5326c --- /dev/null +++ b/jhipster/jhipster-uaa/uaa/src/main/java/com/baeldung/jhipster/uaa/config/UaaConfiguration.java @@ -0,0 +1,193 @@ +package com.baeldung.jhipster.uaa.config; + +import com.baeldung.jhipster.uaa.security.AuthoritiesConstants; +import io.github.jhipster.config.JHipsterProperties; +import org.springframework.beans.BeansException; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.context.ApplicationContext; +import org.springframework.context.ApplicationContextAware; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.core.io.ClassPathResource; +import org.springframework.security.authentication.AuthenticationManager; +import org.springframework.security.config.annotation.web.builders.HttpSecurity; +import org.springframework.security.config.http.SessionCreationPolicy; +import org.springframework.security.crypto.password.PasswordEncoder; +import org.springframework.security.oauth2.config.annotation.configurers.ClientDetailsServiceConfigurer; +import org.springframework.security.oauth2.config.annotation.web.configuration.AuthorizationServerConfigurerAdapter; +import org.springframework.security.oauth2.config.annotation.web.configuration.EnableAuthorizationServer; +import org.springframework.security.oauth2.config.annotation.web.configuration.EnableResourceServer; +import org.springframework.security.oauth2.config.annotation.web.configuration.ResourceServerConfigurerAdapter; +import org.springframework.security.oauth2.config.annotation.web.configurers.AuthorizationServerEndpointsConfigurer; +import org.springframework.security.oauth2.config.annotation.web.configurers.AuthorizationServerSecurityConfigurer; +import org.springframework.security.oauth2.config.annotation.web.configurers.ResourceServerSecurityConfigurer; +import org.springframework.security.oauth2.provider.token.TokenEnhancer; +import org.springframework.security.oauth2.provider.token.TokenEnhancerChain; +import org.springframework.security.oauth2.provider.token.TokenStore; +import org.springframework.security.oauth2.provider.token.store.JwtAccessTokenConverter; +import org.springframework.security.oauth2.provider.token.store.JwtTokenStore; +import org.springframework.security.oauth2.provider.token.store.KeyStoreKeyFactory; +import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter; +import org.springframework.web.filter.CorsFilter; + +import javax.servlet.http.HttpServletResponse; +import java.security.KeyPair; +import java.util.ArrayList; +import java.util.Collection; + +@Configuration +@EnableAuthorizationServer +public class UaaConfiguration extends AuthorizationServerConfigurerAdapter implements ApplicationContextAware { + /** + * Access tokens will not expire any earlier than this. + */ + private static final int MIN_ACCESS_TOKEN_VALIDITY_SECS = 60; + + private ApplicationContext applicationContext; + + @Override + public void setApplicationContext(ApplicationContext applicationContext) throws BeansException { + this.applicationContext = applicationContext; + } + + @EnableResourceServer + public static class ResourceServerConfiguration extends ResourceServerConfigurerAdapter { + + private final TokenStore tokenStore; + + private final JHipsterProperties jHipsterProperties; + + private final CorsFilter corsFilter; + + public ResourceServerConfiguration(TokenStore tokenStore, JHipsterProperties jHipsterProperties, CorsFilter corsFilter) { + this.tokenStore = tokenStore; + this.jHipsterProperties = jHipsterProperties; + this.corsFilter = corsFilter; + } + + @Override + public void configure(HttpSecurity http) throws Exception { + http + .exceptionHandling() + .authenticationEntryPoint((request, response, authException) -> response.sendError(HttpServletResponse.SC_UNAUTHORIZED)) + .and() + .csrf() + .disable() + .addFilterBefore(corsFilter, UsernamePasswordAuthenticationFilter.class) + .headers() + .frameOptions() + .disable() + .and() + .sessionManagement() + .sessionCreationPolicy(SessionCreationPolicy.STATELESS) + .and() + .authorizeRequests() + .antMatchers("/api/register").permitAll() + .antMatchers("/api/activate").permitAll() + .antMatchers("/api/authenticate").permitAll() + .antMatchers("/api/account/reset-password/init").permitAll() + .antMatchers("/api/account/reset-password/finish").permitAll() + .antMatchers("/api/**").authenticated() + .antMatchers("/management/health").permitAll() + .antMatchers("/management/**").hasAuthority(AuthoritiesConstants.ADMIN) + .antMatchers("/v2/api-docs/**").permitAll() + .antMatchers("/swagger-resources/configuration/ui").permitAll() + .antMatchers("/swagger-ui/index.html").hasAuthority(AuthoritiesConstants.ADMIN); + } + + @Override + public void configure(ResourceServerSecurityConfigurer resources) throws Exception { + resources.resourceId("jhipster-uaa").tokenStore(tokenStore); + } + } + + private final JHipsterProperties jHipsterProperties; + + private final UaaProperties uaaProperties; + + private final PasswordEncoder passwordEncoder; + + public UaaConfiguration(JHipsterProperties jHipsterProperties, UaaProperties uaaProperties, PasswordEncoder passwordEncoder) { + this.jHipsterProperties = jHipsterProperties; + this.uaaProperties = uaaProperties; + this.passwordEncoder = passwordEncoder; + } + + @Override + public void configure(ClientDetailsServiceConfigurer clients) throws Exception { + int accessTokenValidity = uaaProperties.getWebClientConfiguration().getAccessTokenValidityInSeconds(); + accessTokenValidity = Math.max(accessTokenValidity, MIN_ACCESS_TOKEN_VALIDITY_SECS); + int refreshTokenValidity = uaaProperties.getWebClientConfiguration().getRefreshTokenValidityInSecondsForRememberMe(); + refreshTokenValidity = Math.max(refreshTokenValidity, accessTokenValidity); + /* + For a better client design, this should be done by a ClientDetailsService (similar to UserDetailsService). + */ + clients.inMemory() + .withClient(uaaProperties.getWebClientConfiguration().getClientId()) + .secret(passwordEncoder.encode(uaaProperties.getWebClientConfiguration().getSecret())) + .scopes("openid") + .autoApprove(true) + .authorizedGrantTypes("implicit","refresh_token", "password", "authorization_code") + .accessTokenValiditySeconds(accessTokenValidity) + .refreshTokenValiditySeconds(refreshTokenValidity) + .and() + .withClient(jHipsterProperties.getSecurity().getClientAuthorization().getClientId()) + .secret(passwordEncoder.encode(jHipsterProperties.getSecurity().getClientAuthorization().getClientSecret())) + .scopes("web-app") + .authorities("ROLE_ADMIN") + .autoApprove(true) + .authorizedGrantTypes("client_credentials") + .accessTokenValiditySeconds((int) jHipsterProperties.getSecurity().getAuthentication().getJwt().getTokenValidityInSeconds()) + .refreshTokenValiditySeconds((int) jHipsterProperties.getSecurity().getAuthentication().getJwt().getTokenValidityInSecondsForRememberMe()); + } + + @Override + public void configure(AuthorizationServerEndpointsConfigurer endpoints) throws Exception { + //pick up all TokenEnhancers incl. those defined in the application + //this avoids changes to this class if an application wants to add its own to the chain + Collection tokenEnhancers = applicationContext.getBeansOfType(TokenEnhancer.class).values(); + TokenEnhancerChain tokenEnhancerChain = new TokenEnhancerChain(); + tokenEnhancerChain.setTokenEnhancers(new ArrayList<>(tokenEnhancers)); + endpoints + .authenticationManager(authenticationManager) + .tokenStore(tokenStore()) + .tokenEnhancer(tokenEnhancerChain) + .reuseRefreshTokens(false); //don't reuse or we will run into session inactivity timeouts + } + + @Autowired + @Qualifier("authenticationManagerBean") + private AuthenticationManager authenticationManager; + + /** + * Apply the token converter (and enhancer) for token store. + * @return the JwtTokenStore managing the tokens. + */ + @Bean + public JwtTokenStore tokenStore() { + return new JwtTokenStore(jwtAccessTokenConverter()); + } + + /** + * This bean generates an token enhancer, which manages the exchange between JWT acces tokens and Authentication + * in both directions. + * + * @return an access token converter configured with the authorization server's public/private keys + */ + @Bean + public JwtAccessTokenConverter jwtAccessTokenConverter() { + JwtAccessTokenConverter converter = new JwtAccessTokenConverter(); + KeyPair keyPair = new KeyStoreKeyFactory( + new ClassPathResource(uaaProperties.getKeyStore().getName()), uaaProperties.getKeyStore().getPassword().toCharArray()) + .getKeyPair(uaaProperties.getKeyStore().getAlias()); + converter.setKeyPair(keyPair); + return converter; + } + + @Override + public void configure(AuthorizationServerSecurityConfigurer oauthServer) throws Exception { + oauthServer.tokenKeyAccess("permitAll()").checkTokenAccess( + "isAuthenticated()"); + } +} diff --git a/jhipster/jhipster-uaa/uaa/src/main/java/com/baeldung/jhipster/uaa/config/UaaProperties.java b/jhipster/jhipster-uaa/uaa/src/main/java/com/baeldung/jhipster/uaa/config/UaaProperties.java new file mode 100644 index 0000000000..00fb4d28f9 --- /dev/null +++ b/jhipster/jhipster-uaa/uaa/src/main/java/com/baeldung/jhipster/uaa/config/UaaProperties.java @@ -0,0 +1,100 @@ +package com.baeldung.jhipster.uaa.config; + +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.stereotype.Component; + +/** + * Properties for UAA-based OAuth2 security. + */ +@Component +@ConfigurationProperties(prefix = "uaa", ignoreUnknownFields = false) +public class UaaProperties { + private KeyStore keyStore = new KeyStore(); + + public KeyStore getKeyStore() { + return keyStore; + } + + private WebClientConfiguration webClientConfiguration = new WebClientConfiguration(); + + public WebClientConfiguration getWebClientConfiguration() { + return webClientConfiguration; + } + + /** + * Keystore configuration for signing and verifying JWT tokens. + */ + public static class KeyStore { + //name of the keystore in the classpath + private String name = "config/tls/keystore.p12"; + //password used to access the key + private String password = "password"; + //name of the alias to fetch + private String alias = "selfsigned"; + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getPassword() { + return password; + } + + public void setPassword(String password) { + this.password = password; + } + + public String getAlias() { + return alias; + } + + public void setAlias(String alias) { + this.alias = alias; + } + } + + public static class WebClientConfiguration { + //validity of the short-lived access token in secs (min: 60), don't make it too long + private int accessTokenValidityInSeconds = 5 * 60; + //validity of the refresh token in secs (defines the duration of "remember me") + private int refreshTokenValidityInSecondsForRememberMe = 7 * 24 * 60 * 60; + private String clientId = "web_app"; + private String secret = "changeit"; + + public int getAccessTokenValidityInSeconds() { + return accessTokenValidityInSeconds; + } + + public void setAccessTokenValidityInSeconds(int accessTokenValidityInSeconds) { + this.accessTokenValidityInSeconds = accessTokenValidityInSeconds; + } + + public int getRefreshTokenValidityInSecondsForRememberMe() { + return refreshTokenValidityInSecondsForRememberMe; + } + + public void setRefreshTokenValidityInSecondsForRememberMe(int refreshTokenValidityInSecondsForRememberMe) { + this.refreshTokenValidityInSecondsForRememberMe = refreshTokenValidityInSecondsForRememberMe; + } + + public String getClientId() { + return clientId; + } + + public void setClientId(String clientId) { + this.clientId = clientId; + } + + public String getSecret() { + return secret; + } + + public void setSecret(String secret) { + this.secret = secret; + } + } +} diff --git a/jhipster/jhipster-uaa/uaa/src/main/java/com/baeldung/jhipster/uaa/config/UaaWebSecurityConfiguration.java b/jhipster/jhipster-uaa/uaa/src/main/java/com/baeldung/jhipster/uaa/config/UaaWebSecurityConfiguration.java new file mode 100644 index 0000000000..865eef9107 --- /dev/null +++ b/jhipster/jhipster-uaa/uaa/src/main/java/com/baeldung/jhipster/uaa/config/UaaWebSecurityConfiguration.java @@ -0,0 +1,72 @@ +package com.baeldung.jhipster.uaa.config; + +import org.springframework.beans.factory.BeanInitializationException; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.http.HttpMethod; +import org.springframework.security.authentication.AuthenticationManager; +import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder; +import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity; +import org.springframework.security.config.annotation.web.builders.WebSecurity; +import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; +import org.springframework.security.core.userdetails.UserDetailsService; +import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; +import org.springframework.security.crypto.password.PasswordEncoder; +import org.springframework.security.data.repository.query.SecurityEvaluationContextExtension; + +import javax.annotation.PostConstruct; + +@Configuration +@EnableGlobalMethodSecurity(prePostEnabled = true, securedEnabled = true) +public class UaaWebSecurityConfiguration extends WebSecurityConfigurerAdapter { + + private final UserDetailsService userDetailsService; + + private final AuthenticationManagerBuilder authenticationManagerBuilder; + + public UaaWebSecurityConfiguration(UserDetailsService userDetailsService, AuthenticationManagerBuilder authenticationManagerBuilder) { + this.userDetailsService = userDetailsService; + this.authenticationManagerBuilder = authenticationManagerBuilder; + } + + @PostConstruct + public void init() throws Exception { + try { + authenticationManagerBuilder + .userDetailsService(userDetailsService) + .passwordEncoder(passwordEncoder()); + } catch (Exception e) { + throw new BeanInitializationException("Security configuration failed", e); + } + } + + + @Bean + public PasswordEncoder passwordEncoder() { + return new BCryptPasswordEncoder(); + } + + @Override + @Bean + public AuthenticationManager authenticationManagerBean() throws Exception { + return super.authenticationManagerBean(); + } + + @Override + public void configure(WebSecurity web) throws Exception { + web.ignoring() + .antMatchers(HttpMethod.OPTIONS, "/**") + .antMatchers("/app/**/*.{js,html}") + .antMatchers("/bower_components/**") + .antMatchers("/i18n/**") + .antMatchers("/content/**") + .antMatchers("/swagger-ui/index.html") + .antMatchers("/test/**") + .antMatchers("/h2-console/**"); + } + + @Bean + public SecurityEvaluationContextExtension securityEvaluationContextExtension() { + return new SecurityEvaluationContextExtension(); + } +} diff --git a/jhipster/jhipster-uaa/uaa/src/main/java/com/baeldung/jhipster/uaa/config/WebConfigurer.java b/jhipster/jhipster-uaa/uaa/src/main/java/com/baeldung/jhipster/uaa/config/WebConfigurer.java new file mode 100644 index 0000000000..5ff65e9da8 --- /dev/null +++ b/jhipster/jhipster-uaa/uaa/src/main/java/com/baeldung/jhipster/uaa/config/WebConfigurer.java @@ -0,0 +1,148 @@ +package com.baeldung.jhipster.uaa.config; + +import com.codahale.metrics.MetricRegistry; +import com.codahale.metrics.servlet.InstrumentedFilter; +import com.codahale.metrics.servlets.MetricsServlet; +import io.github.jhipster.config.JHipsterConstants; +import io.github.jhipster.config.JHipsterProperties; +import io.github.jhipster.config.h2.H2ConfigurationHelper; +import io.undertow.UndertowOptions; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.web.embedded.undertow.UndertowServletWebServerFactory; +import org.springframework.boot.web.server.*; +import org.springframework.boot.web.servlet.ServletContextInitializer; +import org.springframework.boot.web.servlet.server.ConfigurableServletWebServerFactory; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.core.env.Environment; +import org.springframework.http.MediaType; +import org.springframework.web.cors.CorsConfiguration; +import org.springframework.web.cors.UrlBasedCorsConfigurationSource; +import org.springframework.web.filter.CorsFilter; + +import javax.servlet.*; +import java.nio.charset.StandardCharsets; +import java.util.*; + + +/** + * Configuration of web application with Servlet 3.0 APIs. + */ +@Configuration +public class WebConfigurer implements ServletContextInitializer, WebServerFactoryCustomizer { + + private final Logger log = LoggerFactory.getLogger(WebConfigurer.class); + + private final Environment env; + + private final JHipsterProperties jHipsterProperties; + + private MetricRegistry metricRegistry; + + public WebConfigurer(Environment env, JHipsterProperties jHipsterProperties) { + + this.env = env; + this.jHipsterProperties = jHipsterProperties; + } + + @Override + public void onStartup(ServletContext servletContext) throws ServletException { + if (env.getActiveProfiles().length != 0) { + log.info("Web application configuration, using profiles: {}", (Object[]) env.getActiveProfiles()); + } + EnumSet disps = EnumSet.of(DispatcherType.REQUEST, DispatcherType.FORWARD, DispatcherType.ASYNC); + initMetrics(servletContext, disps); + if (env.acceptsProfiles(JHipsterConstants.SPRING_PROFILE_DEVELOPMENT)) { + initH2Console(servletContext); + } + log.info("Web application fully configured"); + } + + /** + * Customize the Servlet engine: Mime types, the document root, the cache. + */ + @Override + public void customize(WebServerFactory server) { + setMimeMappings(server); + + /* + * Enable HTTP/2 for Undertow - https://twitter.com/ankinson/status/829256167700492288 + * HTTP/2 requires HTTPS, so HTTP requests will fallback to HTTP/1.1. + * See the JHipsterProperties class and your application-*.yml configuration files + * for more information. + */ + if (jHipsterProperties.getHttp().getVersion().equals(JHipsterProperties.Http.Version.V_2_0) && + server instanceof UndertowServletWebServerFactory) { + + ((UndertowServletWebServerFactory) server) + .addBuilderCustomizers(builder -> + builder.setServerOption(UndertowOptions.ENABLE_HTTP2, true)); + } + } + + private void setMimeMappings(WebServerFactory server) { + if (server instanceof ConfigurableServletWebServerFactory) { + MimeMappings mappings = new MimeMappings(MimeMappings.DEFAULT); + // IE issue, see https://github.com/jhipster/generator-jhipster/pull/711 + mappings.add("html", MediaType.TEXT_HTML_VALUE + ";charset=" + StandardCharsets.UTF_8.name().toLowerCase()); + // CloudFoundry issue, see https://github.com/cloudfoundry/gorouter/issues/64 + mappings.add("json", MediaType.TEXT_HTML_VALUE + ";charset=" + StandardCharsets.UTF_8.name().toLowerCase()); + ConfigurableServletWebServerFactory servletWebServer = (ConfigurableServletWebServerFactory) server; + servletWebServer.setMimeMappings(mappings); + } + } + + /** + * Initializes Metrics. + */ + private void initMetrics(ServletContext servletContext, EnumSet disps) { + log.debug("Initializing Metrics registries"); + servletContext.setAttribute(InstrumentedFilter.REGISTRY_ATTRIBUTE, + metricRegistry); + servletContext.setAttribute(MetricsServlet.METRICS_REGISTRY, + metricRegistry); + + log.debug("Registering Metrics Filter"); + FilterRegistration.Dynamic metricsFilter = servletContext.addFilter("webappMetricsFilter", + new InstrumentedFilter()); + + metricsFilter.addMappingForUrlPatterns(disps, true, "/*"); + metricsFilter.setAsyncSupported(true); + + log.debug("Registering Metrics Servlet"); + ServletRegistration.Dynamic metricsAdminServlet = + servletContext.addServlet("metricsServlet", new MetricsServlet()); + + metricsAdminServlet.addMapping("/management/metrics/*"); + metricsAdminServlet.setAsyncSupported(true); + metricsAdminServlet.setLoadOnStartup(2); + } + + @Bean + public CorsFilter corsFilter() { + UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource(); + CorsConfiguration config = jHipsterProperties.getCors(); + if (config.getAllowedOrigins() != null && !config.getAllowedOrigins().isEmpty()) { + log.debug("Registering CORS filter"); + source.registerCorsConfiguration("/api/**", config); + source.registerCorsConfiguration("/management/**", config); + source.registerCorsConfiguration("/v2/api-docs", config); + } + return new CorsFilter(source); + } + + /** + * Initializes H2 console. + */ + private void initH2Console(ServletContext servletContext) { + log.debug("Initialize H2 console"); + H2ConfigurationHelper.initH2Console(servletContext); + } + + @Autowired(required = false) + public void setMetricRegistry(MetricRegistry metricRegistry) { + this.metricRegistry = metricRegistry; + } +} diff --git a/jhipster/jhipster-uaa/uaa/src/main/java/com/baeldung/jhipster/uaa/config/audit/AuditEventConverter.java b/jhipster/jhipster-uaa/uaa/src/main/java/com/baeldung/jhipster/uaa/config/audit/AuditEventConverter.java new file mode 100644 index 0000000000..e5e6971bfc --- /dev/null +++ b/jhipster/jhipster-uaa/uaa/src/main/java/com/baeldung/jhipster/uaa/config/audit/AuditEventConverter.java @@ -0,0 +1,86 @@ +package com.baeldung.jhipster.uaa.config.audit; + +import com.baeldung.jhipster.uaa.domain.PersistentAuditEvent; + +import org.springframework.boot.actuate.audit.AuditEvent; +import org.springframework.security.web.authentication.WebAuthenticationDetails; +import org.springframework.stereotype.Component; + +import java.util.*; + +@Component +public class AuditEventConverter { + + /** + * Convert a list of PersistentAuditEvent to a list of AuditEvent + * + * @param persistentAuditEvents the list to convert + * @return the converted list. + */ + public List convertToAuditEvent(Iterable persistentAuditEvents) { + if (persistentAuditEvents == null) { + return Collections.emptyList(); + } + List auditEvents = new ArrayList<>(); + for (PersistentAuditEvent persistentAuditEvent : persistentAuditEvents) { + auditEvents.add(convertToAuditEvent(persistentAuditEvent)); + } + return auditEvents; + } + + /** + * Convert a PersistentAuditEvent to an AuditEvent + * + * @param persistentAuditEvent the event to convert + * @return the converted list. + */ + public AuditEvent convertToAuditEvent(PersistentAuditEvent persistentAuditEvent) { + if (persistentAuditEvent == null) { + return null; + } + return new AuditEvent(persistentAuditEvent.getAuditEventDate(), persistentAuditEvent.getPrincipal(), + persistentAuditEvent.getAuditEventType(), convertDataToObjects(persistentAuditEvent.getData())); + } + + /** + * Internal conversion. This is needed to support the current SpringBoot actuator AuditEventRepository interface + * + * @param data the data to convert + * @return a map of String, Object + */ + public Map convertDataToObjects(Map data) { + Map results = new HashMap<>(); + + if (data != null) { + for (Map.Entry entry : data.entrySet()) { + results.put(entry.getKey(), entry.getValue()); + } + } + return results; + } + + /** + * Internal conversion. This method will allow to save additional data. + * By default, it will save the object as string + * + * @param data the data to convert + * @return a map of String, String + */ + public Map convertDataToStrings(Map data) { + Map results = new HashMap<>(); + + if (data != null) { + for (Map.Entry entry : data.entrySet()) { + // Extract the data that will be saved. + if (entry.getValue() instanceof WebAuthenticationDetails) { + WebAuthenticationDetails authenticationDetails = (WebAuthenticationDetails) entry.getValue(); + results.put("remoteAddress", authenticationDetails.getRemoteAddress()); + results.put("sessionId", authenticationDetails.getSessionId()); + } else { + results.put(entry.getKey(), Objects.toString(entry.getValue())); + } + } + } + return results; + } +} diff --git a/jhipster/jhipster-uaa/uaa/src/main/java/com/baeldung/jhipster/uaa/config/audit/package-info.java b/jhipster/jhipster-uaa/uaa/src/main/java/com/baeldung/jhipster/uaa/config/audit/package-info.java new file mode 100644 index 0000000000..c39bf76a2c --- /dev/null +++ b/jhipster/jhipster-uaa/uaa/src/main/java/com/baeldung/jhipster/uaa/config/audit/package-info.java @@ -0,0 +1,4 @@ +/** + * Audit specific code. + */ +package com.baeldung.jhipster.uaa.config.audit; diff --git a/jhipster/jhipster-uaa/uaa/src/main/java/com/baeldung/jhipster/uaa/config/package-info.java b/jhipster/jhipster-uaa/uaa/src/main/java/com/baeldung/jhipster/uaa/config/package-info.java new file mode 100644 index 0000000000..bf6af99d80 --- /dev/null +++ b/jhipster/jhipster-uaa/uaa/src/main/java/com/baeldung/jhipster/uaa/config/package-info.java @@ -0,0 +1,4 @@ +/** + * Spring Framework configuration files. + */ +package com.baeldung.jhipster.uaa.config; diff --git a/jhipster/jhipster-uaa/uaa/src/main/java/com/baeldung/jhipster/uaa/domain/AbstractAuditingEntity.java b/jhipster/jhipster-uaa/uaa/src/main/java/com/baeldung/jhipster/uaa/domain/AbstractAuditingEntity.java new file mode 100644 index 0000000000..919af9be23 --- /dev/null +++ b/jhipster/jhipster-uaa/uaa/src/main/java/com/baeldung/jhipster/uaa/domain/AbstractAuditingEntity.java @@ -0,0 +1,79 @@ +package com.baeldung.jhipster.uaa.domain; + +import com.fasterxml.jackson.annotation.JsonIgnore; +import org.hibernate.envers.Audited; +import org.springframework.data.annotation.CreatedBy; +import org.springframework.data.annotation.CreatedDate; +import org.springframework.data.annotation.LastModifiedBy; +import org.springframework.data.annotation.LastModifiedDate; +import org.springframework.data.jpa.domain.support.AuditingEntityListener; + +import java.io.Serializable; +import java.time.Instant; +import javax.persistence.Column; +import javax.persistence.EntityListeners; +import javax.persistence.MappedSuperclass; + +/** + * Base abstract class for entities which will hold definitions for created, last modified by and created, + * last modified by date. + */ +@MappedSuperclass +@Audited +@EntityListeners(AuditingEntityListener.class) +public abstract class AbstractAuditingEntity implements Serializable { + + private static final long serialVersionUID = 1L; + + @CreatedBy + @Column(name = "created_by", nullable = false, length = 50, updatable = false) + @JsonIgnore + private String createdBy; + + @CreatedDate + @Column(name = "created_date", nullable = false, updatable = false) + @JsonIgnore + private Instant createdDate = Instant.now(); + + @LastModifiedBy + @Column(name = "last_modified_by", length = 50) + @JsonIgnore + private String lastModifiedBy; + + @LastModifiedDate + @Column(name = "last_modified_date") + @JsonIgnore + private Instant lastModifiedDate = Instant.now(); + + public String getCreatedBy() { + return createdBy; + } + + public void setCreatedBy(String createdBy) { + this.createdBy = createdBy; + } + + public Instant getCreatedDate() { + return createdDate; + } + + public void setCreatedDate(Instant createdDate) { + this.createdDate = createdDate; + } + + public String getLastModifiedBy() { + return lastModifiedBy; + } + + public void setLastModifiedBy(String lastModifiedBy) { + this.lastModifiedBy = lastModifiedBy; + } + + public Instant getLastModifiedDate() { + return lastModifiedDate; + } + + public void setLastModifiedDate(Instant lastModifiedDate) { + this.lastModifiedDate = lastModifiedDate; + } +} diff --git a/jhipster/jhipster-uaa/uaa/src/main/java/com/baeldung/jhipster/uaa/domain/Authority.java b/jhipster/jhipster-uaa/uaa/src/main/java/com/baeldung/jhipster/uaa/domain/Authority.java new file mode 100644 index 0000000000..ea7159a57f --- /dev/null +++ b/jhipster/jhipster-uaa/uaa/src/main/java/com/baeldung/jhipster/uaa/domain/Authority.java @@ -0,0 +1,62 @@ +package com.baeldung.jhipster.uaa.domain; + +import org.hibernate.annotations.Cache; +import org.hibernate.annotations.CacheConcurrencyStrategy; +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.Table; +import javax.persistence.Column; +import javax.validation.constraints.NotNull; +import javax.validation.constraints.Size; +import java.io.Serializable; + +/** + * An authority (a security role) used by Spring Security. + */ +@Entity +@Table(name = "jhi_authority") +@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE) +public class Authority implements Serializable { + + private static final long serialVersionUID = 1L; + + @NotNull + @Size(max = 50) + @Id + @Column(length = 50) + private String name; + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + + Authority authority = (Authority) o; + + return !(name != null ? !name.equals(authority.name) : authority.name != null); + } + + @Override + public int hashCode() { + return name != null ? name.hashCode() : 0; + } + + @Override + public String toString() { + return "Authority{" + + "name='" + name + '\'' + + "}"; + } +} diff --git a/jhipster/jhipster-uaa/uaa/src/main/java/com/baeldung/jhipster/uaa/domain/PersistentAuditEvent.java b/jhipster/jhipster-uaa/uaa/src/main/java/com/baeldung/jhipster/uaa/domain/PersistentAuditEvent.java new file mode 100644 index 0000000000..af232b1a40 --- /dev/null +++ b/jhipster/jhipster-uaa/uaa/src/main/java/com/baeldung/jhipster/uaa/domain/PersistentAuditEvent.java @@ -0,0 +1,81 @@ +package com.baeldung.jhipster.uaa.domain; + +import javax.persistence.*; +import javax.validation.constraints.NotNull; +import java.io.Serializable; +import java.time.Instant; +import java.util.HashMap; +import java.util.Map; + +/** + * Persist AuditEvent managed by the Spring Boot actuator. + * + * @see org.springframework.boot.actuate.audit.AuditEvent + */ +@Entity +@Table(name = "jhi_persistent_audit_event") +public class PersistentAuditEvent implements Serializable { + + private static final long serialVersionUID = 1L; + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Column(name = "event_id") + private Long id; + + @NotNull + @Column(nullable = false) + private String principal; + + @Column(name = "event_date") + private Instant auditEventDate; + + @Column(name = "event_type") + private String auditEventType; + + @ElementCollection + @MapKeyColumn(name = "name") + @Column(name = "value") + @CollectionTable(name = "jhi_persistent_audit_evt_data", joinColumns=@JoinColumn(name="event_id")) + private Map data = new HashMap<>(); + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getPrincipal() { + return principal; + } + + public void setPrincipal(String principal) { + this.principal = principal; + } + + public Instant getAuditEventDate() { + return auditEventDate; + } + + public void setAuditEventDate(Instant auditEventDate) { + this.auditEventDate = auditEventDate; + } + + public String getAuditEventType() { + return auditEventType; + } + + public void setAuditEventType(String auditEventType) { + this.auditEventType = auditEventType; + } + + public Map getData() { + return data; + } + + public void setData(Map data) { + this.data = data; + } +} diff --git a/jhipster/jhipster-uaa/uaa/src/main/java/com/baeldung/jhipster/uaa/domain/User.java b/jhipster/jhipster-uaa/uaa/src/main/java/com/baeldung/jhipster/uaa/domain/User.java new file mode 100644 index 0000000000..3c5e7ffd2b --- /dev/null +++ b/jhipster/jhipster-uaa/uaa/src/main/java/com/baeldung/jhipster/uaa/domain/User.java @@ -0,0 +1,233 @@ +package com.baeldung.jhipster.uaa.domain; + +import com.baeldung.jhipster.uaa.config.Constants; + +import com.fasterxml.jackson.annotation.JsonIgnore; +import org.apache.commons.lang3.StringUtils; +import org.hibernate.annotations.BatchSize; +import org.hibernate.annotations.Cache; +import org.hibernate.annotations.CacheConcurrencyStrategy; +import javax.validation.constraints.Email; + +import javax.persistence.*; +import javax.validation.constraints.NotNull; +import javax.validation.constraints.Pattern; +import javax.validation.constraints.Size; +import java.io.Serializable; +import java.util.HashSet; +import java.util.Locale; +import java.util.Objects; +import java.util.Set; +import java.time.Instant; + +/** + * A user. + */ +@Entity +@Table(name = "jhi_user") +@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE) +public class User extends AbstractAuditingEntity implements Serializable { + + private static final long serialVersionUID = 1L; + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + private Long id; + + @NotNull + @Pattern(regexp = Constants.LOGIN_REGEX) + @Size(min = 1, max = 50) + @Column(length = 50, unique = true, nullable = false) + private String login; + + @JsonIgnore + @NotNull + @Size(min = 60, max = 60) + @Column(name = "password_hash", length = 60, nullable = false) + private String password; + + @Size(max = 50) + @Column(name = "first_name", length = 50) + private String firstName; + + @Size(max = 50) + @Column(name = "last_name", length = 50) + private String lastName; + + @Email + @Size(min = 5, max = 254) + @Column(length = 254, unique = true) + private String email; + + @NotNull + @Column(nullable = false) + private boolean activated = false; + + @Size(min = 2, max = 6) + @Column(name = "lang_key", length = 6) + private String langKey; + + @Size(max = 256) + @Column(name = "image_url", length = 256) + private String imageUrl; + + @Size(max = 20) + @Column(name = "activation_key", length = 20) + @JsonIgnore + private String activationKey; + + @Size(max = 20) + @Column(name = "reset_key", length = 20) + @JsonIgnore + private String resetKey; + + @Column(name = "reset_date") + private Instant resetDate = null; + + @JsonIgnore + @ManyToMany + @JoinTable( + name = "jhi_user_authority", + joinColumns = {@JoinColumn(name = "user_id", referencedColumnName = "id")}, + inverseJoinColumns = {@JoinColumn(name = "authority_name", referencedColumnName = "name")}) + @Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE) + @BatchSize(size = 20) + private Set authorities = new HashSet<>(); + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getLogin() { + return login; + } + + // Lowercase the login before saving it in database + public void setLogin(String login) { + this.login = StringUtils.lowerCase(login, Locale.ENGLISH); + } + + public String getPassword() { + return password; + } + + public void setPassword(String password) { + this.password = password; + } + + public String getFirstName() { + return firstName; + } + + public void setFirstName(String firstName) { + this.firstName = firstName; + } + + public String getLastName() { + return lastName; + } + + public void setLastName(String lastName) { + this.lastName = lastName; + } + + public String getEmail() { + return email; + } + + public void setEmail(String email) { + this.email = email; + } + + public String getImageUrl() { + return imageUrl; + } + + public void setImageUrl(String imageUrl) { + this.imageUrl = imageUrl; + } + + public boolean getActivated() { + return activated; + } + + public void setActivated(boolean activated) { + this.activated = activated; + } + + public String getActivationKey() { + return activationKey; + } + + public void setActivationKey(String activationKey) { + this.activationKey = activationKey; + } + + public String getResetKey() { + return resetKey; + } + + public void setResetKey(String resetKey) { + this.resetKey = resetKey; + } + + public Instant getResetDate() { + return resetDate; + } + + public void setResetDate(Instant resetDate) { + this.resetDate = resetDate; + } + + public String getLangKey() { + return langKey; + } + + public void setLangKey(String langKey) { + this.langKey = langKey; + } + + public Set getAuthorities() { + return authorities; + } + + public void setAuthorities(Set authorities) { + this.authorities = authorities; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + + User user = (User) o; + return !(user.getId() == null || getId() == null) && Objects.equals(getId(), user.getId()); + } + + @Override + public int hashCode() { + return Objects.hashCode(getId()); + } + + @Override + public String toString() { + return "User{" + + "login='" + login + '\'' + + ", firstName='" + firstName + '\'' + + ", lastName='" + lastName + '\'' + + ", email='" + email + '\'' + + ", imageUrl='" + imageUrl + '\'' + + ", activated='" + activated + '\'' + + ", langKey='" + langKey + '\'' + + ", activationKey='" + activationKey + '\'' + + "}"; + } +} diff --git a/jhipster/jhipster-uaa/uaa/src/main/java/com/baeldung/jhipster/uaa/domain/package-info.java b/jhipster/jhipster-uaa/uaa/src/main/java/com/baeldung/jhipster/uaa/domain/package-info.java new file mode 100644 index 0000000000..c79cfa9aa2 --- /dev/null +++ b/jhipster/jhipster-uaa/uaa/src/main/java/com/baeldung/jhipster/uaa/domain/package-info.java @@ -0,0 +1,4 @@ +/** + * JPA domain objects. + */ +package com.baeldung.jhipster.uaa.domain; diff --git a/jhipster/jhipster-uaa/uaa/src/main/java/com/baeldung/jhipster/uaa/repository/AuthorityRepository.java b/jhipster/jhipster-uaa/uaa/src/main/java/com/baeldung/jhipster/uaa/repository/AuthorityRepository.java new file mode 100644 index 0000000000..b60e601315 --- /dev/null +++ b/jhipster/jhipster-uaa/uaa/src/main/java/com/baeldung/jhipster/uaa/repository/AuthorityRepository.java @@ -0,0 +1,11 @@ +package com.baeldung.jhipster.uaa.repository; + +import com.baeldung.jhipster.uaa.domain.Authority; + +import org.springframework.data.jpa.repository.JpaRepository; + +/** + * Spring Data JPA repository for the Authority entity. + */ +public interface AuthorityRepository extends JpaRepository { +} diff --git a/jhipster/jhipster-uaa/uaa/src/main/java/com/baeldung/jhipster/uaa/repository/CustomAuditEventRepository.java b/jhipster/jhipster-uaa/uaa/src/main/java/com/baeldung/jhipster/uaa/repository/CustomAuditEventRepository.java new file mode 100644 index 0000000000..6f63984c52 --- /dev/null +++ b/jhipster/jhipster-uaa/uaa/src/main/java/com/baeldung/jhipster/uaa/repository/CustomAuditEventRepository.java @@ -0,0 +1,89 @@ +package com.baeldung.jhipster.uaa.repository; + +import com.baeldung.jhipster.uaa.config.Constants; +import com.baeldung.jhipster.uaa.config.audit.AuditEventConverter; +import com.baeldung.jhipster.uaa.domain.PersistentAuditEvent; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.boot.actuate.audit.AuditEvent; +import org.springframework.boot.actuate.audit.AuditEventRepository; +import org.springframework.stereotype.Repository; +import org.springframework.transaction.annotation.Propagation; +import org.springframework.transaction.annotation.Transactional; + +import java.time.Instant; +import java.util.*; + +/** + * An implementation of Spring Boot's AuditEventRepository. + */ +@Repository +public class CustomAuditEventRepository implements AuditEventRepository { + + private static final String AUTHORIZATION_FAILURE = "AUTHORIZATION_FAILURE"; + + /** + * Should be the same as in Liquibase migration. + */ + protected static final int EVENT_DATA_COLUMN_MAX_LENGTH = 255; + + private final PersistenceAuditEventRepository persistenceAuditEventRepository; + + private final AuditEventConverter auditEventConverter; + + private final Logger log = LoggerFactory.getLogger(getClass()); + + public CustomAuditEventRepository(PersistenceAuditEventRepository persistenceAuditEventRepository, + AuditEventConverter auditEventConverter) { + + this.persistenceAuditEventRepository = persistenceAuditEventRepository; + this.auditEventConverter = auditEventConverter; + } + + @Override + public List find(String principal, Instant after, String type) { + Iterable persistentAuditEvents = + persistenceAuditEventRepository.findByPrincipalAndAuditEventDateAfterAndAuditEventType(principal, after, type); + return auditEventConverter.convertToAuditEvent(persistentAuditEvents); + } + + @Override + @Transactional(propagation = Propagation.REQUIRES_NEW) + public void add(AuditEvent event) { + if (!AUTHORIZATION_FAILURE.equals(event.getType()) && + !Constants.ANONYMOUS_USER.equals(event.getPrincipal())) { + + PersistentAuditEvent persistentAuditEvent = new PersistentAuditEvent(); + persistentAuditEvent.setPrincipal(event.getPrincipal()); + persistentAuditEvent.setAuditEventType(event.getType()); + persistentAuditEvent.setAuditEventDate(event.getTimestamp()); + Map eventData = auditEventConverter.convertDataToStrings(event.getData()); + persistentAuditEvent.setData(truncate(eventData)); + persistenceAuditEventRepository.save(persistentAuditEvent); + } + } + + /** + * Truncate event data that might exceed column length. + */ + private Map truncate(Map data) { + Map results = new HashMap<>(); + + if (data != null) { + for (Map.Entry entry : data.entrySet()) { + String value = entry.getValue(); + if (value != null) { + int length = value.length(); + if (length > EVENT_DATA_COLUMN_MAX_LENGTH) { + value = value.substring(0, EVENT_DATA_COLUMN_MAX_LENGTH); + log.warn("Event data for {} too long ({}) has been truncated to {}. Consider increasing column width.", + entry.getKey(), length, EVENT_DATA_COLUMN_MAX_LENGTH); + } + } + results.put(entry.getKey(), value); + } + } + return results; + } +} diff --git a/jhipster/jhipster-uaa/uaa/src/main/java/com/baeldung/jhipster/uaa/repository/PersistenceAuditEventRepository.java b/jhipster/jhipster-uaa/uaa/src/main/java/com/baeldung/jhipster/uaa/repository/PersistenceAuditEventRepository.java new file mode 100644 index 0000000000..259887fcc4 --- /dev/null +++ b/jhipster/jhipster-uaa/uaa/src/main/java/com/baeldung/jhipster/uaa/repository/PersistenceAuditEventRepository.java @@ -0,0 +1,25 @@ +package com.baeldung.jhipster.uaa.repository; + +import com.baeldung.jhipster.uaa.domain.PersistentAuditEvent; +import org.springframework.data.domain.Page; +import org.springframework.data.domain.Pageable; +import org.springframework.data.jpa.repository.JpaRepository; + +import java.time.Instant; +import java.util.List; + +/** + * Spring Data JPA repository for the PersistentAuditEvent entity. + */ +public interface PersistenceAuditEventRepository extends JpaRepository { + + List findByPrincipal(String principal); + + List findByAuditEventDateAfter(Instant after); + + List findByPrincipalAndAuditEventDateAfter(String principal, Instant after); + + List findByPrincipalAndAuditEventDateAfterAndAuditEventType(String principal, Instant after, String type); + + Page findAllByAuditEventDateBetween(Instant fromDate, Instant toDate, Pageable pageable); +} diff --git a/jhipster/jhipster-uaa/uaa/src/main/java/com/baeldung/jhipster/uaa/repository/UserRepository.java b/jhipster/jhipster-uaa/uaa/src/main/java/com/baeldung/jhipster/uaa/repository/UserRepository.java new file mode 100644 index 0000000000..dda52a5ef5 --- /dev/null +++ b/jhipster/jhipster-uaa/uaa/src/main/java/com/baeldung/jhipster/uaa/repository/UserRepository.java @@ -0,0 +1,47 @@ +package com.baeldung.jhipster.uaa.repository; + +import com.baeldung.jhipster.uaa.domain.User; + +import org.springframework.cache.annotation.Cacheable; +import org.springframework.data.domain.Page; +import org.springframework.data.domain.Pageable; +import org.springframework.data.jpa.repository.EntityGraph; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.stereotype.Repository; +import java.util.List; +import java.util.Optional; +import java.time.Instant; + +/** + * Spring Data JPA repository for the User entity. + */ +@Repository +public interface UserRepository extends JpaRepository { + + String USERS_BY_LOGIN_CACHE = "usersByLogin"; + + String USERS_BY_EMAIL_CACHE = "usersByEmail"; + + Optional findOneByActivationKey(String activationKey); + + List findAllByActivatedIsFalseAndCreatedDateBefore(Instant dateTime); + + Optional findOneByResetKey(String resetKey); + + Optional findOneByEmailIgnoreCase(String email); + + Optional findOneByLogin(String login); + + @EntityGraph(attributePaths = "authorities") + Optional findOneWithAuthoritiesById(Long id); + + @EntityGraph(attributePaths = "authorities") + @Cacheable(cacheNames = USERS_BY_LOGIN_CACHE) + Optional findOneWithAuthoritiesByLogin(String login); + + @EntityGraph(attributePaths = "authorities") + @Cacheable(cacheNames = USERS_BY_EMAIL_CACHE) + Optional findOneWithAuthoritiesByEmail(String email); + + Page findAllByLoginNot(Pageable pageable, String login); +} diff --git a/jhipster/jhipster-uaa/uaa/src/main/java/com/baeldung/jhipster/uaa/repository/package-info.java b/jhipster/jhipster-uaa/uaa/src/main/java/com/baeldung/jhipster/uaa/repository/package-info.java new file mode 100644 index 0000000000..135fad8759 --- /dev/null +++ b/jhipster/jhipster-uaa/uaa/src/main/java/com/baeldung/jhipster/uaa/repository/package-info.java @@ -0,0 +1,4 @@ +/** + * Spring Data JPA repositories. + */ +package com.baeldung.jhipster.uaa.repository; diff --git a/jhipster/jhipster-uaa/uaa/src/main/java/com/baeldung/jhipster/uaa/security/AuthoritiesConstants.java b/jhipster/jhipster-uaa/uaa/src/main/java/com/baeldung/jhipster/uaa/security/AuthoritiesConstants.java new file mode 100644 index 0000000000..d6f18015c5 --- /dev/null +++ b/jhipster/jhipster-uaa/uaa/src/main/java/com/baeldung/jhipster/uaa/security/AuthoritiesConstants.java @@ -0,0 +1,16 @@ +package com.baeldung.jhipster.uaa.security; + +/** + * Constants for Spring Security authorities. + */ +public final class AuthoritiesConstants { + + public static final String ADMIN = "ROLE_ADMIN"; + + public static final String USER = "ROLE_USER"; + + public static final String ANONYMOUS = "ROLE_ANONYMOUS"; + + private AuthoritiesConstants() { + } +} diff --git a/jhipster/jhipster-uaa/uaa/src/main/java/com/baeldung/jhipster/uaa/security/DomainUserDetailsService.java b/jhipster/jhipster-uaa/uaa/src/main/java/com/baeldung/jhipster/uaa/security/DomainUserDetailsService.java new file mode 100644 index 0000000000..5f0d249070 --- /dev/null +++ b/jhipster/jhipster-uaa/uaa/src/main/java/com/baeldung/jhipster/uaa/security/DomainUserDetailsService.java @@ -0,0 +1,62 @@ +package com.baeldung.jhipster.uaa.security; + +import com.baeldung.jhipster.uaa.domain.User; +import com.baeldung.jhipster.uaa.repository.UserRepository; +import org.hibernate.validator.internal.constraintvalidators.hv.EmailValidator; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.security.core.GrantedAuthority; +import org.springframework.security.core.authority.SimpleGrantedAuthority; +import org.springframework.security.core.userdetails.UserDetails; +import org.springframework.security.core.userdetails.UserDetailsService; +import org.springframework.security.core.userdetails.UsernameNotFoundException; +import org.springframework.stereotype.Component; +import org.springframework.transaction.annotation.Transactional; + +import java.util.*; +import java.util.stream.Collectors; + +/** + * Authenticate a user from the database. + */ +@Component("userDetailsService") +public class DomainUserDetailsService implements UserDetailsService { + + private final Logger log = LoggerFactory.getLogger(DomainUserDetailsService.class); + + private final UserRepository userRepository; + + public DomainUserDetailsService(UserRepository userRepository) { + this.userRepository = userRepository; + } + + @Override + @Transactional + public UserDetails loadUserByUsername(final String login) { + log.debug("Authenticating {}", login); + + if (new EmailValidator().isValid(login, null)) { + return userRepository.findOneWithAuthoritiesByEmail(login) + .map(user -> createSpringSecurityUser(login, user)) + .orElseThrow(() -> new UsernameNotFoundException("User with email " + login + " was not found in the database")); + } + + String lowercaseLogin = login.toLowerCase(Locale.ENGLISH); + return userRepository.findOneWithAuthoritiesByLogin(lowercaseLogin) + .map(user -> createSpringSecurityUser(lowercaseLogin, user)) + .orElseThrow(() -> new UsernameNotFoundException("User " + lowercaseLogin + " was not found in the database")); + + } + + private org.springframework.security.core.userdetails.User createSpringSecurityUser(String lowercaseLogin, User user) { + if (!user.getActivated()) { + throw new UserNotActivatedException("User " + lowercaseLogin + " was not activated"); + } + List grantedAuthorities = user.getAuthorities().stream() + .map(authority -> new SimpleGrantedAuthority(authority.getName())) + .collect(Collectors.toList()); + return new org.springframework.security.core.userdetails.User(user.getLogin(), + user.getPassword(), + grantedAuthorities); + } +} diff --git a/jhipster/jhipster-uaa/uaa/src/main/java/com/baeldung/jhipster/uaa/security/IatTokenEnhancer.java b/jhipster/jhipster-uaa/uaa/src/main/java/com/baeldung/jhipster/uaa/security/IatTokenEnhancer.java new file mode 100644 index 0000000000..d9c2e2b05a --- /dev/null +++ b/jhipster/jhipster-uaa/uaa/src/main/java/com/baeldung/jhipster/uaa/security/IatTokenEnhancer.java @@ -0,0 +1,36 @@ +package com.baeldung.jhipster.uaa.security; + +import org.springframework.security.oauth2.common.DefaultOAuth2AccessToken; +import org.springframework.security.oauth2.common.OAuth2AccessToken; +import org.springframework.security.oauth2.provider.OAuth2Authentication; +import org.springframework.security.oauth2.provider.token.TokenEnhancer; +import org.springframework.stereotype.Component; + +import java.util.LinkedHashMap; +import java.util.Map; + +/** + * Adds the standard "iat" claim to tokens so we know when they have been created. + * This is needed for a session timeout due to inactivity (ignored in case of "remember-me"). + */ +@Component +public class IatTokenEnhancer implements TokenEnhancer { + + @Override + public OAuth2AccessToken enhance(OAuth2AccessToken accessToken, OAuth2Authentication authentication) { + addClaims((DefaultOAuth2AccessToken) accessToken); + return accessToken; + } + + private void addClaims(DefaultOAuth2AccessToken accessToken) { + DefaultOAuth2AccessToken token = accessToken; + Map additionalInformation = token.getAdditionalInformation(); + if (additionalInformation.isEmpty()) { + additionalInformation = new LinkedHashMap(); + } + //add "iat" claim with current time in secs + //this is used for an inactive session timeout + additionalInformation.put("iat", new Integer((int)(System.currentTimeMillis()/1000L))); + token.setAdditionalInformation(additionalInformation); + } +} diff --git a/jhipster/jhipster-uaa/uaa/src/main/java/com/baeldung/jhipster/uaa/security/SecurityUtils.java b/jhipster/jhipster-uaa/uaa/src/main/java/com/baeldung/jhipster/uaa/security/SecurityUtils.java new file mode 100644 index 0000000000..b6ce7546df --- /dev/null +++ b/jhipster/jhipster-uaa/uaa/src/main/java/com/baeldung/jhipster/uaa/security/SecurityUtils.java @@ -0,0 +1,64 @@ +package com.baeldung.jhipster.uaa.security; + +import org.springframework.security.core.context.SecurityContext; +import org.springframework.security.core.context.SecurityContextHolder; +import org.springframework.security.core.userdetails.UserDetails; + +import java.util.Optional; + +/** + * Utility class for Spring Security. + */ +public final class SecurityUtils { + + private SecurityUtils() { + } + + /** + * Get the login of the current user. + * + * @return the login of the current user + */ + public static Optional getCurrentUserLogin() { + SecurityContext securityContext = SecurityContextHolder.getContext(); + return Optional.ofNullable(securityContext.getAuthentication()) + .map(authentication -> { + if (authentication.getPrincipal() instanceof UserDetails) { + UserDetails springSecurityUser = (UserDetails) authentication.getPrincipal(); + return springSecurityUser.getUsername(); + } else if (authentication.getPrincipal() instanceof String) { + return (String) authentication.getPrincipal(); + } + return null; + }); + } + + /** + * Check if a user is authenticated. + * + * @return true if the user is authenticated, false otherwise + */ + public static boolean isAuthenticated() { + SecurityContext securityContext = SecurityContextHolder.getContext(); + return Optional.ofNullable(securityContext.getAuthentication()) + .map(authentication -> authentication.getAuthorities().stream() + .noneMatch(grantedAuthority -> grantedAuthority.getAuthority().equals(AuthoritiesConstants.ANONYMOUS))) + .orElse(false); + } + + /** + * If the current user has a specific authority (security role). + *

+ * The name of this method comes from the isUserInRole() method in the Servlet API + * + * @param authority the authority to check + * @return true if the current user has the authority, false otherwise + */ + public static boolean isCurrentUserInRole(String authority) { + SecurityContext securityContext = SecurityContextHolder.getContext(); + return Optional.ofNullable(securityContext.getAuthentication()) + .map(authentication -> authentication.getAuthorities().stream() + .anyMatch(grantedAuthority -> grantedAuthority.getAuthority().equals(authority))) + .orElse(false); + } +} diff --git a/jhipster/jhipster-uaa/uaa/src/main/java/com/baeldung/jhipster/uaa/security/SpringSecurityAuditorAware.java b/jhipster/jhipster-uaa/uaa/src/main/java/com/baeldung/jhipster/uaa/security/SpringSecurityAuditorAware.java new file mode 100644 index 0000000000..7b71ceab9d --- /dev/null +++ b/jhipster/jhipster-uaa/uaa/src/main/java/com/baeldung/jhipster/uaa/security/SpringSecurityAuditorAware.java @@ -0,0 +1,20 @@ +package com.baeldung.jhipster.uaa.security; + +import com.baeldung.jhipster.uaa.config.Constants; + +import java.util.Optional; + +import org.springframework.data.domain.AuditorAware; +import org.springframework.stereotype.Component; + +/** + * Implementation of AuditorAware based on Spring Security. + */ +@Component +public class SpringSecurityAuditorAware implements AuditorAware { + + @Override + public Optional getCurrentAuditor() { + return Optional.of(SecurityUtils.getCurrentUserLogin().orElse(Constants.SYSTEM_ACCOUNT)); + } +} diff --git a/jhipster/jhipster-uaa/uaa/src/main/java/com/baeldung/jhipster/uaa/security/UserNotActivatedException.java b/jhipster/jhipster-uaa/uaa/src/main/java/com/baeldung/jhipster/uaa/security/UserNotActivatedException.java new file mode 100644 index 0000000000..0a1300e466 --- /dev/null +++ b/jhipster/jhipster-uaa/uaa/src/main/java/com/baeldung/jhipster/uaa/security/UserNotActivatedException.java @@ -0,0 +1,19 @@ +package com.baeldung.jhipster.uaa.security; + +import org.springframework.security.core.AuthenticationException; + +/** + * This exception is thrown in case of a not activated user trying to authenticate. + */ +public class UserNotActivatedException extends AuthenticationException { + + private static final long serialVersionUID = 1L; + + public UserNotActivatedException(String message) { + super(message); + } + + public UserNotActivatedException(String message, Throwable t) { + super(message, t); + } +} diff --git a/jhipster/jhipster-uaa/uaa/src/main/java/com/baeldung/jhipster/uaa/security/package-info.java b/jhipster/jhipster-uaa/uaa/src/main/java/com/baeldung/jhipster/uaa/security/package-info.java new file mode 100644 index 0000000000..b812840289 --- /dev/null +++ b/jhipster/jhipster-uaa/uaa/src/main/java/com/baeldung/jhipster/uaa/security/package-info.java @@ -0,0 +1,4 @@ +/** + * Spring Security configuration. + */ +package com.baeldung.jhipster.uaa.security; diff --git a/jhipster/jhipster-uaa/uaa/src/main/java/com/baeldung/jhipster/uaa/service/AuditEventService.java b/jhipster/jhipster-uaa/uaa/src/main/java/com/baeldung/jhipster/uaa/service/AuditEventService.java new file mode 100644 index 0000000000..ace539f553 --- /dev/null +++ b/jhipster/jhipster-uaa/uaa/src/main/java/com/baeldung/jhipster/uaa/service/AuditEventService.java @@ -0,0 +1,51 @@ +package com.baeldung.jhipster.uaa.service; + +import com.baeldung.jhipster.uaa.config.audit.AuditEventConverter; +import com.baeldung.jhipster.uaa.repository.PersistenceAuditEventRepository; +import org.springframework.boot.actuate.audit.AuditEvent; +import org.springframework.data.domain.Page; +import org.springframework.data.domain.Pageable; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.time.Instant; +import java.util.Optional; + +/** + * Service for managing audit events. + *

+ * This is the default implementation to support SpringBoot Actuator AuditEventRepository + */ +@Service +@Transactional +public class AuditEventService { + + private final PersistenceAuditEventRepository persistenceAuditEventRepository; + + private final AuditEventConverter auditEventConverter; + + public AuditEventService( + PersistenceAuditEventRepository persistenceAuditEventRepository, + AuditEventConverter auditEventConverter) { + + this.persistenceAuditEventRepository = persistenceAuditEventRepository; + this.auditEventConverter = auditEventConverter; + } + + public Page findAll(Pageable pageable) { + return persistenceAuditEventRepository.findAll(pageable) + .map(auditEventConverter::convertToAuditEvent); + } + + public Page findByDates(Instant fromDate, Instant toDate, Pageable pageable) { + return persistenceAuditEventRepository.findAllByAuditEventDateBetween(fromDate, toDate, pageable) + .map(auditEventConverter::convertToAuditEvent); + } + + public Optional find(Long id) { + return Optional.ofNullable(persistenceAuditEventRepository.findById(id)) + .filter(Optional::isPresent) + .map(Optional::get) + .map(auditEventConverter::convertToAuditEvent); + } +} diff --git a/jhipster/jhipster-uaa/uaa/src/main/java/com/baeldung/jhipster/uaa/service/MailService.java b/jhipster/jhipster-uaa/uaa/src/main/java/com/baeldung/jhipster/uaa/service/MailService.java new file mode 100644 index 0000000000..1535fcdac6 --- /dev/null +++ b/jhipster/jhipster-uaa/uaa/src/main/java/com/baeldung/jhipster/uaa/service/MailService.java @@ -0,0 +1,105 @@ +package com.baeldung.jhipster.uaa.service; + +import com.baeldung.jhipster.uaa.domain.User; + +import io.github.jhipster.config.JHipsterProperties; + +import java.nio.charset.StandardCharsets; +import java.util.Locale; +import javax.mail.internet.MimeMessage; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.context.MessageSource; +import org.springframework.mail.javamail.JavaMailSender; +import org.springframework.mail.javamail.MimeMessageHelper; +import org.springframework.scheduling.annotation.Async; +import org.springframework.stereotype.Service; +import org.thymeleaf.context.Context; +import org.thymeleaf.spring5.SpringTemplateEngine; + +/** + * Service for sending emails. + *

+ * We use the @Async annotation to send emails asynchronously. + */ +@Service +public class MailService { + + private final Logger log = LoggerFactory.getLogger(MailService.class); + + private static final String USER = "user"; + + private static final String BASE_URL = "baseUrl"; + + private final JHipsterProperties jHipsterProperties; + + private final JavaMailSender javaMailSender; + + private final MessageSource messageSource; + + private final SpringTemplateEngine templateEngine; + + public MailService(JHipsterProperties jHipsterProperties, JavaMailSender javaMailSender, + MessageSource messageSource, SpringTemplateEngine templateEngine) { + + this.jHipsterProperties = jHipsterProperties; + this.javaMailSender = javaMailSender; + this.messageSource = messageSource; + this.templateEngine = templateEngine; + } + + @Async + public void sendEmail(String to, String subject, String content, boolean isMultipart, boolean isHtml) { + log.debug("Send email[multipart '{}' and html '{}'] to '{}' with subject '{}' and content={}", + isMultipart, isHtml, to, subject, content); + + // Prepare message using a Spring helper + MimeMessage mimeMessage = javaMailSender.createMimeMessage(); + try { + MimeMessageHelper message = new MimeMessageHelper(mimeMessage, isMultipart, StandardCharsets.UTF_8.name()); + message.setTo(to); + message.setFrom(jHipsterProperties.getMail().getFrom()); + message.setSubject(subject); + message.setText(content, isHtml); + javaMailSender.send(mimeMessage); + log.debug("Sent email to User '{}'", to); + } catch (Exception e) { + if (log.isDebugEnabled()) { + log.warn("Email could not be sent to user '{}'", to, e); + } else { + log.warn("Email could not be sent to user '{}': {}", to, e.getMessage()); + } + } + } + + @Async + public void sendEmailFromTemplate(User user, String templateName, String titleKey) { + Locale locale = Locale.forLanguageTag(user.getLangKey()); + Context context = new Context(locale); + context.setVariable(USER, user); + context.setVariable(BASE_URL, jHipsterProperties.getMail().getBaseUrl()); + String content = templateEngine.process(templateName, context); + String subject = messageSource.getMessage(titleKey, null, locale); + sendEmail(user.getEmail(), subject, content, false, true); + + } + + @Async + public void sendActivationEmail(User user) { + log.debug("Sending activation email to '{}'", user.getEmail()); + sendEmailFromTemplate(user, "mail/activationEmail", "email.activation.title"); + } + + @Async + public void sendCreationEmail(User user) { + log.debug("Sending creation email to '{}'", user.getEmail()); + sendEmailFromTemplate(user, "mail/creationEmail", "email.activation.title"); + } + + @Async + public void sendPasswordResetMail(User user) { + log.debug("Sending password reset email to '{}'", user.getEmail()); + sendEmailFromTemplate(user, "mail/passwordResetEmail", "email.reset.title"); + } +} diff --git a/jhipster/jhipster-uaa/uaa/src/main/java/com/baeldung/jhipster/uaa/service/UserService.java b/jhipster/jhipster-uaa/uaa/src/main/java/com/baeldung/jhipster/uaa/service/UserService.java new file mode 100644 index 0000000000..8f5c7bffcc --- /dev/null +++ b/jhipster/jhipster-uaa/uaa/src/main/java/com/baeldung/jhipster/uaa/service/UserService.java @@ -0,0 +1,293 @@ +package com.baeldung.jhipster.uaa.service; + +import com.baeldung.jhipster.uaa.config.Constants; +import com.baeldung.jhipster.uaa.domain.Authority; +import com.baeldung.jhipster.uaa.domain.User; +import com.baeldung.jhipster.uaa.repository.AuthorityRepository; +import com.baeldung.jhipster.uaa.repository.UserRepository; +import com.baeldung.jhipster.uaa.security.AuthoritiesConstants; +import com.baeldung.jhipster.uaa.security.SecurityUtils; +import com.baeldung.jhipster.uaa.service.dto.UserDTO; +import com.baeldung.jhipster.uaa.service.util.RandomUtil; +import com.baeldung.jhipster.uaa.web.rest.errors.*; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.cache.CacheManager; +import org.springframework.data.domain.Page; +import org.springframework.data.domain.Pageable; +import org.springframework.scheduling.annotation.Scheduled; +import org.springframework.security.crypto.password.PasswordEncoder; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.time.Instant; +import java.time.temporal.ChronoUnit; +import java.util.*; +import java.util.stream.Collectors; + +/** + * Service class for managing users. + */ +@Service +@Transactional +public class UserService { + + private final Logger log = LoggerFactory.getLogger(UserService.class); + + private final UserRepository userRepository; + + private final PasswordEncoder passwordEncoder; + + private final AuthorityRepository authorityRepository; + + private final CacheManager cacheManager; + + public UserService(UserRepository userRepository, PasswordEncoder passwordEncoder, AuthorityRepository authorityRepository, CacheManager cacheManager) { + this.userRepository = userRepository; + this.passwordEncoder = passwordEncoder; + this.authorityRepository = authorityRepository; + this.cacheManager = cacheManager; + } + + public Optional activateRegistration(String key) { + log.debug("Activating user for activation key {}", key); + return userRepository.findOneByActivationKey(key) + .map(user -> { + // activate given user for the registration key. + user.setActivated(true); + user.setActivationKey(null); + this.clearUserCaches(user); + log.debug("Activated user: {}", user); + return user; + }); + } + + public Optional completePasswordReset(String newPassword, String key) { + log.debug("Reset user password for reset key {}", key); + return userRepository.findOneByResetKey(key) + .filter(user -> user.getResetDate().isAfter(Instant.now().minusSeconds(86400))) + .map(user -> { + user.setPassword(passwordEncoder.encode(newPassword)); + user.setResetKey(null); + user.setResetDate(null); + this.clearUserCaches(user); + return user; + }); + } + + public Optional requestPasswordReset(String mail) { + return userRepository.findOneByEmailIgnoreCase(mail) + .filter(User::getActivated) + .map(user -> { + user.setResetKey(RandomUtil.generateResetKey()); + user.setResetDate(Instant.now()); + this.clearUserCaches(user); + return user; + }); + } + + public User registerUser(UserDTO userDTO, String password) { + userRepository.findOneByLogin(userDTO.getLogin().toLowerCase()).ifPresent(existingUser -> { + boolean removed = removeNonActivatedUser(existingUser); + if (!removed) { + throw new LoginAlreadyUsedException(); + } + }); + userRepository.findOneByEmailIgnoreCase(userDTO.getEmail()).ifPresent(existingUser -> { + boolean removed = removeNonActivatedUser(existingUser); + if (!removed) { + throw new EmailAlreadyUsedException(); + } + }); + User newUser = new User(); + String encryptedPassword = passwordEncoder.encode(password); + newUser.setLogin(userDTO.getLogin().toLowerCase()); + // new user gets initially a generated password + newUser.setPassword(encryptedPassword); + newUser.setFirstName(userDTO.getFirstName()); + newUser.setLastName(userDTO.getLastName()); + newUser.setEmail(userDTO.getEmail().toLowerCase()); + newUser.setImageUrl(userDTO.getImageUrl()); + newUser.setLangKey(userDTO.getLangKey()); + // new user is not active + newUser.setActivated(false); + // new user gets registration key + newUser.setActivationKey(RandomUtil.generateActivationKey()); + Set authorities = new HashSet<>(); + authorityRepository.findById(AuthoritiesConstants.USER).ifPresent(authorities::add); + newUser.setAuthorities(authorities); + userRepository.save(newUser); + this.clearUserCaches(newUser); + log.debug("Created Information for User: {}", newUser); + return newUser; + } + private boolean removeNonActivatedUser(User existingUser){ + if(existingUser.getActivated()) { + return false; + } + userRepository.delete(existingUser); + userRepository.flush(); + this.clearUserCaches(existingUser); + return true; + } + + public User createUser(UserDTO userDTO) { + User user = new User(); + user.setLogin(userDTO.getLogin().toLowerCase()); + user.setFirstName(userDTO.getFirstName()); + user.setLastName(userDTO.getLastName()); + user.setEmail(userDTO.getEmail().toLowerCase()); + user.setImageUrl(userDTO.getImageUrl()); + if (userDTO.getLangKey() == null) { + user.setLangKey(Constants.DEFAULT_LANGUAGE); // default language + } else { + user.setLangKey(userDTO.getLangKey()); + } + String encryptedPassword = passwordEncoder.encode(RandomUtil.generatePassword()); + user.setPassword(encryptedPassword); + user.setResetKey(RandomUtil.generateResetKey()); + user.setResetDate(Instant.now()); + user.setActivated(true); + if (userDTO.getAuthorities() != null) { + Set authorities = userDTO.getAuthorities().stream() + .map(authorityRepository::findById) + .filter(Optional::isPresent) + .map(Optional::get) + .collect(Collectors.toSet()); + user.setAuthorities(authorities); + } + userRepository.save(user); + this.clearUserCaches(user); + log.debug("Created Information for User: {}", user); + return user; + } + + /** + * Update basic information (first name, last name, email, language) for the current user. + * + * @param firstName first name of user + * @param lastName last name of user + * @param email email id of user + * @param langKey language key + * @param imageUrl image URL of user + */ + public void updateUser(String firstName, String lastName, String email, String langKey, String imageUrl) { + SecurityUtils.getCurrentUserLogin() + .flatMap(userRepository::findOneByLogin) + .ifPresent(user -> { + user.setFirstName(firstName); + user.setLastName(lastName); + user.setEmail(email.toLowerCase()); + user.setLangKey(langKey); + user.setImageUrl(imageUrl); + this.clearUserCaches(user); + log.debug("Changed Information for User: {}", user); + }); + } + + /** + * Update all information for a specific user, and return the modified user. + * + * @param userDTO user to update + * @return updated user + */ + public Optional updateUser(UserDTO userDTO) { + return Optional.of(userRepository + .findById(userDTO.getId())) + .filter(Optional::isPresent) + .map(Optional::get) + .map(user -> { + this.clearUserCaches(user); + user.setLogin(userDTO.getLogin().toLowerCase()); + user.setFirstName(userDTO.getFirstName()); + user.setLastName(userDTO.getLastName()); + user.setEmail(userDTO.getEmail().toLowerCase()); + user.setImageUrl(userDTO.getImageUrl()); + user.setActivated(userDTO.isActivated()); + user.setLangKey(userDTO.getLangKey()); + Set managedAuthorities = user.getAuthorities(); + managedAuthorities.clear(); + userDTO.getAuthorities().stream() + .map(authorityRepository::findById) + .filter(Optional::isPresent) + .map(Optional::get) + .forEach(managedAuthorities::add); + this.clearUserCaches(user); + log.debug("Changed Information for User: {}", user); + return user; + }) + .map(UserDTO::new); + } + + public void deleteUser(String login) { + userRepository.findOneByLogin(login).ifPresent(user -> { + userRepository.delete(user); + this.clearUserCaches(user); + log.debug("Deleted User: {}", user); + }); + } + + public void changePassword(String currentClearTextPassword, String newPassword) { + SecurityUtils.getCurrentUserLogin() + .flatMap(userRepository::findOneByLogin) + .ifPresent(user -> { + String currentEncryptedPassword = user.getPassword(); + if (!passwordEncoder.matches(currentClearTextPassword, currentEncryptedPassword)) { + throw new InvalidPasswordException(); + } + String encryptedPassword = passwordEncoder.encode(newPassword); + user.setPassword(encryptedPassword); + this.clearUserCaches(user); + log.debug("Changed password for User: {}", user); + }); + } + + @Transactional(readOnly = true) + public Page getAllManagedUsers(Pageable pageable) { + return userRepository.findAllByLoginNot(pageable, Constants.ANONYMOUS_USER).map(UserDTO::new); + } + + @Transactional(readOnly = true) + public Optional getUserWithAuthoritiesByLogin(String login) { + return userRepository.findOneWithAuthoritiesByLogin(login); + } + + @Transactional(readOnly = true) + public Optional getUserWithAuthorities(Long id) { + return userRepository.findOneWithAuthoritiesById(id); + } + + @Transactional(readOnly = true) + public Optional getUserWithAuthorities() { + return SecurityUtils.getCurrentUserLogin().flatMap(userRepository::findOneWithAuthoritiesByLogin); + } + + /** + * Not activated users should be automatically deleted after 3 days. + *

+ * This is scheduled to get fired everyday, at 01:00 (am). + */ + @Scheduled(cron = "0 0 1 * * ?") + public void removeNotActivatedUsers() { + userRepository + .findAllByActivatedIsFalseAndCreatedDateBefore(Instant.now().minus(3, ChronoUnit.DAYS)) + .forEach(user -> { + log.debug("Deleting not activated user {}", user.getLogin()); + userRepository.delete(user); + this.clearUserCaches(user); + }); + } + + /** + * @return a list of all the authorities + */ + public List getAuthorities() { + return authorityRepository.findAll().stream().map(Authority::getName).collect(Collectors.toList()); + } + + private void clearUserCaches(User user) { + Objects.requireNonNull(cacheManager.getCache(UserRepository.USERS_BY_LOGIN_CACHE)).evict(user.getLogin()); + Objects.requireNonNull(cacheManager.getCache(UserRepository.USERS_BY_EMAIL_CACHE)).evict(user.getEmail()); + } +} diff --git a/jhipster/jhipster-uaa/uaa/src/main/java/com/baeldung/jhipster/uaa/service/dto/PasswordChangeDTO.java b/jhipster/jhipster-uaa/uaa/src/main/java/com/baeldung/jhipster/uaa/service/dto/PasswordChangeDTO.java new file mode 100644 index 0000000000..47a8720d4a --- /dev/null +++ b/jhipster/jhipster-uaa/uaa/src/main/java/com/baeldung/jhipster/uaa/service/dto/PasswordChangeDTO.java @@ -0,0 +1,35 @@ +package com.baeldung.jhipster.uaa.service.dto; + +/** + * A DTO representing a password change required data - current and new password. + */ +public class PasswordChangeDTO { + private String currentPassword; + private String newPassword; + + public PasswordChangeDTO() { + // Empty constructor needed for Jackson. + } + + public PasswordChangeDTO(String currentPassword, String newPassword) { + this.currentPassword = currentPassword; + this.newPassword = newPassword; + } + + public String getCurrentPassword() { + + return currentPassword; + } + + public void setCurrentPassword(String currentPassword) { + this.currentPassword = currentPassword; + } + + public String getNewPassword() { + return newPassword; + } + + public void setNewPassword(String newPassword) { + this.newPassword = newPassword; + } +} diff --git a/jhipster/jhipster-uaa/uaa/src/main/java/com/baeldung/jhipster/uaa/service/dto/UserDTO.java b/jhipster/jhipster-uaa/uaa/src/main/java/com/baeldung/jhipster/uaa/service/dto/UserDTO.java new file mode 100644 index 0000000000..e8a2e3300c --- /dev/null +++ b/jhipster/jhipster-uaa/uaa/src/main/java/com/baeldung/jhipster/uaa/service/dto/UserDTO.java @@ -0,0 +1,199 @@ +package com.baeldung.jhipster.uaa.service.dto; + +import com.baeldung.jhipster.uaa.config.Constants; + +import com.baeldung.jhipster.uaa.domain.Authority; +import com.baeldung.jhipster.uaa.domain.User; + +import javax.validation.constraints.Email; +import javax.validation.constraints.NotBlank; + +import javax.validation.constraints.*; +import java.time.Instant; +import java.util.Set; +import java.util.stream.Collectors; + +/** + * A DTO representing a user, with his authorities. + */ +public class UserDTO { + + private Long id; + + @NotBlank + @Pattern(regexp = Constants.LOGIN_REGEX) + @Size(min = 1, max = 50) + private String login; + + @Size(max = 50) + private String firstName; + + @Size(max = 50) + private String lastName; + + @Email + @Size(min = 5, max = 254) + private String email; + + @Size(max = 256) + private String imageUrl; + + private boolean activated = false; + + @Size(min = 2, max = 6) + private String langKey; + + private String createdBy; + + private Instant createdDate; + + private String lastModifiedBy; + + private Instant lastModifiedDate; + + private Set authorities; + + public UserDTO() { + // Empty constructor needed for Jackson. + } + + public UserDTO(User user) { + this.id = user.getId(); + this.login = user.getLogin(); + this.firstName = user.getFirstName(); + this.lastName = user.getLastName(); + this.email = user.getEmail(); + this.activated = user.getActivated(); + this.imageUrl = user.getImageUrl(); + this.langKey = user.getLangKey(); + this.createdBy = user.getCreatedBy(); + this.createdDate = user.getCreatedDate(); + this.lastModifiedBy = user.getLastModifiedBy(); + this.lastModifiedDate = user.getLastModifiedDate(); + this.authorities = user.getAuthorities().stream() + .map(Authority::getName) + .collect(Collectors.toSet()); + } + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getLogin() { + return login; + } + + public void setLogin(String login) { + this.login = login; + } + + public String getFirstName() { + return firstName; + } + + public void setFirstName(String firstName) { + this.firstName = firstName; + } + + public String getLastName() { + return lastName; + } + + public void setLastName(String lastName) { + this.lastName = lastName; + } + + public String getEmail() { + return email; + } + + public void setEmail(String email) { + this.email = email; + } + + public String getImageUrl() { + return imageUrl; + } + + public void setImageUrl(String imageUrl) { + this.imageUrl = imageUrl; + } + + public boolean isActivated() { + return activated; + } + + public void setActivated(boolean activated) { + this.activated = activated; + } + + public String getLangKey() { + return langKey; + } + + public void setLangKey(String langKey) { + this.langKey = langKey; + } + + public String getCreatedBy() { + return createdBy; + } + + public void setCreatedBy(String createdBy) { + this.createdBy = createdBy; + } + + public Instant getCreatedDate() { + return createdDate; + } + + public void setCreatedDate(Instant createdDate) { + this.createdDate = createdDate; + } + + public String getLastModifiedBy() { + return lastModifiedBy; + } + + public void setLastModifiedBy(String lastModifiedBy) { + this.lastModifiedBy = lastModifiedBy; + } + + public Instant getLastModifiedDate() { + return lastModifiedDate; + } + + public void setLastModifiedDate(Instant lastModifiedDate) { + this.lastModifiedDate = lastModifiedDate; + } + + public Set getAuthorities() { + return authorities; + } + + public void setAuthorities(Set authorities) { + this.authorities = authorities; + } + + @Override + public String toString() { + return "UserDTO{" + + "login='" + login + '\'' + + ", firstName='" + firstName + '\'' + + ", lastName='" + lastName + '\'' + + ", email='" + email + '\'' + + ", imageUrl='" + imageUrl + '\'' + + ", activated=" + activated + + ", langKey='" + langKey + '\'' + + ", createdBy=" + createdBy + + ", createdDate=" + createdDate + + ", lastModifiedBy='" + lastModifiedBy + '\'' + + ", lastModifiedDate=" + lastModifiedDate + + ", authorities=" + authorities + + "}"; + } +} diff --git a/jhipster/jhipster-uaa/uaa/src/main/java/com/baeldung/jhipster/uaa/service/dto/package-info.java b/jhipster/jhipster-uaa/uaa/src/main/java/com/baeldung/jhipster/uaa/service/dto/package-info.java new file mode 100644 index 0000000000..9fcb17ad7e --- /dev/null +++ b/jhipster/jhipster-uaa/uaa/src/main/java/com/baeldung/jhipster/uaa/service/dto/package-info.java @@ -0,0 +1,4 @@ +/** + * Data Transfer Objects. + */ +package com.baeldung.jhipster.uaa.service.dto; diff --git a/jhipster/jhipster-uaa/uaa/src/main/java/com/baeldung/jhipster/uaa/service/mapper/UserMapper.java b/jhipster/jhipster-uaa/uaa/src/main/java/com/baeldung/jhipster/uaa/service/mapper/UserMapper.java new file mode 100644 index 0000000000..11948b3dce --- /dev/null +++ b/jhipster/jhipster-uaa/uaa/src/main/java/com/baeldung/jhipster/uaa/service/mapper/UserMapper.java @@ -0,0 +1,76 @@ +package com.baeldung.jhipster.uaa.service.mapper; + +import com.baeldung.jhipster.uaa.domain.Authority; +import com.baeldung.jhipster.uaa.domain.User; +import com.baeldung.jhipster.uaa.service.dto.UserDTO; + +import org.springframework.stereotype.Service; + +import java.util.*; +import java.util.stream.Collectors; + +/** + * Mapper for the entity User and its DTO called UserDTO. + * + * Normal mappers are generated using MapStruct, this one is hand-coded as MapStruct + * support is still in beta, and requires a manual step with an IDE. + */ +@Service +public class UserMapper { + + public UserDTO userToUserDTO(User user) { + return new UserDTO(user); + } + + public List usersToUserDTOs(List users) { + return users.stream() + .filter(Objects::nonNull) + .map(this::userToUserDTO) + .collect(Collectors.toList()); + } + + public User userDTOToUser(UserDTO userDTO) { + if (userDTO == null) { + return null; + } else { + User user = new User(); + user.setId(userDTO.getId()); + user.setLogin(userDTO.getLogin()); + user.setFirstName(userDTO.getFirstName()); + user.setLastName(userDTO.getLastName()); + user.setEmail(userDTO.getEmail()); + user.setImageUrl(userDTO.getImageUrl()); + user.setActivated(userDTO.isActivated()); + user.setLangKey(userDTO.getLangKey()); + Set authorities = this.authoritiesFromStrings(userDTO.getAuthorities()); + if (authorities != null) { + user.setAuthorities(authorities); + } + return user; + } + } + + public List userDTOsToUsers(List userDTOs) { + return userDTOs.stream() + .filter(Objects::nonNull) + .map(this::userDTOToUser) + .collect(Collectors.toList()); + } + + public User userFromId(Long id) { + if (id == null) { + return null; + } + User user = new User(); + user.setId(id); + return user; + } + + public Set authoritiesFromStrings(Set strings) { + return strings.stream().map(string -> { + Authority auth = new Authority(); + auth.setName(string); + return auth; + }).collect(Collectors.toSet()); + } +} diff --git a/jhipster/jhipster-uaa/uaa/src/main/java/com/baeldung/jhipster/uaa/service/mapper/package-info.java b/jhipster/jhipster-uaa/uaa/src/main/java/com/baeldung/jhipster/uaa/service/mapper/package-info.java new file mode 100644 index 0000000000..053d4a8e4c --- /dev/null +++ b/jhipster/jhipster-uaa/uaa/src/main/java/com/baeldung/jhipster/uaa/service/mapper/package-info.java @@ -0,0 +1,4 @@ +/** + * MapStruct mappers for mapping domain objects and Data Transfer Objects. + */ +package com.baeldung.jhipster.uaa.service.mapper; diff --git a/jhipster/jhipster-uaa/uaa/src/main/java/com/baeldung/jhipster/uaa/service/package-info.java b/jhipster/jhipster-uaa/uaa/src/main/java/com/baeldung/jhipster/uaa/service/package-info.java new file mode 100644 index 0000000000..ca7bcd8f09 --- /dev/null +++ b/jhipster/jhipster-uaa/uaa/src/main/java/com/baeldung/jhipster/uaa/service/package-info.java @@ -0,0 +1,4 @@ +/** + * Service layer beans. + */ +package com.baeldung.jhipster.uaa.service; diff --git a/jhipster/jhipster-uaa/uaa/src/main/java/com/baeldung/jhipster/uaa/service/util/RandomUtil.java b/jhipster/jhipster-uaa/uaa/src/main/java/com/baeldung/jhipster/uaa/service/util/RandomUtil.java new file mode 100644 index 0000000000..8eab3ac101 --- /dev/null +++ b/jhipster/jhipster-uaa/uaa/src/main/java/com/baeldung/jhipster/uaa/service/util/RandomUtil.java @@ -0,0 +1,41 @@ +package com.baeldung.jhipster.uaa.service.util; + +import org.apache.commons.lang3.RandomStringUtils; + +/** + * Utility class for generating random Strings. + */ +public final class RandomUtil { + + private static final int DEF_COUNT = 20; + + private RandomUtil() { + } + + /** + * Generate a password. + * + * @return the generated password + */ + public static String generatePassword() { + return RandomStringUtils.randomAlphanumeric(DEF_COUNT); + } + + /** + * Generate an activation key. + * + * @return the generated activation key + */ + public static String generateActivationKey() { + return RandomStringUtils.randomNumeric(DEF_COUNT); + } + + /** + * Generate a reset key. + * + * @return the generated reset key + */ + public static String generateResetKey() { + return RandomStringUtils.randomNumeric(DEF_COUNT); + } +} diff --git a/jhipster/jhipster-uaa/uaa/src/main/java/com/baeldung/jhipster/uaa/web/rest/AccountResource.java b/jhipster/jhipster-uaa/uaa/src/main/java/com/baeldung/jhipster/uaa/web/rest/AccountResource.java new file mode 100644 index 0000000000..144ce0f9d9 --- /dev/null +++ b/jhipster/jhipster-uaa/uaa/src/main/java/com/baeldung/jhipster/uaa/web/rest/AccountResource.java @@ -0,0 +1,189 @@ +package com.baeldung.jhipster.uaa.web.rest; + +import com.codahale.metrics.annotation.Timed; + +import com.baeldung.jhipster.uaa.domain.User; +import com.baeldung.jhipster.uaa.repository.UserRepository; +import com.baeldung.jhipster.uaa.security.SecurityUtils; +import com.baeldung.jhipster.uaa.service.MailService; +import com.baeldung.jhipster.uaa.service.UserService; +import com.baeldung.jhipster.uaa.service.dto.PasswordChangeDTO; +import com.baeldung.jhipster.uaa.service.dto.UserDTO; +import com.baeldung.jhipster.uaa.web.rest.errors.*; +import com.baeldung.jhipster.uaa.web.rest.vm.KeyAndPasswordVM; +import com.baeldung.jhipster.uaa.web.rest.vm.ManagedUserVM; + +import org.apache.commons.lang3.StringUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.http.HttpStatus; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletRequest; +import javax.validation.Valid; +import java.util.*; + + +/** + * REST controller for managing the current user's account. + */ +@RestController +@RequestMapping("/api") +public class AccountResource { + + private final Logger log = LoggerFactory.getLogger(AccountResource.class); + + private final UserRepository userRepository; + + private final UserService userService; + + private final MailService mailService; + + public AccountResource(UserRepository userRepository, UserService userService, MailService mailService) { + + this.userRepository = userRepository; + this.userService = userService; + this.mailService = mailService; + } + + /** + * POST /register : register the user. + * + * @param managedUserVM the managed user View Model + * @throws InvalidPasswordException 400 (Bad Request) if the password is incorrect + * @throws EmailAlreadyUsedException 400 (Bad Request) if the email is already used + * @throws LoginAlreadyUsedException 400 (Bad Request) if the login is already used + */ + @PostMapping("/register") + @Timed + @ResponseStatus(HttpStatus.CREATED) + public void registerAccount(@Valid @RequestBody ManagedUserVM managedUserVM) { + if (!checkPasswordLength(managedUserVM.getPassword())) { + throw new InvalidPasswordException(); + } + User user = userService.registerUser(managedUserVM, managedUserVM.getPassword()); + mailService.sendActivationEmail(user); + } + + /** + * GET /activate : activate the registered user. + * + * @param key the activation key + * @throws RuntimeException 500 (Internal Server Error) if the user couldn't be activated + */ + @GetMapping("/activate") + @Timed + public void activateAccount(@RequestParam(value = "key") String key) { + Optional user = userService.activateRegistration(key); + if (!user.isPresent()) { + throw new InternalServerErrorException("No user was found for this activation key"); + } + } + + /** + * GET /authenticate : check if the user is authenticated, and return its login. + * + * @param request the HTTP request + * @return the login if the user is authenticated + */ + @GetMapping("/authenticate") + @Timed + public String isAuthenticated(HttpServletRequest request) { + log.debug("REST request to check if the current user is authenticated"); + return request.getRemoteUser(); + } + + /** + * GET /account : get the current user. + * + * @return the current user + * @throws RuntimeException 500 (Internal Server Error) if the user couldn't be returned + */ + @GetMapping("/account") + @Timed + public UserDTO getAccount() { + return userService.getUserWithAuthorities() + .map(UserDTO::new) + .orElseThrow(() -> new InternalServerErrorException("User could not be found")); + } + + /** + * POST /account : update the current user information. + * + * @param userDTO the current user information + * @throws EmailAlreadyUsedException 400 (Bad Request) if the email is already used + * @throws RuntimeException 500 (Internal Server Error) if the user login wasn't found + */ + @PostMapping("/account") + @Timed + public void saveAccount(@Valid @RequestBody UserDTO userDTO) { + final String userLogin = SecurityUtils.getCurrentUserLogin().orElseThrow(() -> new InternalServerErrorException("Current user login not found")); + Optional existingUser = userRepository.findOneByEmailIgnoreCase(userDTO.getEmail()); + if (existingUser.isPresent() && (!existingUser.get().getLogin().equalsIgnoreCase(userLogin))) { + throw new EmailAlreadyUsedException(); + } + Optional user = userRepository.findOneByLogin(userLogin); + if (!user.isPresent()) { + throw new InternalServerErrorException("User could not be found"); + } + userService.updateUser(userDTO.getFirstName(), userDTO.getLastName(), userDTO.getEmail(), + userDTO.getLangKey(), userDTO.getImageUrl()); + } + + /** + * POST /account/change-password : changes the current user's password + * + * @param passwordChangeDto current and new password + * @throws InvalidPasswordException 400 (Bad Request) if the new password is incorrect + */ + @PostMapping(path = "/account/change-password") + @Timed + public void changePassword(@RequestBody PasswordChangeDTO passwordChangeDto) { + if (!checkPasswordLength(passwordChangeDto.getNewPassword())) { + throw new InvalidPasswordException(); + } + userService.changePassword(passwordChangeDto.getCurrentPassword(), passwordChangeDto.getNewPassword()); + } + + /** + * POST /account/reset-password/init : Send an email to reset the password of the user + * + * @param mail the mail of the user + * @throws EmailNotFoundException 400 (Bad Request) if the email address is not registered + */ + @PostMapping(path = "/account/reset-password/init") + @Timed + public void requestPasswordReset(@RequestBody String mail) { + mailService.sendPasswordResetMail( + userService.requestPasswordReset(mail) + .orElseThrow(EmailNotFoundException::new) + ); + } + + /** + * POST /account/reset-password/finish : Finish to reset the password of the user + * + * @param keyAndPassword the generated key and the new password + * @throws InvalidPasswordException 400 (Bad Request) if the password is incorrect + * @throws RuntimeException 500 (Internal Server Error) if the password could not be reset + */ + @PostMapping(path = "/account/reset-password/finish") + @Timed + public void finishPasswordReset(@RequestBody KeyAndPasswordVM keyAndPassword) { + if (!checkPasswordLength(keyAndPassword.getNewPassword())) { + throw new InvalidPasswordException(); + } + Optional user = + userService.completePasswordReset(keyAndPassword.getNewPassword(), keyAndPassword.getKey()); + + if (!user.isPresent()) { + throw new InternalServerErrorException("No user was found for this reset key"); + } + } + + private static boolean checkPasswordLength(String password) { + return !StringUtils.isEmpty(password) && + password.length() >= ManagedUserVM.PASSWORD_MIN_LENGTH && + password.length() <= ManagedUserVM.PASSWORD_MAX_LENGTH; + } +} diff --git a/jhipster/jhipster-uaa/uaa/src/main/java/com/baeldung/jhipster/uaa/web/rest/AuditResource.java b/jhipster/jhipster-uaa/uaa/src/main/java/com/baeldung/jhipster/uaa/web/rest/AuditResource.java new file mode 100644 index 0000000000..5f69a78cb0 --- /dev/null +++ b/jhipster/jhipster-uaa/uaa/src/main/java/com/baeldung/jhipster/uaa/web/rest/AuditResource.java @@ -0,0 +1,77 @@ +package com.baeldung.jhipster.uaa.web.rest; + +import com.baeldung.jhipster.uaa.service.AuditEventService; +import com.baeldung.jhipster.uaa.web.rest.util.PaginationUtil; + +import io.github.jhipster.web.util.ResponseUtil; +import org.springframework.boot.actuate.audit.AuditEvent; +import org.springframework.data.domain.Page; +import org.springframework.data.domain.Pageable; +import org.springframework.http.HttpHeaders; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.*; + +import java.time.LocalDate; +import java.time.ZoneId; +import java.util.List; + +/** + * REST controller for getting the audit events. + */ +@RestController +@RequestMapping("/management/audits") +public class AuditResource { + + private final AuditEventService auditEventService; + + public AuditResource(AuditEventService auditEventService) { + this.auditEventService = auditEventService; + } + + /** + * GET /audits : get a page of AuditEvents. + * + * @param pageable the pagination information + * @return the ResponseEntity with status 200 (OK) and the list of AuditEvents in body + */ + @GetMapping + public ResponseEntity> getAll(Pageable pageable) { + Page page = auditEventService.findAll(pageable); + HttpHeaders headers = PaginationUtil.generatePaginationHttpHeaders(page, "/management/audits"); + return new ResponseEntity<>(page.getContent(), headers, HttpStatus.OK); + } + + /** + * GET /audits : get a page of AuditEvents between the fromDate and toDate. + * + * @param fromDate the start of the time period of AuditEvents to get + * @param toDate the end of the time period of AuditEvents to get + * @param pageable the pagination information + * @return the ResponseEntity with status 200 (OK) and the list of AuditEvents in body + */ + @GetMapping(params = {"fromDate", "toDate"}) + public ResponseEntity> getByDates( + @RequestParam(value = "fromDate") LocalDate fromDate, + @RequestParam(value = "toDate") LocalDate toDate, + Pageable pageable) { + + Page page = auditEventService.findByDates( + fromDate.atStartOfDay(ZoneId.systemDefault()).toInstant(), + toDate.atStartOfDay(ZoneId.systemDefault()).plusDays(1).toInstant(), + pageable); + HttpHeaders headers = PaginationUtil.generatePaginationHttpHeaders(page, "/management/audits"); + return new ResponseEntity<>(page.getContent(), headers, HttpStatus.OK); + } + + /** + * GET /audits/:id : get an AuditEvent by id. + * + * @param id the id of the entity to get + * @return the ResponseEntity with status 200 (OK) and the AuditEvent in body, or status 404 (Not Found) + */ + @GetMapping("/{id:.+}") + public ResponseEntity get(@PathVariable Long id) { + return ResponseUtil.wrapOrNotFound(auditEventService.find(id)); + } +} diff --git a/jhipster/jhipster-uaa/uaa/src/main/java/com/baeldung/jhipster/uaa/web/rest/LogsResource.java b/jhipster/jhipster-uaa/uaa/src/main/java/com/baeldung/jhipster/uaa/web/rest/LogsResource.java new file mode 100644 index 0000000000..2bfe432452 --- /dev/null +++ b/jhipster/jhipster-uaa/uaa/src/main/java/com/baeldung/jhipster/uaa/web/rest/LogsResource.java @@ -0,0 +1,39 @@ +package com.baeldung.jhipster.uaa.web.rest; + +import com.baeldung.jhipster.uaa.web.rest.vm.LoggerVM; + +import ch.qos.logback.classic.Level; +import ch.qos.logback.classic.LoggerContext; +import com.codahale.metrics.annotation.Timed; +import org.slf4j.LoggerFactory; +import org.springframework.http.HttpStatus; +import org.springframework.web.bind.annotation.*; + +import java.util.List; +import java.util.stream.Collectors; + +/** + * Controller for view and managing Log Level at runtime. + */ +@RestController +@RequestMapping("/management") +public class LogsResource { + + @GetMapping("/logs") + @Timed + public List getList() { + LoggerContext context = (LoggerContext) LoggerFactory.getILoggerFactory(); + return context.getLoggerList() + .stream() + .map(LoggerVM::new) + .collect(Collectors.toList()); + } + + @PutMapping("/logs") + @ResponseStatus(HttpStatus.NO_CONTENT) + @Timed + public void changeLevel(@RequestBody LoggerVM jsonLogger) { + LoggerContext context = (LoggerContext) LoggerFactory.getILoggerFactory(); + context.getLogger(jsonLogger.getName()).setLevel(Level.valueOf(jsonLogger.getLevel())); + } +} diff --git a/jhipster/jhipster-uaa/uaa/src/main/java/com/baeldung/jhipster/uaa/web/rest/UserResource.java b/jhipster/jhipster-uaa/uaa/src/main/java/com/baeldung/jhipster/uaa/web/rest/UserResource.java new file mode 100644 index 0000000000..9df27661db --- /dev/null +++ b/jhipster/jhipster-uaa/uaa/src/main/java/com/baeldung/jhipster/uaa/web/rest/UserResource.java @@ -0,0 +1,190 @@ +package com.baeldung.jhipster.uaa.web.rest; + +import com.baeldung.jhipster.uaa.config.Constants; +import com.baeldung.jhipster.uaa.domain.User; +import com.baeldung.jhipster.uaa.repository.UserRepository; +import com.baeldung.jhipster.uaa.security.AuthoritiesConstants; +import com.baeldung.jhipster.uaa.service.MailService; +import com.baeldung.jhipster.uaa.service.UserService; +import com.baeldung.jhipster.uaa.service.dto.UserDTO; +import com.baeldung.jhipster.uaa.web.rest.errors.BadRequestAlertException; +import com.baeldung.jhipster.uaa.web.rest.errors.EmailAlreadyUsedException; +import com.baeldung.jhipster.uaa.web.rest.errors.LoginAlreadyUsedException; +import com.baeldung.jhipster.uaa.web.rest.util.HeaderUtil; +import com.baeldung.jhipster.uaa.web.rest.util.PaginationUtil; +import com.codahale.metrics.annotation.Timed; +import io.github.jhipster.web.util.ResponseUtil; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.data.domain.Page; +import org.springframework.data.domain.Pageable; +import org.springframework.http.HttpHeaders; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import javax.validation.Valid; +import java.net.URI; +import java.net.URISyntaxException; +import java.util.*; + +/** + * REST controller for managing users. + *

+ * This class accesses the User entity, and needs to fetch its collection of authorities. + *

+ * For a normal use-case, it would be better to have an eager relationship between User and Authority, + * and send everything to the client side: there would be no View Model and DTO, a lot less code, and an outer-join + * which would be good for performance. + *

+ * We use a View Model and a DTO for 3 reasons: + *

    + *
  • We want to keep a lazy association between the user and the authorities, because people will + * quite often do relationships with the user, and we don't want them to get the authorities all + * the time for nothing (for performance reasons). This is the #1 goal: we should not impact our users' + * application because of this use-case.
  • + *
  • Not having an outer join causes n+1 requests to the database. This is not a real issue as + * we have by default a second-level cache. This means on the first HTTP call we do the n+1 requests, + * but then all authorities come from the cache, so in fact it's much better than doing an outer join + * (which will get lots of data from the database, for each HTTP call).
  • + *
  • As this manages users, for security reasons, we'd rather have a DTO layer.
  • + *
+ *

+ * Another option would be to have a specific JPA entity graph to handle this case. + */ +@RestController +@RequestMapping("/api") +public class UserResource { + + private final Logger log = LoggerFactory.getLogger(UserResource.class); + + private final UserService userService; + + private final UserRepository userRepository; + + private final MailService mailService; + + public UserResource(UserService userService, UserRepository userRepository, MailService mailService) { + + this.userService = userService; + this.userRepository = userRepository; + this.mailService = mailService; + } + + /** + * POST /users : Creates a new user. + *

+ * Creates a new user if the login and email are not already used, and sends an + * mail with an activation link. + * The user needs to be activated on creation. + * + * @param userDTO the user to create + * @return the ResponseEntity with status 201 (Created) and with body the new user, or with status 400 (Bad Request) if the login or email is already in use + * @throws URISyntaxException if the Location URI syntax is incorrect + * @throws BadRequestAlertException 400 (Bad Request) if the login or email is already in use + */ + @PostMapping("/users") + @Timed + @PreAuthorize("hasRole(\"" + AuthoritiesConstants.ADMIN + "\")") + public ResponseEntity createUser(@Valid @RequestBody UserDTO userDTO) throws URISyntaxException { + log.debug("REST request to save User : {}", userDTO); + + if (userDTO.getId() != null) { + throw new BadRequestAlertException("A new user cannot already have an ID", "userManagement", "idexists"); + // Lowercase the user login before comparing with database + } else if (userRepository.findOneByLogin(userDTO.getLogin().toLowerCase()).isPresent()) { + throw new LoginAlreadyUsedException(); + } else if (userRepository.findOneByEmailIgnoreCase(userDTO.getEmail()).isPresent()) { + throw new EmailAlreadyUsedException(); + } else { + User newUser = userService.createUser(userDTO); + mailService.sendCreationEmail(newUser); + return ResponseEntity.created(new URI("/api/users/" + newUser.getLogin())) + .headers(HeaderUtil.createAlert( "userManagement.created", newUser.getLogin())) + .body(newUser); + } + } + + /** + * PUT /users : Updates an existing User. + * + * @param userDTO the user to update + * @return the ResponseEntity with status 200 (OK) and with body the updated user + * @throws EmailAlreadyUsedException 400 (Bad Request) if the email is already in use + * @throws LoginAlreadyUsedException 400 (Bad Request) if the login is already in use + */ + @PutMapping("/users") + @Timed + @PreAuthorize("hasRole(\"" + AuthoritiesConstants.ADMIN + "\")") + public ResponseEntity updateUser(@Valid @RequestBody UserDTO userDTO) { + log.debug("REST request to update User : {}", userDTO); + Optional existingUser = userRepository.findOneByEmailIgnoreCase(userDTO.getEmail()); + if (existingUser.isPresent() && (!existingUser.get().getId().equals(userDTO.getId()))) { + throw new EmailAlreadyUsedException(); + } + existingUser = userRepository.findOneByLogin(userDTO.getLogin().toLowerCase()); + if (existingUser.isPresent() && (!existingUser.get().getId().equals(userDTO.getId()))) { + throw new LoginAlreadyUsedException(); + } + Optional updatedUser = userService.updateUser(userDTO); + + return ResponseUtil.wrapOrNotFound(updatedUser, + HeaderUtil.createAlert("userManagement.updated", userDTO.getLogin())); + } + + /** + * GET /users : get all users. + * + * @param pageable the pagination information + * @return the ResponseEntity with status 200 (OK) and with body all users + */ + @GetMapping("/users") + @Timed + public ResponseEntity> getAllUsers(Pageable pageable) { + final Page page = userService.getAllManagedUsers(pageable); + HttpHeaders headers = PaginationUtil.generatePaginationHttpHeaders(page, "/api/users"); + return new ResponseEntity<>(page.getContent(), headers, HttpStatus.OK); + } + + /** + * @return a string list of the all of the roles + */ + @GetMapping("/users/authorities") + @Timed + @PreAuthorize("hasRole(\"" + AuthoritiesConstants.ADMIN + "\")") + public List getAuthorities() { + return userService.getAuthorities(); + } + + /** + * GET /users/:login : get the "login" user. + * + * @param login the login of the user to find + * @return the ResponseEntity with status 200 (OK) and with body the "login" user, or with status 404 (Not Found) + */ + @GetMapping("/users/{login:" + Constants.LOGIN_REGEX + "}") + @Timed + public ResponseEntity getUser(@PathVariable String login) { + log.debug("REST request to get User : {}", login); + return ResponseUtil.wrapOrNotFound( + userService.getUserWithAuthoritiesByLogin(login) + .map(UserDTO::new)); + } + + /** + * DELETE /users/:login : delete the "login" User. + * + * @param login the login of the user to delete + * @return the ResponseEntity with status 200 (OK) + */ + @DeleteMapping("/users/{login:" + Constants.LOGIN_REGEX + "}") + @Timed + @PreAuthorize("hasRole(\"" + AuthoritiesConstants.ADMIN + "\")") + public ResponseEntity deleteUser(@PathVariable String login) { + log.debug("REST request to delete User: {}", login); + userService.deleteUser(login); + return ResponseEntity.ok().headers(HeaderUtil.createAlert( "userManagement.deleted", login)).build(); + } +} diff --git a/jhipster/jhipster-uaa/uaa/src/main/java/com/baeldung/jhipster/uaa/web/rest/errors/BadRequestAlertException.java b/jhipster/jhipster-uaa/uaa/src/main/java/com/baeldung/jhipster/uaa/web/rest/errors/BadRequestAlertException.java new file mode 100644 index 0000000000..f406afe24f --- /dev/null +++ b/jhipster/jhipster-uaa/uaa/src/main/java/com/baeldung/jhipster/uaa/web/rest/errors/BadRequestAlertException.java @@ -0,0 +1,42 @@ +package com.baeldung.jhipster.uaa.web.rest.errors; + +import org.zalando.problem.AbstractThrowableProblem; +import org.zalando.problem.Status; + +import java.net.URI; +import java.util.HashMap; +import java.util.Map; + +public class BadRequestAlertException extends AbstractThrowableProblem { + + private static final long serialVersionUID = 1L; + + private final String entityName; + + private final String errorKey; + + public BadRequestAlertException(String defaultMessage, String entityName, String errorKey) { + this(ErrorConstants.DEFAULT_TYPE, defaultMessage, entityName, errorKey); + } + + public BadRequestAlertException(URI type, String defaultMessage, String entityName, String errorKey) { + super(type, defaultMessage, Status.BAD_REQUEST, null, null, null, getAlertParameters(entityName, errorKey)); + this.entityName = entityName; + this.errorKey = errorKey; + } + + public String getEntityName() { + return entityName; + } + + public String getErrorKey() { + return errorKey; + } + + private static Map getAlertParameters(String entityName, String errorKey) { + Map parameters = new HashMap<>(); + parameters.put("message", "error." + errorKey); + parameters.put("params", entityName); + return parameters; + } +} diff --git a/jhipster/jhipster-uaa/uaa/src/main/java/com/baeldung/jhipster/uaa/web/rest/errors/CustomParameterizedException.java b/jhipster/jhipster-uaa/uaa/src/main/java/com/baeldung/jhipster/uaa/web/rest/errors/CustomParameterizedException.java new file mode 100644 index 0000000000..ab0c08a12a --- /dev/null +++ b/jhipster/jhipster-uaa/uaa/src/main/java/com/baeldung/jhipster/uaa/web/rest/errors/CustomParameterizedException.java @@ -0,0 +1,54 @@ +package com.baeldung.jhipster.uaa.web.rest.errors; + +import org.zalando.problem.AbstractThrowableProblem; + +import java.util.HashMap; +import java.util.Map; + +import static org.zalando.problem.Status.BAD_REQUEST; + +/** + * Custom, parameterized exception, which can be translated on the client side. + * For example: + * + *

+ * throw new CustomParameterizedException("myCustomError", "hello", "world");
+ * 
+ * + * Can be translated with: + * + *
+ * "error.myCustomError" :  "The server says {{param0}} to {{param1}}"
+ * 
+ */ +public class CustomParameterizedException extends AbstractThrowableProblem { + + private static final long serialVersionUID = 1L; + + private static final String PARAM = "param"; + + public CustomParameterizedException(String message, String... params) { + this(message, toParamMap(params)); + } + + public CustomParameterizedException(String message, Map paramMap) { + super(ErrorConstants.PARAMETERIZED_TYPE, "Parameterized Exception", BAD_REQUEST, null, null, null, toProblemParameters(message, paramMap)); + } + + public static Map toParamMap(String... params) { + Map paramMap = new HashMap<>(); + if (params != null && params.length > 0) { + for (int i = 0; i < params.length; i++) { + paramMap.put(PARAM + i, params[i]); + } + } + return paramMap; + } + + public static Map toProblemParameters(String message, Map paramMap) { + Map parameters = new HashMap<>(); + parameters.put("message", message); + parameters.put("params", paramMap); + return parameters; + } +} diff --git a/jhipster/jhipster-uaa/uaa/src/main/java/com/baeldung/jhipster/uaa/web/rest/errors/EmailAlreadyUsedException.java b/jhipster/jhipster-uaa/uaa/src/main/java/com/baeldung/jhipster/uaa/web/rest/errors/EmailAlreadyUsedException.java new file mode 100644 index 0000000000..e1780ab42a --- /dev/null +++ b/jhipster/jhipster-uaa/uaa/src/main/java/com/baeldung/jhipster/uaa/web/rest/errors/EmailAlreadyUsedException.java @@ -0,0 +1,10 @@ +package com.baeldung.jhipster.uaa.web.rest.errors; + +public class EmailAlreadyUsedException extends BadRequestAlertException { + + private static final long serialVersionUID = 1L; + + public EmailAlreadyUsedException() { + super(ErrorConstants.EMAIL_ALREADY_USED_TYPE, "Email is already in use!", "userManagement", "emailexists"); + } +} diff --git a/jhipster/jhipster-uaa/uaa/src/main/java/com/baeldung/jhipster/uaa/web/rest/errors/EmailNotFoundException.java b/jhipster/jhipster-uaa/uaa/src/main/java/com/baeldung/jhipster/uaa/web/rest/errors/EmailNotFoundException.java new file mode 100644 index 0000000000..40487d117f --- /dev/null +++ b/jhipster/jhipster-uaa/uaa/src/main/java/com/baeldung/jhipster/uaa/web/rest/errors/EmailNotFoundException.java @@ -0,0 +1,13 @@ +package com.baeldung.jhipster.uaa.web.rest.errors; + +import org.zalando.problem.AbstractThrowableProblem; +import org.zalando.problem.Status; + +public class EmailNotFoundException extends AbstractThrowableProblem { + + private static final long serialVersionUID = 1L; + + public EmailNotFoundException() { + super(ErrorConstants.EMAIL_NOT_FOUND_TYPE, "Email address not registered", Status.BAD_REQUEST); + } +} diff --git a/jhipster/jhipster-uaa/uaa/src/main/java/com/baeldung/jhipster/uaa/web/rest/errors/ErrorConstants.java b/jhipster/jhipster-uaa/uaa/src/main/java/com/baeldung/jhipster/uaa/web/rest/errors/ErrorConstants.java new file mode 100644 index 0000000000..9cf7cfdde4 --- /dev/null +++ b/jhipster/jhipster-uaa/uaa/src/main/java/com/baeldung/jhipster/uaa/web/rest/errors/ErrorConstants.java @@ -0,0 +1,21 @@ +package com.baeldung.jhipster.uaa.web.rest.errors; + +import java.net.URI; + +public final class ErrorConstants { + + public static final String ERR_CONCURRENCY_FAILURE = "error.concurrencyFailure"; + public static final String ERR_VALIDATION = "error.validation"; + public static final String PROBLEM_BASE_URL = "https://www.jhipster.tech/problem"; + public static final URI DEFAULT_TYPE = URI.create(PROBLEM_BASE_URL + "/problem-with-message"); + public static final URI CONSTRAINT_VIOLATION_TYPE = URI.create(PROBLEM_BASE_URL + "/constraint-violation"); + public static final URI PARAMETERIZED_TYPE = URI.create(PROBLEM_BASE_URL + "/parameterized"); + public static final URI ENTITY_NOT_FOUND_TYPE = URI.create(PROBLEM_BASE_URL + "/entity-not-found"); + public static final URI INVALID_PASSWORD_TYPE = URI.create(PROBLEM_BASE_URL + "/invalid-password"); + public static final URI EMAIL_ALREADY_USED_TYPE = URI.create(PROBLEM_BASE_URL + "/email-already-used"); + public static final URI LOGIN_ALREADY_USED_TYPE = URI.create(PROBLEM_BASE_URL + "/login-already-used"); + public static final URI EMAIL_NOT_FOUND_TYPE = URI.create(PROBLEM_BASE_URL + "/email-not-found"); + + private ErrorConstants() { + } +} diff --git a/jhipster/jhipster-uaa/uaa/src/main/java/com/baeldung/jhipster/uaa/web/rest/errors/ExceptionTranslator.java b/jhipster/jhipster-uaa/uaa/src/main/java/com/baeldung/jhipster/uaa/web/rest/errors/ExceptionTranslator.java new file mode 100644 index 0000000000..320636c51d --- /dev/null +++ b/jhipster/jhipster-uaa/uaa/src/main/java/com/baeldung/jhipster/uaa/web/rest/errors/ExceptionTranslator.java @@ -0,0 +1,107 @@ +package com.baeldung.jhipster.uaa.web.rest.errors; + +import com.baeldung.jhipster.uaa.web.rest.util.HeaderUtil; + +import org.springframework.dao.ConcurrencyFailureException; +import org.springframework.http.ResponseEntity; +import org.springframework.validation.BindingResult; +import org.springframework.web.bind.MethodArgumentNotValidException; +import org.springframework.web.bind.annotation.ControllerAdvice; +import org.springframework.web.bind.annotation.ExceptionHandler; +import org.springframework.web.context.request.NativeWebRequest; +import org.zalando.problem.DefaultProblem; +import org.zalando.problem.Problem; +import org.zalando.problem.ProblemBuilder; +import org.zalando.problem.Status; +import org.zalando.problem.spring.web.advice.ProblemHandling; +import org.zalando.problem.violations.ConstraintViolationProblem; + +import javax.annotation.Nonnull; +import javax.annotation.Nullable; +import javax.servlet.http.HttpServletRequest; +import java.util.List; +import java.util.NoSuchElementException; +import java.util.stream.Collectors; + +/** + * Controller advice to translate the server side exceptions to client-friendly json structures. + * The error response follows RFC7807 - Problem Details for HTTP APIs (https://tools.ietf.org/html/rfc7807) + */ +@ControllerAdvice +public class ExceptionTranslator implements ProblemHandling { + + /** + * Post-process the Problem payload to add the message key for the front-end if needed + */ + @Override + public ResponseEntity process(@Nullable ResponseEntity entity, NativeWebRequest request) { + if (entity == null) { + return entity; + } + Problem problem = entity.getBody(); + if (!(problem instanceof ConstraintViolationProblem || problem instanceof DefaultProblem)) { + return entity; + } + ProblemBuilder builder = Problem.builder() + .withType(Problem.DEFAULT_TYPE.equals(problem.getType()) ? ErrorConstants.DEFAULT_TYPE : problem.getType()) + .withStatus(problem.getStatus()) + .withTitle(problem.getTitle()) + .with("path", request.getNativeRequest(HttpServletRequest.class).getRequestURI()); + + if (problem instanceof ConstraintViolationProblem) { + builder + .with("violations", ((ConstraintViolationProblem) problem).getViolations()) + .with("message", ErrorConstants.ERR_VALIDATION); + } else { + builder + .withCause(((DefaultProblem) problem).getCause()) + .withDetail(problem.getDetail()) + .withInstance(problem.getInstance()); + problem.getParameters().forEach(builder::with); + if (!problem.getParameters().containsKey("message") && problem.getStatus() != null) { + builder.with("message", "error.http." + problem.getStatus().getStatusCode()); + } + } + return new ResponseEntity<>(builder.build(), entity.getHeaders(), entity.getStatusCode()); + } + + @Override + public ResponseEntity handleMethodArgumentNotValid(MethodArgumentNotValidException ex, @Nonnull NativeWebRequest request) { + BindingResult result = ex.getBindingResult(); + List fieldErrors = result.getFieldErrors().stream() + .map(f -> new FieldErrorVM(f.getObjectName(), f.getField(), f.getCode())) + .collect(Collectors.toList()); + + Problem problem = Problem.builder() + .withType(ErrorConstants.CONSTRAINT_VIOLATION_TYPE) + .withTitle("Method argument not valid") + .withStatus(defaultConstraintViolationStatus()) + .with("message", ErrorConstants.ERR_VALIDATION) + .with("fieldErrors", fieldErrors) + .build(); + return create(ex, problem, request); + } + + @ExceptionHandler + public ResponseEntity handleNoSuchElementException(NoSuchElementException ex, NativeWebRequest request) { + Problem problem = Problem.builder() + .withStatus(Status.NOT_FOUND) + .with("message", ErrorConstants.ENTITY_NOT_FOUND_TYPE) + .build(); + return create(ex, problem, request); + } + + @ExceptionHandler + public ResponseEntity handleBadRequestAlertException(BadRequestAlertException ex, NativeWebRequest request) { + return create(ex, request, HeaderUtil.createFailureAlert(ex.getEntityName(), ex.getErrorKey(), ex.getMessage())); + } + + @ExceptionHandler + public ResponseEntity handleConcurrencyFailure(ConcurrencyFailureException ex, NativeWebRequest request) { + Problem problem = Problem.builder() + .withStatus(Status.CONFLICT) + .with("message", ErrorConstants.ERR_CONCURRENCY_FAILURE) + .build(); + return create(ex, problem, request); + } +} diff --git a/jhipster/jhipster-uaa/uaa/src/main/java/com/baeldung/jhipster/uaa/web/rest/errors/FieldErrorVM.java b/jhipster/jhipster-uaa/uaa/src/main/java/com/baeldung/jhipster/uaa/web/rest/errors/FieldErrorVM.java new file mode 100644 index 0000000000..9f7c857374 --- /dev/null +++ b/jhipster/jhipster-uaa/uaa/src/main/java/com/baeldung/jhipster/uaa/web/rest/errors/FieldErrorVM.java @@ -0,0 +1,33 @@ +package com.baeldung.jhipster.uaa.web.rest.errors; + +import java.io.Serializable; + +public class FieldErrorVM implements Serializable { + + private static final long serialVersionUID = 1L; + + private final String objectName; + + private final String field; + + private final String message; + + public FieldErrorVM(String dto, String field, String message) { + this.objectName = dto; + this.field = field; + this.message = message; + } + + public String getObjectName() { + return objectName; + } + + public String getField() { + return field; + } + + public String getMessage() { + return message; + } + +} diff --git a/jhipster/jhipster-uaa/uaa/src/main/java/com/baeldung/jhipster/uaa/web/rest/errors/InternalServerErrorException.java b/jhipster/jhipster-uaa/uaa/src/main/java/com/baeldung/jhipster/uaa/web/rest/errors/InternalServerErrorException.java new file mode 100644 index 0000000000..43b50b86d5 --- /dev/null +++ b/jhipster/jhipster-uaa/uaa/src/main/java/com/baeldung/jhipster/uaa/web/rest/errors/InternalServerErrorException.java @@ -0,0 +1,16 @@ +package com.baeldung.jhipster.uaa.web.rest.errors; + +import org.zalando.problem.AbstractThrowableProblem; +import org.zalando.problem.Status; + +/** + * Simple exception with a message, that returns an Internal Server Error code. + */ +public class InternalServerErrorException extends AbstractThrowableProblem { + + private static final long serialVersionUID = 1L; + + public InternalServerErrorException(String message) { + super(ErrorConstants.DEFAULT_TYPE, message, Status.INTERNAL_SERVER_ERROR); + } +} diff --git a/jhipster/jhipster-uaa/uaa/src/main/java/com/baeldung/jhipster/uaa/web/rest/errors/InvalidPasswordException.java b/jhipster/jhipster-uaa/uaa/src/main/java/com/baeldung/jhipster/uaa/web/rest/errors/InvalidPasswordException.java new file mode 100644 index 0000000000..f4662f5a94 --- /dev/null +++ b/jhipster/jhipster-uaa/uaa/src/main/java/com/baeldung/jhipster/uaa/web/rest/errors/InvalidPasswordException.java @@ -0,0 +1,13 @@ +package com.baeldung.jhipster.uaa.web.rest.errors; + +import org.zalando.problem.AbstractThrowableProblem; +import org.zalando.problem.Status; + +public class InvalidPasswordException extends AbstractThrowableProblem { + + private static final long serialVersionUID = 1L; + + public InvalidPasswordException() { + super(ErrorConstants.INVALID_PASSWORD_TYPE, "Incorrect password", Status.BAD_REQUEST); + } +} diff --git a/jhipster/jhipster-uaa/uaa/src/main/java/com/baeldung/jhipster/uaa/web/rest/errors/LoginAlreadyUsedException.java b/jhipster/jhipster-uaa/uaa/src/main/java/com/baeldung/jhipster/uaa/web/rest/errors/LoginAlreadyUsedException.java new file mode 100644 index 0000000000..35bc827501 --- /dev/null +++ b/jhipster/jhipster-uaa/uaa/src/main/java/com/baeldung/jhipster/uaa/web/rest/errors/LoginAlreadyUsedException.java @@ -0,0 +1,10 @@ +package com.baeldung.jhipster.uaa.web.rest.errors; + +public class LoginAlreadyUsedException extends BadRequestAlertException { + + private static final long serialVersionUID = 1L; + + public LoginAlreadyUsedException() { + super(ErrorConstants.LOGIN_ALREADY_USED_TYPE, "Login name already used!", "userManagement", "userexists"); + } +} diff --git a/jhipster/jhipster-uaa/uaa/src/main/java/com/baeldung/jhipster/uaa/web/rest/errors/package-info.java b/jhipster/jhipster-uaa/uaa/src/main/java/com/baeldung/jhipster/uaa/web/rest/errors/package-info.java new file mode 100644 index 0000000000..8fe243f8c0 --- /dev/null +++ b/jhipster/jhipster-uaa/uaa/src/main/java/com/baeldung/jhipster/uaa/web/rest/errors/package-info.java @@ -0,0 +1,6 @@ +/** + * Specific errors used with Zalando's "problem-spring-web" library. + * + * More information on https://github.com/zalando/problem-spring-web + */ +package com.baeldung.jhipster.uaa.web.rest.errors; diff --git a/jhipster/jhipster-uaa/uaa/src/main/java/com/baeldung/jhipster/uaa/web/rest/package-info.java b/jhipster/jhipster-uaa/uaa/src/main/java/com/baeldung/jhipster/uaa/web/rest/package-info.java new file mode 100644 index 0000000000..28eb2dda3e --- /dev/null +++ b/jhipster/jhipster-uaa/uaa/src/main/java/com/baeldung/jhipster/uaa/web/rest/package-info.java @@ -0,0 +1,4 @@ +/** + * Spring MVC REST controllers. + */ +package com.baeldung.jhipster.uaa.web.rest; diff --git a/jhipster/jhipster-uaa/uaa/src/main/java/com/baeldung/jhipster/uaa/web/rest/util/HeaderUtil.java b/jhipster/jhipster-uaa/uaa/src/main/java/com/baeldung/jhipster/uaa/web/rest/util/HeaderUtil.java new file mode 100644 index 0000000000..1ce4ab7664 --- /dev/null +++ b/jhipster/jhipster-uaa/uaa/src/main/java/com/baeldung/jhipster/uaa/web/rest/util/HeaderUtil.java @@ -0,0 +1,45 @@ +package com.baeldung.jhipster.uaa.web.rest.util; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.http.HttpHeaders; + +/** + * Utility class for HTTP headers creation. + */ +public final class HeaderUtil { + + private static final Logger log = LoggerFactory.getLogger(HeaderUtil.class); + + private static final String APPLICATION_NAME = "uaaApp"; + + private HeaderUtil() { + } + + public static HttpHeaders createAlert(String message, String param) { + HttpHeaders headers = new HttpHeaders(); + headers.add("X-" + APPLICATION_NAME + "-alert", message); + headers.add("X-" + APPLICATION_NAME + "-params", param); + return headers; + } + + public static HttpHeaders createEntityCreationAlert(String entityName, String param) { + return createAlert(APPLICATION_NAME + "." + entityName + ".created", param); + } + + public static HttpHeaders createEntityUpdateAlert(String entityName, String param) { + return createAlert(APPLICATION_NAME + "." + entityName + ".updated", param); + } + + public static HttpHeaders createEntityDeletionAlert(String entityName, String param) { + return createAlert(APPLICATION_NAME + "." + entityName + ".deleted", param); + } + + public static HttpHeaders createFailureAlert(String entityName, String errorKey, String defaultMessage) { + log.error("Entity processing failed, {}", defaultMessage); + HttpHeaders headers = new HttpHeaders(); + headers.add("X-" + APPLICATION_NAME + "-error", "error." + errorKey); + headers.add("X-" + APPLICATION_NAME + "-params", entityName); + return headers; + } +} diff --git a/jhipster/jhipster-uaa/uaa/src/main/java/com/baeldung/jhipster/uaa/web/rest/util/PaginationUtil.java b/jhipster/jhipster-uaa/uaa/src/main/java/com/baeldung/jhipster/uaa/web/rest/util/PaginationUtil.java new file mode 100644 index 0000000000..d8596539ed --- /dev/null +++ b/jhipster/jhipster-uaa/uaa/src/main/java/com/baeldung/jhipster/uaa/web/rest/util/PaginationUtil.java @@ -0,0 +1,45 @@ +package com.baeldung.jhipster.uaa.web.rest.util; + +import org.springframework.data.domain.Page; +import org.springframework.http.HttpHeaders; +import org.springframework.web.util.UriComponentsBuilder; + +/** + * Utility class for handling pagination. + * + *

+ * Pagination uses the same principles as the GitHub API, + * and follow RFC 5988 (Link header). + */ +public final class PaginationUtil { + + private PaginationUtil() { + } + + public static HttpHeaders generatePaginationHttpHeaders(Page page, String baseUrl) { + + HttpHeaders headers = new HttpHeaders(); + headers.add("X-Total-Count", Long.toString(page.getTotalElements())); + String link = ""; + if ((page.getNumber() + 1) < page.getTotalPages()) { + link = "<" + generateUri(baseUrl, page.getNumber() + 1, page.getSize()) + ">; rel=\"next\","; + } + // prev link + if ((page.getNumber()) > 0) { + link += "<" + generateUri(baseUrl, page.getNumber() - 1, page.getSize()) + ">; rel=\"prev\","; + } + // last and first link + int lastPage = 0; + if (page.getTotalPages() > 0) { + lastPage = page.getTotalPages() - 1; + } + link += "<" + generateUri(baseUrl, lastPage, page.getSize()) + ">; rel=\"last\","; + link += "<" + generateUri(baseUrl, 0, page.getSize()) + ">; rel=\"first\""; + headers.add(HttpHeaders.LINK, link); + return headers; + } + + private static String generateUri(String baseUrl, int page, int size) { + return UriComponentsBuilder.fromUriString(baseUrl).queryParam("page", page).queryParam("size", size).toUriString(); + } +} diff --git a/jhipster/jhipster-uaa/uaa/src/main/java/com/baeldung/jhipster/uaa/web/rest/vm/KeyAndPasswordVM.java b/jhipster/jhipster-uaa/uaa/src/main/java/com/baeldung/jhipster/uaa/web/rest/vm/KeyAndPasswordVM.java new file mode 100644 index 0000000000..8e9c3843bb --- /dev/null +++ b/jhipster/jhipster-uaa/uaa/src/main/java/com/baeldung/jhipster/uaa/web/rest/vm/KeyAndPasswordVM.java @@ -0,0 +1,27 @@ +package com.baeldung.jhipster.uaa.web.rest.vm; + +/** + * View Model object for storing the user's key and password. + */ +public class KeyAndPasswordVM { + + private String key; + + private String newPassword; + + public String getKey() { + return key; + } + + public void setKey(String key) { + this.key = key; + } + + public String getNewPassword() { + return newPassword; + } + + public void setNewPassword(String newPassword) { + this.newPassword = newPassword; + } +} diff --git a/jhipster/jhipster-uaa/uaa/src/main/java/com/baeldung/jhipster/uaa/web/rest/vm/LoggerVM.java b/jhipster/jhipster-uaa/uaa/src/main/java/com/baeldung/jhipster/uaa/web/rest/vm/LoggerVM.java new file mode 100644 index 0000000000..45357b14c2 --- /dev/null +++ b/jhipster/jhipster-uaa/uaa/src/main/java/com/baeldung/jhipster/uaa/web/rest/vm/LoggerVM.java @@ -0,0 +1,46 @@ +package com.baeldung.jhipster.uaa.web.rest.vm; + +import ch.qos.logback.classic.Logger; + +/** + * View Model object for storing a Logback logger. + */ +public class LoggerVM { + + private String name; + + private String level; + + public LoggerVM(Logger logger) { + this.name = logger.getName(); + this.level = logger.getEffectiveLevel().toString(); + } + + public LoggerVM() { + // Empty public constructor used by Jackson. + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getLevel() { + return level; + } + + public void setLevel(String level) { + this.level = level; + } + + @Override + public String toString() { + return "LoggerVM{" + + "name='" + name + '\'' + + ", level='" + level + '\'' + + '}'; + } +} diff --git a/jhipster/jhipster-uaa/uaa/src/main/java/com/baeldung/jhipster/uaa/web/rest/vm/ManagedUserVM.java b/jhipster/jhipster-uaa/uaa/src/main/java/com/baeldung/jhipster/uaa/web/rest/vm/ManagedUserVM.java new file mode 100644 index 0000000000..ad6b11eb5f --- /dev/null +++ b/jhipster/jhipster-uaa/uaa/src/main/java/com/baeldung/jhipster/uaa/web/rest/vm/ManagedUserVM.java @@ -0,0 +1,35 @@ +package com.baeldung.jhipster.uaa.web.rest.vm; + +import com.baeldung.jhipster.uaa.service.dto.UserDTO; +import javax.validation.constraints.Size; + +/** + * View Model extending the UserDTO, which is meant to be used in the user management UI. + */ +public class ManagedUserVM extends UserDTO { + + public static final int PASSWORD_MIN_LENGTH = 4; + + public static final int PASSWORD_MAX_LENGTH = 100; + + @Size(min = PASSWORD_MIN_LENGTH, max = PASSWORD_MAX_LENGTH) + private String password; + + public ManagedUserVM() { + // Empty constructor needed for Jackson. + } + + public String getPassword() { + return password; + } + + public void setPassword(String password) { + this.password = password; + } + + @Override + public String toString() { + return "ManagedUserVM{" + + "} " + super.toString(); + } +} diff --git a/jhipster/jhipster-uaa/uaa/src/main/java/com/baeldung/jhipster/uaa/web/rest/vm/package-info.java b/jhipster/jhipster-uaa/uaa/src/main/java/com/baeldung/jhipster/uaa/web/rest/vm/package-info.java new file mode 100644 index 0000000000..0574701dbc --- /dev/null +++ b/jhipster/jhipster-uaa/uaa/src/main/java/com/baeldung/jhipster/uaa/web/rest/vm/package-info.java @@ -0,0 +1,4 @@ +/** + * View Models used by Spring MVC REST controllers. + */ +package com.baeldung.jhipster.uaa.web.rest.vm; diff --git a/jhipster/jhipster-uaa/uaa/src/main/jib/entrypoint.sh b/jhipster/jhipster-uaa/uaa/src/main/jib/entrypoint.sh new file mode 100644 index 0000000000..44808a8fde --- /dev/null +++ b/jhipster/jhipster-uaa/uaa/src/main/jib/entrypoint.sh @@ -0,0 +1,4 @@ +#!/bin/sh + +echo "The application will start in ${JHIPSTER_SLEEP}s..." && sleep ${JHIPSTER_SLEEP} +exec java ${JAVA_OPTS} -Djava.security.egd=file:/dev/./urandom -cp /app/resources/:/app/classes/:/app/libs/* "com.baeldung.jhipster.uaa.UaaApp" "$@" diff --git a/jhipster/jhipster-uaa/uaa/src/main/resources/.h2.server.properties b/jhipster/jhipster-uaa/uaa/src/main/resources/.h2.server.properties new file mode 100644 index 0000000000..e36bc911c7 --- /dev/null +++ b/jhipster/jhipster-uaa/uaa/src/main/resources/.h2.server.properties @@ -0,0 +1,5 @@ +#H2 Server Properties +0=JHipster H2 (Disk)|org.h2.Driver|jdbc\:h2\:file\:./target/h2db/db/uaa|uaa +webAllowOthers=true +webPort=8082 +webSSL=false diff --git a/jhipster/jhipster-uaa/uaa/src/main/resources/banner.txt b/jhipster/jhipster-uaa/uaa/src/main/resources/banner.txt new file mode 100644 index 0000000000..e0bc55aaff --- /dev/null +++ b/jhipster/jhipster-uaa/uaa/src/main/resources/banner.txt @@ -0,0 +1,10 @@ + + ${AnsiColor.GREEN} ██╗${AnsiColor.RED} ██╗ ██╗ ████████╗ ███████╗ ██████╗ ████████╗ ████████╗ ███████╗ + ${AnsiColor.GREEN} ██║${AnsiColor.RED} ██║ ██║ ╚══██╔══╝ ██╔═══██╗ ██╔════╝ ╚══██╔══╝ ██╔═════╝ ██╔═══██╗ + ${AnsiColor.GREEN} ██║${AnsiColor.RED} ████████║ ██║ ███████╔╝ ╚█████╗ ██║ ██████╗ ███████╔╝ + ${AnsiColor.GREEN}██╗ ██║${AnsiColor.RED} ██╔═══██║ ██║ ██╔════╝ ╚═══██╗ ██║ ██╔═══╝ ██╔══██║ + ${AnsiColor.GREEN}╚██████╔╝${AnsiColor.RED} ██║ ██║ ████████╗ ██║ ██████╔╝ ██║ ████████╗ ██║ ╚██╗ + ${AnsiColor.GREEN} ╚═════╝ ${AnsiColor.RED} ╚═╝ ╚═╝ ╚═══════╝ ╚═╝ ╚═════╝ ╚═╝ ╚═══════╝ ╚═╝ ╚═╝ + +${AnsiColor.BRIGHT_BLUE}:: JHipster 🤓 :: Running Spring Boot ${spring-boot.version} :: +:: https://www.jhipster.tech ::${AnsiColor.DEFAULT} diff --git a/jhipster/jhipster-uaa/uaa/src/main/resources/config/application-dev.yml b/jhipster/jhipster-uaa/uaa/src/main/resources/config/application-dev.yml new file mode 100644 index 0000000000..874b2cd533 --- /dev/null +++ b/jhipster/jhipster-uaa/uaa/src/main/resources/config/application-dev.yml @@ -0,0 +1,157 @@ +# =================================================================== +# Spring Boot configuration for the "dev" profile. +# +# This configuration overrides the application.yml file. +# +# More information on profiles: https://www.jhipster.tech/profiles/ +# More information on configuration properties: https://www.jhipster.tech/common-application-properties/ +# =================================================================== + +# =================================================================== +# Standard Spring Boot properties. +# Full reference is available at: +# http://docs.spring.io/spring-boot/docs/current/reference/html/common-application-properties.html +# =================================================================== + +logging: + level: + ROOT: DEBUG + io.github.jhipster: DEBUG + com.baeldung.jhipster.uaa: DEBUG + +eureka: + instance: + prefer-ip-address: true + client: + service-url: + defaultZone: http://admin:${jhipster.registry.password}@localhost:8761/eureka/ + +spring: + profiles: + active: dev + include: + - swagger + # Uncomment to activate TLS for the dev profile + #- tls + devtools: + restart: + enabled: true + livereload: + enabled: false # we use Webpack dev server + BrowserSync for livereload + jackson: + serialization.indent_output: true + datasource: + type: com.zaxxer.hikari.HikariDataSource + url: jdbc:h2:file:./target/h2db/db/uaa;DB_CLOSE_DELAY=-1 + username: uaa + password: + hikari: + auto-commit: false + h2: + console: + enabled: false + jpa: + database-platform: io.github.jhipster.domain.util.FixedH2Dialect + database: H2 + show-sql: true + properties: + hibernate.id.new_generator_mappings: true + hibernate.connection.provider_disables_autocommit: true + hibernate.cache.use_second_level_cache: true + hibernate.cache.use_query_cache: false + hibernate.generate_statistics: true + hibernate.cache.region.factory_class: com.hazelcast.hibernate.HazelcastCacheRegionFactory + hibernate.cache.hazelcast.instance_name: uaa + hibernate.cache.use_minimal_puts: true + hibernate.cache.hazelcast.use_lite_member: true + liquibase: + contexts: dev + mail: + host: localhost + port: 25 + username: + password: + messages: + cache-duration: PT1S # 1 second, see the ISO 8601 standard + thymeleaf: + cache: false + sleuth: + sampler: + percentage: 1 # report 100% of traces + zipkin: # Use the "zipkin" Maven profile to have the Spring Cloud Zipkin dependencies + base-url: http://localhost:9411 + enabled: false + locator: + discovery: + enabled: true + +server: + port: 9999 + +# =================================================================== +# JHipster specific properties +# +# Full reference is available at: https://www.jhipster.tech/common-application-properties/ +# =================================================================== + +jhipster: + http: + version: V_1_1 # To use HTTP/2 you will need to activate TLS (see application-tls.yml) + cache: # Cache configuration + hazelcast: # Hazelcast distributed cache + time-to-live-seconds: 3600 + backup-count: 1 + management-center: # Full reference is available at: http://docs.hazelcast.org/docs/management-center/3.9/manual/html/Deploying_and_Starting.html + enabled: false + update-interval: 3 + url: http://localhost:8180/mancenter + # CORS is only enabled by default with the "dev" profile, so BrowserSync can access the API + cors: + allowed-origins: "*" + allowed-methods: "*" + allowed-headers: "*" + exposed-headers: "Authorization,Link,X-Total-Count" + allow-credentials: true + max-age: 1800 + security: + client-authorization: + client-id: internal + client-secret: internal + mail: # specific JHipster mail property, for standard properties see MailProperties + from: uaa@localhost + base-url: http://127.0.0.1:8080 + metrics: # DropWizard Metrics configuration, used by MetricsConfiguration + jmx: + enabled: true + logs: # Reports Dropwizard metrics in the logs + enabled: false + report-frequency: 60 # in seconds + logging: + logstash: # Forward logs to logstash over a socket, used by LoggingConfiguration + enabled: false + host: localhost + port: 5000 + queue-size: 512 +uaa: + key-store: + name: config/tls/keystore.p12 + password: password + alias: selfsigned + web-client-configuration: + # Access Token is valid for 5 mins + access-token-validity-in-seconds: 3000 + # Refresh Token is valid for 7 days + refresh-token-validity-in-seconds-for-remember-me: 604800 + client-id: web_app + secret: changeit + +# =================================================================== +# Application specific properties +# Add your own application properties here, see the ApplicationProperties class +# to have type-safe configuration, like in the JHipsterProperties above +# +# More documentation is available at: +# https://www.jhipster.tech/common-application-properties/ +# =================================================================== + +# application: diff --git a/jhipster/jhipster-uaa/uaa/src/main/resources/config/application-prod.yml b/jhipster/jhipster-uaa/uaa/src/main/resources/config/application-prod.yml new file mode 100644 index 0000000000..0d4c3c55a7 --- /dev/null +++ b/jhipster/jhipster-uaa/uaa/src/main/resources/config/application-prod.yml @@ -0,0 +1,175 @@ +# =================================================================== +# Spring Boot configuration for the "prod" profile. +# +# This configuration overrides the application.yml file. +# +# More information on profiles: https://www.jhipster.tech/profiles/ +# More information on configuration properties: https://www.jhipster.tech/common-application-properties/ +# =================================================================== + +# =================================================================== +# Standard Spring Boot properties. +# Full reference is available at: +# http://docs.spring.io/spring-boot/docs/current/reference/html/common-application-properties.html +# =================================================================== + +logging: + level: + ROOT: INFO + com.baeldung.jhipster.uaa: INFO + io.github.jhipster: INFO + +eureka: + instance: + prefer-ip-address: true + client: + service-url: + defaultZone: http://admin:${jhipster.registry.password}@localhost:8761/eureka/ + +spring: + devtools: + restart: + enabled: false + livereload: + enabled: false + datasource: + type: com.zaxxer.hikari.HikariDataSource + url: jdbc:mysql://localhost:3306/uaa?useUnicode=true&characterEncoding=utf8&useSSL=false + username: root + password: + hikari: + auto-commit: false + data-source-properties: + cachePrepStmts: true + prepStmtCacheSize: 250 + prepStmtCacheSqlLimit: 2048 + useServerPrepStmts: true + jpa: + database-platform: org.hibernate.dialect.MySQL5InnoDBDialect + database: MYSQL + show-sql: false + properties: + hibernate.id.new_generator_mappings: true + hibernate.connection.provider_disables_autocommit: true + hibernate.cache.use_second_level_cache: true + hibernate.cache.use_query_cache: false + hibernate.generate_statistics: false + hibernate.cache.region.factory_class: com.hazelcast.hibernate.HazelcastCacheRegionFactory + hibernate.cache.hazelcast.instance_name: uaa + hibernate.cache.use_minimal_puts: true + hibernate.cache.hazelcast.use_lite_member: true + liquibase: + contexts: prod + mail: + host: localhost + port: 25 + username: + password: + thymeleaf: + cache: true + sleuth: + sampler: + percentage: 1 # report 100% of traces + zipkin: # Use the "zipkin" Maven profile to have the Spring Cloud Zipkin dependencies + base-url: http://localhost:9411 + enabled: false + locator: + discovery: + enabled: true + +# =================================================================== +# To enable TLS in production, generate a certificate using: +# keytool -genkey -alias uaa -storetype PKCS12 -keyalg RSA -keysize 2048 -keystore keystore.p12 -validity 3650 +# +# You can also use Let's Encrypt: +# https://maximilian-boehm.com/hp2121/Create-a-Java-Keystore-JKS-from-Let-s-Encrypt-Certificates.htm +# +# Then, modify the server.ssl properties so your "server" configuration looks like: +# +# server: +# port: 443 +# ssl: +# key-store: classpath:config/tls/keystore.p12 +# key-store-password: password +# key-store-type: PKCS12 +# key-alias: uaa +# # The ciphers suite enforce the security by deactivating some old and deprecated SSL cipher, this list was tested against SSL Labs (https://www.ssllabs.com/ssltest/) +# ciphers: TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA,TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA,TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 ,TLS_DHE_RSA_WITH_AES_128_GCM_SHA256 ,TLS_DHE_RSA_WITH_AES_256_GCM_SHA384 ,TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256,TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384,TLS_DHE_RSA_WITH_AES_128_CBC_SHA256,TLS_DHE_RSA_WITH_AES_128_CBC_SHA,TLS_DHE_RSA_WITH_AES_256_CBC_SHA256,TLS_DHE_RSA_WITH_AES_256_CBC_SHA,TLS_RSA_WITH_AES_128_GCM_SHA256,TLS_RSA_WITH_AES_256_GCM_SHA384,TLS_RSA_WITH_AES_128_CBC_SHA256,TLS_RSA_WITH_AES_256_CBC_SHA256,TLS_RSA_WITH_AES_128_CBC_SHA,TLS_RSA_WITH_AES_256_CBC_SHA,TLS_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA,TLS_RSA_WITH_CAMELLIA_256_CBC_SHA,TLS_DHE_RSA_WITH_CAMELLIA_128_CBC_SHA,TLS_RSA_WITH_CAMELLIA_128_CBC_SHA +# =================================================================== +server: + port: 9999 + compression: + enabled: true + mime-types: text/html,text/xml,text/plain,text/css, application/javascript, application/json + min-response-size: 1024 + +# =================================================================== +# JHipster specific properties +# +# Full reference is available at: https://www.jhipster.tech/common-application-properties/ +# =================================================================== + +jhipster: + http: + version: V_1_1 # To use HTTP/2 you will need SSL support (see above the "server.ssl" configuration) + cache: # Used by the CachingHttpHeadersFilter + timeToLiveInDays: 1461 + cache: # Cache configuration + hazelcast: # Hazelcast distributed cache + time-to-live-seconds: 3600 + backup-count: 1 + management-center: # Full reference is available at: http://docs.hazelcast.org/docs/management-center/3.9/manual/html/Deploying_and_Starting.html + enabled: false + update-interval: 3 + url: + security: + client-authorization: + client-id: internal + client-secret: internal + authentication: + jwt: + # Access Token is valid for 5 mins + token-validity-in-seconds: 300 + # Refresh Token is valid for 7 days + token-validity-in-seconds-for-remember-me: 252000 + mail: # specific JHipster mail property, for standard properties see MailProperties + from: uaa@localhost + base-url: http://my-server-url-to-change # Modify according to your server's URL + metrics: # DropWizard Metrics configuration, used by MetricsConfiguration + jmx: + enabled: true + logs: # Reports Dropwizard metrics in the logs + enabled: false + report-frequency: 60 # in seconds + logging: + logstash: # Forward logs to logstash over a socket, used by LoggingConfiguration + enabled: false + host: localhost + port: 5000 + queue-size: 512 +uaa: + #be sure to to change to a different keystore in production! + #create one using: keytool -genkey -alias uaa -storetype PKCS12 -keyalg RSA -keysize 2048 -keystore keystore.p12 -validity 3650 + key-store: + name: config/tls/keystore.p12 + password: password + alias: selfsigned + web-client-configuration: + # Access Token is valid for 5 mins + access-token-validity-in-seconds: 300 + # Refresh Token is valid for 7 days + refresh-token-validity-in-seconds-for-remember-me: 604800 + #change client secret in production, keep in sync with gateway configuration + client-id: web_app + secret: changeit + +# =================================================================== +# Application specific properties +# Add your own application properties here, see the ApplicationProperties class +# to have type-safe configuration, like in the JHipsterProperties above +# +# More documentation is available at: +# https://www.jhipster.tech/common-application-properties/ +# =================================================================== + +# application: diff --git a/jhipster/jhipster-uaa/uaa/src/main/resources/config/application-tls.yml b/jhipster/jhipster-uaa/uaa/src/main/resources/config/application-tls.yml new file mode 100644 index 0000000000..e082c8f455 --- /dev/null +++ b/jhipster/jhipster-uaa/uaa/src/main/resources/config/application-tls.yml @@ -0,0 +1,18 @@ +# =================================================================== +# Activate this profile to enable TLS and HTTP/2. +# +# JHipster has generated a self-signed certificate, which will be used to encrypt traffic. +# As your browser will not understand this certificate, you will need to import it. +# +# Another (easiest) solution with Chrome is to enable the "allow-insecure-localhost" flag +# at chrome://flags/#allow-insecure-localhost +# =================================================================== +server: + ssl: + key-store: classpath:config/tls/keystore.p12 + key-store-password: password + key-store-type: PKCS12 + key-alias: selfsigned +jhipster: + http: + version: V_2_0 diff --git a/jhipster/jhipster-uaa/uaa/src/main/resources/config/application.yml b/jhipster/jhipster-uaa/uaa/src/main/resources/config/application.yml new file mode 100644 index 0000000000..0dfe1a15ce --- /dev/null +++ b/jhipster/jhipster-uaa/uaa/src/main/resources/config/application.yml @@ -0,0 +1,139 @@ +# =================================================================== +# Spring Boot configuration. +# +# This configuration will be overridden by the Spring profile you use, +# for example application-dev.yml if you use the "dev" profile. +# +# More information on profiles: https://www.jhipster.tech/profiles/ +# More information on configuration properties: https://www.jhipster.tech/common-application-properties/ +# =================================================================== + +# =================================================================== +# Standard Spring Boot properties. +# Full reference is available at: +# http://docs.spring.io/spring-boot/docs/current/reference/html/common-application-properties.html +# =================================================================== + +eureka: + client: + enabled: true + healthcheck: + enabled: true + fetch-registry: true + register-with-eureka: true + instance-info-replication-interval-seconds: 10 + registry-fetch-interval-seconds: 10 + instance: + appname: uaa + instanceId: uaa:${spring.application.instance-id:${random.value}} + lease-renewal-interval-in-seconds: 5 + lease-expiration-duration-in-seconds: 10 + status-page-url-path: ${management.endpoints.web.base-path}/info + health-check-url-path: ${management.endpoints.web.base-path}/health + metadata-map: + zone: primary # This is needed for the load balancer + profile: ${spring.profiles.active} + version: ${info.project.version:} + git-version: ${git.commit.id.describe:} + git-commit: ${git.commit.id.abbrev:} + git-branch: ${git.branch:} +ribbon: + eureka: + enabled: true +management: + endpoints: + web: + base-path: /management + exposure: + include: ["configprops", "env", "health", "info", "threaddump", "logfile" ] + endpoint: + health: + show-details: when_authorized + info: + git: + mode: full + health: + mail: + enabled: false # When using the MailService, configure an SMTP server and set this to true + metrics: + enabled: false # http://micrometer.io/ is disabled by default, as we use http://metrics.dropwizard.io/ instead + +spring: + application: + name: uaa + jpa: + open-in-view: false + hibernate: + ddl-auto: none + naming: + physical-strategy: org.springframework.boot.orm.jpa.hibernate.SpringPhysicalNamingStrategy + implicit-strategy: org.springframework.boot.orm.jpa.hibernate.SpringImplicitNamingStrategy + messages: + basename: i18n/messages + mvc: + favicon: + enabled: false + thymeleaf: + mode: HTML +security: + oauth2: + resource: + filter-order: 3 + +server: + servlet: + session: + cookie: + http-only: true + +# Properties to be exposed on the /info management endpoint +info: + # Comma separated list of profiles that will trigger the ribbon to show + display-ribbon-on-profiles: "dev" + +# =================================================================== +# JHipster specific properties +# +# Full reference is available at: https://www.jhipster.tech/common-application-properties/ +# =================================================================== + +jhipster: + async: + core-pool-size: 2 + max-pool-size: 50 + queue-capacity: 10000 + # By default CORS is disabled. Uncomment to enable. + #cors: + #allowed-origins: "*" + #allowed-methods: "*" + #allowed-headers: "*" + #exposed-headers: "Authorization,Link,X-Total-Count" + #allow-credentials: true + #max-age: 1800 + mail: + from: uaa@localhost + swagger: + default-include-pattern: /api/.* + title: uaa API + description: uaa API documentation + version: 0.0.1 + terms-of-service-url: + contact-name: + contact-url: + contact-email: + license: + license-url: + +logging: + file: target/uaa.log + +# =================================================================== +# Application specific properties +# Add your own application properties here, see the ApplicationProperties class +# to have type-safe configuration, like in the JHipsterProperties above +# +# More documentation is available at: +# https://www.jhipster.tech/common-application-properties/ +# =================================================================== + +# application: diff --git a/jhipster/jhipster-uaa/uaa/src/main/resources/config/bootstrap-prod.yml b/jhipster/jhipster-uaa/uaa/src/main/resources/config/bootstrap-prod.yml new file mode 100644 index 0000000000..078fafda5c --- /dev/null +++ b/jhipster/jhipster-uaa/uaa/src/main/resources/config/bootstrap-prod.yml @@ -0,0 +1,22 @@ +# =================================================================== +# Spring Cloud Config bootstrap configuration for the "prod" profile +# =================================================================== + +spring: + cloud: + config: + fail-fast: true + retry: + initial-interval: 1000 + max-interval: 2000 + max-attempts: 100 + uri: http://admin:${jhipster.registry.password}@localhost:8761/config + # name of the config server's property source (file.yml) that we want to use + name: uaa + profile: prod # profile(s) of the property source + label: master # toggle to switch to a different version of the configuration as stored in git + # it can be set to any label, branch or commit of the configuration source Git repository + +jhipster: + registry: + password: admin diff --git a/jhipster/jhipster-uaa/uaa/src/main/resources/config/bootstrap.yml b/jhipster/jhipster-uaa/uaa/src/main/resources/config/bootstrap.yml new file mode 100644 index 0000000000..2edc350d9e --- /dev/null +++ b/jhipster/jhipster-uaa/uaa/src/main/resources/config/bootstrap.yml @@ -0,0 +1,26 @@ +# =================================================================== +# Spring Cloud Config bootstrap configuration for the "dev" profile +# In prod profile, properties will be overwriten by the ones defined in bootstrap-prod.yml +# =================================================================== + +jhipster: + registry: + password: admin + +spring: + application: + name: uaa + profiles: + # The commented value for `active` can be replaced with valid Spring profiles to load. + # Otherwise, it will be filled in by maven when building the WAR file + # Either way, it can be overridden by `--spring.profiles.active` value passed in the commandline or `-Dspring.profiles.active` set in `JAVA_OPTS` + active: #spring.profiles.active# + cloud: + config: + fail-fast: false # if not in "prod" profile, do not force to use Spring Cloud Config + uri: http://admin:${jhipster.registry.password}@localhost:8761/config + # name of the config server's property source (file.yml) that we want to use + name: uaa + profile: dev # profile(s) of the property source + label: master # toggle to switch to a different version of the configuration as stored in git + # it can be set to any label, branch or commit of the configuration source Git repository diff --git a/jhipster/jhipster-uaa/uaa/src/main/resources/config/liquibase/authorities.csv b/jhipster/jhipster-uaa/uaa/src/main/resources/config/liquibase/authorities.csv new file mode 100644 index 0000000000..af5c6dfa18 --- /dev/null +++ b/jhipster/jhipster-uaa/uaa/src/main/resources/config/liquibase/authorities.csv @@ -0,0 +1,3 @@ +name +ROLE_ADMIN +ROLE_USER diff --git a/jhipster/jhipster-uaa/uaa/src/main/resources/config/liquibase/changelog/00000000000000_initial_schema.xml b/jhipster/jhipster-uaa/uaa/src/main/resources/config/liquibase/changelog/00000000000000_initial_schema.xml new file mode 100644 index 0000000000..3e3d8cd134 --- /dev/null +++ b/jhipster/jhipster-uaa/uaa/src/main/resources/config/liquibase/changelog/00000000000000_initial_schema.xml @@ -0,0 +1,141 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/jhipster/jhipster-uaa/uaa/src/main/resources/config/liquibase/master.xml b/jhipster/jhipster-uaa/uaa/src/main/resources/config/liquibase/master.xml new file mode 100644 index 0000000000..f2b0b1f7e6 --- /dev/null +++ b/jhipster/jhipster-uaa/uaa/src/main/resources/config/liquibase/master.xml @@ -0,0 +1,10 @@ + + + + + + + diff --git a/jhipster/jhipster-uaa/uaa/src/main/resources/config/liquibase/users.csv b/jhipster/jhipster-uaa/uaa/src/main/resources/config/liquibase/users.csv new file mode 100644 index 0000000000..b25922b699 --- /dev/null +++ b/jhipster/jhipster-uaa/uaa/src/main/resources/config/liquibase/users.csv @@ -0,0 +1,5 @@ +id;login;password_hash;first_name;last_name;email;image_url;activated;lang_key;created_by;last_modified_by +1;system;$2a$10$mE.qmcV0mFU5NcKh73TZx.z4ueI/.bDWbj0T1BYyqP481kGGarKLG;System;System;system@localhost;;true;en;system;system +2;anonymoususer;$2a$10$j8S5d7Sr7.8VTOYNviDPOeWX8KcYILUVJBsYV83Y5NtECayypx9lO;Anonymous;User;anonymous@localhost;;true;en;system;system +3;admin;$2a$10$gSAhZrxMllrbgj/kkK9UceBPpChGWJA7SYIb1Mqo.n5aNLq1/oRrC;Administrator;Administrator;admin@localhost;;true;en;system;system +4;user;$2a$10$VEjxo0jq2YG9Rbk2HmX9S.k1uZBGYUHdUcid3g/vfiEl7lwWgOH/K;User;User;user@localhost;;true;en;system;system diff --git a/jhipster/jhipster-uaa/uaa/src/main/resources/config/liquibase/users_authorities.csv b/jhipster/jhipster-uaa/uaa/src/main/resources/config/liquibase/users_authorities.csv new file mode 100644 index 0000000000..06c5feeeea --- /dev/null +++ b/jhipster/jhipster-uaa/uaa/src/main/resources/config/liquibase/users_authorities.csv @@ -0,0 +1,6 @@ +user_id;authority_name +1;ROLE_ADMIN +1;ROLE_USER +3;ROLE_ADMIN +3;ROLE_USER +4;ROLE_USER diff --git a/jhipster/jhipster-uaa/uaa/src/main/resources/config/tls/keystore.p12 b/jhipster/jhipster-uaa/uaa/src/main/resources/config/tls/keystore.p12 new file mode 100644 index 0000000000..dee8bf3320 Binary files /dev/null and b/jhipster/jhipster-uaa/uaa/src/main/resources/config/tls/keystore.p12 differ diff --git a/jhipster/jhipster-uaa/uaa/src/main/resources/i18n/messages.properties b/jhipster/jhipster-uaa/uaa/src/main/resources/i18n/messages.properties new file mode 100644 index 0000000000..c1822828a1 --- /dev/null +++ b/jhipster/jhipster-uaa/uaa/src/main/resources/i18n/messages.properties @@ -0,0 +1,21 @@ +# Error page +error.title=Your request cannot be processed +error.subtitle=Sorry, an error has occurred. +error.status=Status: +error.message=Message: + +# Activation email +email.activation.title=uaa account activation +email.activation.greeting=Dear {0} +email.activation.text1=Your uaa account has been created, please click on the URL below to activate it: +email.activation.text2=Regards, +email.signature=uaa Team. + +# Creation email +email.creation.text1=Your uaa account has been created, please click on the URL below to access it: + +# Reset email +email.reset.title=uaa password reset +email.reset.greeting=Dear {0} +email.reset.text1=For your uaa account a password reset was requested, please click on the URL below to reset it: +email.reset.text2=Regards, diff --git a/jhipster/jhipster-uaa/uaa/src/main/resources/i18n/messages_en.properties b/jhipster/jhipster-uaa/uaa/src/main/resources/i18n/messages_en.properties new file mode 100644 index 0000000000..c1822828a1 --- /dev/null +++ b/jhipster/jhipster-uaa/uaa/src/main/resources/i18n/messages_en.properties @@ -0,0 +1,21 @@ +# Error page +error.title=Your request cannot be processed +error.subtitle=Sorry, an error has occurred. +error.status=Status: +error.message=Message: + +# Activation email +email.activation.title=uaa account activation +email.activation.greeting=Dear {0} +email.activation.text1=Your uaa account has been created, please click on the URL below to activate it: +email.activation.text2=Regards, +email.signature=uaa Team. + +# Creation email +email.creation.text1=Your uaa account has been created, please click on the URL below to access it: + +# Reset email +email.reset.title=uaa password reset +email.reset.greeting=Dear {0} +email.reset.text1=For your uaa account a password reset was requested, please click on the URL below to reset it: +email.reset.text2=Regards, diff --git a/jhipster/jhipster-uaa/uaa/src/main/resources/logback-spring.xml b/jhipster/jhipster-uaa/uaa/src/main/resources/logback-spring.xml new file mode 100644 index 0000000000..a30ab8c1d2 --- /dev/null +++ b/jhipster/jhipster-uaa/uaa/src/main/resources/logback-spring.xml @@ -0,0 +1,70 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + true + + + diff --git a/jhipster/jhipster-uaa/uaa/src/main/resources/templates/error.html b/jhipster/jhipster-uaa/uaa/src/main/resources/templates/error.html new file mode 100644 index 0000000000..08616bcf1e --- /dev/null +++ b/jhipster/jhipster-uaa/uaa/src/main/resources/templates/error.html @@ -0,0 +1,163 @@ + + + + + + Your request cannot be processed + + + +

+

Your request cannot be processed :(

+ +

Sorry, an error has occurred.

+ + Status:  ()
+ + Message: 
+
+ + + +
+ + diff --git a/jhipster/jhipster-uaa/uaa/src/main/resources/templates/mail/activationEmail.html b/jhipster/jhipster-uaa/uaa/src/main/resources/templates/mail/activationEmail.html new file mode 100644 index 0000000000..aa3822981e --- /dev/null +++ b/jhipster/jhipster-uaa/uaa/src/main/resources/templates/mail/activationEmail.html @@ -0,0 +1,25 @@ + + + + JHipster activation + + + + +

+ Dear +

+

+ Your JHipster account has been created, please click on the URL below to activate it: +

+

+ Activation Link +

+

+ Regards, +
+ JHipster. +

+ + diff --git a/jhipster/jhipster-uaa/uaa/src/main/resources/templates/mail/creationEmail.html b/jhipster/jhipster-uaa/uaa/src/main/resources/templates/mail/creationEmail.html new file mode 100644 index 0000000000..95e73d149e --- /dev/null +++ b/jhipster/jhipster-uaa/uaa/src/main/resources/templates/mail/creationEmail.html @@ -0,0 +1,27 @@ + + + + JHipster creation + + + + +

+ Dear +

+

+ Your JHipster account has been created, please click on the URL below to access it: +

+

+ + Login link + +

+

+ Regards, +
+ JHipster. +

+ + diff --git a/jhipster/jhipster-uaa/uaa/src/main/resources/templates/mail/passwordResetEmail.html b/jhipster/jhipster-uaa/uaa/src/main/resources/templates/mail/passwordResetEmail.html new file mode 100644 index 0000000000..5a90f208b5 --- /dev/null +++ b/jhipster/jhipster-uaa/uaa/src/main/resources/templates/mail/passwordResetEmail.html @@ -0,0 +1,25 @@ + + + + JHipster password reset + + + + +

+ Dear +

+

+ For your JHipster account a password reset was requested, please click on the URL below to reset it: +

+

+ Login link +

+

+ Regards, +
+ JHipster. +

+ + diff --git a/jhipster/jhipster-uaa/uaa/src/test/java/com/baeldung/jhipster/uaa/config/SecurityBeanOverrideConfiguration.java b/jhipster/jhipster-uaa/uaa/src/test/java/com/baeldung/jhipster/uaa/config/SecurityBeanOverrideConfiguration.java new file mode 100644 index 0000000000..2c2e27e151 --- /dev/null +++ b/jhipster/jhipster-uaa/uaa/src/test/java/com/baeldung/jhipster/uaa/config/SecurityBeanOverrideConfiguration.java @@ -0,0 +1,35 @@ +package com.baeldung.jhipster.uaa.config; + +import org.springframework.cloud.client.loadbalancer.RestTemplateCustomizer; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.Primary; +import org.springframework.security.oauth2.provider.token.TokenStore; +import org.springframework.security.oauth2.provider.token.store.JwtAccessTokenConverter; +import org.springframework.web.client.RestTemplate; + +/** + * Overrides UAA specific beans, so they do not interfere the testing + * This configuration must be included in @SpringBootTest in order to take effect. + */ +@Configuration +public class SecurityBeanOverrideConfiguration { + + @Bean + @Primary + public TokenStore tokenStore() { + return null; + } + + @Bean + @Primary + public JwtAccessTokenConverter jwtAccessTokenConverter() { + return null; + } + + @Bean + @Primary + public RestTemplate loadBalancedRestTemplate(RestTemplateCustomizer customizer) { + return null; + } +} diff --git a/jhipster/jhipster-uaa/uaa/src/test/java/com/baeldung/jhipster/uaa/config/WebConfigurerTest.java b/jhipster/jhipster-uaa/uaa/src/test/java/com/baeldung/jhipster/uaa/config/WebConfigurerTest.java new file mode 100644 index 0000000000..0d5b60c163 --- /dev/null +++ b/jhipster/jhipster-uaa/uaa/src/test/java/com/baeldung/jhipster/uaa/config/WebConfigurerTest.java @@ -0,0 +1,197 @@ +package com.baeldung.jhipster.uaa.config; + +import com.codahale.metrics.MetricRegistry; +import com.codahale.metrics.servlet.InstrumentedFilter; +import com.codahale.metrics.servlets.MetricsServlet; +import io.github.jhipster.config.JHipsterConstants; +import io.github.jhipster.config.JHipsterProperties; +import io.undertow.Undertow; +import io.undertow.Undertow.Builder; +import io.undertow.UndertowOptions; + +import org.h2.server.web.WebServlet; +import org.junit.Before; +import org.junit.Test; +import org.springframework.boot.web.embedded.undertow.UndertowServletWebServerFactory; +import org.springframework.http.HttpHeaders; +import org.springframework.mock.env.MockEnvironment; +import org.springframework.mock.web.MockServletContext; +import org.springframework.test.util.ReflectionTestUtils; +import org.springframework.test.web.servlet.MockMvc; +import org.springframework.test.web.servlet.setup.MockMvcBuilders; +import org.xnio.OptionMap; + +import javax.servlet.*; +import java.util.*; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.anyString; +import static org.mockito.Mockito.*; +import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; +import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.options; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.header; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; + +/** + * Unit tests for the WebConfigurer class. + * + * @see WebConfigurer + */ +public class WebConfigurerTest { + + private WebConfigurer webConfigurer; + + private MockServletContext servletContext; + + private MockEnvironment env; + + private JHipsterProperties props; + + private MetricRegistry metricRegistry; + + @Before + public void setup() { + servletContext = spy(new MockServletContext()); + doReturn(mock(FilterRegistration.Dynamic.class)) + .when(servletContext).addFilter(anyString(), any(Filter.class)); + doReturn(mock(ServletRegistration.Dynamic.class)) + .when(servletContext).addServlet(anyString(), any(Servlet.class)); + + env = new MockEnvironment(); + props = new JHipsterProperties(); + + webConfigurer = new WebConfigurer(env, props); + metricRegistry = new MetricRegistry(); + webConfigurer.setMetricRegistry(metricRegistry); + } + + @Test + public void testStartUpProdServletContext() throws ServletException { + env.setActiveProfiles(JHipsterConstants.SPRING_PROFILE_PRODUCTION); + webConfigurer.onStartup(servletContext); + + assertThat(servletContext.getAttribute(InstrumentedFilter.REGISTRY_ATTRIBUTE)).isEqualTo(metricRegistry); + assertThat(servletContext.getAttribute(MetricsServlet.METRICS_REGISTRY)).isEqualTo(metricRegistry); + verify(servletContext).addFilter(eq("webappMetricsFilter"), any(InstrumentedFilter.class)); + verify(servletContext).addServlet(eq("metricsServlet"), any(MetricsServlet.class)); + verify(servletContext, never()).addServlet(eq("H2Console"), any(WebServlet.class)); + } + + @Test + public void testStartUpDevServletContext() throws ServletException { + env.setActiveProfiles(JHipsterConstants.SPRING_PROFILE_DEVELOPMENT); + webConfigurer.onStartup(servletContext); + + assertThat(servletContext.getAttribute(InstrumentedFilter.REGISTRY_ATTRIBUTE)).isEqualTo(metricRegistry); + assertThat(servletContext.getAttribute(MetricsServlet.METRICS_REGISTRY)).isEqualTo(metricRegistry); + verify(servletContext).addFilter(eq("webappMetricsFilter"), any(InstrumentedFilter.class)); + verify(servletContext).addServlet(eq("metricsServlet"), any(MetricsServlet.class)); + verify(servletContext).addServlet(eq("H2Console"), any(WebServlet.class)); + } + + @Test + public void testCustomizeServletContainer() { + env.setActiveProfiles(JHipsterConstants.SPRING_PROFILE_PRODUCTION); + UndertowServletWebServerFactory container = new UndertowServletWebServerFactory(); + webConfigurer.customize(container); + assertThat(container.getMimeMappings().get("abs")).isEqualTo("audio/x-mpeg"); + assertThat(container.getMimeMappings().get("html")).isEqualTo("text/html;charset=utf-8"); + assertThat(container.getMimeMappings().get("json")).isEqualTo("text/html;charset=utf-8"); + + Builder builder = Undertow.builder(); + container.getBuilderCustomizers().forEach(c -> c.customize(builder)); + OptionMap.Builder serverOptions = (OptionMap.Builder) ReflectionTestUtils.getField(builder, "serverOptions"); + assertThat(serverOptions.getMap().get(UndertowOptions.ENABLE_HTTP2)).isNull(); + } + + @Test + public void testUndertowHttp2Enabled() { + props.getHttp().setVersion(JHipsterProperties.Http.Version.V_2_0); + UndertowServletWebServerFactory container = new UndertowServletWebServerFactory(); + webConfigurer.customize(container); + Builder builder = Undertow.builder(); + container.getBuilderCustomizers().forEach(c -> c.customize(builder)); + OptionMap.Builder serverOptions = (OptionMap.Builder) ReflectionTestUtils.getField(builder, "serverOptions"); + assertThat(serverOptions.getMap().get(UndertowOptions.ENABLE_HTTP2)).isTrue(); + } + + @Test + public void testCorsFilterOnApiPath() throws Exception { + props.getCors().setAllowedOrigins(Collections.singletonList("*")); + props.getCors().setAllowedMethods(Arrays.asList("GET", "POST", "PUT", "DELETE")); + props.getCors().setAllowedHeaders(Collections.singletonList("*")); + props.getCors().setMaxAge(1800L); + props.getCors().setAllowCredentials(true); + + MockMvc mockMvc = MockMvcBuilders.standaloneSetup(new WebConfigurerTestController()) + .addFilters(webConfigurer.corsFilter()) + .build(); + + mockMvc.perform( + options("/api/test-cors") + .header(HttpHeaders.ORIGIN, "other.domain.com") + .header(HttpHeaders.ACCESS_CONTROL_REQUEST_METHOD, "POST")) + .andExpect(status().isOk()) + .andExpect(header().string(HttpHeaders.ACCESS_CONTROL_ALLOW_ORIGIN, "other.domain.com")) + .andExpect(header().string(HttpHeaders.VARY, "Origin")) + .andExpect(header().string(HttpHeaders.ACCESS_CONTROL_ALLOW_METHODS, "GET,POST,PUT,DELETE")) + .andExpect(header().string(HttpHeaders.ACCESS_CONTROL_ALLOW_CREDENTIALS, "true")) + .andExpect(header().string(HttpHeaders.ACCESS_CONTROL_MAX_AGE, "1800")); + + mockMvc.perform( + get("/api/test-cors") + .header(HttpHeaders.ORIGIN, "other.domain.com")) + .andExpect(status().isOk()) + .andExpect(header().string(HttpHeaders.ACCESS_CONTROL_ALLOW_ORIGIN, "other.domain.com")); + } + + @Test + public void testCorsFilterOnOtherPath() throws Exception { + props.getCors().setAllowedOrigins(Collections.singletonList("*")); + props.getCors().setAllowedMethods(Arrays.asList("GET", "POST", "PUT", "DELETE")); + props.getCors().setAllowedHeaders(Collections.singletonList("*")); + props.getCors().setMaxAge(1800L); + props.getCors().setAllowCredentials(true); + + MockMvc mockMvc = MockMvcBuilders.standaloneSetup(new WebConfigurerTestController()) + .addFilters(webConfigurer.corsFilter()) + .build(); + + mockMvc.perform( + get("/test/test-cors") + .header(HttpHeaders.ORIGIN, "other.domain.com")) + .andExpect(status().isOk()) + .andExpect(header().doesNotExist(HttpHeaders.ACCESS_CONTROL_ALLOW_ORIGIN)); + } + + @Test + public void testCorsFilterDeactivated() throws Exception { + props.getCors().setAllowedOrigins(null); + + MockMvc mockMvc = MockMvcBuilders.standaloneSetup(new WebConfigurerTestController()) + .addFilters(webConfigurer.corsFilter()) + .build(); + + mockMvc.perform( + get("/api/test-cors") + .header(HttpHeaders.ORIGIN, "other.domain.com")) + .andExpect(status().isOk()) + .andExpect(header().doesNotExist(HttpHeaders.ACCESS_CONTROL_ALLOW_ORIGIN)); + } + + @Test + public void testCorsFilterDeactivated2() throws Exception { + props.getCors().setAllowedOrigins(new ArrayList<>()); + + MockMvc mockMvc = MockMvcBuilders.standaloneSetup(new WebConfigurerTestController()) + .addFilters(webConfigurer.corsFilter()) + .build(); + + mockMvc.perform( + get("/api/test-cors") + .header(HttpHeaders.ORIGIN, "other.domain.com")) + .andExpect(status().isOk()) + .andExpect(header().doesNotExist(HttpHeaders.ACCESS_CONTROL_ALLOW_ORIGIN)); + } +} diff --git a/jhipster/jhipster-uaa/uaa/src/test/java/com/baeldung/jhipster/uaa/config/WebConfigurerTestController.java b/jhipster/jhipster-uaa/uaa/src/test/java/com/baeldung/jhipster/uaa/config/WebConfigurerTestController.java new file mode 100644 index 0000000000..89e29d7541 --- /dev/null +++ b/jhipster/jhipster-uaa/uaa/src/test/java/com/baeldung/jhipster/uaa/config/WebConfigurerTestController.java @@ -0,0 +1,16 @@ +package com.baeldung.jhipster.uaa.config; + +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RestController; + +@RestController +public class WebConfigurerTestController { + + @GetMapping("/api/test-cors") + public void testCorsOnApiPath() { + } + + @GetMapping("/test/test-cors") + public void testCorsOnOtherPath() { + } +} diff --git a/jhipster/jhipster-uaa/uaa/src/test/java/com/baeldung/jhipster/uaa/repository/CustomAuditEventRepositoryIntTest.java b/jhipster/jhipster-uaa/uaa/src/test/java/com/baeldung/jhipster/uaa/repository/CustomAuditEventRepositoryIntTest.java new file mode 100644 index 0000000000..fbfcf8b607 --- /dev/null +++ b/jhipster/jhipster-uaa/uaa/src/test/java/com/baeldung/jhipster/uaa/repository/CustomAuditEventRepositoryIntTest.java @@ -0,0 +1,165 @@ +package com.baeldung.jhipster.uaa.repository; + +import com.baeldung.jhipster.uaa.UaaApp; +import com.baeldung.jhipster.uaa.config.Constants; +import com.baeldung.jhipster.uaa.config.audit.AuditEventConverter; +import com.baeldung.jhipster.uaa.domain.PersistentAuditEvent; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.actuate.audit.AuditEvent; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.mock.web.MockHttpServletRequest; +import org.springframework.mock.web.MockHttpSession; +import org.springframework.security.web.authentication.WebAuthenticationDetails; +import org.springframework.test.context.junit4.SpringRunner; +import org.springframework.transaction.annotation.Transactional; + +import javax.servlet.http.HttpSession; +import java.time.Instant; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import static org.assertj.core.api.Assertions.assertThat; +import static com.baeldung.jhipster.uaa.repository.CustomAuditEventRepository.EVENT_DATA_COLUMN_MAX_LENGTH; + +/** + * Test class for the CustomAuditEventRepository class. + * + * @see CustomAuditEventRepository + */ +@RunWith(SpringRunner.class) +@SpringBootTest(classes = UaaApp.class) +@Transactional +public class CustomAuditEventRepositoryIntTest { + + @Autowired + private PersistenceAuditEventRepository persistenceAuditEventRepository; + + @Autowired + private AuditEventConverter auditEventConverter; + + private CustomAuditEventRepository customAuditEventRepository; + + private PersistentAuditEvent testUserEvent; + + private PersistentAuditEvent testOtherUserEvent; + + private PersistentAuditEvent testOldUserEvent; + + @Before + public void setup() { + customAuditEventRepository = new CustomAuditEventRepository(persistenceAuditEventRepository, auditEventConverter); + persistenceAuditEventRepository.deleteAll(); + Instant oneHourAgo = Instant.now().minusSeconds(3600); + + testUserEvent = new PersistentAuditEvent(); + testUserEvent.setPrincipal("test-user"); + testUserEvent.setAuditEventType("test-type"); + testUserEvent.setAuditEventDate(oneHourAgo); + Map data = new HashMap<>(); + data.put("test-key", "test-value"); + testUserEvent.setData(data); + + testOldUserEvent = new PersistentAuditEvent(); + testOldUserEvent.setPrincipal("test-user"); + testOldUserEvent.setAuditEventType("test-type"); + testOldUserEvent.setAuditEventDate(oneHourAgo.minusSeconds(10000)); + + testOtherUserEvent = new PersistentAuditEvent(); + testOtherUserEvent.setPrincipal("other-test-user"); + testOtherUserEvent.setAuditEventType("test-type"); + testOtherUserEvent.setAuditEventDate(oneHourAgo); + } + + @Test + public void addAuditEvent() { + Map data = new HashMap<>(); + data.put("test-key", "test-value"); + AuditEvent event = new AuditEvent("test-user", "test-type", data); + customAuditEventRepository.add(event); + List persistentAuditEvents = persistenceAuditEventRepository.findAll(); + assertThat(persistentAuditEvents).hasSize(1); + PersistentAuditEvent persistentAuditEvent = persistentAuditEvents.get(0); + assertThat(persistentAuditEvent.getPrincipal()).isEqualTo(event.getPrincipal()); + assertThat(persistentAuditEvent.getAuditEventType()).isEqualTo(event.getType()); + assertThat(persistentAuditEvent.getData()).containsKey("test-key"); + assertThat(persistentAuditEvent.getData().get("test-key")).isEqualTo("test-value"); + assertThat(persistentAuditEvent.getAuditEventDate()).isEqualTo(event.getTimestamp()); + } + + @Test + public void addAuditEventTruncateLargeData() { + Map data = new HashMap<>(); + StringBuilder largeData = new StringBuilder(); + for (int i = 0; i < EVENT_DATA_COLUMN_MAX_LENGTH + 10; i++) { + largeData.append("a"); + } + data.put("test-key", largeData); + AuditEvent event = new AuditEvent("test-user", "test-type", data); + customAuditEventRepository.add(event); + List persistentAuditEvents = persistenceAuditEventRepository.findAll(); + assertThat(persistentAuditEvents).hasSize(1); + PersistentAuditEvent persistentAuditEvent = persistentAuditEvents.get(0); + assertThat(persistentAuditEvent.getPrincipal()).isEqualTo(event.getPrincipal()); + assertThat(persistentAuditEvent.getAuditEventType()).isEqualTo(event.getType()); + assertThat(persistentAuditEvent.getData()).containsKey("test-key"); + String actualData = persistentAuditEvent.getData().get("test-key"); + assertThat(actualData.length()).isEqualTo(EVENT_DATA_COLUMN_MAX_LENGTH); + assertThat(actualData).isSubstringOf(largeData); + assertThat(persistentAuditEvent.getAuditEventDate()).isEqualTo(event.getTimestamp()); + } + + @Test + public void testAddEventWithWebAuthenticationDetails() { + HttpSession session = new MockHttpSession(null, "test-session-id"); + MockHttpServletRequest request = new MockHttpServletRequest(); + request.setSession(session); + request.setRemoteAddr("1.2.3.4"); + WebAuthenticationDetails details = new WebAuthenticationDetails(request); + Map data = new HashMap<>(); + data.put("test-key", details); + AuditEvent event = new AuditEvent("test-user", "test-type", data); + customAuditEventRepository.add(event); + List persistentAuditEvents = persistenceAuditEventRepository.findAll(); + assertThat(persistentAuditEvents).hasSize(1); + PersistentAuditEvent persistentAuditEvent = persistentAuditEvents.get(0); + assertThat(persistentAuditEvent.getData().get("remoteAddress")).isEqualTo("1.2.3.4"); + assertThat(persistentAuditEvent.getData().get("sessionId")).isEqualTo("test-session-id"); + } + + @Test + public void testAddEventWithNullData() { + Map data = new HashMap<>(); + data.put("test-key", null); + AuditEvent event = new AuditEvent("test-user", "test-type", data); + customAuditEventRepository.add(event); + List persistentAuditEvents = persistenceAuditEventRepository.findAll(); + assertThat(persistentAuditEvents).hasSize(1); + PersistentAuditEvent persistentAuditEvent = persistentAuditEvents.get(0); + assertThat(persistentAuditEvent.getData().get("test-key")).isEqualTo("null"); + } + + @Test + public void addAuditEventWithAnonymousUser() { + Map data = new HashMap<>(); + data.put("test-key", "test-value"); + AuditEvent event = new AuditEvent(Constants.ANONYMOUS_USER, "test-type", data); + customAuditEventRepository.add(event); + List persistentAuditEvents = persistenceAuditEventRepository.findAll(); + assertThat(persistentAuditEvents).hasSize(0); + } + + @Test + public void addAuditEventWithAuthorizationFailureType() { + Map data = new HashMap<>(); + data.put("test-key", "test-value"); + AuditEvent event = new AuditEvent("test-user", "AUTHORIZATION_FAILURE", data); + customAuditEventRepository.add(event); + List persistentAuditEvents = persistenceAuditEventRepository.findAll(); + assertThat(persistentAuditEvents).hasSize(0); + } + +} diff --git a/jhipster/jhipster-uaa/uaa/src/test/java/com/baeldung/jhipster/uaa/security/DomainUserDetailsServiceIntTest.java b/jhipster/jhipster-uaa/uaa/src/test/java/com/baeldung/jhipster/uaa/security/DomainUserDetailsServiceIntTest.java new file mode 100644 index 0000000000..6c15e47cb9 --- /dev/null +++ b/jhipster/jhipster-uaa/uaa/src/test/java/com/baeldung/jhipster/uaa/security/DomainUserDetailsServiceIntTest.java @@ -0,0 +1,127 @@ +package com.baeldung.jhipster.uaa.security; + +import com.baeldung.jhipster.uaa.UaaApp; +import com.baeldung.jhipster.uaa.domain.User; +import com.baeldung.jhipster.uaa.repository.UserRepository; + +import org.apache.commons.lang3.RandomStringUtils; +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.core.userdetails.UserDetails; +import org.springframework.security.core.userdetails.UserDetailsService; +import org.springframework.security.core.userdetails.UsernameNotFoundException; +import org.springframework.test.context.junit4.SpringRunner; +import org.springframework.transaction.annotation.Transactional; + +import java.util.Locale; + +import static org.assertj.core.api.Assertions.assertThat; + +/** + * Test class for DomainUserDetailsService. + * + * @see DomainUserDetailsService + */ +@RunWith(SpringRunner.class) +@SpringBootTest(classes = UaaApp.class) +@Transactional +public class DomainUserDetailsServiceIntTest { + + private static final String USER_ONE_LOGIN = "test-user-one"; + private static final String USER_ONE_EMAIL = "test-user-one@localhost"; + private static final String USER_TWO_LOGIN = "test-user-two"; + private static final String USER_TWO_EMAIL = "test-user-two@localhost"; + private static final String USER_THREE_LOGIN = "test-user-three"; + private static final String USER_THREE_EMAIL = "test-user-three@localhost"; + + @Autowired + private UserRepository userRepository; + + @Autowired + private UserDetailsService domainUserDetailsService; + + private User userOne; + private User userTwo; + private User userThree; + + @Before + public void init() { + userOne = new User(); + userOne.setLogin(USER_ONE_LOGIN); + userOne.setPassword(RandomStringUtils.random(60)); + userOne.setActivated(true); + userOne.setEmail(USER_ONE_EMAIL); + userOne.setFirstName("userOne"); + userOne.setLastName("doe"); + userOne.setLangKey("en"); + userRepository.save(userOne); + + userTwo = new User(); + userTwo.setLogin(USER_TWO_LOGIN); + userTwo.setPassword(RandomStringUtils.random(60)); + userTwo.setActivated(true); + userTwo.setEmail(USER_TWO_EMAIL); + userTwo.setFirstName("userTwo"); + userTwo.setLastName("doe"); + userTwo.setLangKey("en"); + userRepository.save(userTwo); + + userThree = new User(); + userThree.setLogin(USER_THREE_LOGIN); + userThree.setPassword(RandomStringUtils.random(60)); + userThree.setActivated(false); + userThree.setEmail(USER_THREE_EMAIL); + userThree.setFirstName("userThree"); + userThree.setLastName("doe"); + userThree.setLangKey("en"); + userRepository.save(userThree); + } + + @Test + @Transactional + public void assertThatUserCanBeFoundByLogin() { + UserDetails userDetails = domainUserDetailsService.loadUserByUsername(USER_ONE_LOGIN); + assertThat(userDetails).isNotNull(); + assertThat(userDetails.getUsername()).isEqualTo(USER_ONE_LOGIN); + } + + @Test + @Transactional + public void assertThatUserCanBeFoundByLoginIgnoreCase() { + UserDetails userDetails = domainUserDetailsService.loadUserByUsername(USER_ONE_LOGIN.toUpperCase(Locale.ENGLISH)); + assertThat(userDetails).isNotNull(); + assertThat(userDetails.getUsername()).isEqualTo(USER_ONE_LOGIN); + } + + @Test + @Transactional + public void assertThatUserCanBeFoundByEmail() { + UserDetails userDetails = domainUserDetailsService.loadUserByUsername(USER_TWO_EMAIL); + assertThat(userDetails).isNotNull(); + assertThat(userDetails.getUsername()).isEqualTo(USER_TWO_LOGIN); + } + + @Test(expected = UsernameNotFoundException.class) + @Transactional + public void assertThatUserCanNotBeFoundByEmailIgnoreCase() { + domainUserDetailsService.loadUserByUsername(USER_TWO_EMAIL.toUpperCase(Locale.ENGLISH)); + } + + @Test + @Transactional + public void assertThatEmailIsPrioritizedOverLogin() { + UserDetails userDetails = domainUserDetailsService.loadUserByUsername(USER_ONE_EMAIL); + assertThat(userDetails).isNotNull(); + assertThat(userDetails.getUsername()).isEqualTo(USER_ONE_LOGIN); + } + + @Test(expected = UserNotActivatedException.class) + @Transactional + public void assertThatUserNotActivatedExceptionIsThrownForNotActivatedUsers() { + domainUserDetailsService.loadUserByUsername(USER_THREE_LOGIN); + } + +} diff --git a/jhipster/jhipster-uaa/uaa/src/test/java/com/baeldung/jhipster/uaa/security/OAuth2TokenMockUtil.java b/jhipster/jhipster-uaa/uaa/src/test/java/com/baeldung/jhipster/uaa/security/OAuth2TokenMockUtil.java new file mode 100644 index 0000000000..85a572234f --- /dev/null +++ b/jhipster/jhipster-uaa/uaa/src/test/java/com/baeldung/jhipster/uaa/security/OAuth2TokenMockUtil.java @@ -0,0 +1,83 @@ +package com.baeldung.jhipster.uaa.security; + +import org.springframework.boot.test.mock.mockito.MockBean; +import org.springframework.mock.web.MockHttpServletRequest; +import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; +import org.springframework.security.core.Authentication; +import org.springframework.security.core.GrantedAuthority; +import org.springframework.security.core.authority.SimpleGrantedAuthority; +import org.springframework.security.core.userdetails.User; +import org.springframework.security.oauth2.common.DefaultOAuth2AccessToken; +import org.springframework.security.oauth2.provider.OAuth2Authentication; +import org.springframework.security.oauth2.provider.OAuth2Request; +import org.springframework.security.oauth2.provider.token.ResourceServerTokenServices; +import org.springframework.stereotype.Component; +import org.springframework.test.web.servlet.request.RequestPostProcessor; + +import java.util.Collections; +import java.util.List; +import java.util.Set; +import java.util.UUID; +import java.util.stream.Collectors; + +import static org.mockito.BDDMockito.given; + +/** + * A bean providing simple mocking of OAuth2 access tokens for security integration tests. + */ +@Component +public class OAuth2TokenMockUtil { + + @MockBean + private ResourceServerTokenServices tokenServices; + + private OAuth2Authentication createAuthentication(String username, Set scopes, Set roles) { + List authorities = roles.stream() + .map(SimpleGrantedAuthority::new) + .collect(Collectors.toList()); + + User principal = new User(username, "test", true, true, true, true, authorities); + Authentication authentication = new UsernamePasswordAuthenticationToken(principal, principal.getPassword(), + principal.getAuthorities()); + + // Create the authorization request and OAuth2Authentication object + OAuth2Request authRequest = new OAuth2Request(null, "testClient", null, true, scopes, null, null, null, + null); + return new OAuth2Authentication(authRequest, authentication); + } + + public RequestPostProcessor oauth2Authentication(String username, Set scopes, Set roles) { + String uuid = String.valueOf(UUID.randomUUID()); + + given(tokenServices.loadAuthentication(uuid)) + .willReturn(createAuthentication(username, scopes, roles)); + + given(tokenServices.readAccessToken(uuid)).willReturn(new DefaultOAuth2AccessToken(uuid)); + + return new OAuth2PostProcessor(uuid); + } + + public RequestPostProcessor oauth2Authentication(String username, Set scopes) { + return oauth2Authentication(username, scopes, Collections.emptySet()); + } + + public RequestPostProcessor oauth2Authentication(String username) { + return oauth2Authentication(username, Collections.emptySet()); + } + + public static class OAuth2PostProcessor implements RequestPostProcessor { + + private String token; + + public OAuth2PostProcessor(String token) { + this.token = token; + } + + @Override + public MockHttpServletRequest postProcessRequest(MockHttpServletRequest mockHttpServletRequest) { + mockHttpServletRequest.addHeader("Authorization", "Bearer " + token); + + return mockHttpServletRequest; + } + } +} diff --git a/jhipster/jhipster-uaa/uaa/src/test/java/com/baeldung/jhipster/uaa/security/SecurityUtilsUnitTest.java b/jhipster/jhipster-uaa/uaa/src/test/java/com/baeldung/jhipster/uaa/security/SecurityUtilsUnitTest.java new file mode 100644 index 0000000000..8da41864c8 --- /dev/null +++ b/jhipster/jhipster-uaa/uaa/src/test/java/com/baeldung/jhipster/uaa/security/SecurityUtilsUnitTest.java @@ -0,0 +1,64 @@ +package com.baeldung.jhipster.uaa.security; + +import org.junit.Test; +import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; +import org.springframework.security.core.GrantedAuthority; +import org.springframework.security.core.authority.SimpleGrantedAuthority; +import org.springframework.security.core.context.SecurityContext; +import org.springframework.security.core.context.SecurityContextHolder; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.Optional; + +import static org.assertj.core.api.Assertions.assertThat; + +/** + * Test class for the SecurityUtils utility class. + * + * @see SecurityUtils + */ +public class SecurityUtilsUnitTest { + + @Test + public void testgetCurrentUserLogin() { + SecurityContext securityContext = SecurityContextHolder.createEmptyContext(); + securityContext.setAuthentication(new UsernamePasswordAuthenticationToken("admin", "admin")); + SecurityContextHolder.setContext(securityContext); + Optional login = SecurityUtils.getCurrentUserLogin(); + assertThat(login).contains("admin"); + } + + @Test + public void testIsAuthenticated() { + SecurityContext securityContext = SecurityContextHolder.createEmptyContext(); + securityContext.setAuthentication(new UsernamePasswordAuthenticationToken("admin", "admin")); + SecurityContextHolder.setContext(securityContext); + boolean isAuthenticated = SecurityUtils.isAuthenticated(); + assertThat(isAuthenticated).isTrue(); + } + + @Test + public void testAnonymousIsNotAuthenticated() { + SecurityContext securityContext = SecurityContextHolder.createEmptyContext(); + Collection authorities = new ArrayList<>(); + authorities.add(new SimpleGrantedAuthority(AuthoritiesConstants.ANONYMOUS)); + securityContext.setAuthentication(new UsernamePasswordAuthenticationToken("anonymous", "anonymous", authorities)); + SecurityContextHolder.setContext(securityContext); + boolean isAuthenticated = SecurityUtils.isAuthenticated(); + assertThat(isAuthenticated).isFalse(); + } + + @Test + public void testIsCurrentUserInRole() { + SecurityContext securityContext = SecurityContextHolder.createEmptyContext(); + Collection authorities = new ArrayList<>(); + authorities.add(new SimpleGrantedAuthority(AuthoritiesConstants.USER)); + securityContext.setAuthentication(new UsernamePasswordAuthenticationToken("user", "user", authorities)); + SecurityContextHolder.setContext(securityContext); + + assertThat(SecurityUtils.isCurrentUserInRole(AuthoritiesConstants.USER)).isTrue(); + assertThat(SecurityUtils.isCurrentUserInRole(AuthoritiesConstants.ADMIN)).isFalse(); + } + +} diff --git a/jhipster/jhipster-uaa/uaa/src/test/java/com/baeldung/jhipster/uaa/service/MailServiceIntTest.java b/jhipster/jhipster-uaa/uaa/src/test/java/com/baeldung/jhipster/uaa/service/MailServiceIntTest.java new file mode 100644 index 0000000000..5be48eea5c --- /dev/null +++ b/jhipster/jhipster-uaa/uaa/src/test/java/com/baeldung/jhipster/uaa/service/MailServiceIntTest.java @@ -0,0 +1,187 @@ +package com.baeldung.jhipster.uaa.service; +import com.baeldung.jhipster.uaa.config.Constants; + +import com.baeldung.jhipster.uaa.UaaApp; +import com.baeldung.jhipster.uaa.domain.User; +import io.github.jhipster.config.JHipsterProperties; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.ArgumentCaptor; +import org.mockito.Captor; +import org.mockito.MockitoAnnotations; +import org.mockito.Spy; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.context.MessageSource; +import org.springframework.mail.MailSendException; +import org.springframework.mail.javamail.JavaMailSenderImpl; +import org.springframework.test.context.junit4.SpringRunner; +import org.thymeleaf.spring5.SpringTemplateEngine; + +import javax.mail.Multipart; +import javax.mail.internet.MimeBodyPart; +import javax.mail.internet.MimeMessage; +import javax.mail.internet.MimeMultipart; +import java.io.ByteArrayOutputStream; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.Mockito.*; + +@RunWith(SpringRunner.class) +@SpringBootTest(classes = UaaApp.class) +public class MailServiceIntTest { + + @Autowired + private JHipsterProperties jHipsterProperties; + + @Autowired + private MessageSource messageSource; + + @Autowired + private SpringTemplateEngine templateEngine; + + @Spy + private JavaMailSenderImpl javaMailSender; + + @Captor + private ArgumentCaptor messageCaptor; + + private MailService mailService; + + @Before + public void setup() { + MockitoAnnotations.initMocks(this); + doNothing().when(javaMailSender).send(any(MimeMessage.class)); + mailService = new MailService(jHipsterProperties, javaMailSender, messageSource, templateEngine); + } + + @Test + public void testSendEmail() throws Exception { + mailService.sendEmail("john.doe@example.com", "testSubject", "testContent", false, false); + verify(javaMailSender).send(messageCaptor.capture()); + MimeMessage message = messageCaptor.getValue(); + assertThat(message.getSubject()).isEqualTo("testSubject"); + assertThat(message.getAllRecipients()[0].toString()).isEqualTo("john.doe@example.com"); + assertThat(message.getFrom()[0].toString()).isEqualTo("test@localhost"); + assertThat(message.getContent()).isInstanceOf(String.class); + assertThat(message.getContent().toString()).isEqualTo("testContent"); + assertThat(message.getDataHandler().getContentType()).isEqualTo("text/plain; charset=UTF-8"); + } + + @Test + public void testSendHtmlEmail() throws Exception { + mailService.sendEmail("john.doe@example.com", "testSubject", "testContent", false, true); + verify(javaMailSender).send(messageCaptor.capture()); + MimeMessage message = messageCaptor.getValue(); + assertThat(message.getSubject()).isEqualTo("testSubject"); + assertThat(message.getAllRecipients()[0].toString()).isEqualTo("john.doe@example.com"); + assertThat(message.getFrom()[0].toString()).isEqualTo("test@localhost"); + assertThat(message.getContent()).isInstanceOf(String.class); + assertThat(message.getContent().toString()).isEqualTo("testContent"); + assertThat(message.getDataHandler().getContentType()).isEqualTo("text/html;charset=UTF-8"); + } + + @Test + public void testSendMultipartEmail() throws Exception { + mailService.sendEmail("john.doe@example.com", "testSubject", "testContent", true, false); + verify(javaMailSender).send(messageCaptor.capture()); + MimeMessage message = messageCaptor.getValue(); + MimeMultipart mp = (MimeMultipart) message.getContent(); + MimeBodyPart part = (MimeBodyPart) ((MimeMultipart) mp.getBodyPart(0).getContent()).getBodyPart(0); + ByteArrayOutputStream aos = new ByteArrayOutputStream(); + part.writeTo(aos); + assertThat(message.getSubject()).isEqualTo("testSubject"); + assertThat(message.getAllRecipients()[0].toString()).isEqualTo("john.doe@example.com"); + assertThat(message.getFrom()[0].toString()).isEqualTo("test@localhost"); + assertThat(message.getContent()).isInstanceOf(Multipart.class); + assertThat(aos.toString()).isEqualTo("\r\ntestContent"); + assertThat(part.getDataHandler().getContentType()).isEqualTo("text/plain; charset=UTF-8"); + } + + @Test + public void testSendMultipartHtmlEmail() throws Exception { + mailService.sendEmail("john.doe@example.com", "testSubject", "testContent", true, true); + verify(javaMailSender).send(messageCaptor.capture()); + MimeMessage message = messageCaptor.getValue(); + MimeMultipart mp = (MimeMultipart) message.getContent(); + MimeBodyPart part = (MimeBodyPart) ((MimeMultipart) mp.getBodyPart(0).getContent()).getBodyPart(0); + ByteArrayOutputStream aos = new ByteArrayOutputStream(); + part.writeTo(aos); + assertThat(message.getSubject()).isEqualTo("testSubject"); + assertThat(message.getAllRecipients()[0].toString()).isEqualTo("john.doe@example.com"); + assertThat(message.getFrom()[0].toString()).isEqualTo("test@localhost"); + assertThat(message.getContent()).isInstanceOf(Multipart.class); + assertThat(aos.toString()).isEqualTo("\r\ntestContent"); + assertThat(part.getDataHandler().getContentType()).isEqualTo("text/html;charset=UTF-8"); + } + + @Test + public void testSendEmailFromTemplate() throws Exception { + User user = new User(); + user.setLogin("john"); + user.setEmail("john.doe@example.com"); + user.setLangKey("en"); + mailService.sendEmailFromTemplate(user, "mail/testEmail", "email.test.title"); + verify(javaMailSender).send(messageCaptor.capture()); + MimeMessage message = messageCaptor.getValue(); + assertThat(message.getSubject()).isEqualTo("test title"); + assertThat(message.getAllRecipients()[0].toString()).isEqualTo(user.getEmail()); + assertThat(message.getFrom()[0].toString()).isEqualTo("test@localhost"); + assertThat(message.getContent().toString()).isEqualToNormalizingNewlines("test title, http://127.0.0.1:8080, john\n"); + assertThat(message.getDataHandler().getContentType()).isEqualTo("text/html;charset=UTF-8"); + } + + @Test + public void testSendActivationEmail() throws Exception { + User user = new User(); + user.setLangKey(Constants.DEFAULT_LANGUAGE); + user.setLogin("john"); + user.setEmail("john.doe@example.com"); + mailService.sendActivationEmail(user); + verify(javaMailSender).send(messageCaptor.capture()); + MimeMessage message = messageCaptor.getValue(); + assertThat(message.getAllRecipients()[0].toString()).isEqualTo(user.getEmail()); + assertThat(message.getFrom()[0].toString()).isEqualTo("test@localhost"); + assertThat(message.getContent().toString()).isNotEmpty(); + assertThat(message.getDataHandler().getContentType()).isEqualTo("text/html;charset=UTF-8"); + } + + @Test + public void testCreationEmail() throws Exception { + User user = new User(); + user.setLangKey(Constants.DEFAULT_LANGUAGE); + user.setLogin("john"); + user.setEmail("john.doe@example.com"); + mailService.sendCreationEmail(user); + verify(javaMailSender).send(messageCaptor.capture()); + MimeMessage message = messageCaptor.getValue(); + assertThat(message.getAllRecipients()[0].toString()).isEqualTo(user.getEmail()); + assertThat(message.getFrom()[0].toString()).isEqualTo("test@localhost"); + assertThat(message.getContent().toString()).isNotEmpty(); + assertThat(message.getDataHandler().getContentType()).isEqualTo("text/html;charset=UTF-8"); + } + + @Test + public void testSendPasswordResetMail() throws Exception { + User user = new User(); + user.setLangKey(Constants.DEFAULT_LANGUAGE); + user.setLogin("john"); + user.setEmail("john.doe@example.com"); + mailService.sendPasswordResetMail(user); + verify(javaMailSender).send(messageCaptor.capture()); + MimeMessage message = messageCaptor.getValue(); + assertThat(message.getAllRecipients()[0].toString()).isEqualTo(user.getEmail()); + assertThat(message.getFrom()[0].toString()).isEqualTo("test@localhost"); + assertThat(message.getContent().toString()).isNotEmpty(); + assertThat(message.getDataHandler().getContentType()).isEqualTo("text/html;charset=UTF-8"); + } + + @Test + public void testSendEmailWithException() throws Exception { + doThrow(MailSendException.class).when(javaMailSender).send(any(MimeMessage.class)); + mailService.sendEmail("john.doe@example.com", "testSubject", "testContent", false, false); + } + +} diff --git a/jhipster/jhipster-uaa/uaa/src/test/java/com/baeldung/jhipster/uaa/service/UserServiceIntTest.java b/jhipster/jhipster-uaa/uaa/src/test/java/com/baeldung/jhipster/uaa/service/UserServiceIntTest.java new file mode 100644 index 0000000000..d544cb2d73 --- /dev/null +++ b/jhipster/jhipster-uaa/uaa/src/test/java/com/baeldung/jhipster/uaa/service/UserServiceIntTest.java @@ -0,0 +1,194 @@ +package com.baeldung.jhipster.uaa.service; + +import com.baeldung.jhipster.uaa.UaaApp; +import com.baeldung.jhipster.uaa.config.Constants; +import com.baeldung.jhipster.uaa.domain.User; +import com.baeldung.jhipster.uaa.repository.UserRepository; +import com.baeldung.jhipster.uaa.service.dto.UserDTO; +import com.baeldung.jhipster.uaa.service.util.RandomUtil; + +import org.apache.commons.lang3.RandomStringUtils; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.Mock; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.data.auditing.AuditingHandler; +import org.springframework.data.auditing.DateTimeProvider; +import org.springframework.data.domain.Page; +import org.springframework.data.domain.PageRequest; +import org.springframework.test.context.junit4.SpringRunner; +import org.springframework.transaction.annotation.Transactional; + +import java.time.Instant; +import java.time.temporal.ChronoUnit; +import java.time.LocalDateTime; +import java.util.Optional; +import java.util.List; +import java.util.Optional; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.junit.Assert.assertEquals; +import static org.mockito.Mockito.when; + +/** + * Test class for the UserResource REST controller. + * + * @see UserService + */ +@RunWith(SpringRunner.class) +@SpringBootTest(classes = UaaApp.class) +@Transactional +public class UserServiceIntTest { + + @Autowired + private UserRepository userRepository; + + @Autowired + private UserService userService; + + @Autowired + private AuditingHandler auditingHandler; + + @Mock + DateTimeProvider dateTimeProvider; + + private User user; + + @Before + public void init() { + user = new User(); + user.setLogin("johndoe"); + user.setPassword(RandomStringUtils.random(60)); + user.setActivated(true); + user.setEmail("johndoe@localhost"); + user.setFirstName("john"); + user.setLastName("doe"); + user.setImageUrl("http://placehold.it/50x50"); + user.setLangKey("en"); + + when(dateTimeProvider.getNow()).thenReturn(Optional.of(LocalDateTime.now())); + auditingHandler.setDateTimeProvider(dateTimeProvider); + } + + @Test + @Transactional + public void assertThatUserMustExistToResetPassword() { + userRepository.saveAndFlush(user); + Optional maybeUser = userService.requestPasswordReset("invalid.login@localhost"); + assertThat(maybeUser).isNotPresent(); + + maybeUser = userService.requestPasswordReset(user.getEmail()); + assertThat(maybeUser).isPresent(); + assertThat(maybeUser.orElse(null).getEmail()).isEqualTo(user.getEmail()); + assertThat(maybeUser.orElse(null).getResetDate()).isNotNull(); + assertThat(maybeUser.orElse(null).getResetKey()).isNotNull(); + } + + @Test + @Transactional + public void assertThatOnlyActivatedUserCanRequestPasswordReset() { + user.setActivated(false); + userRepository.saveAndFlush(user); + + Optional maybeUser = userService.requestPasswordReset(user.getLogin()); + assertThat(maybeUser).isNotPresent(); + userRepository.delete(user); + } + + @Test + @Transactional + public void assertThatResetKeyMustNotBeOlderThan24Hours() { + Instant daysAgo = Instant.now().minus(25, ChronoUnit.HOURS); + String resetKey = RandomUtil.generateResetKey(); + user.setActivated(true); + user.setResetDate(daysAgo); + user.setResetKey(resetKey); + userRepository.saveAndFlush(user); + + Optional maybeUser = userService.completePasswordReset("johndoe2", user.getResetKey()); + assertThat(maybeUser).isNotPresent(); + userRepository.delete(user); + } + + @Test + @Transactional + public void assertThatResetKeyMustBeValid() { + Instant daysAgo = Instant.now().minus(25, ChronoUnit.HOURS); + user.setActivated(true); + user.setResetDate(daysAgo); + user.setResetKey("1234"); + userRepository.saveAndFlush(user); + + Optional maybeUser = userService.completePasswordReset("johndoe2", user.getResetKey()); + assertThat(maybeUser).isNotPresent(); + userRepository.delete(user); + } + + @Test + @Transactional + public void assertThatUserCanResetPassword() { + String oldPassword = user.getPassword(); + Instant daysAgo = Instant.now().minus(2, ChronoUnit.HOURS); + String resetKey = RandomUtil.generateResetKey(); + user.setActivated(true); + user.setResetDate(daysAgo); + user.setResetKey(resetKey); + userRepository.saveAndFlush(user); + + Optional maybeUser = userService.completePasswordReset("johndoe2", user.getResetKey()); + assertThat(maybeUser).isPresent(); + assertThat(maybeUser.orElse(null).getResetDate()).isNull(); + assertThat(maybeUser.orElse(null).getResetKey()).isNull(); + assertThat(maybeUser.orElse(null).getPassword()).isNotEqualTo(oldPassword); + + userRepository.delete(user); + } + + @Test + @Transactional + public void testFindNotActivatedUsersByCreationDateBefore() { + Instant now = Instant.now(); + when(dateTimeProvider.getNow()).thenReturn(Optional.of(now.minus(4, ChronoUnit.DAYS))); + user.setActivated(false); + User dbUser = userRepository.saveAndFlush(user); + dbUser.setCreatedDate(now.minus(4, ChronoUnit.DAYS)); + userRepository.saveAndFlush(user); + List users = userRepository.findAllByActivatedIsFalseAndCreatedDateBefore(now.minus(3, ChronoUnit.DAYS)); + assertThat(users).isNotEmpty(); + userService.removeNotActivatedUsers(); + users = userRepository.findAllByActivatedIsFalseAndCreatedDateBefore(now.minus(3, ChronoUnit.DAYS)); + assertThat(users).isEmpty(); + } + + @Test + @Transactional + public void assertThatAnonymousUserIsNotGet() { + user.setLogin(Constants.ANONYMOUS_USER); + if (!userRepository.findOneByLogin(Constants.ANONYMOUS_USER).isPresent()) { + userRepository.saveAndFlush(user); + } + final PageRequest pageable = PageRequest.of(0, (int) userRepository.count()); + final Page allManagedUsers = userService.getAllManagedUsers(pageable); + assertThat(allManagedUsers.getContent().stream() + .noneMatch(user -> Constants.ANONYMOUS_USER.equals(user.getLogin()))) + .isTrue(); + } + + + @Test + @Transactional + public void testRemoveNotActivatedUsers() { + // custom "now" for audit to use as creation date + when(dateTimeProvider.getNow()).thenReturn(Optional.of(Instant.now().minus(30, ChronoUnit.DAYS))); + + user.setActivated(false); + userRepository.saveAndFlush(user); + + assertThat(userRepository.findOneByLogin("johndoe")).isPresent(); + userService.removeNotActivatedUsers(); + assertThat(userRepository.findOneByLogin("johndoe")).isNotPresent(); + } + +} diff --git a/jhipster/jhipster-uaa/uaa/src/test/java/com/baeldung/jhipster/uaa/web/rest/AccountResourceIntTest.java b/jhipster/jhipster-uaa/uaa/src/test/java/com/baeldung/jhipster/uaa/web/rest/AccountResourceIntTest.java new file mode 100644 index 0000000000..559385da2e --- /dev/null +++ b/jhipster/jhipster-uaa/uaa/src/test/java/com/baeldung/jhipster/uaa/web/rest/AccountResourceIntTest.java @@ -0,0 +1,811 @@ +package com.baeldung.jhipster.uaa.web.rest; + +import com.baeldung.jhipster.uaa.UaaApp; +import com.baeldung.jhipster.uaa.config.Constants; +import com.baeldung.jhipster.uaa.domain.Authority; +import com.baeldung.jhipster.uaa.domain.User; +import com.baeldung.jhipster.uaa.repository.AuthorityRepository; +import com.baeldung.jhipster.uaa.repository.UserRepository; +import com.baeldung.jhipster.uaa.security.AuthoritiesConstants; +import com.baeldung.jhipster.uaa.service.MailService; +import com.baeldung.jhipster.uaa.service.UserService; +import com.baeldung.jhipster.uaa.service.dto.PasswordChangeDTO; +import com.baeldung.jhipster.uaa.service.dto.UserDTO; +import com.baeldung.jhipster.uaa.web.rest.errors.ExceptionTranslator; +import com.baeldung.jhipster.uaa.web.rest.vm.KeyAndPasswordVM; +import com.baeldung.jhipster.uaa.web.rest.vm.ManagedUserVM; +import org.apache.commons.lang3.RandomStringUtils; + +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.Mock; +import org.mockito.MockitoAnnotations; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.http.MediaType; +import org.springframework.http.converter.HttpMessageConverter; +import org.springframework.security.crypto.password.PasswordEncoder; +import org.springframework.security.test.context.support.WithMockUser; +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.transaction.annotation.Transactional; + +import java.time.Instant; +import java.util.*; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.Mockito.doNothing; +import static org.mockito.Mockito.when; +import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*; + +/** + * Test class for the AccountResource REST controller. + * + * @see AccountResource + */ +@RunWith(SpringRunner.class) +@SpringBootTest(classes = UaaApp.class) +public class AccountResourceIntTest { + + @Autowired + private UserRepository userRepository; + + @Autowired + private AuthorityRepository authorityRepository; + + @Autowired + private UserService userService; + + @Autowired + private PasswordEncoder passwordEncoder; + + @Autowired + private HttpMessageConverter[] httpMessageConverters; + + @Autowired + private ExceptionTranslator exceptionTranslator; + + @Mock + private UserService mockUserService; + + @Mock + private MailService mockMailService; + + private MockMvc restMvc; + + private MockMvc restUserMockMvc; + + @Before + public void setup() { + MockitoAnnotations.initMocks(this); + doNothing().when(mockMailService).sendActivationEmail(any()); + AccountResource accountResource = + new AccountResource(userRepository, userService, mockMailService); + + AccountResource accountUserMockResource = + new AccountResource(userRepository, mockUserService, mockMailService); + this.restMvc = MockMvcBuilders.standaloneSetup(accountResource) + .setMessageConverters(httpMessageConverters) + .setControllerAdvice(exceptionTranslator) + .build(); + this.restUserMockMvc = MockMvcBuilders.standaloneSetup(accountUserMockResource) + .setControllerAdvice(exceptionTranslator) + .build(); + } + + @Test + public void testNonAuthenticatedUser() throws Exception { + restUserMockMvc.perform(get("/api/authenticate") + .accept(MediaType.APPLICATION_JSON)) + .andExpect(status().isOk()) + .andExpect(content().string("")); + } + + @Test + public void testAuthenticatedUser() throws Exception { + restUserMockMvc.perform(get("/api/authenticate") + .with(request -> { + request.setRemoteUser("test"); + return request; + }) + .accept(MediaType.APPLICATION_JSON)) + .andExpect(status().isOk()) + .andExpect(content().string("test")); + } + + @Test + public void testGetExistingAccount() throws Exception { + Set authorities = new HashSet<>(); + Authority authority = new Authority(); + authority.setName(AuthoritiesConstants.ADMIN); + authorities.add(authority); + + User user = new User(); + user.setLogin("test"); + user.setFirstName("john"); + user.setLastName("doe"); + user.setEmail("john.doe@jhipster.com"); + user.setImageUrl("http://placehold.it/50x50"); + user.setLangKey("en"); + user.setAuthorities(authorities); + when(mockUserService.getUserWithAuthorities()).thenReturn(Optional.of(user)); + + restUserMockMvc.perform(get("/api/account") + .accept(MediaType.APPLICATION_JSON)) + .andExpect(status().isOk()) + .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE)) + .andExpect(jsonPath("$.login").value("test")) + .andExpect(jsonPath("$.firstName").value("john")) + .andExpect(jsonPath("$.lastName").value("doe")) + .andExpect(jsonPath("$.email").value("john.doe@jhipster.com")) + .andExpect(jsonPath("$.imageUrl").value("http://placehold.it/50x50")) + .andExpect(jsonPath("$.langKey").value("en")) + .andExpect(jsonPath("$.authorities").value(AuthoritiesConstants.ADMIN)); + } + + @Test + public void testGetUnknownAccount() throws Exception { + when(mockUserService.getUserWithAuthorities()).thenReturn(Optional.empty()); + + restUserMockMvc.perform(get("/api/account") + .accept(MediaType.APPLICATION_PROBLEM_JSON)) + .andExpect(status().isInternalServerError()); + } + + @Test + @Transactional + public void testRegisterValid() throws Exception { + ManagedUserVM validUser = new ManagedUserVM(); + validUser.setLogin("test-register-valid"); + validUser.setPassword("password"); + validUser.setFirstName("Alice"); + validUser.setLastName("Test"); + validUser.setEmail("test-register-valid@example.com"); + validUser.setImageUrl("http://placehold.it/50x50"); + validUser.setLangKey(Constants.DEFAULT_LANGUAGE); + validUser.setAuthorities(Collections.singleton(AuthoritiesConstants.USER)); + assertThat(userRepository.findOneByLogin("test-register-valid").isPresent()).isFalse(); + + restMvc.perform( + post("/api/register") + .contentType(TestUtil.APPLICATION_JSON_UTF8) + .content(TestUtil.convertObjectToJsonBytes(validUser))) + .andExpect(status().isCreated()); + + assertThat(userRepository.findOneByLogin("test-register-valid").isPresent()).isTrue(); + } + + @Test + @Transactional + public void testRegisterInvalidLogin() throws Exception { + ManagedUserVM invalidUser = new ManagedUserVM(); + invalidUser.setLogin("funky-log!n");// <-- invalid + invalidUser.setPassword("password"); + invalidUser.setFirstName("Funky"); + invalidUser.setLastName("One"); + invalidUser.setEmail("funky@example.com"); + invalidUser.setActivated(true); + invalidUser.setImageUrl("http://placehold.it/50x50"); + invalidUser.setLangKey(Constants.DEFAULT_LANGUAGE); + invalidUser.setAuthorities(Collections.singleton(AuthoritiesConstants.USER)); + + restUserMockMvc.perform( + post("/api/register") + .contentType(TestUtil.APPLICATION_JSON_UTF8) + .content(TestUtil.convertObjectToJsonBytes(invalidUser))) + .andExpect(status().isBadRequest()); + + Optional user = userRepository.findOneByEmailIgnoreCase("funky@example.com"); + assertThat(user.isPresent()).isFalse(); + } + + @Test + @Transactional + public void testRegisterInvalidEmail() throws Exception { + ManagedUserVM invalidUser = new ManagedUserVM(); + invalidUser.setLogin("bob"); + invalidUser.setPassword("password"); + invalidUser.setFirstName("Bob"); + invalidUser.setLastName("Green"); + invalidUser.setEmail("invalid");// <-- invalid + invalidUser.setActivated(true); + invalidUser.setImageUrl("http://placehold.it/50x50"); + invalidUser.setLangKey(Constants.DEFAULT_LANGUAGE); + invalidUser.setAuthorities(Collections.singleton(AuthoritiesConstants.USER)); + + restUserMockMvc.perform( + post("/api/register") + .contentType(TestUtil.APPLICATION_JSON_UTF8) + .content(TestUtil.convertObjectToJsonBytes(invalidUser))) + .andExpect(status().isBadRequest()); + + Optional user = userRepository.findOneByLogin("bob"); + assertThat(user.isPresent()).isFalse(); + } + + @Test + @Transactional + public void testRegisterInvalidPassword() throws Exception { + ManagedUserVM invalidUser = new ManagedUserVM(); + invalidUser.setLogin("bob"); + invalidUser.setPassword("123");// password with only 3 digits + invalidUser.setFirstName("Bob"); + invalidUser.setLastName("Green"); + invalidUser.setEmail("bob@example.com"); + invalidUser.setActivated(true); + invalidUser.setImageUrl("http://placehold.it/50x50"); + invalidUser.setLangKey(Constants.DEFAULT_LANGUAGE); + invalidUser.setAuthorities(Collections.singleton(AuthoritiesConstants.USER)); + + restUserMockMvc.perform( + post("/api/register") + .contentType(TestUtil.APPLICATION_JSON_UTF8) + .content(TestUtil.convertObjectToJsonBytes(invalidUser))) + .andExpect(status().isBadRequest()); + + Optional user = userRepository.findOneByLogin("bob"); + assertThat(user.isPresent()).isFalse(); + } + + @Test + @Transactional + public void testRegisterNullPassword() throws Exception { + ManagedUserVM invalidUser = new ManagedUserVM(); + invalidUser.setLogin("bob"); + invalidUser.setPassword(null);// invalid null password + invalidUser.setFirstName("Bob"); + invalidUser.setLastName("Green"); + invalidUser.setEmail("bob@example.com"); + invalidUser.setActivated(true); + invalidUser.setImageUrl("http://placehold.it/50x50"); + invalidUser.setLangKey(Constants.DEFAULT_LANGUAGE); + invalidUser.setAuthorities(Collections.singleton(AuthoritiesConstants.USER)); + + restUserMockMvc.perform( + post("/api/register") + .contentType(TestUtil.APPLICATION_JSON_UTF8) + .content(TestUtil.convertObjectToJsonBytes(invalidUser))) + .andExpect(status().isBadRequest()); + + Optional user = userRepository.findOneByLogin("bob"); + assertThat(user.isPresent()).isFalse(); + } + + @Test + @Transactional + public void testRegisterDuplicateLogin() throws Exception { + // First registration + ManagedUserVM firstUser = new ManagedUserVM(); + firstUser.setLogin("alice"); + firstUser.setPassword("password"); + firstUser.setFirstName("Alice"); + firstUser.setLastName("Something"); + firstUser.setEmail("alice@example.com"); + firstUser.setImageUrl("http://placehold.it/50x50"); + firstUser.setLangKey(Constants.DEFAULT_LANGUAGE); + firstUser.setAuthorities(Collections.singleton(AuthoritiesConstants.USER)); + + // Duplicate login, different email + ManagedUserVM secondUser = new ManagedUserVM(); + secondUser.setLogin(firstUser.getLogin()); + secondUser.setPassword(firstUser.getPassword()); + secondUser.setFirstName(firstUser.getFirstName()); + secondUser.setLastName(firstUser.getLastName()); + secondUser.setEmail("alice2@example.com"); + secondUser.setImageUrl(firstUser.getImageUrl()); + secondUser.setLangKey(firstUser.getLangKey()); + secondUser.setCreatedBy(firstUser.getCreatedBy()); + secondUser.setCreatedDate(firstUser.getCreatedDate()); + secondUser.setLastModifiedBy(firstUser.getLastModifiedBy()); + secondUser.setLastModifiedDate(firstUser.getLastModifiedDate()); + secondUser.setAuthorities(new HashSet<>(firstUser.getAuthorities())); + + // First user + restMvc.perform( + post("/api/register") + .contentType(TestUtil.APPLICATION_JSON_UTF8) + .content(TestUtil.convertObjectToJsonBytes(firstUser))) + .andExpect(status().isCreated()); + + // Second (non activated) user + restMvc.perform( + post("/api/register") + .contentType(TestUtil.APPLICATION_JSON_UTF8) + .content(TestUtil.convertObjectToJsonBytes(secondUser))) + .andExpect(status().isCreated()); + + Optional testUser = userRepository.findOneByEmailIgnoreCase("alice2@example.com"); + assertThat(testUser.isPresent()).isTrue(); + testUser.get().setActivated(true); + userRepository.save(testUser.get()); + + // Second (already activated) user + restMvc.perform( + post("/api/register") + .contentType(TestUtil.APPLICATION_JSON_UTF8) + .content(TestUtil.convertObjectToJsonBytes(secondUser))) + .andExpect(status().is4xxClientError()); + } + + @Test + @Transactional + public void testRegisterDuplicateEmail() throws Exception { + // First user + ManagedUserVM firstUser = new ManagedUserVM(); + firstUser.setLogin("test-register-duplicate-email"); + firstUser.setPassword("password"); + firstUser.setFirstName("Alice"); + firstUser.setLastName("Test"); + firstUser.setEmail("test-register-duplicate-email@example.com"); + firstUser.setImageUrl("http://placehold.it/50x50"); + firstUser.setLangKey(Constants.DEFAULT_LANGUAGE); + firstUser.setAuthorities(Collections.singleton(AuthoritiesConstants.USER)); + + // Register first user + restMvc.perform( + post("/api/register") + .contentType(TestUtil.APPLICATION_JSON_UTF8) + .content(TestUtil.convertObjectToJsonBytes(firstUser))) + .andExpect(status().isCreated()); + + Optional testUser1 = userRepository.findOneByLogin("test-register-duplicate-email"); + assertThat(testUser1.isPresent()).isTrue(); + + // Duplicate email, different login + ManagedUserVM secondUser = new ManagedUserVM(); + secondUser.setLogin("test-register-duplicate-email-2"); + secondUser.setPassword(firstUser.getPassword()); + secondUser.setFirstName(firstUser.getFirstName()); + secondUser.setLastName(firstUser.getLastName()); + secondUser.setEmail(firstUser.getEmail()); + secondUser.setImageUrl(firstUser.getImageUrl()); + secondUser.setLangKey(firstUser.getLangKey()); + secondUser.setAuthorities(new HashSet<>(firstUser.getAuthorities())); + + // Register second (non activated) user + restMvc.perform( + post("/api/register") + .contentType(TestUtil.APPLICATION_JSON_UTF8) + .content(TestUtil.convertObjectToJsonBytes(secondUser))) + .andExpect(status().isCreated()); + + Optional testUser2 = userRepository.findOneByLogin("test-register-duplicate-email"); + assertThat(testUser2.isPresent()).isFalse(); + + Optional testUser3 = userRepository.findOneByLogin("test-register-duplicate-email-2"); + assertThat(testUser3.isPresent()).isTrue(); + + // Duplicate email - with uppercase email address + ManagedUserVM userWithUpperCaseEmail = new ManagedUserVM(); + userWithUpperCaseEmail.setId(firstUser.getId()); + userWithUpperCaseEmail.setLogin("test-register-duplicate-email-3"); + userWithUpperCaseEmail.setPassword(firstUser.getPassword()); + userWithUpperCaseEmail.setFirstName(firstUser.getFirstName()); + userWithUpperCaseEmail.setLastName(firstUser.getLastName()); + userWithUpperCaseEmail.setEmail("TEST-register-duplicate-email@example.com"); + userWithUpperCaseEmail.setImageUrl(firstUser.getImageUrl()); + userWithUpperCaseEmail.setLangKey(firstUser.getLangKey()); + userWithUpperCaseEmail.setAuthorities(new HashSet<>(firstUser.getAuthorities())); + + // Register third (not activated) user + restMvc.perform( + post("/api/register") + .contentType(TestUtil.APPLICATION_JSON_UTF8) + .content(TestUtil.convertObjectToJsonBytes(userWithUpperCaseEmail))) + .andExpect(status().isCreated()); + + Optional testUser4 = userRepository.findOneByLogin("test-register-duplicate-email-3"); + assertThat(testUser4.isPresent()).isTrue(); + assertThat(testUser4.get().getEmail()).isEqualTo("test-register-duplicate-email@example.com"); + + testUser4.get().setActivated(true); + userService.updateUser((new UserDTO(testUser4.get()))); + + // Register 4th (already activated) user + restMvc.perform( + post("/api/register") + .contentType(TestUtil.APPLICATION_JSON_UTF8) + .content(TestUtil.convertObjectToJsonBytes(secondUser))) + .andExpect(status().is4xxClientError()); + } + + @Test + @Transactional + public void testRegisterAdminIsIgnored() throws Exception { + ManagedUserVM validUser = new ManagedUserVM(); + validUser.setLogin("badguy"); + validUser.setPassword("password"); + validUser.setFirstName("Bad"); + validUser.setLastName("Guy"); + validUser.setEmail("badguy@example.com"); + validUser.setActivated(true); + validUser.setImageUrl("http://placehold.it/50x50"); + validUser.setLangKey(Constants.DEFAULT_LANGUAGE); + validUser.setAuthorities(Collections.singleton(AuthoritiesConstants.ADMIN)); + + restMvc.perform( + post("/api/register") + .contentType(TestUtil.APPLICATION_JSON_UTF8) + .content(TestUtil.convertObjectToJsonBytes(validUser))) + .andExpect(status().isCreated()); + + Optional userDup = userRepository.findOneByLogin("badguy"); + assertThat(userDup.isPresent()).isTrue(); + assertThat(userDup.get().getAuthorities()).hasSize(1) + .containsExactly(authorityRepository.findById(AuthoritiesConstants.USER).get()); + } + + @Test + @Transactional + public void testActivateAccount() throws Exception { + final String activationKey = "some activation key"; + User user = new User(); + user.setLogin("activate-account"); + user.setEmail("activate-account@example.com"); + user.setPassword(RandomStringUtils.random(60)); + user.setActivated(false); + user.setActivationKey(activationKey); + + userRepository.saveAndFlush(user); + + restMvc.perform(get("/api/activate?key={activationKey}", activationKey)) + .andExpect(status().isOk()); + + user = userRepository.findOneByLogin(user.getLogin()).orElse(null); + assertThat(user.getActivated()).isTrue(); + } + + @Test + @Transactional + public void testActivateAccountWithWrongKey() throws Exception { + restMvc.perform(get("/api/activate?key=wrongActivationKey")) + .andExpect(status().isInternalServerError()); + } + + @Test + @Transactional + @WithMockUser("save-account") + public void testSaveAccount() throws Exception { + User user = new User(); + user.setLogin("save-account"); + user.setEmail("save-account@example.com"); + user.setPassword(RandomStringUtils.random(60)); + user.setActivated(true); + + userRepository.saveAndFlush(user); + + UserDTO userDTO = new UserDTO(); + userDTO.setLogin("not-used"); + userDTO.setFirstName("firstname"); + userDTO.setLastName("lastname"); + userDTO.setEmail("save-account@example.com"); + userDTO.setActivated(false); + userDTO.setImageUrl("http://placehold.it/50x50"); + userDTO.setLangKey(Constants.DEFAULT_LANGUAGE); + userDTO.setAuthorities(Collections.singleton(AuthoritiesConstants.ADMIN)); + + restMvc.perform( + post("/api/account") + .contentType(TestUtil.APPLICATION_JSON_UTF8) + .content(TestUtil.convertObjectToJsonBytes(userDTO))) + .andExpect(status().isOk()); + + User updatedUser = userRepository.findOneByLogin(user.getLogin()).orElse(null); + assertThat(updatedUser.getFirstName()).isEqualTo(userDTO.getFirstName()); + assertThat(updatedUser.getLastName()).isEqualTo(userDTO.getLastName()); + assertThat(updatedUser.getEmail()).isEqualTo(userDTO.getEmail()); + assertThat(updatedUser.getLangKey()).isEqualTo(userDTO.getLangKey()); + assertThat(updatedUser.getPassword()).isEqualTo(user.getPassword()); + assertThat(updatedUser.getImageUrl()).isEqualTo(userDTO.getImageUrl()); + assertThat(updatedUser.getActivated()).isEqualTo(true); + assertThat(updatedUser.getAuthorities()).isEmpty(); + } + + @Test + @Transactional + @WithMockUser("save-invalid-email") + public void testSaveInvalidEmail() throws Exception { + User user = new User(); + user.setLogin("save-invalid-email"); + user.setEmail("save-invalid-email@example.com"); + user.setPassword(RandomStringUtils.random(60)); + user.setActivated(true); + + userRepository.saveAndFlush(user); + + UserDTO userDTO = new UserDTO(); + userDTO.setLogin("not-used"); + userDTO.setFirstName("firstname"); + userDTO.setLastName("lastname"); + userDTO.setEmail("invalid email"); + userDTO.setActivated(false); + userDTO.setImageUrl("http://placehold.it/50x50"); + userDTO.setLangKey(Constants.DEFAULT_LANGUAGE); + userDTO.setAuthorities(Collections.singleton(AuthoritiesConstants.ADMIN)); + + restMvc.perform( + post("/api/account") + .contentType(TestUtil.APPLICATION_JSON_UTF8) + .content(TestUtil.convertObjectToJsonBytes(userDTO))) + .andExpect(status().isBadRequest()); + + assertThat(userRepository.findOneByEmailIgnoreCase("invalid email")).isNotPresent(); + } + + @Test + @Transactional + @WithMockUser("save-existing-email") + public void testSaveExistingEmail() throws Exception { + User user = new User(); + user.setLogin("save-existing-email"); + user.setEmail("save-existing-email@example.com"); + user.setPassword(RandomStringUtils.random(60)); + user.setActivated(true); + + userRepository.saveAndFlush(user); + + User anotherUser = new User(); + anotherUser.setLogin("save-existing-email2"); + anotherUser.setEmail("save-existing-email2@example.com"); + anotherUser.setPassword(RandomStringUtils.random(60)); + anotherUser.setActivated(true); + + userRepository.saveAndFlush(anotherUser); + + UserDTO userDTO = new UserDTO(); + userDTO.setLogin("not-used"); + userDTO.setFirstName("firstname"); + userDTO.setLastName("lastname"); + userDTO.setEmail("save-existing-email2@example.com"); + userDTO.setActivated(false); + userDTO.setImageUrl("http://placehold.it/50x50"); + userDTO.setLangKey(Constants.DEFAULT_LANGUAGE); + userDTO.setAuthorities(Collections.singleton(AuthoritiesConstants.ADMIN)); + + restMvc.perform( + post("/api/account") + .contentType(TestUtil.APPLICATION_JSON_UTF8) + .content(TestUtil.convertObjectToJsonBytes(userDTO))) + .andExpect(status().isBadRequest()); + + User updatedUser = userRepository.findOneByLogin("save-existing-email").orElse(null); + assertThat(updatedUser.getEmail()).isEqualTo("save-existing-email@example.com"); + } + + @Test + @Transactional + @WithMockUser("save-existing-email-and-login") + public void testSaveExistingEmailAndLogin() throws Exception { + User user = new User(); + user.setLogin("save-existing-email-and-login"); + user.setEmail("save-existing-email-and-login@example.com"); + user.setPassword(RandomStringUtils.random(60)); + user.setActivated(true); + + userRepository.saveAndFlush(user); + + UserDTO userDTO = new UserDTO(); + userDTO.setLogin("not-used"); + userDTO.setFirstName("firstname"); + userDTO.setLastName("lastname"); + userDTO.setEmail("save-existing-email-and-login@example.com"); + userDTO.setActivated(false); + userDTO.setImageUrl("http://placehold.it/50x50"); + userDTO.setLangKey(Constants.DEFAULT_LANGUAGE); + userDTO.setAuthorities(Collections.singleton(AuthoritiesConstants.ADMIN)); + + restMvc.perform( + post("/api/account") + .contentType(TestUtil.APPLICATION_JSON_UTF8) + .content(TestUtil.convertObjectToJsonBytes(userDTO))) + .andExpect(status().isOk()); + + User updatedUser = userRepository.findOneByLogin("save-existing-email-and-login").orElse(null); + assertThat(updatedUser.getEmail()).isEqualTo("save-existing-email-and-login@example.com"); + } + + @Test + @Transactional + @WithMockUser("change-password-wrong-existing-password") + public void testChangePasswordWrongExistingPassword() throws Exception { + User user = new User(); + String currentPassword = RandomStringUtils.random(60); + user.setPassword(passwordEncoder.encode(currentPassword)); + user.setLogin("change-password-wrong-existing-password"); + user.setEmail("change-password-wrong-existing-password@example.com"); + userRepository.saveAndFlush(user); + + restMvc.perform(post("/api/account/change-password") + .contentType(TestUtil.APPLICATION_JSON_UTF8) + .content(TestUtil.convertObjectToJsonBytes(new PasswordChangeDTO("1"+currentPassword, "new password")))) + .andExpect(status().isBadRequest()); + + User updatedUser = userRepository.findOneByLogin("change-password-wrong-existing-password").orElse(null); + assertThat(passwordEncoder.matches("new password", updatedUser.getPassword())).isFalse(); + assertThat(passwordEncoder.matches(currentPassword, updatedUser.getPassword())).isTrue(); + } + + @Test + @Transactional + @WithMockUser("change-password") + public void testChangePassword() throws Exception { + User user = new User(); + String currentPassword = RandomStringUtils.random(60); + user.setPassword(passwordEncoder.encode(currentPassword)); + user.setLogin("change-password"); + user.setEmail("change-password@example.com"); + userRepository.saveAndFlush(user); + + restMvc.perform(post("/api/account/change-password") + .contentType(TestUtil.APPLICATION_JSON_UTF8) + .content(TestUtil.convertObjectToJsonBytes(new PasswordChangeDTO(currentPassword, "new password")))) + .andExpect(status().isOk()); + + User updatedUser = userRepository.findOneByLogin("change-password").orElse(null); + assertThat(passwordEncoder.matches("new password", updatedUser.getPassword())).isTrue(); + } + + @Test + @Transactional + @WithMockUser("change-password-too-small") + public void testChangePasswordTooSmall() throws Exception { + User user = new User(); + String currentPassword = RandomStringUtils.random(60); + user.setPassword(passwordEncoder.encode(currentPassword)); + user.setLogin("change-password-too-small"); + user.setEmail("change-password-too-small@example.com"); + userRepository.saveAndFlush(user); + + restMvc.perform(post("/api/account/change-password") + .contentType(TestUtil.APPLICATION_JSON_UTF8) + .content(TestUtil.convertObjectToJsonBytes(new PasswordChangeDTO(currentPassword, "new")))) + .andExpect(status().isBadRequest()); + + User updatedUser = userRepository.findOneByLogin("change-password-too-small").orElse(null); + assertThat(updatedUser.getPassword()).isEqualTo(user.getPassword()); + } + + @Test + @Transactional + @WithMockUser("change-password-too-long") + public void testChangePasswordTooLong() throws Exception { + User user = new User(); + String currentPassword = RandomStringUtils.random(60); + user.setPassword(passwordEncoder.encode(currentPassword)); + user.setLogin("change-password-too-long"); + user.setEmail("change-password-too-long@example.com"); + userRepository.saveAndFlush(user); + + restMvc.perform(post("/api/account/change-password") + .contentType(TestUtil.APPLICATION_JSON_UTF8) + .content(TestUtil.convertObjectToJsonBytes(new PasswordChangeDTO(currentPassword, RandomStringUtils.random(101))))) + .andExpect(status().isBadRequest()); + + User updatedUser = userRepository.findOneByLogin("change-password-too-long").orElse(null); + assertThat(updatedUser.getPassword()).isEqualTo(user.getPassword()); + } + + @Test + @Transactional + @WithMockUser("change-password-empty") + public void testChangePasswordEmpty() throws Exception { + User user = new User(); + user.setPassword(RandomStringUtils.random(60)); + user.setLogin("change-password-empty"); + user.setEmail("change-password-empty@example.com"); + userRepository.saveAndFlush(user); + + restMvc.perform(post("/api/account/change-password").content(RandomStringUtils.random(0))) + .andExpect(status().isBadRequest()); + + User updatedUser = userRepository.findOneByLogin("change-password-empty").orElse(null); + assertThat(updatedUser.getPassword()).isEqualTo(user.getPassword()); + } + + @Test + @Transactional + public void testRequestPasswordReset() throws Exception { + User user = new User(); + user.setPassword(RandomStringUtils.random(60)); + user.setActivated(true); + user.setLogin("password-reset"); + user.setEmail("password-reset@example.com"); + userRepository.saveAndFlush(user); + + restMvc.perform(post("/api/account/reset-password/init") + .content("password-reset@example.com")) + .andExpect(status().isOk()); + } + + @Test + @Transactional + public void testRequestPasswordResetUpperCaseEmail() throws Exception { + User user = new User(); + user.setPassword(RandomStringUtils.random(60)); + user.setActivated(true); + user.setLogin("password-reset"); + user.setEmail("password-reset@example.com"); + userRepository.saveAndFlush(user); + + restMvc.perform(post("/api/account/reset-password/init") + .content("password-reset@EXAMPLE.COM")) + .andExpect(status().isOk()); + } + + @Test + public void testRequestPasswordResetWrongEmail() throws Exception { + restMvc.perform( + post("/api/account/reset-password/init") + .content("password-reset-wrong-email@example.com")) + .andExpect(status().isBadRequest()); + } + + @Test + @Transactional + public void testFinishPasswordReset() throws Exception { + User user = new User(); + user.setPassword(RandomStringUtils.random(60)); + user.setLogin("finish-password-reset"); + user.setEmail("finish-password-reset@example.com"); + user.setResetDate(Instant.now().plusSeconds(60)); + user.setResetKey("reset key"); + userRepository.saveAndFlush(user); + + KeyAndPasswordVM keyAndPassword = new KeyAndPasswordVM(); + keyAndPassword.setKey(user.getResetKey()); + keyAndPassword.setNewPassword("new password"); + + restMvc.perform( + post("/api/account/reset-password/finish") + .contentType(TestUtil.APPLICATION_JSON_UTF8) + .content(TestUtil.convertObjectToJsonBytes(keyAndPassword))) + .andExpect(status().isOk()); + + User updatedUser = userRepository.findOneByLogin(user.getLogin()).orElse(null); + assertThat(passwordEncoder.matches(keyAndPassword.getNewPassword(), updatedUser.getPassword())).isTrue(); + } + + @Test + @Transactional + public void testFinishPasswordResetTooSmall() throws Exception { + User user = new User(); + user.setPassword(RandomStringUtils.random(60)); + user.setLogin("finish-password-reset-too-small"); + user.setEmail("finish-password-reset-too-small@example.com"); + user.setResetDate(Instant.now().plusSeconds(60)); + user.setResetKey("reset key too small"); + userRepository.saveAndFlush(user); + + KeyAndPasswordVM keyAndPassword = new KeyAndPasswordVM(); + keyAndPassword.setKey(user.getResetKey()); + keyAndPassword.setNewPassword("foo"); + + restMvc.perform( + post("/api/account/reset-password/finish") + .contentType(TestUtil.APPLICATION_JSON_UTF8) + .content(TestUtil.convertObjectToJsonBytes(keyAndPassword))) + .andExpect(status().isBadRequest()); + + User updatedUser = userRepository.findOneByLogin(user.getLogin()).orElse(null); + assertThat(passwordEncoder.matches(keyAndPassword.getNewPassword(), updatedUser.getPassword())).isFalse(); + } + + + @Test + @Transactional + public void testFinishPasswordResetWrongKey() throws Exception { + KeyAndPasswordVM keyAndPassword = new KeyAndPasswordVM(); + keyAndPassword.setKey("wrong reset key"); + keyAndPassword.setNewPassword("new password"); + + restMvc.perform( + post("/api/account/reset-password/finish") + .contentType(TestUtil.APPLICATION_JSON_UTF8) + .content(TestUtil.convertObjectToJsonBytes(keyAndPassword))) + .andExpect(status().isInternalServerError()); + } +} diff --git a/jhipster/jhipster-uaa/uaa/src/test/java/com/baeldung/jhipster/uaa/web/rest/AuditResourceIntTest.java b/jhipster/jhipster-uaa/uaa/src/test/java/com/baeldung/jhipster/uaa/web/rest/AuditResourceIntTest.java new file mode 100644 index 0000000000..24bbaf4b0c --- /dev/null +++ b/jhipster/jhipster-uaa/uaa/src/test/java/com/baeldung/jhipster/uaa/web/rest/AuditResourceIntTest.java @@ -0,0 +1,146 @@ +package com.baeldung.jhipster.uaa.web.rest; + +import com.baeldung.jhipster.uaa.UaaApp; +import com.baeldung.jhipster.uaa.config.audit.AuditEventConverter; +import com.baeldung.jhipster.uaa.domain.PersistentAuditEvent; +import com.baeldung.jhipster.uaa.repository.PersistenceAuditEventRepository; +import com.baeldung.jhipster.uaa.service.AuditEventService; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.MockitoAnnotations; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.data.web.PageableHandlerMethodArgumentResolver; +import org.springframework.format.support.FormattingConversionService; +import org.springframework.http.MediaType; +import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter; +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.transaction.annotation.Transactional; + +import java.time.Instant; + +import static org.hamcrest.Matchers.hasItem; +import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*; + +/** + * Test class for the AuditResource REST controller. + * + * @see AuditResource + */ +@RunWith(SpringRunner.class) +@SpringBootTest(classes = UaaApp.class) +@Transactional +public class AuditResourceIntTest { + + private static final String SAMPLE_PRINCIPAL = "SAMPLE_PRINCIPAL"; + private static final String SAMPLE_TYPE = "SAMPLE_TYPE"; + private static final Instant SAMPLE_TIMESTAMP = Instant.parse("2015-08-04T10:11:30Z"); + private static final long SECONDS_PER_DAY = 60 * 60 * 24; + + @Autowired + private PersistenceAuditEventRepository auditEventRepository; + + @Autowired + private AuditEventConverter auditEventConverter; + + @Autowired + private MappingJackson2HttpMessageConverter jacksonMessageConverter; + + @Autowired + private FormattingConversionService formattingConversionService; + + @Autowired + private PageableHandlerMethodArgumentResolver pageableArgumentResolver; + + private PersistentAuditEvent auditEvent; + + private MockMvc restAuditMockMvc; + + @Before + public void setup() { + MockitoAnnotations.initMocks(this); + AuditEventService auditEventService = + new AuditEventService(auditEventRepository, auditEventConverter); + AuditResource auditResource = new AuditResource(auditEventService); + this.restAuditMockMvc = MockMvcBuilders.standaloneSetup(auditResource) + .setCustomArgumentResolvers(pageableArgumentResolver) + .setConversionService(formattingConversionService) + .setMessageConverters(jacksonMessageConverter).build(); + } + + @Before + public void initTest() { + auditEventRepository.deleteAll(); + auditEvent = new PersistentAuditEvent(); + auditEvent.setAuditEventType(SAMPLE_TYPE); + auditEvent.setPrincipal(SAMPLE_PRINCIPAL); + auditEvent.setAuditEventDate(SAMPLE_TIMESTAMP); + } + + @Test + public void getAllAudits() throws Exception { + // Initialize the database + auditEventRepository.save(auditEvent); + + // Get all the audits + restAuditMockMvc.perform(get("/management/audits")) + .andExpect(status().isOk()) + .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE)) + .andExpect(jsonPath("$.[*].principal").value(hasItem(SAMPLE_PRINCIPAL))); + } + + @Test + public void getAudit() throws Exception { + // Initialize the database + auditEventRepository.save(auditEvent); + + // Get the audit + restAuditMockMvc.perform(get("/management/audits/{id}", auditEvent.getId())) + .andExpect(status().isOk()) + .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE)) + .andExpect(jsonPath("$.principal").value(SAMPLE_PRINCIPAL)); + } + + @Test + public void getAuditsByDate() throws Exception { + // Initialize the database + auditEventRepository.save(auditEvent); + + // Generate dates for selecting audits by date, making sure the period will contain the audit + String fromDate = SAMPLE_TIMESTAMP.minusSeconds(SECONDS_PER_DAY).toString().substring(0, 10); + String toDate = SAMPLE_TIMESTAMP.plusSeconds(SECONDS_PER_DAY).toString().substring(0, 10); + + // Get the audit + restAuditMockMvc.perform(get("/management/audits?fromDate="+fromDate+"&toDate="+toDate)) + .andExpect(status().isOk()) + .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE)) + .andExpect(jsonPath("$.[*].principal").value(hasItem(SAMPLE_PRINCIPAL))); + } + + @Test + public void getNonExistingAuditsByDate() throws Exception { + // Initialize the database + auditEventRepository.save(auditEvent); + + // Generate dates for selecting audits by date, making sure the period will not contain the sample audit + String fromDate = SAMPLE_TIMESTAMP.minusSeconds(2*SECONDS_PER_DAY).toString().substring(0, 10); + String toDate = SAMPLE_TIMESTAMP.minusSeconds(SECONDS_PER_DAY).toString().substring(0, 10); + + // Query audits but expect no results + restAuditMockMvc.perform(get("/management/audits?fromDate=" + fromDate + "&toDate=" + toDate)) + .andExpect(status().isOk()) + .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE)) + .andExpect(header().string("X-Total-Count", "0")); + } + + @Test + public void getNonExistingAudit() throws Exception { + // Get the audit + restAuditMockMvc.perform(get("/management/audits/{id}", Long.MAX_VALUE)) + .andExpect(status().isNotFound()); + } +} diff --git a/jhipster/jhipster-uaa/uaa/src/test/java/com/baeldung/jhipster/uaa/web/rest/LogsResourceIntTest.java b/jhipster/jhipster-uaa/uaa/src/test/java/com/baeldung/jhipster/uaa/web/rest/LogsResourceIntTest.java new file mode 100644 index 0000000000..18ab835be7 --- /dev/null +++ b/jhipster/jhipster-uaa/uaa/src/test/java/com/baeldung/jhipster/uaa/web/rest/LogsResourceIntTest.java @@ -0,0 +1,67 @@ +package com.baeldung.jhipster.uaa.web.rest; + +import com.baeldung.jhipster.uaa.UaaApp; +import com.baeldung.jhipster.uaa.config.SecurityBeanOverrideConfiguration; +import com.baeldung.jhipster.uaa.web.rest.vm.LoggerVM; +import ch.qos.logback.classic.AsyncAppender; +import ch.qos.logback.classic.LoggerContext; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.slf4j.LoggerFactory; +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.setup.MockMvcBuilders; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; +import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.put; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; + +/** + * Test class for the LogsResource REST controller. + * + * @see LogsResource + */ +@RunWith(SpringRunner.class) +@SpringBootTest(classes = UaaApp.class) +public class LogsResourceIntTest { + + private MockMvc restLogsMockMvc; + + @Before + public void setup() { + LogsResource logsResource = new LogsResource(); + this.restLogsMockMvc = MockMvcBuilders + .standaloneSetup(logsResource) + .build(); + } + + @Test + public void getAllLogs() throws Exception { + restLogsMockMvc.perform(get("/management/logs")) + .andExpect(status().isOk()) + .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE)); + } + + @Test + public void changeLogs() throws Exception { + LoggerVM logger = new LoggerVM(); + logger.setLevel("INFO"); + logger.setName("ROOT"); + + restLogsMockMvc.perform(put("/management/logs") + .contentType(TestUtil.APPLICATION_JSON_UTF8) + .content(TestUtil.convertObjectToJsonBytes(logger))) + .andExpect(status().isNoContent()); + } + + @Test + public void testLogstashAppender() { + LoggerContext context = (LoggerContext) LoggerFactory.getILoggerFactory(); + assertThat(context.getLogger("ROOT").getAppender("ASYNC_LOGSTASH")).isInstanceOf(AsyncAppender.class); + } +} diff --git a/jhipster/jhipster-uaa/uaa/src/test/java/com/baeldung/jhipster/uaa/web/rest/TestUtil.java b/jhipster/jhipster-uaa/uaa/src/test/java/com/baeldung/jhipster/uaa/web/rest/TestUtil.java new file mode 100644 index 0000000000..ebacd1e593 --- /dev/null +++ b/jhipster/jhipster-uaa/uaa/src/test/java/com/baeldung/jhipster/uaa/web/rest/TestUtil.java @@ -0,0 +1,135 @@ +package com.baeldung.jhipster.uaa.web.rest; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; +import org.hamcrest.Description; +import org.hamcrest.TypeSafeDiagnosingMatcher; +import org.springframework.format.datetime.standard.DateTimeFormatterRegistrar; +import org.springframework.format.support.DefaultFormattingConversionService; +import org.springframework.format.support.FormattingConversionService; +import org.springframework.http.MediaType; + +import java.io.IOException; +import java.nio.charset.StandardCharsets; +import java.time.ZonedDateTime; +import java.time.format.DateTimeParseException; + +import static org.assertj.core.api.Assertions.assertThat; + +/** + * Utility class for testing REST controllers. + */ +public class TestUtil { + + /** MediaType for JSON UTF8 */ + public static final MediaType APPLICATION_JSON_UTF8 = new MediaType( + MediaType.APPLICATION_JSON.getType(), + MediaType.APPLICATION_JSON.getSubtype(), StandardCharsets.UTF_8); + + /** + * Convert an object to JSON byte array. + * + * @param object + * the object to convert + * @return the JSON byte array + * @throws IOException + */ + public static byte[] convertObjectToJsonBytes(Object object) + throws IOException { + ObjectMapper mapper = new ObjectMapper(); + mapper.setSerializationInclusion(JsonInclude.Include.NON_EMPTY); + + JavaTimeModule module = new JavaTimeModule(); + mapper.registerModule(module); + + return mapper.writeValueAsBytes(object); + } + + /** + * Create a byte array with a specific size filled with specified data. + * + * @param size the size of the byte array + * @param data the data to put in the byte array + * @return the JSON byte array + */ + public static byte[] createByteArray(int size, String data) { + byte[] byteArray = new byte[size]; + for (int i = 0; i < size; i++) { + byteArray[i] = Byte.parseByte(data, 2); + } + return byteArray; + } + + /** + * A matcher that tests that the examined string represents the same instant as the reference datetime. + */ + public static class ZonedDateTimeMatcher extends TypeSafeDiagnosingMatcher { + + private final ZonedDateTime date; + + public ZonedDateTimeMatcher(ZonedDateTime date) { + this.date = date; + } + + @Override + protected boolean matchesSafely(String item, Description mismatchDescription) { + try { + if (!date.isEqual(ZonedDateTime.parse(item))) { + mismatchDescription.appendText("was ").appendValue(item); + return false; + } + return true; + } catch (DateTimeParseException e) { + mismatchDescription.appendText("was ").appendValue(item) + .appendText(", which could not be parsed as a ZonedDateTime"); + return false; + } + + } + + @Override + public void describeTo(Description description) { + description.appendText("a String representing the same Instant as ").appendValue(date); + } + } + + /** + * Creates a matcher that matches when the examined string reprensents the same instant as the reference datetime + * @param date the reference datetime against which the examined string is checked + */ + public static ZonedDateTimeMatcher sameInstant(ZonedDateTime date) { + return new ZonedDateTimeMatcher(date); + } + + /** + * Verifies the equals/hashcode contract on the domain object. + */ + public static void equalsVerifier(Class clazz) throws Exception { + T domainObject1 = clazz.getConstructor().newInstance(); + assertThat(domainObject1.toString()).isNotNull(); + assertThat(domainObject1).isEqualTo(domainObject1); + assertThat(domainObject1.hashCode()).isEqualTo(domainObject1.hashCode()); + // Test with an instance of another class + Object testOtherObject = new Object(); + assertThat(domainObject1).isNotEqualTo(testOtherObject); + assertThat(domainObject1).isNotEqualTo(null); + // Test with an instance of the same class + T domainObject2 = clazz.getConstructor().newInstance(); + assertThat(domainObject1).isNotEqualTo(domainObject2); + // HashCodes are equals because the objects are not persisted yet + assertThat(domainObject1.hashCode()).isEqualTo(domainObject2.hashCode()); + } + + /** + * Create a FormattingConversionService which use ISO date format, instead of the localized one. + * @return the FormattingConversionService + */ + public static FormattingConversionService createFormattingConversionService() { + DefaultFormattingConversionService dfcs = new DefaultFormattingConversionService (); + DateTimeFormatterRegistrar registrar = new DateTimeFormatterRegistrar(); + registrar.setUseIsoFormat(true); + registrar.registerFormatters(dfcs); + return dfcs; + } +} diff --git a/jhipster/jhipster-uaa/uaa/src/test/java/com/baeldung/jhipster/uaa/web/rest/UserResourceIntTest.java b/jhipster/jhipster-uaa/uaa/src/test/java/com/baeldung/jhipster/uaa/web/rest/UserResourceIntTest.java new file mode 100644 index 0000000000..0cbed67a04 --- /dev/null +++ b/jhipster/jhipster-uaa/uaa/src/test/java/com/baeldung/jhipster/uaa/web/rest/UserResourceIntTest.java @@ -0,0 +1,614 @@ +package com.baeldung.jhipster.uaa.web.rest; + +import com.baeldung.jhipster.uaa.UaaApp; +import com.baeldung.jhipster.uaa.domain.Authority; +import com.baeldung.jhipster.uaa.domain.User; +import com.baeldung.jhipster.uaa.repository.UserRepository; +import com.baeldung.jhipster.uaa.security.AuthoritiesConstants; +import com.baeldung.jhipster.uaa.service.MailService; +import com.baeldung.jhipster.uaa.service.UserService; +import com.baeldung.jhipster.uaa.service.dto.UserDTO; +import com.baeldung.jhipster.uaa.service.mapper.UserMapper; +import com.baeldung.jhipster.uaa.web.rest.errors.ExceptionTranslator; +import com.baeldung.jhipster.uaa.web.rest.vm.ManagedUserVM; +import org.apache.commons.lang3.RandomStringUtils; +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.cache.CacheManager; +import org.springframework.data.web.PageableHandlerMethodArgumentResolver; +import org.springframework.http.MediaType; +import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter; +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.transaction.annotation.Transactional; + +import javax.persistence.EntityManager; +import java.time.Instant; +import java.util.*; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.hamcrest.Matchers.hasItems; +import static org.hamcrest.Matchers.hasItem; +import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*; + +/** + * Test class for the UserResource REST controller. + * + * @see UserResource + */ +@RunWith(SpringRunner.class) +@SpringBootTest(classes = UaaApp.class) +public class UserResourceIntTest { + + private static final String DEFAULT_LOGIN = "johndoe"; + private static final String UPDATED_LOGIN = "jhipster"; + + private static final Long DEFAULT_ID = 1L; + + private static final String DEFAULT_PASSWORD = "passjohndoe"; + private static final String UPDATED_PASSWORD = "passjhipster"; + + private static final String DEFAULT_EMAIL = "johndoe@localhost"; + private static final String UPDATED_EMAIL = "jhipster@localhost"; + + private static final String DEFAULT_FIRSTNAME = "john"; + private static final String UPDATED_FIRSTNAME = "jhipsterFirstName"; + + private static final String DEFAULT_LASTNAME = "doe"; + private static final String UPDATED_LASTNAME = "jhipsterLastName"; + + private static final String DEFAULT_IMAGEURL = "http://placehold.it/50x50"; + private static final String UPDATED_IMAGEURL = "http://placehold.it/40x40"; + + private static final String DEFAULT_LANGKEY = "en"; + private static final String UPDATED_LANGKEY = "fr"; + + @Autowired + private UserRepository userRepository; + + @Autowired + private MailService mailService; + + @Autowired + private UserService userService; + + @Autowired + private UserMapper userMapper; + + @Autowired + private MappingJackson2HttpMessageConverter jacksonMessageConverter; + + @Autowired + private PageableHandlerMethodArgumentResolver pageableArgumentResolver; + + @Autowired + private ExceptionTranslator exceptionTranslator; + + @Autowired + private EntityManager em; + + @Autowired + private CacheManager cacheManager; + + private MockMvc restUserMockMvc; + + private User user; + + @Before + public void setup() { + cacheManager.getCache(UserRepository.USERS_BY_LOGIN_CACHE).clear(); + cacheManager.getCache(UserRepository.USERS_BY_EMAIL_CACHE).clear(); + UserResource userResource = new UserResource(userService, userRepository, mailService); + + this.restUserMockMvc = MockMvcBuilders.standaloneSetup(userResource) + .setCustomArgumentResolvers(pageableArgumentResolver) + .setControllerAdvice(exceptionTranslator) + .setMessageConverters(jacksonMessageConverter) + .build(); + } + + /** + * Create a User. + * + * This is a static method, as tests for other entities might also need it, + * if they test an entity which has a required relationship to the User entity. + */ + public static User createEntity(EntityManager em) { + User user = new User(); + user.setLogin(DEFAULT_LOGIN + RandomStringUtils.randomAlphabetic(5)); + user.setPassword(RandomStringUtils.random(60)); + user.setActivated(true); + user.setEmail(RandomStringUtils.randomAlphabetic(5) + DEFAULT_EMAIL); + user.setFirstName(DEFAULT_FIRSTNAME); + user.setLastName(DEFAULT_LASTNAME); + user.setImageUrl(DEFAULT_IMAGEURL); + user.setLangKey(DEFAULT_LANGKEY); + return user; + } + + @Before + public void initTest() { + user = createEntity(em); + user.setLogin(DEFAULT_LOGIN); + user.setEmail(DEFAULT_EMAIL); + } + + @Test + @Transactional + public void createUser() throws Exception { + int databaseSizeBeforeCreate = userRepository.findAll().size(); + + // Create the User + ManagedUserVM managedUserVM = new ManagedUserVM(); + managedUserVM.setLogin(DEFAULT_LOGIN); + managedUserVM.setPassword(DEFAULT_PASSWORD); + managedUserVM.setFirstName(DEFAULT_FIRSTNAME); + managedUserVM.setLastName(DEFAULT_LASTNAME); + managedUserVM.setEmail(DEFAULT_EMAIL); + managedUserVM.setActivated(true); + managedUserVM.setImageUrl(DEFAULT_IMAGEURL); + managedUserVM.setLangKey(DEFAULT_LANGKEY); + managedUserVM.setAuthorities(Collections.singleton(AuthoritiesConstants.USER)); + + restUserMockMvc.perform(post("/api/users") + .contentType(TestUtil.APPLICATION_JSON_UTF8) + .content(TestUtil.convertObjectToJsonBytes(managedUserVM))) + .andExpect(status().isCreated()); + + // Validate the User in the database + List userList = userRepository.findAll(); + assertThat(userList).hasSize(databaseSizeBeforeCreate + 1); + User testUser = userList.get(userList.size() - 1); + assertThat(testUser.getLogin()).isEqualTo(DEFAULT_LOGIN); + assertThat(testUser.getFirstName()).isEqualTo(DEFAULT_FIRSTNAME); + assertThat(testUser.getLastName()).isEqualTo(DEFAULT_LASTNAME); + assertThat(testUser.getEmail()).isEqualTo(DEFAULT_EMAIL); + assertThat(testUser.getImageUrl()).isEqualTo(DEFAULT_IMAGEURL); + assertThat(testUser.getLangKey()).isEqualTo(DEFAULT_LANGKEY); + } + + @Test + @Transactional + public void createUserWithExistingId() throws Exception { + int databaseSizeBeforeCreate = userRepository.findAll().size(); + + ManagedUserVM managedUserVM = new ManagedUserVM(); + managedUserVM.setId(1L); + managedUserVM.setLogin(DEFAULT_LOGIN); + managedUserVM.setPassword(DEFAULT_PASSWORD); + managedUserVM.setFirstName(DEFAULT_FIRSTNAME); + managedUserVM.setLastName(DEFAULT_LASTNAME); + managedUserVM.setEmail(DEFAULT_EMAIL); + managedUserVM.setActivated(true); + managedUserVM.setImageUrl(DEFAULT_IMAGEURL); + managedUserVM.setLangKey(DEFAULT_LANGKEY); + managedUserVM.setAuthorities(Collections.singleton(AuthoritiesConstants.USER)); + + // An entity with an existing ID cannot be created, so this API call must fail + restUserMockMvc.perform(post("/api/users") + .contentType(TestUtil.APPLICATION_JSON_UTF8) + .content(TestUtil.convertObjectToJsonBytes(managedUserVM))) + .andExpect(status().isBadRequest()); + + // Validate the User in the database + List userList = userRepository.findAll(); + assertThat(userList).hasSize(databaseSizeBeforeCreate); + } + + @Test + @Transactional + public void createUserWithExistingLogin() throws Exception { + // Initialize the database + userRepository.saveAndFlush(user); + int databaseSizeBeforeCreate = userRepository.findAll().size(); + + ManagedUserVM managedUserVM = new ManagedUserVM(); + managedUserVM.setLogin(DEFAULT_LOGIN);// this login should already be used + managedUserVM.setPassword(DEFAULT_PASSWORD); + managedUserVM.setFirstName(DEFAULT_FIRSTNAME); + managedUserVM.setLastName(DEFAULT_LASTNAME); + managedUserVM.setEmail("anothermail@localhost"); + managedUserVM.setActivated(true); + managedUserVM.setImageUrl(DEFAULT_IMAGEURL); + managedUserVM.setLangKey(DEFAULT_LANGKEY); + managedUserVM.setAuthorities(Collections.singleton(AuthoritiesConstants.USER)); + + // Create the User + restUserMockMvc.perform(post("/api/users") + .contentType(TestUtil.APPLICATION_JSON_UTF8) + .content(TestUtil.convertObjectToJsonBytes(managedUserVM))) + .andExpect(status().isBadRequest()); + + // Validate the User in the database + List userList = userRepository.findAll(); + assertThat(userList).hasSize(databaseSizeBeforeCreate); + } + + @Test + @Transactional + public void createUserWithExistingEmail() throws Exception { + // Initialize the database + userRepository.saveAndFlush(user); + int databaseSizeBeforeCreate = userRepository.findAll().size(); + + ManagedUserVM managedUserVM = new ManagedUserVM(); + managedUserVM.setLogin("anotherlogin"); + managedUserVM.setPassword(DEFAULT_PASSWORD); + managedUserVM.setFirstName(DEFAULT_FIRSTNAME); + managedUserVM.setLastName(DEFAULT_LASTNAME); + managedUserVM.setEmail(DEFAULT_EMAIL);// this email should already be used + managedUserVM.setActivated(true); + managedUserVM.setImageUrl(DEFAULT_IMAGEURL); + managedUserVM.setLangKey(DEFAULT_LANGKEY); + managedUserVM.setAuthorities(Collections.singleton(AuthoritiesConstants.USER)); + + // Create the User + restUserMockMvc.perform(post("/api/users") + .contentType(TestUtil.APPLICATION_JSON_UTF8) + .content(TestUtil.convertObjectToJsonBytes(managedUserVM))) + .andExpect(status().isBadRequest()); + + // Validate the User in the database + List userList = userRepository.findAll(); + assertThat(userList).hasSize(databaseSizeBeforeCreate); + } + + @Test + @Transactional + public void getAllUsers() throws Exception { + // Initialize the database + userRepository.saveAndFlush(user); + + // Get all the users + restUserMockMvc.perform(get("/api/users?sort=id,desc") + .accept(MediaType.APPLICATION_JSON)) + .andExpect(status().isOk()) + .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE)) + .andExpect(jsonPath("$.[*].login").value(hasItem(DEFAULT_LOGIN))) + .andExpect(jsonPath("$.[*].firstName").value(hasItem(DEFAULT_FIRSTNAME))) + .andExpect(jsonPath("$.[*].lastName").value(hasItem(DEFAULT_LASTNAME))) + .andExpect(jsonPath("$.[*].email").value(hasItem(DEFAULT_EMAIL))) + .andExpect(jsonPath("$.[*].imageUrl").value(hasItem(DEFAULT_IMAGEURL))) + .andExpect(jsonPath("$.[*].langKey").value(hasItem(DEFAULT_LANGKEY))); + } + + @Test + @Transactional + public void getUser() throws Exception { + // Initialize the database + userRepository.saveAndFlush(user); + + assertThat(cacheManager.getCache(UserRepository.USERS_BY_LOGIN_CACHE).get(user.getLogin())).isNull(); + + // Get the user + restUserMockMvc.perform(get("/api/users/{login}", user.getLogin())) + .andExpect(status().isOk()) + .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE)) + .andExpect(jsonPath("$.login").value(user.getLogin())) + .andExpect(jsonPath("$.firstName").value(DEFAULT_FIRSTNAME)) + .andExpect(jsonPath("$.lastName").value(DEFAULT_LASTNAME)) + .andExpect(jsonPath("$.email").value(DEFAULT_EMAIL)) + .andExpect(jsonPath("$.imageUrl").value(DEFAULT_IMAGEURL)) + .andExpect(jsonPath("$.langKey").value(DEFAULT_LANGKEY)); + + assertThat(cacheManager.getCache(UserRepository.USERS_BY_LOGIN_CACHE).get(user.getLogin())).isNotNull(); + } + + @Test + @Transactional + public void getNonExistingUser() throws Exception { + restUserMockMvc.perform(get("/api/users/unknown")) + .andExpect(status().isNotFound()); + } + + @Test + @Transactional + public void updateUser() throws Exception { + // Initialize the database + userRepository.saveAndFlush(user); + int databaseSizeBeforeUpdate = userRepository.findAll().size(); + + // Update the user + User updatedUser = userRepository.findById(user.getId()).get(); + + ManagedUserVM managedUserVM = new ManagedUserVM(); + managedUserVM.setId(updatedUser.getId()); + managedUserVM.setLogin(updatedUser.getLogin()); + managedUserVM.setPassword(UPDATED_PASSWORD); + managedUserVM.setFirstName(UPDATED_FIRSTNAME); + managedUserVM.setLastName(UPDATED_LASTNAME); + managedUserVM.setEmail(UPDATED_EMAIL); + managedUserVM.setActivated(updatedUser.getActivated()); + managedUserVM.setImageUrl(UPDATED_IMAGEURL); + managedUserVM.setLangKey(UPDATED_LANGKEY); + managedUserVM.setCreatedBy(updatedUser.getCreatedBy()); + managedUserVM.setCreatedDate(updatedUser.getCreatedDate()); + managedUserVM.setLastModifiedBy(updatedUser.getLastModifiedBy()); + managedUserVM.setLastModifiedDate(updatedUser.getLastModifiedDate()); + managedUserVM.setAuthorities(Collections.singleton(AuthoritiesConstants.USER)); + + restUserMockMvc.perform(put("/api/users") + .contentType(TestUtil.APPLICATION_JSON_UTF8) + .content(TestUtil.convertObjectToJsonBytes(managedUserVM))) + .andExpect(status().isOk()); + + // Validate the User in the database + List userList = userRepository.findAll(); + assertThat(userList).hasSize(databaseSizeBeforeUpdate); + User testUser = userList.get(userList.size() - 1); + assertThat(testUser.getFirstName()).isEqualTo(UPDATED_FIRSTNAME); + assertThat(testUser.getLastName()).isEqualTo(UPDATED_LASTNAME); + assertThat(testUser.getEmail()).isEqualTo(UPDATED_EMAIL); + assertThat(testUser.getImageUrl()).isEqualTo(UPDATED_IMAGEURL); + assertThat(testUser.getLangKey()).isEqualTo(UPDATED_LANGKEY); + } + + @Test + @Transactional + public void updateUserLogin() throws Exception { + // Initialize the database + userRepository.saveAndFlush(user); + int databaseSizeBeforeUpdate = userRepository.findAll().size(); + + // Update the user + User updatedUser = userRepository.findById(user.getId()).get(); + + ManagedUserVM managedUserVM = new ManagedUserVM(); + managedUserVM.setId(updatedUser.getId()); + managedUserVM.setLogin(UPDATED_LOGIN); + managedUserVM.setPassword(UPDATED_PASSWORD); + managedUserVM.setFirstName(UPDATED_FIRSTNAME); + managedUserVM.setLastName(UPDATED_LASTNAME); + managedUserVM.setEmail(UPDATED_EMAIL); + managedUserVM.setActivated(updatedUser.getActivated()); + managedUserVM.setImageUrl(UPDATED_IMAGEURL); + managedUserVM.setLangKey(UPDATED_LANGKEY); + managedUserVM.setCreatedBy(updatedUser.getCreatedBy()); + managedUserVM.setCreatedDate(updatedUser.getCreatedDate()); + managedUserVM.setLastModifiedBy(updatedUser.getLastModifiedBy()); + managedUserVM.setLastModifiedDate(updatedUser.getLastModifiedDate()); + managedUserVM.setAuthorities(Collections.singleton(AuthoritiesConstants.USER)); + + restUserMockMvc.perform(put("/api/users") + .contentType(TestUtil.APPLICATION_JSON_UTF8) + .content(TestUtil.convertObjectToJsonBytes(managedUserVM))) + .andExpect(status().isOk()); + + // Validate the User in the database + List userList = userRepository.findAll(); + assertThat(userList).hasSize(databaseSizeBeforeUpdate); + User testUser = userList.get(userList.size() - 1); + assertThat(testUser.getLogin()).isEqualTo(UPDATED_LOGIN); + assertThat(testUser.getFirstName()).isEqualTo(UPDATED_FIRSTNAME); + assertThat(testUser.getLastName()).isEqualTo(UPDATED_LASTNAME); + assertThat(testUser.getEmail()).isEqualTo(UPDATED_EMAIL); + assertThat(testUser.getImageUrl()).isEqualTo(UPDATED_IMAGEURL); + assertThat(testUser.getLangKey()).isEqualTo(UPDATED_LANGKEY); + } + + @Test + @Transactional + public void updateUserExistingEmail() throws Exception { + // Initialize the database with 2 users + userRepository.saveAndFlush(user); + + User anotherUser = new User(); + anotherUser.setLogin("jhipster"); + anotherUser.setPassword(RandomStringUtils.random(60)); + anotherUser.setActivated(true); + anotherUser.setEmail("jhipster@localhost"); + anotherUser.setFirstName("java"); + anotherUser.setLastName("hipster"); + anotherUser.setImageUrl(""); + anotherUser.setLangKey("en"); + userRepository.saveAndFlush(anotherUser); + + // Update the user + User updatedUser = userRepository.findById(user.getId()).get(); + + ManagedUserVM managedUserVM = new ManagedUserVM(); + managedUserVM.setId(updatedUser.getId()); + managedUserVM.setLogin(updatedUser.getLogin()); + managedUserVM.setPassword(updatedUser.getPassword()); + managedUserVM.setFirstName(updatedUser.getFirstName()); + managedUserVM.setLastName(updatedUser.getLastName()); + managedUserVM.setEmail("jhipster@localhost");// this email should already be used by anotherUser + managedUserVM.setActivated(updatedUser.getActivated()); + managedUserVM.setImageUrl(updatedUser.getImageUrl()); + managedUserVM.setLangKey(updatedUser.getLangKey()); + managedUserVM.setCreatedBy(updatedUser.getCreatedBy()); + managedUserVM.setCreatedDate(updatedUser.getCreatedDate()); + managedUserVM.setLastModifiedBy(updatedUser.getLastModifiedBy()); + managedUserVM.setLastModifiedDate(updatedUser.getLastModifiedDate()); + managedUserVM.setAuthorities(Collections.singleton(AuthoritiesConstants.USER)); + + restUserMockMvc.perform(put("/api/users") + .contentType(TestUtil.APPLICATION_JSON_UTF8) + .content(TestUtil.convertObjectToJsonBytes(managedUserVM))) + .andExpect(status().isBadRequest()); + } + + @Test + @Transactional + public void updateUserExistingLogin() throws Exception { + // Initialize the database + userRepository.saveAndFlush(user); + + User anotherUser = new User(); + anotherUser.setLogin("jhipster"); + anotherUser.setPassword(RandomStringUtils.random(60)); + anotherUser.setActivated(true); + anotherUser.setEmail("jhipster@localhost"); + anotherUser.setFirstName("java"); + anotherUser.setLastName("hipster"); + anotherUser.setImageUrl(""); + anotherUser.setLangKey("en"); + userRepository.saveAndFlush(anotherUser); + + // Update the user + User updatedUser = userRepository.findById(user.getId()).get(); + + ManagedUserVM managedUserVM = new ManagedUserVM(); + managedUserVM.setId(updatedUser.getId()); + managedUserVM.setLogin("jhipster");// this login should already be used by anotherUser + managedUserVM.setPassword(updatedUser.getPassword()); + managedUserVM.setFirstName(updatedUser.getFirstName()); + managedUserVM.setLastName(updatedUser.getLastName()); + managedUserVM.setEmail(updatedUser.getEmail()); + managedUserVM.setActivated(updatedUser.getActivated()); + managedUserVM.setImageUrl(updatedUser.getImageUrl()); + managedUserVM.setLangKey(updatedUser.getLangKey()); + managedUserVM.setCreatedBy(updatedUser.getCreatedBy()); + managedUserVM.setCreatedDate(updatedUser.getCreatedDate()); + managedUserVM.setLastModifiedBy(updatedUser.getLastModifiedBy()); + managedUserVM.setLastModifiedDate(updatedUser.getLastModifiedDate()); + managedUserVM.setAuthorities(Collections.singleton(AuthoritiesConstants.USER)); + + restUserMockMvc.perform(put("/api/users") + .contentType(TestUtil.APPLICATION_JSON_UTF8) + .content(TestUtil.convertObjectToJsonBytes(managedUserVM))) + .andExpect(status().isBadRequest()); + } + + @Test + @Transactional + public void deleteUser() throws Exception { + // Initialize the database + userRepository.saveAndFlush(user); + int databaseSizeBeforeDelete = userRepository.findAll().size(); + + // Delete the user + restUserMockMvc.perform(delete("/api/users/{login}", user.getLogin()) + .accept(TestUtil.APPLICATION_JSON_UTF8)) + .andExpect(status().isOk()); + + assertThat(cacheManager.getCache(UserRepository.USERS_BY_LOGIN_CACHE).get(user.getLogin())).isNull(); + + // Validate the database is empty + List userList = userRepository.findAll(); + assertThat(userList).hasSize(databaseSizeBeforeDelete - 1); + } + + @Test + @Transactional + public void getAllAuthorities() throws Exception { + restUserMockMvc.perform(get("/api/users/authorities") + .accept(TestUtil.APPLICATION_JSON_UTF8) + .contentType(TestUtil.APPLICATION_JSON_UTF8)) + .andExpect(status().isOk()) + .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE)) + .andExpect(jsonPath("$").isArray()) + .andExpect(jsonPath("$").value(hasItems(AuthoritiesConstants.USER, AuthoritiesConstants.ADMIN))); + } + + @Test + @Transactional + public void testUserEquals() throws Exception { + TestUtil.equalsVerifier(User.class); + User user1 = new User(); + user1.setId(1L); + User user2 = new User(); + user2.setId(user1.getId()); + assertThat(user1).isEqualTo(user2); + user2.setId(2L); + assertThat(user1).isNotEqualTo(user2); + user1.setId(null); + assertThat(user1).isNotEqualTo(user2); + } + + @Test + public void testUserFromId() { + assertThat(userMapper.userFromId(DEFAULT_ID).getId()).isEqualTo(DEFAULT_ID); + assertThat(userMapper.userFromId(null)).isNull(); + } + + @Test + public void testUserDTOtoUser() { + UserDTO userDTO = new UserDTO(); + userDTO.setId(DEFAULT_ID); + userDTO.setLogin(DEFAULT_LOGIN); + userDTO.setFirstName(DEFAULT_FIRSTNAME); + userDTO.setLastName(DEFAULT_LASTNAME); + userDTO.setEmail(DEFAULT_EMAIL); + userDTO.setActivated(true); + userDTO.setImageUrl(DEFAULT_IMAGEURL); + userDTO.setLangKey(DEFAULT_LANGKEY); + userDTO.setCreatedBy(DEFAULT_LOGIN); + userDTO.setLastModifiedBy(DEFAULT_LOGIN); + userDTO.setAuthorities(Collections.singleton(AuthoritiesConstants.USER)); + + User user = userMapper.userDTOToUser(userDTO); + assertThat(user.getId()).isEqualTo(DEFAULT_ID); + assertThat(user.getLogin()).isEqualTo(DEFAULT_LOGIN); + assertThat(user.getFirstName()).isEqualTo(DEFAULT_FIRSTNAME); + assertThat(user.getLastName()).isEqualTo(DEFAULT_LASTNAME); + assertThat(user.getEmail()).isEqualTo(DEFAULT_EMAIL); + assertThat(user.getActivated()).isEqualTo(true); + assertThat(user.getImageUrl()).isEqualTo(DEFAULT_IMAGEURL); + assertThat(user.getLangKey()).isEqualTo(DEFAULT_LANGKEY); + assertThat(user.getCreatedBy()).isNull(); + assertThat(user.getCreatedDate()).isNotNull(); + assertThat(user.getLastModifiedBy()).isNull(); + assertThat(user.getLastModifiedDate()).isNotNull(); + assertThat(user.getAuthorities()).extracting("name").containsExactly(AuthoritiesConstants.USER); + } + + @Test + public void testUserToUserDTO() { + user.setId(DEFAULT_ID); + user.setCreatedBy(DEFAULT_LOGIN); + user.setCreatedDate(Instant.now()); + user.setLastModifiedBy(DEFAULT_LOGIN); + user.setLastModifiedDate(Instant.now()); + Set authorities = new HashSet<>(); + Authority authority = new Authority(); + authority.setName(AuthoritiesConstants.USER); + authorities.add(authority); + user.setAuthorities(authorities); + + UserDTO userDTO = userMapper.userToUserDTO(user); + + assertThat(userDTO.getId()).isEqualTo(DEFAULT_ID); + assertThat(userDTO.getLogin()).isEqualTo(DEFAULT_LOGIN); + assertThat(userDTO.getFirstName()).isEqualTo(DEFAULT_FIRSTNAME); + assertThat(userDTO.getLastName()).isEqualTo(DEFAULT_LASTNAME); + assertThat(userDTO.getEmail()).isEqualTo(DEFAULT_EMAIL); + assertThat(userDTO.isActivated()).isEqualTo(true); + assertThat(userDTO.getImageUrl()).isEqualTo(DEFAULT_IMAGEURL); + assertThat(userDTO.getLangKey()).isEqualTo(DEFAULT_LANGKEY); + assertThat(userDTO.getCreatedBy()).isEqualTo(DEFAULT_LOGIN); + assertThat(userDTO.getCreatedDate()).isEqualTo(user.getCreatedDate()); + assertThat(userDTO.getLastModifiedBy()).isEqualTo(DEFAULT_LOGIN); + assertThat(userDTO.getLastModifiedDate()).isEqualTo(user.getLastModifiedDate()); + assertThat(userDTO.getAuthorities()).containsExactly(AuthoritiesConstants.USER); + assertThat(userDTO.toString()).isNotNull(); + } + + @Test + public void testAuthorityEquals() { + Authority authorityA = new Authority(); + assertThat(authorityA).isEqualTo(authorityA); + assertThat(authorityA).isNotEqualTo(null); + assertThat(authorityA).isNotEqualTo(new Object()); + assertThat(authorityA.hashCode()).isEqualTo(0); + assertThat(authorityA.toString()).isNotNull(); + + Authority authorityB = new Authority(); + assertThat(authorityA).isEqualTo(authorityB); + + authorityB.setName(AuthoritiesConstants.ADMIN); + assertThat(authorityA).isNotEqualTo(authorityB); + + authorityA.setName(AuthoritiesConstants.USER); + assertThat(authorityA).isNotEqualTo(authorityB); + + authorityB.setName(AuthoritiesConstants.USER); + assertThat(authorityA).isEqualTo(authorityB); + assertThat(authorityA.hashCode()).isEqualTo(authorityB.hashCode()); + } +} diff --git a/jhipster/jhipster-uaa/uaa/src/test/java/com/baeldung/jhipster/uaa/web/rest/errors/ExceptionTranslatorIntTest.java b/jhipster/jhipster-uaa/uaa/src/test/java/com/baeldung/jhipster/uaa/web/rest/errors/ExceptionTranslatorIntTest.java new file mode 100644 index 0000000000..25c5b865b7 --- /dev/null +++ b/jhipster/jhipster-uaa/uaa/src/test/java/com/baeldung/jhipster/uaa/web/rest/errors/ExceptionTranslatorIntTest.java @@ -0,0 +1,151 @@ +package com.baeldung.jhipster.uaa.web.rest.errors; + +import com.baeldung.jhipster.uaa.UaaApp; +import com.baeldung.jhipster.uaa.config.SecurityBeanOverrideConfiguration; +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.http.MediaType; +import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter; +import org.springframework.test.context.junit4.SpringRunner; +import org.springframework.test.web.servlet.MockMvc; +import org.springframework.test.web.servlet.setup.MockMvcBuilders; + +import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; +import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; + +/** + * Test class for the ExceptionTranslator controller advice. + * + * @see ExceptionTranslator + */ +@RunWith(SpringRunner.class) +@SpringBootTest(classes = UaaApp.class) +public class ExceptionTranslatorIntTest { + + @Autowired + private ExceptionTranslatorTestController controller; + + @Autowired + private ExceptionTranslator exceptionTranslator; + + @Autowired + private MappingJackson2HttpMessageConverter jacksonMessageConverter; + + private MockMvc mockMvc; + + @Before + public void setup() { + mockMvc = MockMvcBuilders.standaloneSetup(controller) + .setControllerAdvice(exceptionTranslator) + .setMessageConverters(jacksonMessageConverter) + .build(); + } + + @Test + public void testConcurrencyFailure() throws Exception { + mockMvc.perform(get("/test/concurrency-failure")) + .andExpect(status().isConflict()) + .andExpect(content().contentType(MediaType.APPLICATION_PROBLEM_JSON)) + .andExpect(jsonPath("$.message").value(ErrorConstants.ERR_CONCURRENCY_FAILURE)); + } + + @Test + public void testMethodArgumentNotValid() throws Exception { + mockMvc.perform(post("/test/method-argument").content("{}").contentType(MediaType.APPLICATION_JSON)) + .andExpect(status().isBadRequest()) + .andExpect(content().contentType(MediaType.APPLICATION_PROBLEM_JSON)) + .andExpect(jsonPath("$.message").value(ErrorConstants.ERR_VALIDATION)) + .andExpect(jsonPath("$.fieldErrors.[0].objectName").value("testDTO")) + .andExpect(jsonPath("$.fieldErrors.[0].field").value("test")) + .andExpect(jsonPath("$.fieldErrors.[0].message").value("NotNull")); + } + + @Test + public void testParameterizedError() throws Exception { + mockMvc.perform(get("/test/parameterized-error")) + .andExpect(status().isBadRequest()) + .andExpect(content().contentType(MediaType.APPLICATION_PROBLEM_JSON)) + .andExpect(jsonPath("$.message").value("test parameterized error")) + .andExpect(jsonPath("$.params.param0").value("param0_value")) + .andExpect(jsonPath("$.params.param1").value("param1_value")); + } + + @Test + public void testParameterizedError2() throws Exception { + mockMvc.perform(get("/test/parameterized-error2")) + .andExpect(status().isBadRequest()) + .andExpect(content().contentType(MediaType.APPLICATION_PROBLEM_JSON)) + .andExpect(jsonPath("$.message").value("test parameterized error")) + .andExpect(jsonPath("$.params.foo").value("foo_value")) + .andExpect(jsonPath("$.params.bar").value("bar_value")); + } + + @Test + public void testMissingServletRequestPartException() throws Exception { + mockMvc.perform(get("/test/missing-servlet-request-part")) + .andExpect(status().isBadRequest()) + .andExpect(content().contentType(MediaType.APPLICATION_PROBLEM_JSON)) + .andExpect(jsonPath("$.message").value("error.http.400")); + } + + @Test + public void testMissingServletRequestParameterException() throws Exception { + mockMvc.perform(get("/test/missing-servlet-request-parameter")) + .andExpect(status().isBadRequest()) + .andExpect(content().contentType(MediaType.APPLICATION_PROBLEM_JSON)) + .andExpect(jsonPath("$.message").value("error.http.400")); + } + + @Test + public void testAccessDenied() throws Exception { + mockMvc.perform(get("/test/access-denied")) + .andExpect(status().isForbidden()) + .andExpect(content().contentType(MediaType.APPLICATION_PROBLEM_JSON)) + .andExpect(jsonPath("$.message").value("error.http.403")) + .andExpect(jsonPath("$.detail").value("test access denied!")); + } + + @Test + public void testUnauthorized() throws Exception { + mockMvc.perform(get("/test/unauthorized")) + .andExpect(status().isUnauthorized()) + .andExpect(content().contentType(MediaType.APPLICATION_PROBLEM_JSON)) + .andExpect(jsonPath("$.message").value("error.http.401")) + .andExpect(jsonPath("$.path").value("/test/unauthorized")) + .andExpect(jsonPath("$.detail").value("test authentication failed!")); + } + + @Test + public void testMethodNotSupported() throws Exception { + mockMvc.perform(post("/test/access-denied")) + .andExpect(status().isMethodNotAllowed()) + .andExpect(content().contentType(MediaType.APPLICATION_PROBLEM_JSON)) + .andExpect(jsonPath("$.message").value("error.http.405")) + .andExpect(jsonPath("$.detail").value("Request method 'POST' not supported")); + } + + @Test + public void testExceptionWithResponseStatus() throws Exception { + mockMvc.perform(get("/test/response-status")) + .andExpect(status().isBadRequest()) + .andExpect(content().contentType(MediaType.APPLICATION_PROBLEM_JSON)) + .andExpect(jsonPath("$.message").value("error.http.400")) + .andExpect(jsonPath("$.title").value("test response status")); + } + + @Test + public void testInternalServerError() throws Exception { + mockMvc.perform(get("/test/internal-server-error")) + .andExpect(status().isInternalServerError()) + .andExpect(content().contentType(MediaType.APPLICATION_PROBLEM_JSON)) + .andExpect(jsonPath("$.message").value("error.http.500")) + .andExpect(jsonPath("$.title").value("Internal Server Error")); + } + +} diff --git a/jhipster/jhipster-uaa/uaa/src/test/java/com/baeldung/jhipster/uaa/web/rest/errors/ExceptionTranslatorTestController.java b/jhipster/jhipster-uaa/uaa/src/test/java/com/baeldung/jhipster/uaa/web/rest/errors/ExceptionTranslatorTestController.java new file mode 100644 index 0000000000..0ea0445563 --- /dev/null +++ b/jhipster/jhipster-uaa/uaa/src/test/java/com/baeldung/jhipster/uaa/web/rest/errors/ExceptionTranslatorTestController.java @@ -0,0 +1,86 @@ +package com.baeldung.jhipster.uaa.web.rest.errors; + +import org.springframework.dao.ConcurrencyFailureException; +import org.springframework.http.HttpStatus; +import org.springframework.security.access.AccessDeniedException; +import org.springframework.security.authentication.BadCredentialsException; +import org.springframework.web.bind.annotation.*; + +import javax.validation.Valid; +import javax.validation.constraints.NotNull; +import java.util.HashMap; +import java.util.Map; + +@RestController +public class ExceptionTranslatorTestController { + + @GetMapping("/test/concurrency-failure") + public void concurrencyFailure() { + throw new ConcurrencyFailureException("test concurrency failure"); + } + + @PostMapping("/test/method-argument") + public void methodArgument(@Valid @RequestBody TestDTO testDTO) { + } + + @GetMapping("/test/parameterized-error") + public void parameterizedError() { + throw new CustomParameterizedException("test parameterized error", "param0_value", "param1_value"); + } + + @GetMapping("/test/parameterized-error2") + public void parameterizedError2() { + Map params = new HashMap<>(); + params.put("foo", "foo_value"); + params.put("bar", "bar_value"); + throw new CustomParameterizedException("test parameterized error", params); + } + + @GetMapping("/test/missing-servlet-request-part") + public void missingServletRequestPartException(@RequestPart String part) { + } + + @GetMapping("/test/missing-servlet-request-parameter") + public void missingServletRequestParameterException(@RequestParam String param) { + } + + @GetMapping("/test/access-denied") + public void accessdenied() { + throw new AccessDeniedException("test access denied!"); + } + + @GetMapping("/test/unauthorized") + public void unauthorized() { + throw new BadCredentialsException("test authentication failed!"); + } + + @GetMapping("/test/response-status") + public void exceptionWithReponseStatus() { + throw new TestResponseStatusException(); + } + + @GetMapping("/test/internal-server-error") + public void internalServerError() { + throw new RuntimeException(); + } + + public static class TestDTO { + + @NotNull + private String test; + + public String getTest() { + return test; + } + + public void setTest(String test) { + this.test = test; + } + } + + @ResponseStatus(value = HttpStatus.BAD_REQUEST, reason = "test response status") + @SuppressWarnings("serial") + public static class TestResponseStatusException extends RuntimeException { + } + +} diff --git a/jhipster/jhipster-uaa/uaa/src/test/java/com/baeldung/jhipster/uaa/web/rest/util/PaginationUtilUnitTest.java b/jhipster/jhipster-uaa/uaa/src/test/java/com/baeldung/jhipster/uaa/web/rest/util/PaginationUtilUnitTest.java new file mode 100644 index 0000000000..998a1da0cf --- /dev/null +++ b/jhipster/jhipster-uaa/uaa/src/test/java/com/baeldung/jhipster/uaa/web/rest/util/PaginationUtilUnitTest.java @@ -0,0 +1,44 @@ +package com.baeldung.jhipster.uaa.web.rest.util; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; + +import java.util.ArrayList; +import java.util.List; + +import org.junit.Test; +import org.springframework.data.domain.Page; +import org.springframework.data.domain.PageImpl; +import org.springframework.data.domain.PageRequest; +import org.springframework.http.HttpHeaders; + +/** + * Tests based on parsing algorithm in app/components/util/pagination-util.service.js + * + * @see PaginationUtil + */ +public class PaginationUtilUnitTest { + + @Test + public void generatePaginationHttpHeadersTest() { + String baseUrl = "/api/_search/example"; + List content = new ArrayList<>(); + Page page = new PageImpl<>(content, PageRequest.of(6, 50), 400L); + HttpHeaders headers = PaginationUtil.generatePaginationHttpHeaders(page, baseUrl); + List strHeaders = headers.get(HttpHeaders.LINK); + assertNotNull(strHeaders); + assertTrue(strHeaders.size() == 1); + String headerData = strHeaders.get(0); + assertTrue(headerData.split(",").length == 4); + String expectedData = "; rel=\"next\"," + + "; rel=\"prev\"," + + "; rel=\"last\"," + + "; rel=\"first\""; + assertEquals(expectedData, headerData); + List xTotalCountHeaders = headers.get("X-Total-Count"); + assertTrue(xTotalCountHeaders.size() == 1); + assertTrue(Long.valueOf(xTotalCountHeaders.get(0)).equals(400L)); + } + +} diff --git a/jhipster/jhipster-uaa/uaa/src/test/resources/config/application.yml b/jhipster/jhipster-uaa/uaa/src/test/resources/config/application.yml new file mode 100644 index 0000000000..d5389ee223 --- /dev/null +++ b/jhipster/jhipster-uaa/uaa/src/test/resources/config/application.yml @@ -0,0 +1,120 @@ +# =================================================================== +# Spring Boot configuration. +# +# This configuration is used for unit/integration tests. +# +# More information on profiles: https://www.jhipster.tech/profiles/ +# More information on configuration properties: https://www.jhipster.tech/common-application-properties/ +# =================================================================== + +# =================================================================== +# Standard Spring Boot properties. +# Full reference is available at: +# http://docs.spring.io/spring-boot/docs/current/reference/html/common-application-properties.html +# =================================================================== + +eureka: + client: + enabled: false + instance: + appname: uaa + instanceId: uaa:${spring.application.instance-id:${random.value}} + +spring: + application: + name: uaa + cache: + type: simple + datasource: + type: com.zaxxer.hikari.HikariDataSource + url: jdbc:h2:mem:uaa;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE + name: + username: + password: + hikari: + auto-commit: false + jpa: + database-platform: io.github.jhipster.domain.util.FixedH2Dialect + database: H2 + open-in-view: false + show-sql: false + hibernate: + ddl-auto: none + naming: + physical-strategy: org.springframework.boot.orm.jpa.hibernate.SpringPhysicalNamingStrategy + implicit-strategy: org.springframework.boot.orm.jpa.hibernate.SpringImplicitNamingStrategy + properties: + hibernate.id.new_generator_mappings: true + hibernate.connection.provider_disables_autocommit: true + hibernate.cache.use_second_level_cache: false + hibernate.cache.use_query_cache: false + hibernate.generate_statistics: true + hibernate.hbm2ddl.auto: validate + liquibase: + contexts: test + mail: + host: localhost + messages: + basename: i18n/messages + mvc: + favicon: + enabled: false + thymeleaf: + mode: HTML + + +server: + port: 10344 + address: localhost + +info: + project: + version: #project.version# + +# =================================================================== +# JHipster specific properties +# +# Full reference is available at: https://www.jhipster.tech/common-application-properties/ +# =================================================================== + +jhipster: + async: + core-pool-size: 1 + max-pool-size: 50 + queue-capacity: 10000 + # To test logstash appender + logging: + logstash: + enabled: true + host: localhost + port: 5000 + queue-size: 512 + mail: + from: test@localhost + base-url: http://127.0.0.1:8080 + security: + authentication: + jwt: + # This token must be encoded using Base64 (you can type `echo 'secret-key'|base64` on your command line) + base64-secret: ZTljMjA0NzA0OWE0MTVhM2Y2MjJkNzg2MzU4NDFhYTZhM2JlOGY4MmM0Y2M4ZTQ3NzdkNjVjZmJkMTFhOGU2MmY3MWMzNDg4OGY2OWI2Zjc4NTFhNDVkOTZlMDVhNzFkNDUyZjMzNDYxNGY5NWNmYTI4NzA2NzRkYzQ4Y2ZiZjU= + # Token is valid 24 hours + token-validity-in-seconds: 86400 + client-authorization: + client-id: internal + client-secret: internal + metrics: # DropWizard Metrics configuration, used by MetricsConfiguration + jmx.enabled: true + logs: # Reports Dropwizard metrics in the logs + enabled: true + report-frequency: 60 # in seconds + +# =================================================================== +# Application specific properties +# Add your own application properties here, see the ApplicationProperties class +# to have type-safe configuration, like in the JHipsterProperties above +# +# More documentation is available at: +# https://www.jhipster.tech/common-application-properties/ +# =================================================================== + +# application: diff --git a/jhipster/jhipster-uaa/uaa/src/test/resources/config/bootstrap.yml b/jhipster/jhipster-uaa/uaa/src/test/resources/config/bootstrap.yml new file mode 100644 index 0000000000..11cd6af21c --- /dev/null +++ b/jhipster/jhipster-uaa/uaa/src/test/resources/config/bootstrap.yml @@ -0,0 +1,4 @@ +spring: + cloud: + config: + enabled: false diff --git a/jhipster/jhipster-uaa/uaa/src/test/resources/i18n/messages_en.properties b/jhipster/jhipster-uaa/uaa/src/test/resources/i18n/messages_en.properties new file mode 100644 index 0000000000..f19db8692f --- /dev/null +++ b/jhipster/jhipster-uaa/uaa/src/test/resources/i18n/messages_en.properties @@ -0,0 +1 @@ +email.test.title=test title diff --git a/jhipster/jhipster-uaa/uaa/src/test/resources/logback.xml b/jhipster/jhipster-uaa/uaa/src/test/resources/logback.xml new file mode 100644 index 0000000000..4d3a18bcba --- /dev/null +++ b/jhipster/jhipster-uaa/uaa/src/test/resources/logback.xml @@ -0,0 +1,43 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/jhipster/jhipster-uaa/uaa/src/test/resources/templates/mail/testEmail.html b/jhipster/jhipster-uaa/uaa/src/test/resources/templates/mail/testEmail.html new file mode 100644 index 0000000000..a4ca16a79f --- /dev/null +++ b/jhipster/jhipster-uaa/uaa/src/test/resources/templates/mail/testEmail.html @@ -0,0 +1 @@ + diff --git a/jib/README.md b/jib/README.md new file mode 100644 index 0000000000..82bd2fed42 --- /dev/null +++ b/jib/README.md @@ -0,0 +1,3 @@ +### Relevant Articles: + +- [Dockerizing Java Apps using Jib](https://www.baeldung.com/jib-dockerizing) diff --git a/jib/pom.xml b/jib/pom.xml new file mode 100644 index 0000000000..e71250f157 --- /dev/null +++ b/jib/pom.xml @@ -0,0 +1,57 @@ + + 4.0.0 + jib + 0.1-SNAPSHOT + jib + + + parent-boot-2 + com.baeldung + 0.0.1-SNAPSHOT + ../parent-boot-2 + + + + + org.springframework.boot + spring-boot-starter-web + + + + + 1.8 + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + com.google.cloud.tools + jib-maven-plugin + 0.9.10 + + + registry.hub.docker.com/baeldungjib/jib-spring-boot-app + + + + + + + + + spring-releases + https://repo.spring.io/libs-release + + + + + spring-releases + https://repo.spring.io/libs-release + + + diff --git a/spring-boot/src/main/java/com/baeldung/mongodb/Application.java b/jib/src/main/java/com/baeldung/Application.java similarity index 89% rename from spring-boot/src/main/java/com/baeldung/mongodb/Application.java rename to jib/src/main/java/com/baeldung/Application.java index 092ce3352b..8c087476bf 100644 --- a/spring-boot/src/main/java/com/baeldung/mongodb/Application.java +++ b/jib/src/main/java/com/baeldung/Application.java @@ -1,11 +1,12 @@ -package com.baeldung.mongodb; +package com.baeldung; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication public class Application { + public static void main(String[] args) { SpringApplication.run(Application.class, args); } -} +} \ No newline at end of file diff --git a/jib/src/main/java/com/baeldung/Greeting.java b/jib/src/main/java/com/baeldung/Greeting.java new file mode 100644 index 0000000000..62834d9752 --- /dev/null +++ b/jib/src/main/java/com/baeldung/Greeting.java @@ -0,0 +1,20 @@ +package com.baeldung; + +public class Greeting { + + private final long id; + private final String content; + + public Greeting(long id, String content) { + this.id = id; + this.content = content; + } + + public long getId() { + return id; + } + + public String getContent() { + return content; + } +} \ No newline at end of file diff --git a/jib/src/main/java/com/baeldung/GreetingController.java b/jib/src/main/java/com/baeldung/GreetingController.java new file mode 100644 index 0000000000..0b082b0001 --- /dev/null +++ b/jib/src/main/java/com/baeldung/GreetingController.java @@ -0,0 +1,20 @@ +package com.baeldung; + +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; + +import java.util.concurrent.atomic.AtomicLong; + +@RestController +public class GreetingController { + + private static final String template = "Hello Docker, %s!"; + private final AtomicLong counter = new AtomicLong(); + + @GetMapping("/greeting") + public Greeting greeting(@RequestParam(value="name", defaultValue="World") String name) { + return new Greeting(counter.incrementAndGet(), + String.format(template, name)); + } +} \ No newline at end of file diff --git a/jni/pom.xml b/jni/pom.xml index d4cc409d33..4850e07ed7 100644 --- a/jni/pom.xml +++ b/jni/pom.xml @@ -2,7 +2,8 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 jni - + jni + com.baeldung parent-modules diff --git a/jsf/pom.xml b/jsf/pom.xml index 2ac8a9f7c2..fc6d4a0ee2 100644 --- a/jsf/pom.xml +++ b/jsf/pom.xml @@ -4,6 +4,7 @@ 4.0.0 jsf 0.1-SNAPSHOT + jsf war diff --git a/json/README.md b/json/README.md index e0679bc60b..2e253a4ae9 100644 --- a/json/README.md +++ b/json/README.md @@ -9,4 +9,5 @@ - [Introduction to JsonPath](http://www.baeldung.com/guide-to-jayway-jsonpath) - [Introduction to JSON-Java (org.json)](http://www.baeldung.com/java-org-json) - [Overview of JSON Pointer](https://www.baeldung.com/json-pointer) -- [Introduction to the JSON Binding API (JSR 367) in Java](http://www.baeldung.com/java-json-binding-api) \ No newline at end of file +- [Introduction to the JSON Binding API (JSR 367) in Java](http://www.baeldung.com/java-json-binding-api) +- [Get a Value by Key in a JSONArray](https://www.baeldung.com/java-jsonarray-get-value-by-key) diff --git a/json/pom.xml b/json/pom.xml index b688baec06..fce2d26db5 100644 --- a/json/pom.xml +++ b/json/pom.xml @@ -4,7 +4,8 @@ org.baeldung json 0.0.1-SNAPSHOT - + json + com.baeldung parent-modules @@ -32,6 +33,16 @@ org.json json 20171018 + + + com.google.code.gson + gson + 2.8.5 + + + com.fasterxml.jackson.core + jackson-databind + 2.9.7 javax.json.bind diff --git a/json/src/main/java/com/baeldung/escape/JsonEscape.java b/json/src/main/java/com/baeldung/escape/JsonEscape.java new file mode 100644 index 0000000000..1e5f0d87cb --- /dev/null +++ b/json/src/main/java/com/baeldung/escape/JsonEscape.java @@ -0,0 +1,41 @@ +package com.baeldung.escape; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.google.gson.JsonObject; +import org.json.JSONObject; + +class JsonEscape { + + String escapeJson(String input) { + JSONObject jsonObject = new JSONObject(); + jsonObject.put("message", input); + return jsonObject.toString(); + } + + String escapeGson(String input) { + JsonObject gsonObject = new JsonObject(); + gsonObject.addProperty("message", input); + return gsonObject.toString(); + } + + String escapeJackson(String input) throws JsonProcessingException { + return new ObjectMapper().writeValueAsString(new Payload(input)); + } + + static class Payload { + String message; + + Payload(String message) { + this.message = message; + } + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + } +} diff --git a/json/src/main/java/com/baeldung/jsonjava/JSONArrayGetValueByKey.java b/json/src/main/java/com/baeldung/jsonjava/JSONArrayGetValueByKey.java new file mode 100644 index 0000000000..b3df318e22 --- /dev/null +++ b/json/src/main/java/com/baeldung/jsonjava/JSONArrayGetValueByKey.java @@ -0,0 +1,30 @@ +package com.baeldung.jsonjava; + +import java.util.ArrayList; +import java.util.List; +import java.util.stream.Collectors; +import java.util.stream.IntStream; + +import org.json.JSONArray; +import org.json.JSONObject; + +public class JSONArrayGetValueByKey { + + public List getValuesByKeyInJSONArray(String jsonArrayStr, String key) { + List values = new ArrayList<>(); + JSONArray jsonArray = new JSONArray(jsonArrayStr); + for (int idx = 0; idx < jsonArray.length(); idx++) { + JSONObject jsonObj = jsonArray.getJSONObject(idx); + values.add(jsonObj.optString(key)); + } + return values; + } + + public List getValuesByKeyInJSONArrayUsingJava8(String jsonArrayStr, String key) { + JSONArray jsonArray = new JSONArray(jsonArrayStr); + return IntStream.range(0, jsonArray.length()) + .mapToObj(index -> ((JSONObject) jsonArray.get(index)).optString(key)) + .collect(Collectors.toList()); + } + +} diff --git a/json/src/test/java/com/baeldung/escape/JsonEscapeUnitTest.java b/json/src/test/java/com/baeldung/escape/JsonEscapeUnitTest.java new file mode 100644 index 0000000000..e959fa227b --- /dev/null +++ b/json/src/test/java/com/baeldung/escape/JsonEscapeUnitTest.java @@ -0,0 +1,36 @@ +package com.baeldung.escape; + +import com.fasterxml.jackson.core.JsonProcessingException; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.*; + +class JsonEscapeUnitTest { + + private JsonEscape testedInstance; + private static final String EXPECTED = "{\"message\":\"Hello \\\"World\\\"\"}"; + + @BeforeEach + void setUp() { + testedInstance = new JsonEscape(); + } + + @Test + void escapeJson() { + String actual = testedInstance.escapeJson("Hello \"World\""); + assertEquals(EXPECTED, actual); + } + + @Test + void escapeGson() { + String actual = testedInstance.escapeGson("Hello \"World\""); + assertEquals(EXPECTED, actual); + } + + @Test + void escapeJackson() throws JsonProcessingException { + String actual = testedInstance.escapeJackson("Hello \"World\""); + assertEquals(EXPECTED, actual); + } +} \ No newline at end of file diff --git a/json/src/test/java/com/baeldung/jsonjava/JSONArrayGetValueByKeyUnitTest.java b/json/src/test/java/com/baeldung/jsonjava/JSONArrayGetValueByKeyUnitTest.java new file mode 100644 index 0000000000..265c603acd --- /dev/null +++ b/json/src/test/java/com/baeldung/jsonjava/JSONArrayGetValueByKeyUnitTest.java @@ -0,0 +1,35 @@ +package com.baeldung.jsonjava; + +import java.util.Arrays; +import java.util.List; + +import org.junit.Test; + +import static org.junit.Assert.assertThat; +import static org.hamcrest.CoreMatchers.equalTo; + +public class JSONArrayGetValueByKeyUnitTest { + + private static final JSONArrayGetValueByKey obj = new JSONArrayGetValueByKey(); + + @Test + public void givenJSONArrayAndAKey_thenReturnAllValuesForGivenKey() { + String jsonStr = "[" + " {" + " \"name\": \"John\"," + " \"city\": \"chicago\"," + " \"age\": \"22\" " + "}," + " { " + "\"name\": \"Gary\"," + " \"city\": \"florida\"," + " \"age\": \"35\" " + "}," + " { " + "\"name\": \"Selena\"," + + " \"city\": \"vegas\"," + " \"age\": \"18\" " + "} " + "]"; + + List actualValues = obj.getValuesByKeyInJSONArray(jsonStr, "name"); + + assertThat(actualValues, equalTo(Arrays.asList("John", "Gary", "Selena"))); + } + + @Test + public void givenJSONArrayAndAKey_whenUsingJava8Syntax_thenReturnAllValuesForGivenKey() { + String jsonStr = "[" + " {" + " \"name\": \"John\"," + " \"city\": \"chicago\"," + " \"age\": \"22\" " + "}," + " { " + "\"name\": \"Gary\"," + " \"city\": \"florida\"," + " \"age\": \"35\" " + "}," + " { " + "\"name\": \"Selena\"," + + " \"city\": \"vegas\"," + " \"age\": \"18\" " + "} " + "]"; + + List actualValues = obj.getValuesByKeyInJSONArrayUsingJava8(jsonStr, "name"); + + assertThat(actualValues, equalTo(Arrays.asList("John", "Gary", "Selena"))); + } + +} diff --git a/jsoup/pom.xml b/jsoup/pom.xml index 2704d7bc00..f6e25e7a23 100644 --- a/jsoup/pom.xml +++ b/jsoup/pom.xml @@ -3,6 +3,7 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 jsoup + jsoup jar diff --git a/jta/pom.xml b/jta/pom.xml index 89bdccf25e..4754c1872b 100644 --- a/jta/pom.xml +++ b/jta/pom.xml @@ -3,8 +3,9 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 com.baeldung - jta-demo + jta 1.0-SNAPSHOT + jta jar JEE JTA demo diff --git a/jta/src/main/java/com/baeldung/jtademo/services/TellerService.java b/jta/src/main/java/com/baeldung/jtademo/services/TellerService.java index d3bd80a2ee..f79238e66a 100644 --- a/jta/src/main/java/com/baeldung/jtademo/services/TellerService.java +++ b/jta/src/main/java/com/baeldung/jtademo/services/TellerService.java @@ -25,7 +25,7 @@ public class TellerService { bankAccountService.transfer(fromAccontId, toAccountId, amount); auditService.log(fromAccontId, toAccountId, amount); BigDecimal balance = bankAccountService.balanceOf(fromAccontId); - if (balance.compareTo(BigDecimal.ZERO) <= 0) { + if (balance.compareTo(BigDecimal.ZERO) < 0) { throw new RuntimeException("Insufficient fund."); } } @@ -35,7 +35,7 @@ public class TellerService { bankAccountService.transfer(fromAccontId, toAccountId, amount); auditService.log(fromAccontId, toAccountId, amount); BigDecimal balance = bankAccountService.balanceOf(fromAccontId); - if (balance.compareTo(BigDecimal.ZERO) <= 0) { + if (balance.compareTo(BigDecimal.ZERO) < 0) { userTransaction.rollback(); throw new RuntimeException("Insufficient fund."); } else { diff --git a/jws/pom.xml b/jws/pom.xml index 1970ab9921..2c89b687f8 100644 --- a/jws/pom.xml +++ b/jws/pom.xml @@ -3,9 +3,9 @@ 4.0.0 com.example jws - war 0.0.1-SNAPSHOT - jws-example + jws + war com.baeldung diff --git a/kotlin-libraries/README.md b/kotlin-libraries/README.md index 30c4d03ded..d1ef77aa46 100644 --- a/kotlin-libraries/README.md +++ b/kotlin-libraries/README.md @@ -7,3 +7,5 @@ - [Processing JSON with Kotlin and Klaxson](http://www.baeldung.com/kotlin-json-klaxson) - [Kotlin with Ktor](http://www.baeldung.com/kotlin-ktor) - [Guide to the Kotlin Exposed Framework](https://www.baeldung.com/kotlin-exposed-persistence) +- [Working with Dates in Kotlin](https://www.baeldung.com/kotlin-dates) +- [Introduction to Arrow in Kotlin](https://www.baeldung.com/kotlin-arrow) diff --git a/kotlin-libraries/pom.xml b/kotlin-libraries/pom.xml index c5b7fed951..ae77a9aa2d 100644 --- a/kotlin-libraries/pom.xml +++ b/kotlin-libraries/pom.xml @@ -3,6 +3,7 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 kotlin-libraries + kotlin-libraries jar @@ -87,6 +88,13 @@ h2 ${h2database.version} + + + io.arrow-kt + arrow-core + 0.7.3 + + diff --git a/kotlin-libraries/src/main/kotlin/com/baeldung/kotlin/arrow/FunctionalErrorHandlingWithEither.kt b/kotlin-libraries/src/main/kotlin/com/baeldung/kotlin/arrow/FunctionalErrorHandlingWithEither.kt new file mode 100644 index 0000000000..75dfb9a2a4 --- /dev/null +++ b/kotlin-libraries/src/main/kotlin/com/baeldung/kotlin/arrow/FunctionalErrorHandlingWithEither.kt @@ -0,0 +1,54 @@ +package com.baeldung.kotlin.arrow + +import arrow.core.Either +import arrow.core.filterOrElse +import kotlin.math.sqrt + +class FunctionalErrorHandlingWithEither { + + sealed class ComputeProblem { + object OddNumber : ComputeProblem() + object NotANumber : ComputeProblem() + } + + fun parseInput(s : String) : Either = Either.cond(s.toIntOrNull() != null, {-> s.toInt()}, {->ComputeProblem.NotANumber} ) + + fun isEven(x : Int) : Boolean = x % 2 == 0 + + fun biggestDivisor(x: Int) : Int = biggestDivisor(x, 2) + + fun biggestDivisor(x : Int, y : Int) : Int { + if(x == y){ + return 1; + } + if(x % y == 0){ + return x / y; + } + return biggestDivisor(x, y+1) + } + + fun isSquareNumber(x : Int) : Boolean { + val sqrt: Double = sqrt(x.toDouble()) + return sqrt % 1.0 == 0.0 + } + + fun computeWithEither(input : String) : Either { + return parseInput(input) + .filterOrElse(::isEven) {->ComputeProblem.OddNumber} + .map (::biggestDivisor) + .map (::isSquareNumber) + } + + fun computeWithEitherClient(input : String) { + val computeWithEither = computeWithEither(input) + + when(computeWithEither){ + is Either.Right -> "The greatest divisor is square number: ${computeWithEither.b}" + is Either.Left -> when(computeWithEither.a){ + is ComputeProblem.NotANumber -> "Wrong input! Not a number!" + is ComputeProblem.OddNumber -> "It is an odd number!" + } + } + } + +} \ No newline at end of file diff --git a/kotlin-libraries/src/main/kotlin/com/baeldung/kotlin/arrow/FunctionalErrorHandlingWithOption.kt b/kotlin-libraries/src/main/kotlin/com/baeldung/kotlin/arrow/FunctionalErrorHandlingWithOption.kt new file mode 100644 index 0000000000..5fddd1d88e --- /dev/null +++ b/kotlin-libraries/src/main/kotlin/com/baeldung/kotlin/arrow/FunctionalErrorHandlingWithOption.kt @@ -0,0 +1,46 @@ +package com.baeldung.kotlin.arrow + +import arrow.core.None +import arrow.core.Option +import arrow.core.Some +import kotlin.math.sqrt + +class FunctionalErrorHandlingWithOption { + + fun parseInput(s : String) : Option = Option.fromNullable(s.toIntOrNull()) + + fun isEven(x : Int) : Boolean = x % 2 == 0 + + fun biggestDivisor(x: Int) : Int = biggestDivisor(x, 2) + + fun biggestDivisor(x : Int, y : Int) : Int { + if(x == y){ + return 1; + } + if(x % y == 0){ + return x / y; + } + return biggestDivisor(x, y+1) + } + + fun isSquareNumber(x : Int) : Boolean { + val sqrt: Double = sqrt(x.toDouble()) + return sqrt % 1.0 == 0.0 + } + + fun computeWithOption(input : String) : Option { + return parseInput(input) + .filter(::isEven) + .map(::biggestDivisor) + .map(::isSquareNumber) + } + + fun computeWithOptionClient(input : String) : String{ + val computeOption = computeWithOption(input) + + return when(computeOption){ + is None -> "Not an even number!" + is Some -> "The greatest divisor is square number: ${computeOption.t}" + } + } +} \ No newline at end of file diff --git a/kotlin-libraries/src/test/kotlin/com/baeldung/kotlin/arrow/FunctionalDataTypes.kt b/kotlin-libraries/src/test/kotlin/com/baeldung/kotlin/arrow/FunctionalDataTypes.kt new file mode 100644 index 0000000000..692425ee07 --- /dev/null +++ b/kotlin-libraries/src/test/kotlin/com/baeldung/kotlin/arrow/FunctionalDataTypes.kt @@ -0,0 +1,143 @@ +package com.baeldung.kotlin.arrow + +import arrow.core.* +import org.junit.Assert +import org.junit.Test + +class FunctionalDataTypes { + + @Test + fun whenIdCreated_thanValueIsPresent(){ + val id = Id("foo") + val justId = Id.just("foo"); + + Assert.assertEquals("foo", id.extract()) + Assert.assertEquals(justId, id) + } + + fun length(s : String) : Int = s.length + + fun isBigEnough(i : Int) : Boolean = i > 10 + + @Test + fun whenIdCreated_thanMapIsAssociative(){ + val foo = Id("foo") + + val map1 = foo.map(::length) + .map(::isBigEnough) + val map2 = foo.map { s -> isBigEnough(length(s)) } + + Assert.assertEquals(map1, map2) + } + + fun lengthId(s : String) : Id = Id.just(length(s)) + + fun isBigEnoughId(i : Int) : Id = Id.just(isBigEnough(i)) + + @Test + fun whenIdCreated_thanFlatMapIsAssociative(){ + val bar = Id("bar") + + val flatMap = bar.flatMap(::lengthId) + .flatMap(::isBigEnoughId) + val flatMap1 = bar.flatMap { s -> lengthId(s).flatMap(::isBigEnoughId) } + + Assert.assertEquals(flatMap, flatMap1) + } + + @Test + fun whenOptionCreated_thanValueIsPresent(){ + val factory = Option.just(42) + val constructor = Option(42) + val emptyOptional = Option.empty() + val fromNullable = Option.fromNullable(null) + + Assert.assertEquals(42, factory.getOrElse { -1 }) + Assert.assertEquals(factory, constructor) + Assert.assertEquals(emptyOptional, fromNullable) + } + + @Test + fun whenOptionCreated_thanConstructorDifferFromFactory(){ + val constructor : Option = Option(null) + val fromNullable : Option = Option.fromNullable(null) + + try{ + constructor.map { s -> s!!.length } + Assert.fail() + } catch (e : KotlinNullPointerException){ + fromNullable.map { s->s!!.length } + } + Assert.assertNotEquals(constructor, fromNullable) + } + + fun wrapper(x : Integer?) : Option = if (x == null) Option.just(-1) else Option.just(x.toInt()) + + @Test + fun whenOptionFromNullableCreated_thanItBreaksLeftIdentity(){ + val optionFromNull = Option.fromNullable(null) + + Assert.assertNotEquals(optionFromNull.flatMap(::wrapper), wrapper(null)) + } + + @Test + fun whenEitherCreated_thanOneValueIsPresent(){ + val rightOnly : Either = Either.right(42) + val leftOnly : Either = Either.left("foo") + + Assert.assertTrue(rightOnly.isRight()) + Assert.assertTrue(leftOnly.isLeft()) + Assert.assertEquals(42, rightOnly.getOrElse { -1 }) + Assert.assertEquals(-1, leftOnly.getOrElse { -1 }) + + Assert.assertEquals(0, rightOnly.map { it % 2 }.getOrElse { -1 }) + Assert.assertEquals(-1, leftOnly.map { it % 2 }.getOrElse { -1 }) + Assert.assertTrue(rightOnly.flatMap { Either.Right(it % 2) }.isRight()) + Assert.assertTrue(leftOnly.flatMap { Either.Right(it % 2) }.isLeft()) + } + + @Test + fun whenEvalNowUsed_thenMapEvaluatedLazily(){ + val now = Eval.now(1) + Assert.assertEquals(1, now.value()) + + var counter : Int = 0 + val map = now.map { x -> counter++; x+1 } + Assert.assertEquals(0, counter) + + val value = map.value() + Assert.assertEquals(2, value) + Assert.assertEquals(1, counter) + } + + @Test + fun whenEvalLaterUsed_theResultIsMemoized(){ + var counter : Int = 0 + val later = Eval.later { counter++; counter } + Assert.assertEquals(0, counter) + + val firstValue = later.value() + Assert.assertEquals(1, firstValue) + Assert.assertEquals(1, counter) + + val secondValue = later.value() + Assert.assertEquals(1, secondValue) + Assert.assertEquals(1, counter) + } + + @Test + fun whenEvalAlwaysUsed_theResultIsNotMemoized(){ + var counter : Int = 0 + val later = Eval.always { counter++; counter } + Assert.assertEquals(0, counter) + + val firstValue = later.value() + Assert.assertEquals(1, firstValue) + Assert.assertEquals(1, counter) + + val secondValue = later.value() + Assert.assertEquals(2, secondValue) + Assert.assertEquals(2, counter) + } + +} \ No newline at end of file diff --git a/kotlin-libraries/src/test/kotlin/com/baeldung/kotlin/arrow/FunctionalErrorHandlingWithEitherTest.kt b/kotlin-libraries/src/test/kotlin/com/baeldung/kotlin/arrow/FunctionalErrorHandlingWithEitherTest.kt new file mode 100644 index 0000000000..47fbf825a0 --- /dev/null +++ b/kotlin-libraries/src/test/kotlin/com/baeldung/kotlin/arrow/FunctionalErrorHandlingWithEitherTest.kt @@ -0,0 +1,68 @@ +package com.baeldung.kotlin.arrow + +import arrow.core.Either +import com.baeldung.kotlin.arrow.FunctionalErrorHandlingWithEither.ComputeProblem.NotANumber +import com.baeldung.kotlin.arrow.FunctionalErrorHandlingWithEither.ComputeProblem.OddNumber +import org.junit.Assert +import org.junit.Test + +class FunctionalErrorHandlingWithEitherTest { + + val operator = FunctionalErrorHandlingWithEither() + + @Test + fun givenInvalidInput_whenComputeInvoked_NotANumberIsPresent(){ + val computeWithEither = operator.computeWithEither("bar") + + Assert.assertTrue(computeWithEither.isLeft()) + when(computeWithEither){ + is Either.Left -> when(computeWithEither.a){ + NotANumber -> "Ok." + else -> Assert.fail() + } + else -> Assert.fail() + } + } + + @Test + fun givenOddNumberInput_whenComputeInvoked_OddNumberIsPresent(){ + val computeWithEither = operator.computeWithEither("121") + + Assert.assertTrue(computeWithEither.isLeft()) + when(computeWithEither){ + is Either.Left -> when(computeWithEither.a){ + OddNumber -> "Ok." + else -> Assert.fail() + } + else -> Assert.fail() + } + } + + @Test + fun givenEvenNumberWithoutSquare_whenComputeInvoked_OddNumberIsPresent(){ + val computeWithEither = operator.computeWithEither("100") + + Assert.assertTrue(computeWithEither.isRight()) + when(computeWithEither){ + is Either.Right -> when(computeWithEither.b){ + false -> "Ok." + else -> Assert.fail() + } + else -> Assert.fail() + } + } + + @Test + fun givenEvenNumberWithSquare_whenComputeInvoked_OddNumberIsPresent(){ + val computeWithEither = operator.computeWithEither("98") + + Assert.assertTrue(computeWithEither.isRight()) + when(computeWithEither){ + is Either.Right -> when(computeWithEither.b){ + true -> "Ok." + else -> Assert.fail() + } + else -> Assert.fail() + } + } +} \ No newline at end of file diff --git a/kotlin-libraries/src/test/kotlin/com/baeldung/kotlin/arrow/FunctionalErrorHandlingWithOptionTest.kt b/kotlin-libraries/src/test/kotlin/com/baeldung/kotlin/arrow/FunctionalErrorHandlingWithOptionTest.kt new file mode 100644 index 0000000000..3ca4cd033f --- /dev/null +++ b/kotlin-libraries/src/test/kotlin/com/baeldung/kotlin/arrow/FunctionalErrorHandlingWithOptionTest.kt @@ -0,0 +1,34 @@ +package com.baeldung.kotlin.arrow + +import org.junit.Assert +import org.junit.Test + +class FunctionalErrorHandlingWithOptionTest { + + val operator = FunctionalErrorHandlingWithOption() + + @Test + fun givenInvalidInput_thenErrorMessageIsPresent(){ + val useComputeOption = operator.computeWithOptionClient("foo") + Assert.assertEquals("Not an even number!", useComputeOption) + } + + @Test + fun givenOddNumberInput_thenErrorMessageIsPresent(){ + val useComputeOption = operator.computeWithOptionClient("539") + Assert.assertEquals("Not an even number!",useComputeOption) + } + + @Test + fun givenEvenNumberInputWithNonSquareNum_thenFalseMessageIsPresent(){ + val useComputeOption = operator.computeWithOptionClient("100") + Assert.assertEquals("The greatest divisor is square number: false",useComputeOption) + } + + @Test + fun givenEvenNumberInputWithSquareNum_thenTrueMessageIsPresent(){ + val useComputeOption = operator.computeWithOptionClient("242") + Assert.assertEquals("The greatest divisor is square number: true",useComputeOption) + } + +} \ No newline at end of file diff --git a/kotlin-libraries/src/test/kotlin/com/baeldung/kotlin/dates/CreateDateUnitTest.kt b/kotlin-libraries/src/test/kotlin/com/baeldung/kotlin/dates/CreateDateUnitTest.kt new file mode 100644 index 0000000000..d52a2f0f19 --- /dev/null +++ b/kotlin-libraries/src/test/kotlin/com/baeldung/kotlin/dates/CreateDateUnitTest.kt @@ -0,0 +1,34 @@ +package com.baeldung.kotlin.dates + +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test +import java.time.LocalDate +import java.time.format.DateTimeFormatter + +class CreateDateUnitTest { + + @Test + fun givenString_whenDefaultFormat_thenCreated() { + + var date = LocalDate.parse("2018-12-31") + + assertThat(date).isEqualTo("2018-12-31") + } + + @Test + fun givenString_whenCustomFormat_thenCreated() { + + var formatter = DateTimeFormatter.ofPattern("dd-MM-yyyy") + var date = LocalDate.parse("31-12-2018", formatter) + + assertThat(date).isEqualTo("2018-12-31") + } + + @Test + fun givenYMD_whenUsingOf_thenCreated() { + var date = LocalDate.of(2018, 12, 31) + + assertThat(date).isEqualTo("2018-12-31") + } + +} \ No newline at end of file diff --git a/kotlin-libraries/src/test/kotlin/com/baeldung/kotlin/dates/ExtractDateUnitTest.kt b/kotlin-libraries/src/test/kotlin/com/baeldung/kotlin/dates/ExtractDateUnitTest.kt new file mode 100644 index 0000000000..ef3841752b --- /dev/null +++ b/kotlin-libraries/src/test/kotlin/com/baeldung/kotlin/dates/ExtractDateUnitTest.kt @@ -0,0 +1,29 @@ +package com.baeldung.kotlin.dates + +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test +import java.time.DayOfWeek +import java.time.LocalDate +import java.time.Month + +class ExtractDateUnitTest { + + @Test + fun givenDate_thenExtractedYMD() { + var date = LocalDate.parse("2018-12-31") + + assertThat(date.year).isEqualTo(2018) + assertThat(date.month).isEqualTo(Month.DECEMBER) + assertThat(date.dayOfMonth).isEqualTo(31) + } + + @Test + fun givenDate_thenExtractedEraDowDoy() { + var date = LocalDate.parse("2018-12-31") + + assertThat(date.era.toString()).isEqualTo("CE") + assertThat(date.dayOfWeek).isEqualTo(DayOfWeek.MONDAY) + assertThat(date.dayOfYear).isEqualTo(365) + } + +} \ No newline at end of file diff --git a/kotlin-libraries/src/test/kotlin/com/baeldung/kotlin/dates/FormatDateUnitTest.kt b/kotlin-libraries/src/test/kotlin/com/baeldung/kotlin/dates/FormatDateUnitTest.kt new file mode 100644 index 0000000000..11ff6ec9f0 --- /dev/null +++ b/kotlin-libraries/src/test/kotlin/com/baeldung/kotlin/dates/FormatDateUnitTest.kt @@ -0,0 +1,29 @@ +package com.baeldung.kotlin.dates + +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test +import java.time.LocalDate +import java.time.format.DateTimeFormatter + +class FormatDateUnitTest { + + @Test + fun givenDate_whenDefaultFormat_thenFormattedString() { + + var date = LocalDate.parse("2018-12-31") + + assertThat(date.toString()).isEqualTo("2018-12-31") + } + + @Test + fun givenDate_whenCustomFormat_thenFormattedString() { + + var date = LocalDate.parse("2018-12-31") + + var formatter = DateTimeFormatter.ofPattern("dd-MMMM-yyyy") + var formattedDate = date.format(formatter) + + assertThat(formattedDate).isEqualTo("31-December-2018") + } + +} \ No newline at end of file diff --git a/kotlin-libraries/src/test/kotlin/com/baeldung/kotlin/dates/PeriodDateUnitTest.kt b/kotlin-libraries/src/test/kotlin/com/baeldung/kotlin/dates/PeriodDateUnitTest.kt new file mode 100644 index 0000000000..e6b66634d3 --- /dev/null +++ b/kotlin-libraries/src/test/kotlin/com/baeldung/kotlin/dates/PeriodDateUnitTest.kt @@ -0,0 +1,48 @@ +package com.baeldung.kotlin.dates + +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test +import java.time.LocalDate +import java.time.Period + +class PeriodDateUnitTest { + + @Test + fun givenYMD_thenCreatePeriod() { + var period = Period.of(1, 2, 3) + + assertThat(period.toString()).isEqualTo("P1Y2M3D") + } + + @Test + fun givenPeriod_whenAdd_thenModifiedDate() { + var period = Period.of(1, 2, 3) + + var date = LocalDate.of(2018, 6, 25) + var modifiedDate = date.plus(period) + + assertThat(modifiedDate).isEqualTo("2019-08-28") + } + + @Test + fun givenPeriod_whenSubtracted_thenModifiedDate() { + var period = Period.of(1, 2, 3) + + var date = LocalDate.of(2018, 6, 25) + var modifiedDate = date.minus(period) + + assertThat(modifiedDate).isEqualTo("2017-04-22") + } + + @Test + fun givenTwoDate_whenUsingBetween_thenDiffOfDates() { + + var date1 = LocalDate.parse("2018-06-25") + var date2 = LocalDate.parse("2018-12-25") + + var period = Period.between(date1, date2) + + assertThat(period.toString()).isEqualTo("P6M") + } + +} \ No newline at end of file diff --git a/libraries-data/README.md b/libraries-data/README.md index 63ee5f9947..69856af66b 100644 --- a/libraries-data/README.md +++ b/libraries-data/README.md @@ -12,3 +12,6 @@ - [Guide to JMapper](https://www.baeldung.com/jmapper) - [A Guide to Apache Crunch](https://www.baeldung.com/apache-crunch) - [Building a Data Pipeline with Flink and Kafka](https://www.baeldung.com/kafka-flink-data-pipeline) +- [Intro to Apache Storm](https://www.baeldung.com/apache-storm) +- [Guide to Ebean ORM](https://www.baeldung.com/ebean-orm) +- [Introduction to Kafka Connectors](https://www.baeldung.com/kafka-connectors-guide) diff --git a/libraries-data/pom.xml b/libraries-data/pom.xml index bbf0c7832f..54d24edbf6 100644 --- a/libraries-data/pom.xml +++ b/libraries-data/pom.xml @@ -259,6 +259,11 @@ slf4j-api ${slf4j.version} + + org.apache.storm + storm-core + ${storm.version} + ch.qos.logback @@ -432,6 +437,7 @@ + 1.2.2 4.0.1 1.4.196 16.5.1 diff --git a/libraries-data/src/main/java/com/baeldung/storm/TopologyRunner.java b/libraries-data/src/main/java/com/baeldung/storm/TopologyRunner.java new file mode 100644 index 0000000000..326f53c0b8 --- /dev/null +++ b/libraries-data/src/main/java/com/baeldung/storm/TopologyRunner.java @@ -0,0 +1,34 @@ +package com.baeldung.storm; + +import com.baeldung.storm.bolt.AggregatingBolt; +import com.baeldung.storm.bolt.FileWritingBolt; +import com.baeldung.storm.bolt.FilteringBolt; +import com.baeldung.storm.bolt.PrintingBolt; +import com.baeldung.storm.spout.RandomNumberSpout; +import org.apache.storm.Config; +import org.apache.storm.LocalCluster; +import org.apache.storm.topology.TopologyBuilder; +import org.apache.storm.topology.base.BaseWindowedBolt; + +public class TopologyRunner { + public static void main(String[] args) { + runTopology(); + } + + public static void runTopology() { + String filePath = "./src/main/resources/operations.txt"; + TopologyBuilder builder = new TopologyBuilder(); + builder.setSpout("randomNumberSpout", new RandomNumberSpout()); + builder.setBolt("filteringBolt", new FilteringBolt()).shuffleGrouping("randomNumberSpout"); + builder.setBolt("aggregatingBolt", new AggregatingBolt() + .withTimestampField("timestamp") + .withLag(BaseWindowedBolt.Duration.seconds(1)) + .withWindow(BaseWindowedBolt.Duration.seconds(5))).shuffleGrouping("filteringBolt"); + builder.setBolt("fileBolt", new FileWritingBolt(filePath)).shuffleGrouping("aggregatingBolt"); + + Config config = new Config(); + config.setDebug(false); + LocalCluster cluster = new LocalCluster(); + cluster.submitTopology("Test", config, builder.createTopology()); + } +} diff --git a/libraries-data/src/main/java/com/baeldung/storm/bolt/AggregatingBolt.java b/libraries-data/src/main/java/com/baeldung/storm/bolt/AggregatingBolt.java new file mode 100644 index 0000000000..c7263cd8d5 --- /dev/null +++ b/libraries-data/src/main/java/com/baeldung/storm/bolt/AggregatingBolt.java @@ -0,0 +1,39 @@ +package com.baeldung.storm.bolt; + +import org.apache.storm.task.OutputCollector; +import org.apache.storm.task.TopologyContext; +import org.apache.storm.topology.OutputFieldsDeclarer; +import org.apache.storm.topology.base.BaseWindowedBolt; +import org.apache.storm.tuple.Fields; +import org.apache.storm.tuple.Tuple; +import org.apache.storm.tuple.Values; +import org.apache.storm.windowing.TupleWindow; + +import java.util.Comparator; +import java.util.List; +import java.util.Map; + +public class AggregatingBolt extends BaseWindowedBolt { + private OutputCollector outputCollector; + @Override + public void prepare(Map stormConf, TopologyContext context, OutputCollector collector) { + this.outputCollector = collector; + } + + @Override + public void declareOutputFields(OutputFieldsDeclarer declarer) { + declarer.declare(new Fields("sumOfOperations", "beginningTimestamp", "endTimestamp")); + } + + @Override + public void execute(TupleWindow tupleWindow) { + List tuples = tupleWindow.get(); + tuples.sort(Comparator.comparing(a -> a.getLongByField("timestamp"))); + //This is safe since the window is calculated basing on Tuple's timestamp, thus it can't really be empty + Long beginningTimestamp = tuples.get(0).getLongByField("timestamp"); + Long endTimestamp = tuples.get(tuples.size() - 1).getLongByField("timestamp"); + int sumOfOperations = tuples.stream().mapToInt(tuple -> tuple.getIntegerByField("operation")).sum(); + Values values = new Values(sumOfOperations, beginningTimestamp, endTimestamp); + outputCollector.emit(values); + } +} diff --git a/libraries-data/src/main/java/com/baeldung/storm/bolt/FileWritingBolt.java b/libraries-data/src/main/java/com/baeldung/storm/bolt/FileWritingBolt.java new file mode 100644 index 0000000000..339e0dc055 --- /dev/null +++ b/libraries-data/src/main/java/com/baeldung/storm/bolt/FileWritingBolt.java @@ -0,0 +1,72 @@ +package com.baeldung.storm.bolt; + +import com.baeldung.storm.model.AggregatedWindow; +import com.fasterxml.jackson.annotation.JsonAutoDetect; +import com.fasterxml.jackson.annotation.PropertyAccessor; +import com.fasterxml.jackson.databind.ObjectMapper; +import org.apache.storm.task.OutputCollector; +import org.apache.storm.task.TopologyContext; +import org.apache.storm.topology.OutputFieldsDeclarer; +import org.apache.storm.topology.base.BaseRichBolt; +import org.apache.storm.tuple.Tuple; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.io.BufferedWriter; +import java.io.FileWriter; +import java.io.IOException; +import java.util.Map; + +public class FileWritingBolt extends BaseRichBolt { + public static Logger logger = LoggerFactory.getLogger(FileWritingBolt.class); + private BufferedWriter writer; + private String filePath; + private ObjectMapper objectMapper; + + @Override + public void prepare(Map map, TopologyContext topologyContext, OutputCollector outputCollector) { + objectMapper = new ObjectMapper(); + objectMapper.setVisibility(PropertyAccessor.FIELD, JsonAutoDetect.Visibility.ANY); + try { + writer = new BufferedWriter(new FileWriter(filePath)); + } catch (IOException e) { + logger.error("Failed to open a file for writing.", e); + } + } + + @Override + public void execute(Tuple tuple) { + int sumOfOperations = tuple.getIntegerByField("sumOfOperations"); + long beginningTimestamp = tuple.getLongByField("beginningTimestamp"); + long endTimestamp = tuple.getLongByField("endTimestamp"); + + if(sumOfOperations > 200) { + AggregatedWindow aggregatedWindow = new AggregatedWindow(sumOfOperations, beginningTimestamp, endTimestamp); + try { + writer.write(objectMapper.writeValueAsString(aggregatedWindow)); + writer.write("\n"); + writer.flush(); + } catch (IOException e) { + logger.error("Failed to write data to file.", e); + } + } + } + + public FileWritingBolt(String filePath) { + this.filePath = filePath; + } + + @Override + public void cleanup() { + try { + writer.close(); + } catch (IOException e) { + logger.error("Failed to close the writer!"); + } + } + + @Override + public void declareOutputFields(OutputFieldsDeclarer outputFieldsDeclarer) { + + } +} diff --git a/libraries-data/src/main/java/com/baeldung/storm/bolt/FilteringBolt.java b/libraries-data/src/main/java/com/baeldung/storm/bolt/FilteringBolt.java new file mode 100644 index 0000000000..564076a1df --- /dev/null +++ b/libraries-data/src/main/java/com/baeldung/storm/bolt/FilteringBolt.java @@ -0,0 +1,22 @@ +package com.baeldung.storm.bolt; + +import org.apache.storm.topology.BasicOutputCollector; +import org.apache.storm.topology.OutputFieldsDeclarer; +import org.apache.storm.topology.base.BaseBasicBolt; +import org.apache.storm.tuple.Fields; +import org.apache.storm.tuple.Tuple; + +public class FilteringBolt extends BaseBasicBolt { + @Override + public void execute(Tuple tuple, BasicOutputCollector basicOutputCollector) { + int operation = tuple.getIntegerByField("operation"); + if(operation > 0 ) { + basicOutputCollector.emit(tuple.getValues()); + } + } + + @Override + public void declareOutputFields(OutputFieldsDeclarer outputFieldsDeclarer) { + outputFieldsDeclarer.declare(new Fields("operation", "timestamp")); + } +} diff --git a/libraries-data/src/main/java/com/baeldung/storm/bolt/PrintingBolt.java b/libraries-data/src/main/java/com/baeldung/storm/bolt/PrintingBolt.java new file mode 100644 index 0000000000..efd2c9b1d9 --- /dev/null +++ b/libraries-data/src/main/java/com/baeldung/storm/bolt/PrintingBolt.java @@ -0,0 +1,18 @@ +package com.baeldung.storm.bolt; + +import org.apache.storm.topology.BasicOutputCollector; +import org.apache.storm.topology.OutputFieldsDeclarer; +import org.apache.storm.topology.base.BaseBasicBolt; +import org.apache.storm.tuple.Tuple; + +public class PrintingBolt extends BaseBasicBolt { + @Override + public void execute(Tuple tuple, BasicOutputCollector basicOutputCollector) { + System.out.println(tuple); + } + + @Override + public void declareOutputFields(OutputFieldsDeclarer outputFieldsDeclarer) { + + } +} diff --git a/libraries-data/src/main/java/com/baeldung/storm/model/AggregatedWindow.java b/libraries-data/src/main/java/com/baeldung/storm/model/AggregatedWindow.java new file mode 100644 index 0000000000..beaf54d34c --- /dev/null +++ b/libraries-data/src/main/java/com/baeldung/storm/model/AggregatedWindow.java @@ -0,0 +1,16 @@ +package com.baeldung.storm.model; + +import com.fasterxml.jackson.databind.annotation.JsonSerialize; + +@JsonSerialize +public class AggregatedWindow { + int sumOfOperations; + long beginningTimestamp; + long endTimestamp; + + public AggregatedWindow(int sumOfOperations, long beginningTimestamp, long endTimestamp) { + this.sumOfOperations = sumOfOperations; + this.beginningTimestamp = beginningTimestamp; + this.endTimestamp = endTimestamp; + } +} diff --git a/libraries-data/src/main/java/com/baeldung/storm/model/User.java b/libraries-data/src/main/java/com/baeldung/storm/model/User.java new file mode 100644 index 0000000000..eafbf0e1eb --- /dev/null +++ b/libraries-data/src/main/java/com/baeldung/storm/model/User.java @@ -0,0 +1,40 @@ +package com.baeldung.storm.model; + +public class User { + private String username; + private String password; + private String email; + private int age; + + 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; + } + + 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/libraries-data/src/main/java/com/baeldung/storm/serialization/UserSerializer.java b/libraries-data/src/main/java/com/baeldung/storm/serialization/UserSerializer.java new file mode 100644 index 0000000000..6199a203da --- /dev/null +++ b/libraries-data/src/main/java/com/baeldung/storm/serialization/UserSerializer.java @@ -0,0 +1,30 @@ +package com.baeldung.storm.serialization; + + +import com.baeldung.storm.model.User; +import com.esotericsoftware.kryo.Kryo; +import com.esotericsoftware.kryo.Serializer; +import com.esotericsoftware.kryo.io.Input; +import com.esotericsoftware.kryo.io.Output; + +public class UserSerializer extends Serializer{ + @Override + public void write(Kryo kryo, Output output, User user) { + output.writeString(user.getEmail()); + output.writeString(user.getUsername()); + output.write(user.getAge()); + } + + @Override + public User read(Kryo kryo, Input input, Class aClass) { + User user = new User(); + String email = input.readString(); + String name = input.readString(); + int age = input.read(); + user.setAge(age); + user.setEmail(email); + user.setUsername(name); + + return user; + } +} diff --git a/libraries-data/src/main/java/com/baeldung/storm/spout/RandomIntSpout.java b/libraries-data/src/main/java/com/baeldung/storm/spout/RandomIntSpout.java new file mode 100644 index 0000000000..4a8ef76598 --- /dev/null +++ b/libraries-data/src/main/java/com/baeldung/storm/spout/RandomIntSpout.java @@ -0,0 +1,35 @@ +package com.baeldung.storm.spout; + +import org.apache.storm.spout.SpoutOutputCollector; +import org.apache.storm.task.TopologyContext; +import org.apache.storm.topology.OutputFieldsDeclarer; +import org.apache.storm.topology.base.BaseRichSpout; +import org.apache.storm.tuple.Fields; +import org.apache.storm.tuple.Values; +import org.apache.storm.utils.Utils; + +import java.util.Map; +import java.util.Random; + +public class RandomIntSpout extends BaseRichSpout { + + private Random random; + private SpoutOutputCollector outputCollector; + + @Override + public void open(Map map, TopologyContext topologyContext, SpoutOutputCollector spoutOutputCollector) { + random = new Random(); + outputCollector = spoutOutputCollector; + } + + @Override + public void nextTuple() { + Utils.sleep(1000); + outputCollector.emit(new Values(random.nextInt(), System.currentTimeMillis())); + } + + @Override + public void declareOutputFields(OutputFieldsDeclarer outputFieldsDeclarer) { + outputFieldsDeclarer.declare(new Fields("randomInt", "timestamp")); + } +} diff --git a/libraries-data/src/main/java/com/baeldung/storm/spout/RandomNumberSpout.java b/libraries-data/src/main/java/com/baeldung/storm/spout/RandomNumberSpout.java new file mode 100644 index 0000000000..c9291cdc9d --- /dev/null +++ b/libraries-data/src/main/java/com/baeldung/storm/spout/RandomNumberSpout.java @@ -0,0 +1,40 @@ +package com.baeldung.storm.spout; + +import org.apache.storm.spout.SpoutOutputCollector; +import org.apache.storm.task.OutputCollector; +import org.apache.storm.task.TopologyContext; +import org.apache.storm.topology.OutputFieldsDeclarer; +import org.apache.storm.topology.base.BaseRichSpout; +import org.apache.storm.tuple.Fields; +import org.apache.storm.tuple.Values; +import org.apache.storm.utils.Utils; + +import java.util.Map; +import java.util.Random; + +public class RandomNumberSpout extends BaseRichSpout { + private Random random; + private SpoutOutputCollector collector; + + @Override + public void open(Map map, TopologyContext topologyContext, SpoutOutputCollector spoutOutputCollector) { + random = new Random(); + collector = spoutOutputCollector; + } + + @Override + public void nextTuple() { + Utils.sleep(1000); + //This will select random int from the range (0, 100) + int operation = random.nextInt(101); + long timestamp = System.currentTimeMillis(); + + Values values = new Values(operation, timestamp); + collector.emit(values); + } + + @Override + public void declareOutputFields(OutputFieldsDeclarer outputFieldsDeclarer) { + outputFieldsDeclarer.declare(new Fields("operation", "timestamp")); + } +} diff --git a/libraries-data/src/main/kafka-connect/01_Quick_Start/connect-file-sink.properties b/libraries-data/src/main/kafka-connect/01_Quick_Start/connect-file-sink.properties new file mode 100644 index 0000000000..594ccc6e95 --- /dev/null +++ b/libraries-data/src/main/kafka-connect/01_Quick_Start/connect-file-sink.properties @@ -0,0 +1,20 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +name=local-file-sink +connector.class=FileStreamSink +tasks.max=1 +file=test.sink.txt +topics=connect-test \ No newline at end of file diff --git a/libraries-data/src/main/kafka-connect/01_Quick_Start/connect-file-source.properties b/libraries-data/src/main/kafka-connect/01_Quick_Start/connect-file-source.properties new file mode 100644 index 0000000000..599cf4cb2a --- /dev/null +++ b/libraries-data/src/main/kafka-connect/01_Quick_Start/connect-file-source.properties @@ -0,0 +1,20 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +name=local-file-source +connector.class=FileStreamSource +tasks.max=1 +file=test.txt +topic=connect-test \ No newline at end of file diff --git a/libraries-data/src/main/kafka-connect/01_Quick_Start/connect-standalone.properties b/libraries-data/src/main/kafka-connect/01_Quick_Start/connect-standalone.properties new file mode 100644 index 0000000000..a2369fa144 --- /dev/null +++ b/libraries-data/src/main/kafka-connect/01_Quick_Start/connect-standalone.properties @@ -0,0 +1,44 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# These are defaults. This file just demonstrates how to override some settings. +bootstrap.servers=localhost:9092 + +# The converters specify the format of data in Kafka and how to translate it into Connect data. Every Connect user will +# need to configure these based on the format they want their data in when loaded from or stored into Kafka +key.converter=org.apache.kafka.connect.json.JsonConverter +value.converter=org.apache.kafka.connect.json.JsonConverter +# Converter-specific settings can be passed in by prefixing the Converter's setting with the converter we want to apply +# it to +key.converter.schemas.enable=false +value.converter.schemas.enable=false + +offset.storage.file.filename=/tmp/connect.offsets +# Flush much faster than normal, which is useful for testing/debugging +offset.flush.interval.ms=10000 + +# Set to a list of filesystem paths separated by commas (,) to enable class loading isolation for plugins +# (connectors, converters, transformations). The list should consist of top level directories that include +# any combination of: +# a) directories immediately containing jars with plugins and their dependencies +# b) uber-jars with plugins and their dependencies +# c) directories immediately containing the package directory structure of classes of plugins and their dependencies +# Note: symlinks will be followed to discover dependencies or plugins. +# Examples: +# plugin.path=/usr/local/share/java,/usr/local/share/kafka/plugins,/opt/connectors, +# Replace the relative path below with an absolute path if you are planning to start Kafka Connect from within a +# directory other than the home directory of Confluent Platform. +plugin.path=C:\Software\confluent-5.0.0\share\java +#plugin.path=./share/java diff --git a/libraries-data/src/main/kafka-connect/02_Distributed/connect-distributed.properties b/libraries-data/src/main/kafka-connect/02_Distributed/connect-distributed.properties new file mode 100644 index 0000000000..5b91baddbd --- /dev/null +++ b/libraries-data/src/main/kafka-connect/02_Distributed/connect-distributed.properties @@ -0,0 +1,88 @@ +## +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +## + +# This file contains some of the configurations for the Kafka Connect distributed worker. This file is intended +# to be used with the examples, and some settings may differ from those used in a production system, especially +# the `bootstrap.servers` and those specifying replication factors. + +# A list of host/port pairs to use for establishing the initial connection to the Kafka cluster. +bootstrap.servers=localhost:9092 + +# unique name for the cluster, used in forming the Connect cluster group. Note that this must not conflict with consumer group IDs +group.id=connect-cluster + +# The converters specify the format of data in Kafka and how to translate it into Connect data. Every Connect user will +# need to configure these based on the format they want their data in when loaded from or stored into Kafka +key.converter=org.apache.kafka.connect.json.JsonConverter +value.converter=org.apache.kafka.connect.json.JsonConverter +# Converter-specific settings can be passed in by prefixing the Converter's setting with the converter we want to apply +# it to +key.converter.schemas.enable=true +value.converter.schemas.enable=true + +# Topic to use for storing offsets. This topic should have many partitions and be replicated and compacted. +# Kafka Connect will attempt to create the topic automatically when needed, but you can always manually create +# the topic before starting Kafka Connect if a specific topic configuration is needed. +# Most users will want to use the built-in default replication factor of 3 or in some cases even specify a larger value. +# Since this means there must be at least as many brokers as the maximum replication factor used, we'd like to be able +# to run this example on a single-broker cluster and so here we instead set the replication factor to 1. +offset.storage.topic=connect-offsets +offset.storage.replication.factor=1 +#offset.storage.partitions=25 + +# Topic to use for storing connector and task configurations; note that this should be a single partition, highly replicated, +# and compacted topic. Kafka Connect will attempt to create the topic automatically when needed, but you can always manually create +# the topic before starting Kafka Connect if a specific topic configuration is needed. +# Most users will want to use the built-in default replication factor of 3 or in some cases even specify a larger value. +# Since this means there must be at least as many brokers as the maximum replication factor used, we'd like to be able +# to run this example on a single-broker cluster and so here we instead set the replication factor to 1. +config.storage.topic=connect-configs +config.storage.replication.factor=1 + +# Topic to use for storing statuses. This topic can have multiple partitions and should be replicated and compacted. +# Kafka Connect will attempt to create the topic automatically when needed, but you can always manually create +# the topic before starting Kafka Connect if a specific topic configuration is needed. +# Most users will want to use the built-in default replication factor of 3 or in some cases even specify a larger value. +# Since this means there must be at least as many brokers as the maximum replication factor used, we'd like to be able +# to run this example on a single-broker cluster and so here we instead set the replication factor to 1. +status.storage.topic=connect-status +status.storage.replication.factor=1 +#status.storage.partitions=5 + +# Flush much faster than normal, which is useful for testing/debugging +offset.flush.interval.ms=10000 + +# These are provided to inform the user about the presence of the REST host and port configs +# Hostname & Port for the REST API to listen on. If this is set, it will bind to the interface used to listen to requests. +#rest.host.name= +#rest.port=8083 + +# The Hostname & Port that will be given out to other workers to connect to i.e. URLs that are routable from other servers. +#rest.advertised.host.name= +#rest.advertised.port= + +# Set to a list of filesystem paths separated by commas (,) to enable class loading isolation for plugins +# (connectors, converters, transformations). The list should consist of top level directories that include +# any combination of: +# a) directories immediately containing jars with plugins and their dependencies +# b) uber-jars with plugins and their dependencies +# c) directories immediately containing the package directory structure of classes of plugins and their dependencies +# Examples: +# plugin.path=/usr/local/share/java,/usr/local/share/kafka/plugins,/opt/connectors, +# Replace the relative path below with an absolute path if you are planning to start Kafka Connect from within a +# directory other than the home directory of Confluent Platform. +plugin.path=./share/java diff --git a/libraries-data/src/main/kafka-connect/02_Distributed/connect-file-sink.json b/libraries-data/src/main/kafka-connect/02_Distributed/connect-file-sink.json new file mode 100644 index 0000000000..8902ecce52 --- /dev/null +++ b/libraries-data/src/main/kafka-connect/02_Distributed/connect-file-sink.json @@ -0,0 +1,9 @@ +{ + "name": "local-file-sink", + "config": { + "connector.class": "FileStreamSink", + "tasks.max": 1, + "file": "test-distributed.sink.txt", + "topics": "connect-distributed" + } +} diff --git a/libraries-data/src/main/kafka-connect/02_Distributed/connect-file-source.json b/libraries-data/src/main/kafka-connect/02_Distributed/connect-file-source.json new file mode 100644 index 0000000000..77e949c91b --- /dev/null +++ b/libraries-data/src/main/kafka-connect/02_Distributed/connect-file-source.json @@ -0,0 +1,9 @@ +{ + "name": "local-file-source", + "config": { + "connector.class": "FileStreamSource", + "tasks.max": 1, + "file": "test-distributed.txt", + "topic": "connect-distributed" + } +} diff --git a/libraries-data/src/main/kafka-connect/03_Transform/connect-distributed.properties b/libraries-data/src/main/kafka-connect/03_Transform/connect-distributed.properties new file mode 100644 index 0000000000..fa63be24b8 --- /dev/null +++ b/libraries-data/src/main/kafka-connect/03_Transform/connect-distributed.properties @@ -0,0 +1,88 @@ +## +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +## + +# This file contains some of the configurations for the Kafka Connect distributed worker. This file is intended +# to be used with the examples, and some settings may differ from those used in a production system, especially +# the `bootstrap.servers` and those specifying replication factors. + +# A list of host/port pairs to use for establishing the initial connection to the Kafka cluster. +bootstrap.servers=localhost:9092 + +# unique name for the cluster, used in forming the Connect cluster group. Note that this must not conflict with consumer group IDs +group.id=connect-cluster + +# The converters specify the format of data in Kafka and how to translate it into Connect data. Every Connect user will +# need to configure these based on the format they want their data in when loaded from or stored into Kafka +key.converter=org.apache.kafka.connect.json.JsonConverter +value.converter=org.apache.kafka.connect.json.JsonConverter +# Converter-specific settings can be passed in by prefixing the Converter's setting with the converter we want to apply +# it to +key.converter.schemas.enable=false +value.converter.schemas.enable=false + +# Topic to use for storing offsets. This topic should have many partitions and be replicated and compacted. +# Kafka Connect will attempt to create the topic automatically when needed, but you can always manually create +# the topic before starting Kafka Connect if a specific topic configuration is needed. +# Most users will want to use the built-in default replication factor of 3 or in some cases even specify a larger value. +# Since this means there must be at least as many brokers as the maximum replication factor used, we'd like to be able +# to run this example on a single-broker cluster and so here we instead set the replication factor to 1. +offset.storage.topic=connect-offsets +offset.storage.replication.factor=1 +#offset.storage.partitions=25 + +# Topic to use for storing connector and task configurations; note that this should be a single partition, highly replicated, +# and compacted topic. Kafka Connect will attempt to create the topic automatically when needed, but you can always manually create +# the topic before starting Kafka Connect if a specific topic configuration is needed. +# Most users will want to use the built-in default replication factor of 3 or in some cases even specify a larger value. +# Since this means there must be at least as many brokers as the maximum replication factor used, we'd like to be able +# to run this example on a single-broker cluster and so here we instead set the replication factor to 1. +config.storage.topic=connect-configs +config.storage.replication.factor=1 + +# Topic to use for storing statuses. This topic can have multiple partitions and should be replicated and compacted. +# Kafka Connect will attempt to create the topic automatically when needed, but you can always manually create +# the topic before starting Kafka Connect if a specific topic configuration is needed. +# Most users will want to use the built-in default replication factor of 3 or in some cases even specify a larger value. +# Since this means there must be at least as many brokers as the maximum replication factor used, we'd like to be able +# to run this example on a single-broker cluster and so here we instead set the replication factor to 1. +status.storage.topic=connect-status +status.storage.replication.factor=1 +#status.storage.partitions=5 + +# Flush much faster than normal, which is useful for testing/debugging +offset.flush.interval.ms=10000 + +# These are provided to inform the user about the presence of the REST host and port configs +# Hostname & Port for the REST API to listen on. If this is set, it will bind to the interface used to listen to requests. +#rest.host.name= +#rest.port=8083 + +# The Hostname & Port that will be given out to other workers to connect to i.e. URLs that are routable from other servers. +#rest.advertised.host.name= +#rest.advertised.port= + +# Set to a list of filesystem paths separated by commas (,) to enable class loading isolation for plugins +# (connectors, converters, transformations). The list should consist of top level directories that include +# any combination of: +# a) directories immediately containing jars with plugins and their dependencies +# b) uber-jars with plugins and their dependencies +# c) directories immediately containing the package directory structure of classes of plugins and their dependencies +# Examples: +# plugin.path=/usr/local/share/java,/usr/local/share/kafka/plugins,/opt/connectors, +# Replace the relative path below with an absolute path if you are planning to start Kafka Connect from within a +# directory other than the home directory of Confluent Platform. +plugin.path=./share/java diff --git a/libraries-data/src/main/kafka-connect/03_Transform/connect-file-source-transform.json b/libraries-data/src/main/kafka-connect/03_Transform/connect-file-source-transform.json new file mode 100644 index 0000000000..e5e21a0608 --- /dev/null +++ b/libraries-data/src/main/kafka-connect/03_Transform/connect-file-source-transform.json @@ -0,0 +1,15 @@ +{ + "name": "local-file-source", + "config": { + "connector.class": "FileStreamSource", + "tasks.max": 1, + "file": "transformation.txt", + "topic": "connect-transformation", + "transforms": "MakeMap,InsertSource", + "transforms.MakeMap.type": "org.apache.kafka.connect.transforms.HoistField$Value", + "transforms.MakeMap.field": "line", + "transforms.InsertSource.type": "org.apache.kafka.connect.transforms.InsertField$Value", + "transforms.InsertSource.static.field": "data_source", + "transforms.InsertSource.static.value": "test-file-source" + } +} diff --git a/libraries-data/src/main/kafka-connect/04_Custom/connect-distributed.properties b/libraries-data/src/main/kafka-connect/04_Custom/connect-distributed.properties new file mode 100644 index 0000000000..5b91baddbd --- /dev/null +++ b/libraries-data/src/main/kafka-connect/04_Custom/connect-distributed.properties @@ -0,0 +1,88 @@ +## +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +## + +# This file contains some of the configurations for the Kafka Connect distributed worker. This file is intended +# to be used with the examples, and some settings may differ from those used in a production system, especially +# the `bootstrap.servers` and those specifying replication factors. + +# A list of host/port pairs to use for establishing the initial connection to the Kafka cluster. +bootstrap.servers=localhost:9092 + +# unique name for the cluster, used in forming the Connect cluster group. Note that this must not conflict with consumer group IDs +group.id=connect-cluster + +# The converters specify the format of data in Kafka and how to translate it into Connect data. Every Connect user will +# need to configure these based on the format they want their data in when loaded from or stored into Kafka +key.converter=org.apache.kafka.connect.json.JsonConverter +value.converter=org.apache.kafka.connect.json.JsonConverter +# Converter-specific settings can be passed in by prefixing the Converter's setting with the converter we want to apply +# it to +key.converter.schemas.enable=true +value.converter.schemas.enable=true + +# Topic to use for storing offsets. This topic should have many partitions and be replicated and compacted. +# Kafka Connect will attempt to create the topic automatically when needed, but you can always manually create +# the topic before starting Kafka Connect if a specific topic configuration is needed. +# Most users will want to use the built-in default replication factor of 3 or in some cases even specify a larger value. +# Since this means there must be at least as many brokers as the maximum replication factor used, we'd like to be able +# to run this example on a single-broker cluster and so here we instead set the replication factor to 1. +offset.storage.topic=connect-offsets +offset.storage.replication.factor=1 +#offset.storage.partitions=25 + +# Topic to use for storing connector and task configurations; note that this should be a single partition, highly replicated, +# and compacted topic. Kafka Connect will attempt to create the topic automatically when needed, but you can always manually create +# the topic before starting Kafka Connect if a specific topic configuration is needed. +# Most users will want to use the built-in default replication factor of 3 or in some cases even specify a larger value. +# Since this means there must be at least as many brokers as the maximum replication factor used, we'd like to be able +# to run this example on a single-broker cluster and so here we instead set the replication factor to 1. +config.storage.topic=connect-configs +config.storage.replication.factor=1 + +# Topic to use for storing statuses. This topic can have multiple partitions and should be replicated and compacted. +# Kafka Connect will attempt to create the topic automatically when needed, but you can always manually create +# the topic before starting Kafka Connect if a specific topic configuration is needed. +# Most users will want to use the built-in default replication factor of 3 or in some cases even specify a larger value. +# Since this means there must be at least as many brokers as the maximum replication factor used, we'd like to be able +# to run this example on a single-broker cluster and so here we instead set the replication factor to 1. +status.storage.topic=connect-status +status.storage.replication.factor=1 +#status.storage.partitions=5 + +# Flush much faster than normal, which is useful for testing/debugging +offset.flush.interval.ms=10000 + +# These are provided to inform the user about the presence of the REST host and port configs +# Hostname & Port for the REST API to listen on. If this is set, it will bind to the interface used to listen to requests. +#rest.host.name= +#rest.port=8083 + +# The Hostname & Port that will be given out to other workers to connect to i.e. URLs that are routable from other servers. +#rest.advertised.host.name= +#rest.advertised.port= + +# Set to a list of filesystem paths separated by commas (,) to enable class loading isolation for plugins +# (connectors, converters, transformations). The list should consist of top level directories that include +# any combination of: +# a) directories immediately containing jars with plugins and their dependencies +# b) uber-jars with plugins and their dependencies +# c) directories immediately containing the package directory structure of classes of plugins and their dependencies +# Examples: +# plugin.path=/usr/local/share/java,/usr/local/share/kafka/plugins,/opt/connectors, +# Replace the relative path below with an absolute path if you are planning to start Kafka Connect from within a +# directory other than the home directory of Confluent Platform. +plugin.path=./share/java diff --git a/libraries-data/src/main/kafka-connect/04_Custom/connect-mongodb-sink.json b/libraries-data/src/main/kafka-connect/04_Custom/connect-mongodb-sink.json new file mode 100644 index 0000000000..333768e4b7 --- /dev/null +++ b/libraries-data/src/main/kafka-connect/04_Custom/connect-mongodb-sink.json @@ -0,0 +1,22 @@ +{ + "firstName": "John", + "lastName": "Smith", + "age": 25, + "address": { + "streetAddress": "21 2nd Street", + "city": "New York", + "state": "NY", + "postalCode": "10021" + }, + "phoneNumber": [{ + "type": "home", + "number": "212 555-1234" + }, { + "type": "fax", + "number": "646 555-4567" + } + ], + "gender": { + "type": "male" + } +} diff --git a/libraries-data/src/main/kafka-connect/04_Custom/connect-mqtt-source.json b/libraries-data/src/main/kafka-connect/04_Custom/connect-mqtt-source.json new file mode 100644 index 0000000000..02d87c5ad7 --- /dev/null +++ b/libraries-data/src/main/kafka-connect/04_Custom/connect-mqtt-source.json @@ -0,0 +1,11 @@ +{ + "name": "mqtt-source", + "config": { + "connector.class": "io.confluent.connect.mqtt.MqttSourceConnector", + "tasks.max": 1, + "mqtt.server.uri": "ws://broker.hivemq.com:8000/mqtt", + "mqtt.topics": "baeldung", + "kafka.topic": "connect-custom", + "value.converter": "org.apache.kafka.connect.converters.ByteArrayConverter" + } +} diff --git a/libraries-security/README.md b/libraries-security/README.md index c42e91a888..6923e0474e 100644 --- a/libraries-security/README.md +++ b/libraries-security/README.md @@ -1,3 +1,4 @@ ### Relevant Articles: - [Guide to ScribeJava](https://www.baeldung.com/scribejava) +- [Guide to Passay](https://www.baeldung.com/java-passay) diff --git a/libraries-server/pom.xml b/libraries-server/pom.xml index 6fca09faf4..661f5f01d5 100644 --- a/libraries-server/pom.xml +++ b/libraries-server/pom.xml @@ -1,9 +1,10 @@ 4.0.0 - com.baeldung libraries-server 0.0.1-SNAPSHOT + libraries-server + com.baeldung parent-modules diff --git a/libraries/README.md b/libraries/README.md index fcf687d806..851e3a3d17 100644 --- a/libraries/README.md +++ b/libraries/README.md @@ -83,6 +83,7 @@ - [Guide to JMapper](http://www.baeldung.com/jmapper) - [An Introduction to Apache Commons Lang 3](https://www.baeldung.com/java-commons-lang-3) - [Exactly Once Processing in Kafka](https://www.baeldung.com/kafka-exactly-once) +- [An Introduction to SuanShu](https://www.baeldung.com/suanshu) The libraries module contains examples related to small libraries that are relatively easy to use and does not require any separate module of its own. diff --git a/libraries/pom.xml b/libraries/pom.xml index 6bbe8e6f1c..cb85a57304 100644 --- a/libraries/pom.xml +++ b/libraries/pom.xml @@ -711,14 +711,26 @@ ${snakeyaml.version} + + com.numericalmethod + suanshu + ${suanshu.version} + + + + org.derive4j + derive4j + ${derive4j.version} + true + - + false @@ -731,6 +743,12 @@ Apache Staging https://repository.apache.org/content/groups/staging + + nm-repo + Numerical Method's Maven Repository + http://repo.numericalmethod.com/maven/ + default + @@ -835,6 +853,7 @@ + 4.0.0 1.21 1.23.0 0.1.0 @@ -929,7 +948,7 @@ 2.0.4 1.3.1 1.2.6 - 4.7 + 4.8.1 1.0.1 3.3.5 2.1 @@ -939,6 +958,7 @@ 4.5.1 3.3.0 3.0.2 + 1.1.0
diff --git a/libraries/src/main/java/com/baeldung/derive4j/adt/Either.java b/libraries/src/main/java/com/baeldung/derive4j/adt/Either.java new file mode 100644 index 0000000000..d22bb89fe2 --- /dev/null +++ b/libraries/src/main/java/com/baeldung/derive4j/adt/Either.java @@ -0,0 +1,10 @@ +package com.baeldung.derive4j.adt; + +import org.derive4j.Data; + +import java.util.function.Function; + +@Data +interface Either{ + X match(Function left, Function right); +} diff --git a/libraries/src/main/java/com/baeldung/derive4j/lazy/LazyRequest.java b/libraries/src/main/java/com/baeldung/derive4j/lazy/LazyRequest.java new file mode 100644 index 0000000000..9f53f3d25b --- /dev/null +++ b/libraries/src/main/java/com/baeldung/derive4j/lazy/LazyRequest.java @@ -0,0 +1,21 @@ +package com.baeldung.derive4j.lazy; + +import org.derive4j.Data; +import org.derive4j.Derive; +import org.derive4j.Make; + +@Data(value = @Derive( + inClass = "{ClassName}Impl", + make = {Make.lazyConstructor, Make.constructors} +)) +public interface LazyRequest { + interface Cases{ + R GET(String path); + R POST(String path, String body); + R PUT(String path, String body); + R DELETE(String path); + } + + R match(LazyRequest.Cases method); +} + diff --git a/libraries/src/main/java/com/baeldung/derive4j/pattern/HTTPRequest.java b/libraries/src/main/java/com/baeldung/derive4j/pattern/HTTPRequest.java new file mode 100644 index 0000000000..04d630f1ef --- /dev/null +++ b/libraries/src/main/java/com/baeldung/derive4j/pattern/HTTPRequest.java @@ -0,0 +1,15 @@ +package com.baeldung.derive4j.pattern; + +import org.derive4j.Data; + +@Data +interface HTTPRequest { + interface Cases{ + R GET(String path); + R POST(String path, String body); + R PUT(String path, String body); + R DELETE(String path); + } + + R match(Cases method); +} diff --git a/libraries/src/main/java/com/baeldung/derive4j/pattern/HTTPResponse.java b/libraries/src/main/java/com/baeldung/derive4j/pattern/HTTPResponse.java new file mode 100644 index 0000000000..593f94a8b7 --- /dev/null +++ b/libraries/src/main/java/com/baeldung/derive4j/pattern/HTTPResponse.java @@ -0,0 +1,19 @@ +package com.baeldung.derive4j.pattern; + +public class HTTPResponse { + private int statusCode; + private String responseBody; + + public int getStatusCode() { + return statusCode; + } + + public String getResponseBody() { + return responseBody; + } + + public HTTPResponse(int statusCode, String responseBody) { + this.statusCode = statusCode; + this.responseBody = responseBody; + } +} diff --git a/libraries/src/main/java/com/baeldung/derive4j/pattern/HTTPServer.java b/libraries/src/main/java/com/baeldung/derive4j/pattern/HTTPServer.java new file mode 100644 index 0000000000..53f4af628c --- /dev/null +++ b/libraries/src/main/java/com/baeldung/derive4j/pattern/HTTPServer.java @@ -0,0 +1,17 @@ +package com.baeldung.derive4j.pattern; + + +public class HTTPServer { + public static String GET_RESPONSE_BODY = "Success!"; + public static String PUT_RESPONSE_BODY = "Resource Created!"; + public static String POST_RESPONSE_BODY = "Resource Updated!"; + public static String DELETE_RESPONSE_BODY = "Resource Deleted!"; + + public HTTPResponse acceptRequest(HTTPRequest request) { + return HTTPRequests.caseOf(request) + .GET((path) -> new HTTPResponse(200, GET_RESPONSE_BODY)) + .POST((path,body) -> new HTTPResponse(201, POST_RESPONSE_BODY)) + .PUT((path,body) -> new HTTPResponse(200, PUT_RESPONSE_BODY)) + .DELETE(path -> new HTTPResponse(200, DELETE_RESPONSE_BODY)); + } +} diff --git a/libraries/src/main/java/com/baeldung/suanshu/SuanShuMath.java b/libraries/src/main/java/com/baeldung/suanshu/SuanShuMath.java new file mode 100644 index 0000000000..46af24692d --- /dev/null +++ b/libraries/src/main/java/com/baeldung/suanshu/SuanShuMath.java @@ -0,0 +1,142 @@ +package com.baeldung.suanshu; + +import java.util.List; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import com.numericalmethod.suanshu.algebra.linear.matrix.doubles.Matrix; +import com.numericalmethod.suanshu.algebra.linear.vector.doubles.Vector; +import com.numericalmethod.suanshu.algebra.linear.vector.doubles.dense.DenseVector; +import com.numericalmethod.suanshu.algebra.linear.matrix.doubles.matrixtype.dense.DenseMatrix; +import com.numericalmethod.suanshu.algebra.linear.matrix.doubles.operation.Inverse; +import com.numericalmethod.suanshu.analysis.function.polynomial.Polynomial; +import com.numericalmethod.suanshu.analysis.function.polynomial.root.PolyRoot; +import com.numericalmethod.suanshu.analysis.function.polynomial.root.PolyRootSolver; +import com.numericalmethod.suanshu.number.complex.Complex; + +class SuanShuMath { + + private static final Logger log = LoggerFactory.getLogger(SuanShuMath.class); + + public static void main(String[] args) throws Exception { + SuanShuMath math = new SuanShuMath(); + + math.addingVectors(); + math.scaleVector(); + math.innerProductVectors(); + math.addingIncorrectVectors(); + + math.addingMatrices(); + math.multiplyMatrices(); + math.multiplyIncorrectMatrices(); + math.inverseMatrix(); + + Polynomial p = math.createPolynomial(); + math.evaluatePolynomial(p); + math.solvePolynomial(); + } + + public void addingVectors() throws Exception { + Vector v1 = new DenseVector(new double[]{1, 2, 3, 4, 5}); + Vector v2 = new DenseVector(new double[]{5, 4, 3, 2, 1}); + Vector v3 = v1.add(v2); + log.info("Adding vectors: {}", v3); + } + + public void scaleVector() throws Exception { + Vector v1 = new DenseVector(new double[]{1, 2, 3, 4, 5}); + Vector v2 = v1.scaled(2.0); + log.info("Scaling a vector: {}", v2); + } + + public void innerProductVectors() throws Exception { + Vector v1 = new DenseVector(new double[]{1, 2, 3, 4, 5}); + Vector v2 = new DenseVector(new double[]{5, 4, 3, 2, 1}); + double inner = v1.innerProduct(v2); + log.info("Vector inner product: {}", inner); + } + + public void addingIncorrectVectors() throws Exception { + Vector v1 = new DenseVector(new double[]{1, 2, 3}); + Vector v2 = new DenseVector(new double[]{5, 4}); + Vector v3 = v1.add(v2); + log.info("Adding vectors: {}", v3); + } + + public void addingMatrices() throws Exception { + Matrix m1 = new DenseMatrix(new double[][]{ + {1, 2, 3}, + {4, 5, 6} + }); + + Matrix m2 = new DenseMatrix(new double[][]{ + {3, 2, 1}, + {6, 5, 4} + }); + + Matrix m3 = m1.add(m2); + log.info("Adding matrices: {}", m3); + } + + public void multiplyMatrices() throws Exception { + Matrix m1 = new DenseMatrix(new double[][]{ + {1, 2, 3}, + {4, 5, 6} + }); + + Matrix m2 = new DenseMatrix(new double[][]{ + {1, 4}, + {2, 5}, + {3, 6} + }); + + Matrix m3 = m1.multiply(m2); + log.info("Multiplying matrices: {}", m3); + } + + public void multiplyIncorrectMatrices() throws Exception { + Matrix m1 = new DenseMatrix(new double[][]{ + {1, 2, 3}, + {4, 5, 6} + }); + + Matrix m2 = new DenseMatrix(new double[][]{ + {3, 2, 1}, + {6, 5, 4} + }); + + Matrix m3 = m1.multiply(m2); + log.info("Multiplying matrices: {}", m3); + } + + public void inverseMatrix() { + Matrix m1 = new DenseMatrix(new double[][]{ + {1, 2}, + {3, 4} + }); + + Inverse m2 = new Inverse(m1); + log.info("Inverting a matrix: {}", m2); + log.info("Verifying a matrix inverse: {}", m1.multiply(m2)); + } + + public Polynomial createPolynomial() { + return new Polynomial(new double[]{3, -5, 1}); + } + + public void evaluatePolynomial(Polynomial p) { + // Evaluate using a real number + log.info("Evaluating a polynomial using a real number: {}", p.evaluate(5)); + // Evaluate using a complex number + log.info("Evaluating a polynomial using a complex number: {}", p.evaluate(new Complex(1, 2))); + } + + public void solvePolynomial() { + Polynomial p = new Polynomial(new double[]{2, 2, -4}); + PolyRootSolver solver = new PolyRoot(); + List roots = solver.solve(p); + log.info("Finding polynomial roots: {}", roots); + } + +} diff --git a/libraries/src/test/java/com/baeldung/derive4j/adt/EitherUnitTest.java b/libraries/src/test/java/com/baeldung/derive4j/adt/EitherUnitTest.java new file mode 100644 index 0000000000..511e24961f --- /dev/null +++ b/libraries/src/test/java/com/baeldung/derive4j/adt/EitherUnitTest.java @@ -0,0 +1,33 @@ +package com.baeldung.derive4j.adt; + +import org.assertj.core.api.Assertions; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.Mockito; +import org.mockito.junit.MockitoJUnitRunner; + +import java.util.Optional; +import java.util.function.Function; +@RunWith(MockitoJUnitRunner.class) +public class EitherUnitTest { + @Test + public void testEitherIsCreatedFromRight() { + Either either = Eithers.right("Okay"); + Optional leftOptional = Eithers.getLeft(either); + Optional rightOptional = Eithers.getRight(either); + Assertions.assertThat(leftOptional).isEmpty(); + Assertions.assertThat(rightOptional).hasValue("Okay"); + + } + + @Test + public void testEitherIsMatchedWithRight() { + Either either = Eithers.right("Okay"); + Function leftFunction = Mockito.mock(Function.class); + Function rightFunction = Mockito.mock(Function.class); + either.match(leftFunction, rightFunction); + Mockito.verify(rightFunction, Mockito.times(1)).apply("Okay"); + Mockito.verify(leftFunction, Mockito.times(0)).apply(Mockito.any(Exception.class)); + } + +} diff --git a/libraries/src/test/java/com/baeldung/derive4j/lazy/LazyRequestUnitTest.java b/libraries/src/test/java/com/baeldung/derive4j/lazy/LazyRequestUnitTest.java new file mode 100644 index 0000000000..3830bc52d0 --- /dev/null +++ b/libraries/src/test/java/com/baeldung/derive4j/lazy/LazyRequestUnitTest.java @@ -0,0 +1,28 @@ +package com.baeldung.derive4j.lazy; + +import org.junit.Assert; +import org.junit.Test; +import org.mockito.Mockito; + +import java.util.function.Supplier; + +public class LazyRequestUnitTest { + + @Test + public void givenLazyContstructedRequest_whenRequestIsReferenced_thenRequestIsLazilyContructed() { + LazyRequestSupplier mockSupplier = Mockito.spy(new LazyRequestSupplier()); + + LazyRequest request = LazyRequestImpl.lazy(() -> mockSupplier.get()); + Mockito.verify(mockSupplier, Mockito.times(0)).get(); + Assert.assertEquals(LazyRequestImpl.getPath(request), "http://test.com/get"); + Mockito.verify(mockSupplier, Mockito.times(1)).get(); + + } + + class LazyRequestSupplier implements Supplier { + @Override + public LazyRequest get() { + return LazyRequestImpl.GET("http://test.com/get"); + } + } +} diff --git a/libraries/src/test/java/com/baeldung/derive4j/pattern/HTTPRequestUnitTest.java b/libraries/src/test/java/com/baeldung/derive4j/pattern/HTTPRequestUnitTest.java new file mode 100644 index 0000000000..0fc257742a --- /dev/null +++ b/libraries/src/test/java/com/baeldung/derive4j/pattern/HTTPRequestUnitTest.java @@ -0,0 +1,22 @@ +package com.baeldung.derive4j.pattern; + +import org.junit.Assert; +import org.junit.BeforeClass; +import org.junit.Test; + +public class HTTPRequestUnitTest { + public static HTTPServer server; + + @BeforeClass + public static void setUp() { + server = new HTTPServer(); + } + + @Test + public void givenHttpGETRequest_whenRequestReachesServer_thenProperResponseIsReturned() { + HTTPRequest postRequest = HTTPRequests.POST("http://test.com/post", "Resource"); + HTTPResponse response = server.acceptRequest(postRequest); + Assert.assertEquals(201, response.getStatusCode()); + Assert.assertEquals(HTTPServer.POST_RESPONSE_BODY, response.getResponseBody()); + } +} diff --git a/libraries/src/test/java/com/baeldung/fj/FunctionalJavaUnitTest.java b/libraries/src/test/java/com/baeldung/fj/FunctionalJavaUnitTest.java index d62a115abd..aa06ba4eb9 100644 --- a/libraries/src/test/java/com/baeldung/fj/FunctionalJavaUnitTest.java +++ b/libraries/src/test/java/com/baeldung/fj/FunctionalJavaUnitTest.java @@ -1,79 +1,122 @@ -package com.baeldung.fj; - -import static org.junit.Assert.assertEquals; - -import org.junit.Test; - -import fj.F; -import fj.data.Array; -import fj.data.List; -import fj.data.Option; -import fj.function.Characters; -import fj.function.Integers; - -public class FunctionalJavaUnitTest { - - public static final F isEven = i -> i % 2 == 0; - - @Test - public void calculateEvenNumbers_givenIntList_returnTrue() { - List fList = List.list(3, 4, 5, 6); - List evenList = fList.map(isEven); - List evenListTrueResult = List.list(false, true, false, true); - List evenListFalseResult = List.list(true, false, false, true); - assertEquals(evenList.equals(evenListTrueResult), true); - assertEquals(evenList.equals(evenListFalseResult), false); - } - - @Test - public void mapList_givenIntList_returnResult() { - List fList = List.list(3, 4, 5, 6); - fList = fList.map(i -> i + 100); - List resultList = List.list(103, 104, 105, 106); - List falseResultList = List.list(15, 504, 105, 106); - assertEquals(fList.equals(resultList), true); - assertEquals(fList.equals(falseResultList), false); - } - - @Test - public void filterList_givenIntList_returnResult() { - Array array = Array.array(3, 4, 5, 6); - Array filteredArray = array.filter(Integers.even); - Array result = Array.array(4, 6); - Array wrongResult = Array.array(3, 5); - assertEquals(filteredArray.equals(result), true); - assertEquals(filteredArray.equals(wrongResult), false); - } - - @Test - public void checkForLowerCase_givenStringArray_returnResult() { - Array array = Array.array("Welcome", "To", "baeldung"); - Array array2 = Array.array("Welcome", "To", "Baeldung"); - Boolean isExist = array.exists(s -> List.fromString(s).forall(Characters.isLowerCase)); - Boolean isExist2 = array2.exists(s -> List.fromString(s).forall(Characters.isLowerCase)); - assertEquals(isExist, true); - assertEquals(isExist2, false); - } - - @Test - public void checkOptions_givenOptions_returnResult() { - Option n1 = Option.some(1); - Option n2 = Option.some(2); - - F> f1 = i -> i % 2 == 0 ? Option.some(i + 100) : Option.none(); - - Option result1 = n1.bind(f1); - Option result2 = n2.bind(f1); - - assertEquals(result1, Option.none()); - assertEquals(result2, Option.some(102)); - } - - @Test - public void foldLeft_givenArray_returnResult() { - Array intArray = Array.array(17, 44, 67, 2, 22, 80, 1, 27); - int sum = intArray.foldLeft(Integers.add, 0); - assertEquals(sum, 260); - } - -} +package com.baeldung.fj; + +import static org.junit.Assert.assertEquals; + +import org.junit.Test; + +import fj.F; +import fj.Show; +import fj.data.Array; +import fj.data.List; +import fj.data.Option; +import fj.function.Characters; +import fj.function.Integers; + +public class FunctionalJavaUnitTest { + + public static final F isEven = i -> i % 2 == 0; + + public static final Integer timesTwoRegular(Integer i) { + return i * 2; + } + + public static final F timesTwo = i -> i * 2; + + public static final F plusOne = i -> i + 1; + + @Test + public void multiplyNumbers_givenIntList_returnTrue() { + List fList = List.list(1, 2, 3, 4); + List fList1 = fList.map(timesTwo); + List fList2 = fList.map(i -> i * 2); + + assertEquals(fList1.equals(fList2), true); + } + + @Test + public void applyMultipleFunctions_givenIntList_returnFalse() { + List fList = List.list(1, 2, 3, 4); + List fList1 = fList.map(timesTwo).map(plusOne); + Show.listShow(Show.intShow).println(fList1); + List fList2 = fList.map(plusOne).map(timesTwo); + Show.listShow(Show.intShow).println(fList2); + + assertEquals(fList1.equals(fList2), false); + } + + @Test + public void calculateEvenNumbers_givenIntList_returnTrue() { + List fList = List.list(3, 4, 5, 6); + List evenList = fList.map(isEven); + List evenListTrueResult = List.list(false, true, false, true); + List evenListFalseResult = List.list(true, false, false, true); + + assertEquals(evenList.equals(evenListTrueResult), true); + assertEquals(evenList.equals(evenListFalseResult), false); + } + + @Test + public void mapList_givenIntList_returnResult() { + List fList = List.list(3, 4, 5, 6); + fList = fList.map(i -> i + 100); + List resultList = List.list(103, 104, 105, 106); + List falseResultList = List.list(15, 504, 105, 106); + + assertEquals(fList.equals(resultList), true); + assertEquals(fList.equals(falseResultList), false); + } + + @Test + public void filterList_givenIntList_returnResult() { + Array array = Array.array(3, 4, 5, 6); + Array filteredArray = array.filter(isEven); + Array result = Array.array(4, 6); + Array wrongResult = Array.array(3, 5); + + assertEquals(filteredArray.equals(result), true); + assertEquals(filteredArray.equals(wrongResult), false); + } + + @Test + public void checkForLowerCase_givenStringArray_returnResult() { + Array array = Array.array("Welcome", "To", "baeldung"); + Array array2 = Array.array("Welcome", "To", "Baeldung"); + Boolean isExist = array.exists(s -> List.fromString(s).forall(Characters.isLowerCase)); + Boolean isExist2 = array2.exists(s -> List.fromString(s).forall(Characters.isLowerCase)); + Boolean isAll = array.forall(s -> List.fromString(s).forall(Characters.isLowerCase)); + + assertEquals(isExist, true); + assertEquals(isExist2, false); + assertEquals(isAll, false); + } + + @Test + public void checkOptions_givenOptions_returnResult() { + Option n1 = Option.some(1); + Option n2 = Option.some(2); + Option n3 = Option.none(); + + F> function = i -> i % 2 == 0 ? Option.some(i + 100) : Option.none(); + + Option result1 = n1.bind(function); + Option result2 = n2.bind(function); + Option result3 = n3.bind(function); + + assertEquals(result1, Option.none()); + assertEquals(result2, Option.some(102)); + assertEquals(result3, Option.none()); + } + + @Test + public void foldLeft_givenArray_returnResult() { + Array intArray = Array.array(17, 44, 67, 2, 22, 80, 1, 27); + int sumAll = intArray.foldLeft(Integers.add, 0); + + assertEquals(sumAll, 260); + + int sumEven = intArray.filter(isEven).foldLeft(Integers.add, 0); + + assertEquals(sumEven, 148); + } + +} diff --git a/linkrest/pom.xml b/linkrest/pom.xml index a27caea1ff..073a173aff 100644 --- a/linkrest/pom.xml +++ b/linkrest/pom.xml @@ -1,9 +1,9 @@ 4.0.0 - com.baeldung linkrest 0.0.1-SNAPSHOT + linkrest war diff --git a/logging-modules/log4j/pom.xml b/logging-modules/log4j/pom.xml index 432295fc62..af97d812de 100644 --- a/logging-modules/log4j/pom.xml +++ b/logging-modules/log4j/pom.xml @@ -1,10 +1,12 @@ - 4.0.0 com.baeldung log4j 1.0-SNAPSHOT + log4j com.baeldung diff --git a/logging-modules/log4j2/pom.xml b/logging-modules/log4j2/pom.xml index 65da318636..d46f92dcd6 100644 --- a/logging-modules/log4j2/pom.xml +++ b/logging-modules/log4j2/pom.xml @@ -3,7 +3,8 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 log4j2 - + log4j2 + com.baeldung parent-modules diff --git a/lombok/README.md b/lombok/README.md index d12c14416d..bd6282fd18 100644 --- a/lombok/README.md +++ b/lombok/README.md @@ -3,3 +3,5 @@ - [Using Lombok’s @Builder Annotation](http://www.baeldung.com/lombok-builder) - [Using Lombok’s @Getter for Boolean Fields](https://www.baeldung.com/lombok-getter-boolean) - [Lombok @Builder with Inheritance](https://www.baeldung.com/lombok-builder-inheritance) +- [Lombok Builder with Default Value](https://www.baeldung.com/lombok-builder-default-value) +- [Lombok Builder with Custom Setter](https://www.baeldung.com/lombok-builder-custom-setter) diff --git a/lombok/pom.xml b/lombok/pom.xml index eba140122a..7ad2e3dc83 100644 --- a/lombok/pom.xml +++ b/lombok/pom.xml @@ -59,6 +59,7 @@ ${project.basedir}/src/main/java + ${project.build.directory}/delombok false skip diff --git a/lombok/src/main/java/com/baeldung/lombok/builder/customsetter/Message.java b/lombok/src/main/java/com/baeldung/lombok/builder/customsetter/Message.java new file mode 100644 index 0000000000..6c58763143 --- /dev/null +++ b/lombok/src/main/java/com/baeldung/lombok/builder/customsetter/Message.java @@ -0,0 +1,39 @@ +package com.baeldung.lombok.builder.customsetter; + +import java.io.File; +import java.util.List; + +import lombok.Builder; +import lombok.Data; + +@Builder +@Data +public class Message { + private String sender; + private String recipient; + private String text; + private File file; + + public static class MessageBuilder { + private String text; + private File file; + + public MessageBuilder text(String text) { + this.text = text; + verifyTextOrFile(); + return this; + } + + public MessageBuilder file(File file) { + this.file = file; + verifyTextOrFile(); + return this; + } + + private void verifyTextOrFile() { + if (text != null && file != null) { + throw new IllegalStateException("Cannot send 'text' and 'file'."); + } + } + } +} diff --git a/lombok/src/main/java/com/baeldung/lombok/builder/defaultvalue/Pojo.java b/lombok/src/main/java/com/baeldung/lombok/builder/defaultvalue/Pojo.java new file mode 100644 index 0000000000..feaade9cd5 --- /dev/null +++ b/lombok/src/main/java/com/baeldung/lombok/builder/defaultvalue/Pojo.java @@ -0,0 +1,17 @@ +package com.baeldung.lombok.builder.defaultvalue; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; + +@Getter +@Setter +@Builder(toBuilder = true) +@NoArgsConstructor +@AllArgsConstructor +public class Pojo { + private String name = "foo"; + private boolean original = true; +} diff --git a/lombok/src/test/java/com/baeldung/lombok/builder/customsetter/BuilderWithCustomSetterUnitTest.java b/lombok/src/test/java/com/baeldung/lombok/builder/customsetter/BuilderWithCustomSetterUnitTest.java new file mode 100644 index 0000000000..3143747f0d --- /dev/null +++ b/lombok/src/test/java/com/baeldung/lombok/builder/customsetter/BuilderWithCustomSetterUnitTest.java @@ -0,0 +1,37 @@ +package com.baeldung.lombok.builder.customsetter; + +import java.io.File; + +import org.junit.Test; + +public class BuilderWithCustomSetterUnitTest { + + @Test + public void givenBuilderWithCustomSetter_TestTextOnly() { + Message message = Message.builder() + .sender("user@somedomain.com") + .recipient("someuser@otherdomain.com") + .text("How are you today?") + .build(); + } + + @Test + public void givenBuilderWithCustomSetter_TestFileOnly() { + Message message = Message.builder() + .sender("user@somedomain.com") + .recipient("someuser@otherdomain.com") + .file(new File("/path/to/file")) + .build(); + } + + @Test(expected = IllegalStateException.class) + public void givenBuilderWithCustomSetter_TestTextAndFile() { + Message message = Message.builder() + .sender("user@somedomain.com") + .recipient("someuser@otherdomain.com") + .text("How are you today?") + .file(new File("/path/to/file")) + .build(); + } + +} diff --git a/lombok/src/test/java/com/baeldung/lombok/builder/defaultvalue/BuilderWithDefaultValueUnitTest.java b/lombok/src/test/java/com/baeldung/lombok/builder/defaultvalue/BuilderWithDefaultValueUnitTest.java new file mode 100644 index 0000000000..d9184f605c --- /dev/null +++ b/lombok/src/test/java/com/baeldung/lombok/builder/defaultvalue/BuilderWithDefaultValueUnitTest.java @@ -0,0 +1,25 @@ +package com.baeldung.lombok.builder.defaultvalue; + +import org.junit.Assert; +import org.junit.Test; + +public class BuilderWithDefaultValueUnitTest { + + @Test + public void givenBuilderWithDefaultValue_ThanDefaultValueIsPresent() { + Pojo build = new Pojo().toBuilder() + .build(); + Assert.assertEquals("foo", build.getName()); + Assert.assertTrue(build.isOriginal()); + } + + @Test + public void givenBuilderWithDefaultValue_NoArgsWorksAlso() { + Pojo build = new Pojo().toBuilder() + .build(); + Pojo pojo = new Pojo(); + Assert.assertEquals(build.getName(), pojo.getName()); + Assert.assertTrue(build.isOriginal() == pojo.isOriginal()); + } + +} diff --git a/maven-archetype/pom.xml b/maven-archetype/pom.xml index f7871c81ea..73ddc78fc7 100644 --- a/maven-archetype/pom.xml +++ b/maven-archetype/pom.xml @@ -5,9 +5,10 @@ com.baeldung.archetypes maven-archetype 1.0-SNAPSHOT + maven-archetype maven-archetype Archetype used to generate rest application based on jaxrs 2.1 - + diff --git a/maven-polyglot/README.md b/maven-polyglot/README.md index 589315efd1..8635c8eddf 100644 --- a/maven-polyglot/README.md +++ b/maven-polyglot/README.md @@ -1,3 +1,4 @@ To run the maven-polyglot-json-app successfully, you first have to build the maven-polyglot-json-extension module using: mvn clean install. -Related Articles: +### Relevant Articles: +- [Maven Polyglot](https://www.baeldung.com/maven-polyglot) diff --git a/maven-polyglot/maven-polyglot-json-extension/pom.xml b/maven-polyglot/maven-polyglot-json-extension/pom.xml index d5c5b7ab55..fe1e025d1f 100644 --- a/maven-polyglot/maven-polyglot-json-extension/pom.xml +++ b/maven-polyglot/maven-polyglot-json-extension/pom.xml @@ -3,11 +3,11 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 - com.baeldung.maven.polyglot maven-polyglot-json-extension 1.0-SNAPSHOT - + maven-polyglot-json-extension + 1.8 1.8 diff --git a/maven/README.md b/maven/README.md index 2d838bcb76..1c0e50f95a 100644 --- a/maven/README.md +++ b/maven/README.md @@ -10,3 +10,7 @@ - [Build a Jar with Maven and Ignore the Test Results](http://www.baeldung.com/maven-ignore-test-results) - [Maven Project with Multiple Source Directories](https://www.baeldung.com/maven-project-multiple-src-directories) - [Integration Testing with Maven](https://www.baeldung.com/maven-integration-test) +- [Apache Maven Standard Directory Layout](https://www.baeldung.com/maven-directory-structure) +- [Apache Maven Tutorial](https://www.baeldung.com/maven) +- [Use the Latest Version of a Dependency in Maven](https://www.baeldung.com/maven-dependency-latest-version) +- [Multi-Module Project with Maven](https://www.baeldung.com/maven-multi-module) diff --git a/maven/pom.xml b/maven/pom.xml index 4bec533226..01fd28db74 100644 --- a/maven/pom.xml +++ b/maven/pom.xml @@ -4,6 +4,7 @@ com.baeldung maven 0.0.1-SNAPSHOT + maven war diff --git a/maven/versions-maven-plugin/pom.xml b/maven/versions-maven-plugin/pom.xml index 295c77b860..dc0cba75f9 100644 --- a/maven/versions-maven-plugin/pom.xml +++ b/maven/versions-maven-plugin/pom.xml @@ -3,9 +3,10 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 com.baeldung - versions-maven-plugin-example + versions-maven-plugin 0.0.1-SNAPSHOT - + versions-maven-plugin + 1.15 diff --git a/mesos-marathon/pom.xml b/mesos-marathon/pom.xml index f92c00892b..dee8eca10d 100644 --- a/mesos-marathon/pom.xml +++ b/mesos-marathon/pom.xml @@ -5,7 +5,8 @@ com.baeldung mesos-marathon 0.0.1-SNAPSHOT - + mesos-marathon + parent-boot-1 com.baeldung diff --git a/metrics/pom.xml b/metrics/pom.xml index 9cf1ec588f..79d340aa49 100644 --- a/metrics/pom.xml +++ b/metrics/pom.xml @@ -3,7 +3,8 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 metrics - + metrics + parent-modules com.baeldung diff --git a/micronaut/pom.xml b/micronaut/pom.xml index 7b722306b6..aa69c77f73 100644 --- a/micronaut/pom.xml +++ b/micronaut/pom.xml @@ -7,15 +7,10 @@ com.baeldung.micronaut.helloworld.server.ServerApplication - 1.0.0.M2 - 9 + 1.0.0.RC2 + 1.8 - - - jcenter.bintray.com - http://jcenter.bintray.com - - + diff --git a/micronaut/src/main/java/com/baeldung/micronaut/helloworld/client/ConcreteGreetingClient.java b/micronaut/src/main/java/com/baeldung/micronaut/helloworld/client/ConcreteGreetingClient.java index d4051cef52..96bc51f235 100644 --- a/micronaut/src/main/java/com/baeldung/micronaut/helloworld/client/ConcreteGreetingClient.java +++ b/micronaut/src/main/java/com/baeldung/micronaut/helloworld/client/ConcreteGreetingClient.java @@ -1,7 +1,7 @@ package com.baeldung.micronaut.helloworld.client; import io.micronaut.http.HttpRequest; -import io.micronaut.http.client.Client; +import io.micronaut.http.client.annotation.Client; import io.micronaut.http.client.RxHttpClient; import io.reactivex.Single; diff --git a/micronaut/src/main/java/com/baeldung/micronaut/helloworld/client/GreetingClient.java b/micronaut/src/main/java/com/baeldung/micronaut/helloworld/client/GreetingClient.java index 8a691d5b06..d29a97fd50 100644 --- a/micronaut/src/main/java/com/baeldung/micronaut/helloworld/client/GreetingClient.java +++ b/micronaut/src/main/java/com/baeldung/micronaut/helloworld/client/GreetingClient.java @@ -1,10 +1,7 @@ package com.baeldung.micronaut.helloworld.client; import io.micronaut.http.annotation.Get; -import io.micronaut.http.client.Client; -import io.micronaut.http.client.RxHttpClient; - -import javax.inject.Inject; +import io.micronaut.http.client.annotation.Client; @Client("/greet") public interface GreetingClient { diff --git a/microprofile/pom.xml b/microprofile/pom.xml index d75b6443ed..52df348ace 100644 --- a/microprofile/pom.xml +++ b/microprofile/pom.xml @@ -5,6 +5,7 @@ com.baeldung microprofile 1.0-SNAPSHOT + microprofile war diff --git a/msf4j/pom.xml b/msf4j/pom.xml index 9a6483772b..4a6f63159d 100644 --- a/msf4j/pom.xml +++ b/msf4j/pom.xml @@ -5,6 +5,7 @@ com.baeldung.msf4j msf4j 0.0.1-SNAPSHOT + msf4j parent-modules diff --git a/muleesb/pom.xml b/muleesb/pom.xml index b34123567a..4b74b6d4f4 100644 --- a/muleesb/pom.xml +++ b/muleesb/pom.xml @@ -6,9 +6,9 @@ com.mycompany muleesb 1.0.0-SNAPSHOT - mule - Mule muleesb Application - + muleesb + mule + com.baeldung parent-modules diff --git a/mybatis/pom.xml b/mybatis/pom.xml index aa9ff9e288..4e63d14ded 100644 --- a/mybatis/pom.xml +++ b/mybatis/pom.xml @@ -5,7 +5,8 @@ com.baeldung mybatis 1.0.0-SNAPSHOT - + mybatis + com.baeldung parent-modules diff --git a/optaplanner/pom.xml b/optaplanner/pom.xml index 22abbedc8c..fbce0ea072 100644 --- a/optaplanner/pom.xml +++ b/optaplanner/pom.xml @@ -2,14 +2,15 @@ + 4.0.0 + optaplanner + optaplanner + parent-modules com.baeldung 1.0.0-SNAPSHOT - 4.0.0 - - optaplanner diff --git a/out/production/main/com/baeldung/README.md b/out/production/main/com/baeldung/README.md deleted file mode 100644 index 51809b2882..0000000000 --- a/out/production/main/com/baeldung/README.md +++ /dev/null @@ -1,2 +0,0 @@ -### Relevant Articles: -- [SHA-256 Hashing in Java](http://www.baeldung.com/sha-256-hashing-java) diff --git a/out/production/main/com/baeldung/enums/README.md b/out/production/main/com/baeldung/enums/README.md deleted file mode 100644 index 6ccfa725f5..0000000000 --- a/out/production/main/com/baeldung/enums/README.md +++ /dev/null @@ -1,2 +0,0 @@ -### Relevant Articles: -- [A Guide to Java Enums](http://www.baeldung.com/a-guide-to-java-enums) diff --git a/out/production/main/com/baeldung/networking/README.md b/out/production/main/com/baeldung/networking/README.md deleted file mode 100644 index b9e827f085..0000000000 --- a/out/production/main/com/baeldung/networking/README.md +++ /dev/null @@ -1,5 +0,0 @@ -### Relevant Articles: -- [A Guide To UDP In Java](http://www.baeldung.com/udp-in-java) -- [A Guide To HTTP Cookies In Java](http://www.baeldung.com/cookies-java) -- [A Guide to the Java URL](http://www.baeldung.com/java-url) -- [Working with Network Interfaces in Java](http://www.baeldung.com/java-network-interfaces) diff --git a/out/production/main/com/baeldung/objectsize/MANIFEST.MF b/out/production/main/com/baeldung/objectsize/MANIFEST.MF deleted file mode 100644 index b814f624d0..0000000000 --- a/out/production/main/com/baeldung/objectsize/MANIFEST.MF +++ /dev/null @@ -1 +0,0 @@ -Premain-class: com.baeldung.objectsize.InstrumentationAgent diff --git a/out/production/main/com/baeldung/printscreen/README.md b/out/production/main/com/baeldung/printscreen/README.md deleted file mode 100644 index 7b3b40c102..0000000000 --- a/out/production/main/com/baeldung/printscreen/README.md +++ /dev/null @@ -1,2 +0,0 @@ -### Relevant Articles: -- [How to Print Screen in Java](http://www.baeldung.com/print-screen-in-java) diff --git a/out/production/main/javac-args/arguments b/out/production/main/javac-args/arguments deleted file mode 100644 index 51639800a7..0000000000 --- a/out/production/main/javac-args/arguments +++ /dev/null @@ -1,2 +0,0 @@ --d javac-target -verbose -com/baeldung/javac/Data.java \ No newline at end of file diff --git a/out/production/main/javac-args/options b/out/production/main/javac-args/options deleted file mode 100644 index f02f2344ff..0000000000 --- a/out/production/main/javac-args/options +++ /dev/null @@ -1,2 +0,0 @@ --d javac-target --verbose \ No newline at end of file diff --git a/out/production/main/javac-args/types b/out/production/main/javac-args/types deleted file mode 100644 index ef2d861f84..0000000000 --- a/out/production/main/javac-args/types +++ /dev/null @@ -1 +0,0 @@ -com/baeldung/javac/Data.java \ No newline at end of file diff --git a/out/production/main/javac-args/xlint-ops b/out/production/main/javac-args/xlint-ops deleted file mode 100644 index cdccbc0cce..0000000000 --- a/out/production/main/javac-args/xlint-ops +++ /dev/null @@ -1,3 +0,0 @@ --d javac-target --Xlint:rawtypes,unchecked,static,cast,serial,fallthrough -com/baeldung/javac/Data.java \ No newline at end of file diff --git a/out/production/main/log4j.properties b/out/production/main/log4j.properties deleted file mode 100644 index 5fe42d854c..0000000000 --- a/out/production/main/log4j.properties +++ /dev/null @@ -1,9 +0,0 @@ -# Set root logger level to DEBUG and its only appender to A1. -log4j.rootLogger=DEBUG, 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=%-4r [%t] %-5p %c %x - %m%n diff --git a/out/production/main1/com/baeldung/datetime/README.md b/out/production/main1/com/baeldung/datetime/README.md deleted file mode 100644 index 1e4adbb612..0000000000 --- a/out/production/main1/com/baeldung/datetime/README.md +++ /dev/null @@ -1,2 +0,0 @@ -### Relevant Articles: -- [Introduction to the Java 8 Date/Time API](http://www.baeldung.com/java-8-date-time-intro) diff --git a/out/test/test/com/baeldung/hexToAscii/README.md b/out/test/test/com/baeldung/hexToAscii/README.md deleted file mode 100644 index c6d5826333..0000000000 --- a/out/test/test/com/baeldung/hexToAscii/README.md +++ /dev/null @@ -1,2 +0,0 @@ -### Relevant Articles: -- [Convert Hex to ASCII in Java](http://www.baeldung.com/java-convert-hex-to-ascii) diff --git a/out/test/test/com/baeldung/java/conversion/README.md b/out/test/test/com/baeldung/java/conversion/README.md deleted file mode 100644 index 7c81180249..0000000000 --- a/out/test/test/com/baeldung/java/conversion/README.md +++ /dev/null @@ -1,2 +0,0 @@ -Relevant Articles: -- [Java String Conversions](http://www.baeldung.com/java-string-conversions) diff --git a/out/test/test/com/baeldung/stringisnumeric.zip b/out/test/test/com/baeldung/stringisnumeric.zip deleted file mode 100644 index b8a7b9b35a..0000000000 Binary files a/out/test/test/com/baeldung/stringisnumeric.zip and /dev/null differ diff --git a/parent-boot-1/README.md b/parent-boot-1/README.md deleted file mode 100644 index ff12555376..0000000000 --- a/parent-boot-1/README.md +++ /dev/null @@ -1 +0,0 @@ -## Relevant articles: diff --git a/parent-boot-1/pom.xml b/parent-boot-1/pom.xml index d220b4a6b7..53f91f975d 100644 --- a/parent-boot-1/pom.xml +++ b/parent-boot-1/pom.xml @@ -3,6 +3,7 @@ 4.0.0 parent-boot-1 0.0.1-SNAPSHOT + parent-boot-1 pom Parent for all Spring Boot 1.x modules @@ -17,7 +18,7 @@ org.springframework.boot spring-boot-dependencies - 1.5.16.RELEASE + ${spring-boot.version} pom import @@ -42,7 +43,11 @@ org.springframework.boot spring-boot-maven-plugin - 1.5.15.RELEASE + ${spring-boot.version} + + ${start-class} + + @@ -50,6 +55,7 @@ 3.1.0 + 1.5.16.RELEASE - - \ No newline at end of file + + diff --git a/parent-boot-2.0-temp/README.md b/parent-boot-2.0-temp/README.md new file mode 100644 index 0000000000..8134c8eafe --- /dev/null +++ b/parent-boot-2.0-temp/README.md @@ -0,0 +1,2 @@ +This pom will be ued only temporary until we migrate parent-boot-2 to 2.1.0 for ticket BAEL-10354 + diff --git a/parent-boot-2.0-temp/pom.xml b/parent-boot-2.0-temp/pom.xml new file mode 100644 index 0000000000..9284e4af13 --- /dev/null +++ b/parent-boot-2.0-temp/pom.xml @@ -0,0 +1,85 @@ + + 4.0.0 + parent-boot-2.0-temp + 0.0.1-SNAPSHOT + pom + Temporary Parent for all Spring Boot 2.0.x modules + + + + com.baeldung + parent-modules + 1.0.0-SNAPSHOT + + + + + + org.springframework.boot + spring-boot-dependencies + ${spring-boot.version} + pom + import + + + + + + io.rest-assured + rest-assured + + + org.springframework.boot + spring-boot-starter-test + test + + + + + + + + org.springframework.boot + spring-boot-maven-plugin + ${spring-boot.version} + + ${start-class} + + + + + + + + + + thin-jar + + + + org.springframework.boot + spring-boot-maven-plugin + + + + org.springframework.boot.experimental + spring-boot-thin-layout + ${thin.version} + + + + + + + + + + 3.1.0 + + 1.0.11.RELEASE + 2.0.5.RELEASE + + + + diff --git a/parent-boot-2/pom.xml b/parent-boot-2/pom.xml index de6cb5d068..280d226e95 100644 --- a/parent-boot-2/pom.xml +++ b/parent-boot-2/pom.xml @@ -3,6 +3,7 @@ 4.0.0 parent-boot-2 0.0.1-SNAPSHOT + parent-boot-2 pom Parent for all Spring Boot 2 modules @@ -17,7 +18,7 @@ org.springframework.boot spring-boot-dependencies - 2.0.4.RELEASE + ${spring-boot.version} pom import @@ -41,7 +42,11 @@ org.springframework.boot spring-boot-maven-plugin - 2.0.4.RELEASE + ${spring-boot.version} + + ${start-class} + + @@ -73,6 +78,8 @@ 3.1.0 1.0.11.RELEASE + 2.1.1.RELEASE + + -
\ No newline at end of file diff --git a/parent-kotlin/pom.xml b/parent-kotlin/pom.xml index 7fd18e4fa4..f8283bd920 100644 --- a/parent-kotlin/pom.xml +++ b/parent-kotlin/pom.xml @@ -13,18 +13,29 @@ 1.0.0-SNAPSHOT - - - jcenter - http://jcenter.bintray.com - - - kotlin-ktor - https://dl.bintray.com/kotlin/ktor/ - - - - + + + jcenter + http://jcenter.bintray.com + + + kotlin-ktor + https://dl.bintray.com/kotlin/ktor/ + + + kotlin-eap + http://dl.bintray.com/kotlin/kotlin-eap + + + + + + kotlin-eap + http://dl.bintray.com/kotlin/kotlin-eap + + + + org.springframework.boot @@ -42,6 +53,11 @@ kotlin-stdlib-jdk8 ${kotlin.version} + + org.jetbrains.kotlin + kotlin-stdlib + ${kotlin.version} + org.jetbrains.kotlin kotlin-reflect @@ -157,6 +173,7 @@ + org.apache.maven.plugins maven-failsafe-plugin ${maven-failsafe-plugin.version} @@ -185,9 +202,9 @@ - 1.2.61 - 0.25.0 - 0.9.3 + 1.3.0 + 1.0.0 + 0.9.5 3.11.0 1.2.0 diff --git a/parent-spring-4/pom.xml b/parent-spring-4/pom.xml index d1b1298013..9b3c42599b 100644 --- a/parent-spring-4/pom.xml +++ b/parent-spring-4/pom.xml @@ -29,7 +29,7 @@ - 4.3.17.RELEASE + 4.3.20.RELEASE 5.0.2 diff --git a/patterns/design-patterns/README.md b/patterns/design-patterns/README.md index 75f7cec73a..e56872b3fd 100644 --- a/patterns/design-patterns/README.md +++ b/patterns/design-patterns/README.md @@ -12,3 +12,5 @@ - [The DAO Pattern in Java](http://www.baeldung.com/java-dao-pattern) - [Interpreter Design Pattern in Java](http://www.baeldung.com/java-interpreter-pattern) - [State Design Pattern in Java](https://www.baeldung.com/java-state-design-pattern) +- [The Decorator Pattern in Java](https://www.baeldung.com/java-decorator-pattern) +- [Abstract Factory Pattern in Java](https://www.baeldung.com/java-abstract-factory-pattern) diff --git a/patterns/design-patterns/pom.xml b/patterns/design-patterns/pom.xml index dc2631b36e..ac201ad653 100644 --- a/patterns/design-patterns/pom.xml +++ b/patterns/design-patterns/pom.xml @@ -4,7 +4,9 @@ 4.0.0 design-patterns 1.0 - jar + design-patterns + jar + com.baeldung patterns diff --git a/patterns/front-controller/pom.xml b/patterns/front-controller/pom.xml index 435b0dd9cd..bb003dd00a 100644 --- a/patterns/front-controller/pom.xml +++ b/patterns/front-controller/pom.xml @@ -3,6 +3,7 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 front-controller + front-controller war diff --git a/patterns/intercepting-filter/pom.xml b/patterns/intercepting-filter/pom.xml index fa94d5d1fd..33589dc242 100644 --- a/patterns/intercepting-filter/pom.xml +++ b/patterns/intercepting-filter/pom.xml @@ -2,8 +2,8 @@ 4.0.0 - intercepting-filter + intercepting-filter war diff --git a/patterns/pom.xml b/patterns/pom.xml index df09f1836a..bc1f5173e2 100644 --- a/patterns/pom.xml +++ b/patterns/pom.xml @@ -4,6 +4,7 @@ 4.0.0 patterns pom + patterns com.baeldung diff --git a/performance-tests/pom.xml b/performance-tests/pom.xml index 8c9d027724..7d77c2a0e3 100644 --- a/performance-tests/pom.xml +++ b/performance-tests/pom.xml @@ -4,7 +4,8 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 performance-tests - + performance-tests + parent-modules com.baeldung diff --git a/performance-tests/src/test/java/com/baeldung/performancetests/benchmark/MappingFrameworksPerformance.java b/performance-tests/src/test/java/com/baeldung/performancetests/benchmark/MappingFrameworksPerformance.java index e781f1fca1..1c9e4c5dc4 100644 --- a/performance-tests/src/test/java/com/baeldung/performancetests/benchmark/MappingFrameworksPerformance.java +++ b/performance-tests/src/test/java/com/baeldung/performancetests/benchmark/MappingFrameworksPerformance.java @@ -97,7 +97,7 @@ public class MappingFrameworksPerformance { sourceCode = new SourceCode("This is source code!"); } - public void main(String[] args) throws IOException, RunnerException { + public static void main(String[] args) throws IOException, RunnerException { org.openjdk.jmh.Main.main(args); } diff --git a/persistence-modules/README.md b/persistence-modules/README.md index f12163bd6a..87dc9522fd 100644 --- a/persistence-modules/README.md +++ b/persistence-modules/README.md @@ -9,3 +9,5 @@ - [Introduction to Lettuce – the Java Redis Client](http://www.baeldung.com/java-redis-lettuce) - [A Guide to Jdbi](http://www.baeldung.com/jdbi) - [Pessimistic Locking in JPA](http://www.baeldung.com/jpa-pessimistic-locking) +- [Get All Data from a Table with Hibernate](https://www.baeldung.com/hibernate-select-all) +- [Spring Data with Reactive Cassandra](https://www.baeldung.com/spring-data-cassandra-reactive) diff --git a/activejdbc/README.md b/persistence-modules/activejdbc/README.md similarity index 100% rename from activejdbc/README.md rename to persistence-modules/activejdbc/README.md diff --git a/activejdbc/pom.xml b/persistence-modules/activejdbc/pom.xml similarity index 98% rename from activejdbc/pom.xml rename to persistence-modules/activejdbc/pom.xml index 542e674ff3..6a29f14ced 100644 --- a/activejdbc/pom.xml +++ b/persistence-modules/activejdbc/pom.xml @@ -11,6 +11,7 @@ parent-modules com.baeldung 1.0.0-SNAPSHOT + ../../ diff --git a/activejdbc/src/main/java/com/baeldung/ActiveJDBCApp.java b/persistence-modules/activejdbc/src/main/java/com/baeldung/ActiveJDBCApp.java similarity index 100% rename from activejdbc/src/main/java/com/baeldung/ActiveJDBCApp.java rename to persistence-modules/activejdbc/src/main/java/com/baeldung/ActiveJDBCApp.java diff --git a/activejdbc/src/main/java/com/baeldung/model/Employee.java b/persistence-modules/activejdbc/src/main/java/com/baeldung/model/Employee.java similarity index 100% rename from activejdbc/src/main/java/com/baeldung/model/Employee.java rename to persistence-modules/activejdbc/src/main/java/com/baeldung/model/Employee.java diff --git a/activejdbc/src/main/java/com/baeldung/model/Role.java b/persistence-modules/activejdbc/src/main/java/com/baeldung/model/Role.java similarity index 100% rename from activejdbc/src/main/java/com/baeldung/model/Role.java rename to persistence-modules/activejdbc/src/main/java/com/baeldung/model/Role.java diff --git a/activejdbc/src/main/migration/_create_tables.sql b/persistence-modules/activejdbc/src/main/migration/_create_tables.sql similarity index 100% rename from activejdbc/src/main/migration/_create_tables.sql rename to persistence-modules/activejdbc/src/main/migration/_create_tables.sql diff --git a/activejdbc/src/main/resources/database.properties b/persistence-modules/activejdbc/src/main/resources/database.properties similarity index 100% rename from activejdbc/src/main/resources/database.properties rename to persistence-modules/activejdbc/src/main/resources/database.properties diff --git a/ejb/ejb-session-beans/src/main/resources/logback.xml b/persistence-modules/activejdbc/src/main/resources/logback.xml similarity index 100% rename from ejb/ejb-session-beans/src/main/resources/logback.xml rename to persistence-modules/activejdbc/src/main/resources/logback.xml diff --git a/activejdbc/src/test/java/com/baeldung/ActiveJDBCAppManualTest.java b/persistence-modules/activejdbc/src/test/java/com/baeldung/ActiveJDBCAppManualTest.java similarity index 100% rename from activejdbc/src/test/java/com/baeldung/ActiveJDBCAppManualTest.java rename to persistence-modules/activejdbc/src/test/java/com/baeldung/ActiveJDBCAppManualTest.java diff --git a/apache-cayenne/README.md b/persistence-modules/apache-cayenne/README.md similarity index 100% rename from apache-cayenne/README.md rename to persistence-modules/apache-cayenne/README.md diff --git a/apache-cayenne/pom.xml b/persistence-modules/apache-cayenne/pom.xml similarity index 97% rename from apache-cayenne/pom.xml rename to persistence-modules/apache-cayenne/pom.xml index 591809d47f..d0c6d1f2b2 100644 --- a/apache-cayenne/pom.xml +++ b/persistence-modules/apache-cayenne/pom.xml @@ -13,6 +13,7 @@ com.baeldung parent-modules 1.0.0-SNAPSHOT + ../../ diff --git a/apache-cayenne/src/main/java/com/baeldung/apachecayenne/persistent/Article.java b/persistence-modules/apache-cayenne/src/main/java/com/baeldung/apachecayenne/persistent/Article.java similarity index 100% rename from apache-cayenne/src/main/java/com/baeldung/apachecayenne/persistent/Article.java rename to persistence-modules/apache-cayenne/src/main/java/com/baeldung/apachecayenne/persistent/Article.java diff --git a/apache-cayenne/src/main/java/com/baeldung/apachecayenne/persistent/Author.java b/persistence-modules/apache-cayenne/src/main/java/com/baeldung/apachecayenne/persistent/Author.java similarity index 100% rename from apache-cayenne/src/main/java/com/baeldung/apachecayenne/persistent/Author.java rename to persistence-modules/apache-cayenne/src/main/java/com/baeldung/apachecayenne/persistent/Author.java diff --git a/apache-cayenne/src/main/java/com/baeldung/apachecayenne/persistent/auto/_Article.java b/persistence-modules/apache-cayenne/src/main/java/com/baeldung/apachecayenne/persistent/auto/_Article.java similarity index 100% rename from apache-cayenne/src/main/java/com/baeldung/apachecayenne/persistent/auto/_Article.java rename to persistence-modules/apache-cayenne/src/main/java/com/baeldung/apachecayenne/persistent/auto/_Article.java diff --git a/apache-cayenne/src/main/java/com/baeldung/apachecayenne/persistent/auto/_Author.java b/persistence-modules/apache-cayenne/src/main/java/com/baeldung/apachecayenne/persistent/auto/_Author.java similarity index 100% rename from apache-cayenne/src/main/java/com/baeldung/apachecayenne/persistent/auto/_Author.java rename to persistence-modules/apache-cayenne/src/main/java/com/baeldung/apachecayenne/persistent/auto/_Author.java diff --git a/apache-cayenne/src/main/resources/cayenne-project.xml b/persistence-modules/apache-cayenne/src/main/resources/cayenne-project.xml similarity index 100% rename from apache-cayenne/src/main/resources/cayenne-project.xml rename to persistence-modules/apache-cayenne/src/main/resources/cayenne-project.xml diff --git a/apache-cayenne/src/main/resources/datamap.map.xml b/persistence-modules/apache-cayenne/src/main/resources/datamap.map.xml similarity index 100% rename from apache-cayenne/src/main/resources/datamap.map.xml rename to persistence-modules/apache-cayenne/src/main/resources/datamap.map.xml diff --git a/ejb/wildfly/widlfly-web/src/main/resources/logback.xml b/persistence-modules/apache-cayenne/src/main/resources/logback.xml similarity index 100% rename from ejb/wildfly/widlfly-web/src/main/resources/logback.xml rename to persistence-modules/apache-cayenne/src/main/resources/logback.xml diff --git a/apache-cayenne/src/test/java/com/baeldung/apachecayenne/CayenneAdvancedOperationLiveTest.java b/persistence-modules/apache-cayenne/src/test/java/com/baeldung/apachecayenne/CayenneAdvancedOperationLiveTest.java similarity index 100% rename from apache-cayenne/src/test/java/com/baeldung/apachecayenne/CayenneAdvancedOperationLiveTest.java rename to persistence-modules/apache-cayenne/src/test/java/com/baeldung/apachecayenne/CayenneAdvancedOperationLiveTest.java diff --git a/apache-cayenne/src/test/java/com/baeldung/apachecayenne/CayenneOperationLiveTest.java b/persistence-modules/apache-cayenne/src/test/java/com/baeldung/apachecayenne/CayenneOperationLiveTest.java similarity index 100% rename from apache-cayenne/src/test/java/com/baeldung/apachecayenne/CayenneOperationLiveTest.java rename to persistence-modules/apache-cayenne/src/test/java/com/baeldung/apachecayenne/CayenneOperationLiveTest.java diff --git a/core-java-persistence/README.md b/persistence-modules/core-java-persistence/README.md similarity index 100% rename from core-java-persistence/README.md rename to persistence-modules/core-java-persistence/README.md diff --git a/core-java-persistence/pom.xml b/persistence-modules/core-java-persistence/pom.xml similarity index 95% rename from core-java-persistence/pom.xml rename to persistence-modules/core-java-persistence/pom.xml index 7279fd763b..f012d60ee6 100644 --- a/core-java-persistence/pom.xml +++ b/persistence-modules/core-java-persistence/pom.xml @@ -1,71 +1,71 @@ - - 4.0.0 - com.baeldung.core-java-persistence - core-java-persistence - 0.1.0-SNAPSHOT - jar - core-java-persistence - - com.baeldung - parent-java - 0.0.1-SNAPSHOT - ../parent-java - - - - org.assertj - assertj-core - ${assertj-core.version} - test - - - com.h2database - h2 - ${h2database.version} - - - org.apache.commons - commons-dbcp2 - ${commons-dbcp2.version} - - - com.zaxxer - HikariCP - ${HikariCP.version} - - - com.mchange - c3p0 - ${c3p0.version} - - - org.springframework - spring-web - ${springframework.spring-web.version} - - - org.springframework.boot - spring-boot-starter - ${springframework.boot.spring-boot-starter.version} - - - - core-java-persistence - - - src/main/resources - true - - - - - 3.10.0 - 1.4.197 - 2.4.0 - 3.2.0 - 0.9.5.2 - 1.5.8.RELEASE - 4.3.4.RELEASE - + + 4.0.0 + com.baeldung.core-java-persistence + core-java-persistence + 0.1.0-SNAPSHOT + jar + core-java-persistence + + com.baeldung + parent-java + 0.0.1-SNAPSHOT + ../../parent-java + + + + org.assertj + assertj-core + ${assertj-core.version} + test + + + com.h2database + h2 + ${h2database.version} + + + org.apache.commons + commons-dbcp2 + ${commons-dbcp2.version} + + + com.zaxxer + HikariCP + ${HikariCP.version} + + + com.mchange + c3p0 + ${c3p0.version} + + + org.springframework + spring-web + ${springframework.spring-web.version} + + + org.springframework.boot + spring-boot-starter + ${springframework.boot.spring-boot-starter.version} + + + + core-java-persistence + + + src/main/resources + true + + + + + 3.10.0 + 1.4.197 + 2.4.0 + 3.2.0 + 0.9.5.2 + 1.5.8.RELEASE + 4.3.4.RELEASE + \ No newline at end of file diff --git a/core-java-persistence/src/main/java/com/baeldung/connectionpool/BasicConnectionPool.java b/persistence-modules/core-java-persistence/src/main/java/com/baeldung/connectionpool/BasicConnectionPool.java similarity index 100% rename from core-java-persistence/src/main/java/com/baeldung/connectionpool/BasicConnectionPool.java rename to persistence-modules/core-java-persistence/src/main/java/com/baeldung/connectionpool/BasicConnectionPool.java diff --git a/core-java-persistence/src/main/java/com/baeldung/connectionpool/C3poDataSource.java b/persistence-modules/core-java-persistence/src/main/java/com/baeldung/connectionpool/C3poDataSource.java similarity index 100% rename from core-java-persistence/src/main/java/com/baeldung/connectionpool/C3poDataSource.java rename to persistence-modules/core-java-persistence/src/main/java/com/baeldung/connectionpool/C3poDataSource.java diff --git a/core-java-persistence/src/main/java/com/baeldung/connectionpool/ConnectionPool.java b/persistence-modules/core-java-persistence/src/main/java/com/baeldung/connectionpool/ConnectionPool.java similarity index 100% rename from core-java-persistence/src/main/java/com/baeldung/connectionpool/ConnectionPool.java rename to persistence-modules/core-java-persistence/src/main/java/com/baeldung/connectionpool/ConnectionPool.java diff --git a/core-java-persistence/src/main/java/com/baeldung/connectionpool/DBCPDataSource.java b/persistence-modules/core-java-persistence/src/main/java/com/baeldung/connectionpool/DBCPDataSource.java similarity index 100% rename from core-java-persistence/src/main/java/com/baeldung/connectionpool/DBCPDataSource.java rename to persistence-modules/core-java-persistence/src/main/java/com/baeldung/connectionpool/DBCPDataSource.java diff --git a/core-java-persistence/src/main/java/com/baeldung/connectionpool/HikariCPDataSource.java b/persistence-modules/core-java-persistence/src/main/java/com/baeldung/connectionpool/HikariCPDataSource.java similarity index 100% rename from core-java-persistence/src/main/java/com/baeldung/connectionpool/HikariCPDataSource.java rename to persistence-modules/core-java-persistence/src/main/java/com/baeldung/connectionpool/HikariCPDataSource.java diff --git a/core-java-persistence/src/main/java/com/baeldung/jdbc/BatchProcessing.java b/persistence-modules/core-java-persistence/src/main/java/com/baeldung/jdbc/BatchProcessing.java similarity index 100% rename from core-java-persistence/src/main/java/com/baeldung/jdbc/BatchProcessing.java rename to persistence-modules/core-java-persistence/src/main/java/com/baeldung/jdbc/BatchProcessing.java diff --git a/core-java-persistence/src/main/java/com/baeldung/jdbc/Employee.java b/persistence-modules/core-java-persistence/src/main/java/com/baeldung/jdbc/Employee.java similarity index 100% rename from core-java-persistence/src/main/java/com/baeldung/jdbc/Employee.java rename to persistence-modules/core-java-persistence/src/main/java/com/baeldung/jdbc/Employee.java diff --git a/core-java-persistence/src/main/java/com/baeldung/jdbcrowset/DatabaseConfiguration.java b/persistence-modules/core-java-persistence/src/main/java/com/baeldung/jdbcrowset/DatabaseConfiguration.java similarity index 100% rename from core-java-persistence/src/main/java/com/baeldung/jdbcrowset/DatabaseConfiguration.java rename to persistence-modules/core-java-persistence/src/main/java/com/baeldung/jdbcrowset/DatabaseConfiguration.java diff --git a/core-java-persistence/src/main/java/com/baeldung/jdbcrowset/ExampleListener.java b/persistence-modules/core-java-persistence/src/main/java/com/baeldung/jdbcrowset/ExampleListener.java similarity index 100% rename from core-java-persistence/src/main/java/com/baeldung/jdbcrowset/ExampleListener.java rename to persistence-modules/core-java-persistence/src/main/java/com/baeldung/jdbcrowset/ExampleListener.java diff --git a/core-java-persistence/src/main/java/com/baeldung/jdbcrowset/FilterExample.java b/persistence-modules/core-java-persistence/src/main/java/com/baeldung/jdbcrowset/FilterExample.java similarity index 100% rename from core-java-persistence/src/main/java/com/baeldung/jdbcrowset/FilterExample.java rename to persistence-modules/core-java-persistence/src/main/java/com/baeldung/jdbcrowset/FilterExample.java diff --git a/core-java-persistence/src/main/java/com/baeldung/jdbcrowset/JdbcRowsetApplication.java b/persistence-modules/core-java-persistence/src/main/java/com/baeldung/jdbcrowset/JdbcRowsetApplication.java similarity index 100% rename from core-java-persistence/src/main/java/com/baeldung/jdbcrowset/JdbcRowsetApplication.java rename to persistence-modules/core-java-persistence/src/main/java/com/baeldung/jdbcrowset/JdbcRowsetApplication.java diff --git a/ejb/wildfly/wildfly-ejb-interfaces/src/main/resources/logback.xml b/persistence-modules/core-java-persistence/src/main/resources/logback.xml similarity index 100% rename from ejb/wildfly/wildfly-ejb-interfaces/src/main/resources/logback.xml rename to persistence-modules/core-java-persistence/src/main/resources/logback.xml diff --git a/core-java-persistence/src/test/java/com/baeldung/connectionpool/BasicConnectionPoolUnitTest.java b/persistence-modules/core-java-persistence/src/test/java/com/baeldung/connectionpool/BasicConnectionPoolUnitTest.java similarity index 97% rename from core-java-persistence/src/test/java/com/baeldung/connectionpool/BasicConnectionPoolUnitTest.java rename to persistence-modules/core-java-persistence/src/test/java/com/baeldung/connectionpool/BasicConnectionPoolUnitTest.java index 479cd0db25..3b3c9870fb 100644 --- a/core-java-persistence/src/test/java/com/baeldung/connectionpool/BasicConnectionPoolUnitTest.java +++ b/persistence-modules/core-java-persistence/src/test/java/com/baeldung/connectionpool/BasicConnectionPoolUnitTest.java @@ -1,67 +1,67 @@ -package com.baeldung.connectionpool; - -import java.sql.Connection; -import java.sql.SQLException; - -import static org.assertj.core.api.Assertions.assertThat; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; - -import org.junit.BeforeClass; -import org.junit.Test; - -public class BasicConnectionPoolUnitTest { - - private static ConnectionPool connectionPool; - - @BeforeClass - public static void setUpBasicConnectionPoolInstance() throws SQLException { - connectionPool = BasicConnectionPool.create("jdbc:h2:mem:test", "user", "password"); - } - - @Test - public void givenBasicConnectionPoolInstance_whenCalledgetConnection_thenCorrect() throws Exception { - assertTrue(connectionPool.getConnection().isValid(1)); - } - - @Test - public void givenBasicConnectionPoolInstance_whenCalledreleaseConnection_thenCorrect() throws Exception { - Connection connection = connectionPool.getConnection(); - assertThat(connectionPool.releaseConnection(connection)).isTrue(); - } - - @Test - public void givenBasicConnectionPoolInstance_whenCalledgetUrl_thenCorrect() { - assertThat(connectionPool.getUrl()).isEqualTo("jdbc:h2:mem:test"); - } - - @Test - public void givenBasicConnectionPoolInstance_whenCalledgetUser_thenCorrect() { - assertThat(connectionPool.getUser()).isEqualTo("user"); - } - - @Test - public void givenBasicConnectionPoolInstance_whenCalledgetPassword_thenCorrect() { - assertThat(connectionPool.getPassword()).isEqualTo("password"); - } - - @Test(expected = RuntimeException.class) - public void givenBasicConnectionPoolInstance_whenAskedForMoreThanMax_thenError() throws Exception { - // this test needs to be independent so it doesn't share the same connection pool as other tests - ConnectionPool cp = BasicConnectionPool.create("jdbc:h2:mem:test", "user", "password"); - final int MAX_POOL_SIZE = 20; - for (int i = 0; i < MAX_POOL_SIZE + 1; i++) { - cp.getConnection(); - } - fail(); - } - - @Test - public void givenBasicConnectionPoolInstance_whenSutdown_thenEmpty() throws Exception { - ConnectionPool cp = BasicConnectionPool.create("jdbc:h2:mem:test", "user", "password"); - assertThat(((BasicConnectionPool)cp).getSize()).isEqualTo(10); - - ((BasicConnectionPool) cp).shutdown(); - assertThat(((BasicConnectionPool)cp).getSize()).isEqualTo(0); - } -} +package com.baeldung.connectionpool; + +import java.sql.Connection; +import java.sql.SQLException; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + +import org.junit.BeforeClass; +import org.junit.Test; + +public class BasicConnectionPoolUnitTest { + + private static ConnectionPool connectionPool; + + @BeforeClass + public static void setUpBasicConnectionPoolInstance() throws SQLException { + connectionPool = BasicConnectionPool.create("jdbc:h2:mem:test", "user", "password"); + } + + @Test + public void givenBasicConnectionPoolInstance_whenCalledgetConnection_thenCorrect() throws Exception { + assertTrue(connectionPool.getConnection().isValid(1)); + } + + @Test + public void givenBasicConnectionPoolInstance_whenCalledreleaseConnection_thenCorrect() throws Exception { + Connection connection = connectionPool.getConnection(); + assertThat(connectionPool.releaseConnection(connection)).isTrue(); + } + + @Test + public void givenBasicConnectionPoolInstance_whenCalledgetUrl_thenCorrect() { + assertThat(connectionPool.getUrl()).isEqualTo("jdbc:h2:mem:test"); + } + + @Test + public void givenBasicConnectionPoolInstance_whenCalledgetUser_thenCorrect() { + assertThat(connectionPool.getUser()).isEqualTo("user"); + } + + @Test + public void givenBasicConnectionPoolInstance_whenCalledgetPassword_thenCorrect() { + assertThat(connectionPool.getPassword()).isEqualTo("password"); + } + + @Test(expected = RuntimeException.class) + public void givenBasicConnectionPoolInstance_whenAskedForMoreThanMax_thenError() throws Exception { + // this test needs to be independent so it doesn't share the same connection pool as other tests + ConnectionPool cp = BasicConnectionPool.create("jdbc:h2:mem:test", "user", "password"); + final int MAX_POOL_SIZE = 20; + for (int i = 0; i < MAX_POOL_SIZE + 1; i++) { + cp.getConnection(); + } + fail(); + } + + @Test + public void givenBasicConnectionPoolInstance_whenSutdown_thenEmpty() throws Exception { + ConnectionPool cp = BasicConnectionPool.create("jdbc:h2:mem:test", "user", "password"); + assertThat(((BasicConnectionPool)cp).getSize()).isEqualTo(10); + + ((BasicConnectionPool) cp).shutdown(); + assertThat(((BasicConnectionPool)cp).getSize()).isEqualTo(0); + } +} diff --git a/core-java-persistence/src/test/java/com/baeldung/connectionpool/C3poDataSourceUnitTest.java b/persistence-modules/core-java-persistence/src/test/java/com/baeldung/connectionpool/C3poDataSourceUnitTest.java similarity index 96% rename from core-java-persistence/src/test/java/com/baeldung/connectionpool/C3poDataSourceUnitTest.java rename to persistence-modules/core-java-persistence/src/test/java/com/baeldung/connectionpool/C3poDataSourceUnitTest.java index a07fa9e74b..acad9fe5e4 100644 --- a/core-java-persistence/src/test/java/com/baeldung/connectionpool/C3poDataSourceUnitTest.java +++ b/persistence-modules/core-java-persistence/src/test/java/com/baeldung/connectionpool/C3poDataSourceUnitTest.java @@ -1,13 +1,13 @@ -package com.baeldung.connectionpool; - -import java.sql.SQLException; -import static org.junit.Assert.assertTrue; -import org.junit.Test; - -public class C3poDataSourceUnitTest { - - @Test - public void givenC3poDataSourceClass_whenCalledgetConnection_thenCorrect() throws SQLException { - assertTrue(C3poDataSource.getConnection().isValid(1)); - } +package com.baeldung.connectionpool; + +import java.sql.SQLException; +import static org.junit.Assert.assertTrue; +import org.junit.Test; + +public class C3poDataSourceUnitTest { + + @Test + public void givenC3poDataSourceClass_whenCalledgetConnection_thenCorrect() throws SQLException { + assertTrue(C3poDataSource.getConnection().isValid(1)); + } } \ No newline at end of file diff --git a/core-java-persistence/src/test/java/com/baeldung/connectionpool/DBCPDataSourceUnitTest.java b/persistence-modules/core-java-persistence/src/test/java/com/baeldung/connectionpool/DBCPDataSourceUnitTest.java similarity index 96% rename from core-java-persistence/src/test/java/com/baeldung/connectionpool/DBCPDataSourceUnitTest.java rename to persistence-modules/core-java-persistence/src/test/java/com/baeldung/connectionpool/DBCPDataSourceUnitTest.java index 43aaf330b6..4882d2af73 100644 --- a/core-java-persistence/src/test/java/com/baeldung/connectionpool/DBCPDataSourceUnitTest.java +++ b/persistence-modules/core-java-persistence/src/test/java/com/baeldung/connectionpool/DBCPDataSourceUnitTest.java @@ -1,13 +1,13 @@ -package com.baeldung.connectionpool; - -import java.sql.SQLException; -import static org.junit.Assert.assertTrue; -import org.junit.Test; - -public class DBCPDataSourceUnitTest { - - @Test - public void givenDBCPDataSourceClass_whenCalledgetConnection_thenCorrect() throws SQLException { - assertTrue(DBCPDataSource.getConnection().isValid(1)); - } +package com.baeldung.connectionpool; + +import java.sql.SQLException; +import static org.junit.Assert.assertTrue; +import org.junit.Test; + +public class DBCPDataSourceUnitTest { + + @Test + public void givenDBCPDataSourceClass_whenCalledgetConnection_thenCorrect() throws SQLException { + assertTrue(DBCPDataSource.getConnection().isValid(1)); + } } \ No newline at end of file diff --git a/core-java-persistence/src/test/java/com/baeldung/connectionpool/HikariCPDataSourceUnitTest.java b/persistence-modules/core-java-persistence/src/test/java/com/baeldung/connectionpool/HikariCPDataSourceUnitTest.java similarity index 96% rename from core-java-persistence/src/test/java/com/baeldung/connectionpool/HikariCPDataSourceUnitTest.java rename to persistence-modules/core-java-persistence/src/test/java/com/baeldung/connectionpool/HikariCPDataSourceUnitTest.java index b20ce70efd..885743ab2b 100644 --- a/core-java-persistence/src/test/java/com/baeldung/connectionpool/HikariCPDataSourceUnitTest.java +++ b/persistence-modules/core-java-persistence/src/test/java/com/baeldung/connectionpool/HikariCPDataSourceUnitTest.java @@ -1,13 +1,13 @@ -package com.baeldung.connectionpool; - -import java.sql.SQLException; -import static org.junit.Assert.assertTrue; -import org.junit.Test; - -public class HikariCPDataSourceUnitTest { - - @Test - public void givenHikariDataSourceClass_whenCalledgetConnection_thenCorrect() throws SQLException { - assertTrue(HikariCPDataSource.getConnection().isValid(1)); - } +package com.baeldung.connectionpool; + +import java.sql.SQLException; +import static org.junit.Assert.assertTrue; +import org.junit.Test; + +public class HikariCPDataSourceUnitTest { + + @Test + public void givenHikariDataSourceClass_whenCalledgetConnection_thenCorrect() throws SQLException { + assertTrue(HikariCPDataSource.getConnection().isValid(1)); + } } \ No newline at end of file diff --git a/core-java-persistence/src/test/java/com/baeldung/jdbc/BatchProcessingLiveTest.java b/persistence-modules/core-java-persistence/src/test/java/com/baeldung/jdbc/BatchProcessingLiveTest.java similarity index 100% rename from core-java-persistence/src/test/java/com/baeldung/jdbc/BatchProcessingLiveTest.java rename to persistence-modules/core-java-persistence/src/test/java/com/baeldung/jdbc/BatchProcessingLiveTest.java diff --git a/core-java-persistence/src/test/java/com/baeldung/jdbc/JdbcLiveTest.java b/persistence-modules/core-java-persistence/src/test/java/com/baeldung/jdbc/JdbcLiveTest.java similarity index 100% rename from core-java-persistence/src/test/java/com/baeldung/jdbc/JdbcLiveTest.java rename to persistence-modules/core-java-persistence/src/test/java/com/baeldung/jdbc/JdbcLiveTest.java diff --git a/core-java-persistence/src/test/java/com/baeldung/jdbcrowset/JdbcRowSetLiveTest.java b/persistence-modules/core-java-persistence/src/test/java/com/baeldung/jdbcrowset/JdbcRowSetLiveTest.java similarity index 100% rename from core-java-persistence/src/test/java/com/baeldung/jdbcrowset/JdbcRowSetLiveTest.java rename to persistence-modules/core-java-persistence/src/test/java/com/baeldung/jdbcrowset/JdbcRowSetLiveTest.java diff --git a/deltaspike/.gitignore b/persistence-modules/deltaspike/.gitignore similarity index 100% rename from deltaspike/.gitignore rename to persistence-modules/deltaspike/.gitignore diff --git a/deltaspike/README.md b/persistence-modules/deltaspike/README.md similarity index 100% rename from deltaspike/README.md rename to persistence-modules/deltaspike/README.md diff --git a/deltaspike/pom.xml b/persistence-modules/deltaspike/pom.xml similarity index 99% rename from deltaspike/pom.xml rename to persistence-modules/deltaspike/pom.xml index 8ab3e3fd80..b798d2f39e 100644 --- a/deltaspike/pom.xml +++ b/persistence-modules/deltaspike/pom.xml @@ -14,6 +14,7 @@ com.baeldung parent-modules 1.0.0-SNAPSHOT + ../../ diff --git a/deltaspike/src/main/java/baeldung/controller/MemberController.java b/persistence-modules/deltaspike/src/main/java/baeldung/controller/MemberController.java similarity index 100% rename from deltaspike/src/main/java/baeldung/controller/MemberController.java rename to persistence-modules/deltaspike/src/main/java/baeldung/controller/MemberController.java diff --git a/deltaspike/src/main/java/baeldung/data/EntityManagerProducer.java b/persistence-modules/deltaspike/src/main/java/baeldung/data/EntityManagerProducer.java similarity index 100% rename from deltaspike/src/main/java/baeldung/data/EntityManagerProducer.java rename to persistence-modules/deltaspike/src/main/java/baeldung/data/EntityManagerProducer.java diff --git a/deltaspike/src/main/java/baeldung/data/MemberListProducer.java b/persistence-modules/deltaspike/src/main/java/baeldung/data/MemberListProducer.java similarity index 100% rename from deltaspike/src/main/java/baeldung/data/MemberListProducer.java rename to persistence-modules/deltaspike/src/main/java/baeldung/data/MemberListProducer.java diff --git a/deltaspike/src/main/java/baeldung/data/MemberRepository.java b/persistence-modules/deltaspike/src/main/java/baeldung/data/MemberRepository.java similarity index 100% rename from deltaspike/src/main/java/baeldung/data/MemberRepository.java rename to persistence-modules/deltaspike/src/main/java/baeldung/data/MemberRepository.java diff --git a/deltaspike/src/main/java/baeldung/data/QueryDslRepositoryExtension.java b/persistence-modules/deltaspike/src/main/java/baeldung/data/QueryDslRepositoryExtension.java similarity index 100% rename from deltaspike/src/main/java/baeldung/data/QueryDslRepositoryExtension.java rename to persistence-modules/deltaspike/src/main/java/baeldung/data/QueryDslRepositoryExtension.java diff --git a/deltaspike/src/main/java/baeldung/data/QueryDslSupport.java b/persistence-modules/deltaspike/src/main/java/baeldung/data/QueryDslSupport.java similarity index 100% rename from deltaspike/src/main/java/baeldung/data/QueryDslSupport.java rename to persistence-modules/deltaspike/src/main/java/baeldung/data/QueryDslSupport.java diff --git a/deltaspike/src/main/java/baeldung/data/SecondaryEntityManagerProducer.java b/persistence-modules/deltaspike/src/main/java/baeldung/data/SecondaryEntityManagerProducer.java similarity index 100% rename from deltaspike/src/main/java/baeldung/data/SecondaryEntityManagerProducer.java rename to persistence-modules/deltaspike/src/main/java/baeldung/data/SecondaryEntityManagerProducer.java diff --git a/deltaspike/src/main/java/baeldung/data/SecondaryEntityManagerResolver.java b/persistence-modules/deltaspike/src/main/java/baeldung/data/SecondaryEntityManagerResolver.java similarity index 100% rename from deltaspike/src/main/java/baeldung/data/SecondaryEntityManagerResolver.java rename to persistence-modules/deltaspike/src/main/java/baeldung/data/SecondaryEntityManagerResolver.java diff --git a/deltaspike/src/main/java/baeldung/data/SecondaryPersistenceUnit.java b/persistence-modules/deltaspike/src/main/java/baeldung/data/SecondaryPersistenceUnit.java similarity index 100% rename from deltaspike/src/main/java/baeldung/data/SecondaryPersistenceUnit.java rename to persistence-modules/deltaspike/src/main/java/baeldung/data/SecondaryPersistenceUnit.java diff --git a/deltaspike/src/main/java/baeldung/data/SimpleUserRepository.java b/persistence-modules/deltaspike/src/main/java/baeldung/data/SimpleUserRepository.java similarity index 100% rename from deltaspike/src/main/java/baeldung/data/SimpleUserRepository.java rename to persistence-modules/deltaspike/src/main/java/baeldung/data/SimpleUserRepository.java diff --git a/deltaspike/src/main/java/baeldung/data/UserRepository.java b/persistence-modules/deltaspike/src/main/java/baeldung/data/UserRepository.java similarity index 100% rename from deltaspike/src/main/java/baeldung/data/UserRepository.java rename to persistence-modules/deltaspike/src/main/java/baeldung/data/UserRepository.java diff --git a/deltaspike/src/main/java/baeldung/model/Address.java b/persistence-modules/deltaspike/src/main/java/baeldung/model/Address.java similarity index 100% rename from deltaspike/src/main/java/baeldung/model/Address.java rename to persistence-modules/deltaspike/src/main/java/baeldung/model/Address.java diff --git a/deltaspike/src/main/java/baeldung/model/Member.java b/persistence-modules/deltaspike/src/main/java/baeldung/model/Member.java similarity index 100% rename from deltaspike/src/main/java/baeldung/model/Member.java rename to persistence-modules/deltaspike/src/main/java/baeldung/model/Member.java diff --git a/deltaspike/src/main/java/baeldung/model/User.java b/persistence-modules/deltaspike/src/main/java/baeldung/model/User.java similarity index 100% rename from deltaspike/src/main/java/baeldung/model/User.java rename to persistence-modules/deltaspike/src/main/java/baeldung/model/User.java diff --git a/deltaspike/src/main/java/baeldung/rest/JaxRsActivator.java b/persistence-modules/deltaspike/src/main/java/baeldung/rest/JaxRsActivator.java similarity index 100% rename from deltaspike/src/main/java/baeldung/rest/JaxRsActivator.java rename to persistence-modules/deltaspike/src/main/java/baeldung/rest/JaxRsActivator.java diff --git a/deltaspike/src/main/java/baeldung/rest/MemberResourceRESTService.java b/persistence-modules/deltaspike/src/main/java/baeldung/rest/MemberResourceRESTService.java similarity index 100% rename from deltaspike/src/main/java/baeldung/rest/MemberResourceRESTService.java rename to persistence-modules/deltaspike/src/main/java/baeldung/rest/MemberResourceRESTService.java diff --git a/deltaspike/src/main/java/baeldung/service/MemberRegistration.java b/persistence-modules/deltaspike/src/main/java/baeldung/service/MemberRegistration.java similarity index 100% rename from deltaspike/src/main/java/baeldung/service/MemberRegistration.java rename to persistence-modules/deltaspike/src/main/java/baeldung/service/MemberRegistration.java diff --git a/deltaspike/src/main/java/baeldung/util/Resources.java b/persistence-modules/deltaspike/src/main/java/baeldung/util/Resources.java similarity index 100% rename from deltaspike/src/main/java/baeldung/util/Resources.java rename to persistence-modules/deltaspike/src/main/java/baeldung/util/Resources.java diff --git a/deltaspike/src/main/resources/META-INF/apache-deltaspike.properties b/persistence-modules/deltaspike/src/main/resources/META-INF/apache-deltaspike.properties similarity index 100% rename from deltaspike/src/main/resources/META-INF/apache-deltaspike.properties rename to persistence-modules/deltaspike/src/main/resources/META-INF/apache-deltaspike.properties diff --git a/deltaspike/src/main/resources/META-INF/beans.xml b/persistence-modules/deltaspike/src/main/resources/META-INF/beans.xml similarity index 100% rename from deltaspike/src/main/resources/META-INF/beans.xml rename to persistence-modules/deltaspike/src/main/resources/META-INF/beans.xml diff --git a/deltaspike/src/main/resources/META-INF/persistence.xml b/persistence-modules/deltaspike/src/main/resources/META-INF/persistence.xml similarity index 100% rename from deltaspike/src/main/resources/META-INF/persistence.xml rename to persistence-modules/deltaspike/src/main/resources/META-INF/persistence.xml diff --git a/deltaspike/src/main/resources/import.sql b/persistence-modules/deltaspike/src/main/resources/import.sql similarity index 100% rename from deltaspike/src/main/resources/import.sql rename to persistence-modules/deltaspike/src/main/resources/import.sql diff --git a/ejb/wildfly/wildfly-ejb/src/main/resources/logback.xml b/persistence-modules/deltaspike/src/main/resources/logback.xml similarity index 100% rename from ejb/wildfly/wildfly-ejb/src/main/resources/logback.xml rename to persistence-modules/deltaspike/src/main/resources/logback.xml diff --git a/deltaspike/src/main/webapp/WEB-INF/baeldung-jee7-seed-ds.xml b/persistence-modules/deltaspike/src/main/webapp/WEB-INF/baeldung-jee7-seed-ds.xml similarity index 100% rename from deltaspike/src/main/webapp/WEB-INF/baeldung-jee7-seed-ds.xml rename to persistence-modules/deltaspike/src/main/webapp/WEB-INF/baeldung-jee7-seed-ds.xml diff --git a/deltaspike/src/main/webapp/WEB-INF/baeldung-jee7-seed-secondary-ds.xml b/persistence-modules/deltaspike/src/main/webapp/WEB-INF/baeldung-jee7-seed-secondary-ds.xml similarity index 100% rename from deltaspike/src/main/webapp/WEB-INF/baeldung-jee7-seed-secondary-ds.xml rename to persistence-modules/deltaspike/src/main/webapp/WEB-INF/baeldung-jee7-seed-secondary-ds.xml diff --git a/deltaspike/src/main/webapp/WEB-INF/beans.xml b/persistence-modules/deltaspike/src/main/webapp/WEB-INF/beans.xml similarity index 100% rename from deltaspike/src/main/webapp/WEB-INF/beans.xml rename to persistence-modules/deltaspike/src/main/webapp/WEB-INF/beans.xml diff --git a/deltaspike/src/main/webapp/WEB-INF/faces-config.xml b/persistence-modules/deltaspike/src/main/webapp/WEB-INF/faces-config.xml similarity index 100% rename from deltaspike/src/main/webapp/WEB-INF/faces-config.xml rename to persistence-modules/deltaspike/src/main/webapp/WEB-INF/faces-config.xml diff --git a/deltaspike/src/main/webapp/WEB-INF/templates/default.xhtml b/persistence-modules/deltaspike/src/main/webapp/WEB-INF/templates/default.xhtml similarity index 100% rename from deltaspike/src/main/webapp/WEB-INF/templates/default.xhtml rename to persistence-modules/deltaspike/src/main/webapp/WEB-INF/templates/default.xhtml diff --git a/deltaspike/src/main/webapp/index.html b/persistence-modules/deltaspike/src/main/webapp/index.html similarity index 100% rename from deltaspike/src/main/webapp/index.html rename to persistence-modules/deltaspike/src/main/webapp/index.html diff --git a/deltaspike/src/main/webapp/index.xhtml b/persistence-modules/deltaspike/src/main/webapp/index.xhtml similarity index 100% rename from deltaspike/src/main/webapp/index.xhtml rename to persistence-modules/deltaspike/src/main/webapp/index.xhtml diff --git a/deltaspike/src/main/webapp/resources/css/screen.css b/persistence-modules/deltaspike/src/main/webapp/resources/css/screen.css similarity index 100% rename from deltaspike/src/main/webapp/resources/css/screen.css rename to persistence-modules/deltaspike/src/main/webapp/resources/css/screen.css diff --git a/deltaspike/src/main/webapp/resources/gfx/asidebkg.png b/persistence-modules/deltaspike/src/main/webapp/resources/gfx/asidebkg.png similarity index 100% rename from deltaspike/src/main/webapp/resources/gfx/asidebkg.png rename to persistence-modules/deltaspike/src/main/webapp/resources/gfx/asidebkg.png diff --git a/deltaspike/src/main/webapp/resources/gfx/bkg-blkheader.png b/persistence-modules/deltaspike/src/main/webapp/resources/gfx/bkg-blkheader.png similarity index 100% rename from deltaspike/src/main/webapp/resources/gfx/bkg-blkheader.png rename to persistence-modules/deltaspike/src/main/webapp/resources/gfx/bkg-blkheader.png diff --git a/deltaspike/src/main/webapp/resources/gfx/dualbrand_logo.png b/persistence-modules/deltaspike/src/main/webapp/resources/gfx/dualbrand_logo.png similarity index 100% rename from deltaspike/src/main/webapp/resources/gfx/dualbrand_logo.png rename to persistence-modules/deltaspike/src/main/webapp/resources/gfx/dualbrand_logo.png diff --git a/deltaspike/src/main/webapp/resources/gfx/headerbkg.png b/persistence-modules/deltaspike/src/main/webapp/resources/gfx/headerbkg.png similarity index 100% rename from deltaspike/src/main/webapp/resources/gfx/headerbkg.png rename to persistence-modules/deltaspike/src/main/webapp/resources/gfx/headerbkg.png diff --git a/deltaspike/src/main/webapp/resources/gfx/wildfly_400x130.jpg b/persistence-modules/deltaspike/src/main/webapp/resources/gfx/wildfly_400x130.jpg similarity index 100% rename from deltaspike/src/main/webapp/resources/gfx/wildfly_400x130.jpg rename to persistence-modules/deltaspike/src/main/webapp/resources/gfx/wildfly_400x130.jpg diff --git a/deltaspike/src/test/java/baeldung/ValidatorProducer.java b/persistence-modules/deltaspike/src/test/java/baeldung/ValidatorProducer.java similarity index 100% rename from deltaspike/src/test/java/baeldung/ValidatorProducer.java rename to persistence-modules/deltaspike/src/test/java/baeldung/ValidatorProducer.java diff --git a/deltaspike/src/test/java/baeldung/data/TestEntityManagerProducer.java b/persistence-modules/deltaspike/src/test/java/baeldung/data/TestEntityManagerProducer.java similarity index 100% rename from deltaspike/src/test/java/baeldung/data/TestEntityManagerProducer.java rename to persistence-modules/deltaspike/src/test/java/baeldung/data/TestEntityManagerProducer.java diff --git a/deltaspike/src/test/java/baeldung/test/MemberRegistrationLiveTest.java b/persistence-modules/deltaspike/src/test/java/baeldung/test/MemberRegistrationLiveTest.java similarity index 100% rename from deltaspike/src/test/java/baeldung/test/MemberRegistrationLiveTest.java rename to persistence-modules/deltaspike/src/test/java/baeldung/test/MemberRegistrationLiveTest.java diff --git a/deltaspike/src/test/java/baeldung/test/SimpleUserRepositoryUnitTest.java b/persistence-modules/deltaspike/src/test/java/baeldung/test/SimpleUserRepositoryUnitTest.java similarity index 100% rename from deltaspike/src/test/java/baeldung/test/SimpleUserRepositoryUnitTest.java rename to persistence-modules/deltaspike/src/test/java/baeldung/test/SimpleUserRepositoryUnitTest.java diff --git a/deltaspike/src/test/java/baeldung/test/UserRepositoryUnitTest.java b/persistence-modules/deltaspike/src/test/java/baeldung/test/UserRepositoryUnitTest.java similarity index 100% rename from deltaspike/src/test/java/baeldung/test/UserRepositoryUnitTest.java rename to persistence-modules/deltaspike/src/test/java/baeldung/test/UserRepositoryUnitTest.java diff --git a/deltaspike/src/test/resources/META-INF/apache-deltaspike.properties b/persistence-modules/deltaspike/src/test/resources/META-INF/apache-deltaspike.properties similarity index 100% rename from deltaspike/src/test/resources/META-INF/apache-deltaspike.properties rename to persistence-modules/deltaspike/src/test/resources/META-INF/apache-deltaspike.properties diff --git a/deltaspike/src/test/resources/META-INF/beans.xml b/persistence-modules/deltaspike/src/test/resources/META-INF/beans.xml similarity index 100% rename from deltaspike/src/test/resources/META-INF/beans.xml rename to persistence-modules/deltaspike/src/test/resources/META-INF/beans.xml diff --git a/deltaspike/src/test/resources/META-INF/persistence.xml b/persistence-modules/deltaspike/src/test/resources/META-INF/persistence.xml similarity index 100% rename from deltaspike/src/test/resources/META-INF/persistence.xml rename to persistence-modules/deltaspike/src/test/resources/META-INF/persistence.xml diff --git a/deltaspike/src/test/resources/arquillian.xml b/persistence-modules/deltaspike/src/test/resources/arquillian.xml similarity index 100% rename from deltaspike/src/test/resources/arquillian.xml rename to persistence-modules/deltaspike/src/test/resources/arquillian.xml diff --git a/deltaspike/src/test/resources/import.sql b/persistence-modules/deltaspike/src/test/resources/import.sql similarity index 100% rename from deltaspike/src/test/resources/import.sql rename to persistence-modules/deltaspike/src/test/resources/import.sql diff --git a/deltaspike/src/test/resources/test-ds.xml b/persistence-modules/deltaspike/src/test/resources/test-ds.xml similarity index 100% rename from deltaspike/src/test/resources/test-ds.xml rename to persistence-modules/deltaspike/src/test/resources/test-ds.xml diff --git a/deltaspike/src/test/resources/test-secondary-ds.xml b/persistence-modules/deltaspike/src/test/resources/test-secondary-ds.xml similarity index 100% rename from deltaspike/src/test/resources/test-secondary-ds.xml rename to persistence-modules/deltaspike/src/test/resources/test-secondary-ds.xml diff --git a/flyway/.gitignore b/persistence-modules/flyway/.gitignore similarity index 100% rename from flyway/.gitignore rename to persistence-modules/flyway/.gitignore diff --git a/flyway/README.MD b/persistence-modules/flyway/README.MD similarity index 100% rename from flyway/README.MD rename to persistence-modules/flyway/README.MD diff --git a/flyway/db/migration/V1_0__create_employee_schema.sql b/persistence-modules/flyway/db/migration/V1_0__create_employee_schema.sql similarity index 100% rename from flyway/db/migration/V1_0__create_employee_schema.sql rename to persistence-modules/flyway/db/migration/V1_0__create_employee_schema.sql diff --git a/flyway/db/migration/V2_0__create_department_schema.sql b/persistence-modules/flyway/db/migration/V2_0__create_department_schema.sql similarity index 100% rename from flyway/db/migration/V2_0__create_department_schema.sql rename to persistence-modules/flyway/db/migration/V2_0__create_department_schema.sql diff --git a/flyway/myFlywayConfig.properties b/persistence-modules/flyway/myFlywayConfig.properties similarity index 100% rename from flyway/myFlywayConfig.properties rename to persistence-modules/flyway/myFlywayConfig.properties diff --git a/flyway/pom.xml b/persistence-modules/flyway/pom.xml similarity index 97% rename from flyway/pom.xml rename to persistence-modules/flyway/pom.xml index 353bbfb1ec..237b426521 100644 --- a/flyway/pom.xml +++ b/persistence-modules/flyway/pom.xml @@ -11,7 +11,7 @@ parent-boot-1 com.baeldung 0.0.1-SNAPSHOT - ../parent-boot-1 + ../../parent-boot-1 diff --git a/flyway/src/main/java/com/baeldung/flywaycallbacks/ExampleFlywayCallback.java b/persistence-modules/flyway/src/main/java/com/baeldung/flywaycallbacks/ExampleFlywayCallback.java similarity index 100% rename from flyway/src/main/java/com/baeldung/flywaycallbacks/ExampleFlywayCallback.java rename to persistence-modules/flyway/src/main/java/com/baeldung/flywaycallbacks/ExampleFlywayCallback.java diff --git a/flyway/src/main/java/com/baeldung/flywaycallbacks/FlywayApplication.java b/persistence-modules/flyway/src/main/java/com/baeldung/flywaycallbacks/FlywayApplication.java similarity index 100% rename from flyway/src/main/java/com/baeldung/flywaycallbacks/FlywayApplication.java rename to persistence-modules/flyway/src/main/java/com/baeldung/flywaycallbacks/FlywayApplication.java diff --git a/persistence-modules/flyway/src/main/resources/application.properties b/persistence-modules/flyway/src/main/resources/application.properties new file mode 100644 index 0000000000..e69de29bb2 diff --git a/flyway/src/main/resources/db/callbacks/beforeEachMigrate.sql b/persistence-modules/flyway/src/main/resources/db/callbacks/beforeEachMigrate.sql similarity index 100% rename from flyway/src/main/resources/db/callbacks/beforeEachMigrate.sql rename to persistence-modules/flyway/src/main/resources/db/callbacks/beforeEachMigrate.sql diff --git a/flyway/src/main/resources/db/callbacks/beforeMigrate.sql b/persistence-modules/flyway/src/main/resources/db/callbacks/beforeMigrate.sql similarity index 100% rename from flyway/src/main/resources/db/callbacks/beforeMigrate.sql rename to persistence-modules/flyway/src/main/resources/db/callbacks/beforeMigrate.sql diff --git a/flyway/src/main/resources/db/migration/V1_0__add_table_one.sql b/persistence-modules/flyway/src/main/resources/db/migration/V1_0__add_table_one.sql similarity index 100% rename from flyway/src/main/resources/db/migration/V1_0__add_table_one.sql rename to persistence-modules/flyway/src/main/resources/db/migration/V1_0__add_table_one.sql diff --git a/flyway/src/main/resources/db/migration/V1_1__add_table_two.sql b/persistence-modules/flyway/src/main/resources/db/migration/V1_1__add_table_two.sql similarity index 100% rename from flyway/src/main/resources/db/migration/V1_1__add_table_two.sql rename to persistence-modules/flyway/src/main/resources/db/migration/V1_1__add_table_two.sql diff --git a/flyway/src/main/resources/logback.xml b/persistence-modules/flyway/src/main/resources/logback.xml similarity index 100% rename from flyway/src/main/resources/logback.xml rename to persistence-modules/flyway/src/main/resources/logback.xml diff --git a/flyway/src/test/java/com/baeldung/flywaycallbacks/FlywayApplicationUnitTest.java b/persistence-modules/flyway/src/test/java/com/baeldung/flywaycallbacks/FlywayApplicationUnitTest.java similarity index 100% rename from flyway/src/test/java/com/baeldung/flywaycallbacks/FlywayApplicationUnitTest.java rename to persistence-modules/flyway/src/test/java/com/baeldung/flywaycallbacks/FlywayApplicationUnitTest.java diff --git a/flyway/src/test/java/com/baeldung/flywaycallbacks/FlywayCallbackTestConfig.java b/persistence-modules/flyway/src/test/java/com/baeldung/flywaycallbacks/FlywayCallbackTestConfig.java similarity index 100% rename from flyway/src/test/java/com/baeldung/flywaycallbacks/FlywayCallbackTestConfig.java rename to persistence-modules/flyway/src/test/java/com/baeldung/flywaycallbacks/FlywayCallbackTestConfig.java diff --git a/hbase/README.md b/persistence-modules/hbase/README.md similarity index 100% rename from hbase/README.md rename to persistence-modules/hbase/README.md diff --git a/hbase/pom.xml b/persistence-modules/hbase/pom.xml similarity index 94% rename from hbase/pom.xml rename to persistence-modules/hbase/pom.xml index 117cf72e30..daf0db5291 100644 --- a/hbase/pom.xml +++ b/persistence-modules/hbase/pom.xml @@ -3,11 +3,13 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 hbase + hbase parent-modules com.baeldung 1.0.0-SNAPSHOT + ../../ diff --git a/hbase/src/main/java/org/baeldung/hbase/HBaseClientOperations.java b/persistence-modules/hbase/src/main/java/org/baeldung/hbase/HBaseClientOperations.java similarity index 100% rename from hbase/src/main/java/org/baeldung/hbase/HBaseClientOperations.java rename to persistence-modules/hbase/src/main/java/org/baeldung/hbase/HBaseClientOperations.java diff --git a/hbase/src/main/java/org/baeldung/hbase/HbaseClientExample.java b/persistence-modules/hbase/src/main/java/org/baeldung/hbase/HbaseClientExample.java similarity index 100% rename from hbase/src/main/java/org/baeldung/hbase/HbaseClientExample.java rename to persistence-modules/hbase/src/main/java/org/baeldung/hbase/HbaseClientExample.java diff --git a/hbase/src/main/resources/hbase-site.xml b/persistence-modules/hbase/src/main/resources/hbase-site.xml similarity index 100% rename from hbase/src/main/resources/hbase-site.xml rename to persistence-modules/hbase/src/main/resources/hbase-site.xml diff --git a/ejb/wildfly/wildfly-jpa/src/main/resources/logback.xml b/persistence-modules/hbase/src/main/resources/logback.xml similarity index 100% rename from ejb/wildfly/wildfly-jpa/src/main/resources/logback.xml rename to persistence-modules/hbase/src/main/resources/logback.xml diff --git a/hibernate5/README.md b/persistence-modules/hibernate5/README.md similarity index 79% rename from hibernate5/README.md rename to persistence-modules/hibernate5/README.md index fbf46eed50..b6e112b5fc 100644 --- a/hibernate5/README.md +++ b/persistence-modules/hibernate5/README.md @@ -17,3 +17,7 @@ - [Mapping A Hibernate Query to a Custom Class](https://www.baeldung.com/hibernate-query-to-custom-class) - [@JoinColumn Annotation Explained](https://www.baeldung.com/jpa-join-column) - [Hibernate 5 Naming Strategy Configuration](https://www.baeldung.com/hibernate-naming-strategy) +- [Proxy in Hibernate load() Method](https://www.baeldung.com/hibernate-proxy-load-method) +- [Custom Types in Hibernate](https://www.baeldung.com/hibernate-custom-types) +- [Criteria API – An Example of IN Expressions](https://www.baeldung.com/jpa-criteria-api-in-expressions) +- [Difference Between @JoinColumn and mappedBy](https://www.baeldung.com/jpa-joincolumn-vs-mappedby) diff --git a/hibernate5/pom.xml b/persistence-modules/hibernate5/pom.xml similarity index 79% rename from hibernate5/pom.xml rename to persistence-modules/hibernate5/pom.xml index 610c893bdc..7e9a0ddb29 100644 --- a/hibernate5/pom.xml +++ b/persistence-modules/hibernate5/pom.xml @@ -5,11 +5,13 @@ com.baeldung hibernate5 0.0.1-SNAPSHOT + hibernate5 com.baeldung parent-modules 1.0.0-SNAPSHOT + ../../ @@ -44,6 +46,16 @@ mariaDB4j ${mariaDB4j.version} + + org.hibernate + hibernate-testing + 5.2.2.Final + + + com.fasterxml.jackson.core + jackson-databind + ${jackson.version} + @@ -57,11 +69,12 @@ - 5.3.2.Final + 5.3.6.Final 6.0.6 2.2.3 1.4.196 3.8.0 + 2.8.11.3 diff --git a/hibernate5/src/main/java/com/baeldung/hibernate/HibernateUtil.java b/persistence-modules/hibernate5/src/main/java/com/baeldung/hibernate/HibernateUtil.java similarity index 93% rename from hibernate5/src/main/java/com/baeldung/hibernate/HibernateUtil.java rename to persistence-modules/hibernate5/src/main/java/com/baeldung/hibernate/HibernateUtil.java index 2212e736ab..e0d1de591b 100644 --- a/hibernate5/src/main/java/com/baeldung/hibernate/HibernateUtil.java +++ b/persistence-modules/hibernate5/src/main/java/com/baeldung/hibernate/HibernateUtil.java @@ -5,6 +5,8 @@ import java.io.IOException; import java.net.URL; import java.util.Properties; +import com.baeldung.hibernate.customtypes.LocalDateStringType; +import com.baeldung.hibernate.customtypes.OfficeEmployee; import com.baeldung.hibernate.entities.DeptEmployee; import com.baeldung.hibernate.optimisticlocking.OptimisticLockingCourse; import com.baeldung.hibernate.optimisticlocking.OptimisticLockingStudent; @@ -18,8 +20,10 @@ import com.baeldung.hibernate.pojo.inheritance.*; import org.apache.commons.lang3.StringUtils; import org.hibernate.SessionFactory; import org.hibernate.boot.Metadata; +import org.hibernate.boot.MetadataBuilder; import org.hibernate.boot.MetadataSources; import org.hibernate.boot.registry.StandardServiceRegistryBuilder; +import org.hibernate.cfg.Configuration; import org.hibernate.service.ServiceRegistry; import com.baeldung.hibernate.pojo.Course; @@ -66,6 +70,7 @@ public class HibernateUtil { private static SessionFactory makeSessionFactory(ServiceRegistry serviceRegistry) { MetadataSources metadataSources = new MetadataSources(serviceRegistry); + metadataSources.addPackage("com.baeldung.hibernate.pojo"); metadataSources.addAnnotatedClass(Employee.class); metadataSources.addAnnotatedClass(Phone.class); @@ -102,8 +107,12 @@ public class HibernateUtil { metadataSources.addAnnotatedClass(com.baeldung.hibernate.entities.Department.class); metadataSources.addAnnotatedClass(OptimisticLockingCourse.class); metadataSources.addAnnotatedClass(OptimisticLockingStudent.class); + metadataSources.addAnnotatedClass(OfficeEmployee.class); + + Metadata metadata = metadataSources.getMetadataBuilder() + .applyBasicType(LocalDateStringType.INSTANCE) + .build(); - Metadata metadata = metadataSources.buildMetadata(); return metadata.getSessionFactoryBuilder() .build(); diff --git a/hibernate5/src/main/java/com/baeldung/hibernate/UnsupportedTenancyException.java b/persistence-modules/hibernate5/src/main/java/com/baeldung/hibernate/UnsupportedTenancyException.java similarity index 100% rename from hibernate5/src/main/java/com/baeldung/hibernate/UnsupportedTenancyException.java rename to persistence-modules/hibernate5/src/main/java/com/baeldung/hibernate/UnsupportedTenancyException.java diff --git a/hibernate5/src/main/java/com/baeldung/hibernate/converters/PersonNameConverter.java b/persistence-modules/hibernate5/src/main/java/com/baeldung/hibernate/converters/PersonNameConverter.java similarity index 100% rename from hibernate5/src/main/java/com/baeldung/hibernate/converters/PersonNameConverter.java rename to persistence-modules/hibernate5/src/main/java/com/baeldung/hibernate/converters/PersonNameConverter.java diff --git a/persistence-modules/hibernate5/src/main/java/com/baeldung/hibernate/customtypes/Address.java b/persistence-modules/hibernate5/src/main/java/com/baeldung/hibernate/customtypes/Address.java new file mode 100644 index 0000000000..d559e5a6c2 --- /dev/null +++ b/persistence-modules/hibernate5/src/main/java/com/baeldung/hibernate/customtypes/Address.java @@ -0,0 +1,69 @@ +package com.baeldung.hibernate.customtypes; + +import java.util.Objects; + +public class Address { + + private String addressLine1; + private String addressLine2; + private String city; + private String country; + private int zipCode; + + public String getAddressLine1() { + return addressLine1; + } + + public String getAddressLine2() { + return addressLine2; + } + + public String getCity() { + return city; + } + + public String getCountry() { + return country; + } + + public int getZipCode() { + return zipCode; + } + + public void setAddressLine1(String addressLine1) { + this.addressLine1 = addressLine1; + } + + public void setAddressLine2(String addressLine2) { + this.addressLine2 = addressLine2; + } + + public void setCity(String city) { + this.city = city; + } + + public void setCountry(String country) { + this.country = country; + } + + public void setZipCode(int zipCode) { + this.zipCode = zipCode; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + Address address = (Address) o; + return zipCode == address.zipCode && + Objects.equals(addressLine1, address.addressLine1) && + Objects.equals(addressLine2, address.addressLine2) && + Objects.equals(city, address.city) && + Objects.equals(country, address.country); + } + + @Override + public int hashCode() { + return Objects.hash(addressLine1, addressLine2, city, country, zipCode); + } +} diff --git a/persistence-modules/hibernate5/src/main/java/com/baeldung/hibernate/customtypes/AddressType.java b/persistence-modules/hibernate5/src/main/java/com/baeldung/hibernate/customtypes/AddressType.java new file mode 100644 index 0000000000..c10c67df9a --- /dev/null +++ b/persistence-modules/hibernate5/src/main/java/com/baeldung/hibernate/customtypes/AddressType.java @@ -0,0 +1,169 @@ +package com.baeldung.hibernate.customtypes; + +import org.hibernate.HibernateException; +import org.hibernate.engine.spi.SharedSessionContractImplementor; +import org.hibernate.type.IntegerType; +import org.hibernate.type.StringType; +import org.hibernate.type.Type; +import org.hibernate.usertype.CompositeUserType; + +import java.io.Serializable; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.sql.Types; +import java.util.Objects; + +public class AddressType implements CompositeUserType { + + @Override + public String[] getPropertyNames() { + return new String[]{"addressLine1", "addressLine2", + "city", "country", "zipcode"}; + } + + @Override + public Type[] getPropertyTypes() { + return new Type[]{StringType.INSTANCE, StringType.INSTANCE, + StringType.INSTANCE, StringType.INSTANCE, IntegerType.INSTANCE}; + } + + @Override + public Object getPropertyValue(Object component, int property) throws HibernateException { + + Address empAdd = (Address) component; + + switch (property) { + case 0: + return empAdd.getAddressLine1(); + case 1: + return empAdd.getAddressLine2(); + case 2: + return empAdd.getCity(); + case 3: + return empAdd.getCountry(); + case 4: + return Integer.valueOf(empAdd.getZipCode()); + } + + throw new IllegalArgumentException(property + + " is an invalid property index for class type " + + component.getClass().getName()); + } + + @Override + public void setPropertyValue(Object component, int property, Object value) throws HibernateException { + + Address empAdd = (Address) component; + + switch (property) { + case 0: + empAdd.setAddressLine1((String) value); + case 1: + empAdd.setAddressLine2((String) value); + case 2: + empAdd.setCity((String) value); + case 3: + empAdd.setCountry((String) value); + case 4: + empAdd.setZipCode((Integer) value); + } + + throw new IllegalArgumentException(property + + " is an invalid property index for class type " + + component.getClass().getName()); + + } + + @Override + public Class returnedClass() { + return Address.class; + } + + @Override + public boolean equals(Object x, Object y) throws HibernateException { + if (x == y) + return true; + + if (Objects.isNull(x) || Objects.isNull(y)) + return false; + + return x.equals(y); + } + + @Override + public int hashCode(Object x) throws HibernateException { + return x.hashCode(); + } + + @Override + public Object nullSafeGet(ResultSet rs, String[] names, SharedSessionContractImplementor session, Object owner) throws HibernateException, SQLException { + + Address empAdd = new Address(); + empAdd.setAddressLine1(rs.getString(names[0])); + + if (rs.wasNull()) + return null; + + empAdd.setAddressLine2(rs.getString(names[1])); + empAdd.setCity(rs.getString(names[2])); + empAdd.setCountry(rs.getString(names[3])); + empAdd.setZipCode(rs.getInt(names[4])); + + return empAdd; + } + + @Override + public void nullSafeSet(PreparedStatement st, Object value, int index, SharedSessionContractImplementor session) throws HibernateException, SQLException { + + if (Objects.isNull(value)) + st.setNull(index, Types.VARCHAR); + else { + + Address empAdd = (Address) value; + st.setString(index, empAdd.getAddressLine1()); + st.setString(index + 1, empAdd.getAddressLine2()); + st.setString(index + 2, empAdd.getCity()); + st.setString(index + 3, empAdd.getCountry()); + st.setInt(index + 4, empAdd.getZipCode()); + } + } + + @Override + public Object deepCopy(Object value) throws HibernateException { + + if (Objects.isNull(value)) + return null; + + Address oldEmpAdd = (Address) value; + Address newEmpAdd = new Address(); + + newEmpAdd.setAddressLine1(oldEmpAdd.getAddressLine1()); + newEmpAdd.setAddressLine2(oldEmpAdd.getAddressLine2()); + newEmpAdd.setCity(oldEmpAdd.getCity()); + newEmpAdd.setCountry(oldEmpAdd.getCountry()); + newEmpAdd.setZipCode(oldEmpAdd.getZipCode()); + + return newEmpAdd; + } + + @Override + public boolean isMutable() { + return true; + } + + @Override + public Serializable disassemble(Object value, SharedSessionContractImplementor session) throws HibernateException { + return (Serializable) deepCopy(value); + } + + @Override + public Object assemble(Serializable cached, SharedSessionContractImplementor session, Object owner) throws HibernateException { + return deepCopy(cached); + } + + @Override + public Object replace(Object original, Object target, SharedSessionContractImplementor session, Object owner) throws HibernateException { + return original; + } +} diff --git a/persistence-modules/hibernate5/src/main/java/com/baeldung/hibernate/customtypes/LocalDateStringJavaDescriptor.java b/persistence-modules/hibernate5/src/main/java/com/baeldung/hibernate/customtypes/LocalDateStringJavaDescriptor.java new file mode 100644 index 0000000000..56be9e693f --- /dev/null +++ b/persistence-modules/hibernate5/src/main/java/com/baeldung/hibernate/customtypes/LocalDateStringJavaDescriptor.java @@ -0,0 +1,51 @@ +package com.baeldung.hibernate.customtypes; + +import org.hibernate.type.LocalDateType; +import org.hibernate.type.descriptor.WrapperOptions; +import org.hibernate.type.descriptor.java.AbstractTypeDescriptor; +import org.hibernate.type.descriptor.java.ImmutableMutabilityPlan; +import org.hibernate.type.descriptor.java.MutabilityPlan; + +import java.time.LocalDate; + +public class LocalDateStringJavaDescriptor extends AbstractTypeDescriptor { + + public static final LocalDateStringJavaDescriptor INSTANCE = new LocalDateStringJavaDescriptor(); + + public LocalDateStringJavaDescriptor() { + super(LocalDate.class, ImmutableMutabilityPlan.INSTANCE); + } + + @Override + public String toString(LocalDate value) { + return LocalDateType.FORMATTER.format(value); + } + + @Override + public LocalDate fromString(String string) { + return LocalDate.from(LocalDateType.FORMATTER.parse(string)); + } + + @Override + public X unwrap(LocalDate value, Class type, WrapperOptions options) { + + if (value == null) + return null; + + if (String.class.isAssignableFrom(type)) + return (X) LocalDateType.FORMATTER.format(value); + + throw unknownUnwrap(type); + } + + @Override + public LocalDate wrap(X value, WrapperOptions options) { + if (value == null) + return null; + + if(String.class.isInstance(value)) + return LocalDate.from(LocalDateType.FORMATTER.parse((CharSequence) value)); + + throw unknownWrap(value.getClass()); + } +} diff --git a/persistence-modules/hibernate5/src/main/java/com/baeldung/hibernate/customtypes/LocalDateStringType.java b/persistence-modules/hibernate5/src/main/java/com/baeldung/hibernate/customtypes/LocalDateStringType.java new file mode 100644 index 0000000000..c8d37073e8 --- /dev/null +++ b/persistence-modules/hibernate5/src/main/java/com/baeldung/hibernate/customtypes/LocalDateStringType.java @@ -0,0 +1,34 @@ +package com.baeldung.hibernate.customtypes; + +import org.hibernate.dialect.Dialect; +import org.hibernate.type.AbstractSingleColumnStandardBasicType; +import org.hibernate.type.DiscriminatorType; +import org.hibernate.type.descriptor.java.LocalDateJavaDescriptor; +import org.hibernate.type.descriptor.sql.VarcharTypeDescriptor; + +import java.time.LocalDate; + +public class LocalDateStringType extends AbstractSingleColumnStandardBasicType implements DiscriminatorType { + + public static final LocalDateStringType INSTANCE = new LocalDateStringType(); + + public LocalDateStringType() { + super(VarcharTypeDescriptor.INSTANCE, LocalDateStringJavaDescriptor.INSTANCE); + } + + @Override + public String getName() { + return "LocalDateString"; + } + + @Override + public LocalDate stringToObject(String xml) throws Exception { + return fromString(xml); + } + + @Override + public String objectToSQLString(LocalDate value, Dialect dialect) throws Exception { + return '\'' + toString(value) + '\''; + } + +} diff --git a/persistence-modules/hibernate5/src/main/java/com/baeldung/hibernate/customtypes/OfficeEmployee.java b/persistence-modules/hibernate5/src/main/java/com/baeldung/hibernate/customtypes/OfficeEmployee.java new file mode 100644 index 0000000000..3ca06e4316 --- /dev/null +++ b/persistence-modules/hibernate5/src/main/java/com/baeldung/hibernate/customtypes/OfficeEmployee.java @@ -0,0 +1,88 @@ +package com.baeldung.hibernate.customtypes; + +import com.baeldung.hibernate.pojo.Phone; +import org.hibernate.annotations.Columns; +import org.hibernate.annotations.Parameter; +import org.hibernate.annotations.Type; +import org.hibernate.annotations.TypeDef; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.Id; +import javax.persistence.Table; +import java.time.LocalDate; + +@TypeDef(name = "PhoneNumber", + typeClass = PhoneNumberType.class, + defaultForType = PhoneNumber.class) +@Entity +@Table(name = "OfficeEmployee") +public class OfficeEmployee { + + @Id + @GeneratedValue + private long id; + + @Column + @Type(type = "LocalDateString") + private LocalDate dateOfJoining; + + @Columns(columns = {@Column(name = "country_code"), + @Column(name = "city_code"), + @Column(name = "number")}) + private PhoneNumber employeeNumber; + + @Columns(columns = {@Column(name = "address_line_1"), + @Column(name = "address_line_2"), + @Column(name = "city"), @Column(name = "country"), + @Column(name = "zip_code")}) + @Type(type = "com.baeldung.hibernate.customtypes.AddressType") + private Address empAddress; + + @Type(type = "com.baeldung.hibernate.customtypes.SalaryType", + parameters = {@Parameter(name = "currency", value = "USD")}) + @Columns(columns = {@Column(name = "amount"), + @Column(name = "currency")}) + private Salary salary; + + public Salary getSalary() { + return salary; + } + + public void setSalary(Salary salary) { + this.salary = salary; + } + + public long getId() { + return id; + } + + public void setId(long id) { + this.id = id; + } + + public LocalDate getDateOfJoining() { + return dateOfJoining; + } + + public void setDateOfJoining(LocalDate dateOfJoining) { + this.dateOfJoining = dateOfJoining; + } + + public PhoneNumber getEmployeeNumber() { + return employeeNumber; + } + + public void setEmployeeNumber(PhoneNumber employeeNumber) { + this.employeeNumber = employeeNumber; + } + + public Address getEmpAddress() { + return empAddress; + } + + public void setEmpAddress(Address empAddress) { + this.empAddress = empAddress; + } +} diff --git a/persistence-modules/hibernate5/src/main/java/com/baeldung/hibernate/customtypes/PhoneNumber.java b/persistence-modules/hibernate5/src/main/java/com/baeldung/hibernate/customtypes/PhoneNumber.java new file mode 100644 index 0000000000..0be6cbc910 --- /dev/null +++ b/persistence-modules/hibernate5/src/main/java/com/baeldung/hibernate/customtypes/PhoneNumber.java @@ -0,0 +1,43 @@ +package com.baeldung.hibernate.customtypes; + +import java.util.Objects; + +public final class PhoneNumber { + + private final int countryCode; + private final int cityCode; + private final int number; + + public PhoneNumber(int countryCode, int cityCode, int number) { + this.countryCode = countryCode; + this.cityCode = cityCode; + this.number = number; + } + + public int getCountryCode() { + return countryCode; + } + + public int getCityCode() { + return cityCode; + } + + public int getNumber() { + return number; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + PhoneNumber that = (PhoneNumber) o; + return countryCode == that.countryCode && + cityCode == that.cityCode && + number == that.number; + } + + @Override + public int hashCode() { + return Objects.hash(countryCode, cityCode, number); + } +} diff --git a/persistence-modules/hibernate5/src/main/java/com/baeldung/hibernate/customtypes/PhoneNumberType.java b/persistence-modules/hibernate5/src/main/java/com/baeldung/hibernate/customtypes/PhoneNumberType.java new file mode 100644 index 0000000000..9f09352bec --- /dev/null +++ b/persistence-modules/hibernate5/src/main/java/com/baeldung/hibernate/customtypes/PhoneNumberType.java @@ -0,0 +1,98 @@ +package com.baeldung.hibernate.customtypes; + +import org.hibernate.HibernateException; +import org.hibernate.engine.spi.SharedSessionContractImplementor; +import org.hibernate.usertype.UserType; + +import java.io.Serializable; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.sql.Types; +import java.util.Objects; + + +public class PhoneNumberType implements UserType { + @Override + public int[] sqlTypes() { + return new int[]{Types.INTEGER, Types.INTEGER, Types.INTEGER}; + } + + @Override + public Class returnedClass() { + return PhoneNumber.class; + } + + @Override + public boolean equals(Object x, Object y) throws HibernateException { + if (x == y) + return true; + if (Objects.isNull(x) || Objects.isNull(y)) + return false; + + return x.equals(y); + } + + @Override + public int hashCode(Object x) throws HibernateException { + return x.hashCode(); + } + + @Override + public Object nullSafeGet(ResultSet rs, String[] names, SharedSessionContractImplementor session, Object owner) throws HibernateException, SQLException { + int countryCode = rs.getInt(names[0]); + + if (rs.wasNull()) + return null; + + int cityCode = rs.getInt(names[1]); + int number = rs.getInt(names[2]); + PhoneNumber employeeNumber = new PhoneNumber(countryCode, cityCode, number); + + return employeeNumber; + } + + @Override + public void nullSafeSet(PreparedStatement st, Object value, int index, SharedSessionContractImplementor session) throws HibernateException, SQLException { + + if (Objects.isNull(value)) { + st.setNull(index, Types.INTEGER); + } else { + PhoneNumber employeeNumber = (PhoneNumber) value; + st.setInt(index,employeeNumber.getCountryCode()); + st.setInt(index+1,employeeNumber.getCityCode()); + st.setInt(index+2,employeeNumber.getNumber()); + } + } + + @Override + public Object deepCopy(Object value) throws HibernateException { + if (Objects.isNull(value)) + return null; + + PhoneNumber empNumber = (PhoneNumber) value; + PhoneNumber newEmpNumber = new PhoneNumber(empNumber.getCountryCode(),empNumber.getCityCode(),empNumber.getNumber()); + + return newEmpNumber; + } + + @Override + public boolean isMutable() { + return false; + } + + @Override + public Serializable disassemble(Object value) throws HibernateException { + return (Serializable) value; + } + + @Override + public Object assemble(Serializable cached, Object owner) throws HibernateException { + return cached; + } + + @Override + public Object replace(Object original, Object target, Object owner) throws HibernateException { + return original; + } +} diff --git a/persistence-modules/hibernate5/src/main/java/com/baeldung/hibernate/customtypes/Salary.java b/persistence-modules/hibernate5/src/main/java/com/baeldung/hibernate/customtypes/Salary.java new file mode 100644 index 0000000000..f9a7ac5902 --- /dev/null +++ b/persistence-modules/hibernate5/src/main/java/com/baeldung/hibernate/customtypes/Salary.java @@ -0,0 +1,39 @@ +package com.baeldung.hibernate.customtypes; + +import java.util.Objects; + +public class Salary { + + private Long amount; + private String currency; + + public Long getAmount() { + return amount; + } + + public void setAmount(Long amount) { + this.amount = amount; + } + + public String getCurrency() { + return currency; + } + + public void setCurrency(String currency) { + this.currency = currency; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + Salary salary = (Salary) o; + return Objects.equals(amount, salary.amount) && + Objects.equals(currency, salary.currency); + } + + @Override + public int hashCode() { + return Objects.hash(amount, currency); + } +} diff --git a/persistence-modules/hibernate5/src/main/java/com/baeldung/hibernate/customtypes/SalaryCurrencyConvertor.java b/persistence-modules/hibernate5/src/main/java/com/baeldung/hibernate/customtypes/SalaryCurrencyConvertor.java new file mode 100644 index 0000000000..340c697c11 --- /dev/null +++ b/persistence-modules/hibernate5/src/main/java/com/baeldung/hibernate/customtypes/SalaryCurrencyConvertor.java @@ -0,0 +1,15 @@ +package com.baeldung.hibernate.customtypes; + +public class SalaryCurrencyConvertor { + + public static Long convert(Long amount, String oldCurr, String newCurr){ + if (newCurr.equalsIgnoreCase(oldCurr)) + return amount; + + return convertTo(); + } + + private static Long convertTo() { + return 10L; + } +} diff --git a/persistence-modules/hibernate5/src/main/java/com/baeldung/hibernate/customtypes/SalaryType.java b/persistence-modules/hibernate5/src/main/java/com/baeldung/hibernate/customtypes/SalaryType.java new file mode 100644 index 0000000000..266b85140b --- /dev/null +++ b/persistence-modules/hibernate5/src/main/java/com/baeldung/hibernate/customtypes/SalaryType.java @@ -0,0 +1,161 @@ +package com.baeldung.hibernate.customtypes; + +import org.hibernate.HibernateException; +import org.hibernate.engine.spi.SharedSessionContractImplementor; +import org.hibernate.type.LongType; +import org.hibernate.type.StringType; +import org.hibernate.type.Type; +import org.hibernate.usertype.CompositeUserType; +import org.hibernate.usertype.DynamicParameterizedType; + +import java.io.Serializable; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.sql.Types; +import java.util.Objects; +import java.util.Properties; + +public class SalaryType implements CompositeUserType, DynamicParameterizedType { + + private String localCurrency; + + @Override + public String[] getPropertyNames() { + return new String[]{"amount", "currency"}; + } + + @Override + public Type[] getPropertyTypes() { + return new Type[]{LongType.INSTANCE, StringType.INSTANCE}; + } + + @Override + public Object getPropertyValue(Object component, int property) throws HibernateException { + + Salary salary = (Salary) component; + + switch (property) { + case 0: + return salary.getAmount(); + case 1: + return salary.getCurrency(); + } + + throw new IllegalArgumentException(property + + " is an invalid property index for class type " + + component.getClass().getName()); + + } + + + @Override + public void setPropertyValue(Object component, int property, Object value) throws HibernateException { + + Salary salary = (Salary) component; + + switch (property) { + case 0: + salary.setAmount((Long) value); + case 1: + salary.setCurrency((String) value); + } + + throw new IllegalArgumentException(property + + " is an invalid property index for class type " + + component.getClass().getName()); + + } + + @Override + public Class returnedClass() { + return Salary.class; + } + + @Override + public boolean equals(Object x, Object y) throws HibernateException { + + if (x == y) + return true; + + if (Objects.isNull(x) || Objects.isNull(y)) + return false; + + return x.equals(y); + + } + + @Override + public int hashCode(Object x) throws HibernateException { + return x.hashCode(); + } + + @Override + public Object nullSafeGet(ResultSet rs, String[] names, SharedSessionContractImplementor session, Object owner) throws HibernateException, SQLException { + + Salary salary = new Salary(); + salary.setAmount(rs.getLong(names[0])); + + if (rs.wasNull()) + return null; + + salary.setCurrency(rs.getString(names[1])); + + return salary; + } + + @Override + public void nullSafeSet(PreparedStatement st, Object value, int index, SharedSessionContractImplementor session) throws HibernateException, SQLException { + + + if (Objects.isNull(value)) + st.setNull(index, Types.BIGINT); + else { + + Salary salary = (Salary) value; + st.setLong(index, SalaryCurrencyConvertor.convert(salary.getAmount(), + salary.getCurrency(), localCurrency)); + st.setString(index + 1, salary.getCurrency()); + } + } + + @Override + public Object deepCopy(Object value) throws HibernateException { + + if (Objects.isNull(value)) + return null; + + Salary oldSal = (Salary) value; + Salary newSal = new Salary(); + + newSal.setAmount(oldSal.getAmount()); + newSal.setCurrency(oldSal.getCurrency()); + + return newSal; + } + + @Override + public boolean isMutable() { + return true; + } + + @Override + public Serializable disassemble(Object value, SharedSessionContractImplementor session) throws HibernateException { + return (Serializable) deepCopy(value); + } + + @Override + public Object assemble(Serializable cached, SharedSessionContractImplementor session, Object owner) throws HibernateException { + return deepCopy(cached); + } + + @Override + public Object replace(Object original, Object target, SharedSessionContractImplementor session, Object owner) throws HibernateException { + return original; + } + + @Override + public void setParameterValues(Properties parameters) { + this.localCurrency = parameters.getProperty("currency"); + } +} diff --git a/hibernate5/src/main/java/com/baeldung/hibernate/entities/Department.java b/persistence-modules/hibernate5/src/main/java/com/baeldung/hibernate/entities/Department.java similarity index 100% rename from hibernate5/src/main/java/com/baeldung/hibernate/entities/Department.java rename to persistence-modules/hibernate5/src/main/java/com/baeldung/hibernate/entities/Department.java diff --git a/persistence-modules/hibernate5/src/main/java/com/baeldung/hibernate/entities/DeptEmployee.java b/persistence-modules/hibernate5/src/main/java/com/baeldung/hibernate/entities/DeptEmployee.java new file mode 100644 index 0000000000..6510e70650 --- /dev/null +++ b/persistence-modules/hibernate5/src/main/java/com/baeldung/hibernate/entities/DeptEmployee.java @@ -0,0 +1,83 @@ +package com.baeldung.hibernate.entities; + +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.ManyToOne; + +@org.hibernate.annotations.NamedQueries({ @org.hibernate.annotations.NamedQuery(name = "DeptEmployee_FindByEmployeeNumber", query = "from DeptEmployee where employeeNumber = :employeeNo"), + @org.hibernate.annotations.NamedQuery(name = "DeptEmployee_FindAllByDesgination", query = "from DeptEmployee where designation = :designation"), + @org.hibernate.annotations.NamedQuery(name = "DeptEmployee_UpdateEmployeeDepartment", query = "Update DeptEmployee set department = :newDepartment where employeeNumber = :employeeNo"), + @org.hibernate.annotations.NamedQuery(name = "DeptEmployee_FindAllByDepartment", query = "from DeptEmployee where department = :department", timeout = 1, fetchSize = 10) }) +@org.hibernate.annotations.NamedNativeQueries({ @org.hibernate.annotations.NamedNativeQuery(name = "DeptEmployee_FindByEmployeeName", query = "select * from deptemployee emp where name=:name", resultClass = DeptEmployee.class), + @org.hibernate.annotations.NamedNativeQuery(name = "DeptEmployee_UpdateEmployeeDesignation", query = "call UPDATE_EMPLOYEE_DESIGNATION(:employeeNumber, :newDesignation)", resultClass = DeptEmployee.class) }) +@Entity +public class DeptEmployee { + @Id + @GeneratedValue(strategy = GenerationType.SEQUENCE) + private long id; + + private String employeeNumber; + + private String title; + + private String name; + + @ManyToOne + private Department department; + + public DeptEmployee(String name, String employeeNumber, Department department) { + this.name = name; + this.employeeNumber = employeeNumber; + this.department = department; + } + + public DeptEmployee(String name, String employeeNumber, String title, Department department) { + super(); + this.name = name; + this.employeeNumber = employeeNumber; + this.title = title; + this.department = department; + } + + 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 Department getDepartment() { + return department; + } + + public void setDepartment(Department department) { + this.department = department; + } + + public String getTitle() { + return title; + } + + public void setTitle(String title) { + this.title = title; + } +} diff --git a/persistence-modules/hibernate5/src/main/java/com/baeldung/hibernate/findall/FindAll.java b/persistence-modules/hibernate5/src/main/java/com/baeldung/hibernate/findall/FindAll.java new file mode 100644 index 0000000000..cc0c234df0 --- /dev/null +++ b/persistence-modules/hibernate5/src/main/java/com/baeldung/hibernate/findall/FindAll.java @@ -0,0 +1,35 @@ +package com.baeldung.hibernate.findall; + +import java.util.List; + +import javax.persistence.TypedQuery; +import javax.persistence.criteria.CriteriaBuilder; +import javax.persistence.criteria.CriteriaQuery; +import javax.persistence.criteria.Root; + +import org.hibernate.Session; + +import com.baeldung.hibernate.pojo.Student; + +public class FindAll { + + private Session session; + + public FindAll(Session session) { + super(); + this.session = session; + } + + public List findAllWithJpql() { + return session.createQuery("SELECT a FROM Student a", Student.class).getResultList(); + } + + public List findAllWithCriteriaQuery() { + CriteriaBuilder cb = session.getCriteriaBuilder(); + CriteriaQuery cq = cb.createQuery(Student.class); + Root rootEntry = cq.from(Student.class); + CriteriaQuery all = cq.select(rootEntry); + TypedQuery allQuery = session.createQuery(all); + return allQuery.getResultList(); + } +} diff --git a/hibernate5/src/main/java/com/baeldung/hibernate/interceptors/CustomInterceptor.java b/persistence-modules/hibernate5/src/main/java/com/baeldung/hibernate/interceptors/CustomInterceptor.java similarity index 100% rename from hibernate5/src/main/java/com/baeldung/hibernate/interceptors/CustomInterceptor.java rename to persistence-modules/hibernate5/src/main/java/com/baeldung/hibernate/interceptors/CustomInterceptor.java diff --git a/hibernate5/src/main/java/com/baeldung/hibernate/interceptors/CustomInterceptorImpl.java b/persistence-modules/hibernate5/src/main/java/com/baeldung/hibernate/interceptors/CustomInterceptorImpl.java similarity index 100% rename from hibernate5/src/main/java/com/baeldung/hibernate/interceptors/CustomInterceptorImpl.java rename to persistence-modules/hibernate5/src/main/java/com/baeldung/hibernate/interceptors/CustomInterceptorImpl.java diff --git a/hibernate5/src/main/java/com/baeldung/hibernate/interceptors/HibernateUtil.java b/persistence-modules/hibernate5/src/main/java/com/baeldung/hibernate/interceptors/HibernateUtil.java similarity index 100% rename from hibernate5/src/main/java/com/baeldung/hibernate/interceptors/HibernateUtil.java rename to persistence-modules/hibernate5/src/main/java/com/baeldung/hibernate/interceptors/HibernateUtil.java diff --git a/hibernate5/src/main/java/com/baeldung/hibernate/interceptors/entity/User.java b/persistence-modules/hibernate5/src/main/java/com/baeldung/hibernate/interceptors/entity/User.java similarity index 100% rename from hibernate5/src/main/java/com/baeldung/hibernate/interceptors/entity/User.java rename to persistence-modules/hibernate5/src/main/java/com/baeldung/hibernate/interceptors/entity/User.java diff --git a/hibernate5/src/main/java/com/baeldung/hibernate/joincolumn/Address.java b/persistence-modules/hibernate5/src/main/java/com/baeldung/hibernate/joincolumn/Address.java similarity index 100% rename from hibernate5/src/main/java/com/baeldung/hibernate/joincolumn/Address.java rename to persistence-modules/hibernate5/src/main/java/com/baeldung/hibernate/joincolumn/Address.java diff --git a/hibernate5/src/main/java/com/baeldung/hibernate/joincolumn/Email.java b/persistence-modules/hibernate5/src/main/java/com/baeldung/hibernate/joincolumn/Email.java similarity index 100% rename from hibernate5/src/main/java/com/baeldung/hibernate/joincolumn/Email.java rename to persistence-modules/hibernate5/src/main/java/com/baeldung/hibernate/joincolumn/Email.java diff --git a/hibernate5/src/main/java/com/baeldung/hibernate/joincolumn/Employee.java b/persistence-modules/hibernate5/src/main/java/com/baeldung/hibernate/joincolumn/Employee.java similarity index 100% rename from hibernate5/src/main/java/com/baeldung/hibernate/joincolumn/Employee.java rename to persistence-modules/hibernate5/src/main/java/com/baeldung/hibernate/joincolumn/Employee.java diff --git a/hibernate5/src/main/java/com/baeldung/hibernate/joincolumn/Office.java b/persistence-modules/hibernate5/src/main/java/com/baeldung/hibernate/joincolumn/Office.java similarity index 100% rename from hibernate5/src/main/java/com/baeldung/hibernate/joincolumn/Office.java rename to persistence-modules/hibernate5/src/main/java/com/baeldung/hibernate/joincolumn/Office.java diff --git a/hibernate5/src/main/java/com/baeldung/hibernate/jpabootstrap/application/Application.java b/persistence-modules/hibernate5/src/main/java/com/baeldung/hibernate/jpabootstrap/application/Application.java similarity index 100% rename from hibernate5/src/main/java/com/baeldung/hibernate/jpabootstrap/application/Application.java rename to persistence-modules/hibernate5/src/main/java/com/baeldung/hibernate/jpabootstrap/application/Application.java diff --git a/hibernate5/src/main/java/com/baeldung/hibernate/jpabootstrap/config/HibernatePersistenceUnitInfo.java b/persistence-modules/hibernate5/src/main/java/com/baeldung/hibernate/jpabootstrap/config/HibernatePersistenceUnitInfo.java similarity index 100% rename from hibernate5/src/main/java/com/baeldung/hibernate/jpabootstrap/config/HibernatePersistenceUnitInfo.java rename to persistence-modules/hibernate5/src/main/java/com/baeldung/hibernate/jpabootstrap/config/HibernatePersistenceUnitInfo.java diff --git a/hibernate5/src/main/java/com/baeldung/hibernate/jpabootstrap/config/JpaEntityManagerFactory.java b/persistence-modules/hibernate5/src/main/java/com/baeldung/hibernate/jpabootstrap/config/JpaEntityManagerFactory.java similarity index 100% rename from hibernate5/src/main/java/com/baeldung/hibernate/jpabootstrap/config/JpaEntityManagerFactory.java rename to persistence-modules/hibernate5/src/main/java/com/baeldung/hibernate/jpabootstrap/config/JpaEntityManagerFactory.java diff --git a/hibernate5/src/main/java/com/baeldung/hibernate/jpabootstrap/entities/User.java b/persistence-modules/hibernate5/src/main/java/com/baeldung/hibernate/jpabootstrap/entities/User.java similarity index 100% rename from hibernate5/src/main/java/com/baeldung/hibernate/jpabootstrap/entities/User.java rename to persistence-modules/hibernate5/src/main/java/com/baeldung/hibernate/jpabootstrap/entities/User.java diff --git a/persistence-modules/hibernate5/src/main/java/com/baeldung/hibernate/jpacriteriabuilder/service/EmployeeSearchService.java b/persistence-modules/hibernate5/src/main/java/com/baeldung/hibernate/jpacriteriabuilder/service/EmployeeSearchService.java new file mode 100644 index 0000000000..b7d1a537f0 --- /dev/null +++ b/persistence-modules/hibernate5/src/main/java/com/baeldung/hibernate/jpacriteriabuilder/service/EmployeeSearchService.java @@ -0,0 +1,15 @@ +package com.baeldung.hibernate.jpacriteriabuilder.service; + +import java.util.List; + +import com.baeldung.hibernate.entities.DeptEmployee; + +public interface EmployeeSearchService { + + List filterbyTitleUsingCriteriaBuilder(List titles); + + List filterbyTitleUsingExpression(List titles); + + List searchByDepartmentQuery(String query); + +} diff --git a/persistence-modules/hibernate5/src/main/java/com/baeldung/hibernate/jpacriteriabuilder/service/EmployeeSearchServiceImpl.java b/persistence-modules/hibernate5/src/main/java/com/baeldung/hibernate/jpacriteriabuilder/service/EmployeeSearchServiceImpl.java new file mode 100644 index 0000000000..e79168a451 --- /dev/null +++ b/persistence-modules/hibernate5/src/main/java/com/baeldung/hibernate/jpacriteriabuilder/service/EmployeeSearchServiceImpl.java @@ -0,0 +1,77 @@ +package com.baeldung.hibernate.jpacriteriabuilder.service; + +import java.util.List; + +import javax.persistence.EntityManager; +import javax.persistence.TypedQuery; +import javax.persistence.criteria.CriteriaBuilder; +import javax.persistence.criteria.CriteriaBuilder.In; +import javax.persistence.criteria.CriteriaQuery; +import javax.persistence.criteria.Root; +import javax.persistence.criteria.Subquery; + +import com.baeldung.hibernate.entities.Department; +import com.baeldung.hibernate.entities.DeptEmployee; + +public class EmployeeSearchServiceImpl implements EmployeeSearchService { + + private EntityManager entityManager; + private CriteriaBuilder criteriaBuilder; + + public EmployeeSearchServiceImpl(EntityManager entityManager) { + this.entityManager = entityManager; + this.criteriaBuilder = entityManager.getCriteriaBuilder(); + + } + + @Override + public List filterbyTitleUsingCriteriaBuilder(List titles) { + CriteriaQuery criteriaQuery = createCriteriaQuery(DeptEmployee.class); + Root root = criteriaQuery.from(DeptEmployee.class); + In inClause = criteriaBuilder.in(root.get("title")); + for (String title : titles) { + inClause.value(title); + } + criteriaQuery.select(root) + .where(inClause); + TypedQuery query = entityManager.createQuery(criteriaQuery); + return query.getResultList(); + } + + @Override + public List filterbyTitleUsingExpression(List titles) { + CriteriaQuery criteriaQuery = createCriteriaQuery(DeptEmployee.class); + Root root = criteriaQuery.from(DeptEmployee.class); + criteriaQuery.select(root) + .where(root.get("title") + .in(titles)); + TypedQuery query = entityManager.createQuery(criteriaQuery); + return query.getResultList(); + } + + @Override + public List searchByDepartmentQuery(String searchKey) { + CriteriaQuery criteriaQuery = createCriteriaQuery(DeptEmployee.class); + Root emp = criteriaQuery.from(DeptEmployee.class); + + Subquery subquery = criteriaQuery.subquery(Department.class); + Root dept = subquery.from(Department.class); + subquery.select(dept) + .distinct(true) + .where(criteriaBuilder.like(dept.get("name"), new StringBuffer("%").append(searchKey) + .append("%") + .toString())); + + criteriaQuery.select(emp) + .where(criteriaBuilder.in(emp.get("department")) + .value(subquery)); + + TypedQuery query = entityManager.createQuery(criteriaQuery); + return query.getResultList(); + } + + private CriteriaQuery createCriteriaQuery(Class klass) { + return criteriaBuilder.createQuery(klass); + } + +} diff --git a/hibernate5/src/main/java/com/baeldung/hibernate/lifecycle/DirtyDataInspector.java b/persistence-modules/hibernate5/src/main/java/com/baeldung/hibernate/lifecycle/DirtyDataInspector.java similarity index 100% rename from hibernate5/src/main/java/com/baeldung/hibernate/lifecycle/DirtyDataInspector.java rename to persistence-modules/hibernate5/src/main/java/com/baeldung/hibernate/lifecycle/DirtyDataInspector.java diff --git a/hibernate5/src/main/java/com/baeldung/hibernate/lifecycle/FootballPlayer.java b/persistence-modules/hibernate5/src/main/java/com/baeldung/hibernate/lifecycle/FootballPlayer.java similarity index 100% rename from hibernate5/src/main/java/com/baeldung/hibernate/lifecycle/FootballPlayer.java rename to persistence-modules/hibernate5/src/main/java/com/baeldung/hibernate/lifecycle/FootballPlayer.java diff --git a/hibernate5/src/main/java/com/baeldung/hibernate/lifecycle/HibernateLifecycleUtil.java b/persistence-modules/hibernate5/src/main/java/com/baeldung/hibernate/lifecycle/HibernateLifecycleUtil.java similarity index 100% rename from hibernate5/src/main/java/com/baeldung/hibernate/lifecycle/HibernateLifecycleUtil.java rename to persistence-modules/hibernate5/src/main/java/com/baeldung/hibernate/lifecycle/HibernateLifecycleUtil.java diff --git a/hibernate5/src/main/java/com/baeldung/hibernate/lob/HibernateSessionUtil.java b/persistence-modules/hibernate5/src/main/java/com/baeldung/hibernate/lob/HibernateSessionUtil.java similarity index 100% rename from hibernate5/src/main/java/com/baeldung/hibernate/lob/HibernateSessionUtil.java rename to persistence-modules/hibernate5/src/main/java/com/baeldung/hibernate/lob/HibernateSessionUtil.java diff --git a/hibernate5/src/main/java/com/baeldung/hibernate/lob/model/User.java b/persistence-modules/hibernate5/src/main/java/com/baeldung/hibernate/lob/model/User.java similarity index 100% rename from hibernate5/src/main/java/com/baeldung/hibernate/lob/model/User.java rename to persistence-modules/hibernate5/src/main/java/com/baeldung/hibernate/lob/model/User.java diff --git a/hibernate5/src/main/java/com/baeldung/hibernate/namingstrategy/CustomPhysicalNamingStrategy.java b/persistence-modules/hibernate5/src/main/java/com/baeldung/hibernate/namingstrategy/CustomPhysicalNamingStrategy.java similarity index 100% rename from hibernate5/src/main/java/com/baeldung/hibernate/namingstrategy/CustomPhysicalNamingStrategy.java rename to persistence-modules/hibernate5/src/main/java/com/baeldung/hibernate/namingstrategy/CustomPhysicalNamingStrategy.java diff --git a/hibernate5/src/main/java/com/baeldung/hibernate/namingstrategy/Customer.java b/persistence-modules/hibernate5/src/main/java/com/baeldung/hibernate/namingstrategy/Customer.java similarity index 100% rename from hibernate5/src/main/java/com/baeldung/hibernate/namingstrategy/Customer.java rename to persistence-modules/hibernate5/src/main/java/com/baeldung/hibernate/namingstrategy/Customer.java diff --git a/persistence-modules/hibernate5/src/main/java/com/baeldung/hibernate/onetoone/HibernateUtil.java b/persistence-modules/hibernate5/src/main/java/com/baeldung/hibernate/onetoone/HibernateUtil.java new file mode 100644 index 0000000000..972ade9671 --- /dev/null +++ b/persistence-modules/hibernate5/src/main/java/com/baeldung/hibernate/onetoone/HibernateUtil.java @@ -0,0 +1,66 @@ +package com.baeldung.hibernate.onetoone; + +import com.baeldung.hibernate.customtypes.LocalDateStringType; +import org.hibernate.SessionFactory; +import org.hibernate.boot.Metadata; +import org.hibernate.boot.MetadataSources; +import org.hibernate.boot.registry.StandardServiceRegistryBuilder; +import org.hibernate.service.ServiceRegistry; + +import java.io.FileInputStream; +import java.io.IOException; +import java.net.URL; +import java.util.Properties; + +public class HibernateUtil { + private static SessionFactory sessionFactory; + + private HibernateUtil() { + } + + public static SessionFactory getSessionFactory(Strategy strategy) { + if (sessionFactory == null) { + sessionFactory = buildSessionFactory(strategy); + } + return sessionFactory; + } + + private static SessionFactory buildSessionFactory(Strategy strategy) { + try { + ServiceRegistry serviceRegistry = configureServiceRegistry(); + + MetadataSources metadataSources = new MetadataSources(serviceRegistry); + + for (Class entityClass : strategy.getEntityClasses()) { + metadataSources.addAnnotatedClass(entityClass); + } + + Metadata metadata = metadataSources.getMetadataBuilder() + .applyBasicType(LocalDateStringType.INSTANCE) + .build(); + + return metadata.getSessionFactoryBuilder() + .build(); + } catch (IOException ex) { + throw new ExceptionInInitializerError(ex); + } + } + + + private static ServiceRegistry configureServiceRegistry() throws IOException { + Properties properties = getProperties(); + return new StandardServiceRegistryBuilder().applySettings(properties) + .build(); + } + + private static Properties getProperties() throws IOException { + Properties properties = new Properties(); + URL propertiesURL = Thread.currentThread() + .getContextClassLoader() + .getResource("hibernate.properties"); + try (FileInputStream inputStream = new FileInputStream(propertiesURL.getFile())) { + properties.load(inputStream); + } + return properties; + } +} diff --git a/persistence-modules/hibernate5/src/main/java/com/baeldung/hibernate/onetoone/Strategy.java b/persistence-modules/hibernate5/src/main/java/com/baeldung/hibernate/onetoone/Strategy.java new file mode 100644 index 0000000000..3180566ca5 --- /dev/null +++ b/persistence-modules/hibernate5/src/main/java/com/baeldung/hibernate/onetoone/Strategy.java @@ -0,0 +1,25 @@ +package com.baeldung.hibernate.onetoone; + + +import java.util.Arrays; +import java.util.List; + +public enum Strategy { + //See that the classes belongs to different packages + FOREIGN_KEY(Arrays.asList(com.baeldung.hibernate.onetoone.foreignkeybased.User.class, + com.baeldung.hibernate.onetoone.foreignkeybased.Address.class)), + SHARED_PRIMARY_KEY(Arrays.asList(com.baeldung.hibernate.onetoone.sharedkeybased.User.class, + com.baeldung.hibernate.onetoone.sharedkeybased.Address.class)), + JOIN_TABLE_BASED(Arrays.asList(com.baeldung.hibernate.onetoone.jointablebased.Employee.class, + com.baeldung.hibernate.onetoone.jointablebased.WorkStation.class)); + + private List> entityClasses; + + Strategy(List> entityClasses) { + this.entityClasses = entityClasses; + } + + public List> getEntityClasses() { + return entityClasses; + } +} diff --git a/persistence-modules/hibernate5/src/main/java/com/baeldung/hibernate/onetoone/foreignkeybased/Address.java b/persistence-modules/hibernate5/src/main/java/com/baeldung/hibernate/onetoone/foreignkeybased/Address.java new file mode 100644 index 0000000000..e05eb46030 --- /dev/null +++ b/persistence-modules/hibernate5/src/main/java/com/baeldung/hibernate/onetoone/foreignkeybased/Address.java @@ -0,0 +1,60 @@ +package com.baeldung.hibernate.onetoone.foreignkeybased; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.OneToOne; +import javax.persistence.Table; + +@Entity +@Table(name = "address") +public class Address { + + @Id + @GeneratedValue(strategy = GenerationType.AUTO) + @Column(name = "id") + private Long id; + + @Column(name = "street") + private String street; + + @Column(name = "city") + private String city; + + @OneToOne(mappedBy = "address") + private User user; + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getStreet() { + return street; + } + + public void setStreet(String street) { + this.street = street; + } + + public String getCity() { + return city; + } + + public void setCity(String city) { + this.city = city; + } + + public User getUser() { + return user; + } + + public void setUser(User user) { + this.user = user; + } +} diff --git a/persistence-modules/hibernate5/src/main/java/com/baeldung/hibernate/onetoone/foreignkeybased/User.java b/persistence-modules/hibernate5/src/main/java/com/baeldung/hibernate/onetoone/foreignkeybased/User.java new file mode 100644 index 0000000000..dda972f29c --- /dev/null +++ b/persistence-modules/hibernate5/src/main/java/com/baeldung/hibernate/onetoone/foreignkeybased/User.java @@ -0,0 +1,51 @@ +package com.baeldung.hibernate.onetoone.foreignkeybased; + +import javax.persistence.CascadeType; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.OneToOne; +import javax.persistence.Table; + +@Entity +@Table(name = "users") +public class User { + @Id + @GeneratedValue(strategy = GenerationType.AUTO) + @Column(name = "id") + private Long id; + + @Column(name = "username") + private String userName; + + @OneToOne(cascade = CascadeType.ALL) + @JoinColumn(name = "address_id", referencedColumnName = "id") + private Address address; + + 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 Address getAddress() { + return address; + } + + public void setAddress(Address address) { + this.address = address; + } +} diff --git a/persistence-modules/hibernate5/src/main/java/com/baeldung/hibernate/onetoone/jointablebased/Employee.java b/persistence-modules/hibernate5/src/main/java/com/baeldung/hibernate/onetoone/jointablebased/Employee.java new file mode 100644 index 0000000000..a0bc101b9f --- /dev/null +++ b/persistence-modules/hibernate5/src/main/java/com/baeldung/hibernate/onetoone/jointablebased/Employee.java @@ -0,0 +1,53 @@ +package com.baeldung.hibernate.onetoone.jointablebased; + +import javax.persistence.CascadeType; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.JoinTable; +import javax.persistence.OneToOne; +import javax.persistence.Table; + +@Entity +@Table(name = "employee") +public class Employee { + @Id + @GeneratedValue(strategy = GenerationType.AUTO) + @Column(name = "id") + private Long id; + + @Column(name = "ename") + private String name; + + @OneToOne(cascade = CascadeType.ALL) + @JoinTable(name = "emp_workstation", joinColumns = {@JoinColumn(name = "employee_id", referencedColumnName = "id")}, + inverseJoinColumns = {@JoinColumn(name = "workstation_id", referencedColumnName = "id")}) + private WorkStation workStation; + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public WorkStation getWorkStation() { + return workStation; + } + + public void setWorkStation(WorkStation workStation) { + this.workStation = workStation; + } +} diff --git a/persistence-modules/hibernate5/src/main/java/com/baeldung/hibernate/onetoone/jointablebased/WorkStation.java b/persistence-modules/hibernate5/src/main/java/com/baeldung/hibernate/onetoone/jointablebased/WorkStation.java new file mode 100644 index 0000000000..f530611f6e --- /dev/null +++ b/persistence-modules/hibernate5/src/main/java/com/baeldung/hibernate/onetoone/jointablebased/WorkStation.java @@ -0,0 +1,61 @@ +package com.baeldung.hibernate.onetoone.jointablebased; + + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.OneToOne; +import javax.persistence.Table; + +@Entity +@Table(name = "workstation") +public class WorkStation { + + @Id + @GeneratedValue(strategy = GenerationType.AUTO) + @Column(name = "id") + private Long id; + + @Column(name = "workstation_number") + private Integer workstationNumber; + + @Column(name = "floor") + private String floor; + + @OneToOne(mappedBy = "workStation") + private Employee employee; + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public Integer getWorkstationNumber() { + return workstationNumber; + } + + public void setWorkstationNumber(Integer workstationNumber) { + this.workstationNumber = workstationNumber; + } + + public String getFloor() { + return floor; + } + + public void setFloor(String floor) { + this.floor = floor; + } + + public Employee getEmployee() { + return employee; + } + + public void setEmployee(Employee employee) { + this.employee = employee; + } +} \ No newline at end of file diff --git a/persistence-modules/hibernate5/src/main/java/com/baeldung/hibernate/onetoone/sharedkeybased/Address.java b/persistence-modules/hibernate5/src/main/java/com/baeldung/hibernate/onetoone/sharedkeybased/Address.java new file mode 100644 index 0000000000..927516f6bb --- /dev/null +++ b/persistence-modules/hibernate5/src/main/java/com/baeldung/hibernate/onetoone/sharedkeybased/Address.java @@ -0,0 +1,60 @@ +package com.baeldung.hibernate.onetoone.sharedkeybased; + + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.MapsId; +import javax.persistence.OneToOne; +import javax.persistence.Table; + +@Entity +@Table(name = "address") +public class Address { + + @Id + @Column(name = "id") + private Long id; + + @Column(name = "street") + private String street; + + @Column(name = "city") + private String city; + + @OneToOne + @MapsId + private User user; + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getStreet() { + return street; + } + + public void setStreet(String street) { + this.street = street; + } + + public String getCity() { + return city; + } + + public void setCity(String city) { + this.city = city; + } + + public User getUser() { + return user; + } + + public void setUser(User user) { + this.user = user; + } +} diff --git a/persistence-modules/hibernate5/src/main/java/com/baeldung/hibernate/onetoone/sharedkeybased/User.java b/persistence-modules/hibernate5/src/main/java/com/baeldung/hibernate/onetoone/sharedkeybased/User.java new file mode 100644 index 0000000000..fa00db1271 --- /dev/null +++ b/persistence-modules/hibernate5/src/main/java/com/baeldung/hibernate/onetoone/sharedkeybased/User.java @@ -0,0 +1,50 @@ +package com.baeldung.hibernate.onetoone.sharedkeybased; + + +import javax.persistence.CascadeType; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.OneToOne; +import javax.persistence.Table; + +@Entity +@Table(name = "users") +public class User { + @Id + @GeneratedValue(strategy = GenerationType.AUTO) + @Column(name = "id") + private Long id; + + @Column(name = "username") + private String userName; + + @OneToOne(mappedBy = "user", cascade = CascadeType.ALL) + private Address address; + + 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 Address getAddress() { + return address; + } + + public void setAddress(Address address) { + this.address = address; + } +} diff --git a/persistence-modules/hibernate5/src/main/java/com/baeldung/hibernate/operations/HibernateOperations.java b/persistence-modules/hibernate5/src/main/java/com/baeldung/hibernate/operations/HibernateOperations.java new file mode 100644 index 0000000000..d45daabe71 --- /dev/null +++ b/persistence-modules/hibernate5/src/main/java/com/baeldung/hibernate/operations/HibernateOperations.java @@ -0,0 +1,114 @@ +package com.baeldung.hibernate.operations; + +import java.util.List; + +import javax.persistence.EntityManager; +import javax.persistence.EntityManagerFactory; +import javax.persistence.Persistence; + +import com.baeldung.hibernate.pojo.Movie; + +/** + * + *Class to illustrate the usage of EntityManager API. + */ +public class HibernateOperations { + + private static final EntityManagerFactory emf; + + /** + * Static block for creating EntityManagerFactory. The Persistence class looks for META-INF/persistence.xml in the classpath. + */ + static { + emf = Persistence.createEntityManagerFactory("com.baeldung.movie_catalog"); + } + + /** + * Static method returning EntityManager. + * @return EntityManager + */ + public static EntityManager getEntityManager() { + return emf.createEntityManager(); + } + + /** + * Saves the movie entity into the database. Here we are using Application Managed EntityManager, hence should handle transactions by ourselves. + */ + public void saveMovie() { + EntityManager em = HibernateOperations.getEntityManager(); + em.getTransaction() + .begin(); + Movie movie = new Movie(); + movie.setId(1L); + movie.setMovieName("The Godfather"); + movie.setReleaseYear(1972); + movie.setLanguage("English"); + em.persist(movie); + em.getTransaction() + .commit(); + } + + /** + * Method to illustrate the querying support in EntityManager when the result is a single object. + * @return Movie + */ + public Movie queryForMovieById() { + EntityManager em = HibernateOperations.getEntityManager(); + Movie movie = (Movie) em.createQuery("SELECT movie from Movie movie where movie.id = ?1") + .setParameter(1, new Long(1L)) + .getSingleResult(); + return movie; + } + + /** + * Method to illustrate the querying support in EntityManager when the result is a list. + * @return + */ + public List queryForMovies() { + EntityManager em = HibernateOperations.getEntityManager(); + List movies = em.createQuery("SELECT movie from Movie movie where movie.language = ?1") + .setParameter(1, "English") + .getResultList(); + return movies; + } + + /** + * Method to illustrate the usage of find() method. + * @param movieId + * @return Movie + */ + public Movie getMovie(Long movieId) { + EntityManager em = HibernateOperations.getEntityManager(); + Movie movie = em.find(Movie.class, new Long(movieId)); + return movie; + } + + /** + * Method to illustrate the usage of merge() function. + */ + public void mergeMovie() { + EntityManager em = HibernateOperations.getEntityManager(); + Movie movie = getMovie(1L); + em.detach(movie); + movie.setLanguage("Italian"); + em.getTransaction() + .begin(); + em.merge(movie); + em.getTransaction() + .commit(); + } + + /** + * Method to illustrate the usage of remove() function. + */ + public void removeMovie() { + EntityManager em = HibernateOperations.getEntityManager(); + em.getTransaction() + .begin(); + Movie movie = em.find(Movie.class, new Long(1L)); + em.remove(movie); + em.getTransaction() + .commit(); + } + +} diff --git a/hibernate5/src/main/java/com/baeldung/hibernate/optimisticlocking/OptimisticLockingCourse.java b/persistence-modules/hibernate5/src/main/java/com/baeldung/hibernate/optimisticlocking/OptimisticLockingCourse.java similarity index 100% rename from hibernate5/src/main/java/com/baeldung/hibernate/optimisticlocking/OptimisticLockingCourse.java rename to persistence-modules/hibernate5/src/main/java/com/baeldung/hibernate/optimisticlocking/OptimisticLockingCourse.java diff --git a/hibernate5/src/main/java/com/baeldung/hibernate/optimisticlocking/OptimisticLockingStudent.java b/persistence-modules/hibernate5/src/main/java/com/baeldung/hibernate/optimisticlocking/OptimisticLockingStudent.java similarity index 100% rename from hibernate5/src/main/java/com/baeldung/hibernate/optimisticlocking/OptimisticLockingStudent.java rename to persistence-modules/hibernate5/src/main/java/com/baeldung/hibernate/optimisticlocking/OptimisticLockingStudent.java diff --git a/persistence-modules/hibernate5/src/main/java/com/baeldung/hibernate/persistjson/Customer.java b/persistence-modules/hibernate5/src/main/java/com/baeldung/hibernate/persistjson/Customer.java new file mode 100644 index 0000000000..6bd1c24869 --- /dev/null +++ b/persistence-modules/hibernate5/src/main/java/com/baeldung/hibernate/persistjson/Customer.java @@ -0,0 +1,80 @@ +package com.baeldung.hibernate.persistjson; + +import java.io.IOException; +import java.util.Map; + +import javax.persistence.Convert; +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.Table; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; + +@Entity +@Table(name = "Customers") +public class Customer { + + @Id + private int id; + + private String firstName; + + private String lastName; + + private String customerAttributeJSON; + + @Convert(converter = HashMapConverter.class) + private Map customerAttributes; + + public int getId() { + return id; + } + + public void setId(int id) { + this.id = id; + } + + public String getFirstName() { + return firstName; + } + + public void setFirstName(String firstName) { + this.firstName = firstName; + } + + public String getLastName() { + return lastName; + } + + public void setLastName(String lastName) { + this.lastName = lastName; + } + + public String getCustomerAttributeJSON() { + return customerAttributeJSON; + } + + public void setCustomerAttributeJSON(String customerAttributeJSON) { + this.customerAttributeJSON = customerAttributeJSON; + } + + public Map getCustomerAttributes() { + return customerAttributes; + } + + public void setCustomerAttributes(Map customerAttributes) { + this.customerAttributes = customerAttributes; + } + + private static final ObjectMapper objectMapper = new ObjectMapper(); + + public void serializeCustomerAttributes() throws JsonProcessingException { + this.customerAttributeJSON = objectMapper.writeValueAsString(customerAttributes); + } + + public void deserializeCustomerAttributes() throws IOException { + this.customerAttributes = objectMapper.readValue(customerAttributeJSON, Map.class); + } + +} diff --git a/persistence-modules/hibernate5/src/main/java/com/baeldung/hibernate/persistjson/HashMapConverter.java b/persistence-modules/hibernate5/src/main/java/com/baeldung/hibernate/persistjson/HashMapConverter.java new file mode 100644 index 0000000000..b1c2d50480 --- /dev/null +++ b/persistence-modules/hibernate5/src/main/java/com/baeldung/hibernate/persistjson/HashMapConverter.java @@ -0,0 +1,47 @@ +package com.baeldung.hibernate.persistjson; + +import java.io.IOException; +import java.util.Map; + +import javax.persistence.AttributeConverter; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import com.baeldung.hibernate.interceptors.CustomInterceptor; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; + +public class HashMapConverter implements AttributeConverter, String> { + + private static final Logger logger = LoggerFactory.getLogger(CustomInterceptor.class); + + private final ObjectMapper objectMapper = new ObjectMapper(); + + @Override + public String convertToDatabaseColumn(Map customerInfo) { + + String customerInfoJson = null; + try { + customerInfoJson = objectMapper.writeValueAsString(customerInfo); + } catch (final JsonProcessingException e) { + logger.error("JSON writing error", e); + } + + return customerInfoJson; + } + + @Override + public Map convertToEntityAttribute(String customerInfoJSON) { + + Map customerInfo = null; + try { + customerInfo = objectMapper.readValue(customerInfoJSON, Map.class); + } catch (final IOException e) { + logger.error("JSON reading error", e); + } + + return customerInfo; + } + +} diff --git a/hibernate5/src/main/java/com/baeldung/hibernate/pessimisticlocking/Address.java b/persistence-modules/hibernate5/src/main/java/com/baeldung/hibernate/pessimisticlocking/Address.java similarity index 100% rename from hibernate5/src/main/java/com/baeldung/hibernate/pessimisticlocking/Address.java rename to persistence-modules/hibernate5/src/main/java/com/baeldung/hibernate/pessimisticlocking/Address.java diff --git a/hibernate5/src/main/java/com/baeldung/hibernate/pessimisticlocking/Customer.java b/persistence-modules/hibernate5/src/main/java/com/baeldung/hibernate/pessimisticlocking/Customer.java similarity index 100% rename from hibernate5/src/main/java/com/baeldung/hibernate/pessimisticlocking/Customer.java rename to persistence-modules/hibernate5/src/main/java/com/baeldung/hibernate/pessimisticlocking/Customer.java diff --git a/hibernate5/src/main/java/com/baeldung/hibernate/pessimisticlocking/Individual.java b/persistence-modules/hibernate5/src/main/java/com/baeldung/hibernate/pessimisticlocking/Individual.java similarity index 100% rename from hibernate5/src/main/java/com/baeldung/hibernate/pessimisticlocking/Individual.java rename to persistence-modules/hibernate5/src/main/java/com/baeldung/hibernate/pessimisticlocking/Individual.java diff --git a/hibernate5/src/main/java/com/baeldung/hibernate/pessimisticlocking/PessimisticLockingCourse.java b/persistence-modules/hibernate5/src/main/java/com/baeldung/hibernate/pessimisticlocking/PessimisticLockingCourse.java similarity index 100% rename from hibernate5/src/main/java/com/baeldung/hibernate/pessimisticlocking/PessimisticLockingCourse.java rename to persistence-modules/hibernate5/src/main/java/com/baeldung/hibernate/pessimisticlocking/PessimisticLockingCourse.java diff --git a/hibernate5/src/main/java/com/baeldung/hibernate/pessimisticlocking/PessimisticLockingEmployee.java b/persistence-modules/hibernate5/src/main/java/com/baeldung/hibernate/pessimisticlocking/PessimisticLockingEmployee.java similarity index 100% rename from hibernate5/src/main/java/com/baeldung/hibernate/pessimisticlocking/PessimisticLockingEmployee.java rename to persistence-modules/hibernate5/src/main/java/com/baeldung/hibernate/pessimisticlocking/PessimisticLockingEmployee.java diff --git a/hibernate5/src/main/java/com/baeldung/hibernate/pessimisticlocking/PessimisticLockingStudent.java b/persistence-modules/hibernate5/src/main/java/com/baeldung/hibernate/pessimisticlocking/PessimisticLockingStudent.java similarity index 100% rename from hibernate5/src/main/java/com/baeldung/hibernate/pessimisticlocking/PessimisticLockingStudent.java rename to persistence-modules/hibernate5/src/main/java/com/baeldung/hibernate/pessimisticlocking/PessimisticLockingStudent.java diff --git a/hibernate5/src/main/java/com/baeldung/hibernate/pojo/Course.java b/persistence-modules/hibernate5/src/main/java/com/baeldung/hibernate/pojo/Course.java similarity index 100% rename from hibernate5/src/main/java/com/baeldung/hibernate/pojo/Course.java rename to persistence-modules/hibernate5/src/main/java/com/baeldung/hibernate/pojo/Course.java diff --git a/hibernate5/src/main/java/com/baeldung/hibernate/pojo/Department.java b/persistence-modules/hibernate5/src/main/java/com/baeldung/hibernate/pojo/Department.java similarity index 100% rename from hibernate5/src/main/java/com/baeldung/hibernate/pojo/Department.java rename to persistence-modules/hibernate5/src/main/java/com/baeldung/hibernate/pojo/Department.java diff --git a/hibernate5/src/main/java/com/baeldung/hibernate/pojo/Employee.java b/persistence-modules/hibernate5/src/main/java/com/baeldung/hibernate/pojo/Employee.java similarity index 100% rename from hibernate5/src/main/java/com/baeldung/hibernate/pojo/Employee.java rename to persistence-modules/hibernate5/src/main/java/com/baeldung/hibernate/pojo/Employee.java diff --git a/hibernate5/src/main/java/com/baeldung/hibernate/pojo/EntityDescription.java b/persistence-modules/hibernate5/src/main/java/com/baeldung/hibernate/pojo/EntityDescription.java similarity index 100% rename from hibernate5/src/main/java/com/baeldung/hibernate/pojo/EntityDescription.java rename to persistence-modules/hibernate5/src/main/java/com/baeldung/hibernate/pojo/EntityDescription.java diff --git a/persistence-modules/hibernate5/src/main/java/com/baeldung/hibernate/pojo/Movie.java b/persistence-modules/hibernate5/src/main/java/com/baeldung/hibernate/pojo/Movie.java new file mode 100644 index 0000000000..5fae7f6a97 --- /dev/null +++ b/persistence-modules/hibernate5/src/main/java/com/baeldung/hibernate/pojo/Movie.java @@ -0,0 +1,52 @@ +package com.baeldung.hibernate.pojo; + +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.Table; + +@Entity +@Table(name = "MOVIE") +public class Movie { + + @Id + private Long id; + + private String movieName; + + private Integer releaseYear; + + private String language; + + public String getMovieName() { + return movieName; + } + + public void setMovieName(String movieName) { + this.movieName = movieName; + } + + public Integer getReleaseYear() { + return releaseYear; + } + + public void setReleaseYear(Integer releaseYear) { + this.releaseYear = releaseYear; + } + + public String getLanguage() { + return language; + } + + public void setLanguage(String language) { + this.language = language; + } + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + +} diff --git a/hibernate5/src/main/java/com/baeldung/hibernate/pojo/OrderEntry.java b/persistence-modules/hibernate5/src/main/java/com/baeldung/hibernate/pojo/OrderEntry.java similarity index 100% rename from hibernate5/src/main/java/com/baeldung/hibernate/pojo/OrderEntry.java rename to persistence-modules/hibernate5/src/main/java/com/baeldung/hibernate/pojo/OrderEntry.java diff --git a/hibernate5/src/main/java/com/baeldung/hibernate/pojo/OrderEntryIdClass.java b/persistence-modules/hibernate5/src/main/java/com/baeldung/hibernate/pojo/OrderEntryIdClass.java similarity index 100% rename from hibernate5/src/main/java/com/baeldung/hibernate/pojo/OrderEntryIdClass.java rename to persistence-modules/hibernate5/src/main/java/com/baeldung/hibernate/pojo/OrderEntryIdClass.java diff --git a/hibernate5/src/main/java/com/baeldung/hibernate/pojo/OrderEntryPK.java b/persistence-modules/hibernate5/src/main/java/com/baeldung/hibernate/pojo/OrderEntryPK.java similarity index 100% rename from hibernate5/src/main/java/com/baeldung/hibernate/pojo/OrderEntryPK.java rename to persistence-modules/hibernate5/src/main/java/com/baeldung/hibernate/pojo/OrderEntryPK.java diff --git a/hibernate5/src/main/java/com/baeldung/hibernate/pojo/Person.java b/persistence-modules/hibernate5/src/main/java/com/baeldung/hibernate/pojo/Person.java similarity index 100% rename from hibernate5/src/main/java/com/baeldung/hibernate/pojo/Person.java rename to persistence-modules/hibernate5/src/main/java/com/baeldung/hibernate/pojo/Person.java diff --git a/hibernate5/src/main/java/com/baeldung/hibernate/pojo/PersonName.java b/persistence-modules/hibernate5/src/main/java/com/baeldung/hibernate/pojo/PersonName.java similarity index 100% rename from hibernate5/src/main/java/com/baeldung/hibernate/pojo/PersonName.java rename to persistence-modules/hibernate5/src/main/java/com/baeldung/hibernate/pojo/PersonName.java diff --git a/hibernate5/src/main/java/com/baeldung/hibernate/pojo/Phone.java b/persistence-modules/hibernate5/src/main/java/com/baeldung/hibernate/pojo/Phone.java similarity index 100% rename from hibernate5/src/main/java/com/baeldung/hibernate/pojo/Phone.java rename to persistence-modules/hibernate5/src/main/java/com/baeldung/hibernate/pojo/Phone.java diff --git a/hibernate5/src/main/java/com/baeldung/hibernate/pojo/PointEntity.java b/persistence-modules/hibernate5/src/main/java/com/baeldung/hibernate/pojo/PointEntity.java similarity index 100% rename from hibernate5/src/main/java/com/baeldung/hibernate/pojo/PointEntity.java rename to persistence-modules/hibernate5/src/main/java/com/baeldung/hibernate/pojo/PointEntity.java diff --git a/hibernate5/src/main/java/com/baeldung/hibernate/pojo/PolygonEntity.java b/persistence-modules/hibernate5/src/main/java/com/baeldung/hibernate/pojo/PolygonEntity.java similarity index 100% rename from hibernate5/src/main/java/com/baeldung/hibernate/pojo/PolygonEntity.java rename to persistence-modules/hibernate5/src/main/java/com/baeldung/hibernate/pojo/PolygonEntity.java diff --git a/hibernate5/src/main/java/com/baeldung/hibernate/pojo/Product.java b/persistence-modules/hibernate5/src/main/java/com/baeldung/hibernate/pojo/Product.java similarity index 100% rename from hibernate5/src/main/java/com/baeldung/hibernate/pojo/Product.java rename to persistence-modules/hibernate5/src/main/java/com/baeldung/hibernate/pojo/Product.java diff --git a/hibernate5/src/main/java/com/baeldung/hibernate/pojo/Result.java b/persistence-modules/hibernate5/src/main/java/com/baeldung/hibernate/pojo/Result.java similarity index 100% rename from hibernate5/src/main/java/com/baeldung/hibernate/pojo/Result.java rename to persistence-modules/hibernate5/src/main/java/com/baeldung/hibernate/pojo/Result.java diff --git a/hibernate5/src/main/java/com/baeldung/hibernate/pojo/Student.java b/persistence-modules/hibernate5/src/main/java/com/baeldung/hibernate/pojo/Student.java similarity index 100% rename from hibernate5/src/main/java/com/baeldung/hibernate/pojo/Student.java rename to persistence-modules/hibernate5/src/main/java/com/baeldung/hibernate/pojo/Student.java diff --git a/hibernate5/src/main/java/com/baeldung/hibernate/pojo/TemporalValues.java b/persistence-modules/hibernate5/src/main/java/com/baeldung/hibernate/pojo/TemporalValues.java similarity index 100% rename from hibernate5/src/main/java/com/baeldung/hibernate/pojo/TemporalValues.java rename to persistence-modules/hibernate5/src/main/java/com/baeldung/hibernate/pojo/TemporalValues.java diff --git a/hibernate5/src/main/java/com/baeldung/hibernate/pojo/User.java b/persistence-modules/hibernate5/src/main/java/com/baeldung/hibernate/pojo/User.java similarity index 100% rename from hibernate5/src/main/java/com/baeldung/hibernate/pojo/User.java rename to persistence-modules/hibernate5/src/main/java/com/baeldung/hibernate/pojo/User.java diff --git a/hibernate5/src/main/java/com/baeldung/hibernate/pojo/UserProfile.java b/persistence-modules/hibernate5/src/main/java/com/baeldung/hibernate/pojo/UserProfile.java similarity index 100% rename from hibernate5/src/main/java/com/baeldung/hibernate/pojo/UserProfile.java rename to persistence-modules/hibernate5/src/main/java/com/baeldung/hibernate/pojo/UserProfile.java diff --git a/hibernate5/src/main/java/com/baeldung/hibernate/pojo/generator/MyGenerator.java b/persistence-modules/hibernate5/src/main/java/com/baeldung/hibernate/pojo/generator/MyGenerator.java similarity index 100% rename from hibernate5/src/main/java/com/baeldung/hibernate/pojo/generator/MyGenerator.java rename to persistence-modules/hibernate5/src/main/java/com/baeldung/hibernate/pojo/generator/MyGenerator.java diff --git a/hibernate5/src/main/java/com/baeldung/hibernate/pojo/inheritance/Animal.java b/persistence-modules/hibernate5/src/main/java/com/baeldung/hibernate/pojo/inheritance/Animal.java similarity index 100% rename from hibernate5/src/main/java/com/baeldung/hibernate/pojo/inheritance/Animal.java rename to persistence-modules/hibernate5/src/main/java/com/baeldung/hibernate/pojo/inheritance/Animal.java diff --git a/hibernate5/src/main/java/com/baeldung/hibernate/pojo/inheritance/Bag.java b/persistence-modules/hibernate5/src/main/java/com/baeldung/hibernate/pojo/inheritance/Bag.java similarity index 100% rename from hibernate5/src/main/java/com/baeldung/hibernate/pojo/inheritance/Bag.java rename to persistence-modules/hibernate5/src/main/java/com/baeldung/hibernate/pojo/inheritance/Bag.java diff --git a/hibernate5/src/main/java/com/baeldung/hibernate/pojo/inheritance/Book.java b/persistence-modules/hibernate5/src/main/java/com/baeldung/hibernate/pojo/inheritance/Book.java similarity index 100% rename from hibernate5/src/main/java/com/baeldung/hibernate/pojo/inheritance/Book.java rename to persistence-modules/hibernate5/src/main/java/com/baeldung/hibernate/pojo/inheritance/Book.java diff --git a/hibernate5/src/main/java/com/baeldung/hibernate/pojo/inheritance/Car.java b/persistence-modules/hibernate5/src/main/java/com/baeldung/hibernate/pojo/inheritance/Car.java similarity index 100% rename from hibernate5/src/main/java/com/baeldung/hibernate/pojo/inheritance/Car.java rename to persistence-modules/hibernate5/src/main/java/com/baeldung/hibernate/pojo/inheritance/Car.java diff --git a/hibernate5/src/main/java/com/baeldung/hibernate/pojo/inheritance/Item.java b/persistence-modules/hibernate5/src/main/java/com/baeldung/hibernate/pojo/inheritance/Item.java similarity index 100% rename from hibernate5/src/main/java/com/baeldung/hibernate/pojo/inheritance/Item.java rename to persistence-modules/hibernate5/src/main/java/com/baeldung/hibernate/pojo/inheritance/Item.java diff --git a/hibernate5/src/main/java/com/baeldung/hibernate/pojo/inheritance/MyEmployee.java b/persistence-modules/hibernate5/src/main/java/com/baeldung/hibernate/pojo/inheritance/MyEmployee.java similarity index 100% rename from hibernate5/src/main/java/com/baeldung/hibernate/pojo/inheritance/MyEmployee.java rename to persistence-modules/hibernate5/src/main/java/com/baeldung/hibernate/pojo/inheritance/MyEmployee.java diff --git a/hibernate5/src/main/java/com/baeldung/hibernate/pojo/inheritance/MyProduct.java b/persistence-modules/hibernate5/src/main/java/com/baeldung/hibernate/pojo/inheritance/MyProduct.java similarity index 100% rename from hibernate5/src/main/java/com/baeldung/hibernate/pojo/inheritance/MyProduct.java rename to persistence-modules/hibernate5/src/main/java/com/baeldung/hibernate/pojo/inheritance/MyProduct.java diff --git a/hibernate5/src/main/java/com/baeldung/hibernate/pojo/inheritance/Pen.java b/persistence-modules/hibernate5/src/main/java/com/baeldung/hibernate/pojo/inheritance/Pen.java similarity index 100% rename from hibernate5/src/main/java/com/baeldung/hibernate/pojo/inheritance/Pen.java rename to persistence-modules/hibernate5/src/main/java/com/baeldung/hibernate/pojo/inheritance/Pen.java diff --git a/hibernate5/src/main/java/com/baeldung/hibernate/pojo/inheritance/Person.java b/persistence-modules/hibernate5/src/main/java/com/baeldung/hibernate/pojo/inheritance/Person.java similarity index 100% rename from hibernate5/src/main/java/com/baeldung/hibernate/pojo/inheritance/Person.java rename to persistence-modules/hibernate5/src/main/java/com/baeldung/hibernate/pojo/inheritance/Person.java diff --git a/hibernate5/src/main/java/com/baeldung/hibernate/pojo/inheritance/Pet.java b/persistence-modules/hibernate5/src/main/java/com/baeldung/hibernate/pojo/inheritance/Pet.java similarity index 100% rename from hibernate5/src/main/java/com/baeldung/hibernate/pojo/inheritance/Pet.java rename to persistence-modules/hibernate5/src/main/java/com/baeldung/hibernate/pojo/inheritance/Pet.java diff --git a/hibernate5/src/main/java/com/baeldung/hibernate/pojo/inheritance/Vehicle.java b/persistence-modules/hibernate5/src/main/java/com/baeldung/hibernate/pojo/inheritance/Vehicle.java similarity index 100% rename from hibernate5/src/main/java/com/baeldung/hibernate/pojo/inheritance/Vehicle.java rename to persistence-modules/hibernate5/src/main/java/com/baeldung/hibernate/pojo/inheritance/Vehicle.java diff --git a/hibernate5/src/main/java/com/baeldung/hibernate/pojo/package-info.java b/persistence-modules/hibernate5/src/main/java/com/baeldung/hibernate/pojo/package-info.java similarity index 100% rename from hibernate5/src/main/java/com/baeldung/hibernate/pojo/package-info.java rename to persistence-modules/hibernate5/src/main/java/com/baeldung/hibernate/pojo/package-info.java diff --git a/hibernate5/src/main/java/com/baeldung/hibernate/proxy/Company.java b/persistence-modules/hibernate5/src/main/java/com/baeldung/hibernate/proxy/Company.java similarity index 100% rename from hibernate5/src/main/java/com/baeldung/hibernate/proxy/Company.java rename to persistence-modules/hibernate5/src/main/java/com/baeldung/hibernate/proxy/Company.java diff --git a/hibernate5/src/main/java/com/baeldung/hibernate/proxy/Employee.java b/persistence-modules/hibernate5/src/main/java/com/baeldung/hibernate/proxy/Employee.java similarity index 100% rename from hibernate5/src/main/java/com/baeldung/hibernate/proxy/Employee.java rename to persistence-modules/hibernate5/src/main/java/com/baeldung/hibernate/proxy/Employee.java diff --git a/hibernate5/src/main/java/com/baeldung/hibernate/proxy/HibernateUtil.java b/persistence-modules/hibernate5/src/main/java/com/baeldung/hibernate/proxy/HibernateUtil.java similarity index 100% rename from hibernate5/src/main/java/com/baeldung/hibernate/proxy/HibernateUtil.java rename to persistence-modules/hibernate5/src/main/java/com/baeldung/hibernate/proxy/HibernateUtil.java diff --git a/persistence-modules/hibernate5/src/main/resources/META-INF/persistence.xml b/persistence-modules/hibernate5/src/main/resources/META-INF/persistence.xml new file mode 100644 index 0000000000..4dfade1af3 --- /dev/null +++ b/persistence-modules/hibernate5/src/main/resources/META-INF/persistence.xml @@ -0,0 +1,19 @@ + + + + Hibernate EntityManager Demo + com.baeldung.hibernate.pojo.Movie + true + + + + + + + + + + \ No newline at end of file diff --git a/persistence-modules/hibernate5/src/main/resources/init_database.sql b/persistence-modules/hibernate5/src/main/resources/init_database.sql new file mode 100644 index 0000000000..b2848aa256 --- /dev/null +++ b/persistence-modules/hibernate5/src/main/resources/init_database.sql @@ -0,0 +1,10 @@ +CREATE ALIAS UPDATE_EMPLOYEE_DESIGNATION AS $$ +import java.sql.CallableStatement; +import java.sql.Connection; +import java.sql.SQLException; +@CODE +void updateEmployeeDesignation(final Connection conn, final String employeeNumber, final String title) throws SQLException { + CallableStatement updateStatement = conn.prepareCall("update deptemployee set title = '" + title + "' where employeeNumber = '" + employeeNumber + "'"); + updateStatement.execute(); +} +$$; \ No newline at end of file diff --git a/ethereumj/src/main/resources/logback.xml b/persistence-modules/hibernate5/src/main/resources/logback.xml similarity index 100% rename from ethereumj/src/main/resources/logback.xml rename to persistence-modules/hibernate5/src/main/resources/logback.xml diff --git a/hibernate5/src/test/java/com/baeldung/hibernate/CustomClassIntegrationTest.java b/persistence-modules/hibernate5/src/test/java/com/baeldung/hibernate/CustomClassIntegrationTest.java similarity index 100% rename from hibernate5/src/test/java/com/baeldung/hibernate/CustomClassIntegrationTest.java rename to persistence-modules/hibernate5/src/test/java/com/baeldung/hibernate/CustomClassIntegrationTest.java diff --git a/hibernate5/src/test/java/com/baeldung/hibernate/DynamicMappingIntegrationTest.java b/persistence-modules/hibernate5/src/test/java/com/baeldung/hibernate/DynamicMappingIntegrationTest.java similarity index 100% rename from hibernate5/src/test/java/com/baeldung/hibernate/DynamicMappingIntegrationTest.java rename to persistence-modules/hibernate5/src/test/java/com/baeldung/hibernate/DynamicMappingIntegrationTest.java diff --git a/hibernate5/src/test/java/com/baeldung/hibernate/HibernateSpatialIntegrationTest.java b/persistence-modules/hibernate5/src/test/java/com/baeldung/hibernate/HibernateSpatialIntegrationTest.java similarity index 100% rename from hibernate5/src/test/java/com/baeldung/hibernate/HibernateSpatialIntegrationTest.java rename to persistence-modules/hibernate5/src/test/java/com/baeldung/hibernate/HibernateSpatialIntegrationTest.java diff --git a/hibernate5/src/test/java/com/baeldung/hibernate/IdentifiersIntegrationTest.java b/persistence-modules/hibernate5/src/test/java/com/baeldung/hibernate/IdentifiersIntegrationTest.java similarity index 100% rename from hibernate5/src/test/java/com/baeldung/hibernate/IdentifiersIntegrationTest.java rename to persistence-modules/hibernate5/src/test/java/com/baeldung/hibernate/IdentifiersIntegrationTest.java diff --git a/hibernate5/src/test/java/com/baeldung/hibernate/InheritanceMappingIntegrationTest.java b/persistence-modules/hibernate5/src/test/java/com/baeldung/hibernate/InheritanceMappingIntegrationTest.java similarity index 100% rename from hibernate5/src/test/java/com/baeldung/hibernate/InheritanceMappingIntegrationTest.java rename to persistence-modules/hibernate5/src/test/java/com/baeldung/hibernate/InheritanceMappingIntegrationTest.java diff --git a/persistence-modules/hibernate5/src/test/java/com/baeldung/hibernate/NamedQueryIntegrationTest.java b/persistence-modules/hibernate5/src/test/java/com/baeldung/hibernate/NamedQueryIntegrationTest.java new file mode 100644 index 0000000000..cb73fe348c --- /dev/null +++ b/persistence-modules/hibernate5/src/test/java/com/baeldung/hibernate/NamedQueryIntegrationTest.java @@ -0,0 +1,98 @@ +package com.baeldung.hibernate; + +import com.baeldung.hibernate.entities.Department; +import com.baeldung.hibernate.entities.DeptEmployee; +import org.hibernate.Session; +import org.hibernate.Transaction; +import org.hibernate.query.NativeQuery; +import org.hibernate.query.Query; +import org.junit.*; + +import java.io.IOException; + +public class NamedQueryIntegrationTest { + private static Session session; + + private Transaction transaction; + + private Long purchaseDeptId; + + @BeforeClass + public static void setUpClass() throws IOException { + session = HibernateUtil.getSessionFactory("hibernate-namedquery.properties").openSession(); + } + + @Before + public void setUp() throws IOException { + transaction = session.beginTransaction(); + session.createNativeQuery("delete from deptemployee").executeUpdate(); + session.createNativeQuery("delete from department").executeUpdate(); + Department salesDepartment = new Department("Sales"); + Department purchaseDepartment = new Department("Purchase"); + DeptEmployee employee1 = new DeptEmployee("John Wayne", "001", salesDepartment); + DeptEmployee employee2 = new DeptEmployee("Sarah Vinton", "002", salesDepartment); + DeptEmployee employee3 = new DeptEmployee("Lisa Carter", "003", salesDepartment); + session.persist(salesDepartment); + session.persist(purchaseDepartment); + purchaseDeptId = purchaseDepartment.getId(); + session.persist(employee1); + session.persist(employee2); + session.persist(employee3); + transaction.commit(); + transaction = session.beginTransaction(); + } + + @After + public void tearDown() { + if(transaction.isActive()) { + transaction.rollback(); + } + } + + @Test + public void whenNamedQueryIsCalledUsingCreateNamedQuery_ThenOk() { + Query query = session.createNamedQuery("DeptEmployee_FindByEmployeeNumber", DeptEmployee.class); + query.setParameter("employeeNo", "001"); + DeptEmployee result = query.getSingleResult(); + Assert.assertNotNull(result); + Assert.assertEquals("John Wayne", result.getName()); + } + + @Test + public void whenNamedNativeQueryIsCalledUsingCreateNamedQuery_ThenOk() { + Query query = session.createNamedQuery("DeptEmployee_FindByEmployeeName", DeptEmployee.class); + query.setParameter("name", "John Wayne"); + DeptEmployee result = query.getSingleResult(); + Assert.assertNotNull(result); + Assert.assertEquals("001", result.getEmployeeNumber()); + } + + @Test + public void whenNamedNativeQueryIsCalledUsingGetNamedNativeQuery_ThenOk() { + @SuppressWarnings("rawtypes") + NativeQuery query = session.getNamedNativeQuery("DeptEmployee_FindByEmployeeName"); + query.setParameter("name", "John Wayne"); + DeptEmployee result = (DeptEmployee) query.getSingleResult(); + Assert.assertNotNull(result); + Assert.assertEquals("001", result.getEmployeeNumber()); + } + + @Test + public void whenUpdateQueryIsCalledWithCreateNamedQuery_ThenOk() { + Query spQuery = session.createNamedQuery("DeptEmployee_UpdateEmployeeDepartment"); + spQuery.setParameter("employeeNo", "001"); + Department newDepartment = session.find(Department.class, purchaseDeptId); + spQuery.setParameter("newDepartment", newDepartment); + spQuery.executeUpdate(); + transaction.commit(); + } + + @Test + public void whenNamedStoredProcedureIsCalledWithCreateNamedQuery_ThenOk() { + Query spQuery = session.createNamedQuery("DeptEmployee_UpdateEmployeeDesignation"); + spQuery.setParameter("employeeNumber", "002"); + spQuery.setParameter("newDesignation", "Supervisor"); + spQuery.executeUpdate(); + transaction.commit(); + } +} diff --git a/hibernate5/src/test/java/com/baeldung/hibernate/TemporalValuesUnitTest.java b/persistence-modules/hibernate5/src/test/java/com/baeldung/hibernate/TemporalValuesUnitTest.java similarity index 100% rename from hibernate5/src/test/java/com/baeldung/hibernate/TemporalValuesUnitTest.java rename to persistence-modules/hibernate5/src/test/java/com/baeldung/hibernate/TemporalValuesUnitTest.java diff --git a/hibernate5/src/test/java/com/baeldung/hibernate/converter/PersonNameConverterUnitTest.java b/persistence-modules/hibernate5/src/test/java/com/baeldung/hibernate/converter/PersonNameConverterUnitTest.java similarity index 100% rename from hibernate5/src/test/java/com/baeldung/hibernate/converter/PersonNameConverterUnitTest.java rename to persistence-modules/hibernate5/src/test/java/com/baeldung/hibernate/converter/PersonNameConverterUnitTest.java diff --git a/persistence-modules/hibernate5/src/test/java/com/baeldung/hibernate/customtypes/HibernateCustomTypesManualTest.java b/persistence-modules/hibernate5/src/test/java/com/baeldung/hibernate/customtypes/HibernateCustomTypesManualTest.java new file mode 100644 index 0000000000..63dc6330be --- /dev/null +++ b/persistence-modules/hibernate5/src/test/java/com/baeldung/hibernate/customtypes/HibernateCustomTypesManualTest.java @@ -0,0 +1,90 @@ +package com.baeldung.hibernate.customtypes; + +import com.baeldung.hibernate.HibernateUtil; +import org.hibernate.SessionFactory; +import org.hibernate.query.Query; +import org.junit.Assert; +import org.junit.Test; + +import java.io.IOException; +import java.time.LocalDate; + +import static org.hibernate.testing.transaction.TransactionUtil.doInHibernate; + +public class HibernateCustomTypesManualTest { + + @Test + public void givenEmployee_whenSavedWithCustomTypes_thenEntityIsSaved() throws IOException { + + final OfficeEmployee e = new OfficeEmployee(); + e.setDateOfJoining(LocalDate.now()); + + PhoneNumber number = new PhoneNumber(1, 222, 8781902); + e.setEmployeeNumber(number); + + Address empAdd = new Address(); + empAdd.setAddressLine1("Street"); + empAdd.setAddressLine2("Area"); + empAdd.setCity("City"); + empAdd.setCountry("Country"); + empAdd.setZipCode(100); + + e.setEmpAddress(empAdd); + + Salary empSalary = new Salary(); + empSalary.setAmount(1000L); + empSalary.setCurrency("USD"); + e.setSalary(empSalary); + + doInHibernate(this::sessionFactory, session -> { + session.save(e); + boolean contains = session.contains(e); + Assert.assertTrue(contains); + }); + + } + + @Test + public void givenEmployee_whenCustomTypeInQuery_thenReturnEntity() throws IOException { + + final OfficeEmployee e = new OfficeEmployee(); + e.setDateOfJoining(LocalDate.now()); + + PhoneNumber number = new PhoneNumber(1, 222, 8781902); + e.setEmployeeNumber(number); + + Address empAdd = new Address(); + empAdd.setAddressLine1("Street"); + empAdd.setAddressLine2("Area"); + empAdd.setCity("City"); + empAdd.setCountry("Country"); + empAdd.setZipCode(100); + e.setEmpAddress(empAdd); + + Salary empSalary = new Salary(); + empSalary.setAmount(1000L); + empSalary.setCurrency("USD"); + e.setSalary(empSalary); + + doInHibernate(this::sessionFactory, session -> { + session.save(e); + + Query query = session.createQuery("FROM OfficeEmployee OE WHERE OE.empAddress.zipcode = :pinCode"); + query.setParameter("pinCode",100); + int size = query.list().size(); + + Assert.assertEquals(1, size); + }); + + } + + private SessionFactory sessionFactory() { + try { + return HibernateUtil.getSessionFactory("hibernate-customtypes.properties"); + } catch (IOException e) { + e.printStackTrace(); + } + + return null; + } +} diff --git a/persistence-modules/hibernate5/src/test/java/com/baeldung/hibernate/findall/FindAllUnitTest.java b/persistence-modules/hibernate5/src/test/java/com/baeldung/hibernate/findall/FindAllUnitTest.java new file mode 100644 index 0000000000..8a1b9e9791 --- /dev/null +++ b/persistence-modules/hibernate5/src/test/java/com/baeldung/hibernate/findall/FindAllUnitTest.java @@ -0,0 +1,63 @@ +package com.baeldung.hibernate.findall; + +import static org.junit.Assert.assertEquals; + +import java.io.IOException; +import java.util.List; + +import org.hibernate.Session; +import org.hibernate.Transaction; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +import com.baeldung.hibernate.HibernateUtil; +import com.baeldung.hibernate.pojo.Student; + +public class FindAllUnitTest { + + private Session session; + private Transaction transaction; + + private FindAll findAll; + + @Before + public void setUp() throws IOException { + + session = HibernateUtil.getSessionFactory().openSession(); + transaction = session.beginTransaction(); + findAll = new FindAll(session); + + session.createNativeQuery("delete from Student").executeUpdate(); + + Student student1 = new Student(); + session.persist(student1); + + Student student2 = new Student(); + session.persist(student2); + + Student student3 = new Student(); + session.persist(student3); + + transaction.commit(); + transaction = session.beginTransaction(); + } + + @After + public void tearDown() { + transaction.rollback(); + session.close(); + } + + @Test + public void givenCriteriaQuery_WhenFindAll_ThenGetAllPersons() { + List list = findAll.findAllWithCriteriaQuery(); + assertEquals(3, list.size()); + } + + @Test + public void givenJpql_WhenFindAll_ThenGetAllPersons() { + List list = findAll.findAllWithJpql(); + assertEquals(3, list.size()); + } +} diff --git a/hibernate5/src/test/java/com/baeldung/hibernate/interceptors/HibernateInterceptorUnitTest.java b/persistence-modules/hibernate5/src/test/java/com/baeldung/hibernate/interceptors/HibernateInterceptorUnitTest.java similarity index 100% rename from hibernate5/src/test/java/com/baeldung/hibernate/interceptors/HibernateInterceptorUnitTest.java rename to persistence-modules/hibernate5/src/test/java/com/baeldung/hibernate/interceptors/HibernateInterceptorUnitTest.java diff --git a/hibernate5/src/test/java/com/baeldung/hibernate/joincolumn/JoinColumnIntegrationTest.java b/persistence-modules/hibernate5/src/test/java/com/baeldung/hibernate/joincolumn/JoinColumnIntegrationTest.java similarity index 100% rename from hibernate5/src/test/java/com/baeldung/hibernate/joincolumn/JoinColumnIntegrationTest.java rename to persistence-modules/hibernate5/src/test/java/com/baeldung/hibernate/joincolumn/JoinColumnIntegrationTest.java diff --git a/persistence-modules/hibernate5/src/test/java/com/baeldung/hibernate/jpacriteriabuilder/EmployeeSearchServiceIntegrationTest.java b/persistence-modules/hibernate5/src/test/java/com/baeldung/hibernate/jpacriteriabuilder/EmployeeSearchServiceIntegrationTest.java new file mode 100644 index 0000000000..2b12734a10 --- /dev/null +++ b/persistence-modules/hibernate5/src/test/java/com/baeldung/hibernate/jpacriteriabuilder/EmployeeSearchServiceIntegrationTest.java @@ -0,0 +1,121 @@ +package com.baeldung.hibernate.jpacriteriabuilder; + +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.collection.IsIterableContainingInAnyOrder.containsInAnyOrder; +import static org.junit.Assert.assertEquals; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; +import java.util.stream.Collectors; + +import javax.persistence.EntityManager; + +import org.hibernate.HibernateException; +import org.hibernate.Session; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +import com.baeldung.hibernate.HibernateUtil; +import com.baeldung.hibernate.entities.Department; +import com.baeldung.hibernate.entities.DeptEmployee; +import com.baeldung.hibernate.jpacriteriabuilder.service.EmployeeSearchService; +import com.baeldung.hibernate.jpacriteriabuilder.service.EmployeeSearchServiceImpl; + +public class EmployeeSearchServiceIntegrationTest { + + private EntityManager entityManager; + private EmployeeSearchService searchService; + private Session session; + + @Before + public final void setup() throws HibernateException, IOException { + session = HibernateUtil.getSessionFactory() + .openSession(); + entityManager = session.getEntityManagerFactory() + .createEntityManager(); + searchService = new EmployeeSearchServiceImpl(entityManager); + + entityManager.getTransaction() + .begin(); + Department department = new Department("Pre Sales"); + DeptEmployee employee = new DeptEmployee("John Smith", "001", "Manager", department); + entityManager.persist(department); + entityManager.persist(employee); + employee = new DeptEmployee("Ian Evans", "002", "Associate", department); + entityManager.persist(department); + entityManager.persist(employee); + department = new Department("Copporate Sales"); + employee = new DeptEmployee("Robert Carter", "003", "Manager", department); + entityManager.persist(department); + entityManager.persist(employee); + employee = new DeptEmployee("John Carter", "004", "Senior Manager", department); + entityManager.persist(employee); + employee = new DeptEmployee("David Guetta", "009", "Associate", department); + entityManager.persist(department); + entityManager.persist(employee); + department = new Department("Post Sales"); + employee = new DeptEmployee("Robert Jonas", "005", "Director", department); + entityManager.persist(department); + entityManager.persist(employee); + employee = new DeptEmployee("John Ferros", "006", "Junior Associate", department); + entityManager.persist(department); + entityManager.persist(employee); + department = new Department("Client Support"); + employee = new DeptEmployee("Robert Mcclements", "007", "Director", department); + entityManager.persist(department); + entityManager.persist(employee); + employee = new DeptEmployee("Peter Parker", "008", "Manager", department); + entityManager.persist(department); + entityManager.persist(employee); + + } + + @After + public final void teardown() { + entityManager.getTransaction() + .rollback(); + entityManager.close(); + } + + @Test + public final void givenCriteriaQuery_whenSearchedUsingCriteriaBuilderWithListofAuthors_thenResultIsFilteredByAuthorNames() { + List titles = new ArrayList() { + { + add("Manager"); + add("Senior Manager"); + add("Director"); + } + }; + List result = searchService.filterbyTitleUsingCriteriaBuilder(titles); + assertEquals("Number of Employees does not match with expected.", 6, result.size()); + assertThat(result.stream() + .map(DeptEmployee::getTitle) + .distinct() + .collect(Collectors.toList()), containsInAnyOrder(titles.toArray())); + } + + @Test + public final void givenCriteriaQuery_whenSearchedUsingExpressionWithListofAuthors_thenResultIsFilteredByAuthorNames() { + List titles = new ArrayList() { + { + add("Manager"); + add("Senior Manager"); + add("Director"); + } + }; + List result = searchService.filterbyTitleUsingExpression(titles); + assertEquals("Number of Employees does not match with expected.", 6, result.size()); + assertThat(result.stream() + .map(DeptEmployee::getTitle) + .distinct() + .collect(Collectors.toList()), containsInAnyOrder(titles.toArray())); + } + + @Test + public final void givenCriteriaQuery_whenSearchedDepartmentLike_thenResultIsFilteredByDepartment() { + List result = searchService.searchByDepartmentQuery("Sales"); + assertEquals("Number of Employees does not match with expected.", 7, result.size()); + } +} diff --git a/hibernate5/src/test/java/com/baeldung/hibernate/lifecycle/HibernateLifecycleUnitTest.java b/persistence-modules/hibernate5/src/test/java/com/baeldung/hibernate/lifecycle/HibernateLifecycleUnitTest.java similarity index 100% rename from hibernate5/src/test/java/com/baeldung/hibernate/lifecycle/HibernateLifecycleUnitTest.java rename to persistence-modules/hibernate5/src/test/java/com/baeldung/hibernate/lifecycle/HibernateLifecycleUnitTest.java diff --git a/hibernate5/src/test/java/com/baeldung/hibernate/lob/LobUnitTest.java b/persistence-modules/hibernate5/src/test/java/com/baeldung/hibernate/lob/LobUnitTest.java similarity index 100% rename from hibernate5/src/test/java/com/baeldung/hibernate/lob/LobUnitTest.java rename to persistence-modules/hibernate5/src/test/java/com/baeldung/hibernate/lob/LobUnitTest.java diff --git a/hibernate5/src/test/java/com/baeldung/hibernate/multitenancy/Car.java b/persistence-modules/hibernate5/src/test/java/com/baeldung/hibernate/multitenancy/Car.java similarity index 100% rename from hibernate5/src/test/java/com/baeldung/hibernate/multitenancy/Car.java rename to persistence-modules/hibernate5/src/test/java/com/baeldung/hibernate/multitenancy/Car.java diff --git a/hibernate5/src/test/java/com/baeldung/hibernate/multitenancy/MultitenancyIntegrationTest.java b/persistence-modules/hibernate5/src/test/java/com/baeldung/hibernate/multitenancy/MultitenancyIntegrationTest.java similarity index 100% rename from hibernate5/src/test/java/com/baeldung/hibernate/multitenancy/MultitenancyIntegrationTest.java rename to persistence-modules/hibernate5/src/test/java/com/baeldung/hibernate/multitenancy/MultitenancyIntegrationTest.java diff --git a/hibernate5/src/test/java/com/baeldung/hibernate/multitenancy/database/DatabaseApproachMultitenancyIntegrationTest.java b/persistence-modules/hibernate5/src/test/java/com/baeldung/hibernate/multitenancy/database/DatabaseApproachMultitenancyIntegrationTest.java similarity index 100% rename from hibernate5/src/test/java/com/baeldung/hibernate/multitenancy/database/DatabaseApproachMultitenancyIntegrationTest.java rename to persistence-modules/hibernate5/src/test/java/com/baeldung/hibernate/multitenancy/database/DatabaseApproachMultitenancyIntegrationTest.java diff --git a/hibernate5/src/test/java/com/baeldung/hibernate/multitenancy/database/MapMultiTenantConnectionProvider.java b/persistence-modules/hibernate5/src/test/java/com/baeldung/hibernate/multitenancy/database/MapMultiTenantConnectionProvider.java similarity index 100% rename from hibernate5/src/test/java/com/baeldung/hibernate/multitenancy/database/MapMultiTenantConnectionProvider.java rename to persistence-modules/hibernate5/src/test/java/com/baeldung/hibernate/multitenancy/database/MapMultiTenantConnectionProvider.java diff --git a/hibernate5/src/test/java/com/baeldung/hibernate/multitenancy/database/TenantIdNames.java b/persistence-modules/hibernate5/src/test/java/com/baeldung/hibernate/multitenancy/database/TenantIdNames.java similarity index 100% rename from hibernate5/src/test/java/com/baeldung/hibernate/multitenancy/database/TenantIdNames.java rename to persistence-modules/hibernate5/src/test/java/com/baeldung/hibernate/multitenancy/database/TenantIdNames.java diff --git a/hibernate5/src/test/java/com/baeldung/hibernate/multitenancy/schema/SchemaApproachMultitenancyIntegrationTest.java b/persistence-modules/hibernate5/src/test/java/com/baeldung/hibernate/multitenancy/schema/SchemaApproachMultitenancyIntegrationTest.java similarity index 100% rename from hibernate5/src/test/java/com/baeldung/hibernate/multitenancy/schema/SchemaApproachMultitenancyIntegrationTest.java rename to persistence-modules/hibernate5/src/test/java/com/baeldung/hibernate/multitenancy/schema/SchemaApproachMultitenancyIntegrationTest.java diff --git a/hibernate5/src/test/java/com/baeldung/hibernate/multitenancy/schema/SchemaMultiTenantConnectionProvider.java b/persistence-modules/hibernate5/src/test/java/com/baeldung/hibernate/multitenancy/schema/SchemaMultiTenantConnectionProvider.java similarity index 100% rename from hibernate5/src/test/java/com/baeldung/hibernate/multitenancy/schema/SchemaMultiTenantConnectionProvider.java rename to persistence-modules/hibernate5/src/test/java/com/baeldung/hibernate/multitenancy/schema/SchemaMultiTenantConnectionProvider.java diff --git a/hibernate5/src/test/java/com/baeldung/hibernate/multitenancy/schema/TenantIdNames.java b/persistence-modules/hibernate5/src/test/java/com/baeldung/hibernate/multitenancy/schema/TenantIdNames.java similarity index 100% rename from hibernate5/src/test/java/com/baeldung/hibernate/multitenancy/schema/TenantIdNames.java rename to persistence-modules/hibernate5/src/test/java/com/baeldung/hibernate/multitenancy/schema/TenantIdNames.java diff --git a/hibernate5/src/test/java/com/baeldung/hibernate/namingstrategy/NamingStrategyLiveTest.java b/persistence-modules/hibernate5/src/test/java/com/baeldung/hibernate/namingstrategy/NamingStrategyLiveTest.java similarity index 100% rename from hibernate5/src/test/java/com/baeldung/hibernate/namingstrategy/NamingStrategyLiveTest.java rename to persistence-modules/hibernate5/src/test/java/com/baeldung/hibernate/namingstrategy/NamingStrategyLiveTest.java diff --git a/persistence-modules/hibernate5/src/test/java/com/baeldung/hibernate/onetoone/HibernateOneToOneAnnotationFKBasedIntegrationTest.java b/persistence-modules/hibernate5/src/test/java/com/baeldung/hibernate/onetoone/HibernateOneToOneAnnotationFKBasedIntegrationTest.java new file mode 100644 index 0000000000..475c93f6ff --- /dev/null +++ b/persistence-modules/hibernate5/src/test/java/com/baeldung/hibernate/onetoone/HibernateOneToOneAnnotationFKBasedIntegrationTest.java @@ -0,0 +1,80 @@ +package com.baeldung.hibernate.onetoone; + +import com.baeldung.hibernate.onetoone.foreignkeybased.Address; +import com.baeldung.hibernate.onetoone.foreignkeybased.User; +import org.hibernate.Session; +import org.hibernate.SessionFactory; +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; + +import java.util.List; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; + +public class HibernateOneToOneAnnotationFKBasedIntegrationTest { + + private static SessionFactory sessionFactory; + + private Session session; + + @BeforeClass + public static void beforeTests() { + sessionFactory = HibernateUtil.getSessionFactory(Strategy.FOREIGN_KEY); + } + + @Before + public void setUp() { + session = sessionFactory.openSession(); + session.beginTransaction(); + } + + @Test + public void givenData_whenInsert_thenCreates1to1relationship() { + User user = new User(); + user.setUserName("alice@baeldung.com"); + + Address address = new Address(); + address.setStreet("FK Street"); + address.setCity("FK City"); + + address.setUser(user); + user.setAddress(address); + + //Address entry will automatically be created by hibernate, since cascade type is specified as ALL + session.persist(user); + session.getTransaction().commit(); + + assert1to1InsertedData(); + } + + private void assert1to1InsertedData() { + @SuppressWarnings("unchecked") + List userList = session.createQuery("FROM User").list(); + + assertNotNull(userList); + assertEquals(1, userList.size()); + + User user = userList.get(0); + assertEquals("alice@baeldung.com", user.getUserName()); + + Address address = user.getAddress(); + assertNotNull(address); + assertEquals("FK Street", address.getStreet()); + assertEquals("FK City", address.getCity()); + + } + + @After + public void tearDown() { + session.close(); + } + + @AfterClass + public static void afterTests() { + sessionFactory.close(); + } +} diff --git a/persistence-modules/hibernate5/src/test/java/com/baeldung/hibernate/onetoone/HibernateOneToOneAnnotationJTBasedIntegrationTest.java b/persistence-modules/hibernate5/src/test/java/com/baeldung/hibernate/onetoone/HibernateOneToOneAnnotationJTBasedIntegrationTest.java new file mode 100644 index 0000000000..df4cd4d137 --- /dev/null +++ b/persistence-modules/hibernate5/src/test/java/com/baeldung/hibernate/onetoone/HibernateOneToOneAnnotationJTBasedIntegrationTest.java @@ -0,0 +1,80 @@ +package com.baeldung.hibernate.onetoone; + +import com.baeldung.hibernate.onetoone.jointablebased.Employee; +import com.baeldung.hibernate.onetoone.jointablebased.WorkStation; +import org.hibernate.Session; +import org.hibernate.SessionFactory; +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; + +import java.util.List; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; + +public class HibernateOneToOneAnnotationJTBasedIntegrationTest { + + private static SessionFactory sessionFactory; + + private Session session; + + @BeforeClass + public static void beforeTests() { + sessionFactory = HibernateUtil.getSessionFactory(Strategy.JOIN_TABLE_BASED); + } + + @Before + public void setUp() { + session = sessionFactory.openSession(); + session.beginTransaction(); + } + + @Test + public void givenData_whenInsert_thenCreates1to1relationship() { + Employee employee = new Employee(); + employee.setName("bob@baeldung.com"); + + WorkStation workStation = new WorkStation(); + workStation.setWorkstationNumber(626); + workStation.setFloor("Sixth Floor"); + + + employee.setWorkStation(workStation); + workStation.setEmployee(employee); + + session.persist(employee); + session.getTransaction().commit(); + + assert1to1InsertedData(); + } + + private void assert1to1InsertedData() { + @SuppressWarnings("unchecked") + List employeeList = session.createQuery("FROM Employee").list(); + assertNotNull(employeeList); + assertEquals(1, employeeList.size()); + + Employee employee = employeeList.get(0); + assertEquals("bob@baeldung.com", employee.getName()); + + WorkStation workStation = employee.getWorkStation(); + + assertNotNull(workStation); + assertEquals((long) 626, (long) workStation.getWorkstationNumber()); + assertEquals("Sixth Floor", workStation.getFloor()); + + } + + @After + public void tearDown() { + session.close(); + } + + @AfterClass + public static void afterTests() { + sessionFactory.close(); + } +} diff --git a/persistence-modules/hibernate5/src/test/java/com/baeldung/hibernate/onetoone/HibernateOneToOneAnnotationSPKBasedIntegrationTest.java b/persistence-modules/hibernate5/src/test/java/com/baeldung/hibernate/onetoone/HibernateOneToOneAnnotationSPKBasedIntegrationTest.java new file mode 100644 index 0000000000..7931a8e3fe --- /dev/null +++ b/persistence-modules/hibernate5/src/test/java/com/baeldung/hibernate/onetoone/HibernateOneToOneAnnotationSPKBasedIntegrationTest.java @@ -0,0 +1,79 @@ +package com.baeldung.hibernate.onetoone; + +import com.baeldung.hibernate.onetoone.sharedkeybased.Address; +import com.baeldung.hibernate.onetoone.sharedkeybased.User; +import org.hibernate.Session; +import org.hibernate.SessionFactory; +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; + +import java.util.List; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; + +public class HibernateOneToOneAnnotationSPKBasedIntegrationTest { + + private static SessionFactory sessionFactory; + + private Session session; + + @BeforeClass + public static void beforeTests() { + sessionFactory = HibernateUtil.getSessionFactory(Strategy.SHARED_PRIMARY_KEY); + } + + @Before + public void setUp() { + session = sessionFactory.openSession(); + session.beginTransaction(); + } + + @Test + public void givenData_whenInsert_thenCreates1to1relationship() { + User user = new User(); + user.setUserName("alice@baeldung.com"); + + Address address = new Address(); + address.setStreet("SPK Street"); + address.setCity("SPK City"); + + address.setUser(user); + user.setAddress(address); + + //Address entry will automatically be created by hibernate, since cascade type is specified as ALL + session.persist(user); + session.getTransaction().commit(); + + assert1to1InsertedData(); + } + + + private void assert1to1InsertedData() { + @SuppressWarnings("unchecked") + List userList = session.createQuery("FROM User").list(); + assertNotNull(userList); + assertEquals(1, userList.size()); + + User user = userList.get(0); + assertEquals("alice@baeldung.com", user.getUserName()); + + Address address = user.getAddress(); + assertNotNull(address); + assertEquals("SPK Street", address.getStreet()); + assertEquals("SPK City", address.getCity()); + } + + @After + public void tearDown() { + session.close(); + } + + @AfterClass + public static void afterTests() { + sessionFactory.close(); + } +} diff --git a/hibernate5/src/test/java/com/baeldung/hibernate/optimisticlocking/OptimisticLockingIntegrationTest.java b/persistence-modules/hibernate5/src/test/java/com/baeldung/hibernate/optimisticlocking/OptimisticLockingIntegrationTest.java similarity index 100% rename from hibernate5/src/test/java/com/baeldung/hibernate/optimisticlocking/OptimisticLockingIntegrationTest.java rename to persistence-modules/hibernate5/src/test/java/com/baeldung/hibernate/optimisticlocking/OptimisticLockingIntegrationTest.java diff --git a/persistence-modules/hibernate5/src/test/java/com/baeldung/hibernate/persistjson/PersistJSONUnitTest.java b/persistence-modules/hibernate5/src/test/java/com/baeldung/hibernate/persistjson/PersistJSONUnitTest.java new file mode 100644 index 0000000000..ecbb073e89 --- /dev/null +++ b/persistence-modules/hibernate5/src/test/java/com/baeldung/hibernate/persistjson/PersistJSONUnitTest.java @@ -0,0 +1,111 @@ +package com.baeldung.hibernate.persistjson; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.fail; + +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; +import java.util.Properties; + +import org.hibernate.HibernateException; +import org.hibernate.Session; +import org.hibernate.SessionFactory; +import org.hibernate.boot.MetadataSources; +import org.hibernate.boot.registry.StandardServiceRegistryBuilder; +import org.hibernate.cfg.Configuration; +import org.hibernate.service.ServiceRegistry; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +public class PersistJSONUnitTest { + + private Session session; + + @Before + public void init() { + try { + Configuration configuration = new Configuration(); + + Properties properties = new Properties(); + properties.load(Thread.currentThread() + .getContextClassLoader() + .getResourceAsStream("hibernate-persistjson.properties")); + + configuration.setProperties(properties); + + ServiceRegistry serviceRegistry = new StandardServiceRegistryBuilder().applySettings(configuration.getProperties()) + .build(); + MetadataSources metadataSources = new MetadataSources(serviceRegistry); + metadataSources.addAnnotatedClass(Customer.class); + + SessionFactory factory = metadataSources.buildMetadata() + .buildSessionFactory(); + + session = factory.openSession(); + } catch (HibernateException | IOException e) { + fail("Failed to initiate Hibernate Session [Exception:" + e.toString() + "]"); + } + } + + @After + public void close() { + if (session != null) + session.close(); + } + + @Test + public void givenCustomer_whenCallingSerializeCustomerAttributes_thenAttributesAreConverted() throws IOException { + + Customer customer = new Customer(); + customer.setFirstName("first name"); + customer.setLastName("last name"); + + Map attributes = new HashMap<>(); + attributes.put("address", "123 Main Street"); + attributes.put("zipcode", 12345); + + customer.setCustomerAttributes(attributes); + + customer.serializeCustomerAttributes(); + + String serialized = customer.getCustomerAttributeJSON(); + + customer.setCustomerAttributeJSON(serialized); + customer.deserializeCustomerAttributes(); + + Map deserialized = customer.getCustomerAttributes(); + + assertEquals("123 Main Street", deserialized.get("address")); + } + + @Test + public void givenCustomer_whenSaving_thenAttributesAreConverted() { + + Customer customer = new Customer(); + customer.setFirstName("first name"); + customer.setLastName("last name"); + + Map attributes = new HashMap<>(); + attributes.put("address", "123 Main Street"); + attributes.put("zipcode", 12345); + + customer.setCustomerAttributes(attributes); + + session.beginTransaction(); + + int id = (int) session.save(customer); + + session.flush(); + session.clear(); + + Customer result = session.createNativeQuery("select * from Customers where Customers.id = :id", Customer.class) + .setParameter("id", id) + .getSingleResult(); + + assertEquals(2, result.getCustomerAttributes() + .size()); + } + +} diff --git a/hibernate5/src/test/java/com/baeldung/hibernate/pessimisticlocking/BasicPessimisticLockingIntegrationTest.java b/persistence-modules/hibernate5/src/test/java/com/baeldung/hibernate/pessimisticlocking/BasicPessimisticLockingIntegrationTest.java similarity index 100% rename from hibernate5/src/test/java/com/baeldung/hibernate/pessimisticlocking/BasicPessimisticLockingIntegrationTest.java rename to persistence-modules/hibernate5/src/test/java/com/baeldung/hibernate/pessimisticlocking/BasicPessimisticLockingIntegrationTest.java diff --git a/hibernate5/src/test/java/com/baeldung/hibernate/pessimisticlocking/PessimisticLockScopesIntegrationTest.java b/persistence-modules/hibernate5/src/test/java/com/baeldung/hibernate/pessimisticlocking/PessimisticLockScopesIntegrationTest.java similarity index 100% rename from hibernate5/src/test/java/com/baeldung/hibernate/pessimisticlocking/PessimisticLockScopesIntegrationTest.java rename to persistence-modules/hibernate5/src/test/java/com/baeldung/hibernate/pessimisticlocking/PessimisticLockScopesIntegrationTest.java diff --git a/hibernate5/src/test/java/com/baeldung/hibernate/proxy/HibernateProxyUnitTest.java b/persistence-modules/hibernate5/src/test/java/com/baeldung/hibernate/proxy/HibernateProxyUnitTest.java similarity index 100% rename from hibernate5/src/test/java/com/baeldung/hibernate/proxy/HibernateProxyUnitTest.java rename to persistence-modules/hibernate5/src/test/java/com/baeldung/hibernate/proxy/HibernateProxyUnitTest.java diff --git a/persistence-modules/hibernate5/src/test/resources/hibernate-customtypes.properties b/persistence-modules/hibernate5/src/test/resources/hibernate-customtypes.properties new file mode 100644 index 0000000000..345f3d37b0 --- /dev/null +++ b/persistence-modules/hibernate5/src/test/resources/hibernate-customtypes.properties @@ -0,0 +1,10 @@ +hibernate.connection.driver_class=org.postgresql.Driver +hibernate.connection.url=jdbc:postgresql://localhost:5432/test +hibernate.connection.username=postgres +hibernate.connection.password=thule +hibernate.connection.autocommit=true +jdbc.password=thule + +hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect +hibernate.show_sql=true +hibernate.hbm2ddl.auto=create-drop \ No newline at end of file diff --git a/hibernate5/src/test/resources/hibernate-database-multitenancy.properties b/persistence-modules/hibernate5/src/test/resources/hibernate-database-multitenancy.properties similarity index 100% rename from hibernate5/src/test/resources/hibernate-database-multitenancy.properties rename to persistence-modules/hibernate5/src/test/resources/hibernate-database-multitenancy.properties diff --git a/hibernate5/src/test/resources/hibernate-database-mydb1.properties b/persistence-modules/hibernate5/src/test/resources/hibernate-database-mydb1.properties similarity index 100% rename from hibernate5/src/test/resources/hibernate-database-mydb1.properties rename to persistence-modules/hibernate5/src/test/resources/hibernate-database-mydb1.properties diff --git a/hibernate5/src/test/resources/hibernate-database-mydb2.properties b/persistence-modules/hibernate5/src/test/resources/hibernate-database-mydb2.properties similarity index 100% rename from hibernate5/src/test/resources/hibernate-database-mydb2.properties rename to persistence-modules/hibernate5/src/test/resources/hibernate-database-mydb2.properties diff --git a/hibernate5/src/test/resources/hibernate-interceptors.properties b/persistence-modules/hibernate5/src/test/resources/hibernate-interceptors.properties similarity index 100% rename from hibernate5/src/test/resources/hibernate-interceptors.properties rename to persistence-modules/hibernate5/src/test/resources/hibernate-interceptors.properties diff --git a/hibernate5/src/test/resources/hibernate-lifecycle.properties b/persistence-modules/hibernate5/src/test/resources/hibernate-lifecycle.properties similarity index 100% rename from hibernate5/src/test/resources/hibernate-lifecycle.properties rename to persistence-modules/hibernate5/src/test/resources/hibernate-lifecycle.properties diff --git a/persistence-modules/hibernate5/src/test/resources/hibernate-namedquery.properties b/persistence-modules/hibernate5/src/test/resources/hibernate-namedquery.properties new file mode 100644 index 0000000000..457f965347 --- /dev/null +++ b/persistence-modules/hibernate5/src/test/resources/hibernate-namedquery.properties @@ -0,0 +1,9 @@ +hibernate.connection.driver_class=org.h2.Driver +hibernate.connection.url=jdbc:h2:mem:mydb1;DB_CLOSE_DELAY=-1;INIT=RUNSCRIPT FROM 'src/main/resources/init_database.sql' +hibernate.connection.username=sa +hibernate.connection.autocommit=true +jdbc.password= + +hibernate.dialect=org.hibernate.dialect.H2Dialect +hibernate.show_sql=true +hibernate.hbm2ddl.auto=create-drop \ No newline at end of file diff --git a/hibernate5/src/test/resources/hibernate-namingstrategy.properties b/persistence-modules/hibernate5/src/test/resources/hibernate-namingstrategy.properties similarity index 100% rename from hibernate5/src/test/resources/hibernate-namingstrategy.properties rename to persistence-modules/hibernate5/src/test/resources/hibernate-namingstrategy.properties diff --git a/persistence-modules/hibernate5/src/test/resources/hibernate-persistjson.properties b/persistence-modules/hibernate5/src/test/resources/hibernate-persistjson.properties new file mode 100644 index 0000000000..2cf8ac5b63 --- /dev/null +++ b/persistence-modules/hibernate5/src/test/resources/hibernate-persistjson.properties @@ -0,0 +1,7 @@ +hibernate.connection.driver_class=org.h2.Driver +hibernate.connection.url=jdbc:h2:mem:mydb1;DB_CLOSE_DELAY=-1 +hibernate.connection.username=sa +hibernate.dialect=org.hibernate.dialect.H2Dialect + +hibernate.show_sql=true +hibernate.hbm2ddl.auto=create-drop \ No newline at end of file diff --git a/hibernate5/src/test/resources/hibernate-pessimistic-locking.properties b/persistence-modules/hibernate5/src/test/resources/hibernate-pessimistic-locking.properties similarity index 100% rename from hibernate5/src/test/resources/hibernate-pessimistic-locking.properties rename to persistence-modules/hibernate5/src/test/resources/hibernate-pessimistic-locking.properties diff --git a/hibernate5/src/test/resources/hibernate-schema-multitenancy.properties b/persistence-modules/hibernate5/src/test/resources/hibernate-schema-multitenancy.properties similarity index 100% rename from hibernate5/src/test/resources/hibernate-schema-multitenancy.properties rename to persistence-modules/hibernate5/src/test/resources/hibernate-schema-multitenancy.properties diff --git a/hibernate5/src/test/resources/hibernate-spatial.properties b/persistence-modules/hibernate5/src/test/resources/hibernate-spatial.properties similarity index 100% rename from hibernate5/src/test/resources/hibernate-spatial.properties rename to persistence-modules/hibernate5/src/test/resources/hibernate-spatial.properties diff --git a/hibernate5/src/test/resources/hibernate.properties b/persistence-modules/hibernate5/src/test/resources/hibernate.properties similarity index 100% rename from hibernate5/src/test/resources/hibernate.properties rename to persistence-modules/hibernate5/src/test/resources/hibernate.properties diff --git a/hibernate5/src/test/resources/lifecycle-init.sql b/persistence-modules/hibernate5/src/test/resources/lifecycle-init.sql similarity index 100% rename from hibernate5/src/test/resources/lifecycle-init.sql rename to persistence-modules/hibernate5/src/test/resources/lifecycle-init.sql diff --git a/hibernate5/src/test/resources/profile.png b/persistence-modules/hibernate5/src/test/resources/profile.png similarity index 100% rename from hibernate5/src/test/resources/profile.png rename to persistence-modules/hibernate5/src/test/resources/profile.png diff --git a/persistence-modules/hibernate5/transaction.log b/persistence-modules/hibernate5/transaction.log new file mode 100644 index 0000000000..e69de29bb2 diff --git a/influxdb/README.md b/persistence-modules/influxdb/README.md similarity index 100% rename from influxdb/README.md rename to persistence-modules/influxdb/README.md diff --git a/influxdb/pom.xml b/persistence-modules/influxdb/pom.xml similarity index 96% rename from influxdb/pom.xml rename to persistence-modules/influxdb/pom.xml index 5bb94bb6e2..5043d61897 100644 --- a/influxdb/pom.xml +++ b/persistence-modules/influxdb/pom.xml @@ -12,6 +12,7 @@ com.baeldung parent-modules 1.0.0-SNAPSHOT + ../../ diff --git a/influxdb/src/main/java/com/baeldung/influxdb/MemoryPoint.java b/persistence-modules/influxdb/src/main/java/com/baeldung/influxdb/MemoryPoint.java similarity index 100% rename from influxdb/src/main/java/com/baeldung/influxdb/MemoryPoint.java rename to persistence-modules/influxdb/src/main/java/com/baeldung/influxdb/MemoryPoint.java diff --git a/hbase/src/main/resources/logback.xml b/persistence-modules/influxdb/src/main/resources/logback.xml similarity index 100% rename from hbase/src/main/resources/logback.xml rename to persistence-modules/influxdb/src/main/resources/logback.xml diff --git a/influxdb/src/test/java/com/baeldung/influxdb/InfluxDBConnectionLiveTest.java b/persistence-modules/influxdb/src/test/java/com/baeldung/influxdb/InfluxDBConnectionLiveTest.java similarity index 100% rename from influxdb/src/test/java/com/baeldung/influxdb/InfluxDBConnectionLiveTest.java rename to persistence-modules/influxdb/src/test/java/com/baeldung/influxdb/InfluxDBConnectionLiveTest.java diff --git a/hibernate5/src/main/resources/logback.xml b/persistence-modules/influxdb/src/test/resources/logback.xml similarity index 100% rename from hibernate5/src/main/resources/logback.xml rename to persistence-modules/influxdb/src/test/resources/logback.xml diff --git a/persistence-modules/java-cassandra/pom.xml b/persistence-modules/java-cassandra/pom.xml index 36ec6b5ac8..aac5d49547 100644 --- a/persistence-modules/java-cassandra/pom.xml +++ b/persistence-modules/java-cassandra/pom.xml @@ -4,6 +4,7 @@ com.baeldung java-cassandra 1.0.0-SNAPSHOT + java-cassandra com.baeldung diff --git a/persistence-modules/java-cockroachdb/pom.xml b/persistence-modules/java-cockroachdb/pom.xml index 870707c750..2a92934a6e 100644 --- a/persistence-modules/java-cockroachdb/pom.xml +++ b/persistence-modules/java-cockroachdb/pom.xml @@ -5,6 +5,7 @@ com.baeldung java-cockroachdb 1.0-SNAPSHOT + java-cockroachdb parent-modules diff --git a/persistence-modules/java-jdbi/pom.xml b/persistence-modules/java-jdbi/pom.xml index 885906fcd0..9281f4fd9d 100644 --- a/persistence-modules/java-jdbi/pom.xml +++ b/persistence-modules/java-jdbi/pom.xml @@ -4,6 +4,7 @@ 4.0.0 java-jdbi 1.0-SNAPSHOT + java-jdbi parent-modules diff --git a/persistence-modules/java-jpa/README.md b/persistence-modules/java-jpa/README.md index 418e0a67e2..9a90216519 100644 --- a/persistence-modules/java-jpa/README.md +++ b/persistence-modules/java-jpa/README.md @@ -1,4 +1,5 @@ # Relevant Articles - [A Guide to SqlResultSetMapping](http://www.baeldung.com/jpa-sql-resultset-mapping) -- [A Guide to Stored Procedures with JPA](http://www.baeldung.com/jpa-stored-procedures) \ No newline at end of file +- [A Guide to Stored Procedures with JPA](http://www.baeldung.com/jpa-stored-procedures) +- [Fixing the JPA error “java.lang.String cannot be cast to [Ljava.lang.String;”](https://www.baeldung.com/jpa-error-java-lang-string-cannot-be-cast) diff --git a/persistence-modules/java-jpa/pom.xml b/persistence-modules/java-jpa/pom.xml index 78764f7148..ddab51a2e2 100644 --- a/persistence-modules/java-jpa/pom.xml +++ b/persistence-modules/java-jpa/pom.xml @@ -2,15 +2,16 @@ + 4.0.0 + java-jpa + java-jpa + parent-modules com.baeldung 1.0.0-SNAPSHOT ../../pom.xml - 4.0.0 - - java-jpa diff --git a/persistence-modules/java-jpa/src/main/java/com/baeldung/jpa/entitygraph/MainApp.java b/persistence-modules/java-jpa/src/main/java/com/baeldung/jpa/entitygraph/MainApp.java new file mode 100644 index 0000000000..88aa4389e9 --- /dev/null +++ b/persistence-modules/java-jpa/src/main/java/com/baeldung/jpa/entitygraph/MainApp.java @@ -0,0 +1,26 @@ +package com.baeldung.jpa.entitygraph; + +import com.baeldung.jpa.entitygraph.model.Post; +import com.baeldung.jpa.entitygraph.repo.PostRepository; + +public class MainApp { + + public static void main(String... args) { + Long postId = 1L; + Post post = null; + PostRepository postRepository = new PostRepository(); + + //Using EntityManager.find(). + post = postRepository.find(postId); + post = postRepository.findWithEntityGraph(postId); + post = postRepository.findWithEntityGraph2(postId); + + //Using JPQL: Query and TypedQuery + post = postRepository.findUsingJpql(postId); + + //Using Criteria API + post = postRepository.findUsingCriteria(postId); + + postRepository.clean(); + } +} \ No newline at end of file diff --git a/persistence-modules/java-jpa/src/main/java/com/baeldung/jpa/entitygraph/model/Comment.java b/persistence-modules/java-jpa/src/main/java/com/baeldung/jpa/entitygraph/model/Comment.java new file mode 100644 index 0000000000..40ecd3262b --- /dev/null +++ b/persistence-modules/java-jpa/src/main/java/com/baeldung/jpa/entitygraph/model/Comment.java @@ -0,0 +1,63 @@ +package com.baeldung.jpa.entitygraph.model; + +import javax.persistence.*; + +@Entity +public class Comment { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + private Long id; + + private String reply; + + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumn + private Post post; + + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumn + private User user; + //... + + public Comment() { + } + + public Comment(String reply, Post post, User user) { + this.reply = reply; + this.post = post; + this.user = user; + } + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getReply() { + return reply; + } + + public void setReply(String reply) { + this.reply = reply; + } + + public Post getPost() { + return post; + } + + public void setPost(Post post) { + this.post = post; + } + + public User getUser() { + return user; + } + + public void setUser(User user) { + this.user = user; + } +} \ No newline at end of file diff --git a/persistence-modules/java-jpa/src/main/java/com/baeldung/jpa/entitygraph/model/Post.java b/persistence-modules/java-jpa/src/main/java/com/baeldung/jpa/entitygraph/model/Post.java new file mode 100644 index 0000000000..59f17ae0c5 --- /dev/null +++ b/persistence-modules/java-jpa/src/main/java/com/baeldung/jpa/entitygraph/model/Post.java @@ -0,0 +1,86 @@ +package com.baeldung.jpa.entitygraph.model; + +import javax.persistence.*; +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; + +@NamedEntityGraph( + name = "post-entity-graph", + attributeNodes = { + @NamedAttributeNode("subject"), + @NamedAttributeNode("user"), + @NamedAttributeNode("comments"), + } +) +@NamedEntityGraph( + name = "post-entity-graph-with-comment-users", + attributeNodes = { + @NamedAttributeNode("subject"), + @NamedAttributeNode("user"), + @NamedAttributeNode(value = "comments", subgraph = "comments-subgraph"), + }, + subgraphs = { + @NamedSubgraph( + name = "comments-subgraph", + attributeNodes = { + @NamedAttributeNode("user") + } + ) + } +) +@Entity +public class Post { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + private Long id; + private String subject; + @OneToMany(mappedBy = "post") + private List comments = new ArrayList<>(); + + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumn + private User user; + //... + + public Post() { + } + + public Post(String subject, User user) { + this.subject = subject; + this.user = user; + } + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getSubject() { + return subject; + } + + public void setSubject(String subject) { + this.subject = subject; + } + + public List getComments() { + return comments; + } + + public void setComments(List comments) { + this.comments = comments; + } + + public User getUser() { + return user; + } + + public void setUser(User user) { + this.user = user; + } +} diff --git a/persistence-modules/java-jpa/src/main/java/com/baeldung/jpa/entitygraph/model/User.java b/persistence-modules/java-jpa/src/main/java/com/baeldung/jpa/entitygraph/model/User.java new file mode 100644 index 0000000000..b712100d4e --- /dev/null +++ b/persistence-modules/java-jpa/src/main/java/com/baeldung/jpa/entitygraph/model/User.java @@ -0,0 +1,48 @@ +package com.baeldung.jpa.entitygraph.model; + +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; + +@Entity +public class User { + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + private Long id; + private String name; + private String email; + + //... + + public User() { + } + + public User(String email) { + this.email = email; + } + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getEmail() { + return email; + } + + public void setEmail(String email) { + this.email = email; + } +} diff --git a/persistence-modules/java-jpa/src/main/java/com/baeldung/jpa/entitygraph/repo/PostRepository.java b/persistence-modules/java-jpa/src/main/java/com/baeldung/jpa/entitygraph/repo/PostRepository.java new file mode 100644 index 0000000000..28f1e1b93c --- /dev/null +++ b/persistence-modules/java-jpa/src/main/java/com/baeldung/jpa/entitygraph/repo/PostRepository.java @@ -0,0 +1,93 @@ +package com.baeldung.jpa.entitygraph.repo; + +import com.baeldung.jpa.entitygraph.model.Post; + +import javax.persistence.*; +import javax.persistence.criteria.CriteriaBuilder; +import javax.persistence.criteria.CriteriaQuery; +import javax.persistence.criteria.Root; +import java.util.HashMap; +import java.util.Map; + +public class PostRepository { + private EntityManagerFactory emf = null; + + + public PostRepository() { + Map properties = new HashMap(); + properties.put("hibernate.show_sql", "true"); + properties.put("hibernate.format_sql", "true"); + emf = Persistence.createEntityManagerFactory("entity-graph-pu", properties); + } + + public Post find(Long id) { + EntityManager entityManager = emf.createEntityManager(); + + Post post = entityManager.find(Post.class, id); + + entityManager.close(); + return post; + } + + public Post findWithEntityGraph(Long id) { + EntityManager entityManager = emf.createEntityManager(); + + EntityGraph entityGraph = entityManager.getEntityGraph("post-entity-graph"); + Map properties = new HashMap<>(); + properties.put("javax.persistence.fetchgraph", entityGraph); + Post post = entityManager.find(Post.class, id, properties); + + entityManager.close(); + return post; + } + + public Post findWithEntityGraph2(Long id) { + EntityManager entityManager = emf.createEntityManager(); + + EntityGraph entityGraph = entityManager.createEntityGraph(Post.class); + entityGraph.addAttributeNodes("subject"); + entityGraph.addAttributeNodes("user"); + entityGraph.addSubgraph("comments") + .addAttributeNodes("user"); + + Map properties = new HashMap<>(); + properties.put("javax.persistence.fetchgraph", entityGraph); + Post post = entityManager.find(Post.class, id, properties); + + entityManager.close(); + return post; + } + + public Post findUsingJpql(Long id) { + EntityManager entityManager = emf.createEntityManager(); + + EntityGraph entityGraph = entityManager.getEntityGraph("post-entity-graph-with-comment-users"); + Post post = entityManager.createQuery("Select p from Post p where p.id=:id", Post.class) + .setParameter("id", id) + .setHint("javax.persistence.fetchgraph", entityGraph) + .getSingleResult(); + + entityManager.close(); + return post; + } + + public Post findUsingCriteria(Long id) { + EntityManager entityManager = emf.createEntityManager(); + + EntityGraph entityGraph = entityManager.getEntityGraph("post-entity-graph-with-comment-users"); + CriteriaBuilder criteriaBuilder = entityManager.getCriteriaBuilder(); + CriteriaQuery criteriaQuery = criteriaBuilder.createQuery(Post.class); + Root root = criteriaQuery.from(Post.class); + criteriaQuery.where(criteriaBuilder.equal(root.get("id"), id)); + TypedQuery typedQuery = entityManager.createQuery(criteriaQuery); + typedQuery.setHint("javax.persistence.loadgraph", entityGraph); + Post post = typedQuery.getSingleResult(); + + entityManager.close(); + return post; + } + + public void clean() { + emf.close(); + } +} diff --git a/persistence-modules/java-jpa/src/main/java/com/baeldung/jpa/stringcast/Message.java b/persistence-modules/java-jpa/src/main/java/com/baeldung/jpa/stringcast/Message.java new file mode 100644 index 0000000000..fb521cfea6 --- /dev/null +++ b/persistence-modules/java-jpa/src/main/java/com/baeldung/jpa/stringcast/Message.java @@ -0,0 +1,43 @@ +package com.baeldung.jpa.stringcast; + +import javax.persistence.*; + +@SqlResultSetMapping(name = "textQueryMapping", classes = { + @ConstructorResult(targetClass = Message.class, columns = { + @ColumnResult(name = "text") + }) +}) +@Entity +public class Message { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + private Long id; + + private String text; + + public Message() { + + } + + public Message(String text) { + this.text = text; + } + + public String getText() { + return text; + } + + public void setText(String text) { + this.text = text; + } + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + +} diff --git a/persistence-modules/java-jpa/src/main/java/com/baeldung/jpa/stringcast/QueryExecutor.java b/persistence-modules/java-jpa/src/main/java/com/baeldung/jpa/stringcast/QueryExecutor.java new file mode 100644 index 0000000000..6f1e2ee5ca --- /dev/null +++ b/persistence-modules/java-jpa/src/main/java/com/baeldung/jpa/stringcast/QueryExecutor.java @@ -0,0 +1,41 @@ +package com.baeldung.jpa.stringcast; + +import com.sun.istack.internal.Nullable; + +import javax.persistence.EntityManager; +import javax.persistence.Query; +import java.util.ArrayList; +import java.util.List; +import java.util.stream.Collectors; + +public class QueryExecutor { + + public static List executeNativeQueryNoCastCheck(String statement, EntityManager em) { + Query query = em.createNativeQuery(statement); + return query.getResultList(); + } + + public static List executeNativeQueryWithCastCheck(String statement, EntityManager em) { + Query query = em.createNativeQuery(statement); + List results = query.getResultList(); + + if (results.isEmpty()) { + return new ArrayList<>(); + } + + if (results.get(0) instanceof String) { + return ((List) results) + .stream() + .map(s -> new String[] { s }) + .collect(Collectors.toList()); + } else { + return (List) results; + } + } + + public static List executeNativeQueryGeneric(String statement, String mapping, EntityManager em) { + Query query = em.createNativeQuery(statement, mapping); + return query.getResultList(); + } + +} diff --git a/persistence-modules/java-jpa/src/main/resources/META-INF/persistence.xml b/persistence-modules/java-jpa/src/main/resources/META-INF/persistence.xml index 3d881673b2..433d456cc9 100644 --- a/persistence-modules/java-jpa/src/main/resources/META-INF/persistence.xml +++ b/persistence-modules/java-jpa/src/main/resources/META-INF/persistence.xml @@ -9,29 +9,61 @@ org.hibernate.jpa.HibernatePersistenceProvider com.baeldung.sqlresultsetmapping.ScheduledDay - + - - - + value="jdbc:h2:mem:test;INIT=RUNSCRIPT FROM 'classpath:database.sql'"/> + + + - + + + org.hibernate.jpa.HibernatePersistenceProvider + com.baeldung.jpa.stringcast.Message + + + + + + + + + + + + org.hibernate.jpa.HibernatePersistenceProvider com.baeldung.jpa.model.Car - - - - - - + + + + + + - + + + com.baeldung.jpa.entitygraph.model.Post + com.baeldung.jpa.entitygraph.model.User + com.baeldung.jpa.entitygraph.model.Comment + true + + + + + + + + + + + \ No newline at end of file diff --git a/persistence-modules/java-jpa/src/main/resources/data-init.sql b/persistence-modules/java-jpa/src/main/resources/data-init.sql new file mode 100644 index 0000000000..86c3f2a651 --- /dev/null +++ b/persistence-modules/java-jpa/src/main/resources/data-init.sql @@ -0,0 +1,8 @@ +INSERT INTO `USER` (`ID`,`NAME`,`EMAIL`) VALUES (1,'user1','user1@test.com'); +INSERT INTO `USER` (`ID`,`NAME`,`EMAIL`) VALUES (2,'user2','user2@test.com'); +INSERT INTO `USER` (`ID`,`NAME`,`EMAIL`) VALUES (3,'user3','user3@test.com'); + +INSERT INTO `POST` (`ID`,`SUBJECT`,`USER_ID`) VALUES (1,'JPA Entity Graph In Action',1); + +INSERT INTO `COMMENT` (`ID`,`REPLY`,`POST_ID`,`USER_ID`) VALUES (1,'Nice !!',1,2); +INSERT INTO `COMMENT` (`ID`,`REPLY`,`POST_ID`,`USER_ID`) VALUES (2,'Cool !!',1,3); diff --git a/persistence-modules/java-jpa/src/test/java/com/baeldung/jpa/entitygraph/repo/PostRepositoryIntegrationTest.java b/persistence-modules/java-jpa/src/test/java/com/baeldung/jpa/entitygraph/repo/PostRepositoryIntegrationTest.java new file mode 100644 index 0000000000..4724bb41ad --- /dev/null +++ b/persistence-modules/java-jpa/src/test/java/com/baeldung/jpa/entitygraph/repo/PostRepositoryIntegrationTest.java @@ -0,0 +1,68 @@ +package com.baeldung.jpa.entitygraph.repo; + +import com.baeldung.jpa.entitygraph.model.Comment; +import com.baeldung.jpa.entitygraph.model.Post; +import com.baeldung.jpa.entitygraph.model.User; +import org.hibernate.LazyInitializationException; +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; + +import static org.junit.Assert.*; + +public class PostRepositoryIntegrationTest { + + private static PostRepository postRepository = null; + + @BeforeClass + public static void once() { + postRepository = new PostRepository(); + } + + @Test(expected = LazyInitializationException.class) + public void find() { + Post post = postRepository.find(1L); + assertNotNull(post.getUser()); + String email = post.getUser().getEmail(); + assertNull(email); + } + + @Test + public void findWithEntityGraph() { + Post post = postRepository.findWithEntityGraph(1L); + assertNotNull(post.getUser()); + String email = post.getUser().getEmail(); + assertNotNull(email); + } + + @Test(expected = LazyInitializationException.class) + public void findWithEntityGraph_Comment_Without_User() { + Post post = postRepository.findWithEntityGraph(1L); + assertNotNull(post.getUser()); + String email = post.getUser().getEmail(); + assertNotNull(email); + assertNotNull(post.getComments()); + assertEquals(post.getComments().size(), 2); + Comment comment = post.getComments().get(0); + assertNotNull(comment); + User user = comment.getUser(); + user.getEmail(); + } + + @Test + public void findWithEntityGraph2_Comment_With_User() { + Post post = postRepository.findWithEntityGraph2(1L); + assertNotNull(post.getComments()); + assertEquals(post.getComments().size(), 2); + Comment comment = post.getComments().get(0); + assertNotNull(comment); + User user = comment.getUser(); + assertNotNull(user); + assertEquals(user.getEmail(), "user2@test.com"); + } + + @AfterClass + public static void destroy() { + postRepository.clean(); + } +} diff --git a/persistence-modules/java-jpa/src/test/java/com/baeldung/jpa/stringcast/SpringCastUnitTest.java b/persistence-modules/java-jpa/src/test/java/com/baeldung/jpa/stringcast/SpringCastUnitTest.java new file mode 100644 index 0000000000..0a11725fc3 --- /dev/null +++ b/persistence-modules/java-jpa/src/test/java/com/baeldung/jpa/stringcast/SpringCastUnitTest.java @@ -0,0 +1,53 @@ +package com.baeldung.jpa.stringcast; + +import org.junit.BeforeClass; +import org.junit.Test; + +import javax.persistence.*; +import java.util.List; + +import static org.junit.Assert.assertEquals; + +public class SpringCastUnitTest { + + private static EntityManager em; + private static EntityManagerFactory emFactory; + + @BeforeClass + public static void setup() { + emFactory = Persistence.createEntityManagerFactory("jpa-h2"); + em = emFactory.createEntityManager(); + + // insert an object into the db + Message message = new Message(); + message.setText("text"); + + EntityTransaction tr = em.getTransaction(); + tr.begin(); + em.persist(message); + tr.commit(); + } + + @Test(expected = ClassCastException.class) + public void givenExecutorNoCastCheck_whenQueryReturnsOneColumn_thenClassCastThrown() { + List results = QueryExecutor.executeNativeQueryNoCastCheck("select text from message", em); + + // fails + for (String[] row : results) { + // do nothing + } + } + + @Test + public void givenExecutorWithCastCheck_whenQueryReturnsOneColumn_thenNoClassCastThrown() { + List results = QueryExecutor.executeNativeQueryWithCastCheck("select text from message", em); + assertEquals("text", results.get(0)[0]); + } + + @Test + public void givenExecutorGeneric_whenQueryReturnsOneColumn_thenNoClassCastThrown() { + List results = QueryExecutor.executeNativeQueryGeneric("select text from message", "textQueryMapping", em); + assertEquals("text", results.get(0).getText()); + } + +} diff --git a/persistence-modules/java-jpa/src/test/resources/persistence.xml b/persistence-modules/java-jpa/src/test/resources/persistence.xml index d94221b54f..c902e0a320 100644 --- a/persistence-modules/java-jpa/src/test/resources/persistence.xml +++ b/persistence-modules/java-jpa/src/test/resources/persistence.xml @@ -17,5 +17,21 @@ + + + org.hibernate.jpa.HibernatePersistenceProvider + com.baeldung.jpa.stringcast.Message + + + + + + + + + + + + diff --git a/persistence-modules/java-mongodb/pom.xml b/persistence-modules/java-mongodb/pom.xml index bbc48f54c2..9658ef567f 100644 --- a/persistence-modules/java-mongodb/pom.xml +++ b/persistence-modules/java-mongodb/pom.xml @@ -5,6 +5,7 @@ com.baeldung java-mongodb 1.0-SNAPSHOT + java-mongodb com.baeldung diff --git a/jnosql/README.md b/persistence-modules/jnosql/README.md similarity index 100% rename from jnosql/README.md rename to persistence-modules/jnosql/README.md diff --git a/jnosql/jnosql-artemis/pom.xml b/persistence-modules/jnosql/jnosql-artemis/pom.xml similarity index 99% rename from jnosql/jnosql-artemis/pom.xml rename to persistence-modules/jnosql/jnosql-artemis/pom.xml index 9c2bfd1ba0..8a978fb179 100644 --- a/jnosql/jnosql-artemis/pom.xml +++ b/persistence-modules/jnosql/jnosql-artemis/pom.xml @@ -3,6 +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"> 4.0.0 + jnosql-artemis + jnosql-artemis + war com.baeldung.jnosql @@ -10,9 +13,6 @@ 1.0-SNAPSHOT - jnosql-artemis - war - 2.4.2 false diff --git a/jnosql/jnosql-artemis/src/main/java/com/baeldung/jnosql/artemis/AppConfig.java b/persistence-modules/jnosql/jnosql-artemis/src/main/java/com/baeldung/jnosql/artemis/AppConfig.java similarity index 100% rename from jnosql/jnosql-artemis/src/main/java/com/baeldung/jnosql/artemis/AppConfig.java rename to persistence-modules/jnosql/jnosql-artemis/src/main/java/com/baeldung/jnosql/artemis/AppConfig.java diff --git a/jnosql/jnosql-artemis/src/main/java/com/baeldung/jnosql/artemis/EmbeddedMongoDBSetup.java b/persistence-modules/jnosql/jnosql-artemis/src/main/java/com/baeldung/jnosql/artemis/EmbeddedMongoDBSetup.java similarity index 100% rename from jnosql/jnosql-artemis/src/main/java/com/baeldung/jnosql/artemis/EmbeddedMongoDBSetup.java rename to persistence-modules/jnosql/jnosql-artemis/src/main/java/com/baeldung/jnosql/artemis/EmbeddedMongoDBSetup.java diff --git a/jnosql/jnosql-artemis/src/main/java/com/baeldung/jnosql/artemis/EntityManagerProducer.java b/persistence-modules/jnosql/jnosql-artemis/src/main/java/com/baeldung/jnosql/artemis/EntityManagerProducer.java similarity index 100% rename from jnosql/jnosql-artemis/src/main/java/com/baeldung/jnosql/artemis/EntityManagerProducer.java rename to persistence-modules/jnosql/jnosql-artemis/src/main/java/com/baeldung/jnosql/artemis/EntityManagerProducer.java diff --git a/jnosql/jnosql-artemis/src/main/java/com/baeldung/jnosql/artemis/RepositoryTodoManager.java b/persistence-modules/jnosql/jnosql-artemis/src/main/java/com/baeldung/jnosql/artemis/RepositoryTodoManager.java similarity index 100% rename from jnosql/jnosql-artemis/src/main/java/com/baeldung/jnosql/artemis/RepositoryTodoManager.java rename to persistence-modules/jnosql/jnosql-artemis/src/main/java/com/baeldung/jnosql/artemis/RepositoryTodoManager.java diff --git a/jnosql/jnosql-artemis/src/main/java/com/baeldung/jnosql/artemis/TemplateTodoManager.java b/persistence-modules/jnosql/jnosql-artemis/src/main/java/com/baeldung/jnosql/artemis/TemplateTodoManager.java similarity index 100% rename from jnosql/jnosql-artemis/src/main/java/com/baeldung/jnosql/artemis/TemplateTodoManager.java rename to persistence-modules/jnosql/jnosql-artemis/src/main/java/com/baeldung/jnosql/artemis/TemplateTodoManager.java diff --git a/jnosql/jnosql-artemis/src/main/java/com/baeldung/jnosql/artemis/Todo.java b/persistence-modules/jnosql/jnosql-artemis/src/main/java/com/baeldung/jnosql/artemis/Todo.java similarity index 100% rename from jnosql/jnosql-artemis/src/main/java/com/baeldung/jnosql/artemis/Todo.java rename to persistence-modules/jnosql/jnosql-artemis/src/main/java/com/baeldung/jnosql/artemis/Todo.java diff --git a/jnosql/jnosql-artemis/src/main/java/com/baeldung/jnosql/artemis/TodoManager.java b/persistence-modules/jnosql/jnosql-artemis/src/main/java/com/baeldung/jnosql/artemis/TodoManager.java similarity index 100% rename from jnosql/jnosql-artemis/src/main/java/com/baeldung/jnosql/artemis/TodoManager.java rename to persistence-modules/jnosql/jnosql-artemis/src/main/java/com/baeldung/jnosql/artemis/TodoManager.java diff --git a/jnosql/jnosql-artemis/src/main/java/com/baeldung/jnosql/artemis/TodoRepository.java b/persistence-modules/jnosql/jnosql-artemis/src/main/java/com/baeldung/jnosql/artemis/TodoRepository.java similarity index 100% rename from jnosql/jnosql-artemis/src/main/java/com/baeldung/jnosql/artemis/TodoRepository.java rename to persistence-modules/jnosql/jnosql-artemis/src/main/java/com/baeldung/jnosql/artemis/TodoRepository.java diff --git a/jnosql/jnosql-artemis/src/main/java/com/baeldung/jnosql/artemis/TodoResource.java b/persistence-modules/jnosql/jnosql-artemis/src/main/java/com/baeldung/jnosql/artemis/TodoResource.java similarity index 100% rename from jnosql/jnosql-artemis/src/main/java/com/baeldung/jnosql/artemis/TodoResource.java rename to persistence-modules/jnosql/jnosql-artemis/src/main/java/com/baeldung/jnosql/artemis/TodoResource.java diff --git a/jnosql/jnosql-artemis/src/main/java/com/baeldung/jnosql/artemis/qualifier/Repo.java b/persistence-modules/jnosql/jnosql-artemis/src/main/java/com/baeldung/jnosql/artemis/qualifier/Repo.java similarity index 100% rename from jnosql/jnosql-artemis/src/main/java/com/baeldung/jnosql/artemis/qualifier/Repo.java rename to persistence-modules/jnosql/jnosql-artemis/src/main/java/com/baeldung/jnosql/artemis/qualifier/Repo.java diff --git a/jnosql/jnosql-artemis/src/main/java/com/baeldung/jnosql/artemis/qualifier/Template.java b/persistence-modules/jnosql/jnosql-artemis/src/main/java/com/baeldung/jnosql/artemis/qualifier/Template.java similarity index 100% rename from jnosql/jnosql-artemis/src/main/java/com/baeldung/jnosql/artemis/qualifier/Template.java rename to persistence-modules/jnosql/jnosql-artemis/src/main/java/com/baeldung/jnosql/artemis/qualifier/Template.java diff --git a/jnosql/jnosql-artemis/src/main/liberty/config/server.xml b/persistence-modules/jnosql/jnosql-artemis/src/main/liberty/config/server.xml similarity index 100% rename from jnosql/jnosql-artemis/src/main/liberty/config/server.xml rename to persistence-modules/jnosql/jnosql-artemis/src/main/liberty/config/server.xml diff --git a/jnosql/jnosql-artemis/src/main/resources/META-INF/beans.xml b/persistence-modules/jnosql/jnosql-artemis/src/main/resources/META-INF/beans.xml similarity index 100% rename from jnosql/jnosql-artemis/src/main/resources/META-INF/beans.xml rename to persistence-modules/jnosql/jnosql-artemis/src/main/resources/META-INF/beans.xml diff --git a/jnosql/jnosql-artemis/src/main/resources/META-INF/jnosql.json b/persistence-modules/jnosql/jnosql-artemis/src/main/resources/META-INF/jnosql.json similarity index 100% rename from jnosql/jnosql-artemis/src/main/resources/META-INF/jnosql.json rename to persistence-modules/jnosql/jnosql-artemis/src/main/resources/META-INF/jnosql.json diff --git a/influxdb/src/main/resources/logback.xml b/persistence-modules/jnosql/jnosql-artemis/src/main/resources/logback.xml similarity index 100% rename from influxdb/src/main/resources/logback.xml rename to persistence-modules/jnosql/jnosql-artemis/src/main/resources/logback.xml diff --git a/jnosql/jnosql-artemis/src/main/webapp/WEB-INF/jnosql.json b/persistence-modules/jnosql/jnosql-artemis/src/main/webapp/WEB-INF/jnosql.json similarity index 100% rename from jnosql/jnosql-artemis/src/main/webapp/WEB-INF/jnosql.json rename to persistence-modules/jnosql/jnosql-artemis/src/main/webapp/WEB-INF/jnosql.json diff --git a/jnosql/jnosql-diana/pom.xml b/persistence-modules/jnosql/jnosql-diana/pom.xml similarity index 98% rename from jnosql/jnosql-diana/pom.xml rename to persistence-modules/jnosql/jnosql-diana/pom.xml index 767defb2a8..126f0314d9 100644 --- a/jnosql/jnosql-diana/pom.xml +++ b/persistence-modules/jnosql/jnosql-diana/pom.xml @@ -3,15 +3,15 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 - + jnosql-diana + jnosql-diana + com.baeldung.jnosql jnosql 1.0-SNAPSHOT - jnosql-diana - diff --git a/jnosql/jnosql-diana/src/main/java/com/baeldung/jnosql/diana/column/ColumnFamilyApp.java b/persistence-modules/jnosql/jnosql-diana/src/main/java/com/baeldung/jnosql/diana/column/ColumnFamilyApp.java similarity index 100% rename from jnosql/jnosql-diana/src/main/java/com/baeldung/jnosql/diana/column/ColumnFamilyApp.java rename to persistence-modules/jnosql/jnosql-diana/src/main/java/com/baeldung/jnosql/diana/column/ColumnFamilyApp.java diff --git a/jnosql/jnosql-diana/src/main/java/com/baeldung/jnosql/diana/document/DocumentApp.java b/persistence-modules/jnosql/jnosql-diana/src/main/java/com/baeldung/jnosql/diana/document/DocumentApp.java similarity index 100% rename from jnosql/jnosql-diana/src/main/java/com/baeldung/jnosql/diana/document/DocumentApp.java rename to persistence-modules/jnosql/jnosql-diana/src/main/java/com/baeldung/jnosql/diana/document/DocumentApp.java diff --git a/jnosql/jnosql-diana/src/main/java/com/baeldung/jnosql/diana/document/MongoDbInit.java b/persistence-modules/jnosql/jnosql-diana/src/main/java/com/baeldung/jnosql/diana/document/MongoDbInit.java similarity index 100% rename from jnosql/jnosql-diana/src/main/java/com/baeldung/jnosql/diana/document/MongoDbInit.java rename to persistence-modules/jnosql/jnosql-diana/src/main/java/com/baeldung/jnosql/diana/document/MongoDbInit.java diff --git a/jnosql/jnosql-diana/src/main/java/com/baeldung/jnosql/diana/key/Book.java b/persistence-modules/jnosql/jnosql-diana/src/main/java/com/baeldung/jnosql/diana/key/Book.java similarity index 100% rename from jnosql/jnosql-diana/src/main/java/com/baeldung/jnosql/diana/key/Book.java rename to persistence-modules/jnosql/jnosql-diana/src/main/java/com/baeldung/jnosql/diana/key/Book.java diff --git a/jnosql/jnosql-diana/src/main/java/com/baeldung/jnosql/diana/key/KeyValueApp.java b/persistence-modules/jnosql/jnosql-diana/src/main/java/com/baeldung/jnosql/diana/key/KeyValueApp.java similarity index 100% rename from jnosql/jnosql-diana/src/main/java/com/baeldung/jnosql/diana/key/KeyValueApp.java rename to persistence-modules/jnosql/jnosql-diana/src/main/java/com/baeldung/jnosql/diana/key/KeyValueApp.java diff --git a/jnosql/jnosql-diana/src/main/resources/diana-cassandra.properties b/persistence-modules/jnosql/jnosql-diana/src/main/resources/diana-cassandra.properties similarity index 100% rename from jnosql/jnosql-diana/src/main/resources/diana-cassandra.properties rename to persistence-modules/jnosql/jnosql-diana/src/main/resources/diana-cassandra.properties diff --git a/jnosql/jnosql-diana/src/main/resources/diana-hazelcast.properties b/persistence-modules/jnosql/jnosql-diana/src/main/resources/diana-hazelcast.properties similarity index 100% rename from jnosql/jnosql-diana/src/main/resources/diana-hazelcast.properties rename to persistence-modules/jnosql/jnosql-diana/src/main/resources/diana-hazelcast.properties diff --git a/jnosql/jnosql-diana/src/main/resources/diana-mongodb.properties b/persistence-modules/jnosql/jnosql-diana/src/main/resources/diana-mongodb.properties similarity index 100% rename from jnosql/jnosql-diana/src/main/resources/diana-mongodb.properties rename to persistence-modules/jnosql/jnosql-diana/src/main/resources/diana-mongodb.properties diff --git a/influxdb/src/test/resources/logback.xml b/persistence-modules/jnosql/jnosql-diana/src/main/resources/logback.xml similarity index 100% rename from influxdb/src/test/resources/logback.xml rename to persistence-modules/jnosql/jnosql-diana/src/main/resources/logback.xml diff --git a/jnosql/pom.xml b/persistence-modules/jnosql/pom.xml similarity index 97% rename from jnosql/pom.xml rename to persistence-modules/jnosql/pom.xml index c87ad3cf4b..5fb29a3b9c 100644 --- a/jnosql/pom.xml +++ b/persistence-modules/jnosql/pom.xml @@ -3,10 +3,10 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 - com.baeldung.jnosql jnosql 1.0-SNAPSHOT + jnosql pom diff --git a/persistence-modules/liquibase/pom.xml b/persistence-modules/liquibase/pom.xml index cb2bee8d48..b06d38e6a0 100644 --- a/persistence-modules/liquibase/pom.xml +++ b/persistence-modules/liquibase/pom.xml @@ -3,6 +3,7 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 liquibase + liquibase parent-modules diff --git a/orientdb/.gitignore b/persistence-modules/orientdb/.gitignore similarity index 100% rename from orientdb/.gitignore rename to persistence-modules/orientdb/.gitignore diff --git a/orientdb/.mvn/wrapper/maven-wrapper.jar b/persistence-modules/orientdb/.mvn/wrapper/maven-wrapper.jar similarity index 100% rename from orientdb/.mvn/wrapper/maven-wrapper.jar rename to persistence-modules/orientdb/.mvn/wrapper/maven-wrapper.jar diff --git a/orientdb/.mvn/wrapper/maven-wrapper.properties b/persistence-modules/orientdb/.mvn/wrapper/maven-wrapper.properties similarity index 100% rename from orientdb/.mvn/wrapper/maven-wrapper.properties rename to persistence-modules/orientdb/.mvn/wrapper/maven-wrapper.properties diff --git a/orientdb/README.md b/persistence-modules/orientdb/README.md similarity index 100% rename from orientdb/README.md rename to persistence-modules/orientdb/README.md diff --git a/orientdb/mvnw b/persistence-modules/orientdb/mvnw old mode 100755 new mode 100644 similarity index 100% rename from orientdb/mvnw rename to persistence-modules/orientdb/mvnw diff --git a/orientdb/mvnw.cmd b/persistence-modules/orientdb/mvnw.cmd similarity index 100% rename from orientdb/mvnw.cmd rename to persistence-modules/orientdb/mvnw.cmd diff --git a/orientdb/pom.xml b/persistence-modules/orientdb/pom.xml similarity index 95% rename from orientdb/pom.xml rename to persistence-modules/orientdb/pom.xml index e1c7ac42bb..a8ac3fb789 100644 --- a/orientdb/pom.xml +++ b/persistence-modules/orientdb/pom.xml @@ -4,14 +4,15 @@ 4.0.0 orientdb 0.0.1-SNAPSHOT + orientdb jar - intro-orientdb introduction to the OrientDB Java APIs com.baeldung parent-modules 1.0.0-SNAPSHOT + ../../ diff --git a/orientdb/src/main/java/com/baeldung/orientdb/Author.java b/persistence-modules/orientdb/src/main/java/com/baeldung/orientdb/Author.java similarity index 100% rename from orientdb/src/main/java/com/baeldung/orientdb/Author.java rename to persistence-modules/orientdb/src/main/java/com/baeldung/orientdb/Author.java diff --git a/jnosql/jnosql-artemis/src/main/resources/logback.xml b/persistence-modules/orientdb/src/main/resources/logback.xml similarity index 100% rename from jnosql/jnosql-artemis/src/main/resources/logback.xml rename to persistence-modules/orientdb/src/main/resources/logback.xml diff --git a/orientdb/src/test/java/com/baeldung/orientdb/OrientDBDocumentAPILiveTest.java b/persistence-modules/orientdb/src/test/java/com/baeldung/orientdb/OrientDBDocumentAPILiveTest.java similarity index 100% rename from orientdb/src/test/java/com/baeldung/orientdb/OrientDBDocumentAPILiveTest.java rename to persistence-modules/orientdb/src/test/java/com/baeldung/orientdb/OrientDBDocumentAPILiveTest.java diff --git a/orientdb/src/test/java/com/baeldung/orientdb/OrientDBGraphAPILiveTest.java b/persistence-modules/orientdb/src/test/java/com/baeldung/orientdb/OrientDBGraphAPILiveTest.java similarity index 100% rename from orientdb/src/test/java/com/baeldung/orientdb/OrientDBGraphAPILiveTest.java rename to persistence-modules/orientdb/src/test/java/com/baeldung/orientdb/OrientDBGraphAPILiveTest.java diff --git a/orientdb/src/test/java/com/baeldung/orientdb/OrientDBObjectAPILiveTest.java b/persistence-modules/orientdb/src/test/java/com/baeldung/orientdb/OrientDBObjectAPILiveTest.java similarity index 100% rename from orientdb/src/test/java/com/baeldung/orientdb/OrientDBObjectAPILiveTest.java rename to persistence-modules/orientdb/src/test/java/com/baeldung/orientdb/OrientDBObjectAPILiveTest.java diff --git a/spring-boot-h2/README.md b/persistence-modules/spring-boot-h2/README.md similarity index 100% rename from spring-boot-h2/README.md rename to persistence-modules/spring-boot-h2/README.md diff --git a/persistence-modules/spring-boot-h2/spring-boot-h2-database/.gitignore b/persistence-modules/spring-boot-h2/spring-boot-h2-database/.gitignore new file mode 100644 index 0000000000..82eca336e3 --- /dev/null +++ b/persistence-modules/spring-boot-h2/spring-boot-h2-database/.gitignore @@ -0,0 +1,25 @@ +/target/ +!.mvn/wrapper/maven-wrapper.jar + +### STS ### +.apt_generated +.classpath +.factorypath +.project +.settings +.springBeans +.sts4-cache + +### IntelliJ IDEA ### +.idea +*.iws +*.iml +*.ipr + +### NetBeans ### +/nbproject/private/ +/build/ +/nbbuild/ +/dist/ +/nbdist/ +/.nb-gradle/ \ No newline at end of file diff --git a/spring-boot-h2/spring-boot-h2-database/pom.xml b/persistence-modules/spring-boot-h2/spring-boot-h2-database/pom.xml similarity index 94% rename from spring-boot-h2/spring-boot-h2-database/pom.xml rename to persistence-modules/spring-boot-h2/spring-boot-h2-database/pom.xml index 94f2293c34..6ebc75de8d 100644 --- a/spring-boot-h2/spring-boot-h2-database/pom.xml +++ b/persistence-modules/spring-boot-h2/spring-boot-h2-database/pom.xml @@ -3,10 +3,10 @@ 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"> 4.0.0 - com.baeldung.h2db spring-boot-h2-database 0.0.1-SNAPSHOT + spring-boot-h2-database jar Demo Spring Boot applications that starts H2 in memory database @@ -23,7 +23,7 @@ UTF-8 1.8 - com.mycorp.starter.HelloWorldApplication + com.baeldung.h2db.demo.server.SpringBootApp diff --git a/spring-boot-h2/spring-boot-h2-database/src/main/java/com/baeldung/h2db/auto/configuration/AutoConfigurationDemo.java b/persistence-modules/spring-boot-h2/spring-boot-h2-database/src/main/java/com/baeldung/h2db/auto/configuration/AutoConfigurationDemo.java similarity index 96% rename from spring-boot-h2/spring-boot-h2-database/src/main/java/com/baeldung/h2db/auto/configuration/AutoConfigurationDemo.java rename to persistence-modules/spring-boot-h2/spring-boot-h2-database/src/main/java/com/baeldung/h2db/auto/configuration/AutoConfigurationDemo.java index 8d92e18754..18236be234 100644 --- a/spring-boot-h2/spring-boot-h2-database/src/main/java/com/baeldung/h2db/auto/configuration/AutoConfigurationDemo.java +++ b/persistence-modules/spring-boot-h2/spring-boot-h2-database/src/main/java/com/baeldung/h2db/auto/configuration/AutoConfigurationDemo.java @@ -1,14 +1,14 @@ -package com.baeldung.h2db.auto.configuration; - -import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.SpringBootApplication; -import org.springframework.context.annotation.ComponentScan; - -@SpringBootApplication -public class AutoConfigurationDemo { - - public static void main(String[] args) { - SpringApplication.run(AutoConfigurationDemo.class, args); - } - -} +package com.baeldung.h2db.auto.configuration; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.context.annotation.ComponentScan; + +@SpringBootApplication +public class AutoConfigurationDemo { + + public static void main(String[] args) { + SpringApplication.run(AutoConfigurationDemo.class, args); + } + +} diff --git a/spring-boot-h2/spring-boot-h2-database/src/main/java/com/baeldung/h2db/demo/client/ClientSpringBootApp.java b/persistence-modules/spring-boot-h2/spring-boot-h2-database/src/main/java/com/baeldung/h2db/demo/client/ClientSpringBootApp.java similarity index 100% rename from spring-boot-h2/spring-boot-h2-database/src/main/java/com/baeldung/h2db/demo/client/ClientSpringBootApp.java rename to persistence-modules/spring-boot-h2/spring-boot-h2-database/src/main/java/com/baeldung/h2db/demo/client/ClientSpringBootApp.java diff --git a/spring-boot-h2/spring-boot-h2-database/src/main/java/com/baeldung/h2db/demo/server/SpringBootApp.java b/persistence-modules/spring-boot-h2/spring-boot-h2-database/src/main/java/com/baeldung/h2db/demo/server/SpringBootApp.java similarity index 100% rename from spring-boot-h2/spring-boot-h2-database/src/main/java/com/baeldung/h2db/demo/server/SpringBootApp.java rename to persistence-modules/spring-boot-h2/spring-boot-h2-database/src/main/java/com/baeldung/h2db/demo/server/SpringBootApp.java diff --git a/spring-boot-h2/spring-boot-h2-database/src/main/resources/application.properties b/persistence-modules/spring-boot-h2/spring-boot-h2-database/src/main/resources/application.properties similarity index 100% rename from spring-boot-h2/spring-boot-h2-database/src/main/resources/application.properties rename to persistence-modules/spring-boot-h2/spring-boot-h2-database/src/main/resources/application.properties diff --git a/persistence-modules/spring-boot-persistence-mongodb/.gitignore b/persistence-modules/spring-boot-persistence-mongodb/.gitignore new file mode 100644 index 0000000000..f96dae6a60 --- /dev/null +++ b/persistence-modules/spring-boot-persistence-mongodb/.gitignore @@ -0,0 +1,4 @@ + +/.idea/ +/target/ +/spring-boot-persistence.iml diff --git a/persistence-modules/spring-boot-persistence-mongodb/pom.xml b/persistence-modules/spring-boot-persistence-mongodb/pom.xml new file mode 100644 index 0000000000..fc267eedf6 --- /dev/null +++ b/persistence-modules/spring-boot-persistence-mongodb/pom.xml @@ -0,0 +1,106 @@ + + + 4.0.0 + + + parent-boot-2 + com.baeldung + 0.0.1-SNAPSHOT + ../../parent-boot-2 + + + spring-boot-persistence-mongodb + war + spring-boot-persistence-mongodb + This is simple boot application for Spring boot persistence mongodb test + + + + org.springframework.boot + spring-boot-starter-web + + + + org.springframework.boot + spring-boot-starter-data-mongodb + + + + org.junit.jupiter + junit-jupiter-api + test + + + org.junit.jupiter + junit-jupiter-engine + test + + + + + org.junit.platform + junit-platform-launcher + ${junit-platform.version} + test + + + org.springframework.boot + spring-boot-starter-test + test + + + + + spring-boot-persistence + + + src/main/resources + true + + + + + org.apache.maven.plugins + maven-war-plugin + + + + + + + autoconfiguration + + + + org.apache.maven.plugins + maven-surefire-plugin + + + integration-test + + test + + + + **/*LiveTest.java + **/*IntegrationTest.java + **/*IntTest.java + + + + + + + json + + + + + + + + + + \ No newline at end of file diff --git a/persistence-modules/spring-boot-persistence-mongodb/src/main/java/com/baeldung/SpringBootPersistenceApplication.java b/persistence-modules/spring-boot-persistence-mongodb/src/main/java/com/baeldung/SpringBootPersistenceApplication.java new file mode 100644 index 0000000000..2dff3f37df --- /dev/null +++ b/persistence-modules/spring-boot-persistence-mongodb/src/main/java/com/baeldung/SpringBootPersistenceApplication.java @@ -0,0 +1,13 @@ +package com.baeldung; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication +public class SpringBootPersistenceApplication { + + public static void main(String ... args) { + SpringApplication.run(SpringBootPersistenceApplication.class, args); + } + +} diff --git a/persistence-modules/spring-boot-persistence-mongodb/src/main/java/com/baeldung/mongodb/daos/UserRepository.java b/persistence-modules/spring-boot-persistence-mongodb/src/main/java/com/baeldung/mongodb/daos/UserRepository.java new file mode 100755 index 0000000000..7f58fdd1c8 --- /dev/null +++ b/persistence-modules/spring-boot-persistence-mongodb/src/main/java/com/baeldung/mongodb/daos/UserRepository.java @@ -0,0 +1,10 @@ +package com.baeldung.mongodb.daos; + + +import com.baeldung.mongodb.models.User; +import org.springframework.data.mongodb.repository.MongoRepository; + + +public interface UserRepository extends MongoRepository { + +} diff --git a/persistence-modules/spring-boot-persistence-mongodb/src/main/java/com/baeldung/mongodb/events/UserModelListener.java b/persistence-modules/spring-boot-persistence-mongodb/src/main/java/com/baeldung/mongodb/events/UserModelListener.java new file mode 100644 index 0000000000..24b53f3d2d --- /dev/null +++ b/persistence-modules/spring-boot-persistence-mongodb/src/main/java/com/baeldung/mongodb/events/UserModelListener.java @@ -0,0 +1,28 @@ +package com.baeldung.mongodb.events; + + +import com.baeldung.mongodb.models.User; +import com.baeldung.mongodb.services.SequenceGeneratorService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.data.mongodb.core.mapping.event.AbstractMongoEventListener; +import org.springframework.data.mongodb.core.mapping.event.BeforeConvertEvent; +import org.springframework.stereotype.Component; + + +@Component +public class UserModelListener extends AbstractMongoEventListener { + + private SequenceGeneratorService sequenceGenerator; + + @Autowired + public UserModelListener(SequenceGeneratorService sequenceGenerator) { + this.sequenceGenerator = sequenceGenerator; + } + + @Override + public void onBeforeConvert(BeforeConvertEvent event) { + event.getSource().setId(sequenceGenerator.generateSequence(User.SEQUENCE_NAME)); + } + + +} diff --git a/persistence-modules/spring-boot-persistence-mongodb/src/main/java/com/baeldung/mongodb/models/DatabaseSequence.java b/persistence-modules/spring-boot-persistence-mongodb/src/main/java/com/baeldung/mongodb/models/DatabaseSequence.java new file mode 100755 index 0000000000..c2c04f7ee6 --- /dev/null +++ b/persistence-modules/spring-boot-persistence-mongodb/src/main/java/com/baeldung/mongodb/models/DatabaseSequence.java @@ -0,0 +1,32 @@ +package com.baeldung.mongodb.models; + +import org.springframework.data.annotation.Id; +import org.springframework.data.mongodb.core.mapping.Document; + + +@Document(collection = "database_sequences") +public class DatabaseSequence { + + @Id + private String id; + + private long seq; + + public DatabaseSequence() {} + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public long getSeq() { + return seq; + } + + public void setSeq(long seq) { + this.seq = seq; + } +} diff --git a/persistence-modules/spring-boot-persistence-mongodb/src/main/java/com/baeldung/mongodb/models/User.java b/persistence-modules/spring-boot-persistence-mongodb/src/main/java/com/baeldung/mongodb/models/User.java new file mode 100755 index 0000000000..1f08074313 --- /dev/null +++ b/persistence-modules/spring-boot-persistence-mongodb/src/main/java/com/baeldung/mongodb/models/User.java @@ -0,0 +1,73 @@ +package com.baeldung.mongodb.models; + +import org.springframework.data.annotation.Id; +import org.springframework.data.annotation.Transient; +import org.springframework.data.mongodb.core.mapping.Document; + + +@Document(collection = "users") +public class User { + + @Transient + public static final String SEQUENCE_NAME = "users_sequence"; + + @Id + private long id; + + private String firstName; + + private String lastName; + + private String email; + + public User() { } + + public User(String firstName, String lastName, String email) { + this.firstName = firstName; + this.lastName = lastName; + this.email = 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 getLastName() { + return lastName; + } + + public void setLastName(String lastName) { + this.lastName = lastName; + } + + public String getEmail() { + return email; + } + + public void setEmail(String email) { + this.email = email; + } + + + @Override + public String toString() { + return "User{" + + "id=" + id + + ", firstName='" + firstName + '\'' + + ", lastName='" + lastName + '\'' + + ", email='" + email + '\'' + + '}'; + } +} diff --git a/persistence-modules/spring-boot-persistence-mongodb/src/main/java/com/baeldung/mongodb/services/SequenceGeneratorService.java b/persistence-modules/spring-boot-persistence-mongodb/src/main/java/com/baeldung/mongodb/services/SequenceGeneratorService.java new file mode 100755 index 0000000000..52ece27d63 --- /dev/null +++ b/persistence-modules/spring-boot-persistence-mongodb/src/main/java/com/baeldung/mongodb/services/SequenceGeneratorService.java @@ -0,0 +1,35 @@ +package com.baeldung.mongodb.services; + +import com.baeldung.mongodb.models.DatabaseSequence; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.data.mongodb.core.MongoOperations; +import org.springframework.data.mongodb.core.query.Update; +import org.springframework.stereotype.Service; + +import java.util.Objects; + +import static org.springframework.data.mongodb.core.FindAndModifyOptions.options; +import static org.springframework.data.mongodb.core.query.Criteria.where; +import static org.springframework.data.mongodb.core.query.Query.query; + + +@Service +public class SequenceGeneratorService { + + + private MongoOperations mongoOperations; + + @Autowired + public SequenceGeneratorService(MongoOperations mongoOperations) { + this.mongoOperations = mongoOperations; + } + + public long generateSequence(String seqName) { + + DatabaseSequence counter = mongoOperations.findAndModify(query(where("_id").is(seqName)), + new Update().inc("seq",1), options().returnNew(true).upsert(true), + DatabaseSequence.class); + return !Objects.isNull(counter) ? counter.getSeq() : 1; + + } +} diff --git a/persistence-modules/spring-boot-persistence-mongodb/src/main/resources/application.properties b/persistence-modules/spring-boot-persistence-mongodb/src/main/resources/application.properties new file mode 100644 index 0000000000..5b1b8000d0 --- /dev/null +++ b/persistence-modules/spring-boot-persistence-mongodb/src/main/resources/application.properties @@ -0,0 +1,8 @@ +spring.application.name=spring-boot-persistence +server.port=${PORT:0} + +#spring boot mongodb +spring.data.mongodb.host=localhost +spring.data.mongodb.port=27017 +spring.data.mongodb.database=springboot-mongo + diff --git a/persistence-modules/spring-boot-persistence-mongodb/src/test/java/com/baeldung/mongodb/MongoDbAutoGeneratedFieldIntegrationTest.java b/persistence-modules/spring-boot-persistence-mongodb/src/test/java/com/baeldung/mongodb/MongoDbAutoGeneratedFieldIntegrationTest.java new file mode 100644 index 0000000000..cec1ad5fea --- /dev/null +++ b/persistence-modules/spring-boot-persistence-mongodb/src/test/java/com/baeldung/mongodb/MongoDbAutoGeneratedFieldIntegrationTest.java @@ -0,0 +1,37 @@ +package com.baeldung.mongodb; + +import com.baeldung.mongodb.daos.UserRepository; +import com.baeldung.mongodb.models.User; +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 MongoDbAutoGeneratedFieldIntegrationTest { + + @Autowired + UserRepository userRepository; + + @Test + public void contextLoads() {} + + @Test + public void givenUserObject_whenSave_thenCreateNewUser() { + + User user = new User(); + user.setFirstName("John"); + user.setLastName("Doe"); + user.setEmail("john.doe@example.com"); + userRepository.save(user); + + assertThat(userRepository.findAll().size()).isGreaterThan(0); + } + + +} diff --git a/spring-custom-aop/.gitignore b/persistence-modules/spring-boot-persistence/.gitignore similarity index 97% rename from spring-custom-aop/.gitignore rename to persistence-modules/spring-boot-persistence/.gitignore index 60be5b80aa..da7c2c5c0a 100644 --- a/spring-custom-aop/.gitignore +++ b/persistence-modules/spring-boot-persistence/.gitignore @@ -2,3 +2,4 @@ .settings/ .classpath .project + diff --git a/spring-boot-persistence/.mvn/wrapper/maven-wrapper.properties b/persistence-modules/spring-boot-persistence/.mvn/wrapper/maven-wrapper.properties old mode 100755 new mode 100644 similarity index 100% rename from spring-boot-persistence/.mvn/wrapper/maven-wrapper.properties rename to persistence-modules/spring-boot-persistence/.mvn/wrapper/maven-wrapper.properties diff --git a/spring-boot-persistence/README.MD b/persistence-modules/spring-boot-persistence/README.MD similarity index 82% rename from spring-boot-persistence/README.MD rename to persistence-modules/spring-boot-persistence/README.MD index 6cf172426a..8988fb4ebd 100644 --- a/spring-boot-persistence/README.MD +++ b/persistence-modules/spring-boot-persistence/README.MD @@ -4,3 +4,4 @@ - [Configuring Separate Spring DataSource for Tests](http://www.baeldung.com/spring-testing-separate-data-source) - [Quick Guide on data.sql and schema.sql Files in Spring Boot](http://www.baeldung.com/spring-boot-data-sql-and-schema-sql) - [Configuring a Tomcat Connection Pool in Spring Boot](https://www.baeldung.com/spring-boot-tomcat-connection-pool) +- [Hibernate Field Naming with Spring Boot](https://www.baeldung.com/hibernate-field-naming-spring-boot) diff --git a/spring-boot-persistence/mvnw b/persistence-modules/spring-boot-persistence/mvnw old mode 100755 new mode 100644 similarity index 100% rename from spring-boot-persistence/mvnw rename to persistence-modules/spring-boot-persistence/mvnw diff --git a/spring-boot-persistence/mvnw.cmd b/persistence-modules/spring-boot-persistence/mvnw.cmd old mode 100755 new mode 100644 similarity index 97% rename from spring-boot-persistence/mvnw.cmd rename to persistence-modules/spring-boot-persistence/mvnw.cmd index 4f0b068a03..6a6eec39ba --- a/spring-boot-persistence/mvnw.cmd +++ b/persistence-modules/spring-boot-persistence/mvnw.cmd @@ -1,145 +1,145 @@ -@REM ---------------------------------------------------------------------------- -@REM Licensed to the Apache Software Foundation (ASF) under one -@REM or more contributor license agreements. See the NOTICE file -@REM distributed with this work for additional information -@REM regarding copyright ownership. The ASF licenses this file -@REM to you under the Apache License, Version 2.0 (the -@REM "License"); you may not use this file except in compliance -@REM with the License. You may obtain a copy of the License at -@REM -@REM http://www.apache.org/licenses/LICENSE-2.0 -@REM -@REM Unless required by applicable law or agreed to in writing, -@REM software distributed under the License is distributed on an -@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -@REM KIND, either express or implied. See the License for the -@REM specific language governing permissions and limitations -@REM under the License. -@REM ---------------------------------------------------------------------------- - -@REM ---------------------------------------------------------------------------- -@REM Maven2 Start Up Batch script -@REM -@REM Required ENV vars: -@REM JAVA_HOME - location of a JDK home dir -@REM -@REM Optional ENV vars -@REM M2_HOME - location of maven2's installed home dir -@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands -@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a key stroke before ending -@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven -@REM e.g. to debug Maven itself, use -@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 -@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files -@REM ---------------------------------------------------------------------------- - -@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on' -@echo off -@REM set title of command window -title %0 -@REM enable echoing my setting MAVEN_BATCH_ECHO to 'on' -@if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO% - -@REM set %HOME% to equivalent of $HOME -if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%") - -@REM Execute a user defined script before this one -if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre -@REM check for pre script, once with legacy .bat ending and once with .cmd ending -if exist "%HOME%\mavenrc_pre.bat" call "%HOME%\mavenrc_pre.bat" -if exist "%HOME%\mavenrc_pre.cmd" call "%HOME%\mavenrc_pre.cmd" -:skipRcPre - -@setlocal - -set ERROR_CODE=0 - -@REM To isolate internal variables from possible post scripts, we use another setlocal -@setlocal - -@REM ==== START VALIDATION ==== -if not "%JAVA_HOME%" == "" goto OkJHome - -echo. -echo Error: JAVA_HOME not found in your environment. >&2 -echo Please set the JAVA_HOME variable in your environment to match the >&2 -echo location of your Java installation. >&2 -echo. -goto error - -:OkJHome -if exist "%JAVA_HOME%\bin\java.exe" goto init - -echo. -echo Error: JAVA_HOME is set to an invalid directory. >&2 -echo JAVA_HOME = "%JAVA_HOME%" >&2 -echo Please set the JAVA_HOME variable in your environment to match the >&2 -echo location of your Java installation. >&2 -echo. -goto error - -@REM ==== END VALIDATION ==== - -:init - -@REM Find the project base dir, i.e. the directory that contains the folder ".mvn". -@REM Fallback to current working directory if not found. - -set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR% -IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir - -set EXEC_DIR=%CD% -set WDIR=%EXEC_DIR% -:findBaseDir -IF EXIST "%WDIR%"\.mvn goto baseDirFound -cd .. -IF "%WDIR%"=="%CD%" goto baseDirNotFound -set WDIR=%CD% -goto findBaseDir - -:baseDirFound -set MAVEN_PROJECTBASEDIR=%WDIR% -cd "%EXEC_DIR%" -goto endDetectBaseDir - -:baseDirNotFound -set MAVEN_PROJECTBASEDIR=%EXEC_DIR% -cd "%EXEC_DIR%" - -:endDetectBaseDir - -IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig - -@setlocal EnableExtensions EnableDelayedExpansion -for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a -@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS% - -:endReadAdditionalConfig - -SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe" - -set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar" -set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain - -%MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %* -if ERRORLEVEL 1 goto error -goto end - -:error -set ERROR_CODE=1 - -:end -@endlocal & set ERROR_CODE=%ERROR_CODE% - -if not "%MAVEN_SKIP_RC%" == "" goto skipRcPost -@REM check for post script, once with legacy .bat ending and once with .cmd ending -if exist "%HOME%\mavenrc_post.bat" call "%HOME%\mavenrc_post.bat" -if exist "%HOME%\mavenrc_post.cmd" call "%HOME%\mavenrc_post.cmd" -:skipRcPost - -@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on' -if "%MAVEN_BATCH_PAUSE%" == "on" pause - -if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE% - -exit /B %ERROR_CODE% +@REM ---------------------------------------------------------------------------- +@REM Licensed to the Apache Software Foundation (ASF) under one +@REM or more contributor license agreements. See the NOTICE file +@REM distributed with this work for additional information +@REM regarding copyright ownership. The ASF licenses this file +@REM to you under the Apache License, Version 2.0 (the +@REM "License"); you may not use this file except in compliance +@REM with the License. You may obtain a copy of the License at +@REM +@REM http://www.apache.org/licenses/LICENSE-2.0 +@REM +@REM Unless required by applicable law or agreed to in writing, +@REM software distributed under the License is distributed on an +@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +@REM KIND, either express or implied. See the License for the +@REM specific language governing permissions and limitations +@REM under the License. +@REM ---------------------------------------------------------------------------- + +@REM ---------------------------------------------------------------------------- +@REM Maven2 Start Up Batch script +@REM +@REM Required ENV vars: +@REM JAVA_HOME - location of a JDK home dir +@REM +@REM Optional ENV vars +@REM M2_HOME - location of maven2's installed home dir +@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands +@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a key stroke before ending +@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven +@REM e.g. to debug Maven itself, use +@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 +@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files +@REM ---------------------------------------------------------------------------- + +@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on' +@echo off +@REM set title of command window +title %0 +@REM enable echoing my setting MAVEN_BATCH_ECHO to 'on' +@if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO% + +@REM set %HOME% to equivalent of $HOME +if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%") + +@REM Execute a user defined script before this one +if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre +@REM check for pre script, once with legacy .bat ending and once with .cmd ending +if exist "%HOME%\mavenrc_pre.bat" call "%HOME%\mavenrc_pre.bat" +if exist "%HOME%\mavenrc_pre.cmd" call "%HOME%\mavenrc_pre.cmd" +:skipRcPre + +@setlocal + +set ERROR_CODE=0 + +@REM To isolate internal variables from possible post scripts, we use another setlocal +@setlocal + +@REM ==== START VALIDATION ==== +if not "%JAVA_HOME%" == "" goto OkJHome + +echo. +echo Error: JAVA_HOME not found in your environment. >&2 +echo Please set the JAVA_HOME variable in your environment to match the >&2 +echo location of your Java installation. >&2 +echo. +goto error + +:OkJHome +if exist "%JAVA_HOME%\bin\java.exe" goto init + +echo. +echo Error: JAVA_HOME is set to an invalid directory. >&2 +echo JAVA_HOME = "%JAVA_HOME%" >&2 +echo Please set the JAVA_HOME variable in your environment to match the >&2 +echo location of your Java installation. >&2 +echo. +goto error + +@REM ==== END VALIDATION ==== + +:init + +@REM Find the project base dir, i.e. the directory that contains the folder ".mvn". +@REM Fallback to current working directory if not found. + +set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR% +IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir + +set EXEC_DIR=%CD% +set WDIR=%EXEC_DIR% +:findBaseDir +IF EXIST "%WDIR%"\.mvn goto baseDirFound +cd .. +IF "%WDIR%"=="%CD%" goto baseDirNotFound +set WDIR=%CD% +goto findBaseDir + +:baseDirFound +set MAVEN_PROJECTBASEDIR=%WDIR% +cd "%EXEC_DIR%" +goto endDetectBaseDir + +:baseDirNotFound +set MAVEN_PROJECTBASEDIR=%EXEC_DIR% +cd "%EXEC_DIR%" + +:endDetectBaseDir + +IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig + +@setlocal EnableExtensions EnableDelayedExpansion +for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a +@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS% + +:endReadAdditionalConfig + +SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe" + +set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar" +set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain + +%MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %* +if ERRORLEVEL 1 goto error +goto end + +:error +set ERROR_CODE=1 + +:end +@endlocal & set ERROR_CODE=%ERROR_CODE% + +if not "%MAVEN_SKIP_RC%" == "" goto skipRcPost +@REM check for post script, once with legacy .bat ending and once with .cmd ending +if exist "%HOME%\mavenrc_post.bat" call "%HOME%\mavenrc_post.bat" +if exist "%HOME%\mavenrc_post.cmd" call "%HOME%\mavenrc_post.cmd" +:skipRcPost + +@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on' +if "%MAVEN_BATCH_PAUSE%" == "on" pause + +if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE% + +exit /B %ERROR_CODE% diff --git a/spring-boot-persistence/pom.xml b/persistence-modules/spring-boot-persistence/pom.xml similarity index 74% rename from spring-boot-persistence/pom.xml rename to persistence-modules/spring-boot-persistence/pom.xml index 08989edfa9..0ea42b1cb7 100644 --- a/spring-boot-persistence/pom.xml +++ b/persistence-modules/spring-boot-persistence/pom.xml @@ -1,75 +1,82 @@ - - - 4.0.0 - - com.baeldung - spring-boot-persistence - 0.1.0 - - - parent-boot-2 - com.baeldung - 0.0.1-SNAPSHOT - ../parent-boot-2 - - - - - org.springframework.boot - spring-boot-starter-data-jpa - - - com.zaxxer - HikariCP - - - - - org.springframework.boot - spring-boot-starter-test - test - - - org.apache.tomcat - tomcat-jdbc - ${tomcat-jdbc.version} - - - mysql - mysql-connector-java - ${mysql-connector-java.version} - - - com.h2database - h2 - ${h2database.version} - runtime - - - - - UTF-8 - 1.8 - 8.0.12 - 9.0.10 - 1.4.197 - - - - spring-boot-persistence - - - src/main/resources - true - - - - - org.springframework.boot - spring-boot-maven-plugin - - - - + + + 4.0.0 + com.baeldung + spring-boot-persistence + 0.1.0 + spring-boot-persistence + + + parent-boot-2 + com.baeldung + 0.0.1-SNAPSHOT + ../../parent-boot-2 + + + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework.boot + spring-boot-starter-thymeleaf + + + org.springframework.boot + spring-boot-starter-data-jpa + + + org.springframework.boot + spring-boot-starter-test + + + org.mockito + mockito-core + ${mockito.version} + test + + + com.h2database + h2 + ${h2database.version} + runtime + + + org.apache.tomcat + tomcat-jdbc + ${tomcat-jdbc.version} + + + mysql + mysql-connector-java + ${mysql-connector-java.version} + + + + UTF-8 + 1.8 + 8.0.12 + 9.0.10 + 1.4.197 + 2.23.0 + + + + spring-boot-persistence + + + src/main/resources + true + + + + + org.springframework.boot + spring-boot-maven-plugin + + + + diff --git a/spring-boot-persistence/src/main/java/com/baeldung/Application.java b/persistence-modules/spring-boot-persistence/src/main/java/com/baeldung/Application.java similarity index 100% rename from spring-boot-persistence/src/main/java/com/baeldung/Application.java rename to persistence-modules/spring-boot-persistence/src/main/java/com/baeldung/Application.java diff --git a/spring-boot-persistence/src/main/java/com/baeldung/boot/config/H2JpaConfig.java b/persistence-modules/spring-boot-persistence/src/main/java/com/baeldung/boot/config/H2JpaConfig.java similarity index 100% rename from spring-boot-persistence/src/main/java/com/baeldung/boot/config/H2JpaConfig.java rename to persistence-modules/spring-boot-persistence/src/main/java/com/baeldung/boot/config/H2JpaConfig.java diff --git a/spring-boot-persistence/src/main/java/com/baeldung/domain/Country.java b/persistence-modules/spring-boot-persistence/src/main/java/com/baeldung/domain/Country.java similarity index 100% rename from spring-boot-persistence/src/main/java/com/baeldung/domain/Country.java rename to persistence-modules/spring-boot-persistence/src/main/java/com/baeldung/domain/Country.java diff --git a/spring-boot-persistence/src/main/java/com/baeldung/domain/User.java b/persistence-modules/spring-boot-persistence/src/main/java/com/baeldung/domain/User.java similarity index 100% rename from spring-boot-persistence/src/main/java/com/baeldung/domain/User.java rename to persistence-modules/spring-boot-persistence/src/main/java/com/baeldung/domain/User.java diff --git a/persistence-modules/spring-boot-persistence/src/main/java/com/baeldung/naming/HibernateConfig.java b/persistence-modules/spring-boot-persistence/src/main/java/com/baeldung/naming/HibernateConfig.java new file mode 100644 index 0000000000..897e34d406 --- /dev/null +++ b/persistence-modules/spring-boot-persistence/src/main/java/com/baeldung/naming/HibernateConfig.java @@ -0,0 +1,19 @@ +package com.baeldung.naming; + +import org.hibernate.jpa.boot.spi.IntegratorProvider; +import org.springframework.boot.autoconfigure.orm.jpa.HibernatePropertiesCustomizer; + +import java.util.Collections; +import java.util.Map; + +/** + * Custom implementation of the {@link HibernatePropertiesCustomizer HibernatePropertiesCustomizer}. + * We can use it to set custom hibernate properties. + */ +public class HibernateConfig implements HibernatePropertiesCustomizer { + + @Override + public void customize(Map hibernateProperties) { + hibernateProperties.put("hibernate.integrator_provider", (IntegratorProvider) () -> Collections.singletonList(MetadataExtractorIntegrator.INSTANCE)); + } +} diff --git a/persistence-modules/spring-boot-persistence/src/main/java/com/baeldung/naming/MetadataExtractorIntegrator.java b/persistence-modules/spring-boot-persistence/src/main/java/com/baeldung/naming/MetadataExtractorIntegrator.java new file mode 100644 index 0000000000..24b5cdea64 --- /dev/null +++ b/persistence-modules/spring-boot-persistence/src/main/java/com/baeldung/naming/MetadataExtractorIntegrator.java @@ -0,0 +1,41 @@ +package com.baeldung.naming; + +import org.hibernate.boot.Metadata; +import org.hibernate.boot.model.relational.Database; +import org.hibernate.engine.spi.SessionFactoryImplementor; +import org.hibernate.integrator.spi.Integrator; +import org.hibernate.service.spi.SessionFactoryServiceRegistry; + +/** + * Custom implementation of the {@link Integrator Integrator} interface. + * We can use it to getting access to the binding metadata between entity mappings and database tables. + */ +public class MetadataExtractorIntegrator implements Integrator { + + public static final MetadataExtractorIntegrator INSTANCE = new MetadataExtractorIntegrator(); + + private Database database; + + private Metadata metadata; + + public Database getDatabase() { + return database; + } + + public Metadata getMetadata() { + return metadata; + } + + @Override + public void integrate(Metadata metadata, SessionFactoryImplementor sessionFactory, SessionFactoryServiceRegistry serviceRegistry) { + + this.database = metadata.getDatabase(); + this.metadata = metadata; + + } + + @Override + public void disintegrate(SessionFactoryImplementor sessionFactory, SessionFactoryServiceRegistry serviceRegistry) { + + } +} diff --git a/persistence-modules/spring-boot-persistence/src/main/java/com/baeldung/naming/entity/Account.java b/persistence-modules/spring-boot-persistence/src/main/java/com/baeldung/naming/entity/Account.java new file mode 100644 index 0000000000..6145818c5b --- /dev/null +++ b/persistence-modules/spring-boot-persistence/src/main/java/com/baeldung/naming/entity/Account.java @@ -0,0 +1,19 @@ +package com.baeldung.naming.entity; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.OneToMany; +import java.util.List; + +@Entity +public class Account { + + @Id private Long id; + + private String defaultEmail; + + @OneToMany List preferences; + + @Column(name = "\"Secondary_Email\"") private String secondaryEmail; +} diff --git a/persistence-modules/spring-boot-persistence/src/main/java/com/baeldung/naming/entity/Preference.java b/persistence-modules/spring-boot-persistence/src/main/java/com/baeldung/naming/entity/Preference.java new file mode 100644 index 0000000000..928884a2c5 --- /dev/null +++ b/persistence-modules/spring-boot-persistence/src/main/java/com/baeldung/naming/entity/Preference.java @@ -0,0 +1,16 @@ +package com.baeldung.naming.entity; + +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.ManyToOne; + +@Entity +public class Preference { + + @Id private Long id; + + private String name; + + @ManyToOne private Account account; + +} diff --git a/spring-boot-persistence/src/main/java/com/baeldung/repository/UserRepository.java b/persistence-modules/spring-boot-persistence/src/main/java/com/baeldung/repository/UserRepository.java similarity index 100% rename from spring-boot-persistence/src/main/java/com/baeldung/repository/UserRepository.java rename to persistence-modules/spring-boot-persistence/src/main/java/com/baeldung/repository/UserRepository.java diff --git a/persistence-modules/spring-boot-persistence/src/main/java/com/baeldung/springbootcrudapp/application/Application.java b/persistence-modules/spring-boot-persistence/src/main/java/com/baeldung/springbootcrudapp/application/Application.java new file mode 100644 index 0000000000..ad99f4b3f2 --- /dev/null +++ b/persistence-modules/spring-boot-persistence/src/main/java/com/baeldung/springbootcrudapp/application/Application.java @@ -0,0 +1,22 @@ +package com.baeldung.springbootcrudapp.application; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.boot.autoconfigure.EnableAutoConfiguration; +import org.springframework.boot.autoconfigure.domain.EntityScan; +import org.springframework.context.annotation.ComponentScan; +import org.springframework.data.jpa.repository.config.EnableJpaRepositories; +import org.springframework.transaction.annotation.EnableTransactionManagement; + +@SpringBootApplication +@EnableAutoConfiguration +@ComponentScan(basePackages={"com.baeldung.springbootcrudapp.application"}) +@EnableJpaRepositories(basePackages="com.baeldung.springbootcrudapp.application.repositories") +@EnableTransactionManagement +@EntityScan(basePackages="com.baeldung.springbootcrudapp.application.entities") +public class Application { + + public static void main(String[] args) { + SpringApplication.run(Application.class, args); + } +} diff --git a/persistence-modules/spring-boot-persistence/src/main/java/com/baeldung/springbootcrudapp/application/controllers/UserController.java b/persistence-modules/spring-boot-persistence/src/main/java/com/baeldung/springbootcrudapp/application/controllers/UserController.java new file mode 100644 index 0000000000..c55f1083ba --- /dev/null +++ b/persistence-modules/spring-boot-persistence/src/main/java/com/baeldung/springbootcrudapp/application/controllers/UserController.java @@ -0,0 +1,66 @@ +package com.baeldung.springbootcrudapp.application.controllers; + +import com.baeldung.springbootcrudapp.application.repositories.UserRepository; +import com.baeldung.springbootcrudapp.application.entities.User; +import javax.validation.Valid; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.ui.Model; +import org.springframework.validation.BindingResult; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; + +@Controller +public class UserController { + + private final UserRepository userRepository; + + @Autowired + public UserController(UserRepository userRepository) { + this.userRepository = userRepository; + } + + @GetMapping("/signup") + public String showSignUpForm(User user) { + return "add-user"; + } + + @PostMapping("/adduser") + public String addUser(@Valid User user, BindingResult result, Model model) { + if (result.hasErrors()) { + return "add-user"; + } + + userRepository.save(user); + model.addAttribute("users", userRepository.findAll()); + return "index"; + } + + @GetMapping("/edit/{id}") + public String showUpdateForm(@PathVariable("id") long id, Model model) { + User user = userRepository.findById(id).orElseThrow(() -> new IllegalArgumentException("Invalid user Id:" + id)); + model.addAttribute("user", user); + return "update-user"; + } + + @PostMapping("/update/{id}") + public String updateUser(@PathVariable("id") long id, @Valid User user, BindingResult result, Model model) { + if (result.hasErrors()) { + user.setId(id); + return "update-user"; + } + + userRepository.save(user); + model.addAttribute("users", userRepository.findAll()); + return "index"; + } + + @GetMapping("/delete/{id}") + public String deleteUser(@PathVariable("id") long id, Model model) { + User user = userRepository.findById(id).orElseThrow(() -> new IllegalArgumentException("Invalid user Id:" + id)); + userRepository.delete(user); + model.addAttribute("users", userRepository.findAll()); + return "index"; + } +} diff --git a/persistence-modules/spring-boot-persistence/src/main/java/com/baeldung/springbootcrudapp/application/entities/User.java b/persistence-modules/spring-boot-persistence/src/main/java/com/baeldung/springbootcrudapp/application/entities/User.java new file mode 100644 index 0000000000..145f251158 --- /dev/null +++ b/persistence-modules/spring-boot-persistence/src/main/java/com/baeldung/springbootcrudapp/application/entities/User.java @@ -0,0 +1,56 @@ +package com.baeldung.springbootcrudapp.application.entities; + +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.validation.constraints.NotBlank; + +@Entity +public class User { + + @Id + @GeneratedValue(strategy = GenerationType.AUTO) + private long id; + @NotBlank(message = "Name is mandatory") + private String name; + + @NotBlank(message = "Email is mandatory") + private String email; + + public User() {} + + public User(String name, String email) { + this.name = name; + this.email = email; + } + + public void setId(long id) { + this.id = id; + } + + public long getId() { + return id; + } + + public void setName(String name) { + this.name = name; + } + + public void setEmail(String email) { + this.email = email; + } + + public String getName() { + return name; + } + + public String getEmail() { + return email; + } + + @Override + public String toString() { + return "User{" + "id=" + id + ", name=" + name + ", email=" + email + '}'; + } +} diff --git a/persistence-modules/spring-boot-persistence/src/main/java/com/baeldung/springbootcrudapp/application/repositories/UserRepository.java b/persistence-modules/spring-boot-persistence/src/main/java/com/baeldung/springbootcrudapp/application/repositories/UserRepository.java new file mode 100644 index 0000000000..c69372aab4 --- /dev/null +++ b/persistence-modules/spring-boot-persistence/src/main/java/com/baeldung/springbootcrudapp/application/repositories/UserRepository.java @@ -0,0 +1,13 @@ +package com.baeldung.springbootcrudapp.application.repositories; + +import com.baeldung.springbootcrudapp.application.entities.User; +import java.util.List; +import org.springframework.data.repository.CrudRepository; +import org.springframework.stereotype.Repository; + +@Repository +public interface UserRepository extends CrudRepository { + + List findByName(String name); + +} diff --git a/spring-boot-persistence/src/main/java/com/baeldung/tomcatconnectionpool/application/SpringBootConsoleApplication.java b/persistence-modules/spring-boot-persistence/src/main/java/com/baeldung/tomcatconnectionpool/application/SpringBootConsoleApplication.java similarity index 97% rename from spring-boot-persistence/src/main/java/com/baeldung/tomcatconnectionpool/application/SpringBootConsoleApplication.java rename to persistence-modules/spring-boot-persistence/src/main/java/com/baeldung/tomcatconnectionpool/application/SpringBootConsoleApplication.java index ff37442cd4..5be61b972f 100644 --- a/spring-boot-persistence/src/main/java/com/baeldung/tomcatconnectionpool/application/SpringBootConsoleApplication.java +++ b/persistence-modules/spring-boot-persistence/src/main/java/com/baeldung/tomcatconnectionpool/application/SpringBootConsoleApplication.java @@ -1,22 +1,22 @@ -package com.baeldung.tomcatconnectionpool.application; - -import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.EnableAutoConfiguration; -import org.springframework.boot.autoconfigure.SpringBootApplication; -import org.springframework.boot.autoconfigure.domain.EntityScan; -import org.springframework.context.annotation.ComponentScan; -import org.springframework.data.jpa.repository.config.EnableJpaRepositories; -import org.springframework.transaction.annotation.EnableTransactionManagement; - -@SpringBootApplication -@EnableAutoConfiguration -@ComponentScan(basePackages={"com.baeldung.tomcatconnectionpool.application"}) -@EnableJpaRepositories(basePackages="com.baeldung.tomcatconnectionpool.application.repositories") -@EnableTransactionManagement -@EntityScan(basePackages="com.baeldung.tomcatconnectionpool.application.entities") -public class SpringBootConsoleApplication { - - public static void main(String[] args) { - SpringApplication.run(SpringBootConsoleApplication.class); - } -} +package com.baeldung.tomcatconnectionpool.application; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.EnableAutoConfiguration; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.boot.autoconfigure.domain.EntityScan; +import org.springframework.context.annotation.ComponentScan; +import org.springframework.data.jpa.repository.config.EnableJpaRepositories; +import org.springframework.transaction.annotation.EnableTransactionManagement; + +@SpringBootApplication +@EnableAutoConfiguration +@ComponentScan(basePackages={"com.baeldung.tomcatconnectionpool.application"}) +@EnableJpaRepositories(basePackages="com.baeldung.tomcatconnectionpool.application.repositories") +@EnableTransactionManagement +@EntityScan(basePackages="com.baeldung.tomcatconnectionpool.application.entities") +public class SpringBootConsoleApplication { + + public static void main(String[] args) { + SpringApplication.run(SpringBootConsoleApplication.class); + } +} diff --git a/spring-boot-persistence/src/main/java/com/baeldung/tomcatconnectionpool/application/entities/Customer.java b/persistence-modules/spring-boot-persistence/src/main/java/com/baeldung/tomcatconnectionpool/application/entities/Customer.java similarity index 95% rename from spring-boot-persistence/src/main/java/com/baeldung/tomcatconnectionpool/application/entities/Customer.java rename to persistence-modules/spring-boot-persistence/src/main/java/com/baeldung/tomcatconnectionpool/application/entities/Customer.java index 4003d5aca9..712506eb98 100644 --- a/spring-boot-persistence/src/main/java/com/baeldung/tomcatconnectionpool/application/entities/Customer.java +++ b/persistence-modules/spring-boot-persistence/src/main/java/com/baeldung/tomcatconnectionpool/application/entities/Customer.java @@ -1,53 +1,53 @@ -package com.baeldung.tomcatconnectionpool.application.entities; - -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.GeneratedValue; -import javax.persistence.GenerationType; -import javax.persistence.Id; -import javax.persistence.Table; - -@Entity -@Table(name = "customers") -public class Customer { - - @Id - @GeneratedValue(strategy = GenerationType.AUTO) - private long id; - @Column(name = "first_name") - private String firstName; - @Column(name = "last_name") - private String lastName; - - public Customer() {} - - public Customer(String firstName, String lastName) { - this.firstName = firstName; - this.lastName = lastName; - } - - public long getId() { - return id; - } - - public void setLastName(String lastName) { - this.lastName = lastName; - } - - public String getFirstName() { - return firstName; - } - - public void setFirstName(String firstName) { - this.firstName = firstName; - } - - public String getLastName() { - return lastName; - } - - @Override - public String toString() { - return "Customer{" + "id=" + id + ", firstName=" + firstName + ", lastName=" + lastName + '}'; - } -} +package com.baeldung.tomcatconnectionpool.application.entities; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.Table; + +@Entity +@Table(name = "customers") +public class Customer { + + @Id + @GeneratedValue(strategy = GenerationType.AUTO) + private long id; + @Column(name = "first_name") + private String firstName; + @Column(name = "last_name") + private String lastName; + + public Customer() {} + + public Customer(String firstName, String lastName) { + this.firstName = firstName; + this.lastName = lastName; + } + + public long getId() { + return id; + } + + public void setLastName(String lastName) { + this.lastName = lastName; + } + + public String getFirstName() { + return firstName; + } + + public void setFirstName(String firstName) { + this.firstName = firstName; + } + + public String getLastName() { + return lastName; + } + + @Override + public String toString() { + return "Customer{" + "id=" + id + ", firstName=" + firstName + ", lastName=" + lastName + '}'; + } +} diff --git a/spring-boot-persistence/src/main/java/com/baeldung/tomcatconnectionpool/application/repositories/CustomerRepository.java b/persistence-modules/spring-boot-persistence/src/main/java/com/baeldung/tomcatconnectionpool/application/repositories/CustomerRepository.java similarity index 97% rename from spring-boot-persistence/src/main/java/com/baeldung/tomcatconnectionpool/application/repositories/CustomerRepository.java rename to persistence-modules/spring-boot-persistence/src/main/java/com/baeldung/tomcatconnectionpool/application/repositories/CustomerRepository.java index 770906439c..c461243cf8 100644 --- a/spring-boot-persistence/src/main/java/com/baeldung/tomcatconnectionpool/application/repositories/CustomerRepository.java +++ b/persistence-modules/spring-boot-persistence/src/main/java/com/baeldung/tomcatconnectionpool/application/repositories/CustomerRepository.java @@ -1,12 +1,12 @@ -package com.baeldung.tomcatconnectionpool.application.repositories; - -import com.baeldung.tomcatconnectionpool.application.entities.Customer; -import java.util.List; -import org.springframework.data.repository.CrudRepository; -import org.springframework.stereotype.Repository; - -@Repository -public interface CustomerRepository extends CrudRepository { - - List findByLastName(String lastName); -} +package com.baeldung.tomcatconnectionpool.application.repositories; + +import com.baeldung.tomcatconnectionpool.application.entities.Customer; +import java.util.List; +import org.springframework.data.repository.CrudRepository; +import org.springframework.stereotype.Repository; + +@Repository +public interface CustomerRepository extends CrudRepository { + + List findByLastName(String lastName); +} diff --git a/spring-boot-persistence/src/main/java/com/baeldung/tomcatconnectionpool/application/runners/CommandLineCrudRunner.java b/persistence-modules/spring-boot-persistence/src/main/java/com/baeldung/tomcatconnectionpool/application/runners/CommandLineCrudRunner.java similarity index 97% rename from spring-boot-persistence/src/main/java/com/baeldung/tomcatconnectionpool/application/runners/CommandLineCrudRunner.java rename to persistence-modules/spring-boot-persistence/src/main/java/com/baeldung/tomcatconnectionpool/application/runners/CommandLineCrudRunner.java index 9666bac5a5..722c7582a1 100644 --- a/spring-boot-persistence/src/main/java/com/baeldung/tomcatconnectionpool/application/runners/CommandLineCrudRunner.java +++ b/persistence-modules/spring-boot-persistence/src/main/java/com/baeldung/tomcatconnectionpool/application/runners/CommandLineCrudRunner.java @@ -1,37 +1,37 @@ -package com.baeldung.tomcatconnectionpool.application.runners; - -import com.baeldung.tomcatconnectionpool.application.entities.Customer; -import com.baeldung.tomcatconnectionpool.application.repositories.CustomerRepository; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.CommandLineRunner; -import org.springframework.stereotype.Component; - -@Component -public class CommandLineCrudRunner implements CommandLineRunner { - - private static final Logger logger = LoggerFactory.getLogger(CommandLineCrudRunner.class); - - @Autowired - private CustomerRepository customerRepository; - - @Override - public void run(String... args) throws Exception { - customerRepository.save(new Customer("John", "Doe")); - customerRepository.save(new Customer("Jennifer", "Wilson")); - - logger.info("Customers found with findAll():"); - customerRepository.findAll().forEach(c -> logger.info(c.toString())); - - logger.info("Customer found with findById(1L):"); - Customer customer = customerRepository.findById(1L) - .orElseGet(() -> new Customer("Non-existing customer", "")); - logger.info(customer.toString()); - - logger.info("Customer found with findByLastName('Wilson'):"); - customerRepository.findByLastName("Wilson").forEach(c -> { - logger.info(c.toString()); - }); - } -} +package com.baeldung.tomcatconnectionpool.application.runners; + +import com.baeldung.tomcatconnectionpool.application.entities.Customer; +import com.baeldung.tomcatconnectionpool.application.repositories.CustomerRepository; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.CommandLineRunner; +import org.springframework.stereotype.Component; + +@Component +public class CommandLineCrudRunner implements CommandLineRunner { + + private static final Logger logger = LoggerFactory.getLogger(CommandLineCrudRunner.class); + + @Autowired + private CustomerRepository customerRepository; + + @Override + public void run(String... args) throws Exception { + customerRepository.save(new Customer("John", "Doe")); + customerRepository.save(new Customer("Jennifer", "Wilson")); + + logger.info("Customers found with findAll():"); + customerRepository.findAll().forEach(c -> logger.info(c.toString())); + + logger.info("Customer found with findById(1L):"); + Customer customer = customerRepository.findById(1L) + .orElseGet(() -> new Customer("Non-existing customer", "")); + logger.info(customer.toString()); + + logger.info("Customer found with findByLastName('Wilson'):"); + customerRepository.findByLastName("Wilson").forEach(c -> { + logger.info(c.toString()); + }); + } +} diff --git a/spring-boot-persistence/src/main/java/org/baeldung/boot/domain/GenericEntity.java b/persistence-modules/spring-boot-persistence/src/main/java/org/baeldung/boot/domain/GenericEntity.java similarity index 100% rename from spring-boot-persistence/src/main/java/org/baeldung/boot/domain/GenericEntity.java rename to persistence-modules/spring-boot-persistence/src/main/java/org/baeldung/boot/domain/GenericEntity.java diff --git a/spring-boot-persistence/src/main/java/org/baeldung/boot/repository/GenericEntityRepository.java b/persistence-modules/spring-boot-persistence/src/main/java/org/baeldung/boot/repository/GenericEntityRepository.java similarity index 100% rename from spring-boot-persistence/src/main/java/org/baeldung/boot/repository/GenericEntityRepository.java rename to persistence-modules/spring-boot-persistence/src/main/java/org/baeldung/boot/repository/GenericEntityRepository.java diff --git a/spring-boot-persistence/src/main/resources/application.properties b/persistence-modules/spring-boot-persistence/src/main/resources/application.properties similarity index 100% rename from spring-boot-persistence/src/main/resources/application.properties rename to persistence-modules/spring-boot-persistence/src/main/resources/application.properties diff --git a/persistence-modules/spring-boot-persistence/src/main/resources/css/shards.min.css b/persistence-modules/spring-boot-persistence/src/main/resources/css/shards.min.css new file mode 100644 index 0000000000..02260d25fa --- /dev/null +++ b/persistence-modules/spring-boot-persistence/src/main/resources/css/shards.min.css @@ -0,0 +1,2 @@ +@import url(https://fonts.googleapis.com/css?family=Poppins:300,400,500,600|Roboto+Mono);:root{--blue:#007bff;--indigo:#674eec;--purple:#8445f7;--pink:#ff4169;--red:#c4183c;--orange:#fb7906;--yellow:#ffb400;--green:#17c671;--teal:#1adba2;--cyan:#00b8d8;--white:#fff;--gray:#868e96;--gray-dark:#343a40;--primary:#007bff;--secondary:#5A6169;--success:#17c671;--info:#00b8d8;--warning:#ffb400;--danger:#c4183c;--light:#e9ecef;--dark:#212529;--breakpoint-xs:0;--breakpoint-sm:576px;--breakpoint-md:768px;--breakpoint-lg:992px;--breakpoint-xl:1200px;--font-family-sans-serif:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif;--font-family-monospace:"Roboto Mono",Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace}@media (max-width:575.98px){html{font-size:15px}}body{font-size:1rem;font-weight:300;color:#5a6169;background-color:#fff}a{color:#007bff;text-decoration:none}a:hover{color:#0056b3;text-decoration:underline}b,strong{font-weight:500}h1,h2,h3,h4,h5,h6{margin-top:0;margin-bottom:.5rem}.h1,.h2,.h3,.h4,.h5,.h6{display:block}.h1,.h2,.h3,.h4,.h5,.h6,h1,h2,h3,h4,h5,h6{margin-bottom:.75rem;font-family:Poppins,-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif;font-weight:400;color:#212529}.h1,h1{font-size:3.052rem;letter-spacing:-.0625rem;line-height:3rem}.h2,h2{font-size:2.441rem;letter-spacing:-.0625rem;line-height:2.25rem}.h3,h3{font-size:1.953rem;line-height:2.25rem}.h4,h4{font-size:1.563rem;line-height:2rem}.h5,h5{font-size:1.25rem;line-height:1.5rem}.h6,h6{font-size:1rem;line-height:1.5rem}.lead{line-height:1.875rem}.display-1,.display-2,.display-3,.display-4{margin-bottom:.75rem}.display-1{font-size:7.451rem;line-height:1}.display-2{font-size:5.96rem;line-height:1}.display-3{font-size:4.768rem;line-height:1}.display-4{font-size:3.815rem;line-height:1}p{margin-bottom:1.75rem}hr{margin-top:1.125rem;margin-bottom:1.125rem;border-top:1px solid rgba(0,0,0,.1)}.small,small{font-size:80%;font-weight:300}.mark,mark{padding:.2em;background-color:#fff09e}.blockquote{margin-bottom:.75rem;font-size:1.5rem}.blockquote-footer{font-size:1.125rem}.img-thumbnail{padding:0;border:none;background-color:#fff;border-radius:.375rem;box-shadow:none}.figure-img{margin-bottom:.75rem}.figure-caption{font-size:1rem;color:#868e96}code,kbd,pre,samp{font-family:"Roboto Mono",Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace}code{font-size:.75rem;padding:.1875rem .8125rem}kbd{padding:.1875rem .8125rem;font-size:.75rem;color:#fff;background-color:#212529;border-radius:.625rem;box-shadow:none}kbd kbd{font-weight:500}pre{margin-bottom:.75rem;font-size:.75rem;color:#212529;line-height:1.375rem}.pre-scrollable{max-height:340px}.table{background-color:transparent}.table td,.table th{padding:.75rem}.table .table{background-color:#fff}.table-sm td,.table-sm th{padding:.3rem}.table-primary,.table-primary>td,.table-primary>th{background-color:#b8daff}.table-hover .table-primary:hover{background-color:#9fcdff}.table-hover .table-primary:hover>td,.table-hover .table-primary:hover>th{background-color:#9fcdff}.table-secondary,.table-secondary>td,.table-secondary>th{background-color:#d1d3d5}.table-hover .table-secondary:hover{background-color:#c4c6c9}.table-hover .table-secondary:hover>td,.table-hover .table-secondary:hover>th{background-color:#c4c6c9}.table-success,.table-success>td,.table-success>th{background-color:#beefd7}.table-hover .table-success:hover{background-color:#aaeaca}.table-hover .table-success:hover>td,.table-hover .table-success:hover>th{background-color:#aaeaca}.table-info,.table-info>td,.table-info>th{background-color:#b8ebf4}.table-hover .table-info:hover{background-color:#a2e5f1}.table-hover .table-info:hover>td,.table-hover .table-info:hover>th{background-color:#a2e5f1}.table-warning,.table-warning>td,.table-warning>th{background-color:#ffeab8}.table-hover .table-warning:hover{background-color:#ffe29f}.table-hover .table-warning:hover>td,.table-hover .table-warning:hover>th{background-color:#ffe29f}.table-danger,.table-danger>td,.table-danger>th{background-color:#eebec8}.table-hover .table-danger:hover{background-color:#e9aab7}.table-hover .table-danger:hover>td,.table-hover .table-danger:hover>th{background-color:#e9aab7}.table-light,.table-light>td,.table-light>th{background-color:#f9fafb}.table-hover .table-light:hover{background-color:#eaedf1}.table-hover .table-light:hover>td,.table-hover .table-light:hover>th{background-color:#eaedf1}.table-dark,.table-dark>td,.table-dark>th{background-color:#c1c2c3}.table-hover .table-dark:hover{background-color:#b4b5b6}.table-hover .table-dark:hover>td,.table-hover .table-dark:hover>th{background-color:#b4b5b6}.table-active,.table-active>td,.table-active>th{background-color:rgba(0,0,0,.075)}.table-hover .table-active:hover{background-color:rgba(0,0,0,.075)}.table-hover .table-active:hover>td,.table-hover .table-active:hover>th{background-color:rgba(0,0,0,.075)}.table .thead-dark th{color:#fff;background-color:#212529;border-color:#32383e}.table .thead-light th{color:#495057;background-color:#e9ecef;border-color:#dee2e6}.table-dark{color:#fff;background-color:#212529}.table-dark td,.table-dark th,.table-dark thead th{border-color:#32383e}.table-dark.table-striped tbody tr:nth-of-type(odd){background-color:rgba(255,255,255,.05)}.table-dark.table-hover tbody tr:hover{background-color:rgba(255,255,255,.075)}.form-control{height:auto;padding:.5rem 1rem;font-size:.95rem;line-height:1.5;color:#495057;background-color:#fff;border:1px solid #becad6;font-weight:300;will-change:border-color,box-shadow;border-radius:.375rem;box-shadow:none;transition:box-shadow 250ms cubic-bezier(.27,.01,.38,1.06),border 250ms cubic-bezier(.27,.01,.38,1.06)}.form-control:hover{border-color:#8fa4b8}.form-control:focus{color:#495057;background-color:#fff;border-color:#007bff;box-shadow:0 .313rem .719rem rgba(0,123,255,.1),0 .156rem .125rem rgba(0,0,0,.06)}.form-control:focus:hover{border-color:#007bff}.form-control::-webkit-input-placeholder{color:#868e96}.form-control:-ms-input-placeholder{color:#868e96}.form-control::-ms-input-placeholder{color:#868e96}.form-control::placeholder{color:#868e96}.form-control:disabled,.form-control[readonly]{background-color:#f5f6f7}.form-control:disabled:hover,.form-control[readonly]:hover{border-color:#becad6;cursor:not-allowed}.form-control[readonly]:not(:disabled):focus{box-shadow:none;border-color:#becad6}select.form-control:not([size]):not([multiple]){height:calc(2.425rem + 2px)}select.form-control:focus::-ms-value{color:#495057;background-color:#fff}select.form-control:hover{cursor:pointer}form label:hover{cursor:pointer}.col-form-label{padding-top:calc(.5rem + 1px);padding-bottom:calc(.5rem + 1px);line-height:1.5}.col-form-label-lg{padding-top:calc(.75rem + 1px);padding-bottom:calc(.75rem + 1px);font-size:1.25rem;line-height:1.5}.col-form-label-sm{padding-top:calc(.35rem + 1px);padding-bottom:calc(.35rem + 1px);font-size:.875rem;line-height:1.5}.form-control-plaintext{padding-top:.5rem;padding-bottom:.5rem;line-height:1.5;font-weight:300}.form-control-sm,.input-group-sm>.form-control,.input-group-sm>.input-group-append>.btn,.input-group-sm>.input-group-append>.input-group-text,.input-group-sm>.input-group-middle>.input-group-text,.input-group-sm>.input-group-prepend>.btn,.input-group-sm>.input-group-prepend>.input-group-text{padding:.35rem .75rem;font-size:.875rem;line-height:1.5;border-radius:.35rem}.input-group-sm>.input-group-append>select.btn:not([size]):not([multiple]),.input-group-sm>.input-group-append>select.input-group-text:not([size]):not([multiple]),.input-group-sm>.input-group-middle>select.input-group-text:not([size]):not([multiple]),.input-group-sm>.input-group-prepend>select.btn:not([size]):not([multiple]),.input-group-sm>.input-group-prepend>select.input-group-text:not([size]):not([multiple]),.input-group-sm>select.form-control:not([size]):not([multiple]),select.form-control-sm:not([size]):not([multiple]){height:calc(2.0125rem + 2px)}.form-control-lg,.input-group-lg>.form-control,.input-group-lg>.input-group-append>.btn,.input-group-lg>.input-group-append>.input-group-text,.input-group-lg>.input-group-middle>.input-group-text,.input-group-lg>.input-group-prepend>.btn,.input-group-lg>.input-group-prepend>.input-group-text{padding:.75rem 1rem;font-size:1.25rem;line-height:1.5;border-radius:.5rem}.input-group-lg>.input-group-append>select.btn:not([size]):not([multiple]),.input-group-lg>.input-group-append>select.input-group-text:not([size]):not([multiple]),.input-group-lg>.input-group-middle>select.input-group-text:not([size]):not([multiple]),.input-group-lg>.input-group-prepend>select.btn:not([size]):not([multiple]),.input-group-lg>.input-group-prepend>select.input-group-text:not([size]):not([multiple]),.input-group-lg>select.form-control:not([size]):not([multiple]),select.form-control-lg:not([size]):not([multiple]){height:calc(3.375rem + 2px)}.form-group{margin-bottom:1rem}.form-text{margin-top:.25rem}.form-check{padding-left:1.25rem}.form-check-input{margin-top:.313rem;margin-left:-1.25rem}.form-check-input:disabled~.form-check-label{color:#868e96}.form-check-inline{margin-right:.75rem}.form-check-inline .form-check-input{margin-right:.3125rem}.valid-feedback{margin-top:.25rem;font-size:80%;color:#17c671}.valid-tooltip{background-color:rgba(23,198,113,.8)}.custom-select.is-valid,.form-control.is-valid,.was-validated .custom-select:valid,.was-validated .form-control:valid{border-color:#17c671;box-shadow:0 5px 11.5px rgba(23,198,113,.1)}.custom-select.is-valid:focus,.form-control.is-valid:focus,.was-validated .custom-select:valid:focus,.was-validated .form-control:valid:focus{box-shadow:0 5px 11.5px rgba(23,198,113,.1),0 1px 1px .1rem rgba(23,198,113,.2)}.custom-select.is-valid:hover,.form-control.is-valid:hover,.was-validated .custom-select:valid:hover,.was-validated .form-control:valid:hover{border-color:#17c671}.form-check-input.is-valid~.form-check-label,.was-validated .form-check-input:valid~.form-check-label{color:#17c671}.custom-control-input.is-valid~.custom-control-label,.was-validated .custom-control-input:valid~.custom-control-label{color:#17c671}.custom-control-input.is-valid~.custom-control-label::before,.was-validated .custom-control-input:valid~.custom-control-label::before{background-color:#57eca4;border-color:#2ae68b}.custom-control-input.is-valid:checked~.custom-control-label::before,.was-validated .custom-control-input:valid:checked~.custom-control-label::before{background-color:#2ae68b}.custom-control-input.is-valid:focus~.custom-control-label::before,.was-validated .custom-control-input:valid:focus~.custom-control-label::before{box-shadow:0 .313rem .719rem rgba(23,198,113,.1),0 .156rem .125rem rgba(0,0,0,.06)}.custom-file-input.is-valid~.custom-file-label,.was-validated .custom-file-input:valid~.custom-file-label{color:#17c671;border-color:#17c671}.custom-file-input.is-valid~.custom-file-label::after,.was-validated .custom-file-input:valid~.custom-file-label::after{background-color:#b3f6d5;border-color:#2ae68b;color:#17c671}.custom-file-input:focus.is-valid~.custom-file-label,.was-validated .custom-file-input:focus:valid~.custom-file-label{border-color:#17c671;box-shadow:0 5px 11.5px rgba(23,198,113,.1),0 1px 1px .1rem rgba(23,198,113,.2)}.custom-file-input:hover.is-valid~.custom-file-label,.was-validated .custom-file-input:hover:valid~.custom-file-label{border-color:#17c671}.custom-toggle .custom-control-input:not(:checked).is-valid~.custom-control-label::before,.was-validated .custom-toggle .custom-control-input:not(:checked):valid~.custom-control-label::before{background-color:#fff}.custom-toggle .custom-control-input.is-valid~.custom-control-label::before,.was-validated .custom-toggle .custom-control-input:valid~.custom-control-label::before{background-color:#17c671}.custom-toggle .custom-control-input.is-invalid~.custom-control-label::after,.was-validated .custom-toggle .custom-control-input:invalid~.custom-control-label::after{background-color:#eb8c95}.custom-toggle .custom-control-input.is-invalid:focus~.custom-control-label::before,.was-validated .custom-toggle .custom-control-input:invalid:focus~.custom-control-label::before{box-shadow:0 .313rem .719rem rgba(23,198,113,.1),0 .156rem .125rem rgba(0,0,0,.06)}.invalid-feedback{margin-top:.25rem;font-size:80%;color:#c4183c}.invalid-tooltip{background-color:rgba(196,24,60,.8)}.custom-select.is-invalid,.form-control.is-invalid,.was-validated .custom-select:invalid,.was-validated .form-control:invalid{border-color:#c4183c;box-shadow:0 5px 11.5px rgba(196,24,60,.1)}.custom-select.is-invalid:focus,.form-control.is-invalid:focus,.was-validated .custom-select:invalid:focus,.was-validated .form-control:invalid:focus{box-shadow:0 5px 11.5px rgba(196,24,60,.1),0 1px 1px .1rem rgba(196,24,60,.2)}.custom-select.is-invalid:hover,.form-control.is-invalid:hover,.was-validated .custom-select:invalid:hover,.was-validated .form-control:invalid:hover{border-color:#c4183c}.form-check-input.is-invalid~.form-check-label,.was-validated .form-check-input:invalid~.form-check-label{color:#c4183c}.custom-control-input.is-invalid~.custom-control-label,.was-validated .custom-control-input:invalid~.custom-control-label{color:#c4183c}.custom-control-input.is-invalid~.custom-control-label::before,.was-validated .custom-control-input:invalid~.custom-control-label::before{background-color:#ea5876;border-color:#e52a51}.custom-control-input.is-invalid:checked~.custom-control-label::before,.was-validated .custom-control-input:invalid:checked~.custom-control-label::before{background-color:#e52a51}.custom-control-input.is-invalid:focus~.custom-control-label::before,.was-validated .custom-control-input:invalid:focus~.custom-control-label::before{box-shadow:0 .313rem .719rem rgba(196,24,60,.1),0 .156rem .125rem rgba(0,0,0,.06)}.custom-file-input.is-invalid~.custom-file-label,.was-validated .custom-file-input:invalid~.custom-file-label{color:#c4183c;border-color:#c4183c}.custom-file-input.is-invalid~.custom-file-label::after,.was-validated .custom-file-input:invalid~.custom-file-label::after{background-color:#f6b2c0;border-color:#e52a51;color:#c4183c}.custom-file-input:focus.is-invalid~.custom-file-label,.was-validated .custom-file-input:focus:invalid~.custom-file-label{border-color:#c4183c;box-shadow:0 5px 11.5px rgba(196,24,60,.1),0 1px 1px .1rem rgba(196,24,60,.2)}.custom-file-input:hover.is-invalid~.custom-file-label,.was-validated .custom-file-input:hover:invalid~.custom-file-label{border-color:#c4183c}.custom-toggle .custom-control-input:not(:checked).is-invalid~.custom-control-label::before,.was-validated .custom-toggle .custom-control-input:not(:checked):invalid~.custom-control-label::before{background-color:#fff}.custom-toggle .custom-control-input.is-valid~.custom-control-label::before,.was-validated .custom-toggle .custom-control-input:valid~.custom-control-label::before{background-color:#17c671}.custom-toggle .custom-control-input.is-invalid~.custom-control-label::after,.was-validated .custom-toggle .custom-control-input:invalid~.custom-control-label::after{background-color:#eb8c95}.custom-toggle .custom-control-input.is-invalid:focus~.custom-control-label::before,.was-validated .custom-toggle .custom-control-input:invalid:focus~.custom-control-label::before{box-shadow:0 .313rem .719rem rgba(196,24,60,.1),0 .156rem .125rem rgba(0,0,0,.06)}@media (min-width:576px){.form-inline .form-check-input{margin-right:.313rem}}.btn{font-weight:300;font-family:Poppins,-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif;border:1px solid transparent;padding:.75rem 1.25rem;font-size:.875rem;line-height:1.125;border-radius:.375rem;transition:all 250ms cubic-bezier(.27,.01,.38,1.06)}.btn.hover,.btn:hover{cursor:pointer}.btn.focus,.btn:focus{box-shadow:none}.btn:not([disabled]):not(.disabled).active,.btn:not([disabled]):not(.disabled):active{background-image:none;box-shadow:none}.btn.btn-squared{border-radius:0}.btn.btn-pill{border-radius:50px}.btn-primary{color:#fff;border-color:#007bff;background-color:#007bff;box-shadow:none}.btn-primary:hover{color:#fff;background-color:#006fe6;border-color:#006fe6;box-shadow:0 5px 15px rgba(0,0,0,.05),0 4px 10px rgba(0,123,255,.25)}.btn-primary.focus,.btn-primary:focus{box-shadow:0 0 0 3px rgba(0,123,255,.15),0 3px 15px rgba(0,123,255,.2),0 2px 5px rgba(0,0,0,.1)}.btn-primary.disabled,.btn-primary:disabled{background-color:#007bff;border-color:#007bff;box-shadow:none;cursor:not-allowed}.btn-primary:not(:disabled):not(.disabled).active,.btn-primary:not(:disabled):not(.disabled):active,.show>.btn-primary.dropdown-toggle{color:#fff;background-color:#006fe6;border-color:#0062cc;background-image:none;box-shadow:inset 0 3px 5px rgba(0,0,0,.125)!important}.btn-secondary{color:#fff;border-color:#5a6169;background-color:#5a6169;box-shadow:none}.btn-secondary:hover{color:#fff;background-color:#4e545b;border-color:#4e545b;box-shadow:0 5px 15px rgba(0,0,0,.05),0 4px 10px rgba(90,97,105,.25)}.btn-secondary.focus,.btn-secondary:focus{box-shadow:0 0 0 3px rgba(90,97,105,.15),0 3px 15px rgba(90,97,105,.2),0 2px 5px rgba(0,0,0,.1)}.btn-secondary.disabled,.btn-secondary:disabled{background-color:#5a6169;border-color:#5a6169;box-shadow:none;cursor:not-allowed}.btn-secondary:not(:disabled):not(.disabled).active,.btn-secondary:not(:disabled):not(.disabled):active,.show>.btn-secondary.dropdown-toggle{color:#fff;background-color:#4e545b;border-color:#42484e;background-image:none;box-shadow:inset 0 3px 5px rgba(0,0,0,.125)!important}.btn-success{color:#fff;border-color:#17c671;background-color:#17c671;box-shadow:none}.btn-success:hover{color:#fff;background-color:#14af64;border-color:#14af64;box-shadow:0 5px 15px rgba(0,0,0,.05),0 4px 10px rgba(23,198,113,.25)}.btn-success.focus,.btn-success:focus{box-shadow:0 0 0 3px rgba(23,198,113,.15),0 3px 15px rgba(23,198,113,.2),0 2px 5px rgba(0,0,0,.1)}.btn-success.disabled,.btn-success:disabled{background-color:#17c671;border-color:#17c671;box-shadow:none;cursor:not-allowed}.btn-success:not(:disabled):not(.disabled).active,.btn-success:not(:disabled):not(.disabled):active,.show>.btn-success.dropdown-toggle{color:#fff;background-color:#14af64;border-color:#129857;background-image:none;box-shadow:inset 0 3px 5px rgba(0,0,0,.125)!important}.btn-info{color:#fff;border-color:#00b8d8;background-color:#00b8d8;box-shadow:none}.btn-info:hover{color:#fff;background-color:#00a2bf;border-color:#00a2bf;box-shadow:0 5px 15px rgba(0,0,0,.05),0 4px 10px rgba(0,184,216,.25)}.btn-info.focus,.btn-info:focus{box-shadow:0 0 0 3px rgba(0,184,216,.15),0 3px 15px rgba(0,184,216,.2),0 2px 5px rgba(0,0,0,.1)}.btn-info.disabled,.btn-info:disabled{background-color:#00b8d8;border-color:#00b8d8;box-shadow:none;cursor:not-allowed}.btn-info:not(:disabled):not(.disabled).active,.btn-info:not(:disabled):not(.disabled):active,.show>.btn-info.dropdown-toggle{color:#fff;background-color:#00a2bf;border-color:#008da5;background-image:none;box-shadow:inset 0 3px 5px rgba(0,0,0,.125)!important}.btn-warning{color:#212529;border-color:#ffb400;background-color:#ffb400;box-shadow:none}.btn-warning:hover{color:#212529;background-color:#e6a200;border-color:#e6a200;box-shadow:0 5px 15px rgba(0,0,0,.05),0 4px 10px rgba(255,180,0,.25)}.btn-warning.focus,.btn-warning:focus{box-shadow:0 0 0 3px rgba(255,180,0,.15),0 3px 15px rgba(255,180,0,.2),0 2px 5px rgba(0,0,0,.1)}.btn-warning.disabled,.btn-warning:disabled{background-color:#ffb400;border-color:#ffb400;box-shadow:none;cursor:not-allowed}.btn-warning:not(:disabled):not(.disabled).active,.btn-warning:not(:disabled):not(.disabled):active,.show>.btn-warning.dropdown-toggle{color:#212529;background-color:#e6a200;border-color:#cc9000;background-image:none;box-shadow:inset 0 3px 5px rgba(0,0,0,.125)!important}.btn-danger{color:#fff;border-color:#c4183c;background-color:#c4183c;box-shadow:none}.btn-danger:hover{color:#fff;background-color:#ad1535;border-color:#ad1535;box-shadow:0 5px 15px rgba(0,0,0,.05),0 4px 10px rgba(196,24,60,.25)}.btn-danger.focus,.btn-danger:focus{box-shadow:0 0 0 3px rgba(196,24,60,.15),0 3px 15px rgba(196,24,60,.2),0 2px 5px rgba(0,0,0,.1)}.btn-danger.disabled,.btn-danger:disabled{background-color:#c4183c;border-color:#c4183c;box-shadow:none;cursor:not-allowed}.btn-danger:not(:disabled):not(.disabled).active,.btn-danger:not(:disabled):not(.disabled):active,.show>.btn-danger.dropdown-toggle{color:#fff;background-color:#ad1535;border-color:#97122e;background-image:none;box-shadow:inset 0 3px 5px rgba(0,0,0,.125)!important}.btn-light{color:#212529;border-color:#e9ecef;background-color:#e9ecef;box-shadow:none}.btn-light:hover{color:#212529;background-color:#dadfe4;border-color:#dadfe4;box-shadow:0 5px 15px rgba(0,0,0,.05),0 4px 10px rgba(233,236,239,.25)}.btn-light.focus,.btn-light:focus{box-shadow:0 0 0 3px rgba(233,236,239,.15),0 3px 15px rgba(233,236,239,.2),0 2px 5px rgba(0,0,0,.1)}.btn-light.disabled,.btn-light:disabled{background-color:#e9ecef;border-color:#e9ecef;box-shadow:none;cursor:not-allowed}.btn-light:not(:disabled):not(.disabled).active,.btn-light:not(:disabled):not(.disabled):active,.show>.btn-light.dropdown-toggle{color:#212529;background-color:#dadfe4;border-color:#cbd3da;background-image:none;box-shadow:inset 0 3px 5px rgba(0,0,0,.125)!important}.btn-dark{color:#fff;border-color:#212529;background-color:#212529;box-shadow:none}.btn-dark:hover{color:#fff;background-color:#16181b;border-color:#16181b;box-shadow:0 5px 15px rgba(0,0,0,.05),0 4px 10px rgba(33,37,41,.25)}.btn-dark.focus,.btn-dark:focus{box-shadow:0 0 0 3px rgba(33,37,41,.15),0 3px 15px rgba(33,37,41,.2),0 2px 5px rgba(0,0,0,.1)}.btn-dark.disabled,.btn-dark:disabled{background-color:#212529;border-color:#212529;box-shadow:none;cursor:not-allowed}.btn-dark:not(:disabled):not(.disabled).active,.btn-dark:not(:disabled):not(.disabled):active,.show>.btn-dark.dropdown-toggle{color:#fff;background-color:#16181b;border-color:#0a0c0d;background-image:none;box-shadow:inset 0 3px 5px rgba(0,0,0,.125)!important}.btn-white{color:#212529;border-color:#fff;background-color:#fff;box-shadow:none}.btn-white:hover{color:#212529;background-color:#f2f2f2;border-color:#f2f2f2;box-shadow:0 5px 15px rgba(0,0,0,.05),0 4px 10px rgba(255,255,255,.25)}.btn-white.focus,.btn-white:focus{box-shadow:0 0 0 3px rgba(255,255,255,.15),0 3px 15px rgba(255,255,255,.2),0 2px 5px rgba(0,0,0,.1)}.btn-white.disabled,.btn-white:disabled{background-color:#fff;border-color:#fff;box-shadow:none;cursor:not-allowed}.btn-white:not(:disabled):not(.disabled).active,.btn-white:not(:disabled):not(.disabled):active,.show>.btn-white.dropdown-toggle{color:#212529;background-color:#f2f2f2;border-color:#e6e6e6;background-image:none;box-shadow:inset 0 3px 5px rgba(0,0,0,.125)!important}.btn-black{color:#fff;border-color:#000;background-color:#000;box-shadow:none}.btn-black:hover{color:#fff;background-color:#000;border-color:#000;box-shadow:0 5px 15px rgba(0,0,0,.05),0 4px 10px rgba(0,0,0,.25)}.btn-black.focus,.btn-black:focus{box-shadow:0 0 0 3px rgba(0,0,0,.15),0 3px 15px rgba(0,0,0,.2),0 2px 5px rgba(0,0,0,.1)}.btn-black.disabled,.btn-black:disabled{background-color:#000;border-color:#000;box-shadow:none;cursor:not-allowed}.btn-black:not(:disabled):not(.disabled).active,.btn-black:not(:disabled):not(.disabled):active,.show>.btn-black.dropdown-toggle{color:#fff;background-color:#000;border-color:#000;background-image:none;box-shadow:inset 0 3px 5px rgba(0,0,0,.125)!important}.btn-outline-primary{background-color:transparent;background-image:none;border-color:#007bff;color:#007bff}.btn-outline-primary:hover{color:#fff;background-color:#007bff;border-color:#007bff;box-shadow:0 5px 15px rgba(0,0,0,.05),0 4px 10px rgba(0,123,255,.25)}.btn-outline-primary.focus,.btn-outline-primary:focus{box-shadow:0 0 0 3px rgba(0,123,255,.15),0 3px 15px rgba(0,123,255,.2),0 2px 5px rgba(0,0,0,.1)!important}.btn-outline-primary.disabled,.btn-outline-primary:disabled{color:#007bff;background-color:transparent;box-shadow:none}.btn-outline-primary:not(:disabled):not(.disabled).active,.btn-outline-primary:not(:disabled):not(.disabled):active,.show>.btn-outline-primary.dropdown-toggle{color:#fff;background-color:#007bff;border-color:#007bff}.btn-outline-primary:not(:disabled):not(.disabled).active:focus,.btn-outline-primary:not(:disabled):not(.disabled):active:focus,.show>.btn-outline-primary.dropdown-toggle:focus{box-shadow:inset 0 3px 5px rgba(0,0,0,.125)!important}.btn-outline-secondary{background-color:transparent;background-image:none;border-color:#5a6169;color:#5a6169}.btn-outline-secondary:hover{color:#fff;background-color:#5a6169;border-color:#5a6169;box-shadow:0 5px 15px rgba(0,0,0,.05),0 4px 10px rgba(90,97,105,.25)}.btn-outline-secondary.focus,.btn-outline-secondary:focus{box-shadow:0 0 0 3px rgba(90,97,105,.15),0 3px 15px rgba(90,97,105,.2),0 2px 5px rgba(0,0,0,.1)!important}.btn-outline-secondary.disabled,.btn-outline-secondary:disabled{color:#5a6169;background-color:transparent;box-shadow:none}.btn-outline-secondary:not(:disabled):not(.disabled).active,.btn-outline-secondary:not(:disabled):not(.disabled):active,.show>.btn-outline-secondary.dropdown-toggle{color:#fff;background-color:#5a6169;border-color:#5a6169}.btn-outline-secondary:not(:disabled):not(.disabled).active:focus,.btn-outline-secondary:not(:disabled):not(.disabled):active:focus,.show>.btn-outline-secondary.dropdown-toggle:focus{box-shadow:inset 0 3px 5px rgba(0,0,0,.125)!important}.btn-outline-success{background-color:transparent;background-image:none;border-color:#17c671;color:#17c671}.btn-outline-success:hover{color:#fff;background-color:#17c671;border-color:#17c671;box-shadow:0 5px 15px rgba(0,0,0,.05),0 4px 10px rgba(23,198,113,.25)}.btn-outline-success.focus,.btn-outline-success:focus{box-shadow:0 0 0 3px rgba(23,198,113,.15),0 3px 15px rgba(23,198,113,.2),0 2px 5px rgba(0,0,0,.1)!important}.btn-outline-success.disabled,.btn-outline-success:disabled{color:#17c671;background-color:transparent;box-shadow:none}.btn-outline-success:not(:disabled):not(.disabled).active,.btn-outline-success:not(:disabled):not(.disabled):active,.show>.btn-outline-success.dropdown-toggle{color:#fff;background-color:#17c671;border-color:#17c671}.btn-outline-success:not(:disabled):not(.disabled).active:focus,.btn-outline-success:not(:disabled):not(.disabled):active:focus,.show>.btn-outline-success.dropdown-toggle:focus{box-shadow:inset 0 3px 5px rgba(0,0,0,.125)!important}.btn-outline-info{background-color:transparent;background-image:none;border-color:#00b8d8;color:#00b8d8}.btn-outline-info:hover{color:#fff;background-color:#00b8d8;border-color:#00b8d8;box-shadow:0 5px 15px rgba(0,0,0,.05),0 4px 10px rgba(0,184,216,.25)}.btn-outline-info.focus,.btn-outline-info:focus{box-shadow:0 0 0 3px rgba(0,184,216,.15),0 3px 15px rgba(0,184,216,.2),0 2px 5px rgba(0,0,0,.1)!important}.btn-outline-info.disabled,.btn-outline-info:disabled{color:#00b8d8;background-color:transparent;box-shadow:none}.btn-outline-info:not(:disabled):not(.disabled).active,.btn-outline-info:not(:disabled):not(.disabled):active,.show>.btn-outline-info.dropdown-toggle{color:#fff;background-color:#00b8d8;border-color:#00b8d8}.btn-outline-info:not(:disabled):not(.disabled).active:focus,.btn-outline-info:not(:disabled):not(.disabled):active:focus,.show>.btn-outline-info.dropdown-toggle:focus{box-shadow:inset 0 3px 5px rgba(0,0,0,.125)!important}.btn-outline-warning{background-color:transparent;background-image:none;border-color:#ffb400;color:#ffb400}.btn-outline-warning:hover{color:#212529;background-color:#ffb400;border-color:#ffb400;box-shadow:0 5px 15px rgba(0,0,0,.05),0 4px 10px rgba(255,180,0,.25)}.btn-outline-warning.focus,.btn-outline-warning:focus{box-shadow:0 0 0 3px rgba(255,180,0,.15),0 3px 15px rgba(255,180,0,.2),0 2px 5px rgba(0,0,0,.1)!important}.btn-outline-warning.disabled,.btn-outline-warning:disabled{color:#ffb400;background-color:transparent;box-shadow:none}.btn-outline-warning:not(:disabled):not(.disabled).active,.btn-outline-warning:not(:disabled):not(.disabled):active,.show>.btn-outline-warning.dropdown-toggle{color:#212529;background-color:#ffb400;border-color:#ffb400}.btn-outline-warning:not(:disabled):not(.disabled).active:focus,.btn-outline-warning:not(:disabled):not(.disabled):active:focus,.show>.btn-outline-warning.dropdown-toggle:focus{box-shadow:inset 0 3px 5px rgba(0,0,0,.125)!important}.btn-outline-danger{background-color:transparent;background-image:none;border-color:#c4183c;color:#c4183c}.btn-outline-danger:hover{color:#fff;background-color:#c4183c;border-color:#c4183c;box-shadow:0 5px 15px rgba(0,0,0,.05),0 4px 10px rgba(196,24,60,.25)}.btn-outline-danger.focus,.btn-outline-danger:focus{box-shadow:0 0 0 3px rgba(196,24,60,.15),0 3px 15px rgba(196,24,60,.2),0 2px 5px rgba(0,0,0,.1)!important}.btn-outline-danger.disabled,.btn-outline-danger:disabled{color:#c4183c;background-color:transparent;box-shadow:none}.btn-outline-danger:not(:disabled):not(.disabled).active,.btn-outline-danger:not(:disabled):not(.disabled):active,.show>.btn-outline-danger.dropdown-toggle{color:#fff;background-color:#c4183c;border-color:#c4183c}.btn-outline-danger:not(:disabled):not(.disabled).active:focus,.btn-outline-danger:not(:disabled):not(.disabled):active:focus,.show>.btn-outline-danger.dropdown-toggle:focus{box-shadow:inset 0 3px 5px rgba(0,0,0,.125)!important}.btn-outline-light{background-color:transparent;background-image:none;border-color:#e9ecef;color:#212529}.btn-outline-light:hover{color:#212529;background-color:#e9ecef;border-color:#e9ecef;box-shadow:0 5px 15px rgba(0,0,0,.05),0 4px 10px rgba(233,236,239,.25)}.btn-outline-light.focus,.btn-outline-light:focus{box-shadow:0 0 0 3px rgba(233,236,239,.15),0 3px 15px rgba(233,236,239,.2),0 2px 5px rgba(0,0,0,.1)!important}.btn-outline-light.disabled,.btn-outline-light:disabled{color:#e9ecef;background-color:transparent;box-shadow:none}.btn-outline-light:not(:disabled):not(.disabled).active,.btn-outline-light:not(:disabled):not(.disabled):active,.show>.btn-outline-light.dropdown-toggle{color:#212529;background-color:#e9ecef;border-color:#e9ecef}.btn-outline-light:not(:disabled):not(.disabled).active:focus,.btn-outline-light:not(:disabled):not(.disabled):active:focus,.show>.btn-outline-light.dropdown-toggle:focus{box-shadow:inset 0 3px 5px rgba(0,0,0,.125)!important}.btn-outline-dark{background-color:transparent;background-image:none;border-color:#212529;color:#212529}.btn-outline-dark:hover{color:#fff;background-color:#212529;border-color:#212529;box-shadow:0 5px 15px rgba(0,0,0,.05),0 4px 10px rgba(33,37,41,.25)}.btn-outline-dark.focus,.btn-outline-dark:focus{box-shadow:0 0 0 3px rgba(33,37,41,.15),0 3px 15px rgba(33,37,41,.2),0 2px 5px rgba(0,0,0,.1)!important}.btn-outline-dark.disabled,.btn-outline-dark:disabled{color:#212529;background-color:transparent;box-shadow:none}.btn-outline-dark:not(:disabled):not(.disabled).active,.btn-outline-dark:not(:disabled):not(.disabled):active,.show>.btn-outline-dark.dropdown-toggle{color:#fff;background-color:#212529;border-color:#212529}.btn-outline-dark:not(:disabled):not(.disabled).active:focus,.btn-outline-dark:not(:disabled):not(.disabled):active:focus,.show>.btn-outline-dark.dropdown-toggle:focus{box-shadow:inset 0 3px 5px rgba(0,0,0,.125)!important}.btn-outline-white{background-color:transparent;background-image:none;border-color:#fff;color:#212529;color:#fff}.btn-outline-white:hover{color:#212529;background-color:#fff;border-color:#fff;box-shadow:0 5px 15px rgba(0,0,0,.05),0 4px 10px rgba(255,255,255,.25)}.btn-outline-white.focus,.btn-outline-white:focus{box-shadow:0 0 0 3px rgba(255,255,255,.15),0 3px 15px rgba(255,255,255,.2),0 2px 5px rgba(0,0,0,.1)!important}.btn-outline-white.disabled,.btn-outline-white:disabled{color:#fff;background-color:transparent;box-shadow:none}.btn-outline-white:not(:disabled):not(.disabled).active,.btn-outline-white:not(:disabled):not(.disabled):active,.show>.btn-outline-white.dropdown-toggle{color:#212529;background-color:#fff;border-color:#fff}.btn-outline-white:not(:disabled):not(.disabled).active:focus,.btn-outline-white:not(:disabled):not(.disabled):active:focus,.show>.btn-outline-white.dropdown-toggle:focus{box-shadow:inset 0 3px 5px rgba(0,0,0,.125)!important}.btn-outline-white:not(:disabled):not(.disabled).active,.btn-outline-white:not(:disabled):not(.disabled):active{color:#000}.btn-outline-black{background-color:transparent;background-image:none;border-color:#000;color:#000;color:#000}.btn-outline-black:hover{color:#fff;background-color:#000;border-color:#000;box-shadow:0 5px 15px rgba(0,0,0,.05),0 4px 10px rgba(0,0,0,.25)}.btn-outline-black.focus,.btn-outline-black:focus{box-shadow:0 0 0 3px rgba(0,0,0,.15),0 3px 15px rgba(0,0,0,.2),0 2px 5px rgba(0,0,0,.1)!important}.btn-outline-black.disabled,.btn-outline-black:disabled{color:#000;background-color:transparent;box-shadow:none}.btn-outline-black:not(:disabled):not(.disabled).active,.btn-outline-black:not(:disabled):not(.disabled):active,.show>.btn-outline-black.dropdown-toggle{color:#fff;background-color:#000;border-color:#000}.btn-outline-black:not(:disabled):not(.disabled).active:focus,.btn-outline-black:not(:disabled):not(.disabled):active:focus,.show>.btn-outline-black.dropdown-toggle:focus{box-shadow:inset 0 3px 5px rgba(0,0,0,.125)!important}.btn-outline-black:not(:disabled):not(.disabled).active,.btn-outline-black:not(:disabled):not(.disabled):active{color:#fff}.btn-link{font-weight:300;color:#007bff}.btn-link:hover{color:#0056b3;text-decoration:underline}.btn-link.focus,.btn-link:focus{text-decoration:underline}.btn-link:disabled{color:#868e96}.btn-group-lg>.btn,.btn-lg{padding:.75rem 1.75rem;font-size:1.125rem;line-height:1.5;border-radius:.5rem}.btn-group-sm>.btn,.btn-sm{padding:.35rem 1rem;font-size:.75rem;line-height:1.5;border-radius:.35rem}.btn-block+.btn-block{margin-top:.5rem}.fade{transition:opacity .2s ease-in-out}.collapsing{transition:height 350ms ease-in-out}i.material-icons{font-size:inherit;position:relative;top:2px}.dropdown-menu{z-index:1000;min-width:10rem;padding:.5rem 0;margin:0 0 0;font-size:1rem;color:#5a6169;background-color:#fff;border:1px solid rgba(0,0,0,.05);border-radius:.375rem;box-shadow:0 .5rem 4rem rgba(0,0,0,.11),0 10px 20px rgba(0,0,0,.05),0 2px 3px rgba(0,0,0,.06)}.dropdown-menu-small{box-shadow:0 .5rem 2rem rgba(0,0,0,.11),0 3px 10px rgba(0,0,0,.05),0 2px 3px rgba(0,0,0,.06);padding:.25rem 0;font-size:.813rem}.dropdown-menu-small .dropdown-item{padding:.375rem .875rem;font-size:.813rem}.dropdown-menu-small .dropdown-divider{margin:.25rem 0}.dropup .dropdown-menu{margin-bottom:0}.dropright .dropdown-menu{margin-left:0}.dropleft .dropdown-menu{margin-right:0}.dropdown-divider{height:0;margin:.75rem 0;overflow:hidden;border-top:1px solid #e9ecef}.dropdown-item{padding:.5rem 1.25rem;font-weight:300;color:#212529;font-size:.9375rem;transition:background-color 250ms cubic-bezier(.27,.01,.38,1.06),color 250ms cubic-bezier(.27,.01,.38,1.06)}.dropdown-item:focus,.dropdown-item:hover{color:#16181b;background-color:#eceeef}.dropdown-item.active,.dropdown-item:active{color:#fff;background-color:#c3c7cc}.dropdown-item.disabled,.dropdown-item:disabled{color:#868e96}.dropdown-item.disabled:hover,.dropdown-item:disabled:hover{background:0 0;cursor:not-allowed}.dropdown-header{padding:.5rem 1.25rem;font-size:.875rem;color:#868e96}.btn-group .btn+.btn,.btn-group .btn+.btn-group,.btn-group .btn-group+.btn,.btn-group .btn-group+.btn-group,.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-left:-1px}.btn-group>.btn-group:not(:last-child)>.btn,.btn-group>.btn:not(:last-child):not(.dropdown-toggle){border-top-right-radius:0;border-bottom-right-radius:0}.btn-group>.btn-group:not(:first-child)>.btn,.btn-group>.btn:not(:first-child){border-top-left-radius:0;border-bottom-left-radius:0}.dropdown-toggle-split{padding-right:.9375rem;padding-left:.9375rem}.btn-group-sm>.btn+.dropdown-toggle-split,.btn-sm+.dropdown-toggle-split{padding-right:.75rem;padding-left:.75rem}.btn-group-lg>.btn+.dropdown-toggle-split,.btn-lg+.dropdown-toggle-split{padding-right:1.3125rem;padding-left:1.3125rem}.btn-group.show .dropdown-toggle{box-shadow:inset 0 3px 5px rgba(0,0,0,.125)}.btn-group.show .dropdown-toggle.btn-link{box-shadow: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}.btn-group-vertical>.btn-group:not(:last-child)>.btn,.btn-group-vertical>.btn:not(:last-child):not(.dropdown-toggle){border-bottom-right-radius:0;border-bottom-left-radius:0}.btn-group-vertical>.btn-group:not(:first-child)>.btn,.btn-group-vertical>.btn:not(:first-child){border-top-left-radius:0;border-top-right-radius:0}.input-group>.custom-file+.custom-file,.input-group>.custom-file+.custom-select,.input-group>.custom-file+.form-control,.input-group>.custom-select+.custom-file,.input-group>.custom-select+.custom-select,.input-group>.custom-select+.form-control,.input-group>.form-control+.custom-file,.input-group>.form-control+.custom-select,.input-group>.form-control+.form-control{margin-left:-1px}.input-group>.custom-select:not(:last-child),.input-group>.form-control:not(:last-child){border-top-right-radius:0;border-bottom-right-radius:0}.input-group>.custom-select:not(:first-child),.input-group>.form-control:not(:first-child){border-top-left-radius:0;border-bottom-left-radius:0}.input-group>.custom-file:not(:last-child) .custom-file-label,.input-group>.custom-file:not(:last-child) .custom-file-label::after{border-top-right-radius:0;border-bottom-right-radius:0}.input-group>.custom-file:not(:first-child) .custom-file-label,.input-group>.custom-file:not(:first-child) .custom-file-label::after{border-top-left-radius:0;border-bottom-left-radius:0}.input-group.input-group-seamless>.form-control{border-radius:.375rem}.input-group.input-group-seamless>.input-group-append,.input-group.input-group-seamless>.input-group-prepend{position:absolute;top:0;bottom:0;z-index:4}.input-group.input-group-seamless>.input-group-append .input-group-text,.input-group.input-group-seamless>.input-group-prepend .input-group-text{padding:12px 14px;background:0 0;border:none}.input-group.input-group-seamless>.input-group-append{right:0}.input-group.input-group-seamless>.input-group-middle{right:0;left:0}.input-group.input-group-seamless>.input-group-prepend{left:0}.input-group.input-group-seamless>.custom-select:not(:last-child),.input-group.input-group-seamless>.form-control:not(:last-child){padding-right:40px}.input-group.input-group-seamless>.custom-select:not(:first-child),.input-group.input-group-seamless>.form-control:not(:first-child){padding-left:40px}.input-group-append .btn+.btn,.input-group-append .btn+.input-group-text,.input-group-append .input-group-text+.btn,.input-group-append .input-group-text+.input-group-text,.input-group-prepend .btn+.btn,.input-group-prepend .btn+.input-group-text,.input-group-prepend .input-group-text+.btn,.input-group-prepend .input-group-text+.input-group-text{margin-left:-1px}.input-group-prepend{margin-right:-1px}.input-group-append{margin-left:-1px}.input-group-text{font-size:1rem;font-weight:300;line-height:1.5;color:#abb6bf;background-color:#f9fafb;border:1px solid #becad6;border-radius:.375rem}.input-group>.input-group-append:last-child>.btn:not(:last-child):not(.dropdown-toggle),.input-group>.input-group-append:last-child>.input-group-text:not(:last-child),.input-group>.input-group-append:not(:last-child)>.btn,.input-group>.input-group-append:not(:last-child)>.input-group-text,.input-group>.input-group-prepend>.btn,.input-group>.input-group-prepend>.input-group-text{border-top-right-radius:0;border-bottom-right-radius:0}.input-group>.input-group-append>.btn,.input-group>.input-group-append>.input-group-text,.input-group>.input-group-prepend:first-child>.btn:not(:first-child),.input-group>.input-group-prepend:first-child>.input-group-text:not(:first-child),.input-group>.input-group-prepend:not(:first-child)>.btn,.input-group>.input-group-prepend:not(:first-child)>.input-group-text{border-top-left-radius:0;border-bottom-left-radius:0}.input-group>.input-group-middle>.btn,.input-group>.input-group-middle>.input-group-text{border-left:0;border-right:0;border-radius:0}.input-group-middle{display:-ms-flexbox;display:flex}.custom-control{min-height:1.5rem;padding-left:1.688rem}.custom-control:hover{cursor:pointer}.custom-control .custom-control-label:before{pointer-events:all}.custom-control-inline{margin-right:1rem}.custom-control-input:checked~.custom-control-label::before{color:#fff;border-color:transparent;background-color:#007bff;box-shadow:none}.custom-control-input:focus~.custom-control-label::before{box-shadow:0 .313rem .719rem rgba(0,123,255,.1),0 .156rem .125rem rgba(0,0,0,.06)}.custom-control-input:active~.custom-control-label::before{color:#fff;background-color:#b3d7ff;box-shadow:none}.custom-control-input:disabled~.custom-control-label{color:#868e96}.custom-control-input:disabled~.custom-control-label:hover{cursor:not-allowed}.custom-control-input:disabled~.custom-control-label::before{background-color:#e9ecef}.custom-control-label{position:static}.custom-control-label:hover{cursor:pointer}.custom-control-label::before{top:.1875rem;left:0;width:1.125rem;height:1.125rem;background-color:#fff;border:1px solid #becad6;transition:all 250ms cubic-bezier(.27,.01,.38,1.06);box-shadow:none}.custom-control-label::after{top:.1875rem;width:1.125rem;height:1.125rem;background-size:50% 50%}.custom-checkbox .custom-control-label::before{border-radius:2px}.custom-checkbox .custom-control-label::after{content:'';position:absolute;top:5px;left:7px;width:5px;height:11px;opacity:0;-webkit-transform:rotate(45deg) scale(0);transform:rotate(45deg) scale(0);border-right:2px solid #fff;border-bottom:2px solid #fff;transition:border 250ms cubic-bezier(.27,.01,.38,1.06),-webkit-transform 250ms cubic-bezier(.27,.01,.38,1.06);transition:transform 250ms cubic-bezier(.27,.01,.38,1.06),border 250ms cubic-bezier(.27,.01,.38,1.06);transition:transform 250ms cubic-bezier(.27,.01,.38,1.06),border 250ms cubic-bezier(.27,.01,.38,1.06),-webkit-transform 250ms cubic-bezier(.27,.01,.38,1.06);transition-delay:.1s}.custom-checkbox .custom-control-input:checked~.custom-control-label::before{background-image:none}.custom-checkbox .custom-control-input:checked~.custom-control-label::after{opacity:1;-webkit-transform:rotate(45deg) scale(1);transform:rotate(45deg) scale(1);background-image:none}.custom-checkbox .custom-control-input:indeterminate~.custom-control-label::before{border:none;background-color:#007bff;box-shadow:none}.custom-checkbox .custom-control-input:indeterminate~.custom-control-label::after{content:'';position:absolute;-webkit-transform:scale(1);transform:scale(1);background-image:none;background-color:#fff;border:none;width:10px;height:2px;top:11px;left:4px;opacity:1;transition:none}.custom-checkbox .custom-control-input:disabled:checked~.custom-control-label::before{background:#e9ecef;border-color:#becad6}.custom-checkbox .custom-control-input:disabled:checked~.custom-control-label::after{border-color:#becad6}.custom-radio .custom-control-label::before{border-radius:50%}.custom-radio .custom-control-label::after{content:'';border-radius:50%;-webkit-transform:scale(0);transform:scale(0);background-image:none!important;position:absolute;background:#fff;width:8px;height:8px;top:8px;left:5px;transition:all 250ms cubic-bezier(.27,.01,.38,1.06);transition-delay:.1s;opacity:0;transform:scale(0)}.custom-radio .custom-control-input:checked~.custom-control-label::before{background-color:#007bff}.custom-radio .custom-control-input:checked~.custom-control-label::after{opacity:1;-webkit-transform:scale(1);transform:scale(1)}.custom-radio .custom-control-input:disabled:checked~.custom-control-label::before{background-color:#a8aeb4}.custom-radio .custom-control-input:disabled:checked~.custom-control-label::before{background:#e9ecef;border-color:#becad6}.custom-radio .custom-control-input:disabled:checked~.custom-control-label::after{background:#becad6}.custom-select{height:calc(2.425rem + 2px);padding:.375rem 1.75rem .375rem .75rem;line-height:1.2;color:#495057;background:#fff url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 4 5'%3E%3Cpath fill='%23333' d='M2 0L0 2h4zm0 5L0 3h4z'/%3E%3C/svg%3E") no-repeat right .75rem center;background-size:8px 10px;border:1px solid #becad6;font-weight:300;font-size:.95rem;transition:box-shadow 250ms cubic-bezier(.27,.01,.38,1.06),border 250ms cubic-bezier(.27,.01,.38,1.06);border-radius:.375rem}.custom-select:focus{border-color:#007bff;box-shadow:0 .313rem .719rem rgba(0,123,255,.1),0 .156rem .125rem rgba(0,0,0,.06)}.custom-select:focus::-ms-value{color:#495057;background-color:#fff}.custom-select:hover:not(:focus):not(:disabled){cursor:pointer;border-color:#8fa4b8}.custom-select[multiple],.custom-select[size]:not([size="1"]){padding-right:.75rem}.custom-select:disabled{color:#868e96;background-color:#e9ecef}.custom-select-sm{height:calc(2.0125rem + 2px);padding-top:.375rem;padding-bottom:.375rem;font-size:.75rem}.custom-select-lg{height:calc(3.375rem + 2px);font-size:1.25rem;padding-top:.375rem;padding-bottom:.375rem}.custom-file{height:calc(2.428rem + 2px);font-size:.95rem;transition:box-shadow 250ms cubic-bezier(.27,.01,.38,1.06),border 250ms cubic-bezier(.27,.01,.38,1.06)}.custom-file-input{min-width:14rem;height:calc(2.428rem + 2px)}.custom-file-input:focus~.custom-file-label{border-color:#007bff;color:#495057;box-shadow:0 .313rem .719rem rgba(0,123,255,.1),0 .156rem .125rem rgba(0,0,0,.06)}.custom-file-input:focus~.custom-file-label::after{border-color:#007bff;color:#007bff;background:#e6f2ff}.custom-file-input:focus~.custom-file-label:hover{border-color:#007bff}.custom-file-input:lang(en)~.custom-file-label::after{content:"Browse"}.custom-file-input:not(:disabled):hover{cursor:pointer}.custom-file-input:not(:disabled):hover~.custom-file-label,.custom-file-input:not(:disabled):hover~.custom-file-label:before{border-color:#8fa4b8}.custom-file-input:disabled+.custom-file-label{color:#868e96;background-color:#f8f9fa}.custom-file-label{height:calc(2.428rem + 2px);padding:.5rem 1rem;line-height:1.5;color:#495057;background-color:#fff;border:1px solid #becad6;font-weight:300;box-shadow:none;transition:box-shadow 250ms cubic-bezier(.27,.01,.38,1.06),border-color 250ms cubic-bezier(.27,.01,.38,1.06);border-radius:.375rem}.custom-file-label::after{padding:.5rem 1rem;height:calc(calc(2.428rem + 2px) - 1px * 2);line-height:1.5;color:#495057;border-left:1px solid #becad6;background-color:#e9ecef;border-radius:0 .375rem .375rem 0}.custom-toggle{position:relative;padding-left:3.75rem}.custom-toggle .custom-control-label::before{position:absolute;top:0;left:0;display:block;width:3.125rem;height:1.75rem;background:#fff;border-radius:100px;border:.0625rem solid #becad6}.custom-toggle .custom-control-label::after{content:'';position:absolute;top:.25rem;left:.25rem;width:1.25rem;height:1.25rem;background:#becad6;border-radius:6.25rem;transition:350ms}.custom-toggle .custom-control-input:checked~.custom-control-label::before{background:#17c671;border-color:#17c671}.custom-toggle .custom-control-input:checked~.custom-control-label::after{left:2.875rem;-webkit-transform:translateX(-100%);transform:translateX(-100%);background:#fff}.custom-toggle .custom-control-input:checked:disabled~.custom-control-label::before{background:#e9ecef;border-color:#becad6}.custom-toggle .custom-control-input:checked:disabled~.custom-control-label::after{background:#becad6}.custom-toggle .custom-control-input:active:not(:disabled)~.custom-control-label::after{width:1.625rem}.custom-toggle .custom-control-input:active:not(:checked)~.custom-control-label::before{background-color:#fff}.custom-toggle .custom-control-input:disabled:active~.custom-control-label::before{background-color:#e9ecef}.custom-toggle .custom-control-input:focus~.custom-control-label::before{box-shadow:0 .313rem .719rem rgba(23,198,113,.1),0 .156rem .125rem rgba(0,0,0,.06)}.custom-toggle .custom-control-input:focus:not(:checked)~.custom-control-label::before{box-shadow:0 .313rem .719rem rgba(0,123,255,.1),0 .156rem .125rem rgba(0,0,0,.06)}.custom-toggle.custom-toggle-sm{padding-left:2.625rem}.custom-toggle.custom-toggle-sm .custom-control-label::before{top:.1875rem;position:absolute;display:block;width:2.1875rem;height:1.125rem;background:#fff;border-radius:100px;border:.0625rem solid #becad6}.custom-toggle.custom-toggle-sm .custom-control-label::after{content:'';position:absolute;top:.375rem;left:.1875rem;width:.75rem;height:.75rem}.custom-toggle.custom-toggle-sm .custom-control-input:checked~.custom-control-label::after{left:1.9375rem}.custom-toggle.custom-toggle-sm .custom-control-input:active:not(:disabled)~.custom-control-label::after{width:1rem}.nav{font-size:.875rem;font-family:Poppins,-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif}.nav-link{padding:.625rem 1.125rem;transition:all 250ms cubic-bezier(.27,.01,.38,1.06)}.nav-link.disabled{color:#868e96}.nav-tabs{border-bottom:1px solid #d1d4d8}.nav-tabs .nav-item{margin-bottom:-1px}.nav-tabs .nav-link{border:1px solid transparent;border-top-left-radius:.375rem;border-top-right-radius:.375rem}.nav-tabs .nav-link:focus,.nav-tabs .nav-link:hover{border-color:#e9ecef}.nav-tabs .nav-link.disabled{color:#868e96}.nav-tabs .nav-link.disabled:hover{cursor:not-allowed;border-color:transparent}.nav-tabs .nav-link:hover{border-color:#e7e9ea}.nav-tabs .nav-item.show .nav-link,.nav-tabs .nav-link.active{color:#495057;background-color:#fff;border-color:#ddd}.nav-tabs .dropdown-menu{margin-top:-1px;border-top-left-radius:0;border-top-right-radius:0}.nav-pills .nav-link{border-radius:.375rem}.nav-pills .nav-link.active,.nav-pills .show>.nav-link{color:#fff;background-color:#007bff}.nav-pills:hover{background-color:#fdfdfd}.nav-outlined-pills .nav-link{border-radius:.375rem;border:1px solid transparent}.nav-outlined-pills .nav-link.active,.show>.nav-outlined-pills .nav-link{background:0 0;color:#007bff;border-color:#007bff}.nav-outlined-pills .nav-link:hover{border-color:#e7e9ea}.nav-blue .nav-link.active{background-color:#007bff;border-color:#0074f0;color:#fff}.nav-blue .nav-link.disabled{color:#868e96}.nav-blue .nav-link.disabled:hover{cursor:not-allowed;border-color:transparent}.nav-blue .nav-link{color:#007bff}.nav-blue.nav-outlined-pills .nav-link.active{background:0 0;border-color:#3395ff;color:#007bff}.nav-blue.nav-outlined-pills .nav-link.active:hover{border-color:#3395ff}.nav-blue.nav-outlined-pills .nav-link{color:#007bff}.nav-indigo .nav-link.active{background-color:#674eec;border-color:#5b40eb;color:#fff}.nav-indigo .nav-link.disabled{color:#868e96}.nav-indigo .nav-link.disabled:hover{cursor:not-allowed;border-color:transparent}.nav-indigo .nav-link{color:#674eec}.nav-indigo.nav-outlined-pills .nav-link.active{background:0 0;border-color:#8f7cf1;color:#674eec}.nav-indigo.nav-outlined-pills .nav-link.active:hover{border-color:#8f7cf1}.nav-indigo.nav-outlined-pills .nav-link{color:#674eec}.nav-purple .nav-link.active{background-color:#8445f7;border-color:#7a36f6;color:#fff}.nav-purple .nav-link.disabled{color:#868e96}.nav-purple .nav-link.disabled:hover{cursor:not-allowed;border-color:transparent}.nav-purple .nav-link{color:#8445f7}.nav-purple.nav-outlined-pills .nav-link.active{background:0 0;border-color:#a476f9;color:#8445f7}.nav-purple.nav-outlined-pills .nav-link.active:hover{border-color:#a476f9}.nav-purple.nav-outlined-pills .nav-link{color:#8445f7}.nav-pink .nav-link.active{background-color:#ff4169;border-color:#ff325d;color:#fff}.nav-pink .nav-link.disabled{color:#868e96}.nav-pink .nav-link.disabled:hover{cursor:not-allowed;border-color:transparent}.nav-pink .nav-link{color:#ff4169}.nav-pink.nav-outlined-pills .nav-link.active{background:0 0;border-color:#ff7491;color:#ff4169}.nav-pink.nav-outlined-pills .nav-link.active:hover{border-color:#ff7491}.nav-pink.nav-outlined-pills .nav-link{color:#ff4169}.nav-red .nav-link.active{background-color:#c4183c;border-color:#b61638;color:#fff}.nav-red .nav-link.disabled{color:#868e96}.nav-red .nav-link.disabled:hover{cursor:not-allowed;border-color:transparent}.nav-red .nav-link{color:#c4183c}.nav-red.nav-outlined-pills .nav-link.active{background:0 0;border-color:#e52a51;color:#c4183c}.nav-red.nav-outlined-pills .nav-link.active:hover{border-color:#e52a51}.nav-red.nav-outlined-pills .nav-link{color:#c4183c}.nav-orange .nav-link.active{background-color:#fb7906;border-color:#ee7204;color:#fff}.nav-orange .nav-link.disabled{color:#868e96}.nav-orange .nav-link.disabled:hover{cursor:not-allowed;border-color:transparent}.nav-orange .nav-link{color:#fb7906}.nav-orange.nav-outlined-pills .nav-link.active{background:0 0;border-color:#fc9438;color:#fb7906}.nav-orange.nav-outlined-pills .nav-link.active:hover{border-color:#fc9438}.nav-orange.nav-outlined-pills .nav-link{color:#fb7906}.nav-yellow .nav-link.active{background-color:#ffb400;border-color:#f0a900;color:#212529}.nav-yellow .nav-link.disabled{color:#868e96}.nav-yellow .nav-link.disabled:hover{cursor:not-allowed;border-color:transparent}.nav-yellow .nav-link{color:#ffb400}.nav-yellow.nav-outlined-pills .nav-link.active{background:0 0;border-color:#ffc333;color:#ffb400}.nav-yellow.nav-outlined-pills .nav-link.active:hover{border-color:#ffc333}.nav-yellow.nav-outlined-pills .nav-link{color:#ffb400}.nav-green .nav-link.active{background-color:#17c671;border-color:#15b869;color:#fff}.nav-green .nav-link.disabled{color:#868e96}.nav-green .nav-link.disabled:hover{cursor:not-allowed;border-color:transparent}.nav-green .nav-link{color:#17c671}.nav-green.nav-outlined-pills .nav-link.active{background:0 0;border-color:#2ae68b;color:#17c671}.nav-green.nav-outlined-pills .nav-link.active:hover{border-color:#2ae68b}.nav-green.nav-outlined-pills .nav-link{color:#17c671}.nav-teal .nav-link.active{background-color:#1adba2;border-color:#18cd98;color:#212529}.nav-teal .nav-link.disabled{color:#868e96}.nav-teal .nav-link.disabled:hover{cursor:not-allowed;border-color:transparent}.nav-teal .nav-link{color:#1adba2}.nav-teal.nav-outlined-pills .nav-link.active{background:0 0;border-color:#40e8b7;color:#1adba2}.nav-teal.nav-outlined-pills .nav-link.active:hover{border-color:#40e8b7}.nav-teal.nav-outlined-pills .nav-link{color:#1adba2}.nav-cyan .nav-link.active{background-color:#00b8d8;border-color:#00abc9;color:#fff}.nav-cyan .nav-link.disabled{color:#868e96}.nav-cyan .nav-link.disabled:hover{cursor:not-allowed;border-color:transparent}.nav-cyan .nav-link{color:#00b8d8}.nav-cyan.nav-outlined-pills .nav-link.active{background:0 0;border-color:#0cdbff;color:#00b8d8}.nav-cyan.nav-outlined-pills .nav-link.active:hover{border-color:#0cdbff}.nav-cyan.nav-outlined-pills .nav-link{color:#00b8d8}.nav-white .nav-link.active{background-color:#fff;border-color:#f7f7f7;color:#212529}.nav-white .nav-link.disabled{color:#868e96}.nav-white .nav-link.disabled:hover{cursor:not-allowed;border-color:transparent}.nav-white .nav-link{color:#fff}.nav-white.nav-outlined-pills .nav-link.active{background:0 0;border-color:#fff;color:#fff}.nav-white.nav-outlined-pills .nav-link.active:hover{border-color:#fff}.nav-white.nav-outlined-pills .nav-link{color:#fff}.nav-gray .nav-link.active{background-color:#868e96;border-color:#7e868f;color:#fff}.nav-gray .nav-link.disabled{color:#868e96}.nav-gray .nav-link.disabled:hover{cursor:not-allowed;border-color:transparent}.nav-gray .nav-link{color:#868e96}.nav-gray.nav-outlined-pills .nav-link.active{background:0 0;border-color:#a1a8ae;color:#868e96}.nav-gray.nav-outlined-pills .nav-link.active:hover{border-color:#a1a8ae}.nav-gray.nav-outlined-pills .nav-link{color:#868e96}.nav-gray-dark .nav-link.active{background-color:#343a40;border-color:#2d3238;color:#fff}.nav-gray-dark .nav-link.disabled{color:#868e96}.nav-gray-dark .nav-link.disabled:hover{cursor:not-allowed;border-color:transparent}.nav-gray-dark .nav-link{color:#343a40}.nav-gray-dark.nav-outlined-pills .nav-link.active{background:0 0;border-color:#4b545c;color:#343a40}.nav-gray-dark.nav-outlined-pills .nav-link.active:hover{border-color:#4b545c}.nav-gray-dark.nav-outlined-pills .nav-link{color:#343a40}.navbar{padding:.75rem 1.5rem}.navbar-brand{padding-top:.625rem;padding-bottom:.625rem;margin-right:1.5rem;font-size:1rem;font-family:Poppins,-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif;font-weight:400}.navbar-text{padding-top:.625rem;padding-bottom:.625rem}.navbar-toggler{padding:.5rem .5rem;font-size:1rem;background:#fff;border:1px solid transparent;border-radius:.375rem}@media (min-width:576px){.navbar-expand-sm .navbar-nav .nav-link{padding-right:.625rem;padding-left:.625rem}}@media (min-width:768px){.navbar-expand-md .navbar-nav .nav-link{padding-right:.625rem;padding-left:.625rem}}@media (min-width:992px){.navbar-expand-lg .navbar-nav .nav-link{padding-right:.625rem;padding-left:.625rem}}@media (min-width:1200px){.navbar-expand-xl .navbar-nav .nav-link{padding-right:.625rem;padding-left:.625rem}}.navbar-expand .navbar-nav .nav-link{padding-right:.625rem;padding-left:.625rem}.navbar-light .navbar-brand{color:rgba(0,0,0,.9)}.navbar-light .navbar-brand:focus,.navbar-light .navbar-brand:hover{color:rgba(0,0,0,.9)}.navbar-light .navbar-nav .nav-link{color:rgba(0,0,0,.5)}.navbar-light .navbar-nav .nav-link:focus,.navbar-light .navbar-nav .nav-link:hover{color:rgba(0,0,0,.7)}.navbar-light .navbar-nav .nav-link.disabled{color:rgba(0,0,0,.3)}.navbar-light .navbar-nav .active>.nav-link,.navbar-light .navbar-nav .nav-link.active,.navbar-light .navbar-nav .nav-link.show,.navbar-light .navbar-nav .show>.nav-link{color:rgba(0,0,0,.9)}.navbar-light .navbar-toggler{color:rgba(0,0,0,.5);border-color:rgba(0,0,0,.1);background:0 0}.navbar-light .navbar-toggler-icon{background-image:url("data:image/svg+xml;charset=utf8,%3Csvg viewBox='0 0 30 30' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath stroke='rgba(0, 0, 0, 0.5)' stroke-width='2' stroke-linecap='round' stroke-miterlimit='10' d='M4 7h22M4 15h22M4 23h22'/%3E%3C/svg%3E")}.navbar-light .navbar-text{color:rgba(0,0,0,.5)}.navbar-light .navbar-text a{color:rgba(0,0,0,.9)}.navbar-light .navbar-text a:focus,.navbar-light .navbar-text a:hover{color:rgba(0,0,0,.9)}.navbar-dark .navbar-brand{color:#fff}.navbar-dark .navbar-brand:focus,.navbar-dark .navbar-brand:hover{color:#fff}.navbar-dark .navbar-nav .nav-link{color:rgba(255,255,255,.5)}.navbar-dark .navbar-nav .nav-link:focus,.navbar-dark .navbar-nav .nav-link:hover{color:rgba(255,255,255,.75)}.navbar-dark .navbar-nav .nav-link.disabled{color:rgba(255,255,255,.25)}.navbar-dark .navbar-nav .active>.nav-link,.navbar-dark .navbar-nav .nav-link.active,.navbar-dark .navbar-nav .nav-link.show,.navbar-dark .navbar-nav .show>.nav-link{color:#fff}.navbar-dark .navbar-toggler{color:rgba(255,255,255,.5);border-color:rgba(255,255,255,.1);background:0 0}.navbar-dark .navbar-toggler-icon{background-image:url("data:image/svg+xml;charset=utf8,%3Csvg viewBox='0 0 30 30' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath stroke='rgba(255, 255, 255, 0.5)' stroke-width='2' stroke-linecap='round' stroke-miterlimit='10' d='M4 7h22M4 15h22M4 23h22'/%3E%3C/svg%3E")}.navbar-dark .navbar-text{color:rgba(255,255,255,.5)}.navbar-dark .navbar-text a{color:#fff}.navbar-dark .navbar-text a:focus,.navbar-dark .navbar-text a:hover{color:#fff}.card{background-color:#fff;border:none;border-radius:.625rem;box-shadow:0 .46875rem 2.1875rem rgba(90,97,105,.1),0 .9375rem 1.40625rem rgba(90,97,105,.1),0 .25rem .53125rem rgba(90,97,105,.12),0 .125rem .1875rem rgba(90,97,105,.1)}.card>.list-group:first-child .list-group-item:first-child{border-top-left-radius:.625rem;border-top-right-radius:.625rem}.card>.list-group:last-child .list-group-item:last-child{border-bottom-right-radius:.625rem;border-bottom-left-radius:.625rem}.card .list-group-item{padding:.8125rem 1.875rem}.card .card-text{margin-bottom:1.5625rem}.card a:hover{text-decoration:none}.card-small{box-shadow:0 2px 0 rgba(90,97,105,.11),0 4px 8px rgba(90,97,105,.12),0 10px 10px rgba(90,97,105,.06),0 7px 70px rgba(90,97,105,.1)}.card-small .card-body,.card-small .card-footer,.card-small .card-header{padding:1rem 1rem}.card-body{padding:1.875rem}.card-body>p:last-child{margin-bottom:0}.card-title{font-weight:500;margin-bottom:.75rem}.card-subtitle{margin-top:-1.09375rem}.card-link{font-family:Poppins,-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif}.card-link+.card-link{margin-left:1.875rem}.card-header{padding:1.09375rem 1.875rem;background-color:rgba(90,97,105,.06);border-bottom:none}.card-header:first-child{border-radius:.625rem .625rem 0 0}.card-footer{padding:1.09375rem 1.875rem;background-color:rgba(90,97,105,.06);border-top:none}.card-footer:last-child{border-radius:0 0 .625rem .625rem}.card-header-tabs{margin-bottom:-1rem;border-bottom:0}.card-header-tabs .nav-link,.card-header-tabs .nav-link:hover{border-bottom:transparent}.card-header-pills{margin-right:-.9375rem;margin-left:-.9375rem}.card-header-pills:hover{background:0 0}.card-img-overlay{padding:1.875rem 2.1875rem;background:rgba(90,97,105,.5);border-radius:.625rem}.card-img-overlay .card-title{color:#fff}.card-img{border-radius:.625rem}.card-img-top{border-top-left-radius:.625rem;border-top-right-radius:.625rem}.card-img-bottom{border-bottom-right-radius:.625rem;border-bottom-left-radius:.625rem}.card-deck .card{margin-bottom:.9375rem}@media (min-width:576px){.card-deck{margin-right:-.9375rem;margin-left:-.9375rem}.card-deck .card{margin-right:.9375rem;margin-left:.9375rem}}.card-group>.card{box-shadow:0 .46875rem 2.1875rem rgba(90,97,105,.1),0 .9375rem 1.40625rem rgba(90,97,105,.1),0 .25rem .53125rem rgba(90,97,105,.12),0 .125rem .1875rem rgba(90,97,105,.1)}.card-group>.card:last-child .card-body,.card-group>.card:last-child .card-footer{border-right:none}.card-group .card-body,.card-group .card-footer{border-right:1px solid #e7e9ea}@media (min-width:576px){.card-group{box-shadow:0 .46875rem 2.1875rem rgba(90,97,105,.1),0 .9375rem 1.40625rem rgba(90,97,105,.1),0 .25rem .53125rem rgba(90,97,105,.12),0 .125rem .1875rem rgba(90,97,105,.1);border-radius:.625rem}.card-group>.card{box-shadow:none}.card-group>.card:first-child{border-top-right-radius:0;border-bottom-right-radius:0}.card-group>.card:last-child{border-top-left-radius:0;border-bottom-left-radius:0}.card-group>.card:only-child{border-radius:.625rem}.card-group>.card:only-child .card-header,.card-group>.card:only-child .card-img-top{border-top-left-radius:.625rem;border-top-right-radius:.625rem}.card-group>.card:only-child .card-footer,.card-group>.card:only-child .card-img-bottom{border-bottom-right-radius:.625rem;border-bottom-left-radius:.625rem}.card-group>.card:not(:first-child):not(:last-child):not(:only-child){border-radius:0}.card-group>.card:not(:first-child):not(:last-child):not(:only-child) .card-footer,.card-group>.card:not(:first-child):not(:last-child):not(:only-child) .card-header,.card-group>.card:not(:first-child):not(:last-child):not(:only-child) .card-img-bottom,.card-group>.card:not(:first-child):not(:last-child):not(:only-child) .card-img-top{border-radius:0}}.card-columns .card{margin-bottom:2.1875rem}@media (min-width:576px){.card-columns{-webkit-column-count:3;column-count:3;-webkit-column-gap:1.25rem;column-gap:1.25rem}}.pagination{padding-left:0;list-style:none;border-radius:.375rem;font-family:Poppins,-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif;font-size:.875rem}.page-link{padding:.5rem .75rem;line-height:1.25;color:#007bff;background-color:#fff;border:none;margin:0;transition:all 250ms cubic-bezier(.27,.01,.38,1.06)}.page-link:focus,.page-link:hover{color:#0056b3;background-color:#f5f5f6;border-color:#dfe1e3}.page-item{box-shadow:0 .125rem .9375rem rgba(90,97,105,.1),0 .125rem .1875rem rgba(90,97,105,.15)}.page-item:first-child{border-top-left-radius:.375rem;border-bottom-left-radius:.375rem;overflow:hidden}.page-item:last-child{border-top-right-radius:.375rem;border-bottom-right-radius:.375rem;overflow:hidden}.page-item:last-child .page-link{border-right:none}.page-item.active .page-link{color:#fff;background-color:#007bff;border-color:#007bff}.page-item.disabled .page-link{color:#a8aeb4;background-color:#fff;border-color:#dfe1e3}.pagination-lg .page-link{padding:.9375rem 1.5625rem;font-size:1.25rem;line-height:1.5}.pagination-lg .page-item:first-child .page-link{border-top-left-radius:.5rem;border-bottom-left-radius:.5rem}.pagination-lg .page-item:last-child .page-link{border-top-right-radius:.5rem;border-bottom-right-radius:.5rem}.pagination-sm .page-link{padding:.25rem .6875rem;font-size:.875rem;line-height:1.5}.pagination-sm .page-item:first-child .page-link{border-top-left-radius:.35rem;border-bottom-left-radius:.35rem}.pagination-sm .page-item:last-child .page-link{border-top-right-radius:.35rem;border-bottom-right-radius:.35rem}.badge{padding:.375rem .5rem;font-size:75%;font-weight:500;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif;color:#fff;border-radius:.375rem}a.badge{transition:all 250ms cubic-bezier(.27,.01,.38,1.06)}.badge-pill{padding-right:.5rem;padding-left:.5rem;border-radius:10rem}.badge-squared{border-radius:0}.badge-primary{color:#fff;background-color:#007bff}.badge-primary[href]:focus,.badge-primary[href]:hover{color:#fff;text-decoration:none;background-color:#0062cc}.badge-outline-primary{background:0 0;border:1px solid #007bff;color:#007bff}.badge-secondary{color:#fff;background-color:#5a6169}.badge-secondary[href]:focus,.badge-secondary[href]:hover{color:#fff;text-decoration:none;background-color:#42484e}.badge-outline-secondary{background:0 0;border:1px solid #5a6169;color:#5a6169}.badge-success{color:#fff;background-color:#17c671}.badge-success[href]:focus,.badge-success[href]:hover{color:#fff;text-decoration:none;background-color:#129857}.badge-outline-success{background:0 0;border:1px solid #17c671;color:#17c671}.badge-info{color:#fff;background-color:#00b8d8}.badge-info[href]:focus,.badge-info[href]:hover{color:#fff;text-decoration:none;background-color:#008da5}.badge-outline-info{background:0 0;border:1px solid #00b8d8;color:#00b8d8}.badge-warning{color:#212529;background-color:#ffb400}.badge-warning[href]:focus,.badge-warning[href]:hover{color:#212529;text-decoration:none;background-color:#cc9000}.badge-outline-warning{background:0 0;border:1px solid #ffb400;color:#ffb400}.badge-danger{color:#fff;background-color:#c4183c}.badge-danger[href]:focus,.badge-danger[href]:hover{color:#fff;text-decoration:none;background-color:#97122e}.badge-outline-danger{background:0 0;border:1px solid #c4183c;color:#c4183c}.badge-light{color:#212529;background-color:#e9ecef}.badge-light[href]:focus,.badge-light[href]:hover{color:#212529;text-decoration:none;background-color:#cbd3da}.badge-outline-light{background:0 0;border:1px solid #e9ecef;color:#e9ecef;color:#212529}.badge-dark{color:#fff;background-color:#212529}.badge-dark[href]:focus,.badge-dark[href]:hover{color:#fff;text-decoration:none;background-color:#0a0c0d}.badge-outline-dark{background:0 0;border:1px solid #212529;color:#212529}.jumbotron{padding:38px 42px;margin-bottom:2rem;background-color:#eceeef;border-radius:.5rem}@media (min-width:576px){.jumbotron{padding:4rem 2rem}}.alert{padding:.75rem 1.25rem;margin-bottom:1rem;border:none;border-radius:0}.alert-link{font-weight:500}.alert-dismissible .close{top:0;right:0;padding:.75rem 1.25rem;transition:all 250ms cubic-bezier(.27,.01,.38,1.06)}.alert-dismissible .close:hover{cursor:pointer}.alert-primary{color:#f5faff;background-color:#007bff}.alert-primary .alert-link{color:#f5faff}.alert-secondary{color:#d9dcdf;background-color:#5a6169}.alert-secondary .alert-link{color:#d9dcdf}.alert-success{color:#d7fae9;background-color:#17c671}.alert-success .alert-link{color:#d7fae9}.alert-info{color:#cef8ff;background-color:#00b8d8}.alert-info .alert-link{color:#cef8ff}.alert-warning{color:#fffcf5;background-color:#ffb400}.alert-warning .alert-link{color:#fffcf5}.alert-danger{color:#fad7de;background-color:#c4183c}.alert-danger .alert-link{color:#fad7de}.alert-light{color:#fff;background-color:#e9ecef;color:#212529}.alert-light .alert-link{color:#fff}.alert-light .alert-link{color:#212529}.alert-dark{color:#959faa;background-color:#212529}.alert-dark .alert-link{color:#959faa}.progress-wrapper{position:relative;color:#5a6169}.progress-wrapper .progress-label{font-size:.8125rem}.progress-wrapper .progress-value{position:absolute;top:6px;right:0;color:#5a6169}.progress{height:.625rem;font-size:.625rem;line-height:.625rem;background-color:#f5f5f6;margin-top:6px;border-radius:1.25rem;box-shadow:inset 0 .1rem .1rem rgba(90,97,105,.15)}.progress-sm{height:.3125rem}.progress-lg{height:.9375rem}.progress-lg .progress-bar{height:.9375rem}.progress-bar{height:.625rem;line-height:.625rem;color:#fff;background-color:#007bff;transition:width .6s ease}.progress-bar-striped{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);background-size:.625rem .625rem}.progress-bar-animated{-webkit-animation:progress-bar-stripes 1s linear infinite;animation:progress-bar-stripes 1s linear infinite}.list-group-small .list-group-item{padding:.625rem 1rem;font-size:.8125rem}.list-group-item-action{color:#5a6169;transition:all 250ms cubic-bezier(.27,.01,.38,1.06)}.list-group-item-action:focus,.list-group-item-action:hover{color:#5a6169;background-color:#f7f8f8}.list-group-item-action:active{color:#5a6169;background-color:#eceeef}.list-group-item{padding:.75rem 1.25rem;margin-bottom:-1px;background-color:#fff;border:1px solid rgba(0,0,0,.125);font-weight:300}.list-group-item:first-child{border-top-left-radius:.375rem;border-top-right-radius:.375rem}.list-group-item:last-child{border-bottom-right-radius:.375rem;border-bottom-left-radius:.375rem}.list-group-item.disabled,.list-group-item:disabled{color:#868e96;background-color:#fff}.list-group-item.active{color:#fff;background-color:#007bff;border-color:#007bff}.list-group-item-primary{color:#004085;background-color:#b8daff}a.list-group-item-primary,button.list-group-item-primary{color:#004085}a.list-group-item-primary:focus,a.list-group-item-primary:hover,button.list-group-item-primary:focus,button.list-group-item-primary:hover{color:#004085;background-color:#9fcdff}a.list-group-item-primary.active,button.list-group-item-primary.active{background-color:#004085;border-color:#004085}.list-group-item-secondary{color:#2f3237;background-color:#d1d3d5}a.list-group-item-secondary,button.list-group-item-secondary{color:#2f3237}a.list-group-item-secondary:focus,a.list-group-item-secondary:hover,button.list-group-item-secondary:focus,button.list-group-item-secondary:hover{color:#2f3237;background-color:#c4c6c9}a.list-group-item-secondary.active,button.list-group-item-secondary.active{background-color:#2f3237;border-color:#2f3237}.list-group-item-success{color:#0c673b;background-color:#beefd7}a.list-group-item-success,button.list-group-item-success{color:#0c673b}a.list-group-item-success:focus,a.list-group-item-success:hover,button.list-group-item-success:focus,button.list-group-item-success:hover{color:#0c673b;background-color:#aaeaca}a.list-group-item-success.active,button.list-group-item-success.active{background-color:#0c673b;border-color:#0c673b}.list-group-item-info{color:#006070;background-color:#b8ebf4}a.list-group-item-info,button.list-group-item-info{color:#006070}a.list-group-item-info:focus,a.list-group-item-info:hover,button.list-group-item-info:focus,button.list-group-item-info:hover{color:#006070;background-color:#a2e5f1}a.list-group-item-info.active,button.list-group-item-info.active{background-color:#006070;border-color:#006070}.list-group-item-warning{color:#855e00;background-color:#ffeab8}a.list-group-item-warning,button.list-group-item-warning{color:#855e00}a.list-group-item-warning:focus,a.list-group-item-warning:hover,button.list-group-item-warning:focus,button.list-group-item-warning:hover{color:#855e00;background-color:#ffe29f}a.list-group-item-warning.active,button.list-group-item-warning.active{background-color:#855e00;border-color:#855e00}.list-group-item-danger{color:#660c1f;background-color:#eebec8}a.list-group-item-danger,button.list-group-item-danger{color:#660c1f}a.list-group-item-danger:focus,a.list-group-item-danger:hover,button.list-group-item-danger:focus,button.list-group-item-danger:hover{color:#660c1f;background-color:#e9aab7}a.list-group-item-danger.active,button.list-group-item-danger.active{background-color:#660c1f;border-color:#660c1f}.list-group-item-light{color:#797b7c;background-color:#f9fafb}a.list-group-item-light,button.list-group-item-light{color:#797b7c}a.list-group-item-light:focus,a.list-group-item-light:hover,button.list-group-item-light:focus,button.list-group-item-light:hover{color:#797b7c;background-color:#eaedf1}a.list-group-item-light.active,button.list-group-item-light.active{background-color:#797b7c;border-color:#797b7c}.list-group-item-dark{color:#111315;background-color:#c1c2c3}a.list-group-item-dark,button.list-group-item-dark{color:#111315}a.list-group-item-dark:focus,a.list-group-item-dark:hover,button.list-group-item-dark:focus,button.list-group-item-dark:hover{color:#111315;background-color:#b4b5b6}a.list-group-item-dark.active,button.list-group-item-dark.active{background-color:#111315;border-color:#111315}.close{font-size:1.5rem;font-weight:500;color:#8c949d;text-shadow:none;transition:all 250ms cubic-bezier(.27,.01,.38,1.06)}.close:focus,.close:hover{color:#8c949d}.modal{z-index:1050}.modal-dialog{margin:.625rem}.modal.fade .modal-dialog{transition:-webkit-transform .3s ease-out;transition:transform .3s ease-out;transition:transform .3s ease-out,-webkit-transform .3s ease-out}.modal-dialog-centered{min-height:calc(100% - (.625rem * 2))}.modal-content{background-color:#fff;border:none;border-radius:.5rem;box-shadow:0 .46875rem 2.1875rem rgba(90,97,105,.1),0 .9375rem 1.40625rem rgba(90,97,105,.1),0 .25rem .53125rem rgba(90,97,105,.12),0 .125rem .1875rem rgba(90,97,105,.1)}.modal-backdrop{z-index:1040;background-color:#5a6169}.modal-backdrop.show{opacity:.12}.modal-header{padding:.9375rem 2.1875rem;border-bottom:1px solid #dfe1e3}.modal-title{line-height:1.5}.modal-body{padding:1.875rem 2.1875rem}.modal-footer{padding:.9375rem 2.1875rem;border-top:1px solid #dfe1e3}@media (min-width:576px){.modal-dialog{max-width:500px;margin:1.875rem auto}.modal-dialog-centered{min-height:calc(100% - (1.875rem * 2))}.modal-content{box-shadow:0 .46875rem 2.1875rem rgba(90,97,105,.1),0 .9375rem 1.40625rem rgba(90,97,105,.1),0 .25rem .53125rem rgba(90,97,105,.12),0 .125rem .1875rem rgba(90,97,105,.1)}.modal-sm{max-width:300px}}@media (min-width:992px){.modal-lg{max-width:800px}}.tooltip{z-index:1070;margin:0;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif;font-style:normal;font-weight:300;line-height:1.5;text-align:left;text-align:start;text-decoration:none;text-shadow:none;text-transform:none;letter-spacing:normal;word-break:normal;word-spacing:normal;white-space:normal;line-break:auto;font-size:.875rem}.tooltip.show{opacity:1}.tooltip .arrow{width:5px;height:5px}.bs-tooltip-auto[x-placement^=top],.bs-tooltip-top{padding:5px 0}.bs-tooltip-auto[x-placement^=top] .arrow::before,.bs-tooltip-top .arrow::before{border-width:5px 2.5px 0;border-top-color:#fff}.bs-tooltip-auto[x-placement^=right],.bs-tooltip-right{padding:0 5px}.bs-tooltip-auto[x-placement^=right] .arrow,.bs-tooltip-right .arrow{width:5px;height:5px}.bs-tooltip-auto[x-placement^=right] .arrow::before,.bs-tooltip-right .arrow::before{border-width:2.5px 5px 2.5px 0;border-right-color:#fff}.bs-tooltip-auto[x-placement^=bottom],.bs-tooltip-bottom{padding:5px 0}.bs-tooltip-auto[x-placement^=bottom] .arrow::before,.bs-tooltip-bottom .arrow::before{border-width:0 2.5px 5px;border-bottom-color:#fff}.bs-tooltip-auto[x-placement^=left],.bs-tooltip-left{padding:0 5px}.bs-tooltip-auto[x-placement^=left] .arrow,.bs-tooltip-left .arrow{width:5px;height:5px}.bs-tooltip-auto[x-placement^=left] .arrow::before,.bs-tooltip-left .arrow::before{border-width:2.5px 0 2.5px 5px;border-left-color:#fff}.tooltip-inner{max-width:200px;padding:7px 13px;color:#5a6169;background-color:#fff;box-shadow:0 3px 15px rgba(90,97,105,.1),0 2px 3px rgba(90,97,105,.2);border-radius:.375rem}.popover{z-index:1060;max-width:276px;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif;font-style:normal;font-weight:300;line-height:1.5;text-align:left;text-align:start;text-decoration:none;text-shadow:none;text-transform:none;letter-spacing:normal;word-break:normal;word-spacing:normal;white-space:normal;line-break:auto;font-size:.875rem;background-color:#fff;border:none;padding:0;border-radius:.5rem;box-shadow:0 3px 15px rgba(90,97,105,.1),0 2px 3px rgba(90,97,105,.2)}.popover .arrow{width:10px;height:5px;margin:0 .5rem}.popover .arrow::before{border-width:11px}.popover .arrow::after{border-width:11px}.bs-popover-auto[x-placement^=top],.bs-popover-top{margin-bottom:5px}.bs-popover-auto[x-placement^=top] .arrow,.bs-popover-top .arrow{bottom:calc((5px + 1px) * -1)}.bs-popover-auto[x-placement^=top] .arrow::after,.bs-popover-auto[x-placement^=top] .arrow::before,.bs-popover-top .arrow::after,.bs-popover-top .arrow::before{border-width:5px 5px 0}.bs-popover-auto[x-placement^=top] .arrow::before,.bs-popover-top .arrow::before{border-top-color:rgba(0,0,0,.05)}.bs-popover-auto[x-placement^=top] .arrow::after,.bs-popover-top .arrow::after{bottom:1px;border-top-color:#fff}.bs-popover-auto[x-placement^=right],.bs-popover-right{margin-left:5px}.bs-popover-auto[x-placement^=right] .arrow,.bs-popover-right .arrow{left:calc((5px + 1px) * -1);width:5px;height:10px;margin:.5rem 0}.bs-popover-auto[x-placement^=right] .arrow::after,.bs-popover-auto[x-placement^=right] .arrow::before,.bs-popover-right .arrow::after,.bs-popover-right .arrow::before{border-width:5px 5px 5px 0}.bs-popover-auto[x-placement^=right] .arrow::before,.bs-popover-right .arrow::before{border-right-color:rgba(0,0,0,.05)}.bs-popover-auto[x-placement^=right] .arrow::after,.bs-popover-right .arrow::after{left:1px;border-right-color:#fff}.bs-popover-auto[x-placement^=bottom],.bs-popover-bottom{margin-top:5px}.bs-popover-auto[x-placement^=bottom] .arrow,.bs-popover-bottom .arrow{top:calc((5px + 1px) * -1)}.bs-popover-auto[x-placement^=bottom] .arrow::after,.bs-popover-auto[x-placement^=bottom] .arrow::before,.bs-popover-bottom .arrow::after,.bs-popover-bottom .arrow::before{border-width:0 5px 5px 5px}.bs-popover-auto[x-placement^=bottom] .arrow::before,.bs-popover-bottom .arrow::before{border-bottom-color:rgba(0,0,0,.05)}.bs-popover-auto[x-placement^=bottom] .arrow::after,.bs-popover-bottom .arrow::after{top:1px;border-bottom-color:#fff}.bs-popover-auto[x-placement^=bottom] .popover-header::before,.bs-popover-bottom .popover-header::before{width:10px;margin-left:-5px;border-bottom:1px solid #f5f5f6}.bs-popover-auto[x-placement^=left],.bs-popover-left{margin-right:5px}.bs-popover-auto[x-placement^=left] .arrow,.bs-popover-left .arrow{right:calc((5px + 1px) * -1);width:5px;height:10px;margin:.5rem 0}.bs-popover-auto[x-placement^=left] .arrow::after,.bs-popover-auto[x-placement^=left] .arrow::before,.bs-popover-left .arrow::after,.bs-popover-left .arrow::before{border-width:5px 0 5px 5px}.bs-popover-auto[x-placement^=left] .arrow::before,.bs-popover-left .arrow::before{border-left-color:rgba(0,0,0,.05)}.bs-popover-auto[x-placement^=left] .arrow::after,.bs-popover-left .arrow::after{right:1px;border-left-color:#fff}.popover-header{padding:14px 20px;font-size:1rem;color:#212529;line-height:14px;background-color:#f5f5f6;border-bottom:1px solid #e7e9ea;border-top-left-radius:calc(.5rem - 1px);border-top-right-radius:calc(.5rem - 1px)}.popover-body{padding:15px 20px;color:#5a6169}.carousel{box-shadow:0 .46875rem 2.1875rem rgba(90,97,105,.1),0 .9375rem 1.40625rem rgba(90,97,105,.1),0 .25rem .53125rem rgba(90,97,105,.12),0 .125rem .1875rem rgba(90,97,105,.1)}.carousel-item{transition:-webkit-transform .6s ease;transition:transform .6s ease;transition:transform .6s ease,-webkit-transform .6s ease}.carousel-control-next,.carousel-control-prev{width:15%;color:#fff;opacity:.5}.carousel-control-next:focus,.carousel-control-next:hover,.carousel-control-prev:focus,.carousel-control-prev:hover{color:#fff}.carousel-control-next-icon,.carousel-control-prev-icon{width:20px;height:20px}.carousel-control-prev-icon{background-image:url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='%23fff' viewBox='0 0 8 8'%3E%3Cpath d='M4 0l-4 4 4 4 1.5-1.5-2.5-2.5 2.5-2.5-1.5-1.5z'/%3E%3C/svg%3E")}.carousel-control-next-icon{background-image:url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='%23fff' viewBox='0 0 8 8'%3E%3Cpath d='M1.5 0l-1.5 1.5 2.5 2.5-2.5 2.5 1.5 1.5 4-4-4-4z'/%3E%3C/svg%3E")}.carousel-indicators{margin-right:15%;margin-left:15%}.carousel-indicators li{width:30px;height:3px;margin-right:3px;margin-left:3px;background-color:rgba(255,255,255,.5);border-radius:3px}.carousel-indicators .active{background-color:#fff}.carousel-caption{right:15%;left:15%;color:#fff}.noUi-target,.noUi-target *{-webkit-touch-callout:none;-webkit-tap-highlight-color:transparent;-webkit-user-select:none;-ms-touch-action:none;touch-action:none;-ms-user-select:none;-moz-user-select:none;user-select:none;box-sizing:border-box}.noUi-target{position:relative;direction:ltr;background:#eceeef;border-radius:5px;box-shadow:inset 0 1px 2px rgba(90,97,105,.1);margin:35px 0}.noUi-target:focus{outline:0;box-shadow:0 0 8px rgba(0,123,255,.65),0 3px 15px rgba(90,97,105,.1),0 2px 3px rgba(90,97,105,.2)}.noUi-base,.noUi-connects{width:100%;height:100%;position:relative;z-index:1}.noUi-connects{overflow:hidden;z-index:0}.noUi-connect,.noUi-origin{position:absolute;will-change:transform;z-index:1;top:0;left:0;height:100%;width:100%;-webkit-transform-origin:0 0;transform-origin:0 0}.noUi-connect:focus,.noUi-origin:focus{outline:0}.noUi-connect{background:#007bff;border-radius:5px}html:not([dir=rtl]) .noUi-horizontal .noUi-origin{left:auto;right:0}html:not([dir=rtl]) .noUi-horizontal .noUi-handle{right:-17px;left:auto}.noUi-rtl .noUi-value-horizontal{-webkit-transform:translate(50%,50%);transform:translate(50%,50%)}.noUi-rtl .noUi-value-vertical{-webkit-transform:translate(0,50%);transform:translate(0,50%)}.noUi-vertical{width:5px}.noUi-vertical .noUi-origin{width:0}.noUi-vertical .noUi-handle{left:-10px;top:-11.5px}.noUi-vertical .noUi-handle:after,.noUi-vertical .noUi-handle:before{width:14px;height:1px;left:6px;top:14px}.noUi-vertical .noUi-handle:after{top:17px}.noUi-vertical .noUi-tooltip{-webkit-transform:translate(0,-50%);transform:translate(0,-50%);top:50%;right:30px}.noUi-vertical .noUi-draggable{cursor:ns-resize}.noUi-horizontal{height:5px}.noUi-horizontal .noUi-origin{height:0}.noUi-horizontal .noUi-handle{left:-11.5px;top:-10px}.noUi-horizontal .noUi-tooltip{-webkit-transform:translate(-50%,0);transform:translate(-50%,0);left:50%;bottom:30px}.noUi-handle{position:absolute;border:1px solid #e7e9ea;border-radius:50%;width:23px;height:23px;box-shadow:0 3px 15px rgba(90,97,105,.1),0 2px 3px rgba(90,97,105,.2);background:#fff;transition:all 250ms cubic-bezier(.27,.01,.38,1.06)}.noUi-handle:hover{cursor:grab;cursor:-webkit-grab;cursor:-moz-grab}.noUi-handle:active{cursor:grabbing;cursor:-webkit-grabbing;cursor:-moz-grabbing}.noUi-handle:focus{outline:0;box-shadow:0 0 8px rgba(0,123,255,.65),0 3px 15px rgba(90,97,105,.1),0 2px 3px rgba(90,97,105,.2)}.noUi-handle:after{left:17px}.noUi-state-tap .noUi-connect,.noUi-state-tap .noUi-origin{transition:-webkit-transform .3s;transition:transform .3s;transition:transform .3s,-webkit-transform .3s}.noUi-state-drag *{cursor:inherit!important}.noUi-connects{border-radius:5px}.noUi-draggable{cursor:ew-resize}.noUi-active{-webkit-transform:scale(1.1);transform:scale(1.1)}[disabled] .noUi-connect{background:#b8b8b8}[disabled] .noUi-handle,[disabled].noUi-handle,[disabled].noUi-target{cursor:not-allowed}[disabled] .noUi-handle{background:#f2f3f4}[disabled] .noUi-handle:focus{box-shadow:0 3px 15px rgba(90,97,105,.1),0 2px 3px rgba(90,97,105,.2)}.noUi-pips,.noUi-pips *{box-sizing:border-box}.noUi-pips{position:absolute;color:#a8aeb4;font-size:12px}.noUi-value{position:absolute;white-space:nowrap;text-align:center}.noUi-value-sub{color:#a8aeb4;font-size:10px}.noUi-marker{position:absolute;background:#a8aeb4}.noUi-marker-sub{background:#a8aeb4}.noUi-marker-large{background:#a8aeb4}.noUi-pips-horizontal{padding:10px 0;height:auto;top:100%;left:0;width:100%}.noUi-value-horizontal{-webkit-transform:translate3d(-50%,50%,0);transform:translate3d(-50%,50%,0)}.noUi-marker-horizontal.noUi-marker{margin-left:-1px;width:1px;height:4px}.noUi-marker-horizontal.noUi-marker-sub{height:5px}.noUi-marker-horizontal.noUi-marker-large{height:7px}.noUi-pips-vertical{padding:0 10px;height:100%;top:0;left:100%}.noUi-value-vertical{-webkit-transform:translate3d(0,-50%,0);transform:translate3d(0,-50%,0);padding-left:15px}.noUi-marker-vertical.noUi-marker{width:4px;height:1px;margin-top:-1px}.noUi-marker-vertical.noUi-marker-sub{width:10px}.noUi-marker-vertical.noUi-marker-large{width:7px}.noUi-tooltip{display:block;position:absolute;text-align:center;white-space:nowrap;border-radius:.375rem;border-radius:.375rem;background:#fff;color:#5a6169;box-shadow:0 3px 15px rgba(90,97,105,.1),0 2px 3px rgba(90,97,105,.2);font-size:.75rem;padding:5px 10px}.slider-primary .noUi-connect{background:#007bff}.slider-secondary .noUi-connect{background:#5a6169}.slider-success .noUi-connect{background:#17c671}.slider-info .noUi-connect{background:#00b8d8}.slider-warning .noUi-connect{background:#ffb400}.slider-danger .noUi-connect{background:#c4183c}.slider-light .noUi-connect{background:#e9ecef}.slider-dark .noUi-connect{background:#212529}.datepicker{border-radius:.625rem;direction:ltr}.datepicker-inline{width:220px}.datepicker-rtl{direction:rtl}.datepicker-rtl.dropdown-menu{left:auto}.datepicker-rtl table tr td span{float:right}.datepicker-dropdown{top:0;left:0;padding:20px 22px}.datepicker-dropdown:after,.datepicker-dropdown:before{content:'';display:inline-block;border-top:0;position:absolute}.datepicker-dropdown:before{border-left:7px solid transparent;border-right:7px solid transparent;border-bottom:7px solid #c3c7cc;border-bottom-color:rgba(0,0,0,.2)}.datepicker-dropdown:after{border-left:6px solid transparent;border-right:6px solid transparent;border-bottom:6px solid #fff}.datepicker-dropdown.datepicker-orient-left:before{left:6px}.datepicker-dropdown.datepicker-orient-left:after{left:7px}.datepicker-dropdown.datepicker-orient-right:before{right:6px}.datepicker-dropdown.datepicker-orient-right:after{right:7px}.datepicker-dropdown.datepicker-orient-bottom:before{top:-7px}.datepicker-dropdown.datepicker-orient-bottom:after{top:-6px}.datepicker-dropdown.datepicker-orient-top:before{bottom:-7px;border-bottom:0;border-top:7px solid #c3c7cc}.datepicker-dropdown.datepicker-orient-top:after{bottom:-6px;border-bottom:0;border-top:6px solid #fff}.datepicker table{margin:0;-webkit-touch-callout:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.datepicker table tr td{border-radius:50%}.datepicker table tr th{border-radius:.375rem;font-weight:500}.datepicker table tr td,.datepicker table tr th{transition:all 250ms cubic-bezier(.27,.01,.38,1.06);width:36px;height:36px;border:none;text-align:center}.table-striped .datepicker table tr td,.table-striped .datepicker table tr th{background-color:transparent}.datepicker table tr td.new,.datepicker table tr td.old{color:#c3c7cc}.datepicker table tr td.day:hover,.datepicker table tr td.focused{background:#eceeef;cursor:pointer}.datepicker table tr td.disabled,.datepicker table tr td.disabled:hover{background:0 0;color:#e7e9ea;cursor:default}.datepicker table tr td.highlighted{border-radius:0}.datepicker table tr td.highlighted.focused{background:#007bff}.datepicker table tr td.highlighted.disabled,.datepicker table tr td.highlighted.disabled:active{background:#007bff;color:#5a6169}.datepicker table tr td.today{background:#e6f2ff}.datepicker table tr td.today.focused{background:#f5f5f6}.datepicker table tr td.today.disabled,.datepicker table tr td.today.disabled:active{background:#f5f5f6;color:#868e96}.datepicker table tr td.range{background:#007bff;color:#fff;border-radius:0}.datepicker table tr td.range.focused{background:#0067d6}.datepicker table tr td.range.day.disabled:hover,.datepicker table tr td.range.disabled,.datepicker table tr td.range.disabled:active{background:#0062cc;color:#3395ff}.datepicker table tr td.range.highlighted.focused{background:#cbd3da}.datepicker table tr td.range.highlighted.disabled,.datepicker table tr td.range.highlighted.disabled:active{background:#e9ecef;color:#e7e9ea}.datepicker table tr td.range.today.disabled,.datepicker table tr td.range.today.disabled:active{background:#007bff;color:#fff}.datepicker table tr td.day.range-start{border-top-right-radius:0;border-bottom-right-radius:0}.datepicker table tr td.day.range-end{border-top-left-radius:0;border-bottom-left-radius:0}.datepicker table tr td.day.range-start.range-end{border-radius:50%}.datepicker table tr td.day.range:hover,.datepicker table tr td.selected,.datepicker table tr td.selected.highlighted,.datepicker table tr td.selected.highlighted:hover,.datepicker table tr td.selected:hover{background:#007bff;color:#fff}.datepicker table tr td.active,.datepicker table tr td.active.highlighted,.datepicker table tr td.active.highlighted:hover,.datepicker table tr td.active:hover{background:#007bff;color:#fff}.datepicker table tr td span{display:block;width:23%;height:54px;line-height:54px;float:left;margin:1%;cursor:pointer;border-radius:4px}.datepicker table tr td span.focused,.datepicker table tr td span:hover{background:#e9ecef}.datepicker table tr td span.disabled,.datepicker table tr td span.disabled:hover{background:0 0;color:#e7e9ea;cursor:default}.datepicker table tr td span.active,.datepicker table tr td span.active.disabled,.datepicker table tr td span.active.disabled:hover,.datepicker table tr td span.active:hover{text-shadow:0 -1px 0 rgba(0,0,0,.25)}.datepicker table tr td span.new,.datepicker table tr td span.old{color:#868e96}.datepicker .datepicker-switch{width:145px}.datepicker .datepicker-switch,.datepicker .next,.datepicker .prev,.datepicker tfoot tr th{cursor:pointer}.datepicker .datepicker-switch:hover,.datepicker .next:hover,.datepicker .prev:hover,.datepicker tfoot tr th:hover{background:#e9ecef}.datepicker .next.disabled,.datepicker .prev.disabled{visibility:hidden}.datepicker .cw{font-size:10px;width:12px;padding:0 2px 0 5px;vertical-align:middle}.input-daterange input{text-align:center}.bg-primary{background-color:#007bff!important}.bg-primary.card .card-body,.bg-primary.card .card-footer,.bg-primary.card .card-header,.bg-primary.card .card-title{background-color:#0062cc!important}.bg-primary.card .card-footer,.bg-primary.card .card-header{background:#0074f0}a.bg-primary:focus,a.bg-primary:hover{background-color:#0062cc!important}.bg-secondary{background-color:#5a6169!important}.bg-secondary.card .card-body,.bg-secondary.card .card-footer,.bg-secondary.card .card-header,.bg-secondary.card .card-title{background-color:#42484e!important}.bg-secondary.card .card-footer,.bg-secondary.card .card-header{background:#535961}a.bg-secondary:focus,a.bg-secondary:hover{background-color:#42484e!important}.bg-success{background-color:#17c671!important}.bg-success.card .card-body,.bg-success.card .card-footer,.bg-success.card .card-header,.bg-success.card .card-title{background-color:#129857!important}.bg-success.card .card-footer,.bg-success.card .card-header{background:#15b869}a.bg-success:focus,a.bg-success:hover{background-color:#129857!important}.bg-info{background-color:#00b8d8!important}.bg-info.card .card-body,.bg-info.card .card-footer,.bg-info.card .card-header,.bg-info.card .card-title{background-color:#008da5!important}.bg-info.card .card-footer,.bg-info.card .card-header{background:#00abc9}a.bg-info:focus,a.bg-info:hover{background-color:#008da5!important}.bg-warning{background-color:#ffb400!important}.bg-warning.card .card-body,.bg-warning.card .card-footer,.bg-warning.card .card-header,.bg-warning.card .card-title{background-color:#cc9000!important}.bg-warning.card .card-footer,.bg-warning.card .card-header{background:#f0a900}a.bg-warning:focus,a.bg-warning:hover{background-color:#cc9000!important}.bg-danger{background-color:#c4183c!important}.bg-danger.card .card-body,.bg-danger.card .card-footer,.bg-danger.card .card-header,.bg-danger.card .card-title{background-color:#97122e!important}.bg-danger.card .card-footer,.bg-danger.card .card-header{background:#b61638}a.bg-danger:focus,a.bg-danger:hover{background-color:#97122e!important}.bg-light{background-color:#e9ecef!important}.bg-light.card .card-body,.bg-light.card .card-footer,.bg-light.card .card-header,.bg-light.card .card-title{background-color:#cbd3da!important}.bg-light.card .card-footer,.bg-light.card .card-header{background:#e0e4e9}a.bg-light:focus,a.bg-light:hover{background-color:#cbd3da!important}.bg-dark{background-color:#212529!important}.bg-dark.card .card-body,.bg-dark.card .card-footer,.bg-dark.card .card-header,.bg-dark.card .card-title{background-color:#0a0c0d!important}.bg-dark.card .card-footer,.bg-dark.card .card-header{background:#1a1d21}a.bg-dark:focus,a.bg-dark:hover{background-color:#0a0c0d!important}.border{border:1px solid #becad6!important}.border-top{border-top:1px solid #becad6!important}.border-right{border-right:1px solid #becad6!important}.border-bottom{border-bottom:1px solid #becad6!important}.border-left{border-left:1px solid #becad6!important}.border-primary{border-color:#007bff!important}.border-secondary{border-color:#5a6169!important}.border-success{border-color:#17c671!important}.border-info{border-color:#00b8d8!important}.border-warning{border-color:#ffb400!important}.border-danger{border-color:#c4183c!important}.border-light{border-color:#e9ecef!important}.border-dark{border-color:#212529!important}.rounded{border-radius:.375rem!important}.rounded-top{border-top-left-radius:.375rem!important;border-top-right-radius:.375rem!important}.rounded-right{border-top-right-radius:.375rem!important;border-bottom-right-radius:.375rem!important}.rounded-bottom{border-bottom-right-radius:.375rem!important;border-bottom-left-radius:.375rem!important}.rounded-left{border-top-left-radius:.375rem!important;border-bottom-left-radius:.375rem!important}.text-monospace{font-family:"Roboto Mono",Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace}.font-weight-normal{font-weight:300}.font-weight-bold{font-weight:500}.text-primary{color:#007bff!important}a.text-primary:focus,a.text-primary:hover{color:#0062cc!important}.text-secondary{color:#5a6169!important}a.text-secondary:focus,a.text-secondary:hover{color:#42484e!important}.text-success{color:#17c671!important}a.text-success:focus,a.text-success:hover{color:#129857!important}.text-info{color:#00b8d8!important}a.text-info:focus,a.text-info:hover{color:#008da5!important}.text-warning{color:#ffb400!important}a.text-warning:focus,a.text-warning:hover{color:#cc9000!important}.text-danger{color:#c4183c!important}a.text-danger:focus,a.text-danger:hover{color:#97122e!important}.text-light{color:#e9ecef!important}a.text-light:focus,a.text-light:hover{color:#cbd3da!important}.text-dark{color:#212529!important}a.text-dark:focus,a.text-dark:hover{color:#0a0c0d!important}.text-body{color:#5a6169!important}a.text-white:focus,a.text-white:hover{color:#e6e6e6!important}.text-black{color:#000}a.text-black:focus,a.text-black:hover{color:#000!important}.text-muted{color:#868e96!important}.with-shadows{box-shadow:0 .46875rem 2.1875rem rgba(90,97,105,.1),0 .9375rem 1.40625rem rgba(90,97,105,.1),0 .25rem .53125rem rgba(90,97,105,.12),0 .125rem .1875rem rgba(90,97,105,.1)} +/*# sourceMappingURL=shards.min.css.map */ \ No newline at end of file diff --git a/spring-boot-persistence/src/main/resources/data.sql b/persistence-modules/spring-boot-persistence/src/main/resources/data.sql similarity index 100% rename from spring-boot-persistence/src/main/resources/data.sql rename to persistence-modules/spring-boot-persistence/src/main/resources/data.sql diff --git a/jnosql/jnosql-diana/src/main/resources/logback.xml b/persistence-modules/spring-boot-persistence/src/main/resources/logback.xml similarity index 100% rename from jnosql/jnosql-diana/src/main/resources/logback.xml rename to persistence-modules/spring-boot-persistence/src/main/resources/logback.xml diff --git a/spring-boot-persistence/src/main/resources/persistence-generic-entity.properties b/persistence-modules/spring-boot-persistence/src/main/resources/persistence-generic-entity.properties similarity index 100% rename from spring-boot-persistence/src/main/resources/persistence-generic-entity.properties rename to persistence-modules/spring-boot-persistence/src/main/resources/persistence-generic-entity.properties diff --git a/spring-boot-persistence/src/main/resources/schema.sql b/persistence-modules/spring-boot-persistence/src/main/resources/schema.sql similarity index 100% rename from spring-boot-persistence/src/main/resources/schema.sql rename to persistence-modules/spring-boot-persistence/src/main/resources/schema.sql diff --git a/persistence-modules/spring-boot-persistence/src/main/resources/templates/add-user.html b/persistence-modules/spring-boot-persistence/src/main/resources/templates/add-user.html new file mode 100644 index 0000000000..31d38f2cb5 --- /dev/null +++ b/persistence-modules/spring-boot-persistence/src/main/resources/templates/add-user.html @@ -0,0 +1,40 @@ + + + + + + Add User + + + + + + +
+

New User

+
+
+
+
+
+ + + +
+
+ + + +
+
+
+
+ +
+
+
+
+
+
+ + \ No newline at end of file diff --git a/persistence-modules/spring-boot-persistence/src/main/resources/templates/index.html b/persistence-modules/spring-boot-persistence/src/main/resources/templates/index.html new file mode 100644 index 0000000000..2634e10380 --- /dev/null +++ b/persistence-modules/spring-boot-persistence/src/main/resources/templates/index.html @@ -0,0 +1,43 @@ + + + + + + Users + + + + + + +
+
+
+

No users yet!

+
+

Users

+ + + + + + + + + + + + + + + + + +
NameEmailEditDelete
+
+

+
+
+
+ + \ No newline at end of file diff --git a/persistence-modules/spring-boot-persistence/src/main/resources/templates/update-user.html b/persistence-modules/spring-boot-persistence/src/main/resources/templates/update-user.html new file mode 100644 index 0000000000..f94e8eb987 --- /dev/null +++ b/persistence-modules/spring-boot-persistence/src/main/resources/templates/update-user.html @@ -0,0 +1,40 @@ + + + + + + Update User + + + + + + +
+

Update User

+
+
+
+
+
+ + + +
+
+ + + +
+
+
+
+ +
+
+
+
+
+
+ + \ No newline at end of file diff --git a/spring-boot-persistence/src/test/java/com/baeldung/SpringBootH2IntegrationTest.java b/persistence-modules/spring-boot-persistence/src/test/java/com/baeldung/SpringBootH2IntegrationTest.java similarity index 100% rename from spring-boot-persistence/src/test/java/com/baeldung/SpringBootH2IntegrationTest.java rename to persistence-modules/spring-boot-persistence/src/test/java/com/baeldung/SpringBootH2IntegrationTest.java diff --git a/spring-boot-persistence/src/test/java/com/baeldung/SpringBootJPAIntegrationTest.java b/persistence-modules/spring-boot-persistence/src/test/java/com/baeldung/SpringBootJPAIntegrationTest.java similarity index 100% rename from spring-boot-persistence/src/test/java/com/baeldung/SpringBootJPAIntegrationTest.java rename to persistence-modules/spring-boot-persistence/src/test/java/com/baeldung/SpringBootJPAIntegrationTest.java diff --git a/spring-boot-persistence/src/test/java/com/baeldung/SpringBootProfileIntegrationTest.java b/persistence-modules/spring-boot-persistence/src/test/java/com/baeldung/SpringBootProfileIntegrationTest.java similarity index 100% rename from spring-boot-persistence/src/test/java/com/baeldung/SpringBootProfileIntegrationTest.java rename to persistence-modules/spring-boot-persistence/src/test/java/com/baeldung/SpringBootProfileIntegrationTest.java diff --git a/persistence-modules/spring-boot-persistence/src/test/java/com/baeldung/naming/LegacyJpaImplNamingIntegrationTest.java b/persistence-modules/spring-boot-persistence/src/test/java/com/baeldung/naming/LegacyJpaImplNamingIntegrationTest.java new file mode 100644 index 0000000000..e68be3bed8 --- /dev/null +++ b/persistence-modules/spring-boot-persistence/src/test/java/com/baeldung/naming/LegacyJpaImplNamingIntegrationTest.java @@ -0,0 +1,58 @@ +package com.baeldung.naming; + +import com.baeldung.naming.entity.Account; +import org.assertj.core.api.SoftAssertions; +import org.hibernate.boot.Metadata; +import org.hibernate.mapping.PersistentClass; +import org.hibernate.mapping.Table; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest; +import org.springframework.test.context.TestPropertySource; +import org.springframework.test.context.junit4.SpringRunner; + +@RunWith(SpringRunner.class) +@DataJpaTest +@TestPropertySource(properties = { + "spring.jpa.hibernate.naming.physical-strategy=org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl", + "spring.jpa.hibernate.naming.implicit-strategy=org.hibernate.boot.model.naming.ImplicitNamingStrategyLegacyJpaImpl" +}) +public class LegacyJpaImplNamingIntegrationTest extends NamingConfig { + + @Test + public void givenLegacyJpaImplNamingStrategy_whenCreateDatabase_thenGetStrategyNames() { + Metadata metadata = MetadataExtractorIntegrator.INSTANCE.getMetadata(); + String entity = Account.class.getCanonicalName(); + PersistentClass persistentClass = metadata.getEntityBinding(entity); + Table table = persistentClass.getTable(); + String physicalNameExpected = "Secondary_Email"; + String implicitNameExpected = "defaultEmail"; + String tableNameExpected = "Account"; + + String tableNameCreated = table.getName(); + boolean columnNameIsQuoted = table + .getColumn(3) + .isQuoted(); + String physicalNameCreated = table + .getColumn(3) + .getName(); + String implicitNameCreated = table + .getColumn(2) + .getName(); + + SoftAssertions.assertSoftly(softly -> { + softly + .assertThat(columnNameIsQuoted) + .isTrue(); + softly + .assertThat(tableNameCreated) + .isEqualTo(tableNameExpected); + softly + .assertThat(physicalNameCreated) + .isEqualTo(physicalNameExpected); + softly + .assertThat(implicitNameCreated) + .isEqualTo(implicitNameExpected); + }); + } +} diff --git a/persistence-modules/spring-boot-persistence/src/test/java/com/baeldung/naming/NamingConfig.java b/persistence-modules/spring-boot-persistence/src/test/java/com/baeldung/naming/NamingConfig.java new file mode 100644 index 0000000000..c3ef37aeb4 --- /dev/null +++ b/persistence-modules/spring-boot-persistence/src/test/java/com/baeldung/naming/NamingConfig.java @@ -0,0 +1,15 @@ +package com.baeldung.naming; + +import org.springframework.boot.autoconfigure.orm.jpa.HibernatePropertiesCustomizer; +import org.springframework.boot.test.context.TestConfiguration; +import org.springframework.context.annotation.Bean; + +public class NamingConfig { + @TestConfiguration + static class Config { + @Bean + public HibernatePropertiesCustomizer customizer() { + return new HibernateConfig(); + } + } +} diff --git a/persistence-modules/spring-boot-persistence/src/test/java/com/baeldung/naming/SpringBootDefaultNamingIntegrationTest.java b/persistence-modules/spring-boot-persistence/src/test/java/com/baeldung/naming/SpringBootDefaultNamingIntegrationTest.java new file mode 100644 index 0000000000..089430aabb --- /dev/null +++ b/persistence-modules/spring-boot-persistence/src/test/java/com/baeldung/naming/SpringBootDefaultNamingIntegrationTest.java @@ -0,0 +1,54 @@ +package com.baeldung.naming; + +import com.baeldung.naming.entity.Account; +import org.assertj.core.api.SoftAssertions; +import org.hibernate.boot.Metadata; +import org.hibernate.mapping.PersistentClass; +import org.hibernate.mapping.Table; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest; +import org.springframework.test.context.TestPropertySource; +import org.springframework.test.context.junit4.SpringRunner; + +import static org.assertj.core.api.Assertions.assertThat; + +@RunWith(SpringRunner.class) +@DataJpaTest +@TestPropertySource(properties = { + "spring.jpa.hibernate.naming.physical-strategy=org.springframework.boot.orm.jpa.hibernate.SpringPhysicalNamingStrategy", + "spring.jpa.hibernate.naming.implicit-strategy=org.springframework.boot.orm.jpa.hibernate.SpringImplicitNamingStrategy" +}) +public class SpringBootDefaultNamingIntegrationTest extends NamingConfig { + + @Test + public void givenDefaultBootNamingStrategy_whenCreateDatabase_thenGetStrategyNames() { + Metadata metadata = MetadataExtractorIntegrator.INSTANCE.getMetadata(); + String entity = Account.class.getCanonicalName(); + PersistentClass persistentClass = metadata.getEntityBinding(entity); + Table table = persistentClass.getTable(); + String physicalNameExpected = "secondary_email"; + String implicitNameExpected = "default_email"; + String tableNameExpected = "account"; + + String tableNameCreated = table.getName(); + String physicalNameCreated = table + .getColumn(3) + .getName(); + String implicitNameCreated = table + .getColumn(2) + .getName(); + + SoftAssertions softly = new SoftAssertions(); + softly + .assertThat(tableNameCreated) + .isEqualTo(tableNameExpected); + softly + .assertThat(physicalNameCreated) + .isEqualTo(physicalNameExpected); + softly + .assertThat(implicitNameCreated) + .isEqualTo(implicitNameExpected); + softly.assertAll(); + } +} diff --git a/persistence-modules/spring-boot-persistence/src/test/java/com/baeldung/naming/StrategyLegacyHbmImplIntegrationTest.java b/persistence-modules/spring-boot-persistence/src/test/java/com/baeldung/naming/StrategyLegacyHbmImplIntegrationTest.java new file mode 100644 index 0000000000..046755d9bc --- /dev/null +++ b/persistence-modules/spring-boot-persistence/src/test/java/com/baeldung/naming/StrategyLegacyHbmImplIntegrationTest.java @@ -0,0 +1,58 @@ +package com.baeldung.naming; + +import com.baeldung.naming.entity.Preference; +import org.assertj.core.api.SoftAssertions; +import org.hibernate.boot.Metadata; +import org.hibernate.mapping.PersistentClass; +import org.hibernate.mapping.Table; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest; +import org.springframework.test.context.TestPropertySource; +import org.springframework.test.context.junit4.SpringRunner; + +import java.util.Collection; + +@RunWith(SpringRunner.class) +@DataJpaTest +@TestPropertySource(properties = { + "spring.jpa.hibernate.naming.physical-strategy=org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl", + "spring.jpa.hibernate.naming.implicit-strategy=org.hibernate.boot.model.naming.ImplicitNamingStrategyLegacyHbmImpl", +}) +public class StrategyLegacyHbmImplIntegrationTest extends NamingConfig { + + @Test + public void givenLegacyHbmImplNamingNamingStrategy_whenCreateDatabase_thenGetStrategyNames() { + Metadata metadata = MetadataExtractorIntegrator.INSTANCE.getMetadata(); + String entity = Preference.class.getCanonicalName(); + PersistentClass persistentClass = metadata.getEntityBinding(entity); + Collection tables = metadata + .getDatabase() + .getDefaultNamespace() + .getTables(); + Table preferenceTable = persistentClass.getTable(); + String tableNameExpected = "Account_preferences"; + Table accountPreferencesTable = tables + .stream() + .filter(table -> table + .getName() + .equals(tableNameExpected)) + .findFirst() + .get(); + String implicitNameExpected = "account"; + + String implicitNameCreated = preferenceTable + .getColumn(3) + .getName(); + String tableNameCreated = accountPreferencesTable.getName(); + + SoftAssertions.assertSoftly(softly -> { + softly + .assertThat(implicitNameCreated) + .isEqualTo(implicitNameExpected); + softly + .assertThat(tableNameCreated) + .isEqualTo(tableNameExpected); + }); + } +} diff --git a/spring-boot-persistence/src/test/java/com/baeldung/repository/UserRepositoryIntegrationTest.java b/persistence-modules/spring-boot-persistence/src/test/java/com/baeldung/repository/UserRepositoryIntegrationTest.java similarity index 100% rename from spring-boot-persistence/src/test/java/com/baeldung/repository/UserRepositoryIntegrationTest.java rename to persistence-modules/spring-boot-persistence/src/test/java/com/baeldung/repository/UserRepositoryIntegrationTest.java diff --git a/persistence-modules/spring-boot-persistence/src/test/java/com/baeldung/springbootcrudapp/application/tests/UserControllerUnitTest.java b/persistence-modules/spring-boot-persistence/src/test/java/com/baeldung/springbootcrudapp/application/tests/UserControllerUnitTest.java new file mode 100644 index 0000000000..658af84516 --- /dev/null +++ b/persistence-modules/spring-boot-persistence/src/test/java/com/baeldung/springbootcrudapp/application/tests/UserControllerUnitTest.java @@ -0,0 +1,81 @@ +package com.baeldung.springbootcrudapp.application.tests; + +import com.baeldung.springbootcrudapp.application.controllers.UserController; +import com.baeldung.springbootcrudapp.application.entities.User; +import com.baeldung.springbootcrudapp.application.repositories.UserRepository; +import static org.assertj.core.api.Assertions.assertThat; +import org.junit.BeforeClass; +import org.junit.Test; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; +import org.springframework.ui.Model; +import org.springframework.validation.BindingResult; + +public class UserControllerUnitTest { + + private static UserController userController; + private static UserRepository mockedUserRepository; + private static BindingResult mockedBindingResult; + private static Model mockedModel; + + @BeforeClass + public static void setUpUserControllerInstance() { + mockedUserRepository = mock(UserRepository.class); + mockedBindingResult = mock(BindingResult.class); + mockedModel = mock(Model.class); + userController = new UserController(mockedUserRepository); + } + + @Test + public void whenCalledshowSignUpForm_thenCorrect() { + User user = new User("John", "john@domain.com"); + + assertThat(userController.showSignUpForm(user)).isEqualTo("add-user"); + } + + @Test + public void whenCalledaddUserAndValidUser_thenCorrect() { + User user = new User("John", "john@domain.com"); + + when(mockedBindingResult.hasErrors()).thenReturn(false); + + assertThat(userController.addUser(user, mockedBindingResult, mockedModel)).isEqualTo("index"); + } + + @Test + public void whenCalledaddUserAndInValidUser_thenCorrect() { + User user = new User("John", "john@domain.com"); + + when(mockedBindingResult.hasErrors()).thenReturn(true); + + assertThat(userController.addUser(user, mockedBindingResult, mockedModel)).isEqualTo("add-user"); + } + + @Test(expected = IllegalArgumentException.class) + public void whenCalledshowUpdateForm_thenIllegalArgumentException() { + assertThat(userController.showUpdateForm(0, mockedModel)).isEqualTo("update-user"); + } + + @Test + public void whenCalledupdateUserAndValidUser_thenCorrect() { + User user = new User("John", "john@domain.com"); + + when(mockedBindingResult.hasErrors()).thenReturn(false); + + assertThat(userController.updateUser(1l, user, mockedBindingResult, mockedModel)).isEqualTo("index"); + } + + @Test + public void whenCalledupdateUserAndInValidUser_thenCorrect() { + User user = new User("John", "john@domain.com"); + + when(mockedBindingResult.hasErrors()).thenReturn(true); + + assertThat(userController.updateUser(1l, user, mockedBindingResult, mockedModel)).isEqualTo("update-user"); + } + + @Test(expected = IllegalArgumentException.class) + public void whenCalleddeleteUser_thenIllegalArgumentException() { + assertThat(userController.deleteUser(1l, mockedModel)).isEqualTo("index"); + } +} diff --git a/persistence-modules/spring-boot-persistence/src/test/java/com/baeldung/springbootcrudapp/application/tests/UserUnitTest.java b/persistence-modules/spring-boot-persistence/src/test/java/com/baeldung/springbootcrudapp/application/tests/UserUnitTest.java new file mode 100644 index 0000000000..2bc4a72542 --- /dev/null +++ b/persistence-modules/spring-boot-persistence/src/test/java/com/baeldung/springbootcrudapp/application/tests/UserUnitTest.java @@ -0,0 +1,46 @@ +package com.baeldung.springbootcrudapp.application.tests; + +import com.baeldung.springbootcrudapp.application.entities.User; +import static org.assertj.core.api.Assertions.assertThat; +import org.junit.Test; + +public class UserUnitTest { + + @Test + public void whenCalledGetName_thenCorrect() { + User user = new User("Julie", "julie@domain.com"); + + assertThat(user.getName()).isEqualTo("Julie"); + } + + @Test + public void whenCalledGetEmail_thenCorrect() { + User user = new User("Julie", "julie@domain.com"); + + assertThat(user.getEmail()).isEqualTo("julie@domain.com"); + } + + @Test + public void whenCalledSetName_thenCorrect() { + User user = new User("Julie", "julie@domain.com"); + + user.setName("John"); + + assertThat(user.getName()).isEqualTo("John"); + } + + @Test + public void whenCalledSetEmail_thenCorrect() { + User user = new User("Julie", "julie@domain.com"); + + user.setEmail("john@domain.com"); + + assertThat(user.getEmail()).isEqualTo("john@domain.com"); + } + + @Test + public void whenCalledtoString_thenCorrect() { + User user = new User("Julie", "julie@domain.com"); + assertThat(user.toString()).isEqualTo("User{id=0, name=Julie, email=julie@domain.com}"); + } +} diff --git a/spring-boot-persistence/src/test/java/com/baeldung/tomcatconnectionpool/test/application/SpringBootTomcatConnectionPoolIntegrationTest.java b/persistence-modules/spring-boot-persistence/src/test/java/com/baeldung/tomcatconnectionpool/test/application/SpringBootTomcatConnectionPoolIntegrationTest.java similarity index 97% rename from spring-boot-persistence/src/test/java/com/baeldung/tomcatconnectionpool/test/application/SpringBootTomcatConnectionPoolIntegrationTest.java rename to persistence-modules/spring-boot-persistence/src/test/java/com/baeldung/tomcatconnectionpool/test/application/SpringBootTomcatConnectionPoolIntegrationTest.java index c68e137fb0..eb000bbc09 100644 --- a/spring-boot-persistence/src/test/java/com/baeldung/tomcatconnectionpool/test/application/SpringBootTomcatConnectionPoolIntegrationTest.java +++ b/persistence-modules/spring-boot-persistence/src/test/java/com/baeldung/tomcatconnectionpool/test/application/SpringBootTomcatConnectionPoolIntegrationTest.java @@ -1,22 +1,22 @@ -package com.baeldung.tomcatconnectionpool.test.application; - -import javax.sql.DataSource; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.test.context.junit4.SpringRunner; -import static org.assertj.core.api.Assertions.*; -import org.springframework.boot.test.context.SpringBootTest; - -@RunWith(SpringRunner.class) -@SpringBootTest -public class SpringBootTomcatConnectionPoolIntegrationTest { - - @Autowired - private DataSource dataSource; - - @Test - public void givenTomcatConnectionPoolInstance_whenCheckedPoolClassName_thenCorrect() { - assertThat(dataSource.getClass().getName()).isEqualTo("org.apache.tomcat.jdbc.pool.DataSource"); - } -} +package com.baeldung.tomcatconnectionpool.test.application; + +import javax.sql.DataSource; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.test.context.junit4.SpringRunner; +import static org.assertj.core.api.Assertions.*; +import org.springframework.boot.test.context.SpringBootTest; + +@RunWith(SpringRunner.class) +@SpringBootTest +public class SpringBootTomcatConnectionPoolIntegrationTest { + + @Autowired + private DataSource dataSource; + + @Test + public void givenTomcatConnectionPoolInstance_whenCheckedPoolClassName_thenCorrect() { + assertThat(dataSource.getClass().getName()).isEqualTo("org.apache.tomcat.jdbc.pool.DataSource"); + } +} diff --git a/spring-boot-persistence/src/test/java/org/baeldung/config/H2TestProfileJPAConfig.java b/persistence-modules/spring-boot-persistence/src/test/java/org/baeldung/config/H2TestProfileJPAConfig.java similarity index 100% rename from spring-boot-persistence/src/test/java/org/baeldung/config/H2TestProfileJPAConfig.java rename to persistence-modules/spring-boot-persistence/src/test/java/org/baeldung/config/H2TestProfileJPAConfig.java diff --git a/spring-boot-persistence/src/test/resources/application.properties b/persistence-modules/spring-boot-persistence/src/test/resources/application.properties similarity index 100% rename from spring-boot-persistence/src/test/resources/application.properties rename to persistence-modules/spring-boot-persistence/src/test/resources/application.properties diff --git a/spring-boot-persistence/src/test/resources/import_active_users.sql b/persistence-modules/spring-boot-persistence/src/test/resources/import_active_users.sql similarity index 100% rename from spring-boot-persistence/src/test/resources/import_active_users.sql rename to persistence-modules/spring-boot-persistence/src/test/resources/import_active_users.sql diff --git a/spring-boot-persistence/src/test/resources/import_inactive_users.sql b/persistence-modules/spring-boot-persistence/src/test/resources/import_inactive_users.sql similarity index 100% rename from spring-boot-persistence/src/test/resources/import_inactive_users.sql rename to persistence-modules/spring-boot-persistence/src/test/resources/import_inactive_users.sql diff --git a/spring-boot-persistence/src/test/resources/migrated_users.sql b/persistence-modules/spring-boot-persistence/src/test/resources/migrated_users.sql similarity index 100% rename from spring-boot-persistence/src/test/resources/migrated_users.sql rename to persistence-modules/spring-boot-persistence/src/test/resources/migrated_users.sql diff --git a/persistence-modules/spring-data-cassandra-reactive/pom.xml b/persistence-modules/spring-data-cassandra-reactive/pom.xml new file mode 100644 index 0000000000..037b1fd3c1 --- /dev/null +++ b/persistence-modules/spring-data-cassandra-reactive/pom.xml @@ -0,0 +1,70 @@ + + + 4.0.0 + + com.baeldung + spring-data-cassandra-reactive + 0.0.1-SNAPSHOT + jar + + spring-data-cassandra-reactive + Spring Data Cassandra reactive + + + org.springframework.boot + spring-boot-starter-parent + 2.1.0.RELEASE + + + + + UTF-8 + UTF-8 + + 1.8 + + + + + org.springframework.data + spring-data-cassandra + 2.1.2.RELEASE + + + io.projectreactor + reactor-core + + + org.springframework.boot + spring-boot-starter-web + + + org.projectlombok + lombok + true + + + org.springframework.boot + spring-boot-starter-test + test + + + io.projectreactor + reactor-test + test + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + + + + diff --git a/spring-custom-aop/src/main/java/org/baeldung/boot/DemoApplication.java b/persistence-modules/spring-data-cassandra-reactive/src/main/java/com/baeldung/cassandra/reactive/SpringDataCassandraReactiveApplication.java similarity index 52% rename from spring-custom-aop/src/main/java/org/baeldung/boot/DemoApplication.java rename to persistence-modules/spring-data-cassandra-reactive/src/main/java/com/baeldung/cassandra/reactive/SpringDataCassandraReactiveApplication.java index e61d140396..5f467042a3 100644 --- a/spring-custom-aop/src/main/java/org/baeldung/boot/DemoApplication.java +++ b/persistence-modules/spring-data-cassandra-reactive/src/main/java/com/baeldung/cassandra/reactive/SpringDataCassandraReactiveApplication.java @@ -1,14 +1,12 @@ -package org.baeldung.boot; +package com.baeldung.cassandra.reactive; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication -public class DemoApplication { +public class SpringDataCassandraReactiveApplication { public static void main(String[] args) { - System.setProperty("spring.config.name", "demo"); - SpringApplication.run(DemoApplication.class, args); + SpringApplication.run(SpringDataCassandraReactiveApplication.class, args); } - } diff --git a/persistence-modules/spring-data-cassandra-reactive/src/main/java/com/baeldung/cassandra/reactive/controller/EmployeeController.java b/persistence-modules/spring-data-cassandra-reactive/src/main/java/com/baeldung/cassandra/reactive/controller/EmployeeController.java new file mode 100644 index 0000000000..e9de213e61 --- /dev/null +++ b/persistence-modules/spring-data-cassandra-reactive/src/main/java/com/baeldung/cassandra/reactive/controller/EmployeeController.java @@ -0,0 +1,49 @@ +package com.baeldung.cassandra.reactive.controller; + +import com.baeldung.cassandra.reactive.model.Employee; +import com.baeldung.cassandra.reactive.service.EmployeeService; +import org.springframework.beans.factory.annotation.Autowired; +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 reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +import javax.annotation.PostConstruct; +import java.util.ArrayList; +import java.util.List; + +@RestController +@RequestMapping("employee") +public class EmployeeController { + + @Autowired + EmployeeService employeeService; + + @PostConstruct + public void saveEmployees() { + List employees = new ArrayList<>(); + employees.add(new Employee(123, "John Doe", "Delaware", "jdoe@xyz.com", 31)); + employees.add(new Employee(324, "Adam Smith", "North Carolina", "asmith@xyz.com", 43)); + employees.add(new Employee(355, "Kevin Dunner", "Virginia", "kdunner@xyz.com", 24)); + employees.add(new Employee(643, "Mike Lauren", "New York", "mlauren@xyz.com", 41)); + employeeService.initializeEmployees(employees); + } + + @GetMapping("/list") + public Flux getAllEmployees() { + Flux employees = employeeService.getAllEmployees(); + return employees; + } + + @GetMapping("/{id}") + public Mono getEmployeeById(@PathVariable int id) { + return employeeService.getEmployeeById(id); + } + + @GetMapping("/filterByAge/{age}") + public Flux getEmployeesFilterByAge(@PathVariable int age) { + return employeeService.getEmployeesFilterByAge(age); + } +} diff --git a/persistence-modules/spring-data-cassandra-reactive/src/main/java/com/baeldung/cassandra/reactive/model/Employee.java b/persistence-modules/spring-data-cassandra-reactive/src/main/java/com/baeldung/cassandra/reactive/model/Employee.java new file mode 100644 index 0000000000..a78f884778 --- /dev/null +++ b/persistence-modules/spring-data-cassandra-reactive/src/main/java/com/baeldung/cassandra/reactive/model/Employee.java @@ -0,0 +1,20 @@ +package com.baeldung.cassandra.reactive.model; + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; +import org.springframework.data.cassandra.core.mapping.PrimaryKey; +import org.springframework.data.cassandra.core.mapping.Table; + +@Table +@Data +@AllArgsConstructor +@NoArgsConstructor +public class Employee { + @PrimaryKey + private int id; + private String name; + private String address; + private String email; + private int age; +} diff --git a/persistence-modules/spring-data-cassandra-reactive/src/main/java/com/baeldung/cassandra/reactive/repository/EmployeeRepository.java b/persistence-modules/spring-data-cassandra-reactive/src/main/java/com/baeldung/cassandra/reactive/repository/EmployeeRepository.java new file mode 100644 index 0000000000..22dc2b4565 --- /dev/null +++ b/persistence-modules/spring-data-cassandra-reactive/src/main/java/com/baeldung/cassandra/reactive/repository/EmployeeRepository.java @@ -0,0 +1,11 @@ +package com.baeldung.cassandra.reactive.repository; + +import com.baeldung.cassandra.reactive.model.Employee; +import org.springframework.data.cassandra.repository.AllowFiltering; +import org.springframework.data.cassandra.repository.ReactiveCassandraRepository; +import reactor.core.publisher.Flux; + +public interface EmployeeRepository extends ReactiveCassandraRepository { + @AllowFiltering + Flux findByAgeGreaterThan(int age); +} diff --git a/persistence-modules/spring-data-cassandra-reactive/src/main/java/com/baeldung/cassandra/reactive/service/EmployeeService.java b/persistence-modules/spring-data-cassandra-reactive/src/main/java/com/baeldung/cassandra/reactive/service/EmployeeService.java new file mode 100644 index 0000000000..40c330937a --- /dev/null +++ b/persistence-modules/spring-data-cassandra-reactive/src/main/java/com/baeldung/cassandra/reactive/service/EmployeeService.java @@ -0,0 +1,35 @@ +package com.baeldung.cassandra.reactive.service; + +import com.baeldung.cassandra.reactive.model.Employee; +import com.baeldung.cassandra.reactive.repository.EmployeeRepository; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +import java.util.List; + +@Service +public class EmployeeService { + + @Autowired + EmployeeRepository employeeRepository; + + public void initializeEmployees(List employees) { + Flux savedEmployees = employeeRepository.saveAll(employees); + savedEmployees.subscribe(); + } + + public Flux getAllEmployees() { + Flux employees = employeeRepository.findAll(); + return employees; + } + + public Flux getEmployeesFilterByAge(int age) { + return employeeRepository.findByAgeGreaterThan(age); + } + + public Mono getEmployeeById(int id) { + return employeeRepository.findById(id); + } +} diff --git a/persistence-modules/spring-data-cassandra-reactive/src/main/resources/application.properties b/persistence-modules/spring-data-cassandra-reactive/src/main/resources/application.properties new file mode 100644 index 0000000000..7ed2f10131 --- /dev/null +++ b/persistence-modules/spring-data-cassandra-reactive/src/main/resources/application.properties @@ -0,0 +1,2 @@ +spring.data.cassandra.keyspace-name=practice +spring.data.cassandra.port=9042 \ No newline at end of file diff --git a/persistence-modules/spring-data-cassandra-reactive/src/test/java/com/baeldung/cassandra/reactive/ReactiveEmployeeRepositoryIntegrationTest.java b/persistence-modules/spring-data-cassandra-reactive/src/test/java/com/baeldung/cassandra/reactive/ReactiveEmployeeRepositoryIntegrationTest.java new file mode 100644 index 0000000000..ad726fe969 --- /dev/null +++ b/persistence-modules/spring-data-cassandra-reactive/src/test/java/com/baeldung/cassandra/reactive/ReactiveEmployeeRepositoryIntegrationTest.java @@ -0,0 +1,55 @@ +package com.baeldung.cassandra.reactive; + +import com.baeldung.cassandra.reactive.model.Employee; +import com.baeldung.cassandra.reactive.repository.EmployeeRepository; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; +import reactor.test.StepVerifier; + + +@RunWith(SpringRunner.class) +@SpringBootTest +public class ReactiveEmployeeRepositoryIntegrationTest { + + @Autowired + EmployeeRepository repository; + + @Before + public void setUp() { + + Flux deleteAndInsert = repository.deleteAll() // + .thenMany(repository.saveAll(Flux.just( + new Employee(111, "John Doe", "Delaware", "jdoe@xyz.com", 31), + new Employee(222, "Adam Smith", "North Carolina", "asmith@xyz.com", 43), + new Employee(333, "Kevin Dunner", "Virginia", "kdunner@xyz.com", 24), + new Employee(444, "Mike Lauren", "New York", "mlauren@xyz.com", 41)))); + + StepVerifier.create(deleteAndInsert).expectNextCount(4).verifyComplete(); + } + + @Test + public void givenRecordsAreInserted_whenDbIsQueried_thenShouldIncludeNewRecords() { + + Mono saveAndCount = repository.count() + .doOnNext(System.out::println) + .thenMany(repository.saveAll(Flux.just(new Employee(325, "Kim Jones", "Florida", "kjones@xyz.com", 42), + new Employee(654, "Tom Moody", "New Hampshire", "tmoody@xyz.com", 44)))) + .last() + .flatMap(v -> repository.count()) + .doOnNext(System.out::println); + + StepVerifier.create(saveAndCount).expectNext(6L).verifyComplete(); + } + + @Test + public void givenAgeForFilter_whenDbIsQueried_thenShouldReturnFilteredRecords() { + StepVerifier.create(repository.findByAgeGreaterThan(35)).expectNextCount(2).verifyComplete(); + } + +} diff --git a/spring-data-couchbase-2/README.md b/persistence-modules/spring-data-couchbase-2/README.md similarity index 100% rename from spring-data-couchbase-2/README.md rename to persistence-modules/spring-data-couchbase-2/README.md diff --git a/spring-data-couchbase-2/pom.xml b/persistence-modules/spring-data-couchbase-2/pom.xml similarity index 98% rename from spring-data-couchbase-2/pom.xml rename to persistence-modules/spring-data-couchbase-2/pom.xml index 6c7d7a9d11..a857ee538f 100644 --- a/spring-data-couchbase-2/pom.xml +++ b/persistence-modules/spring-data-couchbase-2/pom.xml @@ -11,6 +11,7 @@ com.baeldung parent-modules 1.0.0-SNAPSHOT + ../../ diff --git a/spring-data-couchbase-2/src/main/java/org/baeldung/spring/data/couchbase/model/Campus.java b/persistence-modules/spring-data-couchbase-2/src/main/java/org/baeldung/spring/data/couchbase/model/Campus.java similarity index 100% rename from spring-data-couchbase-2/src/main/java/org/baeldung/spring/data/couchbase/model/Campus.java rename to persistence-modules/spring-data-couchbase-2/src/main/java/org/baeldung/spring/data/couchbase/model/Campus.java diff --git a/spring-data-couchbase-2/src/main/java/org/baeldung/spring/data/couchbase/model/Person.java b/persistence-modules/spring-data-couchbase-2/src/main/java/org/baeldung/spring/data/couchbase/model/Person.java similarity index 100% rename from spring-data-couchbase-2/src/main/java/org/baeldung/spring/data/couchbase/model/Person.java rename to persistence-modules/spring-data-couchbase-2/src/main/java/org/baeldung/spring/data/couchbase/model/Person.java diff --git a/spring-data-couchbase-2/src/main/java/org/baeldung/spring/data/couchbase/model/Student.java b/persistence-modules/spring-data-couchbase-2/src/main/java/org/baeldung/spring/data/couchbase/model/Student.java similarity index 100% rename from spring-data-couchbase-2/src/main/java/org/baeldung/spring/data/couchbase/model/Student.java rename to persistence-modules/spring-data-couchbase-2/src/main/java/org/baeldung/spring/data/couchbase/model/Student.java diff --git a/spring-data-couchbase-2/src/main/java/org/baeldung/spring/data/couchbase/repos/CustomStudentRepository.java b/persistence-modules/spring-data-couchbase-2/src/main/java/org/baeldung/spring/data/couchbase/repos/CustomStudentRepository.java similarity index 100% rename from spring-data-couchbase-2/src/main/java/org/baeldung/spring/data/couchbase/repos/CustomStudentRepository.java rename to persistence-modules/spring-data-couchbase-2/src/main/java/org/baeldung/spring/data/couchbase/repos/CustomStudentRepository.java diff --git a/spring-data-couchbase-2/src/main/java/org/baeldung/spring/data/couchbase/repos/CustomStudentRepositoryImpl.java b/persistence-modules/spring-data-couchbase-2/src/main/java/org/baeldung/spring/data/couchbase/repos/CustomStudentRepositoryImpl.java similarity index 100% rename from spring-data-couchbase-2/src/main/java/org/baeldung/spring/data/couchbase/repos/CustomStudentRepositoryImpl.java rename to persistence-modules/spring-data-couchbase-2/src/main/java/org/baeldung/spring/data/couchbase/repos/CustomStudentRepositoryImpl.java diff --git a/spring-data-couchbase-2/src/main/java/org/baeldung/spring/data/couchbase/repos/PersonRepository.java b/persistence-modules/spring-data-couchbase-2/src/main/java/org/baeldung/spring/data/couchbase/repos/PersonRepository.java similarity index 100% rename from spring-data-couchbase-2/src/main/java/org/baeldung/spring/data/couchbase/repos/PersonRepository.java rename to persistence-modules/spring-data-couchbase-2/src/main/java/org/baeldung/spring/data/couchbase/repos/PersonRepository.java diff --git a/spring-data-couchbase-2/src/main/java/org/baeldung/spring/data/couchbase/repos/StudentRepository.java b/persistence-modules/spring-data-couchbase-2/src/main/java/org/baeldung/spring/data/couchbase/repos/StudentRepository.java similarity index 100% rename from spring-data-couchbase-2/src/main/java/org/baeldung/spring/data/couchbase/repos/StudentRepository.java rename to persistence-modules/spring-data-couchbase-2/src/main/java/org/baeldung/spring/data/couchbase/repos/StudentRepository.java diff --git a/spring-data-couchbase-2/src/main/java/org/baeldung/spring/data/couchbase/service/PersonRepositoryService.java b/persistence-modules/spring-data-couchbase-2/src/main/java/org/baeldung/spring/data/couchbase/service/PersonRepositoryService.java similarity index 100% rename from spring-data-couchbase-2/src/main/java/org/baeldung/spring/data/couchbase/service/PersonRepositoryService.java rename to persistence-modules/spring-data-couchbase-2/src/main/java/org/baeldung/spring/data/couchbase/service/PersonRepositoryService.java diff --git a/spring-data-couchbase-2/src/main/java/org/baeldung/spring/data/couchbase/service/PersonService.java b/persistence-modules/spring-data-couchbase-2/src/main/java/org/baeldung/spring/data/couchbase/service/PersonService.java similarity index 100% rename from spring-data-couchbase-2/src/main/java/org/baeldung/spring/data/couchbase/service/PersonService.java rename to persistence-modules/spring-data-couchbase-2/src/main/java/org/baeldung/spring/data/couchbase/service/PersonService.java diff --git a/spring-data-couchbase-2/src/main/java/org/baeldung/spring/data/couchbase/service/PersonTemplateService.java b/persistence-modules/spring-data-couchbase-2/src/main/java/org/baeldung/spring/data/couchbase/service/PersonTemplateService.java similarity index 100% rename from spring-data-couchbase-2/src/main/java/org/baeldung/spring/data/couchbase/service/PersonTemplateService.java rename to persistence-modules/spring-data-couchbase-2/src/main/java/org/baeldung/spring/data/couchbase/service/PersonTemplateService.java diff --git a/spring-data-couchbase-2/src/main/java/org/baeldung/spring/data/couchbase/service/StudentRepositoryService.java b/persistence-modules/spring-data-couchbase-2/src/main/java/org/baeldung/spring/data/couchbase/service/StudentRepositoryService.java similarity index 100% rename from spring-data-couchbase-2/src/main/java/org/baeldung/spring/data/couchbase/service/StudentRepositoryService.java rename to persistence-modules/spring-data-couchbase-2/src/main/java/org/baeldung/spring/data/couchbase/service/StudentRepositoryService.java diff --git a/spring-data-couchbase-2/src/main/java/org/baeldung/spring/data/couchbase/service/StudentService.java b/persistence-modules/spring-data-couchbase-2/src/main/java/org/baeldung/spring/data/couchbase/service/StudentService.java similarity index 100% rename from spring-data-couchbase-2/src/main/java/org/baeldung/spring/data/couchbase/service/StudentService.java rename to persistence-modules/spring-data-couchbase-2/src/main/java/org/baeldung/spring/data/couchbase/service/StudentService.java diff --git a/spring-data-couchbase-2/src/main/java/org/baeldung/spring/data/couchbase/service/StudentTemplateService.java b/persistence-modules/spring-data-couchbase-2/src/main/java/org/baeldung/spring/data/couchbase/service/StudentTemplateService.java similarity index 100% rename from spring-data-couchbase-2/src/main/java/org/baeldung/spring/data/couchbase/service/StudentTemplateService.java rename to persistence-modules/spring-data-couchbase-2/src/main/java/org/baeldung/spring/data/couchbase/service/StudentTemplateService.java diff --git a/spring-data-couchbase-2/src/main/java/org/baeldung/spring/data/couchbase2b/repos/CampusRepository.java b/persistence-modules/spring-data-couchbase-2/src/main/java/org/baeldung/spring/data/couchbase2b/repos/CampusRepository.java similarity index 100% rename from spring-data-couchbase-2/src/main/java/org/baeldung/spring/data/couchbase2b/repos/CampusRepository.java rename to persistence-modules/spring-data-couchbase-2/src/main/java/org/baeldung/spring/data/couchbase2b/repos/CampusRepository.java diff --git a/spring-data-couchbase-2/src/main/java/org/baeldung/spring/data/couchbase2b/repos/PersonRepository.java b/persistence-modules/spring-data-couchbase-2/src/main/java/org/baeldung/spring/data/couchbase2b/repos/PersonRepository.java similarity index 100% rename from spring-data-couchbase-2/src/main/java/org/baeldung/spring/data/couchbase2b/repos/PersonRepository.java rename to persistence-modules/spring-data-couchbase-2/src/main/java/org/baeldung/spring/data/couchbase2b/repos/PersonRepository.java diff --git a/spring-data-couchbase-2/src/main/java/org/baeldung/spring/data/couchbase2b/repos/StudentRepository.java b/persistence-modules/spring-data-couchbase-2/src/main/java/org/baeldung/spring/data/couchbase2b/repos/StudentRepository.java similarity index 100% rename from spring-data-couchbase-2/src/main/java/org/baeldung/spring/data/couchbase2b/repos/StudentRepository.java rename to persistence-modules/spring-data-couchbase-2/src/main/java/org/baeldung/spring/data/couchbase2b/repos/StudentRepository.java diff --git a/spring-data-couchbase-2/src/main/java/org/baeldung/spring/data/couchbase2b/service/CampusService.java b/persistence-modules/spring-data-couchbase-2/src/main/java/org/baeldung/spring/data/couchbase2b/service/CampusService.java similarity index 100% rename from spring-data-couchbase-2/src/main/java/org/baeldung/spring/data/couchbase2b/service/CampusService.java rename to persistence-modules/spring-data-couchbase-2/src/main/java/org/baeldung/spring/data/couchbase2b/service/CampusService.java diff --git a/spring-data-couchbase-2/src/main/java/org/baeldung/spring/data/couchbase2b/service/CampusServiceImpl.java b/persistence-modules/spring-data-couchbase-2/src/main/java/org/baeldung/spring/data/couchbase2b/service/CampusServiceImpl.java similarity index 100% rename from spring-data-couchbase-2/src/main/java/org/baeldung/spring/data/couchbase2b/service/CampusServiceImpl.java rename to persistence-modules/spring-data-couchbase-2/src/main/java/org/baeldung/spring/data/couchbase2b/service/CampusServiceImpl.java diff --git a/spring-data-couchbase-2/src/main/java/org/baeldung/spring/data/couchbase2b/service/PersonService.java b/persistence-modules/spring-data-couchbase-2/src/main/java/org/baeldung/spring/data/couchbase2b/service/PersonService.java similarity index 100% rename from spring-data-couchbase-2/src/main/java/org/baeldung/spring/data/couchbase2b/service/PersonService.java rename to persistence-modules/spring-data-couchbase-2/src/main/java/org/baeldung/spring/data/couchbase2b/service/PersonService.java diff --git a/spring-data-couchbase-2/src/main/java/org/baeldung/spring/data/couchbase2b/service/PersonServiceImpl.java b/persistence-modules/spring-data-couchbase-2/src/main/java/org/baeldung/spring/data/couchbase2b/service/PersonServiceImpl.java similarity index 100% rename from spring-data-couchbase-2/src/main/java/org/baeldung/spring/data/couchbase2b/service/PersonServiceImpl.java rename to persistence-modules/spring-data-couchbase-2/src/main/java/org/baeldung/spring/data/couchbase2b/service/PersonServiceImpl.java diff --git a/spring-data-couchbase-2/src/main/java/org/baeldung/spring/data/couchbase2b/service/StudentService.java b/persistence-modules/spring-data-couchbase-2/src/main/java/org/baeldung/spring/data/couchbase2b/service/StudentService.java similarity index 100% rename from spring-data-couchbase-2/src/main/java/org/baeldung/spring/data/couchbase2b/service/StudentService.java rename to persistence-modules/spring-data-couchbase-2/src/main/java/org/baeldung/spring/data/couchbase2b/service/StudentService.java diff --git a/spring-data-couchbase-2/src/main/java/org/baeldung/spring/data/couchbase2b/service/StudentServiceImpl.java b/persistence-modules/spring-data-couchbase-2/src/main/java/org/baeldung/spring/data/couchbase2b/service/StudentServiceImpl.java similarity index 100% rename from spring-data-couchbase-2/src/main/java/org/baeldung/spring/data/couchbase2b/service/StudentServiceImpl.java rename to persistence-modules/spring-data-couchbase-2/src/main/java/org/baeldung/spring/data/couchbase2b/service/StudentServiceImpl.java diff --git a/spring-custom-aop/src/main/resources/logback.xml b/persistence-modules/spring-data-couchbase-2/src/main/resources/logback.xml similarity index 100% rename from spring-custom-aop/src/main/resources/logback.xml rename to persistence-modules/spring-data-couchbase-2/src/main/resources/logback.xml diff --git a/spring-data-couchbase-2/src/site/site.xml b/persistence-modules/spring-data-couchbase-2/src/site/site.xml similarity index 100% rename from spring-data-couchbase-2/src/site/site.xml rename to persistence-modules/spring-data-couchbase-2/src/site/site.xml diff --git a/spring-data-couchbase-2/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/persistence-modules/spring-data-couchbase-2/src/test/java/org/baeldung/SpringContextIntegrationTest.java similarity index 100% rename from spring-data-couchbase-2/src/test/java/org/baeldung/SpringContextIntegrationTest.java rename to persistence-modules/spring-data-couchbase-2/src/test/java/org/baeldung/SpringContextIntegrationTest.java diff --git a/spring-data-couchbase-2/src/test/java/org/baeldung/spring/data/couchbase/CustomTypeKeyCouchbaseConfig.java b/persistence-modules/spring-data-couchbase-2/src/test/java/org/baeldung/spring/data/couchbase/CustomTypeKeyCouchbaseConfig.java similarity index 100% rename from spring-data-couchbase-2/src/test/java/org/baeldung/spring/data/couchbase/CustomTypeKeyCouchbaseConfig.java rename to persistence-modules/spring-data-couchbase-2/src/test/java/org/baeldung/spring/data/couchbase/CustomTypeKeyCouchbaseConfig.java diff --git a/spring-data-couchbase-2/src/test/java/org/baeldung/spring/data/couchbase/IntegrationTest.java b/persistence-modules/spring-data-couchbase-2/src/test/java/org/baeldung/spring/data/couchbase/IntegrationTest.java similarity index 100% rename from spring-data-couchbase-2/src/test/java/org/baeldung/spring/data/couchbase/IntegrationTest.java rename to persistence-modules/spring-data-couchbase-2/src/test/java/org/baeldung/spring/data/couchbase/IntegrationTest.java diff --git a/spring-data-couchbase-2/src/test/java/org/baeldung/spring/data/couchbase/IntegrationTestConfig.java b/persistence-modules/spring-data-couchbase-2/src/test/java/org/baeldung/spring/data/couchbase/IntegrationTestConfig.java similarity index 100% rename from spring-data-couchbase-2/src/test/java/org/baeldung/spring/data/couchbase/IntegrationTestConfig.java rename to persistence-modules/spring-data-couchbase-2/src/test/java/org/baeldung/spring/data/couchbase/IntegrationTestConfig.java diff --git a/spring-data-couchbase-2/src/test/java/org/baeldung/spring/data/couchbase/MyCouchbaseConfig.java b/persistence-modules/spring-data-couchbase-2/src/test/java/org/baeldung/spring/data/couchbase/MyCouchbaseConfig.java similarity index 100% rename from spring-data-couchbase-2/src/test/java/org/baeldung/spring/data/couchbase/MyCouchbaseConfig.java rename to persistence-modules/spring-data-couchbase-2/src/test/java/org/baeldung/spring/data/couchbase/MyCouchbaseConfig.java diff --git a/spring-data-couchbase-2/src/test/java/org/baeldung/spring/data/couchbase/ReadYourOwnWritesCouchbaseConfig.java b/persistence-modules/spring-data-couchbase-2/src/test/java/org/baeldung/spring/data/couchbase/ReadYourOwnWritesCouchbaseConfig.java similarity index 100% rename from spring-data-couchbase-2/src/test/java/org/baeldung/spring/data/couchbase/ReadYourOwnWritesCouchbaseConfig.java rename to persistence-modules/spring-data-couchbase-2/src/test/java/org/baeldung/spring/data/couchbase/ReadYourOwnWritesCouchbaseConfig.java diff --git a/spring-data-couchbase-2/src/test/java/org/baeldung/spring/data/couchbase/service/PersonRepositoryServiceIntegrationTest.java b/persistence-modules/spring-data-couchbase-2/src/test/java/org/baeldung/spring/data/couchbase/service/PersonRepositoryServiceIntegrationTest.java similarity index 100% rename from spring-data-couchbase-2/src/test/java/org/baeldung/spring/data/couchbase/service/PersonRepositoryServiceIntegrationTest.java rename to persistence-modules/spring-data-couchbase-2/src/test/java/org/baeldung/spring/data/couchbase/service/PersonRepositoryServiceIntegrationTest.java diff --git a/spring-data-couchbase-2/src/test/java/org/baeldung/spring/data/couchbase/service/PersonServiceIntegrationTest.java b/persistence-modules/spring-data-couchbase-2/src/test/java/org/baeldung/spring/data/couchbase/service/PersonServiceIntegrationTest.java similarity index 100% rename from spring-data-couchbase-2/src/test/java/org/baeldung/spring/data/couchbase/service/PersonServiceIntegrationTest.java rename to persistence-modules/spring-data-couchbase-2/src/test/java/org/baeldung/spring/data/couchbase/service/PersonServiceIntegrationTest.java diff --git a/spring-data-couchbase-2/src/test/java/org/baeldung/spring/data/couchbase/service/PersonTemplateServiceIntegrationTest.java b/persistence-modules/spring-data-couchbase-2/src/test/java/org/baeldung/spring/data/couchbase/service/PersonTemplateServiceIntegrationTest.java similarity index 100% rename from spring-data-couchbase-2/src/test/java/org/baeldung/spring/data/couchbase/service/PersonTemplateServiceIntegrationTest.java rename to persistence-modules/spring-data-couchbase-2/src/test/java/org/baeldung/spring/data/couchbase/service/PersonTemplateServiceIntegrationTest.java diff --git a/spring-data-couchbase-2/src/test/java/org/baeldung/spring/data/couchbase/service/StudentRepositoryServiceIntegrationTest.java b/persistence-modules/spring-data-couchbase-2/src/test/java/org/baeldung/spring/data/couchbase/service/StudentRepositoryServiceIntegrationTest.java similarity index 100% rename from spring-data-couchbase-2/src/test/java/org/baeldung/spring/data/couchbase/service/StudentRepositoryServiceIntegrationTest.java rename to persistence-modules/spring-data-couchbase-2/src/test/java/org/baeldung/spring/data/couchbase/service/StudentRepositoryServiceIntegrationTest.java diff --git a/spring-data-couchbase-2/src/test/java/org/baeldung/spring/data/couchbase/service/StudentServiceIntegrationTest.java b/persistence-modules/spring-data-couchbase-2/src/test/java/org/baeldung/spring/data/couchbase/service/StudentServiceIntegrationTest.java similarity index 100% rename from spring-data-couchbase-2/src/test/java/org/baeldung/spring/data/couchbase/service/StudentServiceIntegrationTest.java rename to persistence-modules/spring-data-couchbase-2/src/test/java/org/baeldung/spring/data/couchbase/service/StudentServiceIntegrationTest.java diff --git a/spring-data-couchbase-2/src/test/java/org/baeldung/spring/data/couchbase/service/StudentTemplateServiceIntegrationTest.java b/persistence-modules/spring-data-couchbase-2/src/test/java/org/baeldung/spring/data/couchbase/service/StudentTemplateServiceIntegrationTest.java similarity index 100% rename from spring-data-couchbase-2/src/test/java/org/baeldung/spring/data/couchbase/service/StudentTemplateServiceIntegrationTest.java rename to persistence-modules/spring-data-couchbase-2/src/test/java/org/baeldung/spring/data/couchbase/service/StudentTemplateServiceIntegrationTest.java diff --git a/spring-data-couchbase-2/src/test/java/org/baeldung/spring/data/couchbase2b/MultiBucketCouchbaseConfig.java b/persistence-modules/spring-data-couchbase-2/src/test/java/org/baeldung/spring/data/couchbase2b/MultiBucketCouchbaseConfig.java similarity index 100% rename from spring-data-couchbase-2/src/test/java/org/baeldung/spring/data/couchbase2b/MultiBucketCouchbaseConfig.java rename to persistence-modules/spring-data-couchbase-2/src/test/java/org/baeldung/spring/data/couchbase2b/MultiBucketCouchbaseConfig.java diff --git a/spring-data-couchbase-2/src/test/java/org/baeldung/spring/data/couchbase2b/MultiBucketIntegrationTest.java b/persistence-modules/spring-data-couchbase-2/src/test/java/org/baeldung/spring/data/couchbase2b/MultiBucketIntegrationTest.java similarity index 100% rename from spring-data-couchbase-2/src/test/java/org/baeldung/spring/data/couchbase2b/MultiBucketIntegrationTest.java rename to persistence-modules/spring-data-couchbase-2/src/test/java/org/baeldung/spring/data/couchbase2b/MultiBucketIntegrationTest.java diff --git a/spring-data-couchbase-2/src/test/java/org/baeldung/spring/data/couchbase2b/MultiBucketIntegrationTestConfig.java b/persistence-modules/spring-data-couchbase-2/src/test/java/org/baeldung/spring/data/couchbase2b/MultiBucketIntegrationTestConfig.java similarity index 100% rename from spring-data-couchbase-2/src/test/java/org/baeldung/spring/data/couchbase2b/MultiBucketIntegrationTestConfig.java rename to persistence-modules/spring-data-couchbase-2/src/test/java/org/baeldung/spring/data/couchbase2b/MultiBucketIntegrationTestConfig.java diff --git a/spring-data-couchbase-2/src/test/java/org/baeldung/spring/data/couchbase2b/service/CampusServiceImplIntegrationTest.java b/persistence-modules/spring-data-couchbase-2/src/test/java/org/baeldung/spring/data/couchbase2b/service/CampusServiceImplIntegrationTest.java similarity index 100% rename from spring-data-couchbase-2/src/test/java/org/baeldung/spring/data/couchbase2b/service/CampusServiceImplIntegrationTest.java rename to persistence-modules/spring-data-couchbase-2/src/test/java/org/baeldung/spring/data/couchbase2b/service/CampusServiceImplIntegrationTest.java diff --git a/spring-data-couchbase-2/src/test/java/org/baeldung/spring/data/couchbase2b/service/PersonServiceImplIntegrationTest.java b/persistence-modules/spring-data-couchbase-2/src/test/java/org/baeldung/spring/data/couchbase2b/service/PersonServiceImplIntegrationTest.java similarity index 100% rename from spring-data-couchbase-2/src/test/java/org/baeldung/spring/data/couchbase2b/service/PersonServiceImplIntegrationTest.java rename to persistence-modules/spring-data-couchbase-2/src/test/java/org/baeldung/spring/data/couchbase2b/service/PersonServiceImplIntegrationTest.java diff --git a/spring-data-couchbase-2/src/test/java/org/baeldung/spring/data/couchbase2b/service/StudentServiceImplIntegrationTest.java b/persistence-modules/spring-data-couchbase-2/src/test/java/org/baeldung/spring/data/couchbase2b/service/StudentServiceImplIntegrationTest.java similarity index 100% rename from spring-data-couchbase-2/src/test/java/org/baeldung/spring/data/couchbase2b/service/StudentServiceImplIntegrationTest.java rename to persistence-modules/spring-data-couchbase-2/src/test/java/org/baeldung/spring/data/couchbase2b/service/StudentServiceImplIntegrationTest.java diff --git a/spring-data-couchbase-2/src/main/resources/logback.xml b/persistence-modules/spring-data-couchbase-2/src/test/resources/logback.xml similarity index 100% rename from spring-data-couchbase-2/src/main/resources/logback.xml rename to persistence-modules/spring-data-couchbase-2/src/test/resources/logback.xml diff --git a/persistence-modules/spring-data-dynamodb/pom.xml b/persistence-modules/spring-data-dynamodb/pom.xml index 4cb805131a..e8bf9b8c1e 100644 --- a/persistence-modules/spring-data-dynamodb/pom.xml +++ b/persistence-modules/spring-data-dynamodb/pom.xml @@ -1,9 +1,7 @@ 4.0.0 - com.baeldung spring-data-dynamodb - 0.0.1-SNAPSHOT jar spring-data-dynamodb This is simple boot application for Spring boot dynamodb test @@ -85,7 +83,6 @@ org.apache.httpcomponents httpclient - ${httpclient.version} diff --git a/spring-data-elasticsearch/README.md b/persistence-modules/spring-data-elasticsearch/README.md similarity index 100% rename from spring-data-elasticsearch/README.md rename to persistence-modules/spring-data-elasticsearch/README.md diff --git a/spring-data-elasticsearch/pom.xml b/persistence-modules/spring-data-elasticsearch/pom.xml similarity index 98% rename from spring-data-elasticsearch/pom.xml rename to persistence-modules/spring-data-elasticsearch/pom.xml index 99d8a70807..ee9e71a1cb 100644 --- a/spring-data-elasticsearch/pom.xml +++ b/persistence-modules/spring-data-elasticsearch/pom.xml @@ -11,7 +11,7 @@ com.baeldung parent-spring-5 0.0.1-SNAPSHOT - ../parent-spring-5 + ../../parent-spring-5 diff --git a/spring-data-elasticsearch/src/main/java/com/baeldung/elasticsearch/Person.java b/persistence-modules/spring-data-elasticsearch/src/main/java/com/baeldung/elasticsearch/Person.java similarity index 100% rename from spring-data-elasticsearch/src/main/java/com/baeldung/elasticsearch/Person.java rename to persistence-modules/spring-data-elasticsearch/src/main/java/com/baeldung/elasticsearch/Person.java diff --git a/spring-data-elasticsearch/src/main/java/com/baeldung/spring/data/es/config/Config.java b/persistence-modules/spring-data-elasticsearch/src/main/java/com/baeldung/spring/data/es/config/Config.java similarity index 100% rename from spring-data-elasticsearch/src/main/java/com/baeldung/spring/data/es/config/Config.java rename to persistence-modules/spring-data-elasticsearch/src/main/java/com/baeldung/spring/data/es/config/Config.java diff --git a/spring-data-elasticsearch/src/main/java/com/baeldung/spring/data/es/model/Article.java b/persistence-modules/spring-data-elasticsearch/src/main/java/com/baeldung/spring/data/es/model/Article.java similarity index 100% rename from spring-data-elasticsearch/src/main/java/com/baeldung/spring/data/es/model/Article.java rename to persistence-modules/spring-data-elasticsearch/src/main/java/com/baeldung/spring/data/es/model/Article.java diff --git a/spring-data-elasticsearch/src/main/java/com/baeldung/spring/data/es/model/Author.java b/persistence-modules/spring-data-elasticsearch/src/main/java/com/baeldung/spring/data/es/model/Author.java similarity index 100% rename from spring-data-elasticsearch/src/main/java/com/baeldung/spring/data/es/model/Author.java rename to persistence-modules/spring-data-elasticsearch/src/main/java/com/baeldung/spring/data/es/model/Author.java diff --git a/spring-data-elasticsearch/src/main/java/com/baeldung/spring/data/es/repository/ArticleRepository.java b/persistence-modules/spring-data-elasticsearch/src/main/java/com/baeldung/spring/data/es/repository/ArticleRepository.java similarity index 100% rename from spring-data-elasticsearch/src/main/java/com/baeldung/spring/data/es/repository/ArticleRepository.java rename to persistence-modules/spring-data-elasticsearch/src/main/java/com/baeldung/spring/data/es/repository/ArticleRepository.java diff --git a/spring-data-elasticsearch/src/main/java/com/baeldung/spring/data/es/service/ArticleService.java b/persistence-modules/spring-data-elasticsearch/src/main/java/com/baeldung/spring/data/es/service/ArticleService.java similarity index 100% rename from spring-data-elasticsearch/src/main/java/com/baeldung/spring/data/es/service/ArticleService.java rename to persistence-modules/spring-data-elasticsearch/src/main/java/com/baeldung/spring/data/es/service/ArticleService.java diff --git a/spring-data-elasticsearch/src/main/java/com/baeldung/spring/data/es/service/ArticleServiceImpl.java b/persistence-modules/spring-data-elasticsearch/src/main/java/com/baeldung/spring/data/es/service/ArticleServiceImpl.java similarity index 100% rename from spring-data-elasticsearch/src/main/java/com/baeldung/spring/data/es/service/ArticleServiceImpl.java rename to persistence-modules/spring-data-elasticsearch/src/main/java/com/baeldung/spring/data/es/service/ArticleServiceImpl.java diff --git a/spring-data-elasticsearch/src/main/resources/log4j2.properties b/persistence-modules/spring-data-elasticsearch/src/main/resources/log4j2.properties similarity index 100% rename from spring-data-elasticsearch/src/main/resources/log4j2.properties rename to persistence-modules/spring-data-elasticsearch/src/main/resources/log4j2.properties diff --git a/spring-data-elasticsearch/src/test/java/com/baeldung/elasticsearch/ElasticSearchManualTest.java b/persistence-modules/spring-data-elasticsearch/src/test/java/com/baeldung/elasticsearch/ElasticSearchManualTest.java similarity index 100% rename from spring-data-elasticsearch/src/test/java/com/baeldung/elasticsearch/ElasticSearchManualTest.java rename to persistence-modules/spring-data-elasticsearch/src/test/java/com/baeldung/elasticsearch/ElasticSearchManualTest.java diff --git a/spring-data-elasticsearch/src/test/java/com/baeldung/elasticsearch/GeoQueriesIntegrationTest.java b/persistence-modules/spring-data-elasticsearch/src/test/java/com/baeldung/elasticsearch/GeoQueriesIntegrationTest.java similarity index 100% rename from spring-data-elasticsearch/src/test/java/com/baeldung/elasticsearch/GeoQueriesIntegrationTest.java rename to persistence-modules/spring-data-elasticsearch/src/test/java/com/baeldung/elasticsearch/GeoQueriesIntegrationTest.java diff --git a/spring-data-elasticsearch/src/test/java/com/baeldung/spring/data/es/ElasticSearchIntegrationTest.java b/persistence-modules/spring-data-elasticsearch/src/test/java/com/baeldung/spring/data/es/ElasticSearchIntegrationTest.java similarity index 100% rename from spring-data-elasticsearch/src/test/java/com/baeldung/spring/data/es/ElasticSearchIntegrationTest.java rename to persistence-modules/spring-data-elasticsearch/src/test/java/com/baeldung/spring/data/es/ElasticSearchIntegrationTest.java diff --git a/spring-data-elasticsearch/src/test/java/com/baeldung/spring/data/es/ElasticSearchQueryIntegrationTest.java b/persistence-modules/spring-data-elasticsearch/src/test/java/com/baeldung/spring/data/es/ElasticSearchQueryIntegrationTest.java similarity index 100% rename from spring-data-elasticsearch/src/test/java/com/baeldung/spring/data/es/ElasticSearchQueryIntegrationTest.java rename to persistence-modules/spring-data-elasticsearch/src/test/java/com/baeldung/spring/data/es/ElasticSearchQueryIntegrationTest.java diff --git a/spring-data-elasticsearch/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/persistence-modules/spring-data-elasticsearch/src/test/java/org/baeldung/SpringContextIntegrationTest.java similarity index 100% rename from spring-data-elasticsearch/src/test/java/org/baeldung/SpringContextIntegrationTest.java rename to persistence-modules/spring-data-elasticsearch/src/test/java/org/baeldung/SpringContextIntegrationTest.java diff --git a/persistence-modules/spring-data-gemfire/pom.xml b/persistence-modules/spring-data-gemfire/pom.xml index 34346c502f..292b7387ac 100644 --- a/persistence-modules/spring-data-gemfire/pom.xml +++ b/persistence-modules/spring-data-gemfire/pom.xml @@ -5,6 +5,7 @@ com.baeldung spring-data-gemfire 1.0.0-SNAPSHOT + spring-data-gemfire jar diff --git a/spring-data-jpa/README.md b/persistence-modules/spring-data-jpa/README.md similarity index 89% rename from spring-data-jpa/README.md rename to persistence-modules/spring-data-jpa/README.md index 44ce240da3..e240ae6d33 100644 --- a/spring-data-jpa/README.md +++ b/persistence-modules/spring-data-jpa/README.md @@ -15,6 +15,8 @@ - [Query Entities by Dates and Times with Spring Data JPA](https://www.baeldung.com/spring-data-jpa-query-by-date) - [DDD Aggregates and @DomainEvents](https://www.baeldung.com/spring-data-ddd) - [Spring Data – CrudRepository save() Method](https://www.baeldung.com/spring-data-crud-repository-save) +- [Limiting Query Results with JPA and Spring Data JPA](https://www.baeldung.com/jpa-limit-query-results) +- [Sorting Query Results with Spring Data](https://www.baeldung.com/spring-data-sorting) ### Eclipse Config After importing the project into Eclipse, you may see the following error: diff --git a/spring-data-jpa/pom.xml b/persistence-modules/spring-data-jpa/pom.xml similarity index 94% rename from spring-data-jpa/pom.xml rename to persistence-modules/spring-data-jpa/pom.xml index 8691ce1f09..786e587734 100644 --- a/spring-data-jpa/pom.xml +++ b/persistence-modules/spring-data-jpa/pom.xml @@ -2,15 +2,17 @@ + 4.0.0 + com.baeldung + spring-data-jpa + spring-data-jpa + parent-boot-2 com.baeldung 0.0.1-SNAPSHOT - ../parent-boot-2 + ../../parent-boot-2 - 4.0.0 - - spring-data-jpa diff --git a/spring-data-jpa/src/main/java/com/baeldung/Application.java b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/Application.java similarity index 100% rename from spring-data-jpa/src/main/java/com/baeldung/Application.java rename to persistence-modules/spring-data-jpa/src/main/java/com/baeldung/Application.java diff --git a/spring-data-jpa/src/main/java/com/baeldung/config/PersistenceConfiguration.java b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/config/PersistenceConfiguration.java similarity index 88% rename from spring-data-jpa/src/main/java/com/baeldung/config/PersistenceConfiguration.java rename to persistence-modules/spring-data-jpa/src/main/java/com/baeldung/config/PersistenceConfiguration.java index 16407e510a..2bdd4e5451 100644 --- a/spring-data-jpa/src/main/java/com/baeldung/config/PersistenceConfiguration.java +++ b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/config/PersistenceConfiguration.java @@ -1,13 +1,14 @@ package com.baeldung.config; -import com.baeldung.services.IBarService; -import com.baeldung.services.impl.BarSpringDataJpaService; -import com.google.common.base.Preconditions; -import com.baeldung.dao.repositories.impl.ExtendedRepositoryImpl; -import com.baeldung.services.IFooService; -import com.baeldung.services.impl.FooService; +import java.util.Properties; + +import javax.sql.DataSource; + import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.context.annotation.*; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.ComponentScan; +import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.PropertySource; import org.springframework.core.env.Environment; import org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor; import org.springframework.data.jpa.repository.config.EnableJpaAuditing; @@ -20,13 +21,15 @@ import org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter; import org.springframework.transaction.PlatformTransactionManager; import org.springframework.transaction.annotation.EnableTransactionManagement; -import javax.sql.DataSource; -import java.util.Properties; +import com.baeldung.dao.repositories.impl.ExtendedRepositoryImpl; +import com.baeldung.services.IBarService; +import com.baeldung.services.impl.BarSpringDataJpaService; +import com.google.common.base.Preconditions; @Configuration -@ComponentScan({"com.baeldung.dao", "com.baeldung.services"}) +@ComponentScan({ "com.baeldung.dao", "com.baeldung.services" }) @EnableTransactionManagement -@EnableJpaRepositories(basePackages = {"com.baeldung.dao"}, repositoryBaseClass = ExtendedRepositoryImpl.class) +@EnableJpaRepositories(basePackages = { "com.baeldung.dao" }, repositoryBaseClass = ExtendedRepositoryImpl.class) @EnableJpaAuditing @PropertySource("classpath:persistence.properties") public class PersistenceConfiguration { @@ -79,11 +82,6 @@ public class PersistenceConfiguration { return new BarSpringDataJpaService(); } - @Bean - public IFooService fooService() { - return new FooService(); - } - private final Properties hibernateProperties() { final Properties hibernateProperties = new Properties(); hibernateProperties.setProperty("hibernate.hbm2ddl.auto", env.getProperty("hibernate.hbm2ddl.auto")); @@ -94,7 +92,8 @@ public class PersistenceConfiguration { // hibernateProperties.setProperty("hibernate.globally_quoted_identifiers", "true"); // Envers properties - hibernateProperties.setProperty("org.hibernate.envers.audit_table_suffix", env.getProperty("envers.audit_table_suffix")); + hibernateProperties.setProperty("org.hibernate.envers.audit_table_suffix", + env.getProperty("envers.audit_table_suffix")); return hibernateProperties; } diff --git a/spring-data-jpa/src/main/java/com/baeldung/config/PersistenceProductConfiguration.java b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/config/PersistenceProductConfiguration.java similarity index 100% rename from spring-data-jpa/src/main/java/com/baeldung/config/PersistenceProductConfiguration.java rename to persistence-modules/spring-data-jpa/src/main/java/com/baeldung/config/PersistenceProductConfiguration.java diff --git a/spring-data-jpa/src/main/java/com/baeldung/config/PersistenceUserConfiguration.java b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/config/PersistenceUserConfiguration.java similarity index 100% rename from spring-data-jpa/src/main/java/com/baeldung/config/PersistenceUserConfiguration.java rename to persistence-modules/spring-data-jpa/src/main/java/com/baeldung/config/PersistenceUserConfiguration.java diff --git a/spring-data-jpa/src/main/java/com/baeldung/dao/IFooDao.java b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/dao/IFooDao.java similarity index 100% rename from spring-data-jpa/src/main/java/com/baeldung/dao/IFooDao.java rename to persistence-modules/spring-data-jpa/src/main/java/com/baeldung/dao/IFooDao.java diff --git a/spring-data-jpa/src/main/java/com/baeldung/dao/repositories/ArticleRepository.java b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/dao/repositories/ArticleRepository.java similarity index 100% rename from spring-data-jpa/src/main/java/com/baeldung/dao/repositories/ArticleRepository.java rename to persistence-modules/spring-data-jpa/src/main/java/com/baeldung/dao/repositories/ArticleRepository.java diff --git a/spring-data-jpa/src/main/java/com/baeldung/dao/repositories/CustomItemRepository.java b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/dao/repositories/CustomItemRepository.java similarity index 100% rename from spring-data-jpa/src/main/java/com/baeldung/dao/repositories/CustomItemRepository.java rename to persistence-modules/spring-data-jpa/src/main/java/com/baeldung/dao/repositories/CustomItemRepository.java diff --git a/spring-data-jpa/src/main/java/com/baeldung/dao/repositories/CustomItemTypeRepository.java b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/dao/repositories/CustomItemTypeRepository.java similarity index 100% rename from spring-data-jpa/src/main/java/com/baeldung/dao/repositories/CustomItemTypeRepository.java rename to persistence-modules/spring-data-jpa/src/main/java/com/baeldung/dao/repositories/CustomItemTypeRepository.java diff --git a/spring-data-jpa/src/main/java/com/baeldung/dao/repositories/ExtendedRepository.java b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/dao/repositories/ExtendedRepository.java similarity index 100% rename from spring-data-jpa/src/main/java/com/baeldung/dao/repositories/ExtendedRepository.java rename to persistence-modules/spring-data-jpa/src/main/java/com/baeldung/dao/repositories/ExtendedRepository.java diff --git a/spring-data-jpa/src/main/java/com/baeldung/dao/repositories/ExtendedStudentRepository.java b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/dao/repositories/ExtendedStudentRepository.java similarity index 100% rename from spring-data-jpa/src/main/java/com/baeldung/dao/repositories/ExtendedStudentRepository.java rename to persistence-modules/spring-data-jpa/src/main/java/com/baeldung/dao/repositories/ExtendedStudentRepository.java diff --git a/spring-data-jpa/src/main/java/com/baeldung/dao/repositories/IBarCrudRepository.java b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/dao/repositories/IBarCrudRepository.java similarity index 100% rename from spring-data-jpa/src/main/java/com/baeldung/dao/repositories/IBarCrudRepository.java rename to persistence-modules/spring-data-jpa/src/main/java/com/baeldung/dao/repositories/IBarCrudRepository.java diff --git a/spring-data-jpa/src/main/java/com/baeldung/dao/repositories/InventoryRepository.java b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/dao/repositories/InventoryRepository.java similarity index 100% rename from spring-data-jpa/src/main/java/com/baeldung/dao/repositories/InventoryRepository.java rename to persistence-modules/spring-data-jpa/src/main/java/com/baeldung/dao/repositories/InventoryRepository.java diff --git a/spring-data-jpa/src/main/java/com/baeldung/dao/repositories/ItemTypeRepository.java b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/dao/repositories/ItemTypeRepository.java similarity index 100% rename from spring-data-jpa/src/main/java/com/baeldung/dao/repositories/ItemTypeRepository.java rename to persistence-modules/spring-data-jpa/src/main/java/com/baeldung/dao/repositories/ItemTypeRepository.java diff --git a/spring-data-jpa/src/main/java/com/baeldung/dao/repositories/LocationRepository.java b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/dao/repositories/LocationRepository.java similarity index 100% rename from spring-data-jpa/src/main/java/com/baeldung/dao/repositories/LocationRepository.java rename to persistence-modules/spring-data-jpa/src/main/java/com/baeldung/dao/repositories/LocationRepository.java diff --git a/spring-data-jpa/src/main/java/com/baeldung/dao/repositories/ReadOnlyLocationRepository.java b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/dao/repositories/ReadOnlyLocationRepository.java similarity index 100% rename from spring-data-jpa/src/main/java/com/baeldung/dao/repositories/ReadOnlyLocationRepository.java rename to persistence-modules/spring-data-jpa/src/main/java/com/baeldung/dao/repositories/ReadOnlyLocationRepository.java diff --git a/spring-data-jpa/src/main/java/com/baeldung/dao/repositories/StoreRepository.java b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/dao/repositories/StoreRepository.java similarity index 100% rename from spring-data-jpa/src/main/java/com/baeldung/dao/repositories/StoreRepository.java rename to persistence-modules/spring-data-jpa/src/main/java/com/baeldung/dao/repositories/StoreRepository.java diff --git a/spring-data-jpa/src/main/java/com/baeldung/dao/repositories/impl/CustomItemRepositoryImpl.java b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/dao/repositories/impl/CustomItemRepositoryImpl.java similarity index 100% rename from spring-data-jpa/src/main/java/com/baeldung/dao/repositories/impl/CustomItemRepositoryImpl.java rename to persistence-modules/spring-data-jpa/src/main/java/com/baeldung/dao/repositories/impl/CustomItemRepositoryImpl.java diff --git a/spring-data-jpa/src/main/java/com/baeldung/dao/repositories/impl/CustomItemTypeRepositoryImpl.java b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/dao/repositories/impl/CustomItemTypeRepositoryImpl.java similarity index 100% rename from spring-data-jpa/src/main/java/com/baeldung/dao/repositories/impl/CustomItemTypeRepositoryImpl.java rename to persistence-modules/spring-data-jpa/src/main/java/com/baeldung/dao/repositories/impl/CustomItemTypeRepositoryImpl.java diff --git a/spring-data-jpa/src/main/java/com/baeldung/dao/repositories/impl/ExtendedRepositoryImpl.java b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/dao/repositories/impl/ExtendedRepositoryImpl.java similarity index 100% rename from spring-data-jpa/src/main/java/com/baeldung/dao/repositories/impl/ExtendedRepositoryImpl.java rename to persistence-modules/spring-data-jpa/src/main/java/com/baeldung/dao/repositories/impl/ExtendedRepositoryImpl.java diff --git a/spring-data-jpa/src/main/java/com/baeldung/dao/repositories/product/ProductRepository.java b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/dao/repositories/product/ProductRepository.java similarity index 100% rename from spring-data-jpa/src/main/java/com/baeldung/dao/repositories/product/ProductRepository.java rename to persistence-modules/spring-data-jpa/src/main/java/com/baeldung/dao/repositories/product/ProductRepository.java diff --git a/spring-data-jpa/src/main/java/com/baeldung/dao/repositories/user/PossessionRepository.java b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/dao/repositories/user/PossessionRepository.java similarity index 100% rename from spring-data-jpa/src/main/java/com/baeldung/dao/repositories/user/PossessionRepository.java rename to persistence-modules/spring-data-jpa/src/main/java/com/baeldung/dao/repositories/user/PossessionRepository.java diff --git a/spring-data-jpa/src/main/java/com/baeldung/dao/repositories/user/UserRepository.java b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/dao/repositories/user/UserRepository.java similarity index 100% rename from spring-data-jpa/src/main/java/com/baeldung/dao/repositories/user/UserRepository.java rename to persistence-modules/spring-data-jpa/src/main/java/com/baeldung/dao/repositories/user/UserRepository.java diff --git a/spring-data-jpa/src/main/java/com/baeldung/ddd/event/Aggregate.java b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/ddd/event/Aggregate.java similarity index 100% rename from spring-data-jpa/src/main/java/com/baeldung/ddd/event/Aggregate.java rename to persistence-modules/spring-data-jpa/src/main/java/com/baeldung/ddd/event/Aggregate.java diff --git a/spring-data-jpa/src/main/java/com/baeldung/ddd/event/Aggregate2.java b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/ddd/event/Aggregate2.java similarity index 100% rename from spring-data-jpa/src/main/java/com/baeldung/ddd/event/Aggregate2.java rename to persistence-modules/spring-data-jpa/src/main/java/com/baeldung/ddd/event/Aggregate2.java diff --git a/spring-data-jpa/src/main/java/com/baeldung/ddd/event/Aggregate2Repository.java b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/ddd/event/Aggregate2Repository.java similarity index 100% rename from spring-data-jpa/src/main/java/com/baeldung/ddd/event/Aggregate2Repository.java rename to persistence-modules/spring-data-jpa/src/main/java/com/baeldung/ddd/event/Aggregate2Repository.java diff --git a/spring-data-jpa/src/main/java/com/baeldung/ddd/event/Aggregate3.java b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/ddd/event/Aggregate3.java similarity index 100% rename from spring-data-jpa/src/main/java/com/baeldung/ddd/event/Aggregate3.java rename to persistence-modules/spring-data-jpa/src/main/java/com/baeldung/ddd/event/Aggregate3.java diff --git a/spring-data-jpa/src/main/java/com/baeldung/ddd/event/Aggregate3Repository.java b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/ddd/event/Aggregate3Repository.java similarity index 100% rename from spring-data-jpa/src/main/java/com/baeldung/ddd/event/Aggregate3Repository.java rename to persistence-modules/spring-data-jpa/src/main/java/com/baeldung/ddd/event/Aggregate3Repository.java diff --git a/spring-data-jpa/src/main/java/com/baeldung/ddd/event/AggregateRepository.java b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/ddd/event/AggregateRepository.java similarity index 100% rename from spring-data-jpa/src/main/java/com/baeldung/ddd/event/AggregateRepository.java rename to persistence-modules/spring-data-jpa/src/main/java/com/baeldung/ddd/event/AggregateRepository.java diff --git a/spring-data-jpa/src/main/java/com/baeldung/ddd/event/DddConfig.java b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/ddd/event/DddConfig.java similarity index 100% rename from spring-data-jpa/src/main/java/com/baeldung/ddd/event/DddConfig.java rename to persistence-modules/spring-data-jpa/src/main/java/com/baeldung/ddd/event/DddConfig.java diff --git a/spring-data-jpa/src/main/java/com/baeldung/ddd/event/DomainEvent.java b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/ddd/event/DomainEvent.java similarity index 100% rename from spring-data-jpa/src/main/java/com/baeldung/ddd/event/DomainEvent.java rename to persistence-modules/spring-data-jpa/src/main/java/com/baeldung/ddd/event/DomainEvent.java diff --git a/spring-data-jpa/src/main/java/com/baeldung/ddd/event/DomainService.java b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/ddd/event/DomainService.java similarity index 100% rename from spring-data-jpa/src/main/java/com/baeldung/ddd/event/DomainService.java rename to persistence-modules/spring-data-jpa/src/main/java/com/baeldung/ddd/event/DomainService.java diff --git a/spring-data-jpa/src/main/java/com/baeldung/domain/Article.java b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/domain/Article.java similarity index 100% rename from spring-data-jpa/src/main/java/com/baeldung/domain/Article.java rename to persistence-modules/spring-data-jpa/src/main/java/com/baeldung/domain/Article.java diff --git a/spring-data-jpa/src/main/java/com/baeldung/domain/Bar.java b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/domain/Bar.java similarity index 100% rename from spring-data-jpa/src/main/java/com/baeldung/domain/Bar.java rename to persistence-modules/spring-data-jpa/src/main/java/com/baeldung/domain/Bar.java diff --git a/spring-data-jpa/src/main/java/com/baeldung/domain/Foo.java b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/domain/Foo.java similarity index 100% rename from spring-data-jpa/src/main/java/com/baeldung/domain/Foo.java rename to persistence-modules/spring-data-jpa/src/main/java/com/baeldung/domain/Foo.java diff --git a/spring-data-jpa/src/main/java/com/baeldung/domain/Item.java b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/domain/Item.java similarity index 94% rename from spring-data-jpa/src/main/java/com/baeldung/domain/Item.java rename to persistence-modules/spring-data-jpa/src/main/java/com/baeldung/domain/Item.java index 97ce14d92d..1e58fb25ba 100644 --- a/spring-data-jpa/src/main/java/com/baeldung/domain/Item.java +++ b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/domain/Item.java @@ -1,81 +1,81 @@ -package com.baeldung.domain; - -import java.math.BigDecimal; - -import javax.persistence.Entity; -import javax.persistence.Id; -import javax.persistence.ManyToOne; - -@Entity -public class Item { - - private String color; - private String grade; - - @Id - private Long id; - - @ManyToOne - private ItemType itemType; - - private String name; - private BigDecimal price; - @ManyToOne - private Store store; - - public String getColor() { - return color; - } - - public String getGrade() { - return grade; - } - - public Long getId() { - return id; - } - - public ItemType getItemType() { - return itemType; - } - - public String getName() { - return name; - } - - public BigDecimal getPrice() { - return price; - } - - public Store getStore() { - return store; - } - - public void setColor(String color) { - this.color = color; - } - - public void setGrade(String grade) { - this.grade = grade; - } - - public void setId(Long id) { - this.id = id; - } - - public void setItemType(ItemType itemType) { - this.itemType = itemType; - } - - public void setName(String name) { - this.name = name; - } - - public void setPrice(BigDecimal price) { - this.price = price; - } - - public void setStore(Store store) { - this.store = store; - } -} +package com.baeldung.domain; + +import java.math.BigDecimal; + +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.ManyToOne; + +@Entity +public class Item { + + private String color; + private String grade; + + @Id + private Long id; + + @ManyToOne + private ItemType itemType; + + private String name; + private BigDecimal price; + @ManyToOne + private Store store; + + public String getColor() { + return color; + } + + public String getGrade() { + return grade; + } + + public Long getId() { + return id; + } + + public ItemType getItemType() { + return itemType; + } + + public String getName() { + return name; + } + + public BigDecimal getPrice() { + return price; + } + + public Store getStore() { + return store; + } + + public void setColor(String color) { + this.color = color; + } + + public void setGrade(String grade) { + this.grade = grade; + } + + public void setId(Long id) { + this.id = id; + } + + public void setItemType(ItemType itemType) { + this.itemType = itemType; + } + + public void setName(String name) { + this.name = name; + } + + public void setPrice(BigDecimal price) { + this.price = price; + } + + public void setStore(Store store) { + this.store = store; + } +} diff --git a/spring-data-jpa/src/main/java/com/baeldung/domain/ItemType.java b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/domain/ItemType.java similarity index 94% rename from spring-data-jpa/src/main/java/com/baeldung/domain/ItemType.java rename to persistence-modules/spring-data-jpa/src/main/java/com/baeldung/domain/ItemType.java index 412079c2ae..b0349e0471 100644 --- a/spring-data-jpa/src/main/java/com/baeldung/domain/ItemType.java +++ b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/domain/ItemType.java @@ -1,46 +1,46 @@ -package com.baeldung.domain; - -import java.util.ArrayList; -import java.util.List; - -import javax.persistence.CascadeType; -import javax.persistence.Entity; -import javax.persistence.Id; -import javax.persistence.JoinColumn; -import javax.persistence.OneToMany; - -@Entity -public class ItemType { - - @Id - private Long id; - @OneToMany(cascade = CascadeType.ALL) - @JoinColumn(name = "ITEM_TYPE_ID") - private List items = new ArrayList<>(); - - private String name; - - public Long getId() { - return id; - } - - public List getItems() { - return items; - } - - public String getName() { - return name; - } - - public void setId(Long id) { - this.id = id; - } - - public void setItems(List items) { - this.items = items; - } - - public void setName(String name) { - this.name = name; - } -} +package com.baeldung.domain; + +import java.util.ArrayList; +import java.util.List; + +import javax.persistence.CascadeType; +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.OneToMany; + +@Entity +public class ItemType { + + @Id + private Long id; + @OneToMany(cascade = CascadeType.ALL) + @JoinColumn(name = "ITEM_TYPE_ID") + private List items = new ArrayList<>(); + + private String name; + + public Long getId() { + return id; + } + + public List getItems() { + return items; + } + + public String getName() { + return name; + } + + public void setId(Long id) { + this.id = id; + } + + public void setItems(List items) { + this.items = items; + } + + public void setName(String name) { + this.name = name; + } +} diff --git a/spring-data-jpa/src/main/java/com/baeldung/domain/KVTag.java b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/domain/KVTag.java similarity index 100% rename from spring-data-jpa/src/main/java/com/baeldung/domain/KVTag.java rename to persistence-modules/spring-data-jpa/src/main/java/com/baeldung/domain/KVTag.java diff --git a/spring-data-jpa/src/main/java/com/baeldung/domain/Location.java b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/domain/Location.java similarity index 95% rename from spring-data-jpa/src/main/java/com/baeldung/domain/Location.java rename to persistence-modules/spring-data-jpa/src/main/java/com/baeldung/domain/Location.java index 2178d378eb..4ca7295986 100644 --- a/spring-data-jpa/src/main/java/com/baeldung/domain/Location.java +++ b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/domain/Location.java @@ -1,55 +1,55 @@ -package com.baeldung.domain; - -import java.util.ArrayList; -import java.util.List; - -import javax.persistence.CascadeType; -import javax.persistence.Entity; -import javax.persistence.Id; -import javax.persistence.JoinColumn; -import javax.persistence.OneToMany; - -@Entity -public class Location { - - private String city; - private String country; - @Id - private Long id; - - @OneToMany(cascade = CascadeType.ALL) - @JoinColumn(name = "LOCATION_ID") - private List stores = new ArrayList<>(); - - public String getCity() { - return city; - } - - public String getCountry() { - return country; - } - - public Long getId() { - return id; - } - - public List getStores() { - return stores; - } - - public void setCity(String city) { - this.city = city; - } - - public void setCountry(String country) { - this.country = country; - } - - public void setId(Long id) { - this.id = id; - } - - public void setStores(List stores) { - this.stores = stores; - } -} +package com.baeldung.domain; + +import java.util.ArrayList; +import java.util.List; + +import javax.persistence.CascadeType; +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.OneToMany; + +@Entity +public class Location { + + private String city; + private String country; + @Id + private Long id; + + @OneToMany(cascade = CascadeType.ALL) + @JoinColumn(name = "LOCATION_ID") + private List stores = new ArrayList<>(); + + public String getCity() { + return city; + } + + public String getCountry() { + return country; + } + + public Long getId() { + return id; + } + + public List getStores() { + return stores; + } + + public void setCity(String city) { + this.city = city; + } + + public void setCountry(String country) { + this.country = country; + } + + public void setId(Long id) { + this.id = id; + } + + public void setStores(List stores) { + this.stores = stores; + } +} diff --git a/spring-data-jpa/src/main/java/com/baeldung/domain/MerchandiseEntity.java b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/domain/MerchandiseEntity.java similarity index 100% rename from spring-data-jpa/src/main/java/com/baeldung/domain/MerchandiseEntity.java rename to persistence-modules/spring-data-jpa/src/main/java/com/baeldung/domain/MerchandiseEntity.java diff --git a/spring-data-jpa/src/main/java/com/baeldung/domain/SkillTag.java b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/domain/SkillTag.java similarity index 100% rename from spring-data-jpa/src/main/java/com/baeldung/domain/SkillTag.java rename to persistence-modules/spring-data-jpa/src/main/java/com/baeldung/domain/SkillTag.java diff --git a/spring-data-jpa/src/main/java/com/baeldung/domain/Store.java b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/domain/Store.java similarity index 95% rename from spring-data-jpa/src/main/java/com/baeldung/domain/Store.java rename to persistence-modules/spring-data-jpa/src/main/java/com/baeldung/domain/Store.java index e04684c479..4172051c71 100644 --- a/spring-data-jpa/src/main/java/com/baeldung/domain/Store.java +++ b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/domain/Store.java @@ -1,76 +1,76 @@ -package com.baeldung.domain; - -import java.util.ArrayList; -import java.util.List; - -import javax.persistence.CascadeType; -import javax.persistence.Entity; -import javax.persistence.Id; -import javax.persistence.JoinColumn; -import javax.persistence.ManyToOne; -import javax.persistence.OneToMany; - -@Entity -public class Store { - - private Boolean active; - @Id - private Long id; - @OneToMany(cascade = CascadeType.ALL) - @JoinColumn(name = "STORE_ID") - private List items = new ArrayList<>(); - private Long itemsSold; - - @ManyToOne - private Location location; - - private String name; - - public Boolean getActive() { - return active; - } - - public Long getId() { - return id; - } - - public List getItems() { - return items; - } - - public Long getItemsSold() { - return itemsSold; - } - - public Location getLocation() { - return location; - } - - public String getName() { - return name; - } - - public void setActive(Boolean active) { - this.active = active; - } - - public void setId(Long id) { - this.id = id; - } - - public void setItems(List items) { - this.items = items; - } - - public void setItemsSold(Long itemsSold) { - this.itemsSold = itemsSold; - } - - public void setLocation(Location location) { - this.location = location; - } - - public void setName(String name) { - this.name = name; - } -} +package com.baeldung.domain; + +import java.util.ArrayList; +import java.util.List; + +import javax.persistence.CascadeType; +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.OneToMany; + +@Entity +public class Store { + + private Boolean active; + @Id + private Long id; + @OneToMany(cascade = CascadeType.ALL) + @JoinColumn(name = "STORE_ID") + private List items = new ArrayList<>(); + private Long itemsSold; + + @ManyToOne + private Location location; + + private String name; + + public Boolean getActive() { + return active; + } + + public Long getId() { + return id; + } + + public List getItems() { + return items; + } + + public Long getItemsSold() { + return itemsSold; + } + + public Location getLocation() { + return location; + } + + public String getName() { + return name; + } + + public void setActive(Boolean active) { + this.active = active; + } + + public void setId(Long id) { + this.id = id; + } + + public void setItems(List items) { + this.items = items; + } + + public void setItemsSold(Long itemsSold) { + this.itemsSold = itemsSold; + } + + public void setLocation(Location location) { + this.location = location; + } + + public void setName(String name) { + this.name = name; + } +} diff --git a/spring-data-jpa/src/main/java/com/baeldung/domain/Student.java b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/domain/Student.java similarity index 100% rename from spring-data-jpa/src/main/java/com/baeldung/domain/Student.java rename to persistence-modules/spring-data-jpa/src/main/java/com/baeldung/domain/Student.java diff --git a/spring-data-jpa/src/main/java/com/baeldung/domain/product/Product.java b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/domain/product/Product.java similarity index 100% rename from spring-data-jpa/src/main/java/com/baeldung/domain/product/Product.java rename to persistence-modules/spring-data-jpa/src/main/java/com/baeldung/domain/product/Product.java diff --git a/spring-data-jpa/src/main/java/com/baeldung/domain/user/Possession.java b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/domain/user/Possession.java similarity index 100% rename from spring-data-jpa/src/main/java/com/baeldung/domain/user/Possession.java rename to persistence-modules/spring-data-jpa/src/main/java/com/baeldung/domain/user/Possession.java diff --git a/spring-data-jpa/src/main/java/com/baeldung/domain/user/User.java b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/domain/user/User.java similarity index 100% rename from spring-data-jpa/src/main/java/com/baeldung/domain/user/User.java rename to persistence-modules/spring-data-jpa/src/main/java/com/baeldung/domain/user/User.java diff --git a/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/passenger/CustomPassengerRepository.java b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/passenger/CustomPassengerRepository.java new file mode 100644 index 0000000000..7ae44bfbda --- /dev/null +++ b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/passenger/CustomPassengerRepository.java @@ -0,0 +1,8 @@ +package com.baeldung.passenger; + +import java.util.List; + +interface CustomPassengerRepository { + + List findOrderedBySeatNumberLimitedTo(int limit); +} diff --git a/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/passenger/Passenger.java b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/passenger/Passenger.java new file mode 100644 index 0000000000..24ae47e597 --- /dev/null +++ b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/passenger/Passenger.java @@ -0,0 +1,82 @@ +package com.baeldung.passenger; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.Id; +import java.util.Objects; + +@Entity +class Passenger { + + @Id + @GeneratedValue + @Column(nullable = false) + private Long id; + + @Basic(optional = false) + @Column(nullable = false) + private String firstName; + + @Basic(optional = false) + @Column(nullable = false) + private String lastName; + + @Basic(optional = false) + @Column(nullable = false) + private int seatNumber; + + private Passenger(String firstName, String lastName, int seatNumber) { + this.firstName = firstName; + this.lastName = lastName; + this.seatNumber = seatNumber; + } + + static Passenger from(String firstName, String lastName, int seatNumber) { + return new Passenger(firstName, lastName, seatNumber); + } + + @Override + public boolean equals(Object object) { + if (this == object) + return true; + if (object == null || getClass() != object.getClass()) + return false; + Passenger passenger = (Passenger) object; + return getSeatNumber() == passenger.getSeatNumber() && Objects.equals(getFirstName(), passenger.getFirstName()) + && Objects.equals(getLastName(), passenger.getLastName()); + } + + @Override + public int hashCode() { + return Objects.hash(getFirstName(), getLastName(), getSeatNumber()); + } + + @Override + public String toString() { + final StringBuilder toStringBuilder = new StringBuilder(getClass().getSimpleName()); + toStringBuilder.append("{ id=").append(id); + toStringBuilder.append(", firstName='").append(firstName).append('\''); + toStringBuilder.append(", lastName='").append(lastName).append('\''); + toStringBuilder.append(", seatNumber=").append(seatNumber); + toStringBuilder.append('}'); + return toStringBuilder.toString(); + } + + Long getId() { + return id; + } + + String getFirstName() { + return firstName; + } + + String getLastName() { + return lastName; + } + + int getSeatNumber() { + return seatNumber; + } +} diff --git a/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/passenger/PassengerRepository.java b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/passenger/PassengerRepository.java new file mode 100644 index 0000000000..6ae6afb403 --- /dev/null +++ b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/passenger/PassengerRepository.java @@ -0,0 +1,17 @@ +package com.baeldung.passenger; + +import org.springframework.data.domain.Sort; +import org.springframework.data.jpa.repository.JpaRepository; + +import java.util.List; + +interface PassengerRepository extends JpaRepository, CustomPassengerRepository { + + Passenger findFirstByOrderBySeatNumberAsc(); + + List findByOrderBySeatNumberAsc(); + + List findByLastNameOrderBySeatNumberAsc(String lastName); + + List findByLastName(String lastName, Sort sort); +} diff --git a/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/passenger/PassengerRepositoryImpl.java b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/passenger/PassengerRepositoryImpl.java new file mode 100644 index 0000000000..bd6e535e3e --- /dev/null +++ b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/passenger/PassengerRepositoryImpl.java @@ -0,0 +1,20 @@ +package com.baeldung.passenger; + +import org.springframework.stereotype.Repository; + +import javax.persistence.EntityManager; +import javax.persistence.PersistenceContext; +import java.util.List; + +@Repository +class PassengerRepositoryImpl implements CustomPassengerRepository { + + @PersistenceContext + private EntityManager entityManager; + + @Override + public List findOrderedBySeatNumberLimitedTo(int limit) { + return entityManager.createQuery("SELECT p FROM Passenger p ORDER BY p.seatNumber", + Passenger.class).setMaxResults(limit).getResultList(); + } +} diff --git a/spring-data-jpa/src/main/java/com/baeldung/services/IBarService.java b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/services/IBarService.java similarity index 100% rename from spring-data-jpa/src/main/java/com/baeldung/services/IBarService.java rename to persistence-modules/spring-data-jpa/src/main/java/com/baeldung/services/IBarService.java diff --git a/spring-data-jpa/src/main/java/com/baeldung/services/IFooService.java b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/services/IFooService.java similarity index 100% rename from spring-data-jpa/src/main/java/com/baeldung/services/IFooService.java rename to persistence-modules/spring-data-jpa/src/main/java/com/baeldung/services/IFooService.java diff --git a/spring-data-jpa/src/main/java/com/baeldung/services/IOperations.java b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/services/IOperations.java similarity index 100% rename from spring-data-jpa/src/main/java/com/baeldung/services/IOperations.java rename to persistence-modules/spring-data-jpa/src/main/java/com/baeldung/services/IOperations.java diff --git a/spring-data-jpa/src/main/java/com/baeldung/services/impl/AbstractService.java b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/services/impl/AbstractService.java similarity index 100% rename from spring-data-jpa/src/main/java/com/baeldung/services/impl/AbstractService.java rename to persistence-modules/spring-data-jpa/src/main/java/com/baeldung/services/impl/AbstractService.java diff --git a/spring-data-jpa/src/main/java/com/baeldung/services/impl/AbstractSpringDataJpaService.java b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/services/impl/AbstractSpringDataJpaService.java similarity index 100% rename from spring-data-jpa/src/main/java/com/baeldung/services/impl/AbstractSpringDataJpaService.java rename to persistence-modules/spring-data-jpa/src/main/java/com/baeldung/services/impl/AbstractSpringDataJpaService.java diff --git a/spring-data-jpa/src/main/java/com/baeldung/services/impl/BarSpringDataJpaService.java b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/services/impl/BarSpringDataJpaService.java similarity index 100% rename from spring-data-jpa/src/main/java/com/baeldung/services/impl/BarSpringDataJpaService.java rename to persistence-modules/spring-data-jpa/src/main/java/com/baeldung/services/impl/BarSpringDataJpaService.java diff --git a/spring-data-jpa/src/main/java/com/baeldung/services/impl/FooService.java b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/services/impl/FooService.java similarity index 100% rename from spring-data-jpa/src/main/java/com/baeldung/services/impl/FooService.java rename to persistence-modules/spring-data-jpa/src/main/java/com/baeldung/services/impl/FooService.java diff --git a/spring-data-jpa/src/main/resources/application.properties b/persistence-modules/spring-data-jpa/src/main/resources/application.properties similarity index 83% rename from spring-data-jpa/src/main/resources/application.properties rename to persistence-modules/spring-data-jpa/src/main/resources/application.properties index 73d72bc7d6..37fb9ca9c4 100644 --- a/spring-data-jpa/src/main/resources/application.properties +++ b/persistence-modules/spring-data-jpa/src/main/resources/application.properties @@ -12,4 +12,6 @@ hibernate.cache.use_second_level_cache=true hibernate.cache.use_query_cache=true hibernate.cache.region.factory_class=org.hibernate.cache.ehcache.EhCacheRegionFactory -spring.datasource.data=import_entities.sql \ No newline at end of file +spring.datasource.data=import_entities.sql + +spring.main.allow-bean-definition-overriding=true \ No newline at end of file diff --git a/spring-data-jpa/src/main/resources/ddd.properties b/persistence-modules/spring-data-jpa/src/main/resources/ddd.properties similarity index 100% rename from spring-data-jpa/src/main/resources/ddd.properties rename to persistence-modules/spring-data-jpa/src/main/resources/ddd.properties diff --git a/spring-data-jpa/src/test/resources/import_entities.sql b/persistence-modules/spring-data-jpa/src/main/resources/import_entities.sql similarity index 100% rename from spring-data-jpa/src/test/resources/import_entities.sql rename to persistence-modules/spring-data-jpa/src/main/resources/import_entities.sql diff --git a/orientdb/src/main/resources/logback.xml b/persistence-modules/spring-data-jpa/src/main/resources/logback.xml similarity index 100% rename from orientdb/src/main/resources/logback.xml rename to persistence-modules/spring-data-jpa/src/main/resources/logback.xml diff --git a/spring-data-jpa/src/main/resources/persistence-multiple-db.properties b/persistence-modules/spring-data-jpa/src/main/resources/persistence-multiple-db.properties similarity index 100% rename from spring-data-jpa/src/main/resources/persistence-multiple-db.properties rename to persistence-modules/spring-data-jpa/src/main/resources/persistence-multiple-db.properties diff --git a/spring-data-jpa/src/main/resources/persistence.properties b/persistence-modules/spring-data-jpa/src/main/resources/persistence.properties similarity index 100% rename from spring-data-jpa/src/main/resources/persistence.properties rename to persistence-modules/spring-data-jpa/src/main/resources/persistence.properties diff --git a/spring-data-jpa/src/test/java/com/baeldung/dao/repositories/ArticleRepositoryIntegrationTest.java b/persistence-modules/spring-data-jpa/src/test/java/com/baeldung/dao/repositories/ArticleRepositoryIntegrationTest.java similarity index 100% rename from spring-data-jpa/src/test/java/com/baeldung/dao/repositories/ArticleRepositoryIntegrationTest.java rename to persistence-modules/spring-data-jpa/src/test/java/com/baeldung/dao/repositories/ArticleRepositoryIntegrationTest.java diff --git a/spring-data-jpa/src/test/java/com/baeldung/dao/repositories/ExtendedStudentRepositoryIntegrationTest.java b/persistence-modules/spring-data-jpa/src/test/java/com/baeldung/dao/repositories/ExtendedStudentRepositoryIntegrationTest.java similarity index 100% rename from spring-data-jpa/src/test/java/com/baeldung/dao/repositories/ExtendedStudentRepositoryIntegrationTest.java rename to persistence-modules/spring-data-jpa/src/test/java/com/baeldung/dao/repositories/ExtendedStudentRepositoryIntegrationTest.java diff --git a/spring-data-jpa/src/test/java/com/baeldung/dao/repositories/InventoryRepositoryIntegrationTest.java b/persistence-modules/spring-data-jpa/src/test/java/com/baeldung/dao/repositories/InventoryRepositoryIntegrationTest.java similarity index 100% rename from spring-data-jpa/src/test/java/com/baeldung/dao/repositories/InventoryRepositoryIntegrationTest.java rename to persistence-modules/spring-data-jpa/src/test/java/com/baeldung/dao/repositories/InventoryRepositoryIntegrationTest.java diff --git a/spring-data-jpa/src/test/java/com/baeldung/dao/repositories/JpaRepositoriesIntegrationTest.java b/persistence-modules/spring-data-jpa/src/test/java/com/baeldung/dao/repositories/JpaRepositoriesIntegrationTest.java similarity index 100% rename from spring-data-jpa/src/test/java/com/baeldung/dao/repositories/JpaRepositoriesIntegrationTest.java rename to persistence-modules/spring-data-jpa/src/test/java/com/baeldung/dao/repositories/JpaRepositoriesIntegrationTest.java diff --git a/spring-data-jpa/src/test/java/com/baeldung/dao/repositories/UserRepositoryIntegrationTest.java b/persistence-modules/spring-data-jpa/src/test/java/com/baeldung/dao/repositories/UserRepositoryIntegrationTest.java similarity index 100% rename from spring-data-jpa/src/test/java/com/baeldung/dao/repositories/UserRepositoryIntegrationTest.java rename to persistence-modules/spring-data-jpa/src/test/java/com/baeldung/dao/repositories/UserRepositoryIntegrationTest.java diff --git a/spring-data-jpa/src/test/java/com/baeldung/ddd/event/Aggregate2EventsIntegrationTest.java b/persistence-modules/spring-data-jpa/src/test/java/com/baeldung/ddd/event/Aggregate2EventsIntegrationTest.java similarity index 100% rename from spring-data-jpa/src/test/java/com/baeldung/ddd/event/Aggregate2EventsIntegrationTest.java rename to persistence-modules/spring-data-jpa/src/test/java/com/baeldung/ddd/event/Aggregate2EventsIntegrationTest.java diff --git a/spring-data-jpa/src/test/java/com/baeldung/ddd/event/Aggregate3EventsIntegrationTest.java b/persistence-modules/spring-data-jpa/src/test/java/com/baeldung/ddd/event/Aggregate3EventsIntegrationTest.java similarity index 100% rename from spring-data-jpa/src/test/java/com/baeldung/ddd/event/Aggregate3EventsIntegrationTest.java rename to persistence-modules/spring-data-jpa/src/test/java/com/baeldung/ddd/event/Aggregate3EventsIntegrationTest.java diff --git a/spring-data-jpa/src/test/java/com/baeldung/ddd/event/AggregateEventsIntegrationTest.java b/persistence-modules/spring-data-jpa/src/test/java/com/baeldung/ddd/event/AggregateEventsIntegrationTest.java similarity index 100% rename from spring-data-jpa/src/test/java/com/baeldung/ddd/event/AggregateEventsIntegrationTest.java rename to persistence-modules/spring-data-jpa/src/test/java/com/baeldung/ddd/event/AggregateEventsIntegrationTest.java diff --git a/spring-data-jpa/src/test/java/com/baeldung/ddd/event/TestEventHandler.java b/persistence-modules/spring-data-jpa/src/test/java/com/baeldung/ddd/event/TestEventHandler.java similarity index 100% rename from spring-data-jpa/src/test/java/com/baeldung/ddd/event/TestEventHandler.java rename to persistence-modules/spring-data-jpa/src/test/java/com/baeldung/ddd/event/TestEventHandler.java diff --git a/persistence-modules/spring-data-jpa/src/test/java/com/baeldung/passenger/PassengerRepositoryIntegrationTest.java b/persistence-modules/spring-data-jpa/src/test/java/com/baeldung/passenger/PassengerRepositoryIntegrationTest.java new file mode 100644 index 0000000000..c57e771345 --- /dev/null +++ b/persistence-modules/spring-data-jpa/src/test/java/com/baeldung/passenger/PassengerRepositoryIntegrationTest.java @@ -0,0 +1,98 @@ +package com.baeldung.passenger; + +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.autoconfigure.orm.jpa.DataJpaTest; +import org.springframework.data.domain.Page; +import org.springframework.data.domain.PageRequest; +import org.springframework.data.domain.Sort; +import org.springframework.test.context.junit4.SpringRunner; + +import javax.persistence.EntityManager; +import javax.persistence.PersistenceContext; +import java.util.List; + +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.Matchers.contains; +import static org.junit.Assert.assertEquals; + +@DataJpaTest +@RunWith(SpringRunner.class) +public class PassengerRepositoryIntegrationTest { + + @PersistenceContext + private EntityManager entityManager; + @Autowired + private PassengerRepository repository; + + @Before + public void before() { + entityManager.persist(Passenger.from("Jill", "Smith", 50)); + entityManager.persist(Passenger.from("Eve", "Jackson", 95)); + entityManager.persist(Passenger.from("Fred", "Bloggs", 22)); + entityManager.persist(Passenger.from("Ricki", "Bobbie", 36)); + entityManager.persist(Passenger.from("Siya", "Kolisi", 85)); + } + + @Test + public void givenSeveralPassengersWhenOrderedBySeatNumberLimitedToThenThePassengerInTheFirstFilledSeatIsReturned() { + Passenger expected = Passenger.from("Fred", "Bloggs", 22); + + List passengers = repository.findOrderedBySeatNumberLimitedTo(1); + + assertEquals(1, passengers.size()); + + Passenger actual = passengers.get(0); + assertEquals(actual, expected); + } + + @Test + public void givenSeveralPassengersWhenFindFirstByOrderBySeatNumberAscThenThePassengerInTheFirstFilledSeatIsReturned() { + Passenger expected = Passenger.from("Fred", "Bloggs", 22); + + Passenger actual = repository.findFirstByOrderBySeatNumberAsc(); + + assertEquals(actual, expected); + } + + @Test + public void givenSeveralPassengersWhenFindPageSortedByThenThePassengerInTheFirstFilledSeatIsReturned() { + Passenger expected = Passenger.from("Fred", "Bloggs", 22); + + Page page = repository.findAll(PageRequest.of(0, 1, Sort.by(Sort.Direction.ASC, "seatNumber"))); + + assertEquals(page.getContent().size(), 1); + + Passenger actual = page.getContent().get(0); + assertEquals(expected, actual); + } + + @Test + public void givenPassengers_whenOrderedBySeatNumberAsc_thenCorrectOrder() { + Passenger fred = Passenger.from("Fred", "Bloggs", 22); + Passenger ricki = Passenger.from("Ricki", "Bobbie", 36); + Passenger jill = Passenger.from("Jill", "Smith", 50); + Passenger siya = Passenger.from("Siya", "Kolisi", 85); + Passenger eve = Passenger.from("Eve", "Jackson", 95); + + List passengers = repository.findByOrderBySeatNumberAsc(); + + assertThat(passengers, contains(fred, ricki, jill, siya, eve)); + } + + @Test + public void givenPassengers_whenFindAllWithSortBySeatNumberAsc_thenCorrectOrder() { + Passenger fred = Passenger.from("Fred", "Bloggs", 22); + Passenger ricki = Passenger.from("Ricki", "Bobbie", 36); + Passenger jill = Passenger.from("Jill", "Smith", 50); + Passenger siya = Passenger.from("Siya", "Kolisi", 85); + Passenger eve = Passenger.from("Eve", "Jackson", 95); + + List passengers = repository.findAll(Sort.by(Sort.Direction.ASC, "seatNumber")); + + assertThat(passengers, contains(fred, ricki, jill, siya, eve)); + } + +} diff --git a/spring-data-jpa/src/test/java/com/baeldung/services/AbstractServicePersistenceIntegrationTest.java b/persistence-modules/spring-data-jpa/src/test/java/com/baeldung/services/AbstractServicePersistenceIntegrationTest.java similarity index 100% rename from spring-data-jpa/src/test/java/com/baeldung/services/AbstractServicePersistenceIntegrationTest.java rename to persistence-modules/spring-data-jpa/src/test/java/com/baeldung/services/AbstractServicePersistenceIntegrationTest.java diff --git a/spring-data-jpa/src/test/java/com/baeldung/services/FooServicePersistenceIntegrationTest.java b/persistence-modules/spring-data-jpa/src/test/java/com/baeldung/services/FooServicePersistenceIntegrationTest.java similarity index 100% rename from spring-data-jpa/src/test/java/com/baeldung/services/FooServicePersistenceIntegrationTest.java rename to persistence-modules/spring-data-jpa/src/test/java/com/baeldung/services/FooServicePersistenceIntegrationTest.java diff --git a/spring-data-jpa/src/test/java/com/baeldung/services/JpaMultipleDBIntegrationTest.java b/persistence-modules/spring-data-jpa/src/test/java/com/baeldung/services/JpaMultipleDBIntegrationTest.java similarity index 100% rename from spring-data-jpa/src/test/java/com/baeldung/services/JpaMultipleDBIntegrationTest.java rename to persistence-modules/spring-data-jpa/src/test/java/com/baeldung/services/JpaMultipleDBIntegrationTest.java diff --git a/spring-data-jpa/src/test/java/com/baeldung/services/SpringDataJPABarAuditIntegrationTest.java b/persistence-modules/spring-data-jpa/src/test/java/com/baeldung/services/SpringDataJPABarAuditIntegrationTest.java similarity index 100% rename from spring-data-jpa/src/test/java/com/baeldung/services/SpringDataJPABarAuditIntegrationTest.java rename to persistence-modules/spring-data-jpa/src/test/java/com/baeldung/services/SpringDataJPABarAuditIntegrationTest.java diff --git a/spring-data-jpa/src/test/java/com/baeldung/util/IDUtil.java b/persistence-modules/spring-data-jpa/src/test/java/com/baeldung/util/IDUtil.java similarity index 100% rename from spring-data-jpa/src/test/java/com/baeldung/util/IDUtil.java rename to persistence-modules/spring-data-jpa/src/test/java/com/baeldung/util/IDUtil.java diff --git a/spring-rest-query-language/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/persistence-modules/spring-data-jpa/src/test/java/org/baeldung/SpringContextIntegrationTest.java similarity index 91% rename from spring-rest-query-language/src/test/java/org/baeldung/SpringContextIntegrationTest.java rename to persistence-modules/spring-data-jpa/src/test/java/org/baeldung/SpringContextIntegrationTest.java index 35939c992f..7f906bdbcd 100644 --- a/spring-rest-query-language/src/test/java/org/baeldung/SpringContextIntegrationTest.java +++ b/persistence-modules/spring-data-jpa/src/test/java/org/baeldung/SpringContextIntegrationTest.java @@ -1,11 +1,12 @@ package org.baeldung; -import org.baeldung.spring.Application; 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 { diff --git a/spring-data-jpa/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/persistence-modules/spring-data-jpa/src/test/java/org/baeldung/SpringJpaContextIntegrationTest.java similarity index 61% rename from spring-data-jpa/src/test/java/org/baeldung/SpringContextIntegrationTest.java rename to persistence-modules/spring-data-jpa/src/test/java/org/baeldung/SpringJpaContextIntegrationTest.java index 0a60412813..66b5b20b97 100644 --- a/spring-data-jpa/src/test/java/org/baeldung/SpringContextIntegrationTest.java +++ b/persistence-modules/spring-data-jpa/src/test/java/org/baeldung/SpringJpaContextIntegrationTest.java @@ -3,7 +3,7 @@ package org.baeldung; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest; -import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringRunner; import com.baeldung.Application; @@ -12,9 +12,12 @@ import com.baeldung.config.PersistenceProductConfiguration; import com.baeldung.config.PersistenceUserConfiguration; @RunWith(SpringRunner.class) -@DataJpaTest(excludeAutoConfiguration = {PersistenceConfiguration.class, PersistenceUserConfiguration.class, PersistenceProductConfiguration.class}) -@SpringBootTest(classes = Application.class) -public class SpringContextIntegrationTest { +@DataJpaTest(excludeAutoConfiguration = { + PersistenceConfiguration.class, + PersistenceUserConfiguration.class, + PersistenceProductConfiguration.class }) +@ContextConfiguration(classes = Application.class) +public class SpringJpaContextIntegrationTest { @Test public void whenSpringContextIsBootstrapped_thenNoExceptions() { diff --git a/spring-data-keyvalue/README.md b/persistence-modules/spring-data-keyvalue/README.md similarity index 100% rename from spring-data-keyvalue/README.md rename to persistence-modules/spring-data-keyvalue/README.md diff --git a/spring-data-keyvalue/pom.xml b/persistence-modules/spring-data-keyvalue/pom.xml similarity index 90% rename from spring-data-keyvalue/pom.xml rename to persistence-modules/spring-data-keyvalue/pom.xml index edd8967b97..1fee0a88d4 100644 --- a/spring-data-keyvalue/pom.xml +++ b/persistence-modules/spring-data-keyvalue/pom.xml @@ -2,12 +2,13 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 spring-data-keyvalue + spring-data-keyvalue parent-boot-2 com.baeldung 0.0.1-SNAPSHOT - ../parent-boot-2 + ../../parent-boot-2 diff --git a/spring-data-keyvalue/src/main/java/com/baeldung/spring/data/keyvalue/Configurations.java b/persistence-modules/spring-data-keyvalue/src/main/java/com/baeldung/spring/data/keyvalue/Configurations.java similarity index 100% rename from spring-data-keyvalue/src/main/java/com/baeldung/spring/data/keyvalue/Configurations.java rename to persistence-modules/spring-data-keyvalue/src/main/java/com/baeldung/spring/data/keyvalue/Configurations.java diff --git a/spring-data-keyvalue/src/main/java/com/baeldung/spring/data/keyvalue/SpringDataKeyValueApplication.java b/persistence-modules/spring-data-keyvalue/src/main/java/com/baeldung/spring/data/keyvalue/SpringDataKeyValueApplication.java similarity index 100% rename from spring-data-keyvalue/src/main/java/com/baeldung/spring/data/keyvalue/SpringDataKeyValueApplication.java rename to persistence-modules/spring-data-keyvalue/src/main/java/com/baeldung/spring/data/keyvalue/SpringDataKeyValueApplication.java diff --git a/spring-data-keyvalue/src/main/java/com/baeldung/spring/data/keyvalue/repositories/EmployeeRepository.java b/persistence-modules/spring-data-keyvalue/src/main/java/com/baeldung/spring/data/keyvalue/repositories/EmployeeRepository.java similarity index 100% rename from spring-data-keyvalue/src/main/java/com/baeldung/spring/data/keyvalue/repositories/EmployeeRepository.java rename to persistence-modules/spring-data-keyvalue/src/main/java/com/baeldung/spring/data/keyvalue/repositories/EmployeeRepository.java diff --git a/spring-data-keyvalue/src/main/java/com/baeldung/spring/data/keyvalue/services/EmployeeService.java b/persistence-modules/spring-data-keyvalue/src/main/java/com/baeldung/spring/data/keyvalue/services/EmployeeService.java similarity index 100% rename from spring-data-keyvalue/src/main/java/com/baeldung/spring/data/keyvalue/services/EmployeeService.java rename to persistence-modules/spring-data-keyvalue/src/main/java/com/baeldung/spring/data/keyvalue/services/EmployeeService.java diff --git a/spring-data-keyvalue/src/main/java/com/baeldung/spring/data/keyvalue/services/impl/EmployeeServicesWithKeyValueTemplate.java b/persistence-modules/spring-data-keyvalue/src/main/java/com/baeldung/spring/data/keyvalue/services/impl/EmployeeServicesWithKeyValueTemplate.java similarity index 100% rename from spring-data-keyvalue/src/main/java/com/baeldung/spring/data/keyvalue/services/impl/EmployeeServicesWithKeyValueTemplate.java rename to persistence-modules/spring-data-keyvalue/src/main/java/com/baeldung/spring/data/keyvalue/services/impl/EmployeeServicesWithKeyValueTemplate.java diff --git a/spring-data-keyvalue/src/main/java/com/baeldung/spring/data/keyvalue/services/impl/EmployeeServicesWithRepository.java b/persistence-modules/spring-data-keyvalue/src/main/java/com/baeldung/spring/data/keyvalue/services/impl/EmployeeServicesWithRepository.java similarity index 100% rename from spring-data-keyvalue/src/main/java/com/baeldung/spring/data/keyvalue/services/impl/EmployeeServicesWithRepository.java rename to persistence-modules/spring-data-keyvalue/src/main/java/com/baeldung/spring/data/keyvalue/services/impl/EmployeeServicesWithRepository.java diff --git a/spring-data-keyvalue/src/main/java/com/baeldung/spring/data/keyvalue/vo/Employee.java b/persistence-modules/spring-data-keyvalue/src/main/java/com/baeldung/spring/data/keyvalue/vo/Employee.java similarity index 100% rename from spring-data-keyvalue/src/main/java/com/baeldung/spring/data/keyvalue/vo/Employee.java rename to persistence-modules/spring-data-keyvalue/src/main/java/com/baeldung/spring/data/keyvalue/vo/Employee.java diff --git a/spring-5-reactive-functional/src/main/resources/logback.xml b/persistence-modules/spring-data-keyvalue/src/main/resources/logback.xml similarity index 100% rename from spring-5-reactive-functional/src/main/resources/logback.xml rename to persistence-modules/spring-data-keyvalue/src/main/resources/logback.xml diff --git a/spring-data-keyvalue/src/test/java/com/baeldung/spring/data/keyvalue/services/test/EmployeeServicesWithKeyValueRepositoryIntegrationTest.java b/persistence-modules/spring-data-keyvalue/src/test/java/com/baeldung/spring/data/keyvalue/services/test/EmployeeServicesWithKeyValueRepositoryIntegrationTest.java similarity index 100% rename from spring-data-keyvalue/src/test/java/com/baeldung/spring/data/keyvalue/services/test/EmployeeServicesWithKeyValueRepositoryIntegrationTest.java rename to persistence-modules/spring-data-keyvalue/src/test/java/com/baeldung/spring/data/keyvalue/services/test/EmployeeServicesWithKeyValueRepositoryIntegrationTest.java diff --git a/spring-data-keyvalue/src/test/java/com/baeldung/spring/data/keyvalue/services/test/EmployeeServicesWithRepositoryIntegrationTest.java b/persistence-modules/spring-data-keyvalue/src/test/java/com/baeldung/spring/data/keyvalue/services/test/EmployeeServicesWithRepositoryIntegrationTest.java similarity index 100% rename from spring-data-keyvalue/src/test/java/com/baeldung/spring/data/keyvalue/services/test/EmployeeServicesWithRepositoryIntegrationTest.java rename to persistence-modules/spring-data-keyvalue/src/test/java/com/baeldung/spring/data/keyvalue/services/test/EmployeeServicesWithRepositoryIntegrationTest.java diff --git a/spring-data-keyvalue/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/persistence-modules/spring-data-keyvalue/src/test/java/org/baeldung/SpringContextIntegrationTest.java similarity index 100% rename from spring-data-keyvalue/src/test/java/org/baeldung/SpringContextIntegrationTest.java rename to persistence-modules/spring-data-keyvalue/src/test/java/org/baeldung/SpringContextIntegrationTest.java diff --git a/spring-data-mongodb/README.md b/persistence-modules/spring-data-mongodb/README.md similarity index 80% rename from spring-data-mongodb/README.md rename to persistence-modules/spring-data-mongodb/README.md index 4e12a2218a..c4f21dffc0 100644 --- a/spring-data-mongodb/README.md +++ b/persistence-modules/spring-data-mongodb/README.md @@ -11,3 +11,5 @@ - [Introduction to Spring Data MongoDB](http://www.baeldung.com/spring-data-mongodb-tutorial) - [Spring Data MongoDB: Projections and Aggregations](http://www.baeldung.com/spring-data-mongodb-projections-aggregations) - [Spring Data Annotations](http://www.baeldung.com/spring-data-annotations) +- [Spring Data MongoDB Transactions](https://www.baeldung.com/spring-data-mongodb-transactions ) +- [ZonedDateTime with Spring Data MongoDB](https://www.baeldung.com/spring-data-mongodb-zoneddatetime) diff --git a/spring-data-mongodb/pom.xml b/persistence-modules/spring-data-mongodb/pom.xml similarity index 97% rename from spring-data-mongodb/pom.xml rename to persistence-modules/spring-data-mongodb/pom.xml index 072ed7a2ac..76ec5a96a6 100644 --- a/spring-data-mongodb/pom.xml +++ b/persistence-modules/spring-data-mongodb/pom.xml @@ -10,7 +10,7 @@ com.baeldung parent-spring-5 0.0.1-SNAPSHOT - ../parent-spring-5 + ../../parent-spring-5 @@ -109,7 +109,7 @@ - 2.1.0.RELEASE + 2.1.2.RELEASE 4.1.4 1.1.3 5.1.0.RELEASE diff --git a/spring-data-mongodb/src/main/java/com/baeldung/annotation/CascadeSave.java b/persistence-modules/spring-data-mongodb/src/main/java/com/baeldung/annotation/CascadeSave.java similarity index 100% rename from spring-data-mongodb/src/main/java/com/baeldung/annotation/CascadeSave.java rename to persistence-modules/spring-data-mongodb/src/main/java/com/baeldung/annotation/CascadeSave.java diff --git a/spring-data-mongodb/src/main/java/com/baeldung/config/MongoConfig.java b/persistence-modules/spring-data-mongodb/src/main/java/com/baeldung/config/MongoConfig.java similarity index 91% rename from spring-data-mongodb/src/main/java/com/baeldung/config/MongoConfig.java rename to persistence-modules/spring-data-mongodb/src/main/java/com/baeldung/config/MongoConfig.java index f1048fa145..9fa90acf86 100644 --- a/spring-data-mongodb/src/main/java/com/baeldung/config/MongoConfig.java +++ b/persistence-modules/spring-data-mongodb/src/main/java/com/baeldung/config/MongoConfig.java @@ -3,6 +3,8 @@ package com.baeldung.config; import java.util.ArrayList; import java.util.List; +import converter.ZonedDateTimeReadConverter; +import converter.ZonedDateTimeWriteConverter; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.core.convert.converter.Converter; @@ -52,6 +54,8 @@ public class MongoConfig extends AbstractMongoConfiguration { @Override public MongoCustomConversions customConversions() { converters.add(new UserWriterConverter()); + converters.add(new ZonedDateTimeReadConverter()); + converters.add(new ZonedDateTimeWriteConverter()); return new MongoCustomConversions(converters); } @@ -64,5 +68,5 @@ public class MongoConfig extends AbstractMongoConfiguration { MongoTransactionManager transactionManager(MongoDbFactory dbFactory) { return new MongoTransactionManager(dbFactory); } - + } diff --git a/spring-data-mongodb/src/main/java/com/baeldung/config/MongoReactiveConfig.java b/persistence-modules/spring-data-mongodb/src/main/java/com/baeldung/config/MongoReactiveConfig.java similarity index 100% rename from spring-data-mongodb/src/main/java/com/baeldung/config/MongoReactiveConfig.java rename to persistence-modules/spring-data-mongodb/src/main/java/com/baeldung/config/MongoReactiveConfig.java diff --git a/spring-data-mongodb/src/main/java/com/baeldung/config/SimpleMongoConfig.java b/persistence-modules/spring-data-mongodb/src/main/java/com/baeldung/config/SimpleMongoConfig.java similarity index 100% rename from spring-data-mongodb/src/main/java/com/baeldung/config/SimpleMongoConfig.java rename to persistence-modules/spring-data-mongodb/src/main/java/com/baeldung/config/SimpleMongoConfig.java diff --git a/spring-data-mongodb/src/main/java/com/baeldung/converter/UserWriterConverter.java b/persistence-modules/spring-data-mongodb/src/main/java/com/baeldung/converter/UserWriterConverter.java similarity index 100% rename from spring-data-mongodb/src/main/java/com/baeldung/converter/UserWriterConverter.java rename to persistence-modules/spring-data-mongodb/src/main/java/com/baeldung/converter/UserWriterConverter.java diff --git a/spring-data-mongodb/src/main/java/com/baeldung/event/CascadeCallback.java b/persistence-modules/spring-data-mongodb/src/main/java/com/baeldung/event/CascadeCallback.java similarity index 100% rename from spring-data-mongodb/src/main/java/com/baeldung/event/CascadeCallback.java rename to persistence-modules/spring-data-mongodb/src/main/java/com/baeldung/event/CascadeCallback.java diff --git a/spring-data-mongodb/src/main/java/com/baeldung/event/CascadeSaveMongoEventListener.java b/persistence-modules/spring-data-mongodb/src/main/java/com/baeldung/event/CascadeSaveMongoEventListener.java similarity index 100% rename from spring-data-mongodb/src/main/java/com/baeldung/event/CascadeSaveMongoEventListener.java rename to persistence-modules/spring-data-mongodb/src/main/java/com/baeldung/event/CascadeSaveMongoEventListener.java diff --git a/spring-data-mongodb/src/main/java/com/baeldung/event/FieldCallback.java b/persistence-modules/spring-data-mongodb/src/main/java/com/baeldung/event/FieldCallback.java similarity index 100% rename from spring-data-mongodb/src/main/java/com/baeldung/event/FieldCallback.java rename to persistence-modules/spring-data-mongodb/src/main/java/com/baeldung/event/FieldCallback.java diff --git a/spring-data-mongodb/src/main/java/com/baeldung/event/UserCascadeSaveMongoEventListener.java b/persistence-modules/spring-data-mongodb/src/main/java/com/baeldung/event/UserCascadeSaveMongoEventListener.java similarity index 100% rename from spring-data-mongodb/src/main/java/com/baeldung/event/UserCascadeSaveMongoEventListener.java rename to persistence-modules/spring-data-mongodb/src/main/java/com/baeldung/event/UserCascadeSaveMongoEventListener.java diff --git a/persistence-modules/spring-data-mongodb/src/main/java/com/baeldung/model/Action.java b/persistence-modules/spring-data-mongodb/src/main/java/com/baeldung/model/Action.java new file mode 100644 index 0000000000..aa480dbdf7 --- /dev/null +++ b/persistence-modules/spring-data-mongodb/src/main/java/com/baeldung/model/Action.java @@ -0,0 +1,51 @@ +package com.baeldung.model; + +import org.springframework.data.annotation.Id; +import org.springframework.data.mongodb.core.mapping.Document; + +import java.time.ZonedDateTime; + +@Document +public class Action { + + @Id + private String id; + + private String description; + private ZonedDateTime time; + + public Action(String id, String description, ZonedDateTime time) { + this.id = id; + this.description = description; + this.time = time; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public ZonedDateTime getTime() { + return time; + } + + public void setTime(ZonedDateTime time) { + this.time = time; + } + + @Override + public String toString() { + return "Action{id='" + id + "', description='" + description + "', time=" + time + '}'; + } +} diff --git a/spring-data-mongodb/src/main/java/com/baeldung/model/EmailAddress.java b/persistence-modules/spring-data-mongodb/src/main/java/com/baeldung/model/EmailAddress.java similarity index 100% rename from spring-data-mongodb/src/main/java/com/baeldung/model/EmailAddress.java rename to persistence-modules/spring-data-mongodb/src/main/java/com/baeldung/model/EmailAddress.java diff --git a/spring-data-mongodb/src/main/java/com/baeldung/model/User.java b/persistence-modules/spring-data-mongodb/src/main/java/com/baeldung/model/User.java similarity index 100% rename from spring-data-mongodb/src/main/java/com/baeldung/model/User.java rename to persistence-modules/spring-data-mongodb/src/main/java/com/baeldung/model/User.java diff --git a/spring-data-mongodb/src/main/java/com/baeldung/reactive/repository/UserRepository.java b/persistence-modules/spring-data-mongodb/src/main/java/com/baeldung/reactive/repository/UserRepository.java similarity index 100% rename from spring-data-mongodb/src/main/java/com/baeldung/reactive/repository/UserRepository.java rename to persistence-modules/spring-data-mongodb/src/main/java/com/baeldung/reactive/repository/UserRepository.java diff --git a/persistence-modules/spring-data-mongodb/src/main/java/com/baeldung/repository/ActionRepository.java b/persistence-modules/spring-data-mongodb/src/main/java/com/baeldung/repository/ActionRepository.java new file mode 100644 index 0000000000..bdca490fe6 --- /dev/null +++ b/persistence-modules/spring-data-mongodb/src/main/java/com/baeldung/repository/ActionRepository.java @@ -0,0 +1,6 @@ +package com.baeldung.repository; + +import com.baeldung.model.Action; +import org.springframework.data.mongodb.repository.MongoRepository; + +public interface ActionRepository extends MongoRepository { } \ No newline at end of file diff --git a/spring-data-mongodb/src/main/java/com/baeldung/repository/UserRepository.java b/persistence-modules/spring-data-mongodb/src/main/java/com/baeldung/repository/UserRepository.java similarity index 100% rename from spring-data-mongodb/src/main/java/com/baeldung/repository/UserRepository.java rename to persistence-modules/spring-data-mongodb/src/main/java/com/baeldung/repository/UserRepository.java diff --git a/persistence-modules/spring-data-mongodb/src/main/java/converter/ZonedDateTimeReadConverter.java b/persistence-modules/spring-data-mongodb/src/main/java/converter/ZonedDateTimeReadConverter.java new file mode 100644 index 0000000000..a2d847957b --- /dev/null +++ b/persistence-modules/spring-data-mongodb/src/main/java/converter/ZonedDateTimeReadConverter.java @@ -0,0 +1,14 @@ +package converter; + +import org.springframework.core.convert.converter.Converter; + +import java.time.ZoneOffset; +import java.time.ZonedDateTime; +import java.util.Date; + +public class ZonedDateTimeReadConverter implements Converter { + @Override + public ZonedDateTime convert(Date date) { + return date.toInstant().atZone(ZoneOffset.UTC); + } +} \ No newline at end of file diff --git a/persistence-modules/spring-data-mongodb/src/main/java/converter/ZonedDateTimeWriteConverter.java b/persistence-modules/spring-data-mongodb/src/main/java/converter/ZonedDateTimeWriteConverter.java new file mode 100644 index 0000000000..e13ac2d130 --- /dev/null +++ b/persistence-modules/spring-data-mongodb/src/main/java/converter/ZonedDateTimeWriteConverter.java @@ -0,0 +1,13 @@ +package converter; + +import org.springframework.core.convert.converter.Converter; + +import java.time.ZonedDateTime; +import java.util.Date; + +public class ZonedDateTimeWriteConverter implements Converter { + @Override + public Date convert(ZonedDateTime zonedDateTime) { + return Date.from(zonedDateTime.toInstant()); + } +} \ No newline at end of file diff --git a/spring-data-couchbase-2/src/test/resources/logback.xml b/persistence-modules/spring-data-mongodb/src/main/resources/logback.xml similarity index 100% rename from spring-data-couchbase-2/src/test/resources/logback.xml rename to persistence-modules/spring-data-mongodb/src/main/resources/logback.xml diff --git a/spring-data-mongodb/src/main/resources/mongoConfig.xml b/persistence-modules/spring-data-mongodb/src/main/resources/mongoConfig.xml similarity index 100% rename from spring-data-mongodb/src/main/resources/mongoConfig.xml rename to persistence-modules/spring-data-mongodb/src/main/resources/mongoConfig.xml diff --git a/spring-data-mongodb/src/main/resources/test.png b/persistence-modules/spring-data-mongodb/src/main/resources/test.png similarity index 100% rename from spring-data-mongodb/src/main/resources/test.png rename to persistence-modules/spring-data-mongodb/src/main/resources/test.png diff --git a/spring-data-mongodb/src/test/java/com/baeldung/aggregation/ZipsAggregationLiveTest.java b/persistence-modules/spring-data-mongodb/src/test/java/com/baeldung/aggregation/ZipsAggregationLiveTest.java similarity index 100% rename from spring-data-mongodb/src/test/java/com/baeldung/aggregation/ZipsAggregationLiveTest.java rename to persistence-modules/spring-data-mongodb/src/test/java/com/baeldung/aggregation/ZipsAggregationLiveTest.java diff --git a/spring-data-mongodb/src/test/java/com/baeldung/aggregation/model/StatePopulation.java b/persistence-modules/spring-data-mongodb/src/test/java/com/baeldung/aggregation/model/StatePopulation.java similarity index 100% rename from spring-data-mongodb/src/test/java/com/baeldung/aggregation/model/StatePopulation.java rename to persistence-modules/spring-data-mongodb/src/test/java/com/baeldung/aggregation/model/StatePopulation.java diff --git a/spring-data-mongodb/src/test/java/com/baeldung/gridfs/GridFSLiveTest.java b/persistence-modules/spring-data-mongodb/src/test/java/com/baeldung/gridfs/GridFSLiveTest.java similarity index 100% rename from spring-data-mongodb/src/test/java/com/baeldung/gridfs/GridFSLiveTest.java rename to persistence-modules/spring-data-mongodb/src/test/java/com/baeldung/gridfs/GridFSLiveTest.java diff --git a/spring-data-mongodb/src/test/java/com/baeldung/mongotemplate/DocumentQueryLiveTest.java b/persistence-modules/spring-data-mongodb/src/test/java/com/baeldung/mongotemplate/DocumentQueryLiveTest.java similarity index 100% rename from spring-data-mongodb/src/test/java/com/baeldung/mongotemplate/DocumentQueryLiveTest.java rename to persistence-modules/spring-data-mongodb/src/test/java/com/baeldung/mongotemplate/DocumentQueryLiveTest.java diff --git a/spring-data-mongodb/src/test/java/com/baeldung/mongotemplate/MongoTemplateProjectionLiveTest.java b/persistence-modules/spring-data-mongodb/src/test/java/com/baeldung/mongotemplate/MongoTemplateProjectionLiveTest.java similarity index 100% rename from spring-data-mongodb/src/test/java/com/baeldung/mongotemplate/MongoTemplateProjectionLiveTest.java rename to persistence-modules/spring-data-mongodb/src/test/java/com/baeldung/mongotemplate/MongoTemplateProjectionLiveTest.java diff --git a/spring-data-mongodb/src/test/java/com/baeldung/mongotemplate/MongoTemplateQueryLiveTest.java b/persistence-modules/spring-data-mongodb/src/test/java/com/baeldung/mongotemplate/MongoTemplateQueryLiveTest.java similarity index 100% rename from spring-data-mongodb/src/test/java/com/baeldung/mongotemplate/MongoTemplateQueryLiveTest.java rename to persistence-modules/spring-data-mongodb/src/test/java/com/baeldung/mongotemplate/MongoTemplateQueryLiveTest.java diff --git a/persistence-modules/spring-data-mongodb/src/test/java/com/baeldung/repository/ActionRepositoryLiveTest.java b/persistence-modules/spring-data-mongodb/src/test/java/com/baeldung/repository/ActionRepositoryLiveTest.java new file mode 100644 index 0000000000..096015ca0a --- /dev/null +++ b/persistence-modules/spring-data-mongodb/src/test/java/com/baeldung/repository/ActionRepositoryLiveTest.java @@ -0,0 +1,50 @@ +package com.baeldung.repository; + +import com.baeldung.config.MongoConfig; +import com.baeldung.model.Action; +import org.junit.After; +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.data.mongodb.core.MongoOperations; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; + +import java.time.ZoneOffset; +import java.time.ZonedDateTime; + +@RunWith(SpringJUnit4ClassRunner.class) +@ContextConfiguration(classes = MongoConfig.class) +public class ActionRepositoryLiveTest { + + @Autowired + private MongoOperations mongoOps; + + @Autowired + private ActionRepository actionRepository; + + @Before + public void setup() { + if (!mongoOps.collectionExists(Action.class)) { + mongoOps.createCollection(Action.class); + } + } + + @Test + public void givenSavedAction_TimeIsRetrievedCorrectly() { + String id = "testId"; + ZonedDateTime now = ZonedDateTime.now(ZoneOffset.UTC); + + actionRepository.save(new Action(id, "click-action", now)); + Action savedAction = actionRepository.findById(id).get(); + + Assert.assertEquals(now.withNano(0), savedAction.getTime().withNano(0)); + } + + @After + public void tearDown() { + mongoOps.dropCollection(Action.class); + } +} \ No newline at end of file diff --git a/spring-data-mongodb/src/test/java/com/baeldung/repository/BaseQueryLiveTest.java b/persistence-modules/spring-data-mongodb/src/test/java/com/baeldung/repository/BaseQueryLiveTest.java similarity index 100% rename from spring-data-mongodb/src/test/java/com/baeldung/repository/BaseQueryLiveTest.java rename to persistence-modules/spring-data-mongodb/src/test/java/com/baeldung/repository/BaseQueryLiveTest.java diff --git a/spring-data-mongodb/src/test/java/com/baeldung/repository/DSLQueryLiveTest.java b/persistence-modules/spring-data-mongodb/src/test/java/com/baeldung/repository/DSLQueryLiveTest.java similarity index 100% rename from spring-data-mongodb/src/test/java/com/baeldung/repository/DSLQueryLiveTest.java rename to persistence-modules/spring-data-mongodb/src/test/java/com/baeldung/repository/DSLQueryLiveTest.java diff --git a/spring-data-mongodb/src/test/java/com/baeldung/repository/JSONQueryLiveTest.java b/persistence-modules/spring-data-mongodb/src/test/java/com/baeldung/repository/JSONQueryLiveTest.java similarity index 100% rename from spring-data-mongodb/src/test/java/com/baeldung/repository/JSONQueryLiveTest.java rename to persistence-modules/spring-data-mongodb/src/test/java/com/baeldung/repository/JSONQueryLiveTest.java diff --git a/spring-data-mongodb/src/test/java/com/baeldung/repository/QueryMethodsLiveTest.java b/persistence-modules/spring-data-mongodb/src/test/java/com/baeldung/repository/QueryMethodsLiveTest.java similarity index 100% rename from spring-data-mongodb/src/test/java/com/baeldung/repository/QueryMethodsLiveTest.java rename to persistence-modules/spring-data-mongodb/src/test/java/com/baeldung/repository/QueryMethodsLiveTest.java diff --git a/spring-data-mongodb/src/test/java/com/baeldung/repository/UserRepositoryLiveTest.java b/persistence-modules/spring-data-mongodb/src/test/java/com/baeldung/repository/UserRepositoryLiveTest.java similarity index 100% rename from spring-data-mongodb/src/test/java/com/baeldung/repository/UserRepositoryLiveTest.java rename to persistence-modules/spring-data-mongodb/src/test/java/com/baeldung/repository/UserRepositoryLiveTest.java diff --git a/spring-data-mongodb/src/test/java/com/baeldung/repository/UserRepositoryProjectionLiveTest.java b/persistence-modules/spring-data-mongodb/src/test/java/com/baeldung/repository/UserRepositoryProjectionLiveTest.java similarity index 100% rename from spring-data-mongodb/src/test/java/com/baeldung/repository/UserRepositoryProjectionLiveTest.java rename to persistence-modules/spring-data-mongodb/src/test/java/com/baeldung/repository/UserRepositoryProjectionLiveTest.java diff --git a/spring-data-mongodb/src/test/java/com/baeldung/transaction/MongoTransactionReactiveIntegrationTest.java b/persistence-modules/spring-data-mongodb/src/test/java/com/baeldung/transaction/MongoTransactionReactiveIntegrationTest.java similarity index 100% rename from spring-data-mongodb/src/test/java/com/baeldung/transaction/MongoTransactionReactiveIntegrationTest.java rename to persistence-modules/spring-data-mongodb/src/test/java/com/baeldung/transaction/MongoTransactionReactiveIntegrationTest.java diff --git a/spring-data-mongodb/src/test/java/com/baeldung/transaction/MongoTransactionTemplateIntegrationTest.java b/persistence-modules/spring-data-mongodb/src/test/java/com/baeldung/transaction/MongoTransactionTemplateIntegrationTest.java similarity index 100% rename from spring-data-mongodb/src/test/java/com/baeldung/transaction/MongoTransactionTemplateIntegrationTest.java rename to persistence-modules/spring-data-mongodb/src/test/java/com/baeldung/transaction/MongoTransactionTemplateIntegrationTest.java diff --git a/spring-data-mongodb/src/test/java/com/baeldung/transaction/MongoTransactionalIntegrationTest.java b/persistence-modules/spring-data-mongodb/src/test/java/com/baeldung/transaction/MongoTransactionalIntegrationTest.java similarity index 100% rename from spring-data-mongodb/src/test/java/com/baeldung/transaction/MongoTransactionalIntegrationTest.java rename to persistence-modules/spring-data-mongodb/src/test/java/com/baeldung/transaction/MongoTransactionalIntegrationTest.java diff --git a/spring-data-mongodb/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/persistence-modules/spring-data-mongodb/src/test/java/org/baeldung/SpringContextIntegrationTest.java similarity index 100% rename from spring-data-mongodb/src/test/java/org/baeldung/SpringContextIntegrationTest.java rename to persistence-modules/spring-data-mongodb/src/test/java/org/baeldung/SpringContextIntegrationTest.java diff --git a/spring-data-mongodb/src/test/resources/zips.json b/persistence-modules/spring-data-mongodb/src/test/resources/zips.json similarity index 100% rename from spring-data-mongodb/src/test/resources/zips.json rename to persistence-modules/spring-data-mongodb/src/test/resources/zips.json diff --git a/persistence-modules/spring-data-neo4j/pom.xml b/persistence-modules/spring-data-neo4j/pom.xml index 2be4df71be..1e5d51ddf2 100644 --- a/persistence-modules/spring-data-neo4j/pom.xml +++ b/persistence-modules/spring-data-neo4j/pom.xml @@ -3,7 +3,8 @@ 4.0.0 spring-data-neo4j 1.0 - + spring-data-neo4j + com.baeldung parent-modules diff --git a/persistence-modules/spring-data-redis/README.md b/persistence-modules/spring-data-redis/README.md index da44920e16..a20f5052f0 100644 --- a/persistence-modules/spring-data-redis/README.md +++ b/persistence-modules/spring-data-redis/README.md @@ -3,6 +3,7 @@ ### Relevant Articles: - [Introduction to Spring Data Redis](http://www.baeldung.com/spring-data-redis-tutorial) - [PubSub Messaging with Spring Data Redis](http://www.baeldung.com/spring-data-redis-pub-sub) +- [An Introduction to Spring Data Redis Reactive](https://www.baeldung.com/spring-data-redis-reactive) ### Build the Project with Tests Running ``` diff --git a/persistence-modules/spring-data-redis/pom.xml b/persistence-modules/spring-data-redis/pom.xml index bee3d683b8..fb80b0413f 100644 --- a/persistence-modules/spring-data-redis/pom.xml +++ b/persistence-modules/spring-data-redis/pom.xml @@ -4,6 +4,7 @@ com.baeldung spring-data-redis 1.0 + spring-data-redis jar @@ -46,21 +47,9 @@ org.junit.jupiter junit-jupiter-api - - org.junit.jupiter - junit-jupiter-engine - test - - - org.junit.platform - junit-platform-surefire-provider - ${junit.platform.version} - test - org.junit.platform junit-platform-runner - ${junit.platform.version} test @@ -96,8 +85,6 @@ 0.10.0 2.0.3.RELEASE 0.6 - 1.0.0 - 5.0.2 diff --git a/persistence-modules/spring-hibernate-3/README.md b/persistence-modules/spring-hibernate-3/README.md index f9839e34bf..ac840b6f66 100644 --- a/persistence-modules/spring-hibernate-3/README.md +++ b/persistence-modules/spring-hibernate-3/README.md @@ -5,6 +5,7 @@ ### Relevant ArticleS: - [Hibernate 3 with Spring](http://www.baeldung.com/hibernate3-spring) +- [HibernateException: No Hibernate Session Bound to Thread in Hibernate 3](http://www.baeldung.com/no-hibernate-session-bound-to-thread-exception) ### Quick Start diff --git a/spring-hibernate3/src/main/java/org/baeldung/spring/PersistenceConfigHibernate3.java b/persistence-modules/spring-hibernate-3/src/main/java/org/baeldung/spring/PersistenceConfigHibernate3.java similarity index 97% rename from spring-hibernate3/src/main/java/org/baeldung/spring/PersistenceConfigHibernate3.java rename to persistence-modules/spring-hibernate-3/src/main/java/org/baeldung/spring/PersistenceConfigHibernate3.java index a128d8848c..f38da21dc0 100644 --- a/spring-hibernate3/src/main/java/org/baeldung/spring/PersistenceConfigHibernate3.java +++ b/persistence-modules/spring-hibernate-3/src/main/java/org/baeldung/spring/PersistenceConfigHibernate3.java @@ -1,81 +1,81 @@ -package org.baeldung.spring; - -import java.util.Properties; - -import javax.sql.DataSource; - -import org.apache.tomcat.dbcp.dbcp2.BasicDataSource; -import org.hibernate.SessionFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.ComponentScan; -import org.springframework.context.annotation.Configuration; -import org.springframework.context.annotation.PropertySource; -import org.springframework.core.env.Environment; -import org.springframework.core.io.ClassPathResource; -import org.springframework.core.io.Resource; -import org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor; -import org.springframework.orm.hibernate3.HibernateTransactionManager; -import org.springframework.orm.hibernate3.LocalSessionFactoryBean; -import org.springframework.transaction.annotation.EnableTransactionManagement; - -import com.google.common.base.Preconditions; - -@Configuration -@EnableTransactionManagement -@PropertySource({ "classpath:persistence-h2.properties" }) -@ComponentScan({ "org.baeldung.persistence.dao", "org.baeldung.persistence.service" }) -public class PersistenceConfigHibernate3 { - - @Autowired - private Environment env; - - public PersistenceConfigHibernate3() { - super(); - } - - @Bean - public LocalSessionFactoryBean sessionFactory() { - final LocalSessionFactoryBean sessionFactory = new LocalSessionFactoryBean(); - Resource config = new ClassPathResource("exceptionDemo.cfg.xml"); - sessionFactory.setDataSource(dataSource()); - sessionFactory.setConfigLocation(config); - sessionFactory.setHibernateProperties(hibernateProperties()); - - return sessionFactory; - } - - @Bean - public DataSource dataSource() { - final BasicDataSource dataSource = new BasicDataSource(); - dataSource.setDriverClassName(Preconditions.checkNotNull(env.getProperty("jdbc.driverClassName"))); - dataSource.setUrl(Preconditions.checkNotNull(env.getProperty("jdbc.url"))); - dataSource.setUsername(Preconditions.checkNotNull(env.getProperty("jdbc.user"))); - dataSource.setPassword(Preconditions.checkNotNull(env.getProperty("jdbc.pass"))); - - return dataSource; - } - - @Bean - @Autowired - public HibernateTransactionManager transactionManager(final SessionFactory sessionFactory) { - final HibernateTransactionManager txManager = new HibernateTransactionManager(); - txManager.setSessionFactory(sessionFactory); - - return txManager; - } - - @Bean - public PersistenceExceptionTranslationPostProcessor exceptionTranslation() { - return new PersistenceExceptionTranslationPostProcessor(); - } - - final Properties hibernateProperties() { - final Properties hibernateProperties = new Properties(); - hibernateProperties.setProperty("hibernate.hbm2ddl.auto", env.getProperty("hibernate.hbm2ddl.auto")); - hibernateProperties.setProperty("hibernate.dialect", env.getProperty("hibernate.dialect")); - // hibernateProperties.setProperty("hibernate.globally_quoted_identifiers", "true"); - return hibernateProperties; - } - -} +package org.baeldung.spring; + +import java.util.Properties; + +import javax.sql.DataSource; + +import org.apache.tomcat.dbcp.dbcp2.BasicDataSource; +import org.hibernate.SessionFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.ComponentScan; +import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.PropertySource; +import org.springframework.core.env.Environment; +import org.springframework.core.io.ClassPathResource; +import org.springframework.core.io.Resource; +import org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor; +import org.springframework.orm.hibernate3.HibernateTransactionManager; +import org.springframework.orm.hibernate3.LocalSessionFactoryBean; +import org.springframework.transaction.annotation.EnableTransactionManagement; + +import com.google.common.base.Preconditions; + +@Configuration +@EnableTransactionManagement +@PropertySource({ "classpath:persistence-h2.properties" }) +@ComponentScan({ "org.baeldung.persistence.dao", "org.baeldung.persistence.service" }) +public class PersistenceConfigHibernate3 { + + @Autowired + private Environment env; + + public PersistenceConfigHibernate3() { + super(); + } + + @Bean + public LocalSessionFactoryBean sessionFactory() { + final LocalSessionFactoryBean sessionFactory = new LocalSessionFactoryBean(); + Resource config = new ClassPathResource("exceptionDemo.cfg.xml"); + sessionFactory.setDataSource(dataSource()); + sessionFactory.setConfigLocation(config); + sessionFactory.setHibernateProperties(hibernateProperties()); + + return sessionFactory; + } + + @Bean + public DataSource dataSource() { + final BasicDataSource dataSource = new BasicDataSource(); + dataSource.setDriverClassName(Preconditions.checkNotNull(env.getProperty("jdbc.driverClassName"))); + dataSource.setUrl(Preconditions.checkNotNull(env.getProperty("jdbc.url"))); + dataSource.setUsername(Preconditions.checkNotNull(env.getProperty("jdbc.user"))); + dataSource.setPassword(Preconditions.checkNotNull(env.getProperty("jdbc.pass"))); + + return dataSource; + } + + @Bean + @Autowired + public HibernateTransactionManager transactionManager(final SessionFactory sessionFactory) { + final HibernateTransactionManager txManager = new HibernateTransactionManager(); + txManager.setSessionFactory(sessionFactory); + + return txManager; + } + + @Bean + public PersistenceExceptionTranslationPostProcessor exceptionTranslation() { + return new PersistenceExceptionTranslationPostProcessor(); + } + + final Properties hibernateProperties() { + final Properties hibernateProperties = new Properties(); + hibernateProperties.setProperty("hibernate.hbm2ddl.auto", env.getProperty("hibernate.hbm2ddl.auto")); + hibernateProperties.setProperty("hibernate.dialect", env.getProperty("hibernate.dialect")); + // hibernateProperties.setProperty("hibernate.globally_quoted_identifiers", "true"); + return hibernateProperties; + } + +} diff --git a/spring-hibernate3/src/test/java/org/baeldung/persistence/service/HibernateExceptionScen1MainIntegrationTest.java b/persistence-modules/spring-hibernate-3/src/test/java/org/baeldung/persistence/service/HibernateExceptionScen1MainIntegrationTest.java similarity index 95% rename from spring-hibernate3/src/test/java/org/baeldung/persistence/service/HibernateExceptionScen1MainIntegrationTest.java rename to persistence-modules/spring-hibernate-3/src/test/java/org/baeldung/persistence/service/HibernateExceptionScen1MainIntegrationTest.java index d53c4445a8..08032660c0 100644 --- a/spring-hibernate3/src/test/java/org/baeldung/persistence/service/HibernateExceptionScen1MainIntegrationTest.java +++ b/persistence-modules/spring-hibernate-3/src/test/java/org/baeldung/persistence/service/HibernateExceptionScen1MainIntegrationTest.java @@ -1,43 +1,41 @@ -package org.baeldung.persistence.service; - -import java.util.List; - -import org.baeldung.persistence.model.Event; -import org.baeldung.spring.PersistenceConfigHibernate3; -import org.hamcrest.core.IsInstanceOf; -import org.hibernate.HibernateException; -import org.junit.Ignore; -import org.junit.Rule; -import org.junit.Test; -import org.junit.rules.ExpectedException; -import org.junit.runner.RunWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; -import org.springframework.test.context.support.AnnotationConfigContextLoader; - -@RunWith(SpringJUnit4ClassRunner.class) -@ContextConfiguration(classes = { PersistenceConfigHibernate3.class }, loader = AnnotationConfigContextLoader.class) -public class HibernateExceptionScen1MainIntegrationTest { - - @Autowired - EventService service; - - @Rule - public ExpectedException expectedEx = ExpectedException.none(); - - @Test - public final void whenEntityIsCreated_thenNoExceptions() { - service.create(new Event("from LocalSessionFactoryBean")); - } - - @Test - @Ignore - public final void whenNoTransBoundToSession_thenException() { - expectedEx.expectCause(IsInstanceOf.instanceOf(HibernateException.class)); - expectedEx.expectMessage("No Hibernate Session bound to thread, " - + "and configuration does not allow creation " - + "of non-transactional one here"); - service.create(new Event("from LocalSessionFactoryBean")); - } -} +package org.baeldung.persistence.service; + +import org.baeldung.persistence.model.Event; +import org.baeldung.spring.PersistenceConfigHibernate3; +import org.hamcrest.core.IsInstanceOf; +import org.hibernate.HibernateException; +import org.junit.Ignore; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.ExpectedException; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.support.AnnotationConfigContextLoader; + +@RunWith(SpringJUnit4ClassRunner.class) +@ContextConfiguration(classes = { PersistenceConfigHibernate3.class }, loader = AnnotationConfigContextLoader.class) +public class HibernateExceptionScen1MainIntegrationTest { + + @Autowired + EventService service; + + @Rule + public ExpectedException expectedEx = ExpectedException.none(); + + @Test + public final void whenEntityIsCreated_thenNoExceptions() { + service.create(new Event("from LocalSessionFactoryBean")); + } + + @Test + @Ignore + public final void whenNoTransBoundToSession_thenException() { + expectedEx.expectCause(IsInstanceOf.instanceOf(HibernateException.class)); + expectedEx.expectMessage("No Hibernate Session bound to thread, " + + "and configuration does not allow creation " + + "of non-transactional one here"); + service.create(new Event("from LocalSessionFactoryBean")); + } +} diff --git a/spring-hibernate3/src/test/java/org/baeldung/persistence/service/HibernateExceptionScen2MainIntegrationTest.java b/persistence-modules/spring-hibernate-3/src/test/java/org/baeldung/persistence/service/HibernateExceptionScen2MainIntegrationTest.java similarity index 95% rename from spring-hibernate3/src/test/java/org/baeldung/persistence/service/HibernateExceptionScen2MainIntegrationTest.java rename to persistence-modules/spring-hibernate-3/src/test/java/org/baeldung/persistence/service/HibernateExceptionScen2MainIntegrationTest.java index 84cafe0536..44cc6ca010 100644 --- a/spring-hibernate3/src/test/java/org/baeldung/persistence/service/HibernateExceptionScen2MainIntegrationTest.java +++ b/persistence-modules/spring-hibernate-3/src/test/java/org/baeldung/persistence/service/HibernateExceptionScen2MainIntegrationTest.java @@ -1,45 +1,43 @@ -package org.baeldung.persistence.service; - -import java.util.List; - -import org.baeldung.persistence.model.Event; -import org.baeldung.spring.PersistenceConfig; -import org.hamcrest.core.IsInstanceOf; -import org.hibernate.HibernateException; -import org.junit.Ignore; -import org.junit.Rule; -import org.junit.Test; -import org.junit.rules.ExpectedException; -import org.junit.runner.RunWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; -import org.springframework.test.context.support.AnnotationConfigContextLoader; - - -@RunWith(SpringJUnit4ClassRunner.class) -@ContextConfiguration(classes = { PersistenceConfig.class }, loader = AnnotationConfigContextLoader.class) -public class HibernateExceptionScen2MainIntegrationTest { - - @Autowired - EventService service; - - @Rule - public ExpectedException expectedEx = ExpectedException.none(); - - @Test - public final void whenEntityIsCreated_thenNoExceptions() { - service.create(new Event("from AnnotationSessionFactoryBean")); - } - - @Test - @Ignore - public final void whenNoTransBoundToSession_thenException() { - expectedEx.expectCause(IsInstanceOf.instanceOf(HibernateException.class)); - expectedEx.expectMessage("No Hibernate Session bound to thread, " - + "and configuration does not allow creation " - + "of non-transactional one here"); - service.create(new Event("from AnnotationSessionFactoryBean")); - } - -} +package org.baeldung.persistence.service; + +import org.baeldung.persistence.model.Event; +import org.baeldung.spring.PersistenceConfig; +import org.hamcrest.core.IsInstanceOf; +import org.hibernate.HibernateException; +import org.junit.Ignore; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.ExpectedException; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.support.AnnotationConfigContextLoader; + + +@RunWith(SpringJUnit4ClassRunner.class) +@ContextConfiguration(classes = { PersistenceConfig.class }, loader = AnnotationConfigContextLoader.class) +public class HibernateExceptionScen2MainIntegrationTest { + + @Autowired + EventService service; + + @Rule + public ExpectedException expectedEx = ExpectedException.none(); + + @Test + public final void whenEntityIsCreated_thenNoExceptions() { + service.create(new Event("from AnnotationSessionFactoryBean")); + } + + @Test + @Ignore + public final void whenNoTransBoundToSession_thenException() { + expectedEx.expectCause(IsInstanceOf.instanceOf(HibernateException.class)); + expectedEx.expectMessage("No Hibernate Session bound to thread, " + + "and configuration does not allow creation " + + "of non-transactional one here"); + service.create(new Event("from AnnotationSessionFactoryBean")); + } + +} diff --git a/spring-hibernate4/.gitignore b/persistence-modules/spring-hibernate4/.gitignore similarity index 100% rename from spring-hibernate4/.gitignore rename to persistence-modules/spring-hibernate4/.gitignore diff --git a/spring-hibernate4/README.md b/persistence-modules/spring-hibernate4/README.md similarity index 100% rename from spring-hibernate4/README.md rename to persistence-modules/spring-hibernate4/README.md diff --git a/spring-hibernate4/pom.xml b/persistence-modules/spring-hibernate4/pom.xml similarity index 99% rename from spring-hibernate4/pom.xml rename to persistence-modules/spring-hibernate4/pom.xml index 505a218a94..fad84870df 100644 --- a/spring-hibernate4/pom.xml +++ b/persistence-modules/spring-hibernate4/pom.xml @@ -10,6 +10,7 @@ com.baeldung parent-modules 1.0.0-SNAPSHOT + ../../ diff --git a/spring-hibernate4/src/main/java/com/baeldung/hibernate/criteria/model/Item.java b/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/hibernate/criteria/model/Item.java similarity index 100% rename from spring-hibernate4/src/main/java/com/baeldung/hibernate/criteria/model/Item.java rename to persistence-modules/spring-hibernate4/src/main/java/com/baeldung/hibernate/criteria/model/Item.java diff --git a/spring-hibernate4/src/main/java/com/baeldung/hibernate/fetching/model/OrderDetail.java b/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/hibernate/fetching/model/OrderDetail.java similarity index 100% rename from spring-hibernate4/src/main/java/com/baeldung/hibernate/fetching/model/OrderDetail.java rename to persistence-modules/spring-hibernate4/src/main/java/com/baeldung/hibernate/fetching/model/OrderDetail.java diff --git a/spring-hibernate4/src/main/java/com/baeldung/hibernate/fetching/model/UserEager.java b/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/hibernate/fetching/model/UserEager.java similarity index 100% rename from spring-hibernate4/src/main/java/com/baeldung/hibernate/fetching/model/UserEager.java rename to persistence-modules/spring-hibernate4/src/main/java/com/baeldung/hibernate/fetching/model/UserEager.java diff --git a/spring-hibernate4/src/main/java/com/baeldung/hibernate/fetching/model/UserLazy.java b/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/hibernate/fetching/model/UserLazy.java similarity index 100% rename from spring-hibernate4/src/main/java/com/baeldung/hibernate/fetching/model/UserLazy.java rename to persistence-modules/spring-hibernate4/src/main/java/com/baeldung/hibernate/fetching/model/UserLazy.java diff --git a/spring-hibernate4/src/main/java/com/baeldung/hibernate/fetching/util/HibernateUtil.java b/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/hibernate/fetching/util/HibernateUtil.java similarity index 100% rename from spring-hibernate4/src/main/java/com/baeldung/hibernate/fetching/util/HibernateUtil.java rename to persistence-modules/spring-hibernate4/src/main/java/com/baeldung/hibernate/fetching/util/HibernateUtil.java diff --git a/spring-hibernate4/src/main/java/com/baeldung/hibernate/fetching/view/FetchingAppView.java b/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/hibernate/fetching/view/FetchingAppView.java similarity index 100% rename from spring-hibernate4/src/main/java/com/baeldung/hibernate/fetching/view/FetchingAppView.java rename to persistence-modules/spring-hibernate4/src/main/java/com/baeldung/hibernate/fetching/view/FetchingAppView.java diff --git a/spring-hibernate4/src/main/java/com/baeldung/hibernate/oneToMany/config/HibernateAnnotationUtil.java b/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/hibernate/oneToMany/config/HibernateAnnotationUtil.java similarity index 100% rename from spring-hibernate4/src/main/java/com/baeldung/hibernate/oneToMany/config/HibernateAnnotationUtil.java rename to persistence-modules/spring-hibernate4/src/main/java/com/baeldung/hibernate/oneToMany/config/HibernateAnnotationUtil.java diff --git a/spring-hibernate4/src/main/java/com/baeldung/hibernate/oneToMany/main/HibernateOneToManyAnnotationMain.java b/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/hibernate/oneToMany/main/HibernateOneToManyAnnotationMain.java similarity index 100% rename from spring-hibernate4/src/main/java/com/baeldung/hibernate/oneToMany/main/HibernateOneToManyAnnotationMain.java rename to persistence-modules/spring-hibernate4/src/main/java/com/baeldung/hibernate/oneToMany/main/HibernateOneToManyAnnotationMain.java diff --git a/spring-hibernate4/src/main/java/com/baeldung/hibernate/oneToMany/model/Cart.java b/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/hibernate/oneToMany/model/Cart.java similarity index 100% rename from spring-hibernate4/src/main/java/com/baeldung/hibernate/oneToMany/model/Cart.java rename to persistence-modules/spring-hibernate4/src/main/java/com/baeldung/hibernate/oneToMany/model/Cart.java diff --git a/spring-hibernate4/src/main/java/com/baeldung/hibernate/oneToMany/model/Items.java b/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/hibernate/oneToMany/model/Items.java similarity index 100% rename from spring-hibernate4/src/main/java/com/baeldung/hibernate/oneToMany/model/Items.java rename to persistence-modules/spring-hibernate4/src/main/java/com/baeldung/hibernate/oneToMany/model/Items.java diff --git a/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/IBarAuditableDao.java b/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/IBarAuditableDao.java similarity index 100% rename from spring-hibernate4/src/main/java/com/baeldung/persistence/dao/IBarAuditableDao.java rename to persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/IBarAuditableDao.java diff --git a/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/IBarCrudRepository.java b/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/IBarCrudRepository.java similarity index 100% rename from spring-hibernate4/src/main/java/com/baeldung/persistence/dao/IBarCrudRepository.java rename to persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/IBarCrudRepository.java diff --git a/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/IBarDao.java b/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/IBarDao.java similarity index 100% rename from spring-hibernate4/src/main/java/com/baeldung/persistence/dao/IBarDao.java rename to persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/IBarDao.java diff --git a/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/IChildDao.java b/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/IChildDao.java similarity index 100% rename from spring-hibernate4/src/main/java/com/baeldung/persistence/dao/IChildDao.java rename to persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/IChildDao.java diff --git a/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/IFooAuditableDao.java b/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/IFooAuditableDao.java similarity index 100% rename from spring-hibernate4/src/main/java/com/baeldung/persistence/dao/IFooAuditableDao.java rename to persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/IFooAuditableDao.java diff --git a/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/IFooDao.java b/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/IFooDao.java similarity index 100% rename from spring-hibernate4/src/main/java/com/baeldung/persistence/dao/IFooDao.java rename to persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/IFooDao.java diff --git a/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/IParentDao.java b/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/IParentDao.java similarity index 100% rename from spring-hibernate4/src/main/java/com/baeldung/persistence/dao/IParentDao.java rename to persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/IParentDao.java diff --git a/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/common/AbstractDao.java b/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/common/AbstractDao.java similarity index 100% rename from spring-hibernate4/src/main/java/com/baeldung/persistence/dao/common/AbstractDao.java rename to persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/common/AbstractDao.java diff --git a/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/common/AbstractHibernateAuditableDao.java b/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/common/AbstractHibernateAuditableDao.java similarity index 100% rename from spring-hibernate4/src/main/java/com/baeldung/persistence/dao/common/AbstractHibernateAuditableDao.java rename to persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/common/AbstractHibernateAuditableDao.java diff --git a/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/common/AbstractHibernateDao.java b/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/common/AbstractHibernateDao.java similarity index 100% rename from spring-hibernate4/src/main/java/com/baeldung/persistence/dao/common/AbstractHibernateDao.java rename to persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/common/AbstractHibernateDao.java diff --git a/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/common/AbstractJpaDao.java b/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/common/AbstractJpaDao.java similarity index 100% rename from spring-hibernate4/src/main/java/com/baeldung/persistence/dao/common/AbstractJpaDao.java rename to persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/common/AbstractJpaDao.java diff --git a/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/common/GenericHibernateDao.java b/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/common/GenericHibernateDao.java similarity index 100% rename from spring-hibernate4/src/main/java/com/baeldung/persistence/dao/common/GenericHibernateDao.java rename to persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/common/GenericHibernateDao.java diff --git a/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/common/IAuditOperations.java b/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/common/IAuditOperations.java similarity index 100% rename from spring-hibernate4/src/main/java/com/baeldung/persistence/dao/common/IAuditOperations.java rename to persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/common/IAuditOperations.java diff --git a/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/common/IGenericDao.java b/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/common/IGenericDao.java similarity index 100% rename from spring-hibernate4/src/main/java/com/baeldung/persistence/dao/common/IGenericDao.java rename to persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/common/IGenericDao.java diff --git a/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/common/IOperations.java b/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/common/IOperations.java similarity index 100% rename from spring-hibernate4/src/main/java/com/baeldung/persistence/dao/common/IOperations.java rename to persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/common/IOperations.java diff --git a/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/impl/BarAuditableDao.java b/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/impl/BarAuditableDao.java similarity index 100% rename from spring-hibernate4/src/main/java/com/baeldung/persistence/dao/impl/BarAuditableDao.java rename to persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/impl/BarAuditableDao.java diff --git a/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/impl/BarDao.java b/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/impl/BarDao.java similarity index 100% rename from spring-hibernate4/src/main/java/com/baeldung/persistence/dao/impl/BarDao.java rename to persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/impl/BarDao.java diff --git a/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/impl/BarJpaDao.java b/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/impl/BarJpaDao.java similarity index 100% rename from spring-hibernate4/src/main/java/com/baeldung/persistence/dao/impl/BarJpaDao.java rename to persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/impl/BarJpaDao.java diff --git a/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/impl/ChildDao.java b/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/impl/ChildDao.java similarity index 100% rename from spring-hibernate4/src/main/java/com/baeldung/persistence/dao/impl/ChildDao.java rename to persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/impl/ChildDao.java diff --git a/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/impl/FooAuditableDao.java b/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/impl/FooAuditableDao.java similarity index 100% rename from spring-hibernate4/src/main/java/com/baeldung/persistence/dao/impl/FooAuditableDao.java rename to persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/impl/FooAuditableDao.java diff --git a/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/impl/FooDao.java b/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/impl/FooDao.java similarity index 100% rename from spring-hibernate4/src/main/java/com/baeldung/persistence/dao/impl/FooDao.java rename to persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/impl/FooDao.java diff --git a/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/impl/ParentDao.java b/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/impl/ParentDao.java similarity index 100% rename from spring-hibernate4/src/main/java/com/baeldung/persistence/dao/impl/ParentDao.java rename to persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/impl/ParentDao.java diff --git a/spring-hibernate4/src/main/java/com/baeldung/persistence/model/Bar.java b/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/model/Bar.java similarity index 100% rename from spring-hibernate4/src/main/java/com/baeldung/persistence/model/Bar.java rename to persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/model/Bar.java diff --git a/spring-hibernate4/src/main/java/com/baeldung/persistence/model/Child.java b/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/model/Child.java similarity index 100% rename from spring-hibernate4/src/main/java/com/baeldung/persistence/model/Child.java rename to persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/model/Child.java diff --git a/spring-hibernate4/src/main/java/com/baeldung/persistence/model/Foo.java b/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/model/Foo.java similarity index 100% rename from spring-hibernate4/src/main/java/com/baeldung/persistence/model/Foo.java rename to persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/model/Foo.java diff --git a/spring-hibernate4/src/main/java/com/baeldung/persistence/model/Parent.java b/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/model/Parent.java similarity index 100% rename from spring-hibernate4/src/main/java/com/baeldung/persistence/model/Parent.java rename to persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/model/Parent.java diff --git a/spring-hibernate4/src/main/java/com/baeldung/persistence/model/Person.java b/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/model/Person.java similarity index 100% rename from spring-hibernate4/src/main/java/com/baeldung/persistence/model/Person.java rename to persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/model/Person.java diff --git a/spring-hibernate4/src/main/java/com/baeldung/persistence/service/IBarAuditableService.java b/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/service/IBarAuditableService.java similarity index 100% rename from spring-hibernate4/src/main/java/com/baeldung/persistence/service/IBarAuditableService.java rename to persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/service/IBarAuditableService.java diff --git a/spring-hibernate4/src/main/java/com/baeldung/persistence/service/IBarService.java b/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/service/IBarService.java similarity index 100% rename from spring-hibernate4/src/main/java/com/baeldung/persistence/service/IBarService.java rename to persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/service/IBarService.java diff --git a/spring-hibernate4/src/main/java/com/baeldung/persistence/service/IChildService.java b/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/service/IChildService.java similarity index 100% rename from spring-hibernate4/src/main/java/com/baeldung/persistence/service/IChildService.java rename to persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/service/IChildService.java diff --git a/spring-hibernate4/src/main/java/com/baeldung/persistence/service/IFooAuditableService.java b/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/service/IFooAuditableService.java similarity index 100% rename from spring-hibernate4/src/main/java/com/baeldung/persistence/service/IFooAuditableService.java rename to persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/service/IFooAuditableService.java diff --git a/spring-hibernate4/src/main/java/com/baeldung/persistence/service/IFooService.java b/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/service/IFooService.java similarity index 100% rename from spring-hibernate4/src/main/java/com/baeldung/persistence/service/IFooService.java rename to persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/service/IFooService.java diff --git a/spring-hibernate4/src/main/java/com/baeldung/persistence/service/IParentService.java b/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/service/IParentService.java similarity index 100% rename from spring-hibernate4/src/main/java/com/baeldung/persistence/service/IParentService.java rename to persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/service/IParentService.java diff --git a/spring-hibernate4/src/main/java/com/baeldung/persistence/service/common/AbstractHibernateAuditableService.java b/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/service/common/AbstractHibernateAuditableService.java similarity index 100% rename from spring-hibernate4/src/main/java/com/baeldung/persistence/service/common/AbstractHibernateAuditableService.java rename to persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/service/common/AbstractHibernateAuditableService.java diff --git a/spring-hibernate4/src/main/java/com/baeldung/persistence/service/common/AbstractHibernateService.java b/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/service/common/AbstractHibernateService.java similarity index 100% rename from spring-hibernate4/src/main/java/com/baeldung/persistence/service/common/AbstractHibernateService.java rename to persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/service/common/AbstractHibernateService.java diff --git a/spring-hibernate4/src/main/java/com/baeldung/persistence/service/common/AbstractJpaService.java b/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/service/common/AbstractJpaService.java similarity index 100% rename from spring-hibernate4/src/main/java/com/baeldung/persistence/service/common/AbstractJpaService.java rename to persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/service/common/AbstractJpaService.java diff --git a/spring-hibernate4/src/main/java/com/baeldung/persistence/service/common/AbstractService.java b/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/service/common/AbstractService.java similarity index 100% rename from spring-hibernate4/src/main/java/com/baeldung/persistence/service/common/AbstractService.java rename to persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/service/common/AbstractService.java diff --git a/spring-hibernate4/src/main/java/com/baeldung/persistence/service/common/AbstractSpringDataJpaService.java b/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/service/common/AbstractSpringDataJpaService.java similarity index 100% rename from spring-hibernate4/src/main/java/com/baeldung/persistence/service/common/AbstractSpringDataJpaService.java rename to persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/service/common/AbstractSpringDataJpaService.java diff --git a/spring-hibernate4/src/main/java/com/baeldung/persistence/service/impl/BarAuditableService.java b/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/service/impl/BarAuditableService.java similarity index 100% rename from spring-hibernate4/src/main/java/com/baeldung/persistence/service/impl/BarAuditableService.java rename to persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/service/impl/BarAuditableService.java diff --git a/spring-hibernate4/src/main/java/com/baeldung/persistence/service/impl/BarJpaService.java b/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/service/impl/BarJpaService.java similarity index 100% rename from spring-hibernate4/src/main/java/com/baeldung/persistence/service/impl/BarJpaService.java rename to persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/service/impl/BarJpaService.java diff --git a/spring-hibernate4/src/main/java/com/baeldung/persistence/service/impl/BarService.java b/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/service/impl/BarService.java similarity index 100% rename from spring-hibernate4/src/main/java/com/baeldung/persistence/service/impl/BarService.java rename to persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/service/impl/BarService.java diff --git a/spring-hibernate4/src/main/java/com/baeldung/persistence/service/impl/BarSpringDataJpaService.java b/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/service/impl/BarSpringDataJpaService.java similarity index 100% rename from spring-hibernate4/src/main/java/com/baeldung/persistence/service/impl/BarSpringDataJpaService.java rename to persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/service/impl/BarSpringDataJpaService.java diff --git a/spring-hibernate4/src/main/java/com/baeldung/persistence/service/impl/ChildService.java b/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/service/impl/ChildService.java similarity index 100% rename from spring-hibernate4/src/main/java/com/baeldung/persistence/service/impl/ChildService.java rename to persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/service/impl/ChildService.java diff --git a/spring-hibernate4/src/main/java/com/baeldung/persistence/service/impl/FooAuditableService.java b/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/service/impl/FooAuditableService.java similarity index 100% rename from spring-hibernate4/src/main/java/com/baeldung/persistence/service/impl/FooAuditableService.java rename to persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/service/impl/FooAuditableService.java diff --git a/spring-hibernate4/src/main/java/com/baeldung/persistence/service/impl/FooService.java b/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/service/impl/FooService.java similarity index 100% rename from spring-hibernate4/src/main/java/com/baeldung/persistence/service/impl/FooService.java rename to persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/service/impl/FooService.java diff --git a/spring-hibernate4/src/main/java/com/baeldung/persistence/service/impl/ParentService.java b/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/service/impl/ParentService.java similarity index 100% rename from spring-hibernate4/src/main/java/com/baeldung/persistence/service/impl/ParentService.java rename to persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/service/impl/ParentService.java diff --git a/spring-hibernate4/src/main/java/com/baeldung/spring/PersistenceConfig.java b/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/spring/PersistenceConfig.java similarity index 100% rename from spring-hibernate4/src/main/java/com/baeldung/spring/PersistenceConfig.java rename to persistence-modules/spring-hibernate4/src/main/java/com/baeldung/spring/PersistenceConfig.java diff --git a/spring-hibernate4/src/main/java/com/baeldung/spring/PersistenceXmlConfig.java b/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/spring/PersistenceXmlConfig.java similarity index 100% rename from spring-hibernate4/src/main/java/com/baeldung/spring/PersistenceXmlConfig.java rename to persistence-modules/spring-hibernate4/src/main/java/com/baeldung/spring/PersistenceXmlConfig.java diff --git a/spring-hibernate4/src/main/resources/fetching.cfg.xml b/persistence-modules/spring-hibernate4/src/main/resources/fetching.cfg.xml similarity index 100% rename from spring-hibernate4/src/main/resources/fetching.cfg.xml rename to persistence-modules/spring-hibernate4/src/main/resources/fetching.cfg.xml diff --git a/spring-hibernate4/src/main/resources/fetchingLazy.cfg.xml b/persistence-modules/spring-hibernate4/src/main/resources/fetchingLazy.cfg.xml similarity index 100% rename from spring-hibernate4/src/main/resources/fetchingLazy.cfg.xml rename to persistence-modules/spring-hibernate4/src/main/resources/fetchingLazy.cfg.xml diff --git a/spring-hibernate4/src/main/resources/fetching_create_queries.sql b/persistence-modules/spring-hibernate4/src/main/resources/fetching_create_queries.sql similarity index 100% rename from spring-hibernate4/src/main/resources/fetching_create_queries.sql rename to persistence-modules/spring-hibernate4/src/main/resources/fetching_create_queries.sql diff --git a/spring-hibernate4/src/main/resources/hibernate-annotation.cfg.xml b/persistence-modules/spring-hibernate4/src/main/resources/hibernate-annotation.cfg.xml similarity index 100% rename from spring-hibernate4/src/main/resources/hibernate-annotation.cfg.xml rename to persistence-modules/spring-hibernate4/src/main/resources/hibernate-annotation.cfg.xml diff --git a/spring-hibernate4/src/main/resources/hibernate4Config.xml b/persistence-modules/spring-hibernate4/src/main/resources/hibernate4Config.xml similarity index 100% rename from spring-hibernate4/src/main/resources/hibernate4Config.xml rename to persistence-modules/spring-hibernate4/src/main/resources/hibernate4Config.xml diff --git a/spring-hibernate4/src/main/resources/immutable.cfg.xml b/persistence-modules/spring-hibernate4/src/main/resources/immutable.cfg.xml similarity index 100% rename from spring-hibernate4/src/main/resources/immutable.cfg.xml rename to persistence-modules/spring-hibernate4/src/main/resources/immutable.cfg.xml diff --git a/spring-hibernate4/src/main/resources/insert_statements.sql b/persistence-modules/spring-hibernate4/src/main/resources/insert_statements.sql similarity index 100% rename from spring-hibernate4/src/main/resources/insert_statements.sql rename to persistence-modules/spring-hibernate4/src/main/resources/insert_statements.sql diff --git a/spring-data-mongodb/src/main/resources/logback.xml b/persistence-modules/spring-hibernate4/src/main/resources/logback.xml similarity index 100% rename from spring-data-mongodb/src/main/resources/logback.xml rename to persistence-modules/spring-hibernate4/src/main/resources/logback.xml diff --git a/spring-hibernate4/src/main/resources/one_to_many.sql b/persistence-modules/spring-hibernate4/src/main/resources/one_to_many.sql similarity index 100% rename from spring-hibernate4/src/main/resources/one_to_many.sql rename to persistence-modules/spring-hibernate4/src/main/resources/one_to_many.sql diff --git a/spring-hibernate4/src/main/resources/persistence-mysql.properties b/persistence-modules/spring-hibernate4/src/main/resources/persistence-mysql.properties similarity index 100% rename from spring-hibernate4/src/main/resources/persistence-mysql.properties rename to persistence-modules/spring-hibernate4/src/main/resources/persistence-mysql.properties diff --git a/spring-hibernate4/src/main/resources/stored_procedure.sql b/persistence-modules/spring-hibernate4/src/main/resources/stored_procedure.sql similarity index 93% rename from spring-hibernate4/src/main/resources/stored_procedure.sql rename to persistence-modules/spring-hibernate4/src/main/resources/stored_procedure.sql index 8e1bdf57dd..9cedb75c37 100644 --- a/spring-hibernate4/src/main/resources/stored_procedure.sql +++ b/persistence-modules/spring-hibernate4/src/main/resources/stored_procedure.sql @@ -1,20 +1,20 @@ -DELIMITER // - CREATE PROCEDURE GetFoosByName(IN fooName VARCHAR(255)) - LANGUAGE SQL - DETERMINISTIC - SQL SECURITY DEFINER - BEGIN - SELECT * FROM foo WHERE name = fooName; - END // -DELIMITER ; - - -DELIMITER // - CREATE PROCEDURE GetAllFoos() - LANGUAGE SQL - DETERMINISTIC - SQL SECURITY DEFINER - BEGIN - SELECT * FROM foo; - END // +DELIMITER // + CREATE PROCEDURE GetFoosByName(IN fooName VARCHAR(255)) + LANGUAGE SQL + DETERMINISTIC + SQL SECURITY DEFINER + BEGIN + SELECT * FROM foo WHERE name = fooName; + END // +DELIMITER ; + + +DELIMITER // + CREATE PROCEDURE GetAllFoos() + LANGUAGE SQL + DETERMINISTIC + SQL SECURITY DEFINER + BEGIN + SELECT * FROM foo; + END // DELIMITER ; \ No newline at end of file diff --git a/spring-hibernate4/src/main/resources/webSecurityConfig.xml b/persistence-modules/spring-hibernate4/src/main/resources/webSecurityConfig.xml similarity index 100% rename from spring-hibernate4/src/main/resources/webSecurityConfig.xml rename to persistence-modules/spring-hibernate4/src/main/resources/webSecurityConfig.xml diff --git a/spring-hibernate4/src/test/java/com/baeldung/hibernate/fetching/HibernateFetchingIntegrationTest.java b/persistence-modules/spring-hibernate4/src/test/java/com/baeldung/hibernate/fetching/HibernateFetchingIntegrationTest.java similarity index 100% rename from spring-hibernate4/src/test/java/com/baeldung/hibernate/fetching/HibernateFetchingIntegrationTest.java rename to persistence-modules/spring-hibernate4/src/test/java/com/baeldung/hibernate/fetching/HibernateFetchingIntegrationTest.java diff --git a/spring-hibernate4/src/test/java/com/baeldung/hibernate/oneToMany/main/HibernateOneToManyAnnotationMainIntegrationTest.java b/persistence-modules/spring-hibernate4/src/test/java/com/baeldung/hibernate/oneToMany/main/HibernateOneToManyAnnotationMainIntegrationTest.java similarity index 100% rename from spring-hibernate4/src/test/java/com/baeldung/hibernate/oneToMany/main/HibernateOneToManyAnnotationMainIntegrationTest.java rename to persistence-modules/spring-hibernate4/src/test/java/com/baeldung/hibernate/oneToMany/main/HibernateOneToManyAnnotationMainIntegrationTest.java diff --git a/spring-hibernate4/src/test/java/com/baeldung/persistence/IntegrationTestSuite.java b/persistence-modules/spring-hibernate4/src/test/java/com/baeldung/persistence/IntegrationTestSuite.java similarity index 100% rename from spring-hibernate4/src/test/java/com/baeldung/persistence/IntegrationTestSuite.java rename to persistence-modules/spring-hibernate4/src/test/java/com/baeldung/persistence/IntegrationTestSuite.java diff --git a/spring-hibernate4/src/test/java/com/baeldung/persistence/audit/AuditTestSuite.java b/persistence-modules/spring-hibernate4/src/test/java/com/baeldung/persistence/audit/AuditTestSuite.java similarity index 100% rename from spring-hibernate4/src/test/java/com/baeldung/persistence/audit/AuditTestSuite.java rename to persistence-modules/spring-hibernate4/src/test/java/com/baeldung/persistence/audit/AuditTestSuite.java diff --git a/spring-hibernate4/src/test/java/com/baeldung/persistence/audit/EnversFooBarAuditIntegrationTest.java b/persistence-modules/spring-hibernate4/src/test/java/com/baeldung/persistence/audit/EnversFooBarAuditIntegrationTest.java similarity index 100% rename from spring-hibernate4/src/test/java/com/baeldung/persistence/audit/EnversFooBarAuditIntegrationTest.java rename to persistence-modules/spring-hibernate4/src/test/java/com/baeldung/persistence/audit/EnversFooBarAuditIntegrationTest.java diff --git a/spring-hibernate4/src/test/java/com/baeldung/persistence/audit/JPABarAuditIntegrationTest.java b/persistence-modules/spring-hibernate4/src/test/java/com/baeldung/persistence/audit/JPABarAuditIntegrationTest.java similarity index 100% rename from spring-hibernate4/src/test/java/com/baeldung/persistence/audit/JPABarAuditIntegrationTest.java rename to persistence-modules/spring-hibernate4/src/test/java/com/baeldung/persistence/audit/JPABarAuditIntegrationTest.java diff --git a/spring-hibernate4/src/test/java/com/baeldung/persistence/audit/SpringDataJPABarAuditIntegrationTest.java b/persistence-modules/spring-hibernate4/src/test/java/com/baeldung/persistence/audit/SpringDataJPABarAuditIntegrationTest.java similarity index 100% rename from spring-hibernate4/src/test/java/com/baeldung/persistence/audit/SpringDataJPABarAuditIntegrationTest.java rename to persistence-modules/spring-hibernate4/src/test/java/com/baeldung/persistence/audit/SpringDataJPABarAuditIntegrationTest.java diff --git a/spring-hibernate4/src/test/java/com/baeldung/persistence/hibernate/FooFixtures.java b/persistence-modules/spring-hibernate4/src/test/java/com/baeldung/persistence/hibernate/FooFixtures.java similarity index 100% rename from spring-hibernate4/src/test/java/com/baeldung/persistence/hibernate/FooFixtures.java rename to persistence-modules/spring-hibernate4/src/test/java/com/baeldung/persistence/hibernate/FooFixtures.java diff --git a/spring-hibernate4/src/test/java/com/baeldung/persistence/hibernate/FooPaginationPersistenceIntegrationTest.java b/persistence-modules/spring-hibernate4/src/test/java/com/baeldung/persistence/hibernate/FooPaginationPersistenceIntegrationTest.java similarity index 100% rename from spring-hibernate4/src/test/java/com/baeldung/persistence/hibernate/FooPaginationPersistenceIntegrationTest.java rename to persistence-modules/spring-hibernate4/src/test/java/com/baeldung/persistence/hibernate/FooPaginationPersistenceIntegrationTest.java diff --git a/spring-hibernate4/src/test/java/com/baeldung/persistence/hibernate/FooSortingPersistenceIntegrationTest.java b/persistence-modules/spring-hibernate4/src/test/java/com/baeldung/persistence/hibernate/FooSortingPersistenceIntegrationTest.java similarity index 100% rename from spring-hibernate4/src/test/java/com/baeldung/persistence/hibernate/FooSortingPersistenceIntegrationTest.java rename to persistence-modules/spring-hibernate4/src/test/java/com/baeldung/persistence/hibernate/FooSortingPersistenceIntegrationTest.java diff --git a/spring-hibernate4/src/test/java/com/baeldung/persistence/save/SaveMethodsIntegrationTest.java b/persistence-modules/spring-hibernate4/src/test/java/com/baeldung/persistence/save/SaveMethodsIntegrationTest.java similarity index 100% rename from spring-hibernate4/src/test/java/com/baeldung/persistence/save/SaveMethodsIntegrationTest.java rename to persistence-modules/spring-hibernate4/src/test/java/com/baeldung/persistence/save/SaveMethodsIntegrationTest.java diff --git a/spring-hibernate4/src/test/java/com/baeldung/persistence/service/FooServiceBasicPersistenceIntegrationTest.java b/persistence-modules/spring-hibernate4/src/test/java/com/baeldung/persistence/service/FooServiceBasicPersistenceIntegrationTest.java similarity index 100% rename from spring-hibernate4/src/test/java/com/baeldung/persistence/service/FooServiceBasicPersistenceIntegrationTest.java rename to persistence-modules/spring-hibernate4/src/test/java/com/baeldung/persistence/service/FooServiceBasicPersistenceIntegrationTest.java diff --git a/spring-hibernate4/src/test/java/com/baeldung/persistence/service/FooServicePersistenceIntegrationTest.java b/persistence-modules/spring-hibernate4/src/test/java/com/baeldung/persistence/service/FooServicePersistenceIntegrationTest.java similarity index 100% rename from spring-hibernate4/src/test/java/com/baeldung/persistence/service/FooServicePersistenceIntegrationTest.java rename to persistence-modules/spring-hibernate4/src/test/java/com/baeldung/persistence/service/FooServicePersistenceIntegrationTest.java diff --git a/spring-hibernate4/src/test/java/com/baeldung/persistence/service/FooStoredProceduresLiveTest.java b/persistence-modules/spring-hibernate4/src/test/java/com/baeldung/persistence/service/FooStoredProceduresLiveTest.java similarity index 97% rename from spring-hibernate4/src/test/java/com/baeldung/persistence/service/FooStoredProceduresLiveTest.java rename to persistence-modules/spring-hibernate4/src/test/java/com/baeldung/persistence/service/FooStoredProceduresLiveTest.java index 9ec04d297c..d9353f1ad1 100644 --- a/spring-hibernate4/src/test/java/com/baeldung/persistence/service/FooStoredProceduresLiveTest.java +++ b/persistence-modules/spring-hibernate4/src/test/java/com/baeldung/persistence/service/FooStoredProceduresLiveTest.java @@ -1,121 +1,121 @@ -package com.baeldung.persistence.service; - -import java.util.List; - -import static org.apache.commons.lang3.RandomStringUtils.randomAlphabetic; -import static org.junit.Assert.assertEquals; - -import org.hibernate.Query; -import org.hibernate.Session; -import org.hibernate.SessionFactory; -import org.hibernate.exception.SQLGrammarException; -import org.junit.After; -import org.junit.Assume; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; -import org.springframework.test.context.support.AnnotationConfigContextLoader; - -import com.baeldung.persistence.model.Foo; -import com.baeldung.spring.PersistenceConfig; - -@RunWith(SpringJUnit4ClassRunner.class) -@ContextConfiguration(classes = { PersistenceConfig.class }, loader = AnnotationConfigContextLoader.class) -public class FooStoredProceduresLiveTest { - - private static final Logger LOGGER = LoggerFactory.getLogger(FooStoredProceduresLiveTest.class); - - @Autowired - private SessionFactory sessionFactory; - - @Autowired - private IFooService fooService; - - private Session session; - - @Before - public final void before() { - session = sessionFactory.openSession(); - Assume.assumeTrue(getAllFoosExists()); - Assume.assumeTrue(getFoosByNameExists()); - } - - private boolean getFoosByNameExists() { - try { - Query sqlQuery = session.createSQLQuery("CALL GetAllFoos()").addEntity(Foo.class); - sqlQuery.list(); - return true; - } catch (SQLGrammarException e) { - LOGGER.error("WARNING : GetFoosByName() Procedure is may be missing ", e); - return false; - } - } - - private boolean getAllFoosExists() { - try { - Query sqlQuery = session.createSQLQuery("CALL GetAllFoos()").addEntity(Foo.class); - sqlQuery.list(); - return true; - } catch (SQLGrammarException e) { - LOGGER.error("WARNING : GetAllFoos() Procedure is may be missing ", e); - return false; - } - } - - @After - public final void after() { - session.close(); - } - - @Test - public final void getAllFoosUsingStoredProcedures() { - - fooService.create(new Foo(randomAlphabetic(6))); - - // Stored procedure getAllFoos using createSQLQuery - Query sqlQuery = session.createSQLQuery("CALL GetAllFoos()").addEntity(Foo.class); - @SuppressWarnings("unchecked") - List allFoos = sqlQuery.list(); - for (Foo foo : allFoos) { - LOGGER.info("getAllFoos() SQL Query result : {}", foo.getName()); - } - assertEquals(allFoos.size(), fooService.findAll().size()); - - // Stored procedure getAllFoos using a Named Query - Query namedQuery = session.getNamedQuery("callGetAllFoos"); - @SuppressWarnings("unchecked") - List allFoos2 = namedQuery.list(); - for (Foo foo : allFoos2) { - LOGGER.info("getAllFoos() NamedQuery result : {}", foo.getName()); - } - assertEquals(allFoos2.size(), fooService.findAll().size()); - } - - @Test - public final void getFoosByNameUsingStoredProcedures() { - - fooService.create(new Foo("NewFooName")); - - // Stored procedure getFoosByName using createSQLQuery() - Query sqlQuery = session.createSQLQuery("CALL GetFoosByName(:fooName)").addEntity(Foo.class).setParameter("fooName", "NewFooName"); - @SuppressWarnings("unchecked") - List allFoosByName = sqlQuery.list(); - for (Foo foo : allFoosByName) { - LOGGER.info("getFoosByName() using SQL Query : found => {}", foo.toString()); - } - - // Stored procedure getFoosByName using getNamedQuery() - Query namedQuery = session.getNamedQuery("callGetFoosByName").setParameter("fooName", "NewFooName"); - @SuppressWarnings("unchecked") - List allFoosByName2 = namedQuery.list(); - for (Foo foo : allFoosByName2) { - LOGGER.info("getFoosByName() using Native Query : found => {}", foo.toString()); - } - - } -} +package com.baeldung.persistence.service; + +import java.util.List; + +import static org.apache.commons.lang3.RandomStringUtils.randomAlphabetic; +import static org.junit.Assert.assertEquals; + +import org.hibernate.Query; +import org.hibernate.Session; +import org.hibernate.SessionFactory; +import org.hibernate.exception.SQLGrammarException; +import org.junit.After; +import org.junit.Assume; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.support.AnnotationConfigContextLoader; + +import com.baeldung.persistence.model.Foo; +import com.baeldung.spring.PersistenceConfig; + +@RunWith(SpringJUnit4ClassRunner.class) +@ContextConfiguration(classes = { PersistenceConfig.class }, loader = AnnotationConfigContextLoader.class) +public class FooStoredProceduresLiveTest { + + private static final Logger LOGGER = LoggerFactory.getLogger(FooStoredProceduresLiveTest.class); + + @Autowired + private SessionFactory sessionFactory; + + @Autowired + private IFooService fooService; + + private Session session; + + @Before + public final void before() { + session = sessionFactory.openSession(); + Assume.assumeTrue(getAllFoosExists()); + Assume.assumeTrue(getFoosByNameExists()); + } + + private boolean getFoosByNameExists() { + try { + Query sqlQuery = session.createSQLQuery("CALL GetAllFoos()").addEntity(Foo.class); + sqlQuery.list(); + return true; + } catch (SQLGrammarException e) { + LOGGER.error("WARNING : GetFoosByName() Procedure is may be missing ", e); + return false; + } + } + + private boolean getAllFoosExists() { + try { + Query sqlQuery = session.createSQLQuery("CALL GetAllFoos()").addEntity(Foo.class); + sqlQuery.list(); + return true; + } catch (SQLGrammarException e) { + LOGGER.error("WARNING : GetAllFoos() Procedure is may be missing ", e); + return false; + } + } + + @After + public final void after() { + session.close(); + } + + @Test + public final void getAllFoosUsingStoredProcedures() { + + fooService.create(new Foo(randomAlphabetic(6))); + + // Stored procedure getAllFoos using createSQLQuery + Query sqlQuery = session.createSQLQuery("CALL GetAllFoos()").addEntity(Foo.class); + @SuppressWarnings("unchecked") + List allFoos = sqlQuery.list(); + for (Foo foo : allFoos) { + LOGGER.info("getAllFoos() SQL Query result : {}", foo.getName()); + } + assertEquals(allFoos.size(), fooService.findAll().size()); + + // Stored procedure getAllFoos using a Named Query + Query namedQuery = session.getNamedQuery("callGetAllFoos"); + @SuppressWarnings("unchecked") + List allFoos2 = namedQuery.list(); + for (Foo foo : allFoos2) { + LOGGER.info("getAllFoos() NamedQuery result : {}", foo.getName()); + } + assertEquals(allFoos2.size(), fooService.findAll().size()); + } + + @Test + public final void getFoosByNameUsingStoredProcedures() { + + fooService.create(new Foo("NewFooName")); + + // Stored procedure getFoosByName using createSQLQuery() + Query sqlQuery = session.createSQLQuery("CALL GetFoosByName(:fooName)").addEntity(Foo.class).setParameter("fooName", "NewFooName"); + @SuppressWarnings("unchecked") + List allFoosByName = sqlQuery.list(); + for (Foo foo : allFoosByName) { + LOGGER.info("getFoosByName() using SQL Query : found => {}", foo.toString()); + } + + // Stored procedure getFoosByName using getNamedQuery() + Query namedQuery = session.getNamedQuery("callGetFoosByName").setParameter("fooName", "NewFooName"); + @SuppressWarnings("unchecked") + List allFoosByName2 = namedQuery.list(); + for (Foo foo : allFoosByName2) { + LOGGER.info("getFoosByName() using Native Query : found => {}", foo.toString()); + } + + } +} diff --git a/spring-hibernate4/src/test/java/com/baeldung/persistence/service/ParentServicePersistenceIntegrationTest.java b/persistence-modules/spring-hibernate4/src/test/java/com/baeldung/persistence/service/ParentServicePersistenceIntegrationTest.java similarity index 100% rename from spring-hibernate4/src/test/java/com/baeldung/persistence/service/ParentServicePersistenceIntegrationTest.java rename to persistence-modules/spring-hibernate4/src/test/java/com/baeldung/persistence/service/ParentServicePersistenceIntegrationTest.java diff --git a/spring-hibernate4/src/test/java/com/baeldung/spring/config/PersistenceTestConfig.java b/persistence-modules/spring-hibernate4/src/test/java/com/baeldung/spring/config/PersistenceTestConfig.java similarity index 100% rename from spring-hibernate4/src/test/java/com/baeldung/spring/config/PersistenceTestConfig.java rename to persistence-modules/spring-hibernate4/src/test/java/com/baeldung/spring/config/PersistenceTestConfig.java diff --git a/spring-hibernate4/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/persistence-modules/spring-hibernate4/src/test/java/org/baeldung/SpringContextIntegrationTest.java similarity index 100% rename from spring-hibernate4/src/test/java/org/baeldung/SpringContextIntegrationTest.java rename to persistence-modules/spring-hibernate4/src/test/java/org/baeldung/SpringContextIntegrationTest.java diff --git a/spring-hibernate4/src/test/resources/.gitignore b/persistence-modules/spring-hibernate4/src/test/resources/.gitignore similarity index 100% rename from spring-hibernate4/src/test/resources/.gitignore rename to persistence-modules/spring-hibernate4/src/test/resources/.gitignore diff --git a/spring-hibernate4/src/test/resources/fetching.cfg.xml b/persistence-modules/spring-hibernate4/src/test/resources/fetching.cfg.xml similarity index 100% rename from spring-hibernate4/src/test/resources/fetching.cfg.xml rename to persistence-modules/spring-hibernate4/src/test/resources/fetching.cfg.xml diff --git a/spring-hibernate4/src/test/resources/fetchingLazy.cfg.xml b/persistence-modules/spring-hibernate4/src/test/resources/fetchingLazy.cfg.xml similarity index 100% rename from spring-hibernate4/src/test/resources/fetchingLazy.cfg.xml rename to persistence-modules/spring-hibernate4/src/test/resources/fetchingLazy.cfg.xml diff --git a/spring-hibernate4/src/test/resources/persistence-h2.properties b/persistence-modules/spring-hibernate4/src/test/resources/persistence-h2.properties similarity index 100% rename from spring-hibernate4/src/test/resources/persistence-h2.properties rename to persistence-modules/spring-hibernate4/src/test/resources/persistence-h2.properties diff --git a/persistence-modules/spring-jpa/README.md b/persistence-modules/spring-jpa/README.md index 299a5a1e51..e6f91ac016 100644 --- a/persistence-modules/spring-jpa/README.md +++ b/persistence-modules/spring-jpa/README.md @@ -19,6 +19,7 @@ - [Obtaining Auto-generated Keys in Spring JDBC](http://www.baeldung.com/spring-jdbc-autogenerated-keys) - [Transactions with Spring 4 and JPA](http://www.baeldung.com/transaction-configuration-with-jpa-and-spring) - [Use Criteria Queries in a Spring Data Application](https://www.baeldung.com/spring-data-criteria-queries) +- [Many-To-Many Relationship in JPA](https://www.baeldung.com/jpa-many-to-many) ### Eclipse Config After importing the project into Eclipse, you may see the following error: diff --git a/persistence-modules/spring-jpa/src/main/java/com/baeldung/manytomany/model/Course.java b/persistence-modules/spring-jpa/src/main/java/com/baeldung/manytomany/model/Course.java new file mode 100644 index 0000000000..bdfb8e890f --- /dev/null +++ b/persistence-modules/spring-jpa/src/main/java/com/baeldung/manytomany/model/Course.java @@ -0,0 +1,71 @@ +package com.baeldung.manytomany.model; + +import java.util.Set; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.ManyToMany; +import javax.persistence.OneToMany; +import javax.persistence.Table; + +@Entity +@Table(name = "course") +public class Course { + + @Id + @Column(name = "id") + private Long id; + + @ManyToMany(mappedBy = "likedCourses") + private Set likes; + + @OneToMany(mappedBy = "course") + private Set ratings; + + @OneToMany(mappedBy = "course") + private Set registrations; + + // additional properties + + public Course() { + } + + public Long getId() { + return id; + } + + public Set getRatings() { + return ratings; + } + + public Set getRegistrations() { + return registrations; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((id == null) ? 0 : id.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + Course other = (Course) obj; + if (id == null) { + if (other.id != null) + return false; + } else if (!id.equals(other.id)) + return false; + return true; + } + +} diff --git a/persistence-modules/spring-jpa/src/main/java/com/baeldung/manytomany/model/CourseRating.java b/persistence-modules/spring-jpa/src/main/java/com/baeldung/manytomany/model/CourseRating.java new file mode 100644 index 0000000000..4951f766bc --- /dev/null +++ b/persistence-modules/spring-jpa/src/main/java/com/baeldung/manytomany/model/CourseRating.java @@ -0,0 +1,79 @@ +package com.baeldung.manytomany.model; + +import javax.persistence.Column; +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.MapsId; +import javax.persistence.Table; + +@Entity +@Table(name = "course_rating") +public class CourseRating { + + @EmbeddedId + private CourseRatingKey id; + + @ManyToOne + @MapsId("student_id") + @JoinColumn(name = "student_id") + private Student student; + + @ManyToOne + @MapsId("course_id") + @JoinColumn(name = "course_id") + private Course course; + + @Column(name = "rating") + private int rating; + + public CourseRating() { + } + + public int getRating() { + return rating; + } + + public void setRating(int rating) { + this.rating = rating; + } + + public CourseRatingKey getId() { + return id; + } + + public Student getStudent() { + return student; + } + + public Course getCourse() { + return course; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((id == null) ? 0 : id.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + CourseRating other = (CourseRating) obj; + if (id == null) { + if (other.id != null) + return false; + } else if (!id.equals(other.id)) + return false; + return true; + } + +} diff --git a/persistence-modules/spring-jpa/src/main/java/com/baeldung/manytomany/model/CourseRatingKey.java b/persistence-modules/spring-jpa/src/main/java/com/baeldung/manytomany/model/CourseRatingKey.java new file mode 100644 index 0000000000..4e7430ed92 --- /dev/null +++ b/persistence-modules/spring-jpa/src/main/java/com/baeldung/manytomany/model/CourseRatingKey.java @@ -0,0 +1,59 @@ +package com.baeldung.manytomany.model; + +import java.io.Serializable; + +import javax.persistence.Column; +import javax.persistence.Embeddable; + +@Embeddable +public class CourseRatingKey implements Serializable { + + @Column(name = "student_id") + private Long studentId; + + @Column(name = "course_id") + private Long courseId; + + public CourseRatingKey() { + } + + public Long getStudentId() { + return studentId; + } + + public Long getCourseId() { + return courseId; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((courseId == null) ? 0 : courseId.hashCode()); + result = prime * result + ((studentId == null) ? 0 : studentId.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + CourseRatingKey other = (CourseRatingKey) obj; + if (courseId == null) { + if (other.courseId != null) + return false; + } else if (!courseId.equals(other.courseId)) + return false; + if (studentId == null) { + if (other.studentId != null) + return false; + } else if (!studentId.equals(other.studentId)) + return false; + return true; + } + +} diff --git a/persistence-modules/spring-jpa/src/main/java/com/baeldung/manytomany/model/CourseRegistration.java b/persistence-modules/spring-jpa/src/main/java/com/baeldung/manytomany/model/CourseRegistration.java new file mode 100644 index 0000000000..e1f30af883 --- /dev/null +++ b/persistence-modules/spring-jpa/src/main/java/com/baeldung/manytomany/model/CourseRegistration.java @@ -0,0 +1,100 @@ +package com.baeldung.manytomany.model; + +import java.time.LocalDateTime; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.Table; + +@Entity +@Table(name = "course_registration") +public class CourseRegistration { + + @Id + @Column(name = "id") + private Long id; + + @ManyToOne + @JoinColumn(name = "student_id") + private Student student; + + @ManyToOne + @JoinColumn(name = "course_id") + private Course course; + + @Column(name = "registered_at") + private LocalDateTime registeredAt; + + @Column(name = "grade") + private int grade; + + // additional properties + + public CourseRegistration() { + } + + public Student getStudent() { + return student; + } + + public void setStudent(Student student) { + this.student = student; + } + + public Course getCourse() { + return course; + } + + public void setCourse(Course course) { + this.course = course; + } + + public LocalDateTime getRegisteredAt() { + return registeredAt; + } + + public void setRegisteredAt(LocalDateTime registeredAt) { + this.registeredAt = registeredAt; + } + + public int getGrade() { + return grade; + } + + public void setGrade(int grade) { + this.grade = grade; + } + + public Long getId() { + return id; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((id == null) ? 0 : id.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + CourseRegistration other = (CourseRegistration) obj; + if (id == null) { + if (other.id != null) + return false; + } else if (!id.equals(other.id)) + return false; + return true; + } + +} diff --git a/persistence-modules/spring-jpa/src/main/java/com/baeldung/manytomany/model/Student.java b/persistence-modules/spring-jpa/src/main/java/com/baeldung/manytomany/model/Student.java new file mode 100644 index 0000000000..00561593a6 --- /dev/null +++ b/persistence-modules/spring-jpa/src/main/java/com/baeldung/manytomany/model/Student.java @@ -0,0 +1,78 @@ +package com.baeldung.manytomany.model; + +import java.util.Set; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.JoinTable; +import javax.persistence.ManyToMany; +import javax.persistence.OneToMany; +import javax.persistence.Table; + +@Entity +@Table(name = "student") +public class Student { + + @Id + @Column(name = "id") + private Long id; + + @ManyToMany + @JoinTable(name = "course_like", joinColumns = @JoinColumn(name = "student_id"), inverseJoinColumns = @JoinColumn(name = "course_id")) + private Set likedCourses; + + @OneToMany(mappedBy = "student") + private Set ratings; + + @OneToMany(mappedBy = "student") + private Set registrations; + + // additional properties + + public Student() { + } + + public Long getId() { + return id; + } + + public Set getLikedCourses() { + return likedCourses; + } + + public Set getRatings() { + return ratings; + } + + public Set getRegistrations() { + return registrations; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((id == null) ? 0 : id.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + Student other = (Student) obj; + if (id == null) { + if (other.id != null) + return false; + } else if (!id.equals(other.id)) + return false; + return true; + } + +} diff --git a/persistence-modules/spring-jpa/src/main/java/org/baeldung/config/PersistenceJNDIConfig.java b/persistence-modules/spring-jpa/src/main/java/org/baeldung/config/PersistenceJNDIConfig.java index 7f28c958f1..56ba68dcbb 100644 --- a/persistence-modules/spring-jpa/src/main/java/org/baeldung/config/PersistenceJNDIConfig.java +++ b/persistence-modules/spring-jpa/src/main/java/org/baeldung/config/PersistenceJNDIConfig.java @@ -23,23 +23,19 @@ import org.springframework.transaction.annotation.EnableTransactionManagement; @Configuration @EnableTransactionManagement -@PropertySource({ "classpath:persistence-jndi.properties" }) -@ComponentScan({ "org.baeldung.persistence" }) +@PropertySource("classpath:persistence-jndi.properties") +@ComponentScan("org.baeldung.persistence") @EnableJpaRepositories(basePackages = "org.baeldung.persistence.dao") public class PersistenceJNDIConfig { @Autowired private Environment env; - public PersistenceJNDIConfig() { - super(); - } - @Bean public LocalContainerEntityManagerFactoryBean entityManagerFactory() throws NamingException { final LocalContainerEntityManagerFactoryBean em = new LocalContainerEntityManagerFactoryBean(); em.setDataSource(dataSource()); - em.setPackagesToScan(new String[] { "org.baeldung.persistence.model" }); + em.setPackagesToScan("org.baeldung.persistence.model"); em.setJpaVendorAdapter(new HibernateJpaVendorAdapter()); em.setJpaProperties(additionalProperties()); return em; @@ -52,9 +48,7 @@ public class PersistenceJNDIConfig { @Bean public PlatformTransactionManager transactionManager(final EntityManagerFactory emf) { - final JpaTransactionManager transactionManager = new JpaTransactionManager(); - transactionManager.setEntityManagerFactory(emf); - return transactionManager; + return new JpaTransactionManager(emf); } @Bean diff --git a/persistence-modules/spring-jpa/src/main/java/org/baeldung/persistence/model/Foo.java b/persistence-modules/spring-jpa/src/main/java/org/baeldung/persistence/model/Foo.java index 209ab081de..5294860311 100644 --- a/persistence-modules/spring-jpa/src/main/java/org/baeldung/persistence/model/Foo.java +++ b/persistence-modules/spring-jpa/src/main/java/org/baeldung/persistence/model/Foo.java @@ -25,7 +25,7 @@ public class Foo implements Serializable { @Id @GeneratedValue(strategy = GenerationType.AUTO) @Column(name = "ID") - private long id; + private Long id; @Column(name = "NAME") private String name; @@ -41,11 +41,11 @@ public class Foo implements Serializable { this.bar = bar; } - public long getId() { + public Long getId() { return id; } - public void setId(final int id) { + public void setId(final Long id) { this.id = id; } diff --git a/persistence-modules/spring-jpa/src/test/java/com/baeldung/manytomany/ManyToManyIntegrationTest.java b/persistence-modules/spring-jpa/src/test/java/com/baeldung/manytomany/ManyToManyIntegrationTest.java new file mode 100644 index 0000000000..5e4334f5d4 --- /dev/null +++ b/persistence-modules/spring-jpa/src/test/java/com/baeldung/manytomany/ManyToManyIntegrationTest.java @@ -0,0 +1,24 @@ +package com.baeldung.manytomany; + +import javax.persistence.EntityManager; +import javax.persistence.PersistenceContext; + +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.SpringRunner; + +@RunWith(SpringRunner.class) +@ContextConfiguration(classes = ManyToManyTestConfiguration.class) +@DirtiesContext +public class ManyToManyIntegrationTest { + + @PersistenceContext + EntityManager entityManager; + + @Test + public void contextStarted() { + } + +} diff --git a/persistence-modules/spring-jpa/src/test/java/com/baeldung/manytomany/ManyToManyTestConfiguration.java b/persistence-modules/spring-jpa/src/test/java/com/baeldung/manytomany/ManyToManyTestConfiguration.java new file mode 100644 index 0000000000..f4635b563a --- /dev/null +++ b/persistence-modules/spring-jpa/src/test/java/com/baeldung/manytomany/ManyToManyTestConfiguration.java @@ -0,0 +1,51 @@ +package com.baeldung.manytomany; + +import java.util.HashMap; +import java.util.Map; + +import javax.sql.DataSource; + +import org.springframework.beans.factory.annotation.Value; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.PropertySource; +import org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseBuilder; +import org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseType; +import org.springframework.orm.jpa.JpaVendorAdapter; +import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean; +import org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter; + +@Configuration +@PropertySource("classpath:/manytomany/test.properties") +public class ManyToManyTestConfiguration { + + @Bean + public DataSource dataSource() { + EmbeddedDatabaseBuilder dbBuilder = new EmbeddedDatabaseBuilder(); + return dbBuilder.setType(EmbeddedDatabaseType.H2) + .addScript("classpath:/manytomany/db.sql") + .build(); + } + + @Bean + public LocalContainerEntityManagerFactoryBean entityManagerFactory(@Value("${hibernate.hbm2ddl.auto}") String hbm2ddlType, @Value("${hibernate.dialect}") String dialect, @Value("${hibernate.show_sql}") boolean showSql) { + LocalContainerEntityManagerFactoryBean result = new LocalContainerEntityManagerFactoryBean(); + + result.setDataSource(dataSource()); + result.setPackagesToScan("com.baeldung.manytomany.model"); + result.setJpaVendorAdapter(jpaVendorAdapter()); + + Map jpaProperties = new HashMap<>(); + jpaProperties.put("hibernate.hbm2ddl.auto", hbm2ddlType); + jpaProperties.put("hibernate.dialect", dialect); + jpaProperties.put("hibernate.show_sql", showSql); + result.setJpaPropertyMap(jpaProperties); + + return result; + } + + public JpaVendorAdapter jpaVendorAdapter() { + return new HibernateJpaVendorAdapter(); + } + +} diff --git a/persistence-modules/spring-jpa/src/test/resources/manytomany/db.sql b/persistence-modules/spring-jpa/src/test/resources/manytomany/db.sql new file mode 100644 index 0000000000..02905e41ee --- /dev/null +++ b/persistence-modules/spring-jpa/src/test/resources/manytomany/db.sql @@ -0,0 +1,44 @@ +CREATE TABLE course ( + id bigint(20) NOT NULL, + PRIMARY KEY (id) +); + + +CREATE TABLE student ( + id bigint(20) NOT NULL, + PRIMARY KEY (id) +); + + +CREATE TABLE course_like ( + student_id bigint(20) NOT NULL, + course_id bigint(20) NOT NULL, + PRIMARY KEY (student_id, course_id), + CONSTRAINT fk_course_like__student FOREIGN KEY (student_id) REFERENCES student (id), + CONSTRAINT fk_course_like__course FOREIGN KEY (course_id) REFERENCES course (id) +); + + + +CREATE TABLE course_rating ( + course_id bigint(20) NOT NULL, + student_id bigint(20) NOT NULL, + rating int(11) NOT NULL, + PRIMARY KEY (course_id, student_id), + CONSTRAINT fk_course_rating__student FOREIGN KEY (student_id) REFERENCES student (id), + CONSTRAINT fk_course_rating__course FOREIGN KEY (course_id) REFERENCES course (id) +); + + + +CREATE TABLE course_registration ( + id bigint(20) NOT NULL, + grade int(11), + registered_at datetime NOT NULL, + course_id bigint(20) NOT NULL, + student_id bigint(20) NOT NULL, + PRIMARY KEY (id), + CONSTRAINT fk_course_registration__student FOREIGN KEY (student_id) REFERENCES student (id), + CONSTRAINT fk_course_registration__course FOREIGN KEY (course_id) REFERENCES course (id) +); + diff --git a/persistence-modules/spring-jpa/src/test/resources/manytomany/test.properties b/persistence-modules/spring-jpa/src/test/resources/manytomany/test.properties new file mode 100644 index 0000000000..9e4236a6c2 --- /dev/null +++ b/persistence-modules/spring-jpa/src/test/resources/manytomany/test.properties @@ -0,0 +1,6 @@ +jdbc.driverClassName=org.h2.Driver +jdbc.url=jdbc:h2:mem:myDb;DB_CLOSE_DELAY=-1 + +hibernate.dialect=org.hibernate.dialect.H2Dialect +hibernate.show_sql=true +hibernate.hbm2ddl.auto=validate diff --git a/pom.xml b/pom.xml index beb10b3287..4e1e61961e 100644 --- a/pom.xml +++ b/pom.xml @@ -323,218 +323,242 @@ parent-boot-1 - parent-boot-2 - parent-spring-4 - parent-spring-5 - parent-java - parent-kotlin - asm - atomix - apache-cayenne - aws - aws-lambda - akka-streams - algorithms - annotations - apache-cxf - apache-fop - apache-geode - apache-poi - apache-tika - apache-thrift - apache-curator - apache-zookeeper - apache-opennlp - autovalue - axon - azure - bootique - cdi - java-strings - - core-java - core-java-collections - core-java-io - core-java-8 - java-streams - core-java-persistence - core-kotlin - kotlin-libraries - core-groovy - core-java-concurrency - core-java-concurrency-collections - couchbase - deltaspike - dozer - ethereum - ejb - ejb/ejb-client - feign - flips - testing-modules/gatling - geotools - testing-modules/groovy-spock - google-cloud - google-web-toolkit - gson - guava - guava-collections - guava-modules/guava-18 - guava-modules/guava-19 - guava-modules/guava-21 - guice - disruptor - spring-static-resources - hazelcast - hbase - hibernate5 - httpclient - hystrix - image-processing - immutables - influxdb - jackson - persistence-modules/java-cassandra - vavr - java-lite - java-numbers - java-rmi - java-vavr-stream - javax-servlets - javaxval - jaxb - javafx - jgroups - jee-7 - jee-7-security - jhipster - jjwt - jsf - json-path - json - jsoup - testing-modules/junit-5 - - libraries - libraries-data - libraries-security - libraries-server - linkrest - logging-modules/log-mdc - logging-modules/log4j - logging-modules/log4j2 - logging-modules/logback - lombok - mapstruct - metrics - maven - mesos-marathon - msf4j - testing-modules/mockito - testing-modules/mockito-2 - testing-modules/mocks - mustache - mvn-wrapper - noexception - orientdb - osgi - orika - patterns - pdf - protobuffer - persistence-modules/querydsl - reactor-core - persistence-modules/redis - testing-modules/rest-assured - testing-modules/rest-testing - resteasy - rxjava - rxjava-2 - spring-swagger-codegen - testing-modules/selenium-junit-testng - persistence-modules/solr - spark-java - spring-4 - spring-5 - spring-5-data-reactive - spring-5-reactive - spring-data-5-reactive/spring-5-data-reactive-redis - spring-5-reactive-security - spring-5-reactive-client - spring-5-mvc - spring-5-security - spring-activiti - spring-akka - spring-amqp - spring-all - spring-amqp-simple - spring-apache-camel - spring-batch - spring-bom - spring-boot - spring-boot-client - spring-boot-keycloak - spring-boot-bootstrap - spring-boot-admin - spring-boot-camel - spring-boot-ops - spring-boot-persistence - spring-boot-security - spring-boot-mvc - spring-boot-vue - spring-boot-logging-log4j2 - spring-cloud-data-flow - spring-cloud - spring-cloud-bus - spring-core - spring-cucumber - spring-ejb - spring-ejb/spring-ejb-client - spring-aop - persistence-modules/spring-data-cassandra - spring-data-couchbase-2 - persistence-modules/spring-data-dynamodb - spring-data-elasticsearch - spring-data-jpa - spring-data-keyvalue - spring-data-mongodb - persistence-modules/spring-data-neo4j - persistence-modules/spring-data-redis - spring-data-rest - persistence-modules/spring-data-solr - spring-dispatcher-servlet - spring-exceptions - spring-freemarker - persistence-modules/spring-hibernate-3 - spring-hibernate4 - persistence-modules/spring-hibernate-5 - persistence-modules/spring-data-eclipselink - spring-integration - spring-jenkins-pipeline - spring-jersey - jmeter - spring-jms - spring-jooq - persistence-modules/spring-jpa - spring-kafka - spring-katharsis - spring-ldap - spring-mockito - spring-mvc-forms-jsp - spring-mvc-forms-thymeleaf - spring-mvc-java - spring-mvc-velocity - spring-mvc-webflow - spring-mvc-xml - spring-mvc-kotlin - spring-protobuf - spring-quartz - spring-rest-angular - spring-rest-full - spring-rest-query-language - - - spring-resttemplate + parent-boot-2 + parent-boot-2.0-temp + parent-spring-4 + parent-spring-5 + parent-java + parent-kotlin + + akka-streams + algorithms-genetic + algorithms-miscellaneous-1 + algorithms-miscellaneous-2 + algorithms-sorting + animal-sniffer-mvn-plugin + annotations + antlr + apache-avro + apache-bval + apache-curator + apache-cxf + apache-fop + apache-geode + apache-meecrowave + apache-opennlp + apache-poi + apache-pulsar + apache-shiro + apache-solrj + apache-spark + apache-thrift + apache-tika + apache-velocity + apache-zookeeper + asciidoctor + asm + atomix + autovalue + aws + aws-lambda + axon + azure + + bootique + + cas/cas-secured-app + cas/cas-server + cdi + checker-plugin + core-groovy + + + core-java-8 + + core-java-arrays + core-java-collections + core-java-concurrency-collections + core-java-io + core-java-lang + core-java-networking + core-java-sun + core-scala + couchbase + custom-pmd + + dagger + data-structures + ddd + deeplearning4j + disruptor + dozer + drools + dubbo + + ethereum + + feign + flips + flyway-cdi-extension + + geotools + google-cloud + google-web-toolkit + + + graphql/graphql-java + grpc + gson + guava + guava-collections + guava-modules/guava-18 + guava-modules/guava-19 + guava-modules/guava-21 + + guice + + hazelcast + helidon + httpclient + hystrix + + image-processing + immutables + + jackson + java-collections-conversions + java-collections-maps + + java-ee-8-security-api + java-lite + java-numbers + java-rmi + java-spi + java-streams + java-strings + java-vavr-stream + java-websocket + javafx + javax-servlets + javaxval + jaxb + + jee-7-security + jersey + JGit + jgroups + jhipster + jib + jjwt + jmeter + jmh + jni + jooby + jsf + json + json-path + jsoup + jta + + + kotlin-libraries + + + libraries-data + libraries-security + libraries-server + linkrest + logging-modules/log4j + logging-modules/log4j2 + logging-modules/logback + logging-modules/log-mdc + lombok + lucene + + mapstruct + maven + maven-archetype + + maven-polyglot/maven-polyglot-json-extension + + mesos-marathon + metrics + + microprofile + msf4j + + mustache + mvn-wrapper + mybatis + + noexception + + optaplanner + orika + osgi + + patterns + pdf + performance-tests + + protobuffer + + persistence-modules/activejdbc + persistence-modules/apache-cayenne + persistence-modules/core-java-persistence + persistence-modules/deltaspike + persistence-modules/flyway + persistence-modules/hbase + persistence-modules/hibernate5 + persistence-modules/influxdb + persistence-modules/java-cassandra + persistence-modules/java-cockroachdb + persistence-modules/java-jdbi + persistence-modules/java-jpa + persistence-modules/java-mongodb + persistence-modules/jnosql + persistence-modules/liquibase + persistence-modules/orientdb + persistence-modules/querydsl + persistence-modules/redis + persistence-modules/solr + persistence-modules/spring-boot-h2/spring-boot-h2-database + persistence-modules/spring-boot-persistence + persistence-modules/spring-boot-persistence-mongodb + persistence-modules/spring-data-cassandra + persistence-modules/spring-data-cassandra-reactive + persistence-modules/spring-data-couchbase-2 + persistence-modules/spring-data-dynamodb + persistence-modules/spring-data-eclipselink + persistence-modules/spring-data-elasticsearch + persistence-modules/spring-data-gemfire + persistence-modules/spring-data-jpa + persistence-modules/spring-data-keyvalue + persistence-modules/spring-data-mongodb + persistence-modules/spring-data-neo4j + persistence-modules/spring-data-redis + persistence-modules/spring-data-solr + persistence-modules/spring-hibernate-3 + persistence-modules/spring-hibernate-5 + persistence-modules/spring-hibernate4 + persistence-modules/spring-jpa + + rabbitmq + + ratpack + reactor-core + rest-with-spark-java + resteasy + restx + + rule-engines/easy-rules + rule-engines/openl-tablets + rule-engines/rulebook + rsocket + rxjava + rxjava-2 + @@ -556,7 +580,7 @@ **/*IntTest.java **/*LongRunningUnitTest.java **/*ManualTest.java - **/JdbcTest.java + **/*JdbcTest.java **/*LiveTest.java @@ -568,145 +592,126 @@ parent-boot-1 parent-boot-2 + parent-boot-2.0-temp parent-spring-4 parent-spring-5 parent-java parent-kotlin - spring-session - spring-sleuth - spring-social-login - spring-spel - spring-state-machine - spring-thymeleaf - spring-userservice - spring-zuul - spring-remoting - spring-reactor - spring-vertx - spring-jinq - spring-rest-embedded-tomcat - testing-modules/testing - testing-modules/testng - video-tutorials - xml - xmlunit-2 - struts-2 - apache-velocity - apache-solrj - rabbitmq - vertx - persistence-modules/spring-data-gemfire - mybatis - spring-drools - drools - persistence-modules/liquibase - spring-boot-property-exp - testing-modules/mockserver - testing-modules/test-containers - undertow - vaadin - vertx-and-rxjava saas - deeplearning4j - lucene - vraptor - persistence-modules/java-cockroachdb - spring-security-thymeleaf - persistence-modules/java-jdbi - jersey - java-spi - performance-tests - twilio - spring-boot-ctx-fluent - java-ee-8-security-api - spring-webflux-amqp - antlr - maven-archetype - optaplanner - apache-meecrowave - spring-reactive-kotlin - jnosql + spark-java + + spring-4 + + spring-5 + spring-5-mvc + spring-5-reactive + spring-5-reactive-client + spring-5-reactive-oauth + spring-5-reactive-security + spring-5-security + spring-5-security-oauth + + spring-activiti + spring-akka + spring-all + spring-amqp + spring-aop + spring-apache-camel + spring-batch + spring-bom + + spring-boot + spring-boot-admin spring-boot-angular-ecommerce - cdi-portable-extension - jta - - java-websocket - activejdbc - animal-sniffer-mvn-plugin - apache-avro - apache-bval - apache-shiro - apache-spark - asciidoctor - checker-plugin - - - core-java-sun - custom-pmd - dagger - data-structures - dubbo - flyway - - - jni - jooby - - - - ratpack - rest-with-spark-java spring-boot-autoconfiguration + spring-boot-bootstrap + spring-boot-camel + + spring-boot-client + spring-boot-crud + spring-boot-ctx-fluent spring-boot-custom-starter + spring-boot-disable-console-logging + spring-boot-jasypt - spring-custom-aop + spring-boot-keycloak + spring-boot-logging-log4j2 + spring-boot-mvc + spring-boot-ops + spring-boot-property-exp + spring-boot-security + spring-boot-vue + + spring-cloud + spring-cloud-bus + + spring-cloud-data-flow + + spring-core + spring-cucumber + + spring-data-rest spring-data-rest-querydsl + spring-dispatcher-servlet + spring-drools + + spring-ejb + spring-exceptions + + spring-freemarker + spring-groovy + + spring-integration + + spring-jenkins-pipeline + spring-jersey + spring-jinq + spring-jms + spring-jooq + + spring-kafka + spring-katharsis + + spring-ldap + spring-mobile + spring-mockito spring-mustache + spring-mvc-forms-jsp + spring-mvc-forms-thymeleaf + spring-mvc-java + spring-mvc-kotlin spring-mvc-simple + spring-mvc-velocity + spring-mvc-webflow + spring-mvc-xml spring-mybatis + + spring-protobuf + + spring-quartz + + spring-reactive-kotlin + spring-reactor + spring-remoting + spring-rest + spring-rest-angular + spring-rest-embedded-tomcat + spring-rest-full spring-rest-hal-browser + spring-rest-query-language spring-rest-shell + spring-rest-simple spring-rest-template + spring-resttemplate spring-roo - spring-security-stormpath - sse-jaxrs - static-analysis - stripe - - Twitter4J - wicket - xstream - cas/cas-secured-app - cas/cas-server - - - - - - - - - - - - - - - - - spring-boot-custom-starter/greeter - spring-boot-h2/spring-boot-h2-database - - - - - flyway-cdi-extension spring-security-acl + spring-security-angular/server spring-security-cache-control + spring-security-client/spring-security-jsp-authentication spring-security-client/spring-security-jsp-authorize spring-security-client/spring-security-jsp-config @@ -714,6 +719,7 @@ spring-security-client/spring-security-thymeleaf-authentication spring-security-client/spring-security-thymeleaf-authorize spring-security-client/spring-security-thymeleaf-config + spring-security-core spring-security-mvc-boot spring-security-mvc-custom @@ -724,12 +730,75 @@ spring-security-mvc-session spring-security-mvc-socket spring-security-openid - + + spring-security-rest spring-security-rest-basic-auth spring-security-rest-custom - spring-security-rest spring-security-sso - spring-security-x509 + spring-security-stormpath + spring-security-thymeleaf + spring-security-x509 + spring-session + spring-sleuth + spring-social-login + spring-spel + spring-state-machine + spring-static-resources + spring-swagger-codegen + + spring-thymeleaf + + spring-userservice + + spring-vault + spring-vertx + + spring-webflux-amqp + + spring-zuul + + sse-jaxrs + static-analysis + stripe + structurizr + struts-2 + + testing-modules/gatling + testing-modules/groovy-spock + testing-modules/junit-5 + testing-modules/junit5-migration + testing-modules/load-testing-comparison + testing-modules/mockito + testing-modules/mockito-2 + testing-modules/mocks + testing-modules/mockserver + testing-modules/parallel-tests-junit + testing-modules/rest-assured + testing-modules/rest-testing + + testing-modules/selenium-junit-testng + testing-modules/spring-testing + testing-modules/test-containers + testing-modules/testing + testing-modules/testng + + twilio + Twitter4J + + undertow + + vavr + vertx + vertx-and-rxjava + video-tutorials + vraptor + + wicket + + xml + xmlunit-2 + xstream + @@ -762,6 +831,7 @@ spring-5-reactive-client spring-5-reactive-security spring-5-security + spring-5-security-oauth spring-activiti spring-akka spring-all @@ -778,7 +848,7 @@ spring-boot-custom-starter greeter-spring-boot-autoconfigure greeter-spring-boot-sample-app - spring-boot-h2/spring-boot-h2-database + persistence-modules/spring-boot-h2/spring-boot-h2-database spring-boot-jasypt spring-boot-keycloak spring-boot-mvc @@ -806,13 +876,13 @@ spring-cloud/spring-cloud-data-flow/time-processor spring-cloud/spring-cloud-data-flow/time-source spring-cucumber - spring-data-keyvalue + persistence-modules/spring-data-keyvalue spring-data-rest spring-dispatcher-servlet spring-drools spring-freemarker - spring-hibernate-3 - spring-hibernate4 + persistence-modules/spring-hibernate-3 + persistence-modules/spring-hibernate4 spring-integration spring-jenkins-pipeline spring-jersey @@ -877,7 +947,7 @@ spring-swagger-codegen/spring-swagger-codegen-app spring-thymeleaf spring-userservice - spring-vault + spring-vault spring-vertx spring-zuul/spring-zuul-foos-resource persistence-modules/spring-data-dynamodb @@ -888,663 +958,560 @@ - - integration - - - - org.apache.maven.plugins - maven-surefire-plugin - - - integration-test - - test - - - - **/*ManualTest.java - **/*LiveTest.java - - - **/*IntegrationTest.java - **/*IntTest.java - - - - - - - json - - - - - + + default-heavy + + - + + org.apache.maven.plugins + maven-surefire-plugin + ${maven-surefire-plugin.version} + + 3 + true + + **/*IntegrationTest.java + **/*IntTest.java + **/*LongRunningUnitTest.java + **/*ManualTest.java + **/*JdbcTest.java + **/*LiveTest.java + + + - parent-boot-1 - parent-boot-2 - parent-spring-4 - parent-spring-5 - parent-java - parent-kotlin - + + - + + parent-boot-1 + parent-boot-2 + parent-boot-2.0-temp + parent-spring-4 + parent-spring-5 + parent-java + parent-kotlin + + core-java + core-java-concurrency + core-kotlin - + jenkins/hello-world + jws - + libraries - - testing-modules/mockito - testing-modules/mockito-2 - testing-modules/mocks - mustache - mvn-wrapper - noexception - orientdb - osgi - orika - patterns - pdf - protobuffer - persistence-modules/querydsl - reactor-core - persistence-modules/redis - testing-modules/rest-assured - testing-modules/rest-testing - resteasy - rxjava - rxjava-2 - spring-swagger-codegen - testing-modules/selenium-junit-testng - persistence-modules/solr - spark-java - spring-4 - spring-5 - spring-5-data-reactive - spring-5-reactive - spring-5-reactive-security - spring-5-reactive-client - spring-5-mvc - spring-5-security - spring-activiti - spring-akka - spring-amqp - spring-all - spring-amqp-simple - spring-apache-camel - spring-batch - jmh + persistence-modules/hibernate5 + persistence-modules/java-jpa + persistence-modules/jnosql - + spring-5-data-reactive + spring-amqp-simple + + vaadin + + + + + integration-lite-first - + + + + org.apache.maven.plugins + maven-surefire-plugin + + + **/*ManualTest.java + **/*LiveTest.java + + + **/*IntegrationTest.java + **/*IntTest.java + + + + + - spring-bom - spring-boot - spring-boot-client - spring-boot-keycloak - spring-boot-bootstrap - spring-boot-admin - spring-boot-camel - spring-boot-ops - spring-boot-persistence - spring-boot-security - spring-boot-mvc - spring-boot-logging-log4j2 - spring-cloud-data-flow - spring-cloud - spring-cloud-bus - spring-core - spring-cucumber - spring-ejb - spring-ejb/spring-ejb-client - spring-aop - persistence-modules/spring-data-cassandra - spring-data-couchbase-2 - persistence-modules/spring-data-dynamodb - spring-data-elasticsearch - spring-data-keyvalue - spring-data-mongodb - spring-data-jpa - persistence-modules/spring-data-neo4j - persistence-modules/spring-data-redis - spring-data-rest + + parent-boot-1 + parent-boot-2 + parent-boot-2.0-temp + parent-spring-4 + parent-spring-5 + parent-java + parent-kotlin + + akka-streams + algorithms-genetic + algorithms-miscellaneous-1 + algorithms-miscellaneous-2 + algorithms-sorting + animal-sniffer-mvn-plugin + annotations + antlr + apache-avro + apache-bval + apache-curator + apache-cxf + apache-fop + apache-geode + apache-meecrowave + apache-opennlp + apache-poi + apache-pulsar + apache-shiro + apache-solrj + apache-spark + apache-thrift + apache-tika + apache-velocity + apache-zookeeper + asciidoctor + asm + atomix + autovalue + aws + aws-lambda + axon + azure - + bootique - - - - persistence-modules/spring-data-solr - spring-dispatcher-servlet - spring-exceptions - spring-freemarker - persistence-modules/spring-hibernate-3 - spring-hibernate4 - persistence-modules/spring-hibernate-5 - persistence-modules/spring-data-eclipselink - spring-integration - spring-jenkins-pipeline - spring-jersey - spring-jms - spring-jooq - persistence-modules/spring-jpa - spring-kafka - spring-katharsis - spring-ldap - spring-mockito - spring-mvc-forms-jsp - spring-mvc-forms-thymeleaf - spring-mvc-java - spring-mvc-velocity - spring-mvc-webflow - spring-mvc-xml - spring-mvc-kotlin - spring-protobuf - spring-quartz - spring-rest-angular - spring-rest-full - spring-rest-query-language - spring-rest - spring-resttemplate - spring-rest-simple - spring-reactive-kotlin - - - - - - - - - - - - - - - - java-websocket - activejdbc - animal-sniffer-mvn-plugin - apache-avro - apache-bval - apache-shiro - apache-spark - asciidoctor - checker-plugin - - - core-java-sun - custom-pmd - dagger - data-structures - dubbo - flyway - - - jni - jooby - - - - ratpack - rest-with-spark-java - spring-boot-autoconfiguration - spring-boot-custom-starter - spring-boot-jasypt - spring-custom-aop - spring-data-rest-querydsl - spring-groovy - spring-mobile - spring-mustache - spring-mvc-simple - spring-mybatis - spring-rest-hal-browser - spring-rest-shell - spring-rest-template - spring-roo - spring-security-stormpath - sse-jaxrs - static-analysis - stripe - - - wicket - xstream - cas/cas-secured-app - - - - - - - - - - - - - - jenkins/hello-world - - - - spring-boot-custom-starter/greeter - spring-boot-h2/spring-boot-h2-database - - - - - - - - - - integration-lite - - - - - org.apache.maven.plugins - maven-surefire-plugin - - - integration-test - - test - - - - **/*ManualTest.java - **/*LiveTest.java - - - **/*IntegrationTest.java - **/*IntTest.java - - - - - - - json - - - - - - - - parent-boot-1 - parent-boot-2 - parent-spring-4 - parent-spring-5 - parent-java - parent-kotlin - asm - atomix - apache-cayenne - aws - aws-lambda - akka-streams - algorithms - annotations - apache-cxf - apache-fop - apache-poi - apache-tika - apache-thrift - apache-curator - apache-zookeeper - apache-opennlp - autovalue - axon - azure - bootique - cdi - java-strings - - core-java-collections - core-java-io - core-java-8 - java-streams - core-groovy - - couchbase - deltaspike - dozer - ethereum - feign - flips - testing-modules/groovy-spock - google-cloud - gson - guava - guava-collections - guava-modules/guava-18 - guava-modules/guava-19 - guava-modules/guava-21 - guice - disruptor - spring-static-resources - hazelcast - hbase - - hystrix - image-processing - immutables - influxdb - jackson - vavr - java-lite - java-numbers - java-rmi - java-vavr-stream - javax-servlets - javaxval - jaxb - javafx - jgroups - jee-7 - jee-7-security - jjwt - jsf - json-path - json - jsoup - jta - testing-modules/junit-5 - testing-modules/junit5-migration - jws - libraries-data - linkrest - logging-modules/log-mdc - logging-modules/log4j - - logging-modules/logback - lombok - mapstruct - - maven - mesos-marathon - msf4j - testing-modules/mockito - testing-modules/mockito-2 - testing-modules/mocks - mustache - mvn-wrapper - noexception - orientdb - osgi - orika - patterns - pdf - protobuffer - persistence-modules/querydsl - reactor-core - persistence-modules/redis - testing-modules/rest-assured - testing-modules/rest-testing - resteasy - rxjava - rxjava-2 - spring-swagger-codegen - testing-modules/selenium-junit-testng - persistence-modules/solr - spark-java - spring-4 - spring-5-data-reactive - spring-5-reactive - spring-5-reactive-security - spring-5-reactive-client - spring-5-mvc - spring-5-security - spring-activiti - spring-akka - spring-amqp - spring-all - spring-amqp-simple - spring-apache-camel - spring-batch - spring-bom - spring-boot-keycloak - spring-boot-bootstrap - spring-boot-admin - spring-boot-camel - spring-boot-persistence - spring-boot-security - spring-boot-mvc - spring-boot-logging-log4j2 - spring-cloud-data-flow - spring-cloud - spring-cloud-bus - spring-core - spring-cucumber - spring-ejb - spring-ejb/spring-ejb-client - spring-aop - - persistence-modules/spring-data-dynamodb - spring-data-keyvalue - spring-data-mongodb - persistence-modules/spring-data-neo4j - - spring-data-rest - persistence-modules/spring-data-solr - spring-dispatcher-servlet - spring-exceptions - spring-freemarker - persistence-modules/spring-hibernate-3 - - persistence-modules/spring-hibernate-5 - persistence-modules/spring-data-eclipselink - spring-integration - spring-jenkins-pipeline - spring-jersey - - spring-jms - spring-jooq - persistence-modules/spring-jpa - spring-kafka - spring-katharsis - spring-ldap - spring-mockito - spring-mvc-forms-jsp - spring-mvc-forms-thymeleaf - spring-mvc-java - spring-mvc-velocity - spring-mvc-webflow - spring-mvc-xml - spring-mvc-kotlin - spring-protobuf - spring-quartz - spring-rest-angular - spring-rest-full - spring-rest-query-language - spring-rest - spring-resttemplate - spring-rest-simple - spring-security-acl - spring-security-cache-control - spring-security-client/spring-security-jsp-authentication - spring-security-client/spring-security-jsp-authorize - spring-security-client/spring-security-jsp-config - spring-security-client/spring-security-mvc - spring-security-client/spring-security-thymeleaf-authentication - spring-security-client/spring-security-thymeleaf-authorize - spring-security-client/spring-security-thymeleaf-config - spring-security-core - spring-security-mvc-boot - spring-security-mvc-digest-auth - spring-security-mvc-ldap - spring-security-mvc-login - spring-security-mvc-persisted-remember-me - spring-security-mvc-session - spring-security-mvc-socket - spring-security-openid - - spring-security-rest-basic-auth - spring-security-rest-custom - spring-security-rest - spring-security-sso - spring-security-x509 - spring-session - spring-sleuth - spring-social-login - spring-spel - spring-state-machine - spring-thymeleaf - spring-userservice - spring-zuul - spring-remoting - spring-reactor - spring-vertx - spring-vault - spring-jinq - spring-rest-embedded-tomcat - testing-modules/testing - testing-modules/testng - video-tutorials - - xmlunit-2 - struts-2 - apache-velocity - apache-solrj - rabbitmq - - persistence-modules/spring-data-gemfire - mybatis - spring-drools - drools - persistence-modules/liquibase - spring-boot-property-exp - testing-modules/mockserver - testing-modules/test-containers - undertow - vaadin - vertx-and-rxjava - saas - deeplearning4j - lucene - vraptor - persistence-modules/java-cockroachdb - spring-security-thymeleaf - persistence-modules/java-jdbi - jersey - java-spi - performance-tests - twilio - spring-boot-ctx-fluent - java-ee-8-security-api - spring-webflux-amqp - antlr - maven-archetype - apache-meecrowave - - spring-hibernate4 - xml - vertx - metrics + cas/cas-secured-app + cas/cas-server + cdi + checker-plugin + core-groovy + + + core-java-8 + + core-java-arrays + core-java-collections + core-java-concurrency-collections + core-java-io + core-java-lang + core-java-networking + core-java-sun + core-scala + couchbase + custom-pmd + + dagger + data-structures + ddd + deeplearning4j + disruptor + dozer + drools + dubbo + + ethereum + + feign + flips + flyway-cdi-extension + + geotools + google-cloud + google-web-toolkit + + + graphql/graphql-java + grpc + gson + guava + guava-collections + guava-modules/guava-18 + guava-modules/guava-19 + guava-modules/guava-21 + + guice + + hazelcast + helidon httpclient + hystrix + + image-processing + immutables - - + java-ee-8-security-api + java-lite + java-numbers + java-rmi + java-spi + java-streams + java-strings + java-vavr-stream + java-websocket + javafx + javax-servlets + javaxval + jaxb + + jee-7-security + jersey + JGit + jgroups + jhipster + jib + jjwt jmeter - --> + jmh + jni + jooby + jsf + json + json-path + jsoup + jta - - + kotlin-libraries + + + libraries-data + libraries-security + libraries-server + linkrest + logging-modules/log4j + logging-modules/log4j2 + logging-modules/logback + logging-modules/log-mdc + lombok + lucene + + mapstruct + maven + maven-archetype + + maven-polyglot/maven-polyglot-json-extension + + mesos-marathon + metrics + + microprofile + msf4j + + mustache + mvn-wrapper + mybatis + + noexception + + optaplanner + orika + osgi + + patterns + pdf + performance-tests + + protobuffer + + persistence-modules/activejdbc + persistence-modules/apache-cayenne + persistence-modules/core-java-persistence + persistence-modules/deltaspike + persistence-modules/flyway + persistence-modules/hbase + persistence-modules/hibernate5 + persistence-modules/influxdb + persistence-modules/java-cassandra + persistence-modules/java-cockroachdb + persistence-modules/java-jdbi + persistence-modules/java-jpa + persistence-modules/java-mongodb + persistence-modules/jnosql + persistence-modules/liquibase + persistence-modules/orientdb + persistence-modules/querydsl + persistence-modules/redis + persistence-modules/solr + persistence-modules/spring-boot-h2/spring-boot-h2-database + persistence-modules/spring-boot-persistence + persistence-modules/spring-boot-persistence-mongodb + persistence-modules/spring-data-cassandra + persistence-modules/spring-data-cassandra-reactive + persistence-modules/spring-data-couchbase-2 + persistence-modules/spring-data-dynamodb + persistence-modules/spring-data-eclipselink + persistence-modules/spring-data-elasticsearch + persistence-modules/spring-data-gemfire + persistence-modules/spring-data-jpa + persistence-modules/spring-data-keyvalue + persistence-modules/spring-data-mongodb + persistence-modules/spring-data-neo4j + persistence-modules/spring-data-redis + persistence-modules/spring-data-solr + persistence-modules/spring-hibernate-3 + persistence-modules/spring-hibernate-5 + persistence-modules/spring-hibernate4 + persistence-modules/spring-jpa + + rabbitmq + + ratpack + reactor-core + rest-with-spark-java + resteasy + restx + + rule-engines/easy-rules + rule-engines/openl-tablets + rule-engines/rulebook + rsocket + rxjava + rxjava-2 + + + + + + + integration-lite-second + + + + + org.apache.maven.plugins + maven-surefire-plugin + + + **/*ManualTest.java + **/*LiveTest.java + + + **/*IntegrationTest.java + **/*IntTest.java + + + + + + + + parent-boot-1 + parent-boot-2 + parent-boot-2.0-temp + parent-spring-4 + parent-spring-5 + parent-java + parent-kotlin + + saas + spark-java + + spring-4 + + spring-5 + spring-5-mvc + spring-5-reactive + spring-5-reactive-client + spring-5-reactive-oauth + spring-5-reactive-security + spring-5-security + spring-5-security-oauth + + spring-activiti + spring-akka + spring-all + spring-amqp + spring-aop + spring-apache-camel + spring-batch + spring-bom + + spring-boot + spring-boot-admin + spring-boot-angular-ecommerce + spring-boot-autoconfiguration + spring-boot-bootstrap + spring-boot-camel + + spring-boot-client + spring-boot-crud + spring-boot-ctx-fluent + spring-boot-custom-starter + spring-boot-disable-console-logging + + spring-boot-jasypt + spring-boot-keycloak + spring-boot-logging-log4j2 + spring-boot-mvc + spring-boot-ops + spring-boot-property-exp + spring-boot-security + spring-boot-vue + + spring-cloud + spring-cloud-bus + + spring-cloud-data-flow + + spring-core + spring-cucumber + + spring-data-rest + spring-data-rest-querydsl + spring-dispatcher-servlet + spring-drools + + spring-ejb + spring-exceptions + + spring-freemarker + + spring-groovy + + spring-integration + + spring-jenkins-pipeline + spring-jersey + spring-jinq + spring-jms + spring-jooq + + spring-kafka + spring-katharsis + + spring-ldap + + spring-mobile + spring-mockito + spring-mustache + spring-mvc-forms-jsp + spring-mvc-forms-thymeleaf + spring-mvc-java + spring-mvc-kotlin + spring-mvc-simple + spring-mvc-velocity + spring-mvc-webflow + spring-mvc-xml + spring-mybatis + + spring-protobuf + + spring-quartz + + spring-reactive-kotlin + spring-reactor + spring-remoting + spring-rest + spring-rest-angular + spring-rest-embedded-tomcat + spring-rest-full + spring-rest-hal-browser + spring-rest-query-language + spring-rest-shell + spring-rest-simple + spring-rest-template + spring-resttemplate + spring-roo + + spring-security-acl + spring-security-angular/server + spring-security-cache-control + + spring-security-client/spring-security-jsp-authentication + spring-security-client/spring-security-jsp-authorize + spring-security-client/spring-security-jsp-config + spring-security-client/spring-security-mvc + spring-security-client/spring-security-thymeleaf-authentication + spring-security-client/spring-security-thymeleaf-authorize + spring-security-client/spring-security-thymeleaf-config + + spring-security-core + spring-security-mvc-boot spring-security-mvc-custom - core-java-concurrency - --> + spring-security-mvc-digest-auth + spring-security-mvc-ldap + spring-security-mvc-login + spring-security-mvc-persisted-remember-me + spring-security-mvc-session + spring-security-mvc-socket + spring-security-openid + + spring-security-rest + spring-security-rest-basic-auth + spring-security-rest-custom + spring-security-sso + spring-security-stormpath + spring-security-thymeleaf + spring-security-x509 + spring-session + spring-sleuth + spring-social-login + spring-spel + spring-state-machine + spring-static-resources + spring-swagger-codegen + + spring-thymeleaf + + spring-userservice + + spring-vault + spring-vertx + + spring-webflux-amqp + + spring-zuul + + sse-jaxrs + static-analysis + stripe + structurizr + struts-2 + + testing-modules/gatling + testing-modules/groovy-spock + testing-modules/junit-5 + testing-modules/junit5-migration + testing-modules/load-testing-comparison + testing-modules/mockito + testing-modules/mockito-2 + testing-modules/mocks + testing-modules/mockserver + testing-modules/parallel-tests-junit + testing-modules/rest-assured + testing-modules/rest-testing + + testing-modules/selenium-junit-testng + testing-modules/spring-testing + testing-modules/test-containers + testing-modules/testing + testing-modules/testng + + twilio + Twitter4J + + undertow + + vavr + vertx + vertx-and-rxjava + video-tutorials + vraptor + + wicket + + xml + xmlunit-2 + xstream + + - - - - + integration-heavy @@ -1554,28 +1521,15 @@ org.apache.maven.plugins maven-surefire-plugin - - - integration-test - - test - - - - **/*ManualTest.java - **/*LiveTest.java - - - **/*IntegrationTest.java - **/*IntTest.java - - - - - - json - + + **/*ManualTest.java + **/*LiveTest.java + + + **/*IntegrationTest.java + **/*IntTest.java + @@ -1584,26 +1538,29 @@ parent-boot-1 parent-boot-2 + parent-boot-2.0-temp parent-spring-4 parent-spring-5 parent-java - parent-kotlin - libraries - geotools - jhipster - testing-modules/gatling - spring-boot - spring-boot-ops - spring-5 - core-kotlin - kotlin-libraries - core-java - google-web-toolkit - spring-security-mvc-custom - hibernate5 - spring-data-elasticsearch - core-java-concurrency - core-java-concurrency-collections + parent-kotlin + + core-java + core-java-concurrency + core-kotlin + + jenkins/hello-world + jws + + libraries + + persistence-modules/hibernate5 + persistence-modules/java-jpa + persistence-modules/jnosql + + spring-5-data-reactive + spring-amqp-simple + + vaadin @@ -1628,13 +1585,16 @@ true false false - + false + 4.12 1.3 2.21.0 + 1.7.21 1.1.7 + 2.21.0 3.7.0 diff --git a/protobuffer/pom.xml b/protobuffer/pom.xml index ff443a1615..d9e6cb26e4 100644 --- a/protobuffer/pom.xml +++ b/protobuffer/pom.xml @@ -3,7 +3,8 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 protobuffer - + protobuffer + parent-modules com.baeldung diff --git a/reactor-core/pom.xml b/reactor-core/pom.xml index cf720ad6ea..db9550df7b 100644 --- a/reactor-core/pom.xml +++ b/reactor-core/pom.xml @@ -1,11 +1,11 @@ 4.0.0 - org.baeldung reactor-core 0.0.1-SNAPSHOT - + reactor-core + com.baeldung parent-modules diff --git a/reactor-core/src/main/java/com/baeldung/reactor/ItemProducerCreate.java b/reactor-core/src/main/java/com/baeldung/reactor/ItemProducerCreate.java new file mode 100644 index 0000000000..e475303a3d --- /dev/null +++ b/reactor-core/src/main/java/com/baeldung/reactor/ItemProducerCreate.java @@ -0,0 +1,22 @@ +package com.baeldung.reactor; + +import reactor.core.publisher.Flux; + +import java.util.List; +import java.util.function.Consumer; + +public class ItemProducerCreate { + + Consumer> listener; + + public Flux create() { + Flux articlesFlux = Flux.create((sink) -> { + ItemProducerCreate.this.listener = (items) -> { + items.stream() + .forEach(article -> sink.next(article)); + }; + }); + return articlesFlux; + } + +} diff --git a/reactor-core/src/main/java/com/baeldung/reactor/NetworkTrafficProducerPush.java b/reactor-core/src/main/java/com/baeldung/reactor/NetworkTrafficProducerPush.java new file mode 100644 index 0000000000..a81d41ac11 --- /dev/null +++ b/reactor-core/src/main/java/com/baeldung/reactor/NetworkTrafficProducerPush.java @@ -0,0 +1,23 @@ +package com.baeldung.reactor; + +import java.util.function.Consumer; + +import reactor.core.publisher.Flux; +import reactor.core.publisher.FluxSink.OverflowStrategy; + +public class NetworkTrafficProducerPush { + + Consumer listener; + + public void subscribe(Consumer consumer) { + Flux flux = Flux.push(sink -> { + NetworkTrafficProducerPush.this.listener = (t) -> sink.next(t); + }, OverflowStrategy.DROP); + flux.subscribe(consumer); + } + + public void onPacket(String packet) { + listener.accept(packet); + } + +} diff --git a/reactor-core/src/main/java/com/baeldung/reactor/ProgrammaticSequences.java b/reactor-core/src/main/java/com/baeldung/reactor/ProgrammaticSequences.java new file mode 100644 index 0000000000..5c11240753 --- /dev/null +++ b/reactor-core/src/main/java/com/baeldung/reactor/ProgrammaticSequences.java @@ -0,0 +1,38 @@ +package com.baeldung.reactor; + +import java.util.concurrent.atomic.AtomicInteger; + +import reactor.core.publisher.Flux; + +public class ProgrammaticSequences { + + public Flux statefulImutableGenerate() { + return Flux.generate(() -> 1, (state, sink) -> { + sink.next("2 + " + state + " = " + (2 + state)); + if (state == 101) + sink.complete(); + return state + 1; + }); + } + + public Flux statefulMutableGenerate() { + return Flux.generate(AtomicInteger::new, (state, sink) -> { + int i = state.getAndIncrement(); + sink.next("2 + " + i + " = " + (2 + i)); + if (i == 101) + sink.complete(); + return state; + }); + } + + public Flux handle() { + return Flux.just(1, 2, 3, 4, 5, 6, 7, 8, 9, 10) + .handle((i, sink) -> { + String animal = "Elephant nr " + i; + if (i % 2 == 0) { + sink.next(animal); + } + }); + } + +} diff --git a/reactor-core/src/main/java/com/baeldung/reactor/StatelessGenerate.java b/reactor-core/src/main/java/com/baeldung/reactor/StatelessGenerate.java new file mode 100644 index 0000000000..3b9f0bb522 --- /dev/null +++ b/reactor-core/src/main/java/com/baeldung/reactor/StatelessGenerate.java @@ -0,0 +1,12 @@ +package com.baeldung.reactor; + +import reactor.core.publisher.Flux; + +public class StatelessGenerate { + + public Flux statelessGenerate() { + return Flux.generate((sink) -> { + sink.next("hello"); + }); + } +} diff --git a/reactor-core/src/test/java/com/baeldung/reactor/ItemProducerCreateUnitTest.java b/reactor-core/src/test/java/com/baeldung/reactor/ItemProducerCreateUnitTest.java new file mode 100644 index 0000000000..8c436306d1 --- /dev/null +++ b/reactor-core/src/test/java/com/baeldung/reactor/ItemProducerCreateUnitTest.java @@ -0,0 +1,33 @@ +package com.baeldung.reactor; + +import org.junit.Test; + +import java.util.ArrayList; +import java.util.List; + +import static org.assertj.core.api.Assertions.assertThat; + +public class ItemProducerCreateUnitTest { + + @Test + public void givenFluxWithAsynchronousCreate_whenProduceItemsFromDifferentThread_thenAllItemsAreCollectedByTheSubscriber() throws InterruptedException { + List elements = new ArrayList<>(); + ItemProducerCreate producer = new ItemProducerCreate(); + producer.create() + .subscribe(elements::add); + + Thread producerThread = new Thread(() -> { + List items = new ArrayList<>(); + items.add("Item 1"); + items.add("Item 2"); + items.add("Item 3"); + producer.listener.accept(items); + }); + + producerThread.start(); + producerThread.join(); + + assertThat(elements).containsExactly("Item 1", "Item 2", "Item 3"); + } + +} diff --git a/reactor-core/src/test/java/com/baeldung/reactor/NetworkTrafficProducerPushUnitTest.java b/reactor-core/src/test/java/com/baeldung/reactor/NetworkTrafficProducerPushUnitTest.java new file mode 100644 index 0000000000..168ab1f297 --- /dev/null +++ b/reactor-core/src/test/java/com/baeldung/reactor/NetworkTrafficProducerPushUnitTest.java @@ -0,0 +1,23 @@ +package com.baeldung.reactor; + +import org.junit.Test; + +import java.util.ArrayList; +import java.util.List; + +import static org.assertj.core.api.Assertions.assertThat; + +public class NetworkTrafficProducerPushUnitTest { + + @Test + public void givenFluxWithAsynchronousPushWithListener_whenListenerIsInvoked_thenItemCollectedByTheSubscriber() throws InterruptedException { + List elements = new ArrayList<>(); + + NetworkTrafficProducerPush trafficProducer = new NetworkTrafficProducerPush(); + trafficProducer.subscribe(elements::add); + trafficProducer.onPacket("Packet[A18]"); + + assertThat(elements).containsExactly("Packet[A18]"); + } + +} diff --git a/reactor-core/src/test/java/com/baeldung/reactor/ProgrammaticSequencesUnitTest.java b/reactor-core/src/test/java/com/baeldung/reactor/ProgrammaticSequencesUnitTest.java new file mode 100644 index 0000000000..996ca9e20c --- /dev/null +++ b/reactor-core/src/test/java/com/baeldung/reactor/ProgrammaticSequencesUnitTest.java @@ -0,0 +1,42 @@ +package com.baeldung.reactor; + +import org.junit.Test; + +import java.util.ArrayList; +import java.util.List; + +import static org.assertj.core.api.Assertions.assertThat; + +public class ProgrammaticSequencesUnitTest { + + @Test + public void givenFluxWithStatefulImmutableGenerate_whenSubscribeAddItemsToCollect_thenAllItemsAreCollectedByTheSubscriber() throws InterruptedException { + List elements = new ArrayList<>(); + ProgrammaticSequences producer = new ProgrammaticSequences(); + producer.statefulImutableGenerate() + .subscribe(elements::add); + assertThat(elements).hasSize(101); + assertThat(elements).contains("2 + 1 = 3", "2 + 101 = 103"); + } + + @Test + public void givenFluxWithStatefulMutableGenerate_whenSubscribeAddItemsToCollect_thenAllItemsAreCollectedByTheSubscriber() throws InterruptedException { + List elements = new ArrayList<>(); + ProgrammaticSequences producer = new ProgrammaticSequences(); + producer.statefulMutableGenerate() + .subscribe(elements::add); + assertThat(elements).hasSize(102); + assertThat(elements).contains("2 + 0 = 2", "2 + 101 = 103"); + } + + @Test + public void givenFluxWithHandle_whenSubscribeAddItemsToCollect_thenAllItemsAreCollectedByTheSubscriber() throws InterruptedException { + List elements = new ArrayList<>(); + ProgrammaticSequences producer = new ProgrammaticSequences(); + producer.handle() + .subscribe(elements::add); + assertThat(elements).hasSize(5); + assertThat(elements).contains("Elephant nr 2", "Elephant nr 10"); + } + +} diff --git a/restx/README.md b/restx/README.md new file mode 100644 index 0000000000..665f7ea82d --- /dev/null +++ b/restx/README.md @@ -0,0 +1,4 @@ +# Relevant Articles + +* [Introduction to RESTX](https://www.baeldung.com/java-restx) + diff --git a/restx/data/credentials.json b/restx/data/credentials.json new file mode 100644 index 0000000000..c1a4fcf531 --- /dev/null +++ b/restx/data/credentials.json @@ -0,0 +1,12 @@ +{ + "//": "lines with // keys are just comments (we don't have real comments in json)", + "//": "this file stores password passed through md5+bcrypt hash", + "//": "you can use `restx hash md5+bcrypt {password}` shell command to get hashed passwords to put here", + + "//": "to help startup with restx, there are comments with clear text passwords,", + "//": "which should obviously not be stored here.", + "user1": "$2a$10$iZluFUJShbjb1ue68bLrDuGCeJL9EMLHelVIf8u0SUbCseDOvKnoe", + "//": "user 1 password is 'user1-pwd'", + "user2": "$2a$10$oym3SYMFXf/9gGfDKKHO4eM1vWNqAZMsRZCL.BORCaP4yp5cdiCXu", + "//": "user 2 password is 'user2-pwd'" +} \ No newline at end of file diff --git a/restx/data/users.json b/restx/data/users.json new file mode 100644 index 0000000000..834e03c4b4 --- /dev/null +++ b/restx/data/users.json @@ -0,0 +1,4 @@ +[ + {"name":"user1", "roles": ["hello"]}, + {"name":"user2", "roles": []} +] \ No newline at end of file diff --git a/restx/md.restx.json b/restx/md.restx.json new file mode 100644 index 0000000000..c87244001c --- /dev/null +++ b/restx/md.restx.json @@ -0,0 +1,38 @@ +{ + "module": "restx-demo:restx-demo:0.1-SNAPSHOT", + "packaging": "war", + + "properties": { + "java.version": "1.8", + "restx.version": "0.35-rc4" + }, + "fragments": { + "maven": [ + "classpath:///restx/build/fragments/maven/javadoc-apidoclet.xml" ] + }, + "dependencies": { + "compile": [ + "io.restx:restx-core:${restx.version}", + "io.restx:restx-security-basic:${restx.version}", + "io.restx:restx-core-annotation-processor:${restx.version}", + "io.restx:restx-factory:${restx.version}", + "io.restx:restx-factory-admin:${restx.version}", + "io.restx:restx-validation:${restx.version}", + "io.restx:restx-monitor-codahale:${restx.version}", + "io.restx:restx-monitor-admin:${restx.version}", + "io.restx:restx-log-admin:${restx.version}", + "io.restx:restx-i18n-admin:${restx.version}", + "io.restx:restx-stats-admin:${restx.version}", + "io.restx:restx-servlet:${restx.version}", + "io.restx:restx-server-jetty8:${restx.version}!optional", + "io.restx:restx-apidocs:${restx.version}", + "io.restx:restx-specs-admin:${restx.version}", + "io.restx:restx-admin:${restx.version}", + "ch.qos.logback:logback-classic:1.0.13" + ], + "test": [ + "io.restx:restx-specs-tests:${restx.version}", + "junit:junit:4.11" + ] + } +} diff --git a/restx/pom.xml b/restx/pom.xml new file mode 100644 index 0000000000..c6233b968c --- /dev/null +++ b/restx/pom.xml @@ -0,0 +1,155 @@ + + + 4.0.0 + + restx + 0.1-SNAPSHOT + war + restx-demo + + + 1.8 + 1.8 + 0.35-rc4 + + + + com.baeldung + parent-modules + 1.0.0-SNAPSHOT + + + + + io.restx + restx-core + ${restx.version} + + + io.restx + restx-security-basic + ${restx.version} + + + io.restx + restx-core-annotation-processor + ${restx.version} + + + io.restx + restx-factory + ${restx.version} + + + io.restx + restx-factory-admin + ${restx.version} + + + io.restx + restx-validation + ${restx.version} + + + io.restx + restx-monitor-codahale + ${restx.version} + + + io.restx + restx-monitor-admin + ${restx.version} + + + io.restx + restx-log-admin + ${restx.version} + + + io.restx + restx-i18n-admin + ${restx.version} + + + io.restx + restx-stats-admin + ${restx.version} + + + io.restx + restx-servlet + ${restx.version} + + + io.restx + restx-server-jetty8 + ${restx.version} + true + + + io.restx + restx-apidocs + ${restx.version} + + + io.restx + restx-specs-admin + ${restx.version} + + + io.restx + restx-admin + ${restx.version} + + + ch.qos.logback + logback-classic + 1.0.13 + + + io.restx + restx-specs-tests + ${restx.version} + test + + + junit + junit + 4.11 + test + + + + + + org.apache.maven.plugins + maven-javadoc-plugin + + + attach-docs + + prepare-package + + jar + + + + + ${maven.compiler.source} + restx.apidocs.doclet.ApidocsDoclet + + io.restx + restx-apidocs-doclet + ${restx.version} + + -restx-target-dir ${project.basedir}/target/classes + + + + + diff --git a/restx/src/main/java/restx/demo/AppModule.java b/restx/src/main/java/restx/demo/AppModule.java new file mode 100644 index 0000000000..26bc681481 --- /dev/null +++ b/restx/src/main/java/restx/demo/AppModule.java @@ -0,0 +1,74 @@ +package restx.demo; + +import restx.config.ConfigLoader; +import restx.config.ConfigSupplier; +import restx.factory.Provides; + +import com.fasterxml.jackson.databind.ObjectMapper; +import com.google.common.base.Charsets; +import com.google.common.collect.ImmutableSet; +import restx.security.*; +import restx.factory.Module; +import restx.factory.Provides; +import javax.inject.Named; + +import java.nio.file.Paths; + +@Module +public class AppModule { + @Provides + public SignatureKey signatureKey() { + return new SignatureKey("restx-demo -447494532235718370 restx-demo 801c9eaf-4116-48f2-906b-e979fba72757".getBytes(Charsets.UTF_8)); + } + + @Provides + @Named("restx.admin.password") + public String restxAdminPassword() { + return "4780"; + } + + @Provides + public ConfigSupplier appConfigSupplier(ConfigLoader configLoader) { + // Load settings.properties in restx.demo package as a set of config entries + return configLoader.fromResource("restx/demo/settings"); + } + + @Provides + public CredentialsStrategy credentialsStrategy() { + return new BCryptCredentialsStrategy(); + } + + @Provides + public BasicPrincipalAuthenticator basicPrincipalAuthenticator( + SecuritySettings securitySettings, CredentialsStrategy credentialsStrategy, + @Named("restx.admin.passwordHash") String defaultAdminPasswordHash, ObjectMapper mapper) { + return new StdBasicPrincipalAuthenticator(new StdUserService<>( + // use file based users repository. + // Developer's note: prefer another storage mechanism for your users if you need real user management + // and better perf + new FileBasedUserRepository<>( + StdUser.class, // this is the class for the User objects, that you can get in your app code + // with RestxSession.current().getPrincipal().get() + // it can be a custom user class, it just need to be json deserializable + mapper, + + // this is the default restx admin, useful to access the restx admin console. + // if one user with restx-admin role is defined in the repository, this default user won't be + // available anymore + new StdUser("admin", ImmutableSet.of("*")), + + // the path where users are stored + Paths.get("data/users.json"), + + // the path where credentials are stored. isolating both is a good practice in terms of security + // it is strongly recommended to follow this approach even if you use your own repository + Paths.get("data/credentials.json"), + + // tells that we want to reload the files dynamically if they are touched. + // this has a performance impact, if you know your users / credentials never change without a + // restart you can disable this to get better perfs + true), + credentialsStrategy, defaultAdminPasswordHash), + securitySettings); + } +} diff --git a/restx/src/main/java/restx/demo/AppServer.java b/restx/src/main/java/restx/demo/AppServer.java new file mode 100644 index 0000000000..d66aadac68 --- /dev/null +++ b/restx/src/main/java/restx/demo/AppServer.java @@ -0,0 +1,32 @@ +package restx.demo; + +import com.google.common.base.Optional; +import restx.server.WebServer; +import restx.server.Jetty8WebServer; + +/** + * This class can be used to run the app. + * + * Alternatively, you can deploy the app as a war in a regular container like tomcat or jetty. + * + * Reading the port from system env PORT makes it compatible with heroku. + */ +public class AppServer { + public static final String WEB_INF_LOCATION = "src/main/webapp/WEB-INF/web.xml"; + public static final String WEB_APP_LOCATION = "src/main/webapp"; + + public static void main(String[] args) throws Exception { + int port = Integer.valueOf(Optional.fromNullable(System.getenv("PORT")).or("8080")); + WebServer server = new Jetty8WebServer(WEB_INF_LOCATION, WEB_APP_LOCATION, port, "0.0.0.0"); + + /* + * load mode from system property if defined, or default to dev + * be careful with that setting, if you use this class to launch your server in production, make sure to launch + * it with -Drestx.mode=prod or change the default here + */ + System.setProperty("restx.mode", System.getProperty("restx.mode", "dev")); + System.setProperty("restx.app.package", "restx.demo"); + + server.startAndAwait(); + } +} diff --git a/restx/src/main/java/restx/demo/Roles.java b/restx/src/main/java/restx/demo/Roles.java new file mode 100644 index 0000000000..1240da70d1 --- /dev/null +++ b/restx/src/main/java/restx/demo/Roles.java @@ -0,0 +1,10 @@ +package restx.demo; + +/** + * A list of roles for the application. + * + * We don't use an enum here because it must be used inside an annotation. + */ +public final class Roles { + public static final String HELLO_ROLE = "hello"; +} diff --git a/restx/src/main/java/restx/demo/domain/Message.java b/restx/src/main/java/restx/demo/domain/Message.java new file mode 100644 index 0000000000..733c00deff --- /dev/null +++ b/restx/src/main/java/restx/demo/domain/Message.java @@ -0,0 +1,21 @@ +package restx.demo.domain; + +public class Message { + private String message; + + public String getMessage() { + return message; + } + + public Message setMessage(final String message) { + this.message = message; + return this; + } + + @Override + public String toString() { + return "Message{" + + "message='" + message + '\'' + + '}'; + } +} diff --git a/restx/src/main/java/restx/demo/rest/HelloResource.java b/restx/src/main/java/restx/demo/rest/HelloResource.java new file mode 100644 index 0000000000..5cb2c2a5e6 --- /dev/null +++ b/restx/src/main/java/restx/demo/rest/HelloResource.java @@ -0,0 +1,62 @@ +package restx.demo.rest; + +import restx.demo.domain.Message; +import restx.demo.Roles; +import org.joda.time.DateTime; +import restx.annotations.GET; +import restx.annotations.POST; +import restx.annotations.RestxResource; +import restx.factory.Component; +import restx.security.PermitAll; +import restx.security.RolesAllowed; +import restx.security.RestxSession; + +import javax.validation.constraints.NotNull; + +@Component @RestxResource +public class HelloResource { + + /** + * Say hello to currently logged in user. + * + * Authorized only for principals with Roles.HELLO_ROLE role. + * + * @return a Message to say hello + */ + @GET("/message") + @RolesAllowed(Roles.HELLO_ROLE) + public Message sayHello() { + return new Message().setMessage(String.format( + "hello %s, it's %s", + RestxSession.current().getPrincipal().get().getName(), + DateTime.now().toString("HH:mm:ss"))); + } + + /** + * Say hello to anybody. + * + * Does not require authentication. + * + * @return a Message to say hello + */ + @GET("/hello") + @PermitAll + public Message helloPublic(String who) { + return new Message().setMessage(String.format( + "hello %s, it's %s", + who, DateTime.now().toString("HH:mm:ss"))); + } + + public static class MyPOJO { + @NotNull + String value; + public String getValue(){ return value; } + public void setValue(String value){ this.value = value; } + } + @POST("/mypojo") + @PermitAll + public MyPOJO helloPojo(MyPOJO pojo){ + pojo.setValue("hello "+pojo.getValue()); + return pojo; + } +} diff --git a/restx/src/main/resources/logback.xml b/restx/src/main/resources/logback.xml new file mode 100644 index 0000000000..524bca6b1f --- /dev/null +++ b/restx/src/main/resources/logback.xml @@ -0,0 +1,94 @@ + + + true + + + + + ${LOGS_FOLDER}/errors.log + + ERROR + + + %d [%-16thread] [%-10X{principal}] %-5level %logger{36} - %msg%n + + + ${LOGS_FOLDER}/errors.%d.log + 30 + + + + + + + + ${LOGS_FOLDER}/app.log + + INFO + + + %d [%-16thread] [%-10X{principal}] %-5level %logger{36} - %msg%n + + + ${LOGS_FOLDER}/app.%d.log + 10 + + + + ${LOGS_FOLDER}/debug.log + + %d [%-16thread] [%-10X{principal}] %-5level %logger{36} - %msg%n + + + ${LOGS_FOLDER}/debug.%i.log.zip + 1 + 3 + + + + 50MB + + + + + + + + + + + + %d [%-16thread] [%-10X{principal}] %-5level %logger{36} - %msg%n + + + + ${LOGS_FOLDER}/app.log + + %d [%-16thread] [%-10X{principal}] %-5level %logger{36} - %msg%n + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/restx/src/main/resources/restx/demo/settings.properties b/restx/src/main/resources/restx/demo/settings.properties new file mode 100644 index 0000000000..a03c2eea97 --- /dev/null +++ b/restx/src/main/resources/restx/demo/settings.properties @@ -0,0 +1 @@ +app.name=restx-demo \ No newline at end of file diff --git a/restx/src/main/webapp/WEB-INF/web.xml b/restx/src/main/webapp/WEB-INF/web.xml new file mode 100644 index 0000000000..c651794526 --- /dev/null +++ b/restx/src/main/webapp/WEB-INF/web.xml @@ -0,0 +1,15 @@ + + + + restx + restx.servlet.RestxMainRouterServlet + 1 + + + restx + /api/* + + diff --git a/restx/src/test/java/restx/demo/rest/HelloResourceSpecUnitTest.java b/restx/src/test/java/restx/demo/rest/HelloResourceSpecUnitTest.java new file mode 100644 index 0000000000..f67e4565b3 --- /dev/null +++ b/restx/src/test/java/restx/demo/rest/HelloResourceSpecUnitTest.java @@ -0,0 +1,23 @@ +package restx.demo.rest; + +import org.junit.runner.RunWith; + +import restx.tests.FindSpecsIn; +import restx.tests.RestxSpecTestsRunner; + +@RunWith(RestxSpecTestsRunner.class) +@FindSpecsIn("specs/hello") +public class HelloResourceSpecUnitTest { + + /** + * Useless, thanks to both @RunWith(RestxSpecTestsRunner.class) & @FindSpecsIn() + * + * @Rule + * public RestxSpecRule rule = new RestxSpecRule(); + * + * @Test + * public void test_spec() throws Exception { + * rule.runTest(specTestPath); + * } + */ +} diff --git a/restx/src/test/resources/specs/hello/should_admin_say_hello.spec.yaml b/restx/src/test/resources/specs/hello/should_admin_say_hello.spec.yaml new file mode 100644 index 0000000000..1b7b8f0f90 --- /dev/null +++ b/restx/src/test/resources/specs/hello/should_admin_say_hello.spec.yaml @@ -0,0 +1,10 @@ +title: should admin say hello +given: + - time: 2013-08-28T01:18:00.822+02:00 + - uuids: [ "e2b4430f-9541-4602-9a3a-413d17c56a6b" ] +wts: + - when: | + GET message + $RestxSession: {"_expires":"2013-09-27T01:18:00.822+02:00","principal":"admin","sessionKey":"e2b4430f-9541-4602-9a3a-413d17c56a6b"} + then: | + {"message":"hello admin, it's 01:18:00"} diff --git a/restx/src/test/resources/specs/hello/should_anyone_say_hello.spec.yaml b/restx/src/test/resources/specs/hello/should_anyone_say_hello.spec.yaml new file mode 100644 index 0000000000..29b6faca34 --- /dev/null +++ b/restx/src/test/resources/specs/hello/should_anyone_say_hello.spec.yaml @@ -0,0 +1,8 @@ +title: should admin say hello +given: + - time: 2013-08-28T01:18:00.822+02:00 +wts: + - when: | + GET hello?who=xavier + then: | + {"message":"hello xavier, it's 01:18:00"} diff --git a/restx/src/test/resources/specs/hello/should_missing_value_triggers_validation_error.spec.yaml b/restx/src/test/resources/specs/hello/should_missing_value_triggers_validation_error.spec.yaml new file mode 100644 index 0000000000..d0c6323caf --- /dev/null +++ b/restx/src/test/resources/specs/hello/should_missing_value_triggers_validation_error.spec.yaml @@ -0,0 +1,17 @@ +title: should missing post value triggers a validation error +given: + - time: 2013-08-28T01:18:00.822+02:00 + - uuids: [ "e2b4430f-9541-4602-9a3a-413d17c56a6b" ] +wts: + - when: | + POST mypojo + $RestxSession: {"_expires":"2013-09-27T01:18:00.822+02:00","principal":"user1","sessionKey":"e2b4430f-9541-4602-9a3a-413d17c56a6b"} + {} + then: | + 400 + - when: | + POST mypojo + $RestxSession: {"_expires":"2013-09-27T01:18:00.822+02:00","principal":"user1","sessionKey":"e2b4430f-9541-4602-9a3a-413d17c56a6b"} + {"value":"world"} + then: | + {"value":"hello world"} diff --git a/restx/src/test/resources/specs/hello/should_user1_say_hello.spec.yaml b/restx/src/test/resources/specs/hello/should_user1_say_hello.spec.yaml new file mode 100644 index 0000000000..791a3a2776 --- /dev/null +++ b/restx/src/test/resources/specs/hello/should_user1_say_hello.spec.yaml @@ -0,0 +1,10 @@ +title: should user1 say hello +given: + - time: 2013-08-28T01:18:00.822+02:00 + - uuids: [ "e2b4430f-9541-4602-9a3a-413d17c56a6b" ] +wts: + - when: | + GET message + $RestxSession: {"_expires":"2013-09-27T01:18:00.822+02:00","principal":"user1","sessionKey":"e2b4430f-9541-4602-9a3a-413d17c56a6b"} + then: | + {"message":"hello user1, it's 01:18:00"} diff --git a/restx/src/test/resources/specs/hello/should_user2_not_say_hello.spec.yaml b/restx/src/test/resources/specs/hello/should_user2_not_say_hello.spec.yaml new file mode 100644 index 0000000000..ead5af8d0c --- /dev/null +++ b/restx/src/test/resources/specs/hello/should_user2_not_say_hello.spec.yaml @@ -0,0 +1,10 @@ +title: should user2 not say hello +given: + - time: 2013-08-28T01:19:44.770+02:00 + - uuids: [ "56f71fcc-42d3-422f-9458-8ad37fc4a0b5" ] +wts: + - when: | + GET message + $RestxSession: {"_expires":"2013-09-27T01:19:44.770+02:00","principal":"user2","sessionKey":"56f71fcc-42d3-422f-9458-8ad37fc4a0b5"} + then: | + 403 diff --git a/rmi/README.md b/rmi/README.md deleted file mode 100644 index ff12555376..0000000000 --- a/rmi/README.md +++ /dev/null @@ -1 +0,0 @@ -## Relevant articles: diff --git a/rmi/client.policy b/rmi/client.policy deleted file mode 100644 index 5d74bde76d..0000000000 --- a/rmi/client.policy +++ /dev/null @@ -1,3 +0,0 @@ -grant { - permission java.security.AllPermission; -}; \ No newline at end of file diff --git a/rmi/server.policy b/rmi/server.policy deleted file mode 100644 index 5d74bde76d..0000000000 --- a/rmi/server.policy +++ /dev/null @@ -1,3 +0,0 @@ -grant { - permission java.security.AllPermission; -}; \ No newline at end of file diff --git a/rmi/src/org/baeldung/Client.java b/rmi/src/org/baeldung/Client.java deleted file mode 100644 index 0376952bab..0000000000 --- a/rmi/src/org/baeldung/Client.java +++ /dev/null @@ -1,20 +0,0 @@ -package org.baeldung; - -import java.rmi.NotBoundException; -import java.rmi.RemoteException; -import java.rmi.registry.LocateRegistry; -import java.rmi.registry.Registry; - -public class Client { - public static void main(String[] args) throws RemoteException, NotBoundException { - System.setProperty("java.security.policy", "file:./client.policy"); - if (System.getSecurityManager() == null) { - System.setSecurityManager(new SecurityManager()); - } - String name = "RandomNumberGenerator"; - Registry registry = LocateRegistry.getRegistry(); - RandomNumberGenerator randomNumberGenerator = (RandomNumberGenerator) registry.lookup(name); - int number = randomNumberGenerator.get(); - System.out.println("Received random number:" + number); - } -} diff --git a/rmi/src/org/baeldung/RandomNumberGenerator.java b/rmi/src/org/baeldung/RandomNumberGenerator.java deleted file mode 100644 index 50e49d2652..0000000000 --- a/rmi/src/org/baeldung/RandomNumberGenerator.java +++ /dev/null @@ -1,8 +0,0 @@ -package org.baeldung; - -import java.rmi.Remote; -import java.rmi.RemoteException; - -public interface RandomNumberGenerator extends Remote{ - int get() throws RemoteException; -} diff --git a/rmi/src/org/baeldung/RandomNumberGeneratorEngine.java b/rmi/src/org/baeldung/RandomNumberGeneratorEngine.java deleted file mode 100644 index 04d90b2ff9..0000000000 --- a/rmi/src/org/baeldung/RandomNumberGeneratorEngine.java +++ /dev/null @@ -1,10 +0,0 @@ -package org.baeldung; - -import java.rmi.RemoteException; - -public class RandomNumberGeneratorEngine implements RandomNumberGenerator { - @Override - public int get() throws RemoteException { - return (int) (100 * Math.random()); - } -} diff --git a/rmi/src/org/baeldung/Server.java b/rmi/src/org/baeldung/Server.java deleted file mode 100644 index 8e613cb6bb..0000000000 --- a/rmi/src/org/baeldung/Server.java +++ /dev/null @@ -1,22 +0,0 @@ -package org.baeldung; - -import java.rmi.RemoteException; -import java.rmi.registry.LocateRegistry; -import java.rmi.registry.Registry; -import java.rmi.server.UnicastRemoteObject; - -public class Server { - public static void main(String[] args) throws RemoteException { - System.setProperty("java.security.policy", "file:./server.policy"); - if (System.getSecurityManager() == null) { - System.setSecurityManager(new SecurityManager()); - } - String name = "RandomNumberGenerator"; - RandomNumberGenerator randomNumberGenerator = new RandomNumberGeneratorEngine(); - RandomNumberGenerator stub = - (RandomNumberGenerator) UnicastRemoteObject.exportObject(randomNumberGenerator, 0); - Registry registry = LocateRegistry.getRegistry(); - registry.rebind(name, stub); - System.out.println("RandomNumberGenerator bound"); - } -} diff --git a/rsocket/pom.xml b/rsocket/pom.xml new file mode 100644 index 0000000000..8b04a31583 --- /dev/null +++ b/rsocket/pom.xml @@ -0,0 +1,54 @@ + + + 4.0.0 + rsocket + 0.0.1-SNAPSHOT + rsocket + + + com.baeldung + parent-modules + 1.0.0-SNAPSHOT + + jar + + + + io.rsocket + rsocket-core + 0.11.13 + + + io.rsocket + rsocket-transport-netty + 0.11.13 + + + junit + junit + 4.12 + test + + + org.hamcrest + hamcrest-core + 1.3 + test + + + ch.qos.logback + logback-classic + 1.2.3 + + + ch.qos.logback + logback-core + 1.2.3 + + + org.slf4j + slf4j-api + 1.7.25 + + + \ No newline at end of file diff --git a/rsocket/src/main/java/com/baeldung/rsocket/ChannelClient.java b/rsocket/src/main/java/com/baeldung/rsocket/ChannelClient.java new file mode 100644 index 0000000000..f35d337427 --- /dev/null +++ b/rsocket/src/main/java/com/baeldung/rsocket/ChannelClient.java @@ -0,0 +1,33 @@ +package com.baeldung.rsocket; + +import static com.baeldung.rsocket.support.Constants.*; +import com.baeldung.rsocket.support.GameController; +import io.rsocket.RSocket; +import io.rsocket.RSocketFactory; +import io.rsocket.transport.netty.client.TcpClientTransport; +import reactor.core.publisher.Flux; + +public class ChannelClient { + + private final RSocket socket; + private final GameController gameController; + + public ChannelClient() { + this.socket = RSocketFactory.connect() + .transport(TcpClientTransport.create("localhost", TCP_PORT)) + .start() + .block(); + + this.gameController = new GameController("Client Player"); + } + + public void playGame() { + socket.requestChannel(Flux.from(gameController)) + .doOnNext(gameController::processPayload) + .blockLast(); + } + + public void dispose() { + this.socket.dispose(); + } +} diff --git a/rsocket/src/main/java/com/baeldung/rsocket/FireNForgetClient.java b/rsocket/src/main/java/com/baeldung/rsocket/FireNForgetClient.java new file mode 100644 index 0000000000..496b3fc5c9 --- /dev/null +++ b/rsocket/src/main/java/com/baeldung/rsocket/FireNForgetClient.java @@ -0,0 +1,85 @@ +package com.baeldung.rsocket; + +import static com.baeldung.rsocket.support.Constants.*; +import io.rsocket.Payload; +import io.rsocket.RSocket; +import io.rsocket.RSocketFactory; +import io.rsocket.transport.netty.client.TcpClientTransport; +import io.rsocket.util.DefaultPayload; +import java.nio.ByteBuffer; +import java.time.Duration; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.function.Function; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import reactor.core.publisher.Flux; + +public class FireNForgetClient { + + private static final Logger LOG = LoggerFactory.getLogger(FireNForgetClient.class); + + private final RSocket socket; + private final List data; + + public FireNForgetClient() { + this.socket = RSocketFactory.connect() + .transport(TcpClientTransport.create("localhost", TCP_PORT)) + .start() + .block(); + this.data = Collections.unmodifiableList(generateData()); + } + + /** + * Send binary velocity (float) every 50ms + */ + public void sendData() { + Flux.interval(Duration.ofMillis(50)) + .take(data.size()) + .map(this::createFloatPayload) + .flatMap(socket::fireAndForget) + .blockLast(); + } + + /** + * Create a binary payload containing a single float value + * + * @param index Index into the data list + * @return Payload ready to send to the server + */ + private Payload createFloatPayload(Long index) { + float velocity = data.get(index.intValue()); + ByteBuffer buffer = ByteBuffer.allocate(4).putFloat(velocity); + buffer.rewind(); + return DefaultPayload.create(buffer); + } + + /** + * Generate sample data + * + * @return List of random floats + */ + private List generateData() { + List dataList = new ArrayList<>(WIND_DATA_LENGTH); + float velocity = 0; + for (int i = 0; i < WIND_DATA_LENGTH; i++) { + velocity += Math.random(); + dataList.add(velocity); + } + return dataList; + } + + /** + * Get the data used for this client. + * + * @return list of data values + */ + public List getData() { + return data; + } + + public void dispose() { + this.socket.dispose(); + } +} diff --git a/rsocket/src/main/java/com/baeldung/rsocket/ReqResClient.java b/rsocket/src/main/java/com/baeldung/rsocket/ReqResClient.java new file mode 100644 index 0000000000..fff196a580 --- /dev/null +++ b/rsocket/src/main/java/com/baeldung/rsocket/ReqResClient.java @@ -0,0 +1,32 @@ +package com.baeldung.rsocket; + +import static com.baeldung.rsocket.support.Constants.*; +import io.rsocket.Payload; +import io.rsocket.RSocket; +import io.rsocket.RSocketFactory; +import io.rsocket.transport.netty.client.TcpClientTransport; +import io.rsocket.util.DefaultPayload; + +public class ReqResClient { + + private final RSocket socket; + + public ReqResClient() { + this.socket = RSocketFactory.connect() + .transport(TcpClientTransport.create("localhost", TCP_PORT)) + .start() + .block(); + } + + public String callBlocking(String string) { + return socket + .requestResponse(DefaultPayload.create(string)) + .map(Payload::getDataUtf8) + .onErrorReturn(ERROR_MSG) + .block(); + } + + public void dispose() { + this.socket.dispose(); + } +} diff --git a/rsocket/src/main/java/com/baeldung/rsocket/ReqStreamClient.java b/rsocket/src/main/java/com/baeldung/rsocket/ReqStreamClient.java new file mode 100644 index 0000000000..e97192bdf0 --- /dev/null +++ b/rsocket/src/main/java/com/baeldung/rsocket/ReqStreamClient.java @@ -0,0 +1,33 @@ +package com.baeldung.rsocket; + +import static com.baeldung.rsocket.support.Constants.*; +import io.rsocket.Payload; +import io.rsocket.RSocket; +import io.rsocket.RSocketFactory; +import io.rsocket.transport.netty.client.TcpClientTransport; +import io.rsocket.util.DefaultPayload; +import reactor.core.publisher.Flux; + +public class ReqStreamClient { + + private final RSocket socket; + + public ReqStreamClient() { + this.socket = RSocketFactory.connect() + .transport(TcpClientTransport.create("localhost", TCP_PORT)) + .start() + .block(); + } + + public Flux getDataStream() { + return socket + .requestStream(DefaultPayload.create(WIND_DATA_STREAM_NAME)) + .map(Payload::getData) + .map(buf -> buf.getFloat()) + .onErrorReturn(null); + } + + public void dispose() { + this.socket.dispose(); + } +} diff --git a/rsocket/src/main/java/com/baeldung/rsocket/Server.java b/rsocket/src/main/java/com/baeldung/rsocket/Server.java new file mode 100644 index 0000000000..b5718ab36d --- /dev/null +++ b/rsocket/src/main/java/com/baeldung/rsocket/Server.java @@ -0,0 +1,107 @@ +package com.baeldung.rsocket; + +import com.baeldung.rsocket.support.WindDataPublisher; +import static com.baeldung.rsocket.support.Constants.*; +import com.baeldung.rsocket.support.GameController; +import io.rsocket.AbstractRSocket; +import io.rsocket.Payload; +import io.rsocket.RSocketFactory; +import io.rsocket.transport.netty.server.TcpServerTransport; +import org.reactivestreams.Publisher; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import reactor.core.Disposable; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public class Server { + + private static final Logger LOG = LoggerFactory.getLogger(Server.class); + + private final Disposable server; + private final WindDataPublisher windDataPublisher = new WindDataPublisher(); + private final GameController gameController; + + public Server() { + this.server = RSocketFactory.receive() + .acceptor((setupPayload, reactiveSocket) -> Mono.just(new RSocketImpl())) + .transport(TcpServerTransport.create("localhost", TCP_PORT)) + .start() + .doOnNext(x -> LOG.info("Server started")) + .subscribe(); + + this.gameController = new GameController("Server Player"); + } + + public void dispose() { + windDataPublisher.complete(); + this.server.dispose(); + } + + /** + * RSocket implementation + */ + private class RSocketImpl extends AbstractRSocket { + + /** + * Handle Request/Response messages + * + * @param payload Message payload + * @return payload response + */ + @Override + public Mono requestResponse(Payload payload) { + try { + return Mono.just(payload); // reflect the payload back to the sender + } catch (Exception x) { + return Mono.error(x); + } + } + + /** + * Handle Fire-and-Forget messages + * + * @param payload Message payload + * @return nothing + */ + @Override + public Mono fireAndForget(Payload payload) { + try { + windDataPublisher.publish(payload); // forward the payload + return Mono.empty(); + } catch (Exception x) { + return Mono.error(x); + } + } + + /** + * Handle Request/Stream messages. Each request returns a new stream. + * + * @param payload Payload that can be used to determine which stream to return + * @return Flux stream containing simulated wind speed data + */ + @Override + public Flux requestStream(Payload payload) { + String streamName = payload.getDataUtf8(); + if (WIND_DATA_STREAM_NAME.equals(streamName)) { + return Flux.from(windDataPublisher); + } + return Flux.error(new IllegalArgumentException(streamName)); + } + + /** + * Handle request for bidirectional channel + * + * @param payloads Stream of payloads delivered from the client + * @return + */ + @Override + public Flux requestChannel(Publisher payloads) { + Flux.from(payloads) + .subscribe(gameController::processPayload); + Flux channel = Flux.from(gameController); + return channel; + } + } + +} diff --git a/rsocket/src/main/java/com/baeldung/rsocket/support/Constants.java b/rsocket/src/main/java/com/baeldung/rsocket/support/Constants.java new file mode 100644 index 0000000000..01bb374b4e --- /dev/null +++ b/rsocket/src/main/java/com/baeldung/rsocket/support/Constants.java @@ -0,0 +1,10 @@ +package com.baeldung.rsocket.support; + +public interface Constants { + + int TCP_PORT = 7101; + String ERROR_MSG = "error"; + int WIND_DATA_LENGTH = 30; + String WIND_DATA_STREAM_NAME = "wind-data"; + int SHOT_COUNT = 10; +} diff --git a/rsocket/src/main/java/com/baeldung/rsocket/support/GameController.java b/rsocket/src/main/java/com/baeldung/rsocket/support/GameController.java new file mode 100644 index 0000000000..bc1bc0f861 --- /dev/null +++ b/rsocket/src/main/java/com/baeldung/rsocket/support/GameController.java @@ -0,0 +1,84 @@ +package com.baeldung.rsocket.support; + +import static com.baeldung.rsocket.support.Constants.*; +import io.rsocket.Payload; +import io.rsocket.util.DefaultPayload; +import java.util.List; +import org.reactivestreams.Publisher; +import org.reactivestreams.Subscriber; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import reactor.core.publisher.Flux; + +public class GameController implements Publisher { + + private static final Logger LOG = LoggerFactory.getLogger(GameController.class); + + private final String playerName; + private final List shots; + private Subscriber subscriber; + private boolean truce = false; + + public GameController(String playerName) { + this.playerName = playerName; + this.shots = generateShotList(); + } + + /** + * Create a random list of time intervals, 0-1000ms + * + * @return List of time intervals + */ + private List generateShotList() { + return Flux.range(1, SHOT_COUNT) + .map(x -> (long) Math.ceil(Math.random() * 1000)) + .collectList() + .block(); + } + + @Override + public void subscribe(Subscriber subscriber) { + this.subscriber = subscriber; + fireAtWill(); + } + + /** + * Publish game events asynchronously + */ + private void fireAtWill() { + new Thread(() -> { + for (Long shotDelay : shots) { + try { Thread.sleep(shotDelay); } catch (Exception x) {} + if (truce) { + break; + } + LOG.info("{}: bang!", playerName); + subscriber.onNext(DefaultPayload.create("bang!")); + } + if (!truce) { + LOG.info("{}: I give up!", playerName); + subscriber.onNext(DefaultPayload.create("I give up")); + } + subscriber.onComplete(); + }).start(); + } + + /** + * Process events from the opponent + * + * @param payload Payload received from the rSocket + */ + public void processPayload(Payload payload) { + String message = payload.getDataUtf8(); + switch (message) { + case "bang!": + String result = Math.random() < 0.5 ? "Haha missed!" : "Ow!"; + LOG.info("{}: {}", playerName, result); + break; + case "I give up": + truce = true; + LOG.info("{}: OK, truce", playerName); + break; + } + } +} diff --git a/rsocket/src/main/java/com/baeldung/rsocket/support/WindDataPublisher.java b/rsocket/src/main/java/com/baeldung/rsocket/support/WindDataPublisher.java new file mode 100644 index 0000000000..2ad5b5144b --- /dev/null +++ b/rsocket/src/main/java/com/baeldung/rsocket/support/WindDataPublisher.java @@ -0,0 +1,31 @@ +package com.baeldung.rsocket.support; + +import io.rsocket.Payload; +import org.reactivestreams.Publisher; +import org.reactivestreams.Subscriber; + +/** + * Simple PUblisher to provide async data to Flux stream + */ +public class WindDataPublisher implements Publisher { + + private Subscriber subscriber; + + @Override + public void subscribe(Subscriber subscriber) { + this.subscriber = subscriber; + } + + public void publish(Payload payload) { + if (subscriber != null) { + subscriber.onNext(payload); + } + } + + public void complete() { + if (subscriber != null) { + subscriber.onComplete(); + } + } + +} diff --git a/spring-boot-persistence/src/main/resources/logback.xml b/rsocket/src/main/resources/logback.xml similarity index 100% rename from spring-boot-persistence/src/main/resources/logback.xml rename to rsocket/src/main/resources/logback.xml diff --git a/rsocket/src/test/java/com/baeldung/rsocket/RSocketIntegrationTest.java b/rsocket/src/test/java/com/baeldung/rsocket/RSocketIntegrationTest.java new file mode 100644 index 0000000000..afa3960eac --- /dev/null +++ b/rsocket/src/test/java/com/baeldung/rsocket/RSocketIntegrationTest.java @@ -0,0 +1,84 @@ +package com.baeldung.rsocket; + +import java.util.ArrayList; +import java.util.List; +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; +import static org.junit.Assert.*; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import reactor.core.Disposable; + +public class RSocketIntegrationTest { + + private static final Logger LOG = LoggerFactory.getLogger(RSocketIntegrationTest.class); + + private static Server server; + + public RSocketIntegrationTest() { + } + + @BeforeClass + public static void setUpClass() { + server = new Server(); + } + + @AfterClass + public static void tearDownClass() { + server.dispose(); + } + + @Test + public void whenSendingAString_thenRevceiveTheSameString() { + ReqResClient client = new ReqResClient(); + String string = "Hello RSocket"; + + assertEquals(string, client.callBlocking(string)); + + client.dispose(); + } + + @Test + public void whenSendingStream_thenReceiveTheSameStream() { + // create the client that pushes data to the server and start sending + FireNForgetClient fnfClient = new FireNForgetClient(); + // create a client to read a stream from the server and subscribe to events + ReqStreamClient streamClient = new ReqStreamClient(); + + // get the data that is used by the client + List data = fnfClient.getData(); + // create a place to count the results + List dataReceived = new ArrayList<>(); + + // assert that the data received is the same as the data sent + Disposable subscription = streamClient.getDataStream() + .index() + .subscribe( + tuple -> { + assertEquals("Wrong value", data.get(tuple.getT1().intValue()), tuple.getT2()); + dataReceived.add(tuple.getT2()); + }, + err -> LOG.error(err.getMessage()) + ); + + // start sending the data + fnfClient.sendData(); + + // wait a short time for the data to complete then dispose everything + try { Thread.sleep(500); } catch (Exception x) {} + subscription.dispose(); + fnfClient.dispose(); + + // verify the item count + assertEquals("Wrong data count received", data.size(), dataReceived.size()); + } + + @Test + public void whenRunningChannelGame_thenLogTheResults() { + ChannelClient client = new ChannelClient(); + client.playGame(); + client.dispose(); + } + +} diff --git a/rxjava-2/README.md b/rxjava-2/README.md index 78eb6e6428..f9528bb1d5 100644 --- a/rxjava-2/README.md +++ b/rxjava-2/README.md @@ -5,3 +5,4 @@ - [RxJava 2 - Completable](http://www.baeldung.com/rxjava-completable) - [RxJava Maybe](http://www.baeldung.com/rxjava-maybe) - [Introduction to RxRelay for RxJava](http://www.baeldung.com/rx-relay) +- [Combining RxJava Completables](https://www.baeldung.com/rxjava-completable) diff --git a/rxjava-2/pom.xml b/rxjava-2/pom.xml index a18b096b6d..3038c20037 100644 --- a/rxjava-2/pom.xml +++ b/rxjava-2/pom.xml @@ -1,45 +1,53 @@ - - 4.0.0 + + 4.0.0 - rxjava-2 - 1.0-SNAPSHOT + rxjava-2 + 1.0-SNAPSHOT - - com.baeldung - parent-java - 0.0.1-SNAPSHOT - ../parent-java - + + com.baeldung + parent-java + 0.0.1-SNAPSHOT + ../parent-java + - - - io.reactivex.rxjava2 - rxjava - ${rx.java2.version} - - - com.jayway.awaitility - awaitility - ${awaitility.version} - - - org.assertj - assertj-core - ${assertj.version} - - - com.jakewharton.rxrelay2 - rxrelay - ${rxrelay.version} - - + + + io.reactivex.rxjava2 + rxjava + ${rx.java2.version} + + + com.jayway.awaitility + awaitility + ${awaitility.version} + + + org.assertj + assertj-core + ${assertj.version} + + + com.jakewharton.rxrelay2 + rxrelay + ${rxrelay.version} + + + + com.github.akarnokd + rxjava2-extensions + ${rxjava2.ext.version} + + - - 3.8.0 - 2.2.2 - 1.7.0 - 2.0.0 - + + 3.8.0 + 2.2.2 + 1.7.0 + 2.0.0 + 0.20.4 + \ No newline at end of file diff --git a/rxjava-2/src/test/java/com/baeldung/rxjava/AsyncAndSyncToObservableIntegrationTest.java b/rxjava-2/src/test/java/com/baeldung/rxjava/AsyncAndSyncToObservableIntegrationTest.java new file mode 100644 index 0000000000..90f4fe94ae --- /dev/null +++ b/rxjava-2/src/test/java/com/baeldung/rxjava/AsyncAndSyncToObservableIntegrationTest.java @@ -0,0 +1,107 @@ +package com.baeldung.rxjava; + +import static org.junit.Assert.assertEquals; + +import java.util.Arrays; +import java.util.List; +import java.util.concurrent.Callable; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.concurrent.Future; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.atomic.AtomicInteger; + +import org.junit.Test; + +import hu.akarnokd.rxjava2.async.AsyncObservable; +import io.reactivex.Observable; + +public class AsyncAndSyncToObservableIntegrationTest { + + AtomicInteger counter = new AtomicInteger(); + Callable callable = () -> counter.incrementAndGet(); + + /* Method will execute every time it gets subscribed*/ + @Test + public void givenSyncMethod_whenConvertedWithFromCallable_thenReturnObservable() { + + Observable source = Observable.fromCallable(callable); + + for (int i = 1; i < 5; i++) { + source.test() + .awaitDone(5, TimeUnit.SECONDS) + .assertResult(i); + + assertEquals(i, counter.get()); + } + } + + /* Method will execute only once and cache its result.*/ + @Test + public void givenSyncMethod_whenConvertedWithStart_thenReturnObservable() { + + Observable source = AsyncObservable.start(callable); + + for (int i = 1; i < 5; i++) { + source.test() + .awaitDone(5, TimeUnit.SECONDS) + .assertResult(1); + + assertEquals(1, counter.get()); + } + } + + /* Method will execute only once and cache its result.*/ + @Test + public void givenAsyncMethod_whenConvertedWithFromFuture_thenRetrunObservble() { + + ExecutorService executor = Executors.newSingleThreadExecutor(); + Future future = executor.submit(callable); + Observable source = Observable.fromFuture(future); + + for (int i = 1; i < 5; i++) { + source.test() + .awaitDone(5, TimeUnit.SECONDS) + .assertResult(1); + + assertEquals(1, counter.get()); + } + + executor.shutdown(); + } + + /* Method will execute every time it gets subscribed*/ + @Test + public void givenAsyncMethod_whenConvertedWithStartFuture_thenRetrunObservble() { + + ExecutorService executor = Executors.newSingleThreadExecutor(); + Observable source = AsyncObservable.startFuture(() -> executor.submit(callable)); + + for (int i = 1; i < 5; i++) { + source.test() + .awaitDone(5, TimeUnit.SECONDS) + .assertResult(i); + + assertEquals(i, counter.get()); + } + + executor.shutdown(); + } + + /*Method will execute only once and cache its result.*/ + @Test + public void givenAsyncMethod_whenConvertedWithDeferFuture_thenRetrunObservble() { + List list = Arrays.asList(new Integer[] { counter.incrementAndGet(), counter.incrementAndGet(), counter.incrementAndGet() }); + ExecutorService exec = Executors.newSingleThreadExecutor(); + Callable> callable = () -> Observable.fromIterable(list); + Observable source = AsyncObservable.deferFuture(() -> exec.submit(callable)); + for (int i = 1; i < 4; i++) { + source.test() + .awaitDone(5, TimeUnit.SECONDS) + .assertResult(1, 2, 3); + } + + exec.shutdown(); + } + +} diff --git a/rxjava/pom.xml b/rxjava/pom.xml index b316001d87..596a5196da 100644 --- a/rxjava/pom.xml +++ b/rxjava/pom.xml @@ -2,10 +2,10 @@ 4.0.0 - rxjava 1.0-SNAPSHOT - + rxjava + com.baeldung parent-java diff --git a/spring-5-data-reactive/pom.xml b/spring-5-data-reactive/pom.xml index 5c723c6e29..aa73cf11ae 100644 --- a/spring-5-data-reactive/pom.xml +++ b/spring-5-data-reactive/pom.xml @@ -3,6 +3,7 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 spring-5-data-reactive + spring-5-data-reactive jar diff --git a/spring-5-data-reactive/src/main/kotlin/com/baeldung/Application.kt b/spring-5-data-reactive/src/main/kotlin/com/baeldung/Application.kt index af29a429a4..5a59d11de0 100644 --- a/spring-5-data-reactive/src/main/kotlin/com/baeldung/Application.kt +++ b/spring-5-data-reactive/src/main/kotlin/com/baeldung/Application.kt @@ -2,8 +2,9 @@ package com.baeldung import org.springframework.boot.SpringApplication import org.springframework.boot.autoconfigure.SpringBootApplication +import org.springframework.boot.autoconfigure.data.mongo.MongoReactiveDataAutoConfiguration -@SpringBootApplication +@SpringBootApplication(exclude = arrayOf(MongoReactiveDataAutoConfiguration::class)) class Application fun main(args: Array) { diff --git a/spring-5-mvc/src/main/java/com/baeldung/Spring5Application.java b/spring-5-mvc/src/main/java/com/baeldung/Spring5Application.java index 8251467122..74a348dea6 100644 --- a/spring-5-mvc/src/main/java/com/baeldung/Spring5Application.java +++ b/spring-5-mvc/src/main/java/com/baeldung/Spring5Application.java @@ -4,10 +4,11 @@ import javax.servlet.Filter; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration; import org.springframework.web.filter.DelegatingFilterProxy; import org.springframework.web.servlet.support.AbstractAnnotationConfigDispatcherServletInitializer; -@SpringBootApplication +@SpringBootApplication( exclude = SecurityAutoConfiguration.class) public class Spring5Application { public static void main(String[] args) { diff --git a/spring-5-mvc/src/main/kotlin/com/baeldung/springbootkotlin/KotlinDemoApplication.kt b/spring-5-mvc/src/main/kotlin/com/baeldung/springbootkotlin/KotlinDemoApplication.kt index f95586af80..8904d8d805 100644 --- a/spring-5-mvc/src/main/kotlin/com/baeldung/springbootkotlin/KotlinDemoApplication.kt +++ b/spring-5-mvc/src/main/kotlin/com/baeldung/springbootkotlin/KotlinDemoApplication.kt @@ -2,8 +2,9 @@ package com.baeldung.springbootkotlin import org.springframework.boot.SpringApplication import org.springframework.boot.autoconfigure.SpringBootApplication +import org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration -@SpringBootApplication(scanBasePackages = arrayOf("com.baeldung.springbootkotlin")) +@SpringBootApplication(scanBasePackages = arrayOf("com.baeldung.springbootkotlin"), exclude = arrayOf(SecurityAutoConfiguration::class)) class KotlinDemoApplication fun main(args: Array) { diff --git a/spring-5-mvc/src/test/kotlin/com/baeldung/LiveTest.java b/spring-5-mvc/src/test/java/com/baeldung/LiveTest.java similarity index 100% rename from spring-5-mvc/src/test/kotlin/com/baeldung/LiveTest.java rename to spring-5-mvc/src/test/java/com/baeldung/LiveTest.java diff --git a/spring-5-reactive-oauth/README.md b/spring-5-reactive-oauth/README.md new file mode 100644 index 0000000000..0f27cf5d20 --- /dev/null +++ b/spring-5-reactive-oauth/README.md @@ -0,0 +1,3 @@ +### Relevant Articles: + +- [Spring Security OAuth Login with WebFlux](https://www.baeldung.com/spring-oauth-login-webflux) diff --git a/spring-5-reactive-oauth/pom.xml b/spring-5-reactive-oauth/pom.xml new file mode 100644 index 0000000000..73809681f2 --- /dev/null +++ b/spring-5-reactive-oauth/pom.xml @@ -0,0 +1,77 @@ + + + 4.0.0 + + com.baeldung.reactive.oauth + spring-5-reactive-oauth + 1.0.0-SNAPSHOT + jar + + spring-5-reactive-oauth + WebFluc and Spring Security OAuth + + + org.springframework.boot + spring-boot-starter-parent + 2.1.0.RELEASE + + + + + UTF-8 + UTF-8 + 1.8 + + + + + org.springframework.boot + spring-boot-starter-security + + + org.springframework.boot + spring-boot-starter-webflux + + + + org.springframework.security + spring-security-oauth2-client + + + + org.springframework.boot + spring-boot-starter-test + test + + + io.projectreactor + reactor-test + test + + + org.springframework.security + spring-security-test + test + + + + + + + + org.apache.maven.plugins + maven-surefire-plugin + 2.20.1 + + true + + **/*IntegrationTest.java + + + + + + + + diff --git a/spring-5-reactive-oauth/src/main/java/com/baeldung/reactive/oauth/SecurityConfig.java b/spring-5-reactive-oauth/src/main/java/com/baeldung/reactive/oauth/SecurityConfig.java new file mode 100644 index 0000000000..2fa1dd9380 --- /dev/null +++ b/spring-5-reactive-oauth/src/main/java/com/baeldung/reactive/oauth/SecurityConfig.java @@ -0,0 +1,19 @@ +package com.baeldung.reactive.oauth; + +import org.springframework.context.annotation.Bean; +import org.springframework.security.config.annotation.web.reactive.EnableWebFluxSecurity; +import org.springframework.security.config.web.server.ServerHttpSecurity; +import org.springframework.security.web.server.SecurityWebFilterChain; + +@EnableWebFluxSecurity +public class SecurityConfig { + + @Bean + public SecurityWebFilterChain configure(ServerHttpSecurity http) throws Exception { + return http.authorizeExchange() + .pathMatchers("/about").permitAll() + .anyExchange().authenticated() + .and().oauth2Login() + .and().build(); + } +} diff --git a/spring-5-reactive-oauth/src/main/java/com/baeldung/reactive/oauth/Spring5ReactiveOauthApplication.java b/spring-5-reactive-oauth/src/main/java/com/baeldung/reactive/oauth/Spring5ReactiveOauthApplication.java new file mode 100644 index 0000000000..602ded6b9e --- /dev/null +++ b/spring-5-reactive-oauth/src/main/java/com/baeldung/reactive/oauth/Spring5ReactiveOauthApplication.java @@ -0,0 +1,25 @@ +package com.baeldung.reactive.oauth; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.context.annotation.Bean; +import org.springframework.security.oauth2.client.registration.ReactiveClientRegistrationRepository; +import org.springframework.security.oauth2.client.web.reactive.function.client.ServerOAuth2AuthorizedClientExchangeFilterFunction; +import org.springframework.security.oauth2.client.web.server.ServerOAuth2AuthorizedClientRepository; +import org.springframework.web.reactive.function.client.WebClient; + +@SpringBootApplication +public class Spring5ReactiveOauthApplication { + + public static void main(String[] args) { + SpringApplication.run(Spring5ReactiveOauthApplication.class, args); + } + + @Bean + public WebClient webClient(ReactiveClientRegistrationRepository clientRegistrationRepo, ServerOAuth2AuthorizedClientRepository authorizedClientRepo) { + ServerOAuth2AuthorizedClientExchangeFilterFunction filter = new ServerOAuth2AuthorizedClientExchangeFilterFunction(clientRegistrationRepo, authorizedClientRepo); + return WebClient.builder() + .filter(filter) + .build(); + } +} diff --git a/spring-5-reactive-oauth/src/main/java/com/baeldung/reactive/oauth/web/MainController.java b/spring-5-reactive-oauth/src/main/java/com/baeldung/reactive/oauth/web/MainController.java new file mode 100644 index 0000000000..b3ce24b0ea --- /dev/null +++ b/spring-5-reactive-oauth/src/main/java/com/baeldung/reactive/oauth/web/MainController.java @@ -0,0 +1,46 @@ +package com.baeldung.reactive.oauth.web; + +import static org.springframework.security.oauth2.client.web.reactive.function.client.ServerOAuth2AuthorizedClientExchangeFilterFunction.oauth2AuthorizedClient; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.core.annotation.AuthenticationPrincipal; +import org.springframework.security.oauth2.client.OAuth2AuthorizedClient; +import org.springframework.security.oauth2.client.annotation.RegisteredOAuth2AuthorizedClient; +import org.springframework.security.oauth2.core.user.OAuth2User; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.reactive.function.client.WebClient; + +import reactor.core.publisher.Mono; + +import com.baeldung.reactive.oauth.web.dto.Foo; + +@RestController +public class MainController { + + @Autowired + private WebClient webClient; + + @GetMapping("/") + public Mono index(@AuthenticationPrincipal Mono oauth2User) { + return oauth2User + .map(OAuth2User::getName) + .map(name -> String.format("Hi, %s", name)); + } + + @GetMapping("/foos/{id}") + public Mono getFooResource(@RegisteredOAuth2AuthorizedClient("custom") OAuth2AuthorizedClient client, @PathVariable final long id){ + return webClient + .get() + .uri("http://localhost:8088/spring-security-oauth-resource/foos/{id}", id) + .attributes(oauth2AuthorizedClient(client)) + .retrieve() + .bodyToMono(Foo.class); + } + + @GetMapping("/about") + public String getAboutPage() { + return "WebFlux OAuth example"; + } +} diff --git a/spring-5-reactive-oauth/src/main/java/com/baeldung/reactive/oauth/web/dto/Foo.java b/spring-5-reactive-oauth/src/main/java/com/baeldung/reactive/oauth/web/dto/Foo.java new file mode 100644 index 0000000000..15b4addbcd --- /dev/null +++ b/spring-5-reactive-oauth/src/main/java/com/baeldung/reactive/oauth/web/dto/Foo.java @@ -0,0 +1,35 @@ +package com.baeldung.reactive.oauth.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; + } + + public void setId(final long id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(final String name) { + this.name = name; + } +} diff --git a/spring-5-reactive-oauth/src/main/resources/application.yml b/spring-5-reactive-oauth/src/main/resources/application.yml new file mode 100644 index 0000000000..e35e19b344 --- /dev/null +++ b/spring-5-reactive-oauth/src/main/resources/application.yml @@ -0,0 +1,20 @@ +spring: + security: + oauth2: + client: + registration: + google: + client-id: YOUR_APP_CLIENT_ID + client-secret: YOUR_APP_CLIENT_SECRET + custom: + client-id: fooClientIdPassword + client-secret: secret + scopes: read,foo + authorization-grant-type: authorization_code + redirect-uri-template: http://localhost:8080/login/oauth2/code/custom + provider: + custom: + authorization-uri: http://localhost:8081/spring-security-oauth-server/oauth/authorize + token-uri: http://localhost:8081/spring-security-oauth-server/oauth/token + user-info-uri: http://localhost:8088/spring-security-oauth-resource/users/extra + user-name-attribute: user_name \ No newline at end of file diff --git a/spring-5-reactive-oauth/src/test/java/com/baeldung/reactive/oauth/Spring5ReactiveOauthIntegrationTest.java b/spring-5-reactive-oauth/src/test/java/com/baeldung/reactive/oauth/Spring5ReactiveOauthIntegrationTest.java new file mode 100644 index 0000000000..db545d63de --- /dev/null +++ b/spring-5-reactive-oauth/src/test/java/com/baeldung/reactive/oauth/Spring5ReactiveOauthIntegrationTest.java @@ -0,0 +1,16 @@ +package com.baeldung.reactive.oauth; + +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 Spring5ReactiveOauthIntegrationTest { + + @Test + public void contextLoads() { + } + +} diff --git a/spring-5-reactive-security/README.md b/spring-5-reactive-security/README.md index 3395cf5562..845d07cd7f 100644 --- a/spring-5-reactive-security/README.md +++ b/spring-5-reactive-security/README.md @@ -8,4 +8,4 @@ The "REST With Spring" Classes: http://bit.ly/restwithspring - [Spring Boot Actuator](http://www.baeldung.com/spring-boot-actuators) - [Spring Security 5 for Reactive Applications](http://www.baeldung.com/spring-security-5-reactive) - [Guide to Spring 5 WebFlux](http://www.baeldung.com/spring-webflux) - +- [Introduction to the Functional Web Framework in Spring 5](https://www.baeldung.com/spring-5-functional-web) diff --git a/spring-5-reactive-security/src/main/java/com/baeldung/reactive/actuator/Spring5ReactiveApplication.java b/spring-5-reactive-security/src/main/java/com/baeldung/reactive/actuator/Spring5ReactiveApplication.java index f07ddfb0f7..03943d436d 100644 --- a/spring-5-reactive-security/src/main/java/com/baeldung/reactive/actuator/Spring5ReactiveApplication.java +++ b/spring-5-reactive-security/src/main/java/com/baeldung/reactive/actuator/Spring5ReactiveApplication.java @@ -1,9 +1,7 @@ package com.baeldung.reactive.actuator; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; -import org.springframework.context.annotation.Bean; @SpringBootApplication public class Spring5ReactiveApplication{ diff --git a/spring-5-reactive-security/src/main/java/com/baeldung/reactive/security/SpringSecurity5Application.java b/spring-5-reactive-security/src/main/java/com/baeldung/reactive/security/SpringSecurity5Application.java index f2963c4fa5..325923f577 100644 --- a/spring-5-reactive-security/src/main/java/com/baeldung/reactive/security/SpringSecurity5Application.java +++ b/spring-5-reactive-security/src/main/java/com/baeldung/reactive/security/SpringSecurity5Application.java @@ -8,8 +8,9 @@ import org.springframework.http.server.reactive.HttpHandler; import org.springframework.http.server.reactive.ReactorHttpHandlerAdapter; import org.springframework.web.reactive.config.EnableWebFlux; import org.springframework.web.server.adapter.WebHttpHandlerBuilder; -import reactor.ipc.netty.NettyContext; -import reactor.ipc.netty.http.server.HttpServer; + +import reactor.netty.DisposableServer; +import reactor.netty.http.server.HttpServer; @ComponentScan(basePackages = {"com.baeldung.reactive.security"}) @EnableWebFlux @@ -18,17 +19,19 @@ public class SpringSecurity5Application { public static void main(String[] args) { try (AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(SpringSecurity5Application.class)) { - context.getBean(NettyContext.class).onClose().block(); + context.getBean(DisposableServer.class).onDispose().block(); } } @Bean - public NettyContext nettyContext(ApplicationContext context) { + public DisposableServer disposableServer(ApplicationContext context) { HttpHandler handler = WebHttpHandlerBuilder.applicationContext(context) .build(); ReactorHttpHandlerAdapter adapter = new ReactorHttpHandlerAdapter(handler); - HttpServer httpServer = HttpServer.create("localhost", 8080); - return httpServer.newHandler(adapter).block(); + HttpServer httpServer = HttpServer.create(); + httpServer.host("localhost"); + httpServer.port(8080); + return httpServer.handle(adapter).bindNow(); } } diff --git a/spring-5-reactive-security/src/test/java/com/baeldung/reactive/webflux/EmployeeControllerIntegrationTest.java b/spring-5-reactive-security/src/test/java/com/baeldung/reactive/webflux/EmployeeControllerIntegrationTest.java index 3dc832d781..12a21ed4ef 100644 --- a/spring-5-reactive-security/src/test/java/com/baeldung/reactive/webflux/EmployeeControllerIntegrationTest.java +++ b/spring-5-reactive-security/src/test/java/com/baeldung/reactive/webflux/EmployeeControllerIntegrationTest.java @@ -15,7 +15,7 @@ import org.springframework.boot.test.mock.mockito.MockBean; import org.springframework.test.context.junit4.SpringRunner; import org.springframework.test.web.reactive.server.WebTestClient; -import com.baeldung.reactive.actuator.Spring5ReactiveApplication; +import com.baeldung.webflux.EmployeeSpringApplication; import com.baeldung.webflux.Employee; import com.baeldung.webflux.EmployeeRepository; @@ -23,7 +23,7 @@ import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; @RunWith(SpringRunner.class) -@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes=Spring5ReactiveApplication.class) +@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes=EmployeeSpringApplication.class) @FixMethodOrder(MethodSorters.NAME_ASCENDING) public class EmployeeControllerIntegrationTest { diff --git a/spring-5-reactive/README.md b/spring-5-reactive/README.md index 7977fd820f..fc898a56dc 100644 --- a/spring-5-reactive/README.md +++ b/spring-5-reactive/README.md @@ -14,3 +14,7 @@ The "REST With Spring" Classes: http://bit.ly/restwithspring - [Spring Webflux and CORS](http://www.baeldung.com/spring-webflux-cors) - [Handling Errors in Spring WebFlux](http://www.baeldung.com/spring-webflux-errors) - [Server-Sent Events in Spring](https://www.baeldung.com/spring-server-sent-events) +- [A Guide to Spring Session Reactive Support: WebSession](https://www.baeldung.com/spring-session-reactive) +- [Validation for Functional Endpoints in Spring 5](https://www.baeldung.com/spring-functional-endpoints-validation) +- [Logging a Reactive Sequence](https://www.baeldung.com/spring-reactive-sequence-logging) + diff --git a/spring-5-reactive/pom.xml b/spring-5-reactive/pom.xml index 5f455c3906..ab64d1e2fa 100644 --- a/spring-5-reactive/pom.xml +++ b/spring-5-reactive/pom.xml @@ -75,6 +75,33 @@ spring-boot-starter-test test + + org.springframework.security + spring-security-test + test + + + + + org.springframework.boot + spring-boot-starter-webflux + + + org.springframework.boot + spring-boot-starter-data-redis + + + org.springframework.boot + spring-boot-starter-security + + + org.springframework.session + spring-session-core + + + org.springframework.session + spring-session-data-redis + org.apache.commons @@ -94,12 +121,6 @@ ${project-reactor-test} test - - org.junit.platform - junit-platform-runner - ${junit.platform.version} - test - @@ -123,7 +144,6 @@ 1.0 4.1 3.1.6.RELEASE - 1.2.0 diff --git a/spring-5-reactive/src/main/java/com/baeldung/debugging/consumer/ConsumerDebuggingApplication.java b/spring-5-reactive/src/main/java/com/baeldung/debugging/consumer/ConsumerDebuggingApplication.java new file mode 100644 index 0000000000..486c5e77eb --- /dev/null +++ b/spring-5-reactive/src/main/java/com/baeldung/debugging/consumer/ConsumerDebuggingApplication.java @@ -0,0 +1,33 @@ +package com.baeldung.debugging.consumer; + +import java.util.Collections; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.boot.autoconfigure.mongo.MongoReactiveAutoConfiguration; +import org.springframework.context.annotation.Bean; +import org.springframework.scheduling.annotation.EnableScheduling; +import org.springframework.security.config.web.server.ServerHttpSecurity; +import org.springframework.security.web.server.SecurityWebFilterChain; + +import reactor.core.publisher.Hooks; + +@SpringBootApplication(exclude = MongoReactiveAutoConfiguration.class) +@EnableScheduling +public class ConsumerDebuggingApplication { + + public static void main(String[] args) { + Hooks.onOperatorDebug(); + SpringApplication app = new SpringApplication(ConsumerDebuggingApplication.class); + app.setDefaultProperties(Collections.singletonMap("server.port", "8082")); + app.run(args); + } + + @Bean + public SecurityWebFilterChain debuggingConsumerSpringSecurityFilterChain(ServerHttpSecurity http) { + http.authorizeExchange() + .anyExchange() + .permitAll(); + return http.build(); + } +} diff --git a/spring-5-reactive/src/main/java/com/baeldung/debugging/consumer/chronjobs/ChronJobs.java b/spring-5-reactive/src/main/java/com/baeldung/debugging/consumer/chronjobs/ChronJobs.java new file mode 100644 index 0000000000..bf96ab56d6 --- /dev/null +++ b/spring-5-reactive/src/main/java/com/baeldung/debugging/consumer/chronjobs/ChronJobs.java @@ -0,0 +1,154 @@ +package com.baeldung.debugging.consumer.chronjobs; + +import java.time.Duration; +import java.util.concurrent.ThreadLocalRandom; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.MediaType; +import org.springframework.scheduling.annotation.Scheduled; +import org.springframework.stereotype.Component; +import org.springframework.web.reactive.function.client.WebClient; + +import com.baeldung.debugging.consumer.model.Foo; +import com.baeldung.debugging.consumer.model.FooDto; +import com.baeldung.debugging.consumer.service.FooService; + +import reactor.core.publisher.Flux; + +@Component +public class ChronJobs { + + private static Logger logger = LoggerFactory.getLogger(ChronJobs.class); + private WebClient client = WebClient.create("http://localhost:8081"); + + @Autowired + private FooService service; + + @Scheduled(fixedRate = 10000) + public void consumeInfiniteFlux() { + Flux fluxFoo = client.get() + .uri("/functional-reactive/periodic-foo") + .accept(MediaType.TEXT_EVENT_STREAM) + .retrieve() + .bodyToFlux(FooDto.class) + .delayElements(Duration.ofMillis(100)) + .map(dto -> { + logger.debug("process 1 with dto id {} name{}", dto.getId(), dto.getName()); + return new Foo(dto); + }); + Integer random = ThreadLocalRandom.current() + .nextInt(0, 3); + switch (random) { + case 0: + logger.info("process 1 with approach 1"); + service.processFoo(fluxFoo); + break; + case 1: + logger.info("process 1 with approach 1 EH"); + service.processUsingApproachOneWithErrorHandling(fluxFoo); + break; + default: + logger.info("process 1 with approach 2"); + service.processFooInAnotherScenario(fluxFoo); + break; + + } + } + + @Scheduled(fixedRate = 20000) + public void consumeFiniteFlux2() { + Flux fluxFoo = client.get() + .uri("/functional-reactive/periodic-foo-2") + .accept(MediaType.TEXT_EVENT_STREAM) + .retrieve() + .bodyToFlux(FooDto.class) + .delayElements(Duration.ofMillis(100)) + .map(dto -> { + logger.debug("process 2 with dto id {} name{}", dto.getId(), dto.getName()); + return new Foo(dto); + }); + Integer random = ThreadLocalRandom.current() + .nextInt(0, 3); + switch (random) { + case 0: + logger.info("process 2 with approach 1"); + service.processFoo(fluxFoo); + break; + case 1: + logger.info("process 2 with approach 1 EH"); + service.processUsingApproachOneWithErrorHandling(fluxFoo); + break; + default: + logger.info("process 2 with approach 2"); + service.processFooInAnotherScenario(fluxFoo); + break; + + } + } + + @Scheduled(fixedRate = 20000) + public void consumeFiniteFlux3() { + Flux fluxFoo = client.get() + .uri("/functional-reactive/periodic-foo-2") + .accept(MediaType.TEXT_EVENT_STREAM) + .retrieve() + .bodyToFlux(FooDto.class) + .delayElements(Duration.ofMillis(100)) + .map(dto -> { + logger.debug("process 3 with dto id {} name{}", dto.getId(), dto.getName()); + return new Foo(dto); + }); + logger.info("process 3 with approach 3"); + service.processUsingApproachThree(fluxFoo); + } + + @Scheduled(fixedRate = 20000) + public void consumeFiniteFluxWithCheckpoint4() { + Flux fluxFoo = client.get() + .uri("/functional-reactive/periodic-foo-2") + .accept(MediaType.TEXT_EVENT_STREAM) + .retrieve() + .bodyToFlux(FooDto.class) + .delayElements(Duration.ofMillis(100)) + .map(dto -> { + logger.debug("process 4 with dto id {} name{}", dto.getId(), dto.getName()); + return new Foo(dto); + }); + logger.info("process 4 with approach 4"); + service.processUsingApproachFourWithCheckpoint(fluxFoo); + } + + @Scheduled(fixedRate = 20000) + public void consumeFiniteFluxWitParallelScheduler() { + Flux fluxFoo = client.get() + .uri("/functional-reactive/periodic-foo-2") + .accept(MediaType.TEXT_EVENT_STREAM) + .retrieve() + .bodyToFlux(FooDto.class) + .delayElements(Duration.ofMillis(100)) + .map(dto -> { + logger.debug("process 5-parallel with dto id {} name{}", dto.getId(), dto.getName()); + return new Foo(dto); + }); + logger.info("process 5-parallel with approach 5-parallel"); + service.processUsingApproachFivePublishingToDifferentParallelThreads(fluxFoo); + } + + @Scheduled(fixedRate = 20000) + public void consumeFiniteFluxWithSingleSchedulers() { + Flux fluxFoo = client.get() + .uri("/functional-reactive/periodic-foo-2") + .accept(MediaType.TEXT_EVENT_STREAM) + .retrieve() + .bodyToFlux(FooDto.class) + .delayElements(Duration.ofMillis(100)) + .map(dto -> { + logger.debug("process 5-single with dto id {} name{}", dto.getId(), dto.getName()); + return new Foo(dto); + }); + logger.info("process 5-single with approach 5-single"); + service.processUsingApproachFivePublishingToDifferentSingleThreads(fluxFoo); + } +} diff --git a/spring-5-reactive/src/main/java/com/baeldung/debugging/consumer/controllers/ReactiveConfigsToggleRestController.java b/spring-5-reactive/src/main/java/com/baeldung/debugging/consumer/controllers/ReactiveConfigsToggleRestController.java new file mode 100644 index 0000000000..3dcdc6c7c0 --- /dev/null +++ b/spring-5-reactive/src/main/java/com/baeldung/debugging/consumer/controllers/ReactiveConfigsToggleRestController.java @@ -0,0 +1,23 @@ +package com.baeldung.debugging.consumer.controllers; + +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RestController; + +import reactor.core.publisher.Hooks; + +@RestController +public class ReactiveConfigsToggleRestController { + + @GetMapping("/debug-hook-on") + public String setReactiveDebugOn() { + Hooks.onOperatorDebug(); + return "DEBUG HOOK ON"; + } + + @GetMapping("/debug-hook-off") + public String setReactiveDebugOff() { + Hooks.resetOnOperatorDebug(); + return "DEBUG HOOK OFF"; + } + +} diff --git a/spring-5-reactive/src/main/java/com/baeldung/debugging/consumer/model/Foo.java b/spring-5-reactive/src/main/java/com/baeldung/debugging/consumer/model/Foo.java new file mode 100644 index 0000000000..ac5093c261 --- /dev/null +++ b/spring-5-reactive/src/main/java/com/baeldung/debugging/consumer/model/Foo.java @@ -0,0 +1,31 @@ +package com.baeldung.debugging.consumer.model; + +import java.util.concurrent.ThreadLocalRandom; + +import org.springframework.data.annotation.Id; + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; + +@Getter +@Setter +@NoArgsConstructor +@AllArgsConstructor +public class Foo { + + @Id + private Integer id; + private String formattedName; + private Integer quantity; + + public Foo(FooDto dto) { + this.id = (ThreadLocalRandom.current() + .nextInt(0, 100) == 0) ? null : dto.getId(); + this.formattedName = dto.getName(); + this.quantity = ThreadLocalRandom.current() + .nextInt(0, 10); + } +} diff --git a/spring-5-reactive/src/main/java/com/baeldung/debugging/consumer/model/FooDto.java b/spring-5-reactive/src/main/java/com/baeldung/debugging/consumer/model/FooDto.java new file mode 100644 index 0000000000..33f19c4e60 --- /dev/null +++ b/spring-5-reactive/src/main/java/com/baeldung/debugging/consumer/model/FooDto.java @@ -0,0 +1,16 @@ +package com.baeldung.debugging.consumer.model; + +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; + +@Getter +@Setter +@NoArgsConstructor +@AllArgsConstructor +public class FooDto { + + private Integer id; + private String name; +} diff --git a/spring-5-reactive/src/main/java/com/baeldung/debugging/consumer/service/FooNameHelper.java b/spring-5-reactive/src/main/java/com/baeldung/debugging/consumer/service/FooNameHelper.java new file mode 100644 index 0000000000..772b360437 --- /dev/null +++ b/spring-5-reactive/src/main/java/com/baeldung/debugging/consumer/service/FooNameHelper.java @@ -0,0 +1,45 @@ +package com.baeldung.debugging.consumer.service; + +import java.util.concurrent.ThreadLocalRandom; + +import com.baeldung.debugging.consumer.model.Foo; + +import reactor.core.publisher.Flux; + +public class FooNameHelper { + + public static Flux concatAndSubstringFooName(Flux flux) { + flux = concatFooName(flux); + flux = substringFooName(flux); + return flux; + } + + public static Flux concatFooName(Flux flux) { + flux = flux.map(foo -> { + String processedName = null; + Integer random = ThreadLocalRandom.current() + .nextInt(0, 80); + processedName = (random != 0) ? foo.getFormattedName() : foo.getFormattedName() + "-bael"; + foo.setFormattedName(processedName); + return foo; + }); + return flux; + } + + public static Flux substringFooName(Flux flux) { + return flux.map(foo -> { + String processedName; + Integer random = ThreadLocalRandom.current() + .nextInt(0, 100); + + processedName = (random == 0) ? foo.getFormattedName() + .substring(10, 15) + : foo.getFormattedName() + .substring(0, 5); + + foo.setFormattedName(processedName); + return foo; + }); + } + +} diff --git a/spring-5-reactive/src/main/java/com/baeldung/debugging/consumer/service/FooQuantityHelper.java b/spring-5-reactive/src/main/java/com/baeldung/debugging/consumer/service/FooQuantityHelper.java new file mode 100644 index 0000000000..615239313d --- /dev/null +++ b/spring-5-reactive/src/main/java/com/baeldung/debugging/consumer/service/FooQuantityHelper.java @@ -0,0 +1,31 @@ +package com.baeldung.debugging.consumer.service; + +import java.util.concurrent.ThreadLocalRandom; + +import com.baeldung.debugging.consumer.model.Foo; + +import reactor.core.publisher.Flux; + +public class FooQuantityHelper { + + public static Flux processFooReducingQuantity(Flux flux) { + flux = flux.map(foo -> { + Integer result; + Integer random = ThreadLocalRandom.current() + .nextInt(0, 90); + result = (random == 0) ? result = 0 : foo.getQuantity() + 2; + foo.setQuantity(result); + return foo; + }); + return divideFooQuantity(flux); + } + + public static Flux divideFooQuantity(Flux flux) { + return flux.map(foo -> { + Integer result = Math.round(5 / foo.getQuantity()); + foo.setQuantity(result); + return foo; + }); + } + +} diff --git a/spring-5-reactive/src/main/java/com/baeldung/debugging/consumer/service/FooReporter.java b/spring-5-reactive/src/main/java/com/baeldung/debugging/consumer/service/FooReporter.java new file mode 100644 index 0000000000..f53cd238e0 --- /dev/null +++ b/spring-5-reactive/src/main/java/com/baeldung/debugging/consumer/service/FooReporter.java @@ -0,0 +1,26 @@ +package com.baeldung.debugging.consumer.service; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import com.baeldung.debugging.consumer.model.Foo; + +import reactor.core.publisher.Flux; + +public class FooReporter { + + private static Logger logger = LoggerFactory.getLogger(FooReporter.class); + + public static Flux reportResult(Flux input, String approach) { + return input.map(foo -> { + if (foo.getId() == null) + throw new IllegalArgumentException("Null id is not valid!"); + logger.info("Reporting for approach {}: Foo with id '{}' name '{}' and quantity '{}'", approach, foo.getId(), foo.getFormattedName(), foo.getQuantity()); + return foo; + }); + } + + public static Flux reportResult(Flux input) { + return reportResult(input, "default"); + } +} diff --git a/spring-5-reactive/src/main/java/com/baeldung/debugging/consumer/service/FooService.java b/spring-5-reactive/src/main/java/com/baeldung/debugging/consumer/service/FooService.java new file mode 100644 index 0000000000..438f6d473c --- /dev/null +++ b/spring-5-reactive/src/main/java/com/baeldung/debugging/consumer/service/FooService.java @@ -0,0 +1,120 @@ +package com.baeldung.debugging.consumer.service; + +import static com.baeldung.debugging.consumer.service.FooNameHelper.concatAndSubstringFooName; +import static com.baeldung.debugging.consumer.service.FooNameHelper.substringFooName; +import static com.baeldung.debugging.consumer.service.FooQuantityHelper.divideFooQuantity; +import static com.baeldung.debugging.consumer.service.FooQuantityHelper.processFooReducingQuantity; +import static com.baeldung.debugging.consumer.service.FooReporter.reportResult; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Component; + +import com.baeldung.debugging.consumer.model.Foo; + +import reactor.core.publisher.Flux; +import reactor.core.scheduler.Schedulers; + +@Component +public class FooService { + + private static Logger logger = LoggerFactory.getLogger(FooService.class); + + public void processFoo(Flux flux) { + flux = FooNameHelper.concatFooName(flux); + flux = FooNameHelper.substringFooName(flux); + flux = flux.log(); + flux = FooReporter.reportResult(flux); + flux = flux.doOnError(error -> { + logger.error("The following error happened on processFoo method!", error); + }); + flux.subscribe(); + } + + public void processFooInAnotherScenario(Flux flux) { + flux = FooNameHelper.substringFooName(flux); + flux = FooQuantityHelper.divideFooQuantity(flux); + flux.subscribe(); + } + + public void processUsingApproachOneWithErrorHandling(Flux flux) { + logger.info("starting approach one w error handling!"); + flux = concatAndSubstringFooName(flux); + flux = concatAndSubstringFooName(flux); + flux = substringFooName(flux); + flux = processFooReducingQuantity(flux); + flux = processFooReducingQuantity(flux); + flux = processFooReducingQuantity(flux); + flux = reportResult(flux, "ONE w/ EH"); + flux = flux.doOnError(error -> { + logger.error("Approach 1 with Error Handling failed!", error); + }); + flux.subscribe(); + } + + public void processUsingApproachThree(Flux flux) { + logger.info("starting approach three!"); + flux = concatAndSubstringFooName(flux); + flux = reportResult(flux, "THREE"); + flux = flux.doOnError(error -> { + logger.error("Approach 3 failed!", error); + }); + flux.subscribe(); + } + + public void processUsingApproachFourWithCheckpoint(Flux flux) { + logger.info("starting approach four!"); + flux = concatAndSubstringFooName(flux); + flux = flux.checkpoint("CHECKPOINT 1"); + flux = concatAndSubstringFooName(flux); + flux = divideFooQuantity(flux); + flux = flux.checkpoint("CHECKPOINT 2", true); + flux = reportResult(flux, "FOUR"); + flux = concatAndSubstringFooName(flux).doOnError(error -> { + logger.error("Approach 4 failed!", error); + }); + flux.subscribe(); + } + + public void processUsingApproachFourWithInitialCheckpoint(Flux flux) { + logger.info("starting approach four!"); + flux = concatAndSubstringFooName(flux); + flux = flux.checkpoint("CHECKPOINT 1", true); + flux = concatAndSubstringFooName(flux); + flux = divideFooQuantity(flux); + flux = reportResult(flux, "FOUR"); + flux = flux.doOnError(error -> { + logger.error("Approach 4-2 failed!", error); + }); + flux.subscribe(); + } + + public void processUsingApproachFivePublishingToDifferentParallelThreads(Flux flux) { + logger.info("starting approach five-parallel!"); + flux = concatAndSubstringFooName(flux).publishOn(Schedulers.newParallel("five-parallel-foo")) + .log(); + flux = concatAndSubstringFooName(flux); + flux = divideFooQuantity(flux); + flux = reportResult(flux, "FIVE-PARALLEL").publishOn(Schedulers.newSingle("five-parallel-bar")); + flux = concatAndSubstringFooName(flux).doOnError(error -> { + logger.error("Approach 5-parallel failed!", error); + }); + flux.subscribeOn(Schedulers.newParallel("five-parallel-starter")) + .subscribe(); + } + + public void processUsingApproachFivePublishingToDifferentSingleThreads(Flux flux) { + logger.info("starting approach five-single!"); + flux = flux.log() + .subscribeOn(Schedulers.newSingle("five-single-starter")); + flux = concatAndSubstringFooName(flux).publishOn(Schedulers.newSingle("five-single-foo")); + flux = concatAndSubstringFooName(flux); + flux = divideFooQuantity(flux); + flux = reportResult(flux, "FIVE-SINGLE").publishOn(Schedulers.newSingle("five-single-bar")); + flux = concatAndSubstringFooName(flux).doOnError(error -> { + logger.error("Approach 5-single failed!", error); + }); + flux.subscribe(); + } + +} diff --git a/spring-5-reactive/src/main/java/com/baeldung/debugging/server/ServerDebuggingApplication.java b/spring-5-reactive/src/main/java/com/baeldung/debugging/server/ServerDebuggingApplication.java new file mode 100644 index 0000000000..4fdc1dd137 --- /dev/null +++ b/spring-5-reactive/src/main/java/com/baeldung/debugging/server/ServerDebuggingApplication.java @@ -0,0 +1,29 @@ +package com.baeldung.debugging.server; + +import java.util.Collections; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.context.annotation.Bean; +import org.springframework.security.config.web.server.ServerHttpSecurity; +import org.springframework.security.web.server.SecurityWebFilterChain; +import org.springframework.web.reactive.config.EnableWebFlux; + +@EnableWebFlux +@SpringBootApplication +public class ServerDebuggingApplication { + + public static void main(String[] args) { + SpringApplication app = new SpringApplication(ServerDebuggingApplication.class); + app.setDefaultProperties(Collections.singletonMap("server.port", "8081")); + app.run(args); + } + + @Bean + public SecurityWebFilterChain debuggingServerSpringSecurityFilterChain(ServerHttpSecurity http) { + http.authorizeExchange() + .anyExchange() + .permitAll(); + return http.build(); + } +} diff --git a/spring-5-reactive/src/main/java/com/baeldung/debugging/server/handlers/ServerHandler.java b/spring-5-reactive/src/main/java/com/baeldung/debugging/server/handlers/ServerHandler.java new file mode 100644 index 0000000000..759cd9b01d --- /dev/null +++ b/spring-5-reactive/src/main/java/com/baeldung/debugging/server/handlers/ServerHandler.java @@ -0,0 +1,47 @@ +package com.baeldung.debugging.server.handlers; + +import java.time.Duration; +import java.util.concurrent.ThreadLocalRandom; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.http.MediaType; +import org.springframework.stereotype.Component; +import org.springframework.web.reactive.function.server.ServerRequest; +import org.springframework.web.reactive.function.server.ServerResponse; + +import com.baeldung.debugging.server.model.Foo; + +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +@Component +public class ServerHandler { + + private static Logger logger = LoggerFactory.getLogger(ServerHandler.class); + + public Mono useHandler(final ServerRequest request) { + // there are chances that something goes wrong here... + return ServerResponse.ok() + .contentType(MediaType.TEXT_EVENT_STREAM) + .body(Flux.interval(Duration.ofSeconds(1)) + .map(sequence -> { + logger.info("retrieving Foo. Sequence: {}", sequence); + if (ThreadLocalRandom.current() + .nextInt(0, 50) == 1) { + throw new RuntimeException("There was an error retrieving the Foo!"); + } + return new Foo(sequence, "name" + sequence); + + }), Foo.class); + } + + public Mono useHandlerFinite(final ServerRequest request) { + return ServerResponse.ok() + .contentType(MediaType.TEXT_EVENT_STREAM) + .body(Flux.range(0, 50) + .map(sequence -> { + return new Foo(new Long(sequence), "theFooNameNumber" + sequence); + }), Foo.class); + } +} diff --git a/spring-5-reactive/src/main/java/com/baeldung/debugging/server/model/Foo.java b/spring-5-reactive/src/main/java/com/baeldung/debugging/server/model/Foo.java new file mode 100644 index 0000000000..a60e468e7f --- /dev/null +++ b/spring-5-reactive/src/main/java/com/baeldung/debugging/server/model/Foo.java @@ -0,0 +1,16 @@ +package com.baeldung.debugging.server.model; + +import org.springframework.data.annotation.Id; + +import lombok.AllArgsConstructor; +import lombok.Data; + +@Data +@AllArgsConstructor +public class Foo { + + @Id + private Long id; + private String name; + +} diff --git a/spring-5-reactive/src/main/java/com/baeldung/debugging/server/routers/ServerRouter.java b/spring-5-reactive/src/main/java/com/baeldung/debugging/server/routers/ServerRouter.java new file mode 100644 index 0000000000..6378b2213d --- /dev/null +++ b/spring-5-reactive/src/main/java/com/baeldung/debugging/server/routers/ServerRouter.java @@ -0,0 +1,22 @@ +package com.baeldung.debugging.server.routers; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.web.reactive.function.server.RequestPredicates; +import org.springframework.web.reactive.function.server.RouterFunction; +import org.springframework.web.reactive.function.server.RouterFunctions; +import org.springframework.web.reactive.function.server.ServerResponse; + +import com.baeldung.debugging.server.handlers.ServerHandler; + +@Configuration +public class ServerRouter { + + @Bean + public RouterFunction responseRoute(@Autowired ServerHandler handler) { + return RouterFunctions.route(RequestPredicates.GET("/functional-reactive/periodic-foo"), handler::useHandler) + .andRoute(RequestPredicates.GET("/functional-reactive/periodic-foo-2"), handler::useHandlerFinite); + } + +} diff --git a/spring-5-reactive/src/main/java/com/baeldung/functional/FunctionalSpringBootApplication.java b/spring-5-reactive/src/main/java/com/baeldung/functional/FunctionalSpringBootApplication.java index a1d5d87d5c..9cbc1b7669 100644 --- a/spring-5-reactive/src/main/java/com/baeldung/functional/FunctionalSpringBootApplication.java +++ b/spring-5-reactive/src/main/java/com/baeldung/functional/FunctionalSpringBootApplication.java @@ -17,8 +17,6 @@ import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.web.servlet.ServletRegistrationBean; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.ComponentScan; -import org.springframework.context.annotation.Configuration; -import org.springframework.context.annotation.Profile; import org.springframework.core.io.ClassPathResource; import org.springframework.http.server.reactive.HttpHandler; import org.springframework.web.reactive.function.server.RouterFunction; @@ -40,11 +38,14 @@ public class FunctionalSpringBootApplication { private RouterFunction routingFunction() { FormHandler formHandler = new FormHandler(); - RouterFunction restfulRouter = route(GET("/"), serverRequest -> ok().body(Flux.fromIterable(actors), Actor.class)).andRoute(POST("/"), serverRequest -> serverRequest.bodyToMono(Actor.class) - .doOnNext(actors::add) - .then(ok().build())); + RouterFunction restfulRouter = route(GET("/"), + serverRequest -> ok().body(Flux.fromIterable(actors), Actor.class)).andRoute(POST("/"), + serverRequest -> serverRequest.bodyToMono(Actor.class) + .doOnNext(actors::add) + .then(ok().build())); - return route(GET("/test"), serverRequest -> ok().body(fromObject("helloworld"))).andRoute(POST("/login"), formHandler::handleLogin) + return route(GET("/test"), serverRequest -> ok().body(fromObject("helloworld"))) + .andRoute(POST("/login"), formHandler::handleLogin) .andRoute(POST("/upload"), formHandler::handleUpload) .and(RouterFunctions.resources("/files/**", new ClassPathResource("files/"))) .andNest(path("/actor"), restfulRouter) @@ -68,5 +69,4 @@ public class FunctionalSpringBootApplication { public static void main(String[] args) { SpringApplication.run(FunctionalSpringBootApplication.class, args); } - } diff --git a/spring-5-reactive/src/main/java/com/baeldung/reactive/Spring5ReactiveApplication.java b/spring-5-reactive/src/main/java/com/baeldung/reactive/Spring5ReactiveApplication.java index 1656f70221..a8cd18c470 100644 --- a/spring-5-reactive/src/main/java/com/baeldung/reactive/Spring5ReactiveApplication.java +++ b/spring-5-reactive/src/main/java/com/baeldung/reactive/Spring5ReactiveApplication.java @@ -1,9 +1,7 @@ package com.baeldung.reactive; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; -import org.springframework.context.annotation.Bean; @SpringBootApplication public class Spring5ReactiveApplication{ diff --git a/spring-5-reactive/src/main/java/com/baeldung/reactive/cors/annotated/CorsOnAnnotatedElementsApplication.java b/spring-5-reactive/src/main/java/com/baeldung/reactive/cors/annotated/CorsOnAnnotatedElementsApplication.java index d990928abe..69ae24b849 100644 --- a/spring-5-reactive/src/main/java/com/baeldung/reactive/cors/annotated/CorsOnAnnotatedElementsApplication.java +++ b/spring-5-reactive/src/main/java/com/baeldung/reactive/cors/annotated/CorsOnAnnotatedElementsApplication.java @@ -4,6 +4,9 @@ import java.util.Collections; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.context.annotation.Bean; +import org.springframework.security.config.web.server.ServerHttpSecurity; +import org.springframework.security.web.server.SecurityWebFilterChain; @SpringBootApplication public class CorsOnAnnotatedElementsApplication { @@ -14,4 +17,9 @@ public class CorsOnAnnotatedElementsApplication { app.run(args); } + @Bean + public SecurityWebFilterChain corsAnnotatedSpringSecurityFilterChain(ServerHttpSecurity http) { + http.csrf().disable(); + return http.build(); + } } diff --git a/spring-5-reactive/src/main/java/com/baeldung/reactive/cors/global/CorsGlobalConfigApplication.java b/spring-5-reactive/src/main/java/com/baeldung/reactive/cors/global/CorsGlobalConfigApplication.java index 8228944569..a70f937980 100644 --- a/spring-5-reactive/src/main/java/com/baeldung/reactive/cors/global/CorsGlobalConfigApplication.java +++ b/spring-5-reactive/src/main/java/com/baeldung/reactive/cors/global/CorsGlobalConfigApplication.java @@ -8,6 +8,9 @@ import org.springframework.boot.autoconfigure.data.mongo.MongoDataAutoConfigurat import org.springframework.boot.autoconfigure.data.mongo.MongoReactiveDataAutoConfiguration; import org.springframework.boot.autoconfigure.mongo.MongoAutoConfiguration; import org.springframework.boot.autoconfigure.mongo.MongoReactiveAutoConfiguration; +import org.springframework.context.annotation.Bean; +import org.springframework.security.config.web.server.ServerHttpSecurity; +import org.springframework.security.web.server.SecurityWebFilterChain; @SpringBootApplication(exclude = { MongoAutoConfiguration.class, MongoDataAutoConfiguration.class, @@ -22,4 +25,9 @@ public class CorsGlobalConfigApplication { app.run(args); } + @Bean + public SecurityWebFilterChain corsGlobalSpringSecurityFilterChain(ServerHttpSecurity http) { + http.csrf().disable(); + return http.build(); + } } diff --git a/spring-5-reactive/src/main/java/com/baeldung/reactive/cors/global/functional/handlers/FunctionalHandler.java b/spring-5-reactive/src/main/java/com/baeldung/reactive/cors/global/functional/handlers/CorsGlobalFunctionalHandler.java similarity index 93% rename from spring-5-reactive/src/main/java/com/baeldung/reactive/cors/global/functional/handlers/FunctionalHandler.java rename to spring-5-reactive/src/main/java/com/baeldung/reactive/cors/global/functional/handlers/CorsGlobalFunctionalHandler.java index e6e32d7cc8..d2b7af29a6 100644 --- a/spring-5-reactive/src/main/java/com/baeldung/reactive/cors/global/functional/handlers/FunctionalHandler.java +++ b/spring-5-reactive/src/main/java/com/baeldung/reactive/cors/global/functional/handlers/CorsGlobalFunctionalHandler.java @@ -7,7 +7,7 @@ import org.springframework.web.reactive.function.server.ServerResponse; import reactor.core.publisher.Mono; @Component -public class FunctionalHandler { +public class CorsGlobalFunctionalHandler { public Mono useHandler(final ServerRequest request) { final String responseMessage = "CORS GLOBAL CONFIG IS NOT EFFECTIVE ON FUNCTIONAL ENDPOINTS!!!"; diff --git a/spring-5-reactive/src/main/java/com/baeldung/reactive/cors/global/functional/routers/CorsRouterFunctions.java b/spring-5-reactive/src/main/java/com/baeldung/reactive/cors/global/functional/routers/CorsRouterFunctions.java index 19621a9e97..0a520828b9 100644 --- a/spring-5-reactive/src/main/java/com/baeldung/reactive/cors/global/functional/routers/CorsRouterFunctions.java +++ b/spring-5-reactive/src/main/java/com/baeldung/reactive/cors/global/functional/routers/CorsRouterFunctions.java @@ -8,13 +8,13 @@ import org.springframework.web.reactive.function.server.RouterFunction; import org.springframework.web.reactive.function.server.RouterFunctions; import org.springframework.web.reactive.function.server.ServerResponse; -import com.baeldung.reactive.cors.global.functional.handlers.FunctionalHandler; +import com.baeldung.reactive.cors.global.functional.handlers.CorsGlobalFunctionalHandler; @Configuration public class CorsRouterFunctions { @Bean - public RouterFunction responseHeaderRoute(@Autowired FunctionalHandler handler) { + public RouterFunction corsGlobalRouter(@Autowired CorsGlobalFunctionalHandler handler) { return RouterFunctions.route(RequestPredicates.PUT("/global-config-on-functional/cors-disabled-functional-endpoint"), handler::useHandler); } } diff --git a/spring-5-reactive/src/main/java/com/baeldung/reactive/cors/webfilter/CorsWebFilterApplication.java b/spring-5-reactive/src/main/java/com/baeldung/reactive/cors/webfilter/CorsWebFilterApplication.java index 38140c0d71..7792975768 100644 --- a/spring-5-reactive/src/main/java/com/baeldung/reactive/cors/webfilter/CorsWebFilterApplication.java +++ b/spring-5-reactive/src/main/java/com/baeldung/reactive/cors/webfilter/CorsWebFilterApplication.java @@ -8,6 +8,9 @@ import org.springframework.boot.autoconfigure.data.mongo.MongoDataAutoConfigurat import org.springframework.boot.autoconfigure.data.mongo.MongoReactiveDataAutoConfiguration; import org.springframework.boot.autoconfigure.mongo.MongoAutoConfiguration; import org.springframework.boot.autoconfigure.mongo.MongoReactiveAutoConfiguration; +import org.springframework.context.annotation.Bean; +import org.springframework.security.config.web.server.ServerHttpSecurity; +import org.springframework.security.web.server.SecurityWebFilterChain; @SpringBootApplication(exclude = { MongoAutoConfiguration.class, MongoDataAutoConfiguration.class, @@ -21,5 +24,11 @@ public class CorsWebFilterApplication { app.setDefaultProperties(Collections.singletonMap("server.port", "8083")); app.run(args); } + + @Bean + public SecurityWebFilterChain corsWebfilterSpringSecurityFilterChain(ServerHttpSecurity http) { + http.csrf().disable(); + return http.build(); + } } diff --git a/spring-5-reactive/src/main/java/com/baeldung/reactive/cors/webfilter/functional/routers/CorsWithWebFilterRouterFunctions.java b/spring-5-reactive/src/main/java/com/baeldung/reactive/cors/webfilter/functional/routers/CorsWithWebFilterRouterFunctions.java index a3905bb79f..6056b9bf5a 100644 --- a/spring-5-reactive/src/main/java/com/baeldung/reactive/cors/webfilter/functional/routers/CorsWithWebFilterRouterFunctions.java +++ b/spring-5-reactive/src/main/java/com/baeldung/reactive/cors/webfilter/functional/routers/CorsWithWebFilterRouterFunctions.java @@ -14,7 +14,7 @@ import com.baeldung.reactive.cors.webfilter.functional.handlers.CorsWithWebFilte public class CorsWithWebFilterRouterFunctions { @Bean - public RouterFunction responseHeaderRoute(@Autowired CorsWithWebFilterHandler handler) { + public RouterFunction corsWebfilterRouter(@Autowired CorsWithWebFilterHandler handler) { return RouterFunctions.route(RequestPredicates.PUT("/web-filter-on-functional/functional-endpoint"), handler::useHandler); } } diff --git a/spring-5-reactive/src/main/java/com/baeldung/reactive/serversentevents/consumer/ConsumerSSEApplication.java b/spring-5-reactive/src/main/java/com/baeldung/reactive/serversentevents/consumer/ConsumerSSEApplication.java index 3997607ef0..d8edaf7fd5 100644 --- a/spring-5-reactive/src/main/java/com/baeldung/reactive/serversentevents/consumer/ConsumerSSEApplication.java +++ b/spring-5-reactive/src/main/java/com/baeldung/reactive/serversentevents/consumer/ConsumerSSEApplication.java @@ -4,9 +4,13 @@ import java.util.Collections; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.boot.autoconfigure.data.redis.RedisReactiveAutoConfiguration; +import org.springframework.context.annotation.Bean; import org.springframework.scheduling.annotation.EnableAsync; +import org.springframework.security.config.web.server.ServerHttpSecurity; +import org.springframework.security.web.server.SecurityWebFilterChain; -@SpringBootApplication +@SpringBootApplication(exclude = { RedisReactiveAutoConfiguration.class }) @EnableAsync public class ConsumerSSEApplication { @@ -15,5 +19,13 @@ public class ConsumerSSEApplication { app.setDefaultProperties(Collections.singletonMap("server.port", "8082")); app.run(args); } + + @Bean + public SecurityWebFilterChain sseConsumerSpringSecurityFilterChain(ServerHttpSecurity http) { + http.authorizeExchange() + .anyExchange() + .permitAll(); + return http.build(); + } } diff --git a/spring-5-reactive/src/main/java/com/baeldung/reactive/serversentevents/server/ServerSSEApplication.java b/spring-5-reactive/src/main/java/com/baeldung/reactive/serversentevents/server/ServerSSEApplication.java index 2750e6616d..c040b83da0 100644 --- a/spring-5-reactive/src/main/java/com/baeldung/reactive/serversentevents/server/ServerSSEApplication.java +++ b/spring-5-reactive/src/main/java/com/baeldung/reactive/serversentevents/server/ServerSSEApplication.java @@ -4,14 +4,26 @@ import java.util.Collections; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.boot.autoconfigure.data.redis.RedisReactiveAutoConfiguration; +import org.springframework.context.annotation.Bean; +import org.springframework.security.config.web.server.ServerHttpSecurity; +import org.springframework.security.web.server.SecurityWebFilterChain; -@SpringBootApplication +@SpringBootApplication(exclude = { RedisReactiveAutoConfiguration.class }) public class ServerSSEApplication { - + public static void main(String[] args) { SpringApplication app = new SpringApplication(ServerSSEApplication.class); app.setDefaultProperties(Collections.singletonMap("server.port", "8081")); app.run(args); } + @Bean + public SecurityWebFilterChain sseServerSpringSecurityFilterChain(ServerHttpSecurity http) { + http.authorizeExchange() + .anyExchange() + .permitAll(); + return http.build(); + } + } diff --git a/spring-5-reactive/src/main/java/com/baeldung/validations/functional/FunctionalValidationsApplication.java b/spring-5-reactive/src/main/java/com/baeldung/validations/functional/FunctionalValidationsApplication.java new file mode 100644 index 0000000000..4cbb65dc60 --- /dev/null +++ b/spring-5-reactive/src/main/java/com/baeldung/validations/functional/FunctionalValidationsApplication.java @@ -0,0 +1,24 @@ +package com.baeldung.validations.functional; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.context.annotation.Bean; +import org.springframework.security.config.web.server.ServerHttpSecurity; +import org.springframework.security.web.server.SecurityWebFilterChain; + +@SpringBootApplication +public class FunctionalValidationsApplication { + + public static void main(String[] args) { + SpringApplication.run(FunctionalValidationsApplication.class, args); + } + + @Bean + public SecurityWebFilterChain functionalValidationsSpringSecurityFilterChain(ServerHttpSecurity http) { + http.authorizeExchange() + .anyExchange() + .permitAll(); + http.csrf().disable(); + return http.build(); + } +} diff --git a/spring-5-reactive/src/main/java/com/baeldung/validations/functional/handlers/AbstractValidationHandler.java b/spring-5-reactive/src/main/java/com/baeldung/validations/functional/handlers/AbstractValidationHandler.java new file mode 100644 index 0000000000..f34c1ee8d8 --- /dev/null +++ b/spring-5-reactive/src/main/java/com/baeldung/validations/functional/handlers/AbstractValidationHandler.java @@ -0,0 +1,45 @@ +package com.baeldung.validations.functional.handlers; + +import org.springframework.http.HttpStatus; +import org.springframework.validation.BeanPropertyBindingResult; +import org.springframework.validation.Errors; +import org.springframework.validation.Validator; +import org.springframework.web.reactive.function.server.ServerRequest; +import org.springframework.web.reactive.function.server.ServerResponse; +import org.springframework.web.server.ResponseStatusException; + +import reactor.core.publisher.Mono; + +public abstract class AbstractValidationHandler { + + private final Class validationClass; + + private final U validator; + + protected AbstractValidationHandler(Class clazz, U validator) { + this.validationClass = clazz; + this.validator = validator; + } + + abstract protected Mono processBody(T validBody, final ServerRequest originalRequest); + + public final Mono handleRequest(final ServerRequest request) { + return request.bodyToMono(this.validationClass) + .flatMap(body -> { + Errors errors = new BeanPropertyBindingResult(body, this.validationClass.getName()); + this.validator.validate(body, errors); + + if (errors == null || errors.getAllErrors() + .isEmpty()) { + return processBody(body, request); + } else { + return onValidationErrors(errors, body, request); + } + }); + } + + protected Mono onValidationErrors(Errors errors, T invalidBody, final ServerRequest request) { + throw new ResponseStatusException(HttpStatus.BAD_REQUEST, errors.getAllErrors() + .toString()); + } +} diff --git a/spring-5-reactive/src/main/java/com/baeldung/validations/functional/handlers/FunctionalHandler.java b/spring-5-reactive/src/main/java/com/baeldung/validations/functional/handlers/FunctionalHandler.java new file mode 100644 index 0000000000..d7e3bd0bc0 --- /dev/null +++ b/spring-5-reactive/src/main/java/com/baeldung/validations/functional/handlers/FunctionalHandler.java @@ -0,0 +1,43 @@ +package com.baeldung.validations.functional.handlers; + +import org.springframework.http.HttpStatus; +import org.springframework.http.MediaType; +import org.springframework.stereotype.Component; +import org.springframework.validation.BeanPropertyBindingResult; +import org.springframework.validation.Errors; +import org.springframework.validation.Validator; +import org.springframework.web.reactive.function.server.ServerRequest; +import org.springframework.web.reactive.function.server.ServerResponse; +import org.springframework.web.server.ResponseStatusException; + +import com.baeldung.validations.functional.model.CustomRequestEntity; +import com.baeldung.validations.functional.validators.CustomRequestEntityValidator; + +import reactor.core.publisher.Mono; + +@Component +public class FunctionalHandler { + + public Mono handleRequest(final ServerRequest request) { + Validator validator = new CustomRequestEntityValidator(); + Mono responseBody = request.bodyToMono(CustomRequestEntity.class) + .map(body -> { + Errors errors = new BeanPropertyBindingResult(body, CustomRequestEntity.class.getName()); + validator.validate(body, errors); + + if (errors == null || errors.getAllErrors() + .isEmpty()) { + return String.format("Hi, %s [%s]!", body.getName(), body.getCode()); + + } else { + throw new ResponseStatusException(HttpStatus.BAD_REQUEST, errors.getAllErrors() + .toString()); + } + + }); + return ServerResponse.ok() + .contentType(MediaType.APPLICATION_JSON) + .body(responseBody, String.class); + + } +} diff --git a/spring-5-reactive/src/main/java/com/baeldung/validations/functional/handlers/impl/AnnotatedRequestEntityValidationHandler.java b/spring-5-reactive/src/main/java/com/baeldung/validations/functional/handlers/impl/AnnotatedRequestEntityValidationHandler.java new file mode 100644 index 0000000000..2011679741 --- /dev/null +++ b/spring-5-reactive/src/main/java/com/baeldung/validations/functional/handlers/impl/AnnotatedRequestEntityValidationHandler.java @@ -0,0 +1,30 @@ +package com.baeldung.validations.functional.handlers.impl; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.http.MediaType; +import org.springframework.stereotype.Component; +import org.springframework.validation.Validator; +import org.springframework.web.reactive.function.server.ServerRequest; +import org.springframework.web.reactive.function.server.ServerResponse; + +import com.baeldung.validations.functional.handlers.AbstractValidationHandler; +import com.baeldung.validations.functional.model.AnnotatedRequestEntity; + +import reactor.core.publisher.Mono; + +@Component +public class AnnotatedRequestEntityValidationHandler extends AbstractValidationHandler { + + private AnnotatedRequestEntityValidationHandler(@Autowired Validator validator) { + super(AnnotatedRequestEntity.class, validator); + } + + @Override + protected Mono processBody(AnnotatedRequestEntity validBody, ServerRequest originalRequest) { + String responseBody = String.format("Hi, %s. Password: %s!", validBody.getUser(), validBody.getPassword()); + return ServerResponse.ok() + .contentType(MediaType.APPLICATION_JSON) + .body(Mono.just(responseBody), String.class); + } +} diff --git a/spring-5-reactive/src/main/java/com/baeldung/validations/functional/handlers/impl/CustomRequestEntityValidationHandler.java b/spring-5-reactive/src/main/java/com/baeldung/validations/functional/handlers/impl/CustomRequestEntityValidationHandler.java new file mode 100644 index 0000000000..34630c60b2 --- /dev/null +++ b/spring-5-reactive/src/main/java/com/baeldung/validations/functional/handlers/impl/CustomRequestEntityValidationHandler.java @@ -0,0 +1,37 @@ +package com.baeldung.validations.functional.handlers.impl; + +import org.springframework.http.MediaType; +import org.springframework.stereotype.Component; +import org.springframework.validation.Errors; +import org.springframework.web.reactive.function.server.ServerRequest; +import org.springframework.web.reactive.function.server.ServerResponse; + +import com.baeldung.validations.functional.handlers.AbstractValidationHandler; +import com.baeldung.validations.functional.model.CustomRequestEntity; +import com.baeldung.validations.functional.validators.CustomRequestEntityValidator; + +import reactor.core.publisher.Mono; + +@Component +public class CustomRequestEntityValidationHandler extends AbstractValidationHandler { + + private CustomRequestEntityValidationHandler() { + super(CustomRequestEntity.class, new CustomRequestEntityValidator()); + } + + @Override + protected Mono processBody(CustomRequestEntity validBody, ServerRequest originalRequest) { + String responseBody = String.format("Hi, %s [%s]!", validBody.getName(), validBody.getCode()); + return ServerResponse.ok() + .contentType(MediaType.APPLICATION_JSON) + .body(Mono.just(responseBody), String.class); + } + + @Override + protected Mono onValidationErrors(Errors errors, CustomRequestEntity invalidBody, final ServerRequest request) { + return ServerResponse.badRequest() + .contentType(MediaType.APPLICATION_JSON) + .body(Mono.just(String.format("Custom message showing the errors: %s", errors.getAllErrors() + .toString())), String.class); + } +} diff --git a/spring-5-reactive/src/main/java/com/baeldung/validations/functional/handlers/impl/OtherEntityValidationHandler.java b/spring-5-reactive/src/main/java/com/baeldung/validations/functional/handlers/impl/OtherEntityValidationHandler.java new file mode 100644 index 0000000000..0196287d13 --- /dev/null +++ b/spring-5-reactive/src/main/java/com/baeldung/validations/functional/handlers/impl/OtherEntityValidationHandler.java @@ -0,0 +1,28 @@ +package com.baeldung.validations.functional.handlers.impl; + +import org.springframework.http.MediaType; +import org.springframework.stereotype.Component; +import org.springframework.web.reactive.function.server.ServerRequest; +import org.springframework.web.reactive.function.server.ServerResponse; + +import com.baeldung.validations.functional.handlers.AbstractValidationHandler; +import com.baeldung.validations.functional.model.OtherEntity; +import com.baeldung.validations.functional.validators.OtherEntityValidator; + +import reactor.core.publisher.Mono; + +@Component +public class OtherEntityValidationHandler extends AbstractValidationHandler { + + private OtherEntityValidationHandler() { + super(OtherEntity.class, new OtherEntityValidator()); + } + + @Override + protected Mono processBody(OtherEntity validBody, ServerRequest originalRequest) { + String responseBody = String.format("Other object with item %s and quantity %s!", validBody.getItem(), validBody.getQuantity()); + return ServerResponse.ok() + .contentType(MediaType.APPLICATION_JSON) + .body(Mono.just(responseBody), String.class); + } +} diff --git a/spring-5-reactive/src/main/java/com/baeldung/validations/functional/model/AnnotatedRequestEntity.java b/spring-5-reactive/src/main/java/com/baeldung/validations/functional/model/AnnotatedRequestEntity.java new file mode 100644 index 0000000000..992f07481c --- /dev/null +++ b/spring-5-reactive/src/main/java/com/baeldung/validations/functional/model/AnnotatedRequestEntity.java @@ -0,0 +1,23 @@ +package com.baeldung.validations.functional.model; + +import javax.validation.constraints.NotNull; +import javax.validation.constraints.Size; + +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; + +@AllArgsConstructor +@NoArgsConstructor +@Getter +@Setter +public class AnnotatedRequestEntity { + @NotNull + private String user; + + @NotNull + @Size(min = 4, max = 7) + private String password; + +} diff --git a/spring-5-reactive/src/main/java/com/baeldung/validations/functional/model/CustomRequestEntity.java b/spring-5-reactive/src/main/java/com/baeldung/validations/functional/model/CustomRequestEntity.java new file mode 100644 index 0000000000..ed459f121b --- /dev/null +++ b/spring-5-reactive/src/main/java/com/baeldung/validations/functional/model/CustomRequestEntity.java @@ -0,0 +1,17 @@ +package com.baeldung.validations.functional.model; + +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; + +@AllArgsConstructor +@NoArgsConstructor +@Getter +@Setter +public class CustomRequestEntity { + + private String name; + private String code; + +} diff --git a/spring-5-reactive/src/main/java/com/baeldung/validations/functional/model/OtherEntity.java b/spring-5-reactive/src/main/java/com/baeldung/validations/functional/model/OtherEntity.java new file mode 100644 index 0000000000..78667cb13d --- /dev/null +++ b/spring-5-reactive/src/main/java/com/baeldung/validations/functional/model/OtherEntity.java @@ -0,0 +1,17 @@ +package com.baeldung.validations.functional.model; + +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; + +@AllArgsConstructor +@NoArgsConstructor +@Getter +@Setter +public class OtherEntity { + + private String item; + private Integer quantity; + +} diff --git a/spring-5-reactive/src/main/java/com/baeldung/validations/functional/routers/ValidationsRouters.java b/spring-5-reactive/src/main/java/com/baeldung/validations/functional/routers/ValidationsRouters.java new file mode 100644 index 0000000000..29582a0b0f --- /dev/null +++ b/spring-5-reactive/src/main/java/com/baeldung/validations/functional/routers/ValidationsRouters.java @@ -0,0 +1,29 @@ +package com.baeldung.validations.functional.routers; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.web.reactive.function.server.RequestPredicates; +import org.springframework.web.reactive.function.server.RouterFunction; +import org.springframework.web.reactive.function.server.RouterFunctions; +import org.springframework.web.reactive.function.server.ServerResponse; + +import com.baeldung.validations.functional.handlers.FunctionalHandler; +import com.baeldung.validations.functional.handlers.impl.AnnotatedRequestEntityValidationHandler; +import com.baeldung.validations.functional.handlers.impl.CustomRequestEntityValidationHandler; +import com.baeldung.validations.functional.handlers.impl.OtherEntityValidationHandler; + +@Configuration +public class ValidationsRouters { + + @Bean + public RouterFunction validationsRouter(@Autowired CustomRequestEntityValidationHandler dryHandler, + @Autowired FunctionalHandler complexHandler, + @Autowired OtherEntityValidationHandler otherHandler, + @Autowired AnnotatedRequestEntityValidationHandler annotatedEntityHandler) { + return RouterFunctions.route(RequestPredicates.POST("/complex-handler-functional-validation"), complexHandler::handleRequest) + .andRoute(RequestPredicates.POST("/dry-functional-validation"), dryHandler::handleRequest) + .andRoute(RequestPredicates.POST("/other-dry-functional-validation"), otherHandler::handleRequest) + .andRoute(RequestPredicates.POST("/annotated-functional-validation"), annotatedEntityHandler::handleRequest); + } +} diff --git a/spring-5-reactive/src/main/java/com/baeldung/validations/functional/validators/CustomRequestEntityValidator.java b/spring-5-reactive/src/main/java/com/baeldung/validations/functional/validators/CustomRequestEntityValidator.java new file mode 100644 index 0000000000..085d477318 --- /dev/null +++ b/spring-5-reactive/src/main/java/com/baeldung/validations/functional/validators/CustomRequestEntityValidator.java @@ -0,0 +1,29 @@ +package com.baeldung.validations.functional.validators; + +import org.springframework.validation.Errors; +import org.springframework.validation.ValidationUtils; +import org.springframework.validation.Validator; + +import com.baeldung.validations.functional.model.CustomRequestEntity; + +public class CustomRequestEntityValidator implements Validator { + + private static final int MINIMUM_CODE_LENGTH = 6; + + @Override + public boolean supports(Class clazz) { + return CustomRequestEntity.class.isAssignableFrom(clazz); + } + + @Override + public void validate(Object target, Errors errors) { + ValidationUtils.rejectIfEmptyOrWhitespace(errors, "name", "field.required"); + ValidationUtils.rejectIfEmptyOrWhitespace(errors, "code", "field.required"); + CustomRequestEntity request = (CustomRequestEntity) target; + if (request.getCode() != null && request.getCode() + .trim() + .length() < MINIMUM_CODE_LENGTH) { + errors.rejectValue("code", "field.min.length", new Object[] { Integer.valueOf(MINIMUM_CODE_LENGTH) }, "The code must be at least [" + MINIMUM_CODE_LENGTH + "] characters in length."); + } + } +} diff --git a/spring-5-reactive/src/main/java/com/baeldung/validations/functional/validators/OtherEntityValidator.java b/spring-5-reactive/src/main/java/com/baeldung/validations/functional/validators/OtherEntityValidator.java new file mode 100644 index 0000000000..18c2c28cfe --- /dev/null +++ b/spring-5-reactive/src/main/java/com/baeldung/validations/functional/validators/OtherEntityValidator.java @@ -0,0 +1,27 @@ +package com.baeldung.validations.functional.validators; + +import org.springframework.validation.Errors; +import org.springframework.validation.ValidationUtils; +import org.springframework.validation.Validator; + +import com.baeldung.validations.functional.model.OtherEntity; + +public class OtherEntityValidator implements Validator { + + private static final int MIN_ITEM_QUANTITY = 1; + + @Override + public boolean supports(Class clazz) { + return OtherEntity.class.isAssignableFrom(clazz); + } + + @Override + public void validate(Object target, Errors errors) { + ValidationUtils.rejectIfEmptyOrWhitespace(errors, "item", "field.required"); + ValidationUtils.rejectIfEmptyOrWhitespace(errors, "quantity", "field.required"); + OtherEntity request = (OtherEntity) target; + if (request.getQuantity() != null && request.getQuantity() < MIN_ITEM_QUANTITY) { + errors.rejectValue("quantity", "field.min.length", new Object[] { Integer.valueOf(MIN_ITEM_QUANTITY) }, "There must be at least one item"); + } + } +} diff --git a/spring-5-reactive/src/main/java/com/baeldung/webflux/logging/WebFluxLoggingExample.java b/spring-5-reactive/src/main/java/com/baeldung/webflux/logging/WebFluxLoggingExample.java new file mode 100644 index 0000000000..c4881b2296 --- /dev/null +++ b/spring-5-reactive/src/main/java/com/baeldung/webflux/logging/WebFluxLoggingExample.java @@ -0,0 +1,21 @@ +package com.baeldung.webflux.logging; + +import reactor.core.publisher.Flux; + +public class WebFluxLoggingExample { + + public static void main(String[] args) { + Flux reactiveStream = Flux.range(1, 5).log(); + + reactiveStream.subscribe(); + + reactiveStream = Flux.range(1, 5).log().take(3); + + reactiveStream.subscribe(); + + reactiveStream = Flux.range(1, 5).take(3).log(); + + reactiveStream.subscribe(); + } + +} diff --git a/spring-custom-aop/src/main/java/com/baeldung/utils/Application.java b/spring-5-reactive/src/main/java/com/baeldung/websession/Application.java similarity index 69% rename from spring-custom-aop/src/main/java/com/baeldung/utils/Application.java rename to spring-5-reactive/src/main/java/com/baeldung/websession/Application.java index 46cf3fb4aa..667ef29658 100644 --- a/spring-custom-aop/src/main/java/com/baeldung/utils/Application.java +++ b/spring-5-reactive/src/main/java/com/baeldung/websession/Application.java @@ -1,18 +1,15 @@ -package com.baeldung.utils; - -import javax.annotation.security.RolesAllowed; +package com.baeldung.websession; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.context.annotation.ComponentScan; @SpringBootApplication -@ComponentScan(basePackages = "com.baeldung.utils") +@ComponentScan(basePackages = {"com.baeldung"}) public class Application { - @RolesAllowed("*") public static void main(String[] args) { SpringApplication.run(Application.class, args); } -} +} \ No newline at end of file diff --git a/spring-5-reactive/src/main/java/com/baeldung/websession/configuration/RedisConfig.java b/spring-5-reactive/src/main/java/com/baeldung/websession/configuration/RedisConfig.java new file mode 100644 index 0000000000..aa85cf9fd9 --- /dev/null +++ b/spring-5-reactive/src/main/java/com/baeldung/websession/configuration/RedisConfig.java @@ -0,0 +1,17 @@ +package com.baeldung.websession.configuration; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory; +import org.springframework.session.data.redis.config.annotation.web.server.EnableRedisWebSession; + +@Configuration +//@EnableRedisWebSession +public class RedisConfig { +/** + @Bean + public LettuceConnectionFactory redisConnectionFactory() { + return new LettuceConnectionFactory(); + } +*/ +} \ No newline at end of file diff --git a/spring-5-reactive/src/main/java/com/baeldung/websession/configuration/SessionConfig.java b/spring-5-reactive/src/main/java/com/baeldung/websession/configuration/SessionConfig.java new file mode 100644 index 0000000000..7cb2ff680e --- /dev/null +++ b/spring-5-reactive/src/main/java/com/baeldung/websession/configuration/SessionConfig.java @@ -0,0 +1,20 @@ +package com.baeldung.websession.configuration; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.session.ReactiveMapSessionRepository; +import org.springframework.session.ReactiveSessionRepository; +import org.springframework.session.config.annotation.web.server.EnableSpringWebSession; + +import java.util.concurrent.ConcurrentHashMap; + +@Configuration +@EnableSpringWebSession +public class SessionConfig { + + @Bean + public ReactiveSessionRepository reactiveSessionRepository() { + return new ReactiveMapSessionRepository(new ConcurrentHashMap<>()); + } + +} diff --git a/spring-5-reactive/src/main/java/com/baeldung/websession/configuration/WebFluxConfig.java b/spring-5-reactive/src/main/java/com/baeldung/websession/configuration/WebFluxConfig.java new file mode 100644 index 0000000000..964b544916 --- /dev/null +++ b/spring-5-reactive/src/main/java/com/baeldung/websession/configuration/WebFluxConfig.java @@ -0,0 +1,20 @@ +package com.baeldung.websession.configuration; + +import org.springframework.context.ApplicationContext; +import org.springframework.context.ApplicationContextAware; +import org.springframework.context.annotation.Configuration; +import org.springframework.web.reactive.config.EnableWebFlux; +import org.springframework.web.reactive.config.ResourceHandlerRegistry; +import org.springframework.web.reactive.config.WebFluxConfigurer; + +@Configuration +@EnableWebFlux +public class WebFluxConfig implements ApplicationContextAware, WebFluxConfigurer { + + private ApplicationContext context; + + @Override + public void setApplicationContext(ApplicationContext context) { + this.context = context; + } +} diff --git a/spring-5-reactive/src/main/java/com/baeldung/websession/configuration/WebFluxSecurityConfig.java b/spring-5-reactive/src/main/java/com/baeldung/websession/configuration/WebFluxSecurityConfig.java new file mode 100644 index 0000000000..61927e47ab --- /dev/null +++ b/spring-5-reactive/src/main/java/com/baeldung/websession/configuration/WebFluxSecurityConfig.java @@ -0,0 +1,56 @@ +package com.baeldung.websession.configuration; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.security.config.annotation.web.reactive.EnableWebFluxSecurity; +import org.springframework.security.config.web.server.ServerHttpSecurity; +import org.springframework.security.core.userdetails.MapReactiveUserDetailsService; +import org.springframework.security.core.userdetails.User; +import org.springframework.security.core.userdetails.UserDetails; +import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; +import org.springframework.security.crypto.password.PasswordEncoder; +import org.springframework.security.web.server.SecurityWebFilterChain; +import org.springframework.security.web.server.context.WebSessionServerSecurityContextRepository; + +@Configuration +@EnableWebFluxSecurity +public class WebFluxSecurityConfig { + + @Bean + public MapReactiveUserDetailsService userDetailsService() { + UserDetails admin = User + .withUsername("admin") + .password(encoder().encode("password")) + .roles("ADMIN") + .build(); + + UserDetails user = User + .withUsername("user") + .password(encoder().encode("password")) + .roles("USER") + .build(); + + return new MapReactiveUserDetailsService(admin, user); + } + + @Bean + public SecurityWebFilterChain webSessionSpringSecurityFilterChain(ServerHttpSecurity http) { + http.authorizeExchange() + .anyExchange().authenticated() + .and() + .httpBasic() + .securityContextRepository(new WebSessionServerSecurityContextRepository()) + .and() + .formLogin(); + + http.csrf().disable(); + + return http.build(); + + } + + @Bean + public PasswordEncoder encoder() { + return new BCryptPasswordEncoder(); + } +} diff --git a/spring-5-reactive/src/main/java/com/baeldung/websession/controller/SessionController.java b/spring-5-reactive/src/main/java/com/baeldung/websession/controller/SessionController.java new file mode 100644 index 0000000000..b91a050322 --- /dev/null +++ b/spring-5-reactive/src/main/java/com/baeldung/websession/controller/SessionController.java @@ -0,0 +1,42 @@ +package com.baeldung.websession.controller; + +import com.baeldung.websession.transfer.CustomResponse; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.server.WebSession; +import reactor.core.publisher.Mono; + +@RestController +public class SessionController { + + @GetMapping("/websession/test") + public Mono testWebSessionByParam( + @RequestParam(value = "id") int id, + @RequestParam(value = "note") String note, + WebSession session) { + + session.getAttributes().put("id", id); + session.getAttributes().put("note", note); + + CustomResponse r = new CustomResponse(); + r.setId((int) session.getAttributes().get("id")); + r.setNote((String) session.getAttributes().get("note")); + + return Mono.just(r); + } + + @GetMapping("/websession") + public Mono getSession(WebSession session) { + + session.getAttributes().putIfAbsent("id", 0); + session.getAttributes().putIfAbsent("note", "Howdy Cosmic Spheroid!"); + + CustomResponse r = new CustomResponse(); + r.setId((int) session.getAttributes().get("id")); + r.setNote((String) session.getAttributes().get("note")); + + return Mono.just(r); + } + +} \ No newline at end of file diff --git a/spring-5-reactive/src/main/java/com/baeldung/websession/transfer/CustomResponse.java b/spring-5-reactive/src/main/java/com/baeldung/websession/transfer/CustomResponse.java new file mode 100644 index 0000000000..2d562de157 --- /dev/null +++ b/spring-5-reactive/src/main/java/com/baeldung/websession/transfer/CustomResponse.java @@ -0,0 +1,31 @@ +package com.baeldung.websession.transfer; + +public class CustomResponse { + + private int id; + private String note; + + public CustomResponse() {} + + public CustomResponse(int id, String note) { + this.id = id; + this.note = note; + } + + public int getId() { + return id; + } + + public void setId(int id) { + this.id = id; + } + + public String getNote() { + return note; + } + + public void setNote(String note) { + this.note = note; + } + +} diff --git a/spring-5-reactive/src/main/resources/application.properties b/spring-5-reactive/src/main/resources/application.properties index 92f3116f84..4b49e8e8a2 100644 --- a/spring-5-reactive/src/main/resources/application.properties +++ b/spring-5-reactive/src/main/resources/application.properties @@ -1,2 +1 @@ -logging.level.root=INFO - +logging.level.root=INFO \ No newline at end of file diff --git a/spring-5-reactive/src/test/java/com/baeldung/debugging/consumer/ConsumerFooServiceIntegrationTest.java b/spring-5-reactive/src/test/java/com/baeldung/debugging/consumer/ConsumerFooServiceIntegrationTest.java new file mode 100644 index 0000000000..b7ed031ec7 --- /dev/null +++ b/spring-5-reactive/src/test/java/com/baeldung/debugging/consumer/ConsumerFooServiceIntegrationTest.java @@ -0,0 +1,65 @@ +package com.baeldung.debugging.consumer; + +import static org.assertj.core.api.Assertions.assertThat; + +import java.util.Arrays; +import java.util.Collection; +import java.util.Optional; +import java.util.stream.Collectors; +import java.util.stream.Stream; + +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + +import com.baeldung.debugging.consumer.model.Foo; +import com.baeldung.debugging.consumer.service.FooService; +import com.baeldung.debugging.consumer.utils.ListAppender; + +import ch.qos.logback.classic.spi.ILoggingEvent; +import ch.qos.logback.classic.spi.IThrowableProxy; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Hooks; + +public class ConsumerFooServiceIntegrationTest { + + FooService service = new FooService(); + + @BeforeEach + public void clearLogList() { + Hooks.onOperatorDebug(); + ListAppender.clearEventList(); + } + + @Test + public void givenFooWithNullId_whenProcessFoo_thenLogsWithDebugTrace() { + Foo one = new Foo(1, "nameverylong", 8); + Foo two = new Foo(null, "nameverylong", 4); + Flux flux = Flux.just(one, two); + + service.processFoo(flux); + + Collection allLoggedEntries = ListAppender.getEvents() + .stream() + .map(ILoggingEvent::getFormattedMessage) + .collect(Collectors.toList()); + + Collection allSuppressedEntries = ListAppender.getEvents() + .stream() + .map(ILoggingEvent::getThrowableProxy) + .flatMap(t -> { + return Optional.ofNullable(t) + .map(IThrowableProxy::getSuppressed) + .map(Arrays::stream) + .orElse(Stream.empty()); + }) + .map(IThrowableProxy::getMessage) + .collect(Collectors.toList()); + assertThat(allLoggedEntries).anyMatch(entry -> entry.contains("The following error happened on processFoo method!")) + .anyMatch(entry -> entry.contains("| onSubscribe")) + .anyMatch(entry -> entry.contains("| cancel()")); + + assertThat(allSuppressedEntries).anyMatch(entry -> entry.contains("Assembly trace from producer")) + .anyMatch(entry -> entry.contains("Error has been observed by the following operator(s)")); + } + +} diff --git a/spring-5-reactive/src/test/java/com/baeldung/debugging/consumer/ConsumerFooServiceLiveTest.java b/spring-5-reactive/src/test/java/com/baeldung/debugging/consumer/ConsumerFooServiceLiveTest.java new file mode 100644 index 0000000000..af9bdfbc9b --- /dev/null +++ b/spring-5-reactive/src/test/java/com/baeldung/debugging/consumer/ConsumerFooServiceLiveTest.java @@ -0,0 +1,49 @@ +package com.baeldung.debugging.consumer; + +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; +import org.springframework.test.web.reactive.server.WebTestClient; +import org.springframework.test.web.reactive.server.WebTestClient.ResponseSpec; + +import com.baeldung.debugging.consumer.service.FooService; + +public class ConsumerFooServiceLiveTest { + + FooService service = new FooService(); + + private static final String BASE_URL = "http://localhost:8082"; + private static final String DEBUG_HOOK_ON = BASE_URL + "/debug-hook-on"; + private static final String DEBUG_HOOK_OFF = BASE_URL + "/debug-hook-off"; + + private static WebTestClient client; + + @BeforeAll + public static void setup() { + client = WebTestClient.bindToServer() + .baseUrl(BASE_URL) + .build(); + } + + @Test + public void whenRequestingDebugHookOn_thenObtainExpectedMessage() { + ResponseSpec response = client.get() + .uri(DEBUG_HOOK_ON) + .exchange(); + response.expectStatus() + .isOk() + .expectBody(String.class) + .isEqualTo("DEBUG HOOK ON"); + } + + @Test + public void whenRequestingDebugHookOff_thenObtainExpectedMessage() { + ResponseSpec response = client.get() + .uri(DEBUG_HOOK_OFF) + .exchange(); + response.expectStatus() + .isOk() + .expectBody(String.class) + .isEqualTo("DEBUG HOOK OFF"); + } + +} diff --git a/spring-5-reactive/src/test/java/com/baeldung/debugging/consumer/utils/ListAppender.java b/spring-5-reactive/src/test/java/com/baeldung/debugging/consumer/utils/ListAppender.java new file mode 100644 index 0000000000..c8c1c110bb --- /dev/null +++ b/spring-5-reactive/src/test/java/com/baeldung/debugging/consumer/utils/ListAppender.java @@ -0,0 +1,25 @@ +package com.baeldung.debugging.consumer.utils; + +import java.util.ArrayList; +import java.util.List; + +import ch.qos.logback.classic.spi.ILoggingEvent; +import ch.qos.logback.core.AppenderBase; + +public class ListAppender extends AppenderBase { + + static private List events = new ArrayList<>(); + + @Override + protected void append(ILoggingEvent eventObject) { + events.add(eventObject); + } + + public static List getEvents() { + return events; + } + + public static void clearEventList() { + events.clear(); + } +} diff --git a/spring-5-reactive/src/test/java/com/baeldung/functional/FunctionalWebApplicationIntegrationTest.java b/spring-5-reactive/src/test/java/com/baeldung/functional/FunctionalWebApplicationIntegrationTest.java index 4dea2a05cf..1256d5f129 100644 --- a/spring-5-reactive/src/test/java/com/baeldung/functional/FunctionalWebApplicationIntegrationTest.java +++ b/spring-5-reactive/src/test/java/com/baeldung/functional/FunctionalWebApplicationIntegrationTest.java @@ -10,6 +10,7 @@ import org.springframework.boot.web.server.WebServer; import org.springframework.core.io.ClassPathResource; import org.springframework.core.io.Resource; import org.springframework.http.MediaType; +import org.springframework.security.test.context.support.WithMockUser; import org.springframework.test.web.reactive.server.WebTestClient; import org.springframework.util.LinkedMultiValueMap; import org.springframework.util.MultiValueMap; diff --git a/spring-5-reactive/src/test/java/com/baeldung/reactive/Spring5ReactiveServerClientIntegrationTest.java b/spring-5-reactive/src/test/java/com/baeldung/reactive/Spring5ReactiveServerClientIntegrationTest.java index 8707c27fb3..b8dd9c9509 100644 --- a/spring-5-reactive/src/test/java/com/baeldung/reactive/Spring5ReactiveServerClientIntegrationTest.java +++ b/spring-5-reactive/src/test/java/com/baeldung/reactive/Spring5ReactiveServerClientIntegrationTest.java @@ -1,5 +1,10 @@ package com.baeldung.reactive; +import static org.springframework.web.reactive.function.server.RequestPredicates.GET; +import static org.springframework.web.reactive.function.server.RequestPredicates.POST; + +import java.time.Duration; + import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.BeforeAll; import org.springframework.http.server.reactive.HttpHandler; @@ -12,21 +17,17 @@ import com.baeldung.web.reactive.Task; import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; -import reactor.ipc.netty.NettyContext; -import reactor.ipc.netty.http.server.HttpServer; - -import java.time.Duration; - -import static org.springframework.web.reactive.function.server.RequestPredicates.GET; -import static org.springframework.web.reactive.function.server.RequestPredicates.POST; +import reactor.netty.DisposableServer; +import reactor.netty.http.server.HttpServer; public class Spring5ReactiveServerClientIntegrationTest { - - private static NettyContext nettyContext; + private static DisposableServer disposableServer; @BeforeAll public static void setUp() throws Exception { - HttpServer server = HttpServer.create("localhost", 8080); + HttpServer server = HttpServer.create() + .host("localhost") + .port(8080); RouterFunction route = RouterFunctions.route(POST("/task/process"), request -> ServerResponse.ok() .body(request.bodyToFlux(Task.class) .map(ll -> new Task("TaskName", 1)), Task.class)) @@ -34,13 +35,13 @@ public class Spring5ReactiveServerClientIntegrationTest { .body(Mono.just("server is alive"), String.class))); HttpHandler httpHandler = RouterFunctions.toHttpHandler(route); ReactorHttpHandlerAdapter adapter = new ReactorHttpHandlerAdapter(httpHandler); - nettyContext = server.newHandler(adapter) - .block(); + disposableServer = server.handle(adapter) + .bindNow(); } @AfterAll public static void shutDown() { - nettyContext.dispose(); + disposableServer.disposeNow(); } // @Test diff --git a/spring-5-reactive/src/test/java/com/baeldung/reactive/cors/CorsOnAnnotatedElementsLiveTest.java b/spring-5-reactive/src/test/java/com/baeldung/reactive/cors/CorsOnAnnotatedElementsLiveTest.java index 0043d62e5a..e6847e63da 100644 --- a/spring-5-reactive/src/test/java/com/baeldung/reactive/cors/CorsOnAnnotatedElementsLiveTest.java +++ b/spring-5-reactive/src/test/java/com/baeldung/reactive/cors/CorsOnAnnotatedElementsLiveTest.java @@ -2,13 +2,10 @@ package com.baeldung.reactive.cors; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; -import org.junit.runner.RunWith; import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.junit4.SpringRunner; import org.springframework.test.web.reactive.server.WebTestClient; import org.springframework.test.web.reactive.server.WebTestClient.ResponseSpec; -@RunWith(SpringRunner.class) @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) public class CorsOnAnnotatedElementsLiveTest { diff --git a/spring-5-reactive/src/test/java/com/baeldung/reactive/cors/CorsOnGlobalConfigLiveTest.java b/spring-5-reactive/src/test/java/com/baeldung/reactive/cors/CorsOnGlobalConfigLiveTest.java index 39927af4c3..008f1a16f2 100644 --- a/spring-5-reactive/src/test/java/com/baeldung/reactive/cors/CorsOnGlobalConfigLiveTest.java +++ b/spring-5-reactive/src/test/java/com/baeldung/reactive/cors/CorsOnGlobalConfigLiveTest.java @@ -2,13 +2,10 @@ package com.baeldung.reactive.cors; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; -import org.junit.runner.RunWith; import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.junit4.SpringRunner; import org.springframework.test.web.reactive.server.WebTestClient; import org.springframework.test.web.reactive.server.WebTestClient.ResponseSpec; -@RunWith(SpringRunner.class) @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) public class CorsOnGlobalConfigLiveTest { diff --git a/spring-5-reactive/src/test/java/com/baeldung/reactive/cors/CorsOnWebFilterLiveTest.java b/spring-5-reactive/src/test/java/com/baeldung/reactive/cors/CorsOnWebFilterLiveTest.java index e5a3c8a99a..f8a4f34e29 100644 --- a/spring-5-reactive/src/test/java/com/baeldung/reactive/cors/CorsOnWebFilterLiveTest.java +++ b/spring-5-reactive/src/test/java/com/baeldung/reactive/cors/CorsOnWebFilterLiveTest.java @@ -2,13 +2,10 @@ package com.baeldung.reactive.cors; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; -import org.junit.runner.RunWith; import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.junit4.SpringRunner; import org.springframework.test.web.reactive.server.WebTestClient; import org.springframework.test.web.reactive.server.WebTestClient.ResponseSpec; -@RunWith(SpringRunner.class) @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) public class CorsOnWebFilterLiveTest { diff --git a/spring-5-reactive/src/test/java/com/baeldung/reactive/errorhandling/ErrorHandlingIntegrationTest.java b/spring-5-reactive/src/test/java/com/baeldung/reactive/errorhandling/ErrorHandlingIntegrationTest.java index bea2eaa75f..10cfaffce4 100644 --- a/spring-5-reactive/src/test/java/com/baeldung/reactive/errorhandling/ErrorHandlingIntegrationTest.java +++ b/spring-5-reactive/src/test/java/com/baeldung/reactive/errorhandling/ErrorHandlingIntegrationTest.java @@ -8,11 +8,13 @@ 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.http.MediaType; +import org.springframework.security.test.context.support.WithMockUser; import org.springframework.test.context.junit4.SpringRunner; import org.springframework.test.web.reactive.server.WebTestClient; @RunWith(SpringRunner.class) @SpringBootTest(webEnvironment = WebEnvironment.DEFINED_PORT) +@WithMockUser public class ErrorHandlingIntegrationTest { @Autowired diff --git a/spring-5-reactive/src/test/java/com/baeldung/reactive/filters/PlayerHandlerIntegrationTest.java b/spring-5-reactive/src/test/java/com/baeldung/reactive/filters/PlayerHandlerIntegrationTest.java index bb2408ea79..fbf46a93cc 100644 --- a/spring-5-reactive/src/test/java/com/baeldung/reactive/filters/PlayerHandlerIntegrationTest.java +++ b/spring-5-reactive/src/test/java/com/baeldung/reactive/filters/PlayerHandlerIntegrationTest.java @@ -4,6 +4,7 @@ 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.context.support.WithMockUser; import org.springframework.test.context.junit4.SpringRunner; import org.springframework.test.web.reactive.server.EntityExchangeResult; import org.springframework.test.web.reactive.server.WebTestClient; @@ -12,6 +13,7 @@ import static org.junit.Assert.assertEquals; @RunWith(SpringRunner.class) @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) +@WithMockUser public class PlayerHandlerIntegrationTest { @Autowired diff --git a/spring-5-reactive/src/test/java/com/baeldung/reactive/filters/UserControllerIntegrationTest.java b/spring-5-reactive/src/test/java/com/baeldung/reactive/filters/UserControllerIntegrationTest.java index e7d289e5c4..22991b298f 100644 --- a/spring-5-reactive/src/test/java/com/baeldung/reactive/filters/UserControllerIntegrationTest.java +++ b/spring-5-reactive/src/test/java/com/baeldung/reactive/filters/UserControllerIntegrationTest.java @@ -4,6 +4,7 @@ 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.context.support.WithMockUser; import org.springframework.test.context.junit4.SpringRunner; import org.springframework.test.web.reactive.server.EntityExchangeResult; import org.springframework.test.web.reactive.server.WebTestClient; @@ -12,6 +13,7 @@ import static org.junit.Assert.assertEquals; @RunWith(SpringRunner.class) @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) +@WithMockUser public class UserControllerIntegrationTest { @Autowired diff --git a/spring-5-reactive/src/test/java/com/baeldung/reactive/responseheaders/ResponseHeaderLiveTest.java b/spring-5-reactive/src/test/java/com/baeldung/reactive/responseheaders/ResponseHeaderLiveTest.java index db563e27d1..927c52e7e6 100644 --- a/spring-5-reactive/src/test/java/com/baeldung/reactive/responseheaders/ResponseHeaderLiveTest.java +++ b/spring-5-reactive/src/test/java/com/baeldung/reactive/responseheaders/ResponseHeaderLiveTest.java @@ -2,13 +2,10 @@ package com.baeldung.reactive.responseheaders; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; -import org.junit.runner.RunWith; import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.junit4.SpringRunner; import org.springframework.test.web.reactive.server.WebTestClient; import org.springframework.test.web.reactive.server.WebTestClient.ResponseSpec; -@RunWith(SpringRunner.class) @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) public class ResponseHeaderLiveTest { diff --git a/spring-5-reactive/src/test/java/com/baeldung/reactive/serversentsevents/ServiceSentEventLiveTest.java b/spring-5-reactive/src/test/java/com/baeldung/reactive/serversentsevents/ServiceSentEventLiveTest.java index 53f4a3b1bb..547cd99034 100644 --- a/spring-5-reactive/src/test/java/com/baeldung/reactive/serversentsevents/ServiceSentEventLiveTest.java +++ b/spring-5-reactive/src/test/java/com/baeldung/reactive/serversentsevents/ServiceSentEventLiveTest.java @@ -3,14 +3,13 @@ package com.baeldung.reactive.serversentsevents; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.function.Executable; -import org.junit.platform.runner.JUnitPlatform; -import org.junit.runner.RunWith; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.http.MediaType; +import org.springframework.security.test.context.support.WithMockUser; import org.springframework.test.web.reactive.server.WebTestClient; -@RunWith(JUnitPlatform.class) @SpringBootTest +@WithMockUser public class ServiceSentEventLiveTest { private WebTestClient client = WebTestClient.bindToServer() diff --git a/spring-5-reactive/src/test/java/com/baeldung/reactive/urlmatch/PathPatternsUsingHandlerMethodIntegrationTest.java b/spring-5-reactive/src/test/java/com/baeldung/reactive/urlmatch/PathPatternsUsingHandlerMethodIntegrationTest.java index 9f31608ff7..d4c1cfe4c8 100644 --- a/spring-5-reactive/src/test/java/com/baeldung/reactive/urlmatch/PathPatternsUsingHandlerMethodIntegrationTest.java +++ b/spring-5-reactive/src/test/java/com/baeldung/reactive/urlmatch/PathPatternsUsingHandlerMethodIntegrationTest.java @@ -4,6 +4,7 @@ import org.junit.BeforeClass; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.security.test.context.support.WithMockUser; import org.springframework.test.context.junit4.SpringRunner; import org.springframework.test.web.reactive.server.WebTestClient; @@ -12,6 +13,7 @@ import com.baeldung.reactive.controller.PathPatternController; @RunWith(SpringRunner.class) @SpringBootTest(classes = Spring5ReactiveApplication.class) +@WithMockUser public class PathPatternsUsingHandlerMethodIntegrationTest { private static WebTestClient client; diff --git a/spring-5-reactive/src/test/java/com/baeldung/validations/functional/FunctionalEndpointValidationsLiveTest.java b/spring-5-reactive/src/test/java/com/baeldung/validations/functional/FunctionalEndpointValidationsLiveTest.java new file mode 100644 index 0000000000..73968cdf05 --- /dev/null +++ b/spring-5-reactive/src/test/java/com/baeldung/validations/functional/FunctionalEndpointValidationsLiveTest.java @@ -0,0 +1,108 @@ +package com.baeldung.validations.functional; + +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.web.reactive.server.WebTestClient; +import org.springframework.test.web.reactive.server.WebTestClient.ResponseSpec; + +import com.baeldung.validations.functional.model.AnnotatedRequestEntity; +import com.baeldung.validations.functional.model.CustomRequestEntity; + +import reactor.core.publisher.Mono; + +@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) +public class FunctionalEndpointValidationsLiveTest { + + private static final String BASE_URL = "http://localhost:8080"; + private static final String COMPLEX_EP_URL = BASE_URL + "/complex-handler-functional-validation"; + private static final String DRY_EP_URL = BASE_URL + "/dry-functional-validation"; + private static final String ANNOTATIONS_EP_URL = BASE_URL + "/annotated-functional-validation"; + + private static WebTestClient client; + + @BeforeAll + public static void setup() { + client = WebTestClient.bindToServer() + .baseUrl(BASE_URL) + .build(); + } + + @Test + public void whenRequestingDryEPWithInvalidBody_thenObtainBadRequest() { + CustomRequestEntity body = new CustomRequestEntity("name", "123"); + + ResponseSpec response = client.post() + .uri(DRY_EP_URL) + .body(Mono.just(body), CustomRequestEntity.class) + .exchange(); + + response.expectStatus() + .isBadRequest(); + } + + @Test + public void whenRequestingComplexEPWithInvalidBody_thenObtainBadRequest() { + CustomRequestEntity body = new CustomRequestEntity("name", "123"); + + ResponseSpec response = client.post() + .uri(COMPLEX_EP_URL) + .body(Mono.just(body), CustomRequestEntity.class) + .exchange(); + + response.expectStatus() + .isBadRequest(); + } + + @Test + public void whenRequestingAnnotatedEPWithInvalidBody_thenObtainBadRequest() { + AnnotatedRequestEntity body = new AnnotatedRequestEntity("user", "passwordlongerthan7digits"); + + ResponseSpec response = client.post() + .uri(ANNOTATIONS_EP_URL) + .body(Mono.just(body), AnnotatedRequestEntity.class) + .exchange(); + + response.expectStatus() + .isBadRequest(); + } + + @Test + public void whenRequestingDryEPWithValidBody_thenObtainBadRequest() { + CustomRequestEntity body = new CustomRequestEntity("name", "1234567"); + + ResponseSpec response = client.post() + .uri(DRY_EP_URL) + .body(Mono.just(body), CustomRequestEntity.class) + .exchange(); + + response.expectStatus() + .isOk(); + } + + @Test + public void whenRequestingComplexEPWithValidBody_thenObtainBadRequest() { + CustomRequestEntity body = new CustomRequestEntity("name", "1234567"); + + ResponseSpec response = client.post() + .uri(COMPLEX_EP_URL) + .body(Mono.just(body), CustomRequestEntity.class) + .exchange(); + + response.expectStatus() + .isOk(); + } + + @Test + public void whenRequestingAnnotatedEPWithValidBody_thenObtainBadRequest() { + AnnotatedRequestEntity body = new AnnotatedRequestEntity("user", "12345"); + + ResponseSpec response = client.post() + .uri(ANNOTATIONS_EP_URL) + .body(Mono.just(body), AnnotatedRequestEntity.class) + .exchange(); + + response.expectStatus() + .isOk(); + } +} diff --git a/spring-5-reactive/src/test/java/com/baeldung/web/client/WebTestClientIntegrationTest.java b/spring-5-reactive/src/test/java/com/baeldung/web/client/WebTestClientIntegrationTest.java index 08bd883b0b..2e37f2ffbd 100644 --- a/spring-5-reactive/src/test/java/com/baeldung/web/client/WebTestClientIntegrationTest.java +++ b/spring-5-reactive/src/test/java/com/baeldung/web/client/WebTestClientIntegrationTest.java @@ -1,10 +1,10 @@ package com.baeldung.web.client; -import com.baeldung.reactive.Spring5ReactiveApplication; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.web.server.LocalServerPort; +import org.springframework.security.test.context.support.WithMockUser; import org.springframework.test.context.junit4.SpringRunner; import org.springframework.test.web.reactive.server.WebTestClient; import org.springframework.web.reactive.function.server.RequestPredicates; @@ -12,10 +12,14 @@ import org.springframework.web.reactive.function.server.RouterFunction; import org.springframework.web.reactive.function.server.RouterFunctions; import org.springframework.web.reactive.function.server.ServerResponse; import org.springframework.web.server.WebHandler; + +import com.baeldung.reactive.Spring5ReactiveApplication; + import reactor.core.publisher.Mono; @RunWith(SpringRunner.class) @SpringBootTest(classes = Spring5ReactiveApplication.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) +@WithMockUser public class WebTestClientIntegrationTest { @LocalServerPort diff --git a/spring-5-reactive/src/test/resources/logback-test.xml b/spring-5-reactive/src/test/resources/logback-test.xml new file mode 100644 index 0000000000..514029e402 --- /dev/null +++ b/spring-5-reactive/src/test/resources/logback-test.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/spring-5-security-oauth/README.md b/spring-5-security-oauth/README.md new file mode 100644 index 0000000000..f13925992b --- /dev/null +++ b/spring-5-security-oauth/README.md @@ -0,0 +1,4 @@ +## Relevant articles: + +- [Spring Security 5 -OAuth2 Login](http://www.baeldung.com/spring-security-5-oauth2-login) +- [Extracting Principal and Authorities using Spring Security OAuth](https://www.baeldung.com/spring-security-oauth-principal-authorities-extractor) diff --git a/spring-5-security-oauth/pom.xml b/spring-5-security-oauth/pom.xml new file mode 100644 index 0000000000..59150a153f --- /dev/null +++ b/spring-5-security-oauth/pom.xml @@ -0,0 +1,74 @@ + + 4.0.0 + com.baeldung + spring-5-security-oauth + 0.0.1-SNAPSHOT + jar + spring-5-security-oauth + spring 5 security oauth sample project + + + com.baeldung + parent-boot-2 + 0.0.1-SNAPSHOT + ../parent-boot-2 + + + + + + org.springframework.boot + spring-boot-starter-security + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework.boot + spring-boot-starter-thymeleaf + + + org.thymeleaf.extras + thymeleaf-extras-springsecurity5 + + + + + org.springframework.security.oauth.boot + spring-security-oauth2-autoconfigure + ${oauth-auto.version} + + + org.springframework.security + spring-security-oauth2-client + + + org.springframework.security + spring-security-oauth2-jose + + + + org.springframework + spring-test + + + org.springframework.boot + spring-boot-starter-test + test + + + org.springframework.security + spring-security-test + test + + + + + 2.1.0.RELEASE + 2.1.0.RELEASE + com.baeldung.oauth2.SpringOAuthApplication + + + diff --git a/spring-5-security-oauth/src/main/java/com/baeldung/oauth2/CustomRequestSecurityConfig.java b/spring-5-security-oauth/src/main/java/com/baeldung/oauth2/CustomRequestSecurityConfig.java new file mode 100644 index 0000000000..2aba5a82ac --- /dev/null +++ b/spring-5-security-oauth/src/main/java/com/baeldung/oauth2/CustomRequestSecurityConfig.java @@ -0,0 +1,118 @@ +package com.baeldung.oauth2; + +import java.util.Arrays; +import java.util.List; +import java.util.stream.Collectors; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.PropertySource; +import org.springframework.core.env.Environment; +import org.springframework.http.converter.FormHttpMessageConverter; +import org.springframework.security.config.annotation.web.builders.HttpSecurity; +import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; +import org.springframework.security.config.oauth2.client.CommonOAuth2Provider; +import org.springframework.security.oauth2.client.endpoint.DefaultAuthorizationCodeTokenResponseClient; +import org.springframework.security.oauth2.client.endpoint.OAuth2AccessTokenResponseClient; +import org.springframework.security.oauth2.client.endpoint.OAuth2AuthorizationCodeGrantRequest; +import org.springframework.security.oauth2.client.http.OAuth2ErrorResponseErrorHandler; +import org.springframework.security.oauth2.client.registration.ClientRegistration; +import org.springframework.security.oauth2.client.registration.ClientRegistrationRepository; +import org.springframework.security.oauth2.client.registration.InMemoryClientRegistrationRepository; +import org.springframework.security.oauth2.client.web.AuthorizationRequestRepository; +import org.springframework.security.oauth2.client.web.HttpSessionOAuth2AuthorizationRequestRepository; +import org.springframework.security.oauth2.core.endpoint.OAuth2AuthorizationRequest; +import org.springframework.security.oauth2.core.http.converter.OAuth2AccessTokenResponseHttpMessageConverter; +import org.springframework.web.client.RestTemplate; + +import com.baeldung.oauth2request.CustomAuthorizationRequestResolver; +import com.baeldung.oauth2request.CustomRequestEntityConverter; +import com.baeldung.oauth2request.CustomTokenResponseConverter; + +//@Configuration +@PropertySource("application-oauth2.properties") +public class CustomRequestSecurityConfig extends WebSecurityConfigurerAdapter { + + @Override + protected void configure(HttpSecurity http) throws Exception { + http.authorizeRequests() + .antMatchers("/oauth_login", "/loginFailure", "/") + .permitAll() + .anyRequest() + .authenticated() + .and() + .oauth2Login() + .loginPage("/oauth_login") + .authorizationEndpoint() + .authorizationRequestResolver( new CustomAuthorizationRequestResolver(clientRegistrationRepository(),"/oauth2/authorize-client")) + + .baseUri("/oauth2/authorize-client") + .authorizationRequestRepository(authorizationRequestRepository()) + .and() + .tokenEndpoint() + .accessTokenResponseClient(accessTokenResponseClient()) + .and() + .defaultSuccessUrl("/loginSuccess") + .failureUrl("/loginFailure"); + } + + @Bean + public AuthorizationRequestRepository authorizationRequestRepository() { + return new HttpSessionOAuth2AuthorizationRequestRepository(); + } + + @Bean + public OAuth2AccessTokenResponseClient accessTokenResponseClient() { + DefaultAuthorizationCodeTokenResponseClient accessTokenResponseClient = new DefaultAuthorizationCodeTokenResponseClient(); + accessTokenResponseClient.setRequestEntityConverter(new CustomRequestEntityConverter()); + + OAuth2AccessTokenResponseHttpMessageConverter tokenResponseHttpMessageConverter = new OAuth2AccessTokenResponseHttpMessageConverter(); + tokenResponseHttpMessageConverter.setTokenResponseConverter(new CustomTokenResponseConverter()); + RestTemplate restTemplate = new RestTemplate(Arrays.asList(new FormHttpMessageConverter(), tokenResponseHttpMessageConverter)); + restTemplate.setErrorHandler(new OAuth2ErrorResponseErrorHandler()); + accessTokenResponseClient.setRestOperations(restTemplate); + return accessTokenResponseClient; + } + + + // additional configuration for non-Spring Boot projects + private static List clients = Arrays.asList("google", "facebook"); + + //@Bean + public ClientRegistrationRepository clientRegistrationRepository() { + List registrations = clients.stream() + .map(c -> getRegistration(c)) + .filter(registration -> registration != null) + .collect(Collectors.toList()); + + return new InMemoryClientRegistrationRepository(registrations); + } + + private static String CLIENT_PROPERTY_KEY = "spring.security.oauth2.client.registration."; + + @Autowired + private Environment env; + + private ClientRegistration getRegistration(String client) { + String clientId = env.getProperty(CLIENT_PROPERTY_KEY + client + ".client-id"); + + if (clientId == null) { + return null; + } + + String clientSecret = env.getProperty(CLIENT_PROPERTY_KEY + client + ".client-secret"); + if (client.equals("google")) { + return CommonOAuth2Provider.GOOGLE.getBuilder(client) + .clientId(clientId) + .clientSecret(clientSecret) + .build(); + } + if (client.equals("facebook")) { + return CommonOAuth2Provider.FACEBOOK.getBuilder(client) + .clientId(clientId) + .clientSecret(clientSecret) + .build(); + } + return null; + } +} diff --git a/spring-5-security/src/main/java/com/baeldung/oauth2/LoginController.java b/spring-5-security-oauth/src/main/java/com/baeldung/oauth2/LoginController.java similarity index 100% rename from spring-5-security/src/main/java/com/baeldung/oauth2/LoginController.java rename to spring-5-security-oauth/src/main/java/com/baeldung/oauth2/LoginController.java diff --git a/spring-5-security/src/main/java/com/baeldung/oauth2/MvcConfig.java b/spring-5-security-oauth/src/main/java/com/baeldung/oauth2/MvcConfig.java similarity index 100% rename from spring-5-security/src/main/java/com/baeldung/oauth2/MvcConfig.java rename to spring-5-security-oauth/src/main/java/com/baeldung/oauth2/MvcConfig.java diff --git a/spring-5-security/src/main/java/com/baeldung/oauth2/SecurityConfig.java b/spring-5-security-oauth/src/main/java/com/baeldung/oauth2/SecurityConfig.java similarity index 93% rename from spring-5-security/src/main/java/com/baeldung/oauth2/SecurityConfig.java rename to spring-5-security-oauth/src/main/java/com/baeldung/oauth2/SecurityConfig.java index b45f325767..e17e339142 100644 --- a/spring-5-security/src/main/java/com/baeldung/oauth2/SecurityConfig.java +++ b/spring-5-security-oauth/src/main/java/com/baeldung/oauth2/SecurityConfig.java @@ -12,7 +12,7 @@ import org.springframework.core.env.Environment; import org.springframework.security.config.annotation.web.builders.HttpSecurity; import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; import org.springframework.security.config.oauth2.client.CommonOAuth2Provider; -import org.springframework.security.oauth2.client.endpoint.NimbusAuthorizationCodeTokenResponseClient; +import org.springframework.security.oauth2.client.endpoint.DefaultAuthorizationCodeTokenResponseClient; import org.springframework.security.oauth2.client.endpoint.OAuth2AccessTokenResponseClient; import org.springframework.security.oauth2.client.endpoint.OAuth2AuthorizationCodeGrantRequest; import org.springframework.security.oauth2.client.registration.ClientRegistration; @@ -54,7 +54,8 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter { @Bean public OAuth2AccessTokenResponseClient accessTokenResponseClient() { - return new NimbusAuthorizationCodeTokenResponseClient(); + DefaultAuthorizationCodeTokenResponseClient accessTokenResponseClient = new DefaultAuthorizationCodeTokenResponseClient(); + return accessTokenResponseClient; } diff --git a/spring-5-security/src/main/java/com/baeldung/oauth2/SpringOAuthApplication.java b/spring-5-security-oauth/src/main/java/com/baeldung/oauth2/SpringOAuthApplication.java similarity index 100% rename from spring-5-security/src/main/java/com/baeldung/oauth2/SpringOAuthApplication.java rename to spring-5-security-oauth/src/main/java/com/baeldung/oauth2/SpringOAuthApplication.java diff --git a/spring-5-security/src/main/java/com/baeldung/oauth2extractors/ExtractorsApplication.java b/spring-5-security-oauth/src/main/java/com/baeldung/oauth2extractors/ExtractorsApplication.java similarity index 100% rename from spring-5-security/src/main/java/com/baeldung/oauth2extractors/ExtractorsApplication.java rename to spring-5-security-oauth/src/main/java/com/baeldung/oauth2extractors/ExtractorsApplication.java diff --git a/spring-5-security/src/main/java/com/baeldung/oauth2extractors/configuration/SecurityConfig.java b/spring-5-security-oauth/src/main/java/com/baeldung/oauth2extractors/configuration/SecurityConfig.java similarity index 100% rename from spring-5-security/src/main/java/com/baeldung/oauth2extractors/configuration/SecurityConfig.java rename to spring-5-security-oauth/src/main/java/com/baeldung/oauth2extractors/configuration/SecurityConfig.java diff --git a/spring-5-security/src/main/java/com/baeldung/oauth2extractors/extractor/custom/BaeldungAuthoritiesExtractor.java b/spring-5-security-oauth/src/main/java/com/baeldung/oauth2extractors/extractor/custom/BaeldungAuthoritiesExtractor.java similarity index 100% rename from spring-5-security/src/main/java/com/baeldung/oauth2extractors/extractor/custom/BaeldungAuthoritiesExtractor.java rename to spring-5-security-oauth/src/main/java/com/baeldung/oauth2extractors/extractor/custom/BaeldungAuthoritiesExtractor.java diff --git a/spring-5-security/src/main/java/com/baeldung/oauth2extractors/extractor/custom/BaeldungPrincipalExtractor.java b/spring-5-security-oauth/src/main/java/com/baeldung/oauth2extractors/extractor/custom/BaeldungPrincipalExtractor.java similarity index 100% rename from spring-5-security/src/main/java/com/baeldung/oauth2extractors/extractor/custom/BaeldungPrincipalExtractor.java rename to spring-5-security-oauth/src/main/java/com/baeldung/oauth2extractors/extractor/custom/BaeldungPrincipalExtractor.java diff --git a/spring-5-security/src/main/java/com/baeldung/oauth2extractors/extractor/github/GithubAuthoritiesExtractor.java b/spring-5-security-oauth/src/main/java/com/baeldung/oauth2extractors/extractor/github/GithubAuthoritiesExtractor.java similarity index 100% rename from spring-5-security/src/main/java/com/baeldung/oauth2extractors/extractor/github/GithubAuthoritiesExtractor.java rename to spring-5-security-oauth/src/main/java/com/baeldung/oauth2extractors/extractor/github/GithubAuthoritiesExtractor.java diff --git a/spring-5-security/src/main/java/com/baeldung/oauth2extractors/extractor/github/GithubPrincipalExtractor.java b/spring-5-security-oauth/src/main/java/com/baeldung/oauth2extractors/extractor/github/GithubPrincipalExtractor.java similarity index 100% rename from spring-5-security/src/main/java/com/baeldung/oauth2extractors/extractor/github/GithubPrincipalExtractor.java rename to spring-5-security-oauth/src/main/java/com/baeldung/oauth2extractors/extractor/github/GithubPrincipalExtractor.java diff --git a/spring-5-security-oauth/src/main/java/com/baeldung/oauth2request/CustomAuthorizationRequestResolver.java b/spring-5-security-oauth/src/main/java/com/baeldung/oauth2request/CustomAuthorizationRequestResolver.java new file mode 100644 index 0000000000..47aacf9c06 --- /dev/null +++ b/spring-5-security-oauth/src/main/java/com/baeldung/oauth2request/CustomAuthorizationRequestResolver.java @@ -0,0 +1,57 @@ +package com.baeldung.oauth2request; + +import java.util.HashMap; +import java.util.Map; + +import javax.servlet.http.HttpServletRequest; + +import org.springframework.security.oauth2.client.registration.ClientRegistrationRepository; +import org.springframework.security.oauth2.client.web.DefaultOAuth2AuthorizationRequestResolver; +import org.springframework.security.oauth2.client.web.OAuth2AuthorizationRequestResolver; +import org.springframework.security.oauth2.core.endpoint.OAuth2AuthorizationRequest; + +public class CustomAuthorizationRequestResolver implements OAuth2AuthorizationRequestResolver { + + private OAuth2AuthorizationRequestResolver defaultResolver; + + public CustomAuthorizationRequestResolver(ClientRegistrationRepository repo, String authorizationRequestBaseUri){ + defaultResolver = new DefaultOAuth2AuthorizationRequestResolver(repo, authorizationRequestBaseUri); + } + + @Override + public OAuth2AuthorizationRequest resolve(HttpServletRequest request) { + OAuth2AuthorizationRequest req = defaultResolver.resolve(request); + if(req != null){ + req = customizeAuthorizationRequest(req); + } + return req; + } + + @Override + public OAuth2AuthorizationRequest resolve(HttpServletRequest request, String clientRegistrationId) { + OAuth2AuthorizationRequest req = defaultResolver.resolve(request, clientRegistrationId); + if(req != null){ + req = customizeAuthorizationRequest(req); + } + return req; + } + + private OAuth2AuthorizationRequest customizeAuthorizationRequest(OAuth2AuthorizationRequest req) { + Map extraParams = new HashMap(); + extraParams.putAll(req.getAdditionalParameters()); //VIP note + extraParams.put("test", "extra"); + System.out.println("here ====================="); + return OAuth2AuthorizationRequest.from(req).additionalParameters(extraParams).build(); + } + + private OAuth2AuthorizationRequest customizeAuthorizationRequest1(OAuth2AuthorizationRequest req) { + return OAuth2AuthorizationRequest.from(req).state("xyz").build(); + } + + private OAuth2AuthorizationRequest customizeOktaReq(OAuth2AuthorizationRequest req) { + Map extraParams = new HashMap(); + extraParams.putAll(req.getAdditionalParameters()); + extraParams.put("idp", "https://idprovider.com"); + return OAuth2AuthorizationRequest.from(req).additionalParameters(extraParams).build(); + } +} diff --git a/spring-5-security-oauth/src/main/java/com/baeldung/oauth2request/CustomRequestEntityConverter.java b/spring-5-security-oauth/src/main/java/com/baeldung/oauth2request/CustomRequestEntityConverter.java new file mode 100644 index 0000000000..5486105c34 --- /dev/null +++ b/spring-5-security-oauth/src/main/java/com/baeldung/oauth2request/CustomRequestEntityConverter.java @@ -0,0 +1,26 @@ +package com.baeldung.oauth2request; + +import org.springframework.core.convert.converter.Converter; +import org.springframework.http.RequestEntity; +import org.springframework.security.oauth2.client.endpoint.OAuth2AuthorizationCodeGrantRequest; +import org.springframework.security.oauth2.client.endpoint.OAuth2AuthorizationCodeGrantRequestEntityConverter; +import org.springframework.util.MultiValueMap; + +public class CustomRequestEntityConverter implements Converter> { + + private OAuth2AuthorizationCodeGrantRequestEntityConverter defaultConverter; + + public CustomRequestEntityConverter() { + defaultConverter = new OAuth2AuthorizationCodeGrantRequestEntityConverter(); + } + + @Override + public RequestEntity convert(OAuth2AuthorizationCodeGrantRequest req) { + RequestEntity entity = defaultConverter.convert(req); + MultiValueMap params = (MultiValueMap) entity.getBody(); + params.add("test2", "extra2"); + System.out.println(params.entrySet()); + return new RequestEntity<>(params, entity.getHeaders(), entity.getMethod(), entity.getUrl()); + } + +} diff --git a/spring-5-security-oauth/src/main/java/com/baeldung/oauth2request/CustomTokenResponseConverter.java b/spring-5-security-oauth/src/main/java/com/baeldung/oauth2request/CustomTokenResponseConverter.java new file mode 100644 index 0000000000..b9775d674a --- /dev/null +++ b/spring-5-security-oauth/src/main/java/com/baeldung/oauth2request/CustomTokenResponseConverter.java @@ -0,0 +1,67 @@ +package com.baeldung.oauth2request; + +import java.util.Arrays; +import java.util.Collections; +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.Set; +import java.util.stream.Collectors; +import java.util.stream.Stream; + +import org.springframework.core.convert.converter.Converter; +import org.springframework.security.oauth2.core.OAuth2AccessToken; +import org.springframework.security.oauth2.core.endpoint.OAuth2AccessTokenResponse; +import org.springframework.security.oauth2.core.endpoint.OAuth2ParameterNames; +import org.springframework.util.StringUtils; + +public class CustomTokenResponseConverter implements Converter, OAuth2AccessTokenResponse> { + private static final Set TOKEN_RESPONSE_PARAMETER_NAMES = Stream.of( + OAuth2ParameterNames.ACCESS_TOKEN, + OAuth2ParameterNames.TOKEN_TYPE, + OAuth2ParameterNames.EXPIRES_IN, + OAuth2ParameterNames.REFRESH_TOKEN, + OAuth2ParameterNames.SCOPE) .collect(Collectors.toSet()); + + @Override + public OAuth2AccessTokenResponse convert(Map tokenResponseParameters) { + String accessToken = tokenResponseParameters.get(OAuth2ParameterNames.ACCESS_TOKEN); + + OAuth2AccessToken.TokenType accessTokenType = null; + if (OAuth2AccessToken.TokenType.BEARER.getValue() + .equalsIgnoreCase(tokenResponseParameters.get(OAuth2ParameterNames.TOKEN_TYPE))) { + accessTokenType = OAuth2AccessToken.TokenType.BEARER; + } + + long expiresIn = 0; + if (tokenResponseParameters.containsKey(OAuth2ParameterNames.EXPIRES_IN)) { + try { + expiresIn = Long.valueOf(tokenResponseParameters.get(OAuth2ParameterNames.EXPIRES_IN)); + } catch (NumberFormatException ex) { + } + } + + Set scopes = Collections.emptySet(); + if (tokenResponseParameters.containsKey(OAuth2ParameterNames.SCOPE)) { + String scope = tokenResponseParameters.get(OAuth2ParameterNames.SCOPE); + scopes = Arrays.stream(StringUtils.delimitedListToStringArray(scope, " ")) + .collect(Collectors.toSet()); + } + + String refreshToken = tokenResponseParameters.get(OAuth2ParameterNames.REFRESH_TOKEN); + + Map additionalParameters = new LinkedHashMap<>(); + tokenResponseParameters.entrySet() + .stream() + .filter(e -> !TOKEN_RESPONSE_PARAMETER_NAMES.contains(e.getKey())) + .forEach(e -> additionalParameters.put(e.getKey(), e.getValue())); + + return OAuth2AccessTokenResponse.withToken(accessToken) + .tokenType(accessTokenType) + .expiresIn(expiresIn) + .scopes(scopes) + .refreshToken(refreshToken) + .additionalParameters(additionalParameters) + .build(); + } + +} diff --git a/spring-5-security-oauth/src/main/java/com/baeldung/oauth2request/LinkedinTokenResponseConverter.java b/spring-5-security-oauth/src/main/java/com/baeldung/oauth2request/LinkedinTokenResponseConverter.java new file mode 100644 index 0000000000..89b3d32de5 --- /dev/null +++ b/spring-5-security-oauth/src/main/java/com/baeldung/oauth2request/LinkedinTokenResponseConverter.java @@ -0,0 +1,24 @@ +package com.baeldung.oauth2request; + +import java.util.Map; + +import org.springframework.core.convert.converter.Converter; +import org.springframework.security.oauth2.core.OAuth2AccessToken; +import org.springframework.security.oauth2.core.endpoint.OAuth2AccessTokenResponse; +import org.springframework.security.oauth2.core.endpoint.OAuth2ParameterNames; + +public class LinkedinTokenResponseConverter implements Converter, OAuth2AccessTokenResponse> { + + @Override + public OAuth2AccessTokenResponse convert(Map tokenResponseParameters) { + String accessToken = tokenResponseParameters.get(OAuth2ParameterNames.ACCESS_TOKEN); + long expiresIn = Long.valueOf(tokenResponseParameters.get(OAuth2ParameterNames.EXPIRES_IN)); + + OAuth2AccessToken.TokenType accessTokenType = OAuth2AccessToken.TokenType.BEARER; + + return OAuth2AccessTokenResponse.withToken(accessToken) + .tokenType(accessTokenType) + .expiresIn(expiresIn) + .build(); + } +} diff --git a/spring-5-security/src/main/resources/application-oauth2-extractors-baeldung.properties b/spring-5-security-oauth/src/main/resources/application-oauth2-extractors-baeldung.properties similarity index 100% rename from spring-5-security/src/main/resources/application-oauth2-extractors-baeldung.properties rename to spring-5-security-oauth/src/main/resources/application-oauth2-extractors-baeldung.properties diff --git a/spring-5-security/src/main/resources/application-oauth2-extractors-github.properties b/spring-5-security-oauth/src/main/resources/application-oauth2-extractors-github.properties similarity index 100% rename from spring-5-security/src/main/resources/application-oauth2-extractors-github.properties rename to spring-5-security-oauth/src/main/resources/application-oauth2-extractors-github.properties diff --git a/spring-5-security/src/main/resources/application-oauth2.properties b/spring-5-security-oauth/src/main/resources/application-oauth2.properties similarity index 100% rename from spring-5-security/src/main/resources/application-oauth2.properties rename to spring-5-security-oauth/src/main/resources/application-oauth2.properties diff --git a/spring-5-security-oauth/src/main/resources/application.properties b/spring-5-security-oauth/src/main/resources/application.properties new file mode 100644 index 0000000000..5912b0f755 --- /dev/null +++ b/spring-5-security-oauth/src/main/resources/application.properties @@ -0,0 +1,5 @@ +server.port=8081 + +logging.level.root=INFO + +logging.level.com.baeldung.dsl.ClientErrorLoggingFilter=DEBUG \ No newline at end of file diff --git a/spring-data-jpa/src/main/resources/logback.xml b/spring-5-security-oauth/src/main/resources/logback.xml similarity index 100% rename from spring-data-jpa/src/main/resources/logback.xml rename to spring-5-security-oauth/src/main/resources/logback.xml diff --git a/spring-5-security-oauth/src/main/resources/static/css/main.css b/spring-5-security-oauth/src/main/resources/static/css/main.css new file mode 100644 index 0000000000..febc353af7 --- /dev/null +++ b/spring-5-security-oauth/src/main/resources/static/css/main.css @@ -0,0 +1,8 @@ +p.error { + font-weight: bold; + color: red; +} + +div.logout { + margin-right: 2em;; +} diff --git a/spring-5-security-oauth/src/main/resources/templates/index.html b/spring-5-security-oauth/src/main/resources/templates/index.html new file mode 100644 index 0000000000..4216d74037 --- /dev/null +++ b/spring-5-security-oauth/src/main/resources/templates/index.html @@ -0,0 +1,11 @@ + + + + Home + + + + Home + Welcome! + + \ No newline at end of file diff --git a/spring-5-security/src/main/resources/templates/loginFailure.html b/spring-5-security-oauth/src/main/resources/templates/loginFailure.html similarity index 100% rename from spring-5-security/src/main/resources/templates/loginFailure.html rename to spring-5-security-oauth/src/main/resources/templates/loginFailure.html diff --git a/spring-5-security/src/main/resources/templates/loginSuccess.html b/spring-5-security-oauth/src/main/resources/templates/loginSuccess.html similarity index 100% rename from spring-5-security/src/main/resources/templates/loginSuccess.html rename to spring-5-security-oauth/src/main/resources/templates/loginSuccess.html diff --git a/spring-5-security/src/main/resources/templates/oauth2_extractors.html b/spring-5-security-oauth/src/main/resources/templates/oauth2_extractors.html similarity index 100% rename from spring-5-security/src/main/resources/templates/oauth2_extractors.html rename to spring-5-security-oauth/src/main/resources/templates/oauth2_extractors.html diff --git a/spring-5-security/src/main/resources/templates/oauth_login.html b/spring-5-security-oauth/src/main/resources/templates/oauth_login.html similarity index 100% rename from spring-5-security/src/main/resources/templates/oauth_login.html rename to spring-5-security-oauth/src/main/resources/templates/oauth_login.html diff --git a/spring-5-security/src/main/resources/templates/securedPage.html b/spring-5-security-oauth/src/main/resources/templates/securedPage.html similarity index 100% rename from spring-5-security/src/main/resources/templates/securedPage.html rename to spring-5-security-oauth/src/main/resources/templates/securedPage.html diff --git a/spring-5-security/src/test/java/com/baeldung/oauth2extractors/ExtractorsUnitTest.java b/spring-5-security-oauth/src/test/java/com/baeldung/oauth2extractors/ExtractorsUnitTest.java similarity index 100% rename from spring-5-security/src/test/java/com/baeldung/oauth2extractors/ExtractorsUnitTest.java rename to spring-5-security-oauth/src/test/java/com/baeldung/oauth2extractors/ExtractorsUnitTest.java diff --git a/spring-5-security/README.md b/spring-5-security/README.md index 55fa7ab042..37dc8b0f28 100644 --- a/spring-5-security/README.md +++ b/spring-5-security/README.md @@ -1,8 +1,7 @@ ## Relevant articles: -- [Spring Security 5 -OAuth2 Login](http://www.baeldung.com/spring-security-5-oauth2-login) - [Extra Login Fields with Spring Security](http://www.baeldung.com/spring-security-extra-login-fields) - [A Custom Spring SecurityConfigurer](http://www.baeldung.com/spring-security-custom-configurer) - [New Password Storage In Spring Security 5](http://www.baeldung.com/spring-security-5-password-storage) - [Default Password Encoder in Spring Security 5](https://www.baeldung.com/spring-security-5-default-password-encoder) -- [Extracting Principal and Authorities using Spring Security OAuth](https://www.baeldung.com/spring-security-oauth-principal-authorities-extractor) + diff --git a/spring-5-security/pom.xml b/spring-5-security/pom.xml index 1435019c24..c26e370381 100644 --- a/spring-5-security/pom.xml +++ b/spring-5-security/pom.xml @@ -31,19 +31,8 @@ org.thymeleaf.extras - thymeleaf-extras-springsecurity4 + thymeleaf-extras-springsecurity5 - - - - org.springframework.security - spring-security-oauth2-client - - - org.springframework.security - spring-security-oauth2-jose - - org.springframework spring-test @@ -58,12 +47,6 @@ spring-security-test test - - - org.springframework.security.oauth.boot - spring-security-oauth2-autoconfigure - 2.0.1.RELEASE - @@ -79,4 +62,4 @@ - \ No newline at end of file + diff --git a/spring-5-security/src/main/resources/templatesextrafields/index.html b/spring-5-security/src/main/resources/templatesextrafields/index.html index 37833ff0d2..1dd9c12d42 100644 --- a/spring-5-security/src/main/resources/templatesextrafields/index.html +++ b/spring-5-security/src/main/resources/templatesextrafields/index.html @@ -1,5 +1,5 @@ - + Spring Security with Extra Fields diff --git a/spring-5/pom.xml b/spring-5/pom.xml index 293edb5bda..58c14475e0 100644 --- a/spring-5/pom.xml +++ b/spring-5/pom.xml @@ -135,7 +135,8 @@ - + org.apache.maven.plugins maven-surefire-plugin @@ -143,14 +144,6 @@ methods true - - **/*IntegrationTest.java - **/*IntTest.java - **/*LongRunningUnitTest.java - **/*ManualTest.java - **/JdbcTest.java - **/*LiveTest.java - diff --git a/spring-5/src/main/java/com/baeldung/exception/SpringExceptionApplication.java b/spring-5/src/main/java/com/baeldung/exception/SpringExceptionApplication.java index ed163f7fa7..82a5fe083b 100644 --- a/spring-5/src/main/java/com/baeldung/exception/SpringExceptionApplication.java +++ b/spring-5/src/main/java/com/baeldung/exception/SpringExceptionApplication.java @@ -6,7 +6,7 @@ import org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfi import org.springframework.context.annotation.ComponentScan; @SpringBootApplication(exclude = SecurityAutoConfiguration.class) -@ComponentScan(basePackages = { "com.baeldung.execption" }) +@ComponentScan(basePackages = { "com.baeldung.exception" }) public class SpringExceptionApplication { public static void main(String[] args) { SpringApplication.run(SpringExceptionApplication.class, args); diff --git a/spring-5/src/main/java/com/baeldung/jsonb/Spring5Application.java b/spring-5/src/main/java/com/baeldung/jsonb/Spring5Application.java index 00fce06834..540992b4bc 100644 --- a/spring-5/src/main/java/com/baeldung/jsonb/Spring5Application.java +++ b/spring-5/src/main/java/com/baeldung/jsonb/Spring5Application.java @@ -6,12 +6,13 @@ import java.util.Collection; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.http.HttpMessageConverters; +import org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.ComponentScan; import org.springframework.http.converter.HttpMessageConverter; import org.springframework.http.converter.json.JsonbHttpMessageConverter; -@SpringBootApplication +@SpringBootApplication(exclude = SecurityAutoConfiguration.class) @ComponentScan(basePackages = { "com.baeldung.jsonb" }) public class Spring5Application { diff --git a/spring-5/src/main/java/com/baeldung/restdocs/SpringRestDocsApplication.java b/spring-5/src/main/java/com/baeldung/restdocs/SpringRestDocsApplication.java index 02332ee7b6..f512b52af4 100644 --- a/spring-5/src/main/java/com/baeldung/restdocs/SpringRestDocsApplication.java +++ b/spring-5/src/main/java/com/baeldung/restdocs/SpringRestDocsApplication.java @@ -2,8 +2,9 @@ package com.baeldung.restdocs; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration; -@SpringBootApplication +@SpringBootApplication(exclude = SecurityAutoConfiguration.class) public class SpringRestDocsApplication { public static void main(String[] args) { diff --git a/spring-5/src/test/java/com/baeldung/Example1IntegrationTest.java b/spring-5/src/test/java/com/baeldung/Example1IntegrationTest.java index ecc677465e..8b9e66213f 100644 --- a/spring-5/src/test/java/com/baeldung/Example1IntegrationTest.java +++ b/spring-5/src/test/java/com/baeldung/Example1IntegrationTest.java @@ -3,12 +3,10 @@ package com.baeldung; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.data.jpa.repository.config.EnableJpaRepositories; import org.springframework.test.context.junit4.SpringRunner; @RunWith(SpringRunner.class) @SpringBootTest -@EnableJpaRepositories("com.baeldung.persistence") public class Example1IntegrationTest { @Test diff --git a/spring-5/src/test/java/com/baeldung/Example2IntegrationTest.java b/spring-5/src/test/java/com/baeldung/Example2IntegrationTest.java index e1d56c2fc3..6ed53ca4e9 100644 --- a/spring-5/src/test/java/com/baeldung/Example2IntegrationTest.java +++ b/spring-5/src/test/java/com/baeldung/Example2IntegrationTest.java @@ -3,12 +3,10 @@ package com.baeldung; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.data.jpa.repository.config.EnableJpaRepositories; import org.springframework.test.context.junit4.SpringRunner; @RunWith(SpringRunner.class) @SpringBootTest -@EnableJpaRepositories("com.baeldung.persistence") public class Example2IntegrationTest { @Test diff --git a/spring-5/src/test/java/com/baeldung/functional/BeanRegistrationIntegrationTest.java b/spring-5/src/test/java/com/baeldung/functional/BeanRegistrationIntegrationTest.java index fba01726f4..9c462e0412 100644 --- a/spring-5/src/test/java/com/baeldung/functional/BeanRegistrationIntegrationTest.java +++ b/spring-5/src/test/java/com/baeldung/functional/BeanRegistrationIntegrationTest.java @@ -1,12 +1,11 @@ package com.baeldung.functional; -import static org.junit.Assert.*; +import static org.junit.Assert.assertTrue; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.data.jpa.repository.config.EnableJpaRepositories; import org.springframework.test.context.junit4.SpringRunner; import org.springframework.web.context.support.GenericWebApplicationContext; @@ -14,7 +13,6 @@ import com.baeldung.Spring5Application; @RunWith(SpringRunner.class) @SpringBootTest(classes = Spring5Application.class) -@EnableJpaRepositories("com.baeldung.persistence") public class BeanRegistrationIntegrationTest { @Autowired diff --git a/spring-activiti/pom.xml b/spring-activiti/pom.xml index 0a19f483c1..4e21c5b032 100644 --- a/spring-activiti/pom.xml +++ b/spring-activiti/pom.xml @@ -41,9 +41,21 @@ test + + + + + org.springframework.boot + spring-boot-maven-plugin + ${spring-boot.version} + + com.baeldung.activitiwithspring.ActivitiWithSpringApplication + + + + - com.example.activitiwithspring.ActivitiWithSpringApplication UTF-8 UTF-8 6.0.0 diff --git a/spring-activiti/src/main/java/com/example/activitiwithspring/ActivitiController.java b/spring-activiti/src/main/java/com/baeldung/activitiwithspring/ActivitiController.java similarity index 97% rename from spring-activiti/src/main/java/com/example/activitiwithspring/ActivitiController.java rename to spring-activiti/src/main/java/com/baeldung/activitiwithspring/ActivitiController.java index 96b551c03c..54dd4670f0 100644 --- a/spring-activiti/src/main/java/com/example/activitiwithspring/ActivitiController.java +++ b/spring-activiti/src/main/java/com/baeldung/activitiwithspring/ActivitiController.java @@ -1,4 +1,4 @@ -package com.example.activitiwithspring; +package com.baeldung.activitiwithspring; import org.activiti.engine.RuntimeService; import org.activiti.engine.TaskService; diff --git a/spring-activiti/src/main/java/com/example/activitiwithspring/ActivitiWithSpringApplication.java b/spring-activiti/src/main/java/com/baeldung/activitiwithspring/ActivitiWithSpringApplication.java similarity index 91% rename from spring-activiti/src/main/java/com/example/activitiwithspring/ActivitiWithSpringApplication.java rename to spring-activiti/src/main/java/com/baeldung/activitiwithspring/ActivitiWithSpringApplication.java index a9cd1301eb..d43ae3cc35 100644 --- a/spring-activiti/src/main/java/com/example/activitiwithspring/ActivitiWithSpringApplication.java +++ b/spring-activiti/src/main/java/com/baeldung/activitiwithspring/ActivitiWithSpringApplication.java @@ -1,4 +1,4 @@ -package com.example.activitiwithspring; +package com.baeldung.activitiwithspring; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; diff --git a/spring-activiti/src/main/java/com/example/activitiwithspring/TaskRepresentation.java b/spring-activiti/src/main/java/com/baeldung/activitiwithspring/TaskRepresentation.java similarity index 90% rename from spring-activiti/src/main/java/com/example/activitiwithspring/TaskRepresentation.java rename to spring-activiti/src/main/java/com/baeldung/activitiwithspring/TaskRepresentation.java index bb1412b057..de1ad88ba9 100644 --- a/spring-activiti/src/main/java/com/example/activitiwithspring/TaskRepresentation.java +++ b/spring-activiti/src/main/java/com/baeldung/activitiwithspring/TaskRepresentation.java @@ -1,4 +1,4 @@ -package com.example.activitiwithspring; +package com.baeldung.activitiwithspring; class TaskRepresentation { diff --git a/spring-activiti/src/main/java/com/example/activitiwithspring/servicetasks/SendEmailServiceTask.java b/spring-activiti/src/main/java/com/baeldung/activitiwithspring/servicetasks/SendEmailServiceTask.java similarity index 83% rename from spring-activiti/src/main/java/com/example/activitiwithspring/servicetasks/SendEmailServiceTask.java rename to spring-activiti/src/main/java/com/baeldung/activitiwithspring/servicetasks/SendEmailServiceTask.java index c11b48f37a..c174b6ae4a 100644 --- a/spring-activiti/src/main/java/com/example/activitiwithspring/servicetasks/SendEmailServiceTask.java +++ b/spring-activiti/src/main/java/com/baeldung/activitiwithspring/servicetasks/SendEmailServiceTask.java @@ -1,4 +1,4 @@ -package com.example.activitiwithspring.servicetasks; +package com.baeldung.activitiwithspring.servicetasks; import org.activiti.engine.delegate.DelegateExecution; import org.activiti.engine.delegate.JavaDelegate; diff --git a/spring-activiti/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-activiti/src/test/java/com/baeldung/SpringContextIntegrationTest.java similarity index 81% rename from spring-activiti/src/test/java/org/baeldung/SpringContextIntegrationTest.java rename to spring-activiti/src/test/java/com/baeldung/SpringContextIntegrationTest.java index ae37e77f86..ce48080753 100644 --- a/spring-activiti/src/test/java/org/baeldung/SpringContextIntegrationTest.java +++ b/spring-activiti/src/test/java/com/baeldung/SpringContextIntegrationTest.java @@ -1,11 +1,11 @@ -package org.baeldung; +package com.baeldung; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit4.SpringRunner; -import com.example.activitiwithspring.ActivitiWithSpringApplication; +import com.baeldung.activitiwithspring.ActivitiWithSpringApplication; @RunWith(SpringRunner.class) @SpringBootTest(classes = ActivitiWithSpringApplication.class) diff --git a/spring-activiti/src/test/java/com/example/activitiwithspring/ActivitiControllerIntegrationTest.java b/spring-activiti/src/test/java/com/baeldung/activitiwithspring/ActivitiControllerIntegrationTest.java similarity index 97% rename from spring-activiti/src/test/java/com/example/activitiwithspring/ActivitiControllerIntegrationTest.java rename to spring-activiti/src/test/java/com/baeldung/activitiwithspring/ActivitiControllerIntegrationTest.java index 65fd33bfc6..12c855e5ff 100644 --- a/spring-activiti/src/test/java/com/example/activitiwithspring/ActivitiControllerIntegrationTest.java +++ b/spring-activiti/src/test/java/com/baeldung/activitiwithspring/ActivitiControllerIntegrationTest.java @@ -1,5 +1,6 @@ -package com.example.activitiwithspring; +package com.baeldung.activitiwithspring; +import com.baeldung.activitiwithspring.TaskRepresentation; import com.fasterxml.jackson.databind.ObjectMapper; import org.activiti.engine.RuntimeService; import org.activiti.engine.runtime.ProcessInstance; diff --git a/spring-activiti/src/test/java/com/example/activitiwithspring/ActivitiSpringSecurityIntegrationTest.java b/spring-activiti/src/test/java/com/baeldung/activitiwithspring/ActivitiSpringSecurityIntegrationTest.java similarity index 96% rename from spring-activiti/src/test/java/com/example/activitiwithspring/ActivitiSpringSecurityIntegrationTest.java rename to spring-activiti/src/test/java/com/baeldung/activitiwithspring/ActivitiSpringSecurityIntegrationTest.java index c2eeb96555..53bdcee888 100644 --- a/spring-activiti/src/test/java/com/example/activitiwithspring/ActivitiSpringSecurityIntegrationTest.java +++ b/spring-activiti/src/test/java/com/baeldung/activitiwithspring/ActivitiSpringSecurityIntegrationTest.java @@ -1,4 +1,4 @@ -package com.example.activitiwithspring; +package com.baeldung.activitiwithspring; import org.activiti.engine.IdentityService; import org.junit.Test; diff --git a/spring-activiti/src/test/java/com/example/activitiwithspring/ActivitiWithSpringApplicationIntegrationTest.java b/spring-activiti/src/test/java/com/baeldung/activitiwithspring/ActivitiWithSpringApplicationIntegrationTest.java similarity index 89% rename from spring-activiti/src/test/java/com/example/activitiwithspring/ActivitiWithSpringApplicationIntegrationTest.java rename to spring-activiti/src/test/java/com/baeldung/activitiwithspring/ActivitiWithSpringApplicationIntegrationTest.java index 7460c302d8..8c1e400215 100644 --- a/spring-activiti/src/test/java/com/example/activitiwithspring/ActivitiWithSpringApplicationIntegrationTest.java +++ b/spring-activiti/src/test/java/com/baeldung/activitiwithspring/ActivitiWithSpringApplicationIntegrationTest.java @@ -1,4 +1,4 @@ -package com.example.activitiwithspring; +package com.baeldung.activitiwithspring; import org.junit.Test; import org.junit.runner.RunWith; diff --git a/spring-activiti/src/test/java/com/example/activitiwithspring/ProcessEngineCreationIntegrationTest.java b/spring-activiti/src/test/java/com/baeldung/activitiwithspring/ProcessEngineCreationIntegrationTest.java similarity index 98% rename from spring-activiti/src/test/java/com/example/activitiwithspring/ProcessEngineCreationIntegrationTest.java rename to spring-activiti/src/test/java/com/baeldung/activitiwithspring/ProcessEngineCreationIntegrationTest.java index 00afd14590..00538f8e6e 100644 --- a/spring-activiti/src/test/java/com/example/activitiwithspring/ProcessEngineCreationIntegrationTest.java +++ b/spring-activiti/src/test/java/com/baeldung/activitiwithspring/ProcessEngineCreationIntegrationTest.java @@ -1,4 +1,4 @@ -package com.example.activitiwithspring; +package com.baeldung.activitiwithspring; import org.activiti.engine.ProcessEngine; import org.activiti.engine.ProcessEngineConfiguration; diff --git a/spring-activiti/src/test/java/com/example/activitiwithspring/ProcessExecutionIntegrationTest.java b/spring-activiti/src/test/java/com/baeldung/activitiwithspring/ProcessExecutionIntegrationTest.java similarity index 99% rename from spring-activiti/src/test/java/com/example/activitiwithspring/ProcessExecutionIntegrationTest.java rename to spring-activiti/src/test/java/com/baeldung/activitiwithspring/ProcessExecutionIntegrationTest.java index 9c35ea413b..4342590ea9 100644 --- a/spring-activiti/src/test/java/com/example/activitiwithspring/ProcessExecutionIntegrationTest.java +++ b/spring-activiti/src/test/java/com/baeldung/activitiwithspring/ProcessExecutionIntegrationTest.java @@ -1,4 +1,4 @@ -package com.example.activitiwithspring; +package com.baeldung.activitiwithspring; import org.activiti.engine.ActivitiException; diff --git a/spring-all/README.md b/spring-all/README.md index ded5e26285..0d78efdcf2 100644 --- a/spring-all/README.md +++ b/spring-all/README.md @@ -4,10 +4,12 @@ This project is used to replicate Spring Exceptions only. -###The Course +### The Course + The "REST With Spring" Classes: http://bit.ly/restwithspring - -### Relevant articles: + +### Relevant articles: + - [Guide to Spring @Autowired](http://www.baeldung.com/spring-autowire) - [Properties with Spring](http://www.baeldung.com/properties-with-spring) - checkout the `org.baeldung.properties` package for all scenarios of properties injection and usage - [Spring Profiles](http://www.baeldung.com/spring-profiles) @@ -30,3 +32,5 @@ The "REST With Spring" Classes: http://bit.ly/restwithspring - [Spring Web Contexts](http://www.baeldung.com/spring-web-contexts) - [Spring Cache – Creating a Custom KeyGenerator](http://www.baeldung.com/spring-cache-custom-keygenerator) - [Spring @Primary Annotation](http://www.baeldung.com/spring-primary) +- [Spring Events](https://www.baeldung.com/spring-events) +- [Spring Null-Safety Annotations](https://www.baeldung.com/spring-null-safety-annotations) diff --git a/spring-all/pom.xml b/spring-all/pom.xml index bab2e431ec..2dc4915bab 100644 --- a/spring-all/pom.xml +++ b/spring-all/pom.xml @@ -1,7 +1,6 @@ 4.0.0 - com.baeldung spring-all 0.1-SNAPSHOT spring-all diff --git a/spring-all/src/main/java/org/baeldung/caching/eviction/controllers/CachingController.java b/spring-all/src/main/java/org/baeldung/caching/eviction/controllers/CachingController.java new file mode 100644 index 0000000000..675cb7a516 --- /dev/null +++ b/spring-all/src/main/java/org/baeldung/caching/eviction/controllers/CachingController.java @@ -0,0 +1,18 @@ +package org.baeldung.caching.eviction.controllers; + +import org.baeldung.caching.eviction.service.CachingService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RestController; + +@RestController +public class CachingController { + + @Autowired + CachingService cachingService; + + @GetMapping("clearAllCaches") + public void clearAllCaches() { + cachingService.evictAllCaches(); + } +} diff --git a/spring-all/src/main/java/org/baeldung/caching/eviction/service/CachingService.java b/spring-all/src/main/java/org/baeldung/caching/eviction/service/CachingService.java new file mode 100644 index 0000000000..7e37215954 --- /dev/null +++ b/spring-all/src/main/java/org/baeldung/caching/eviction/service/CachingService.java @@ -0,0 +1,53 @@ +package org.baeldung.caching.eviction.service; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.cache.CacheManager; +import org.springframework.cache.annotation.CacheEvict; +import org.springframework.scheduling.annotation.Scheduled; +import org.springframework.stereotype.Component; + +@Component +public class CachingService { + + @Autowired + CacheManager cacheManager; + + public void putToCache(String cacheName, String key, String value) { + cacheManager.getCache(cacheName).put(key, value); + } + + public String getFromCache(String cacheName, String key) { + String value = null; + if (cacheManager.getCache(cacheName).get(key) != null) { + value = cacheManager.getCache(cacheName).get(key).get().toString(); + } + return value; + } + + @CacheEvict(value = "first", key = "#cacheKey") + public void evictSingleCacheValue(String cacheKey) { + } + + @CacheEvict(value = "first", allEntries = true) + public void evictAllCacheValues() { + } + + public void evictSingleCacheValue(String cacheName, String cacheKey) { + cacheManager.getCache(cacheName).evict(cacheKey); + } + + public void evictAllCacheValues(String cacheName) { + cacheManager.getCache(cacheName).clear(); + } + + public void evictAllCaches() { + cacheManager.getCacheNames() + .parallelStream() + .forEach(cacheName -> cacheManager.getCache(cacheName).clear()); + } + + @Scheduled(fixedRate = 6000) + public void evictAllcachesAtIntervals() { + evictAllCaches(); + } +} diff --git a/spring-all/src/main/java/org/baeldung/nullibility/Person.java b/spring-all/src/main/java/org/baeldung/nullibility/Person.java new file mode 100644 index 0000000000..08c77c9e9c --- /dev/null +++ b/spring-all/src/main/java/org/baeldung/nullibility/Person.java @@ -0,0 +1,33 @@ +package org.baeldung.nullibility; + +import org.springframework.lang.NonNull; +import org.springframework.lang.Nullable; + +public class Person { + @NonNull + private String fullName; + @Nullable + private String nickName; + + void setFullName(String fullName) { + if (fullName != null && fullName.isEmpty()) { + fullName = null; + } + this.fullName = fullName; + } + + void setNickName(String nickName) { + if (nickName != null && nickName.isEmpty()) { + nickName = null; + } + this.nickName = nickName; + } + + String getFullName() { + return fullName; + } + + String getNickName() { + return nickName; + } +} diff --git a/spring-all/src/main/java/org/baeldung/nullibility/package-info.java b/spring-all/src/main/java/org/baeldung/nullibility/package-info.java new file mode 100644 index 0000000000..446f2e316e --- /dev/null +++ b/spring-all/src/main/java/org/baeldung/nullibility/package-info.java @@ -0,0 +1,6 @@ +@NonNullApi +@NonNullFields +package org.baeldung.nullibility; + +import org.springframework.lang.NonNullApi; +import org.springframework.lang.NonNullFields; \ No newline at end of file diff --git a/spring-all/src/main/java/org/baeldung/springevents/synchronous/AnnotationDrivenEventListener.java b/spring-all/src/main/java/org/baeldung/springevents/synchronous/AnnotationDrivenEventListener.java new file mode 100644 index 0000000000..f750c40a6e --- /dev/null +++ b/spring-all/src/main/java/org/baeldung/springevents/synchronous/AnnotationDrivenEventListener.java @@ -0,0 +1,46 @@ +package org.baeldung.springevents.synchronous; + +import org.springframework.context.event.ContextStartedEvent; +import org.springframework.context.event.EventListener; +import org.springframework.stereotype.Component; +import org.springframework.transaction.event.TransactionPhase; +import org.springframework.transaction.event.TransactionalEventListener; + +@Component +public class AnnotationDrivenEventListener { + + // for tests + private boolean hitContextStartedHandler = false; + private boolean hitSuccessfulEventHandler = false; + private boolean hitCustomEventHandler = false; + + @EventListener + public void handleContextStart(final ContextStartedEvent cse) { + System.out.println("Handling context started event."); + hitContextStartedHandler = true; + } + + @EventListener(condition = "#event.success") + public void handleSuccessful(final GenericSpringEvent event) { + System.out.println("Handling generic event (conditional): " + event.getWhat()); + hitSuccessfulEventHandler = true; + } + + @TransactionalEventListener(phase = TransactionPhase.BEFORE_COMMIT) + public void handleCustom(final CustomSpringEvent event) { + System.out.println("Handling event inside a transaction BEFORE COMMIT."); + hitCustomEventHandler = true; + } + + boolean isHitContextStartedHandler() { + return hitContextStartedHandler; + } + + boolean isHitSuccessfulEventHandler() { + return hitSuccessfulEventHandler; + } + + boolean isHitCustomEventHandler() { + return hitCustomEventHandler; + } +} diff --git a/spring-all/src/main/java/org/baeldung/springevents/synchronous/ContextRefreshedListener.java b/spring-all/src/main/java/org/baeldung/springevents/synchronous/ContextRefreshedListener.java index 052437e555..9f8b2e6e83 100644 --- a/spring-all/src/main/java/org/baeldung/springevents/synchronous/ContextRefreshedListener.java +++ b/spring-all/src/main/java/org/baeldung/springevents/synchronous/ContextRefreshedListener.java @@ -7,9 +7,16 @@ import org.springframework.stereotype.Component; @Component public class ContextRefreshedListener implements ApplicationListener { + // for tests + private boolean hitContextRefreshedHandler = false; + @Override public void onApplicationEvent(final ContextRefreshedEvent cse) { System.out.println("Handling context re-freshed event. "); + hitContextRefreshedHandler = true; } + boolean isHitContextRefreshedHandler() { + return hitContextRefreshedHandler; + } } \ No newline at end of file diff --git a/spring-all/src/main/java/org/baeldung/springevents/synchronous/CustomSpringEventPublisher.java b/spring-all/src/main/java/org/baeldung/springevents/synchronous/CustomSpringEventPublisher.java index 4569de1d5e..3182090d5d 100644 --- a/spring-all/src/main/java/org/baeldung/springevents/synchronous/CustomSpringEventPublisher.java +++ b/spring-all/src/main/java/org/baeldung/springevents/synchronous/CustomSpringEventPublisher.java @@ -16,4 +16,16 @@ public class CustomSpringEventPublisher { applicationEventPublisher.publishEvent(customSpringEvent); } + public void publishGenericEvent(final String message, boolean success) { + System.out.println("Publishing generic event."); + final GenericSpringEvent genericSpringEvent = new GenericStringSpringEvent(message, success); + applicationEventPublisher.publishEvent(genericSpringEvent); + } + + public void publishGenericAppEvent(final String message) { + System.out.println("Publishing generic event."); + final GenericSpringAppEvent genericSpringEvent = new GenericStringSpringAppEvent(this, message); + applicationEventPublisher.publishEvent(genericSpringEvent); + } + } diff --git a/spring-all/src/main/java/org/baeldung/springevents/synchronous/GenericSpringAppEvent.java b/spring-all/src/main/java/org/baeldung/springevents/synchronous/GenericSpringAppEvent.java new file mode 100644 index 0000000000..6804312189 --- /dev/null +++ b/spring-all/src/main/java/org/baeldung/springevents/synchronous/GenericSpringAppEvent.java @@ -0,0 +1,18 @@ +package org.baeldung.springevents.synchronous; + +import org.springframework.context.ApplicationEvent; + +public class GenericSpringAppEvent extends ApplicationEvent { + + private final T what; + + public GenericSpringAppEvent(final Object source, final T what) { + super(source); + this.what = what; + } + + public T getWhat() { + return what; + } + +} diff --git a/spring-all/src/main/java/org/baeldung/springevents/synchronous/GenericSpringEvent.java b/spring-all/src/main/java/org/baeldung/springevents/synchronous/GenericSpringEvent.java new file mode 100644 index 0000000000..ce2c223fec --- /dev/null +++ b/spring-all/src/main/java/org/baeldung/springevents/synchronous/GenericSpringEvent.java @@ -0,0 +1,21 @@ +package org.baeldung.springevents.synchronous; + +public class GenericSpringEvent { + + private final T what; + protected final boolean success; + + public GenericSpringEvent(final T what, final boolean success) { + this.what = what; + this.success = success; + } + + public T getWhat() { + return what; + } + + public boolean isSuccess() { + return success; + } + +} diff --git a/spring-all/src/main/java/org/baeldung/springevents/synchronous/GenericSpringEventListener.java b/spring-all/src/main/java/org/baeldung/springevents/synchronous/GenericSpringEventListener.java new file mode 100644 index 0000000000..1f5e3e7068 --- /dev/null +++ b/spring-all/src/main/java/org/baeldung/springevents/synchronous/GenericSpringEventListener.java @@ -0,0 +1,22 @@ +package org.baeldung.springevents.synchronous; + +import org.springframework.context.ApplicationListener; +import org.springframework.lang.NonNull; +import org.springframework.stereotype.Component; + +@Component +public class GenericSpringEventListener implements ApplicationListener> { + + // for testing + private boolean hitEventHandler = false; + + @Override + public void onApplicationEvent(@NonNull final GenericSpringAppEvent event) { + System.out.println("Received spring generic event - " + event.getWhat()); + hitEventHandler = true; + } + + boolean isHitEventHandler() { + return hitEventHandler; + } +} \ No newline at end of file diff --git a/spring-all/src/main/java/org/baeldung/springevents/synchronous/GenericStringSpringAppEvent.java b/spring-all/src/main/java/org/baeldung/springevents/synchronous/GenericStringSpringAppEvent.java new file mode 100644 index 0000000000..fd214696e7 --- /dev/null +++ b/spring-all/src/main/java/org/baeldung/springevents/synchronous/GenericStringSpringAppEvent.java @@ -0,0 +1,9 @@ +package org.baeldung.springevents.synchronous; + +class GenericStringSpringAppEvent extends GenericSpringAppEvent { + + GenericStringSpringAppEvent(final Object source, final String what) { + super(source, what); + } + +} diff --git a/spring-all/src/main/java/org/baeldung/springevents/synchronous/GenericStringSpringEvent.java b/spring-all/src/main/java/org/baeldung/springevents/synchronous/GenericStringSpringEvent.java new file mode 100644 index 0000000000..dd4e4e3ed4 --- /dev/null +++ b/spring-all/src/main/java/org/baeldung/springevents/synchronous/GenericStringSpringEvent.java @@ -0,0 +1,9 @@ +package org.baeldung.springevents.synchronous; + +public class GenericStringSpringEvent extends GenericSpringEvent { + + GenericStringSpringEvent(final String what, final boolean success) { + super(what, success); + } + +} diff --git a/spring-all/src/test/java/org/baeldung/caching/test/CacheEvictAnnotationIntegrationTest.java b/spring-all/src/test/java/org/baeldung/caching/test/CacheEvictAnnotationIntegrationTest.java new file mode 100644 index 0000000000..f24cdef917 --- /dev/null +++ b/spring-all/src/test/java/org/baeldung/caching/test/CacheEvictAnnotationIntegrationTest.java @@ -0,0 +1,79 @@ +package org.baeldung.caching.test; + +import static org.hamcrest.CoreMatchers.is; +import static org.hamcrest.CoreMatchers.nullValue; +import static org.junit.Assert.assertThat; + +import java.util.ArrayList; +import java.util.List; + +import org.baeldung.caching.eviction.service.CachingService; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.cache.Cache; +import org.springframework.cache.CacheManager; +import org.springframework.cache.annotation.EnableCaching; +import org.springframework.cache.concurrent.ConcurrentMapCacheFactoryBean; +import org.springframework.cache.support.SimpleCacheManager; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; + +@RunWith(SpringJUnit4ClassRunner.class) +@ContextConfiguration +public class CacheEvictAnnotationIntegrationTest { + + @Configuration + @EnableCaching + static class ContextConfiguration { + + @Bean + public CachingService cachingService() { + return new CachingService(); + } + + @Bean + public CacheManager cacheManager(){ + SimpleCacheManager cacheManager = new SimpleCacheManager(); + List caches = new ArrayList<>(); + caches.add(cacheBean().getObject()); + cacheManager.setCaches(caches ); + return cacheManager; + } + + @Bean + public ConcurrentMapCacheFactoryBean cacheBean(){ + ConcurrentMapCacheFactoryBean cacheFactoryBean = new ConcurrentMapCacheFactoryBean(); + cacheFactoryBean.setName("first"); + return cacheFactoryBean; + } + } + + @Autowired + CachingService cachingService; + + @Before + public void before() { + cachingService.putToCache("first", "key1", "Baeldung"); + cachingService.putToCache("first", "key2", "Article"); + } + + @Test + public void givenFirstCache_whenSingleCacheValueEvictRequested_thenEmptyCacheValue() { + cachingService.evictSingleCacheValue("key1"); + String key1 = cachingService.getFromCache("first", "key1"); + assertThat(key1, is(nullValue())); + } + + @Test + public void givenFirstCache_whenAllCacheValueEvictRequested_thenEmptyCache() { + cachingService.evictAllCacheValues(); + String key1 = cachingService.getFromCache("first", "key1"); + String key2 = cachingService.getFromCache("first", "key2"); + assertThat(key1, is(nullValue())); + assertThat(key2, is(nullValue())); + } +} diff --git a/spring-all/src/test/java/org/baeldung/caching/test/CacheManagerEvictIntegrationTest.java b/spring-all/src/test/java/org/baeldung/caching/test/CacheManagerEvictIntegrationTest.java new file mode 100644 index 0000000000..9c6aaea892 --- /dev/null +++ b/spring-all/src/test/java/org/baeldung/caching/test/CacheManagerEvictIntegrationTest.java @@ -0,0 +1,96 @@ +package org.baeldung.caching.test; + +import static org.hamcrest.CoreMatchers.is; +import static org.hamcrest.CoreMatchers.nullValue; +import static org.junit.Assert.assertThat; + +import java.util.ArrayList; +import java.util.List; + +import org.baeldung.caching.eviction.service.CachingService; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.cache.Cache; +import org.springframework.cache.CacheManager; +import org.springframework.cache.concurrent.ConcurrentMapCacheFactoryBean; +import org.springframework.cache.support.SimpleCacheManager; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; + +@RunWith(SpringJUnit4ClassRunner.class) +@ContextConfiguration +public class CacheManagerEvictIntegrationTest { + + @Configuration + static class ContextConfiguration { + + @Bean + public CachingService cachingService() { + return new CachingService(); + } + + @Bean + public CacheManager cacheManager(){ + SimpleCacheManager cacheManager = new SimpleCacheManager(); + List caches = new ArrayList<>(); + caches.add(cacheBeanFirst().getObject()); + caches.add(cacheBeanSecond().getObject()); + cacheManager.setCaches(caches ); + return cacheManager; + } + + @Bean + public ConcurrentMapCacheFactoryBean cacheBeanFirst(){ + ConcurrentMapCacheFactoryBean cacheFactoryBean = new ConcurrentMapCacheFactoryBean(); + cacheFactoryBean.setName("first"); + return cacheFactoryBean; + } + + @Bean + public ConcurrentMapCacheFactoryBean cacheBeanSecond(){ + ConcurrentMapCacheFactoryBean cacheFactoryBean = new ConcurrentMapCacheFactoryBean(); + cacheFactoryBean.setName("second"); + return cacheFactoryBean; + } + } + + @Autowired + CachingService cachingService; + + @Before + public void before() { + cachingService.putToCache("first", "key1", "Baeldung"); + cachingService.putToCache("first", "key2", "Article"); + cachingService.putToCache("second", "key", "Article"); + } + + @Test + public void givenFirstCache_whenSingleCacheValueEvictRequested_thenEmptyCacheValue() { + cachingService.evictSingleCacheValue("first", "key1"); + String key1 = cachingService.getFromCache("first", "key1"); + assertThat(key1, is(nullValue())); + } + + @Test + public void givenFirstCache_whenAllCacheValueEvictRequested_thenEmptyCache() { + cachingService.evictAllCacheValues("first"); + String key1 = cachingService.getFromCache("first", "key1"); + String key2 = cachingService.getFromCache("first", "key2"); + assertThat(key1, is(nullValue())); + assertThat(key2, is(nullValue())); + } + + @Test + public void givenAllCaches_whenAllCacheEvictRequested_thenEmptyAllCaches() { + cachingService.evictAllCaches(); + String key1 = cachingService.getFromCache("first", "key1"); + assertThat(key1, is(nullValue())); + + String key = cachingService.getFromCache("second", "key"); + assertThat(key, is(nullValue())); + } +} diff --git a/spring-all/src/test/java/org/baeldung/springevents/synchronous/ContextRefreshedListenerIntegrationTest.java b/spring-all/src/test/java/org/baeldung/springevents/synchronous/ContextRefreshedListenerIntegrationTest.java index ac8758bbf6..e8e6f91b06 100644 --- a/spring-all/src/test/java/org/baeldung/springevents/synchronous/ContextRefreshedListenerIntegrationTest.java +++ b/spring-all/src/test/java/org/baeldung/springevents/synchronous/ContextRefreshedListenerIntegrationTest.java @@ -3,16 +3,23 @@ package org.baeldung.springevents.synchronous; import org.baeldung.springevents.synchronous.SynchronousSpringEventsConfig; import org.junit.Test; import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import org.springframework.test.context.support.AnnotationConfigContextLoader; +import static org.springframework.util.Assert.isTrue; + @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(classes = { SynchronousSpringEventsConfig.class }, loader = AnnotationConfigContextLoader.class) public class ContextRefreshedListenerIntegrationTest { + @Autowired + private ContextRefreshedListener listener; + @Test - public void testContextRefreshedListener() throws InterruptedException { + public void testContextRefreshedListener() { System.out.println("Test context re-freshed listener."); + isTrue(listener.isHitContextRefreshedHandler(), "Refresh should be called once"); } } \ No newline at end of file diff --git a/spring-all/src/test/java/org/baeldung/springevents/synchronous/GenericAppEventListenerIntegrationTest.java b/spring-all/src/test/java/org/baeldung/springevents/synchronous/GenericAppEventListenerIntegrationTest.java new file mode 100644 index 0000000000..f183314b6d --- /dev/null +++ b/spring-all/src/test/java/org/baeldung/springevents/synchronous/GenericAppEventListenerIntegrationTest.java @@ -0,0 +1,28 @@ +package org.baeldung.springevents.synchronous; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.support.AnnotationConfigContextLoader; + +import static org.springframework.util.Assert.isTrue; + +@RunWith(SpringJUnit4ClassRunner.class) +@ContextConfiguration(classes = { SynchronousSpringEventsConfig.class }, loader = AnnotationConfigContextLoader.class) +public class GenericAppEventListenerIntegrationTest { + + @Autowired + private CustomSpringEventPublisher publisher; + @Autowired + private GenericSpringEventListener listener; + + @Test + public void testGenericSpringEvent() { + isTrue(!listener.isHitEventHandler(), "The initial value should be false"); + publisher.publishGenericAppEvent("Hello world!!!"); + isTrue(listener.isHitEventHandler(), "Now the value should be changed to true"); + } + +} \ No newline at end of file diff --git a/spring-all/src/test/java/org/baeldung/springevents/synchronous/SynchronousCustomSpringEventsIntegrationTest.java b/spring-all/src/test/java/org/baeldung/springevents/synchronous/SynchronousCustomSpringEventsIntegrationTest.java index f9783f57dc..b169cfec36 100644 --- a/spring-all/src/test/java/org/baeldung/springevents/synchronous/SynchronousCustomSpringEventsIntegrationTest.java +++ b/spring-all/src/test/java/org/baeldung/springevents/synchronous/SynchronousCustomSpringEventsIntegrationTest.java @@ -1,5 +1,6 @@ package org.baeldung.springevents.synchronous; +import org.junit.Ignore; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; @@ -7,16 +8,42 @@ import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import org.springframework.test.context.support.AnnotationConfigContextLoader; +import static org.springframework.util.Assert.isTrue; + @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(classes = { SynchronousSpringEventsConfig.class }, loader = AnnotationConfigContextLoader.class) public class SynchronousCustomSpringEventsIntegrationTest { @Autowired private CustomSpringEventPublisher publisher; + @Autowired + private AnnotationDrivenEventListener listener; @Test - public void testCustomSpringEvents() throws InterruptedException { + public void testCustomSpringEvents() { + isTrue(!listener.isHitCustomEventHandler(), "The value should be false"); publisher.publishEvent("Hello world!!"); System.out.println("Done publishing synchronous custom event. "); + isTrue(listener.isHitCustomEventHandler(), "Now the value should be changed to true"); + } + + @Test + public void testGenericSpringEvent() { + isTrue(!listener.isHitSuccessfulEventHandler(), "The initial value should be false"); + publisher.publishGenericEvent("Hello world!!!", true); + isTrue(listener.isHitSuccessfulEventHandler(), "Now the value should be changed to true"); + } + + @Test + public void testGenericSpringEventNotProcessed() { + isTrue(!listener.isHitSuccessfulEventHandler(), "The initial value should be false"); + publisher.publishGenericEvent("Hello world!!!", false); + isTrue(!listener.isHitSuccessfulEventHandler(), "The value should still be false"); + } + + @Ignore("fix me") + @Test + public void testContextStartedEvent() { + isTrue(listener.isHitContextStartedHandler(), "Start should be called once"); } } diff --git a/spring-amqp-simple/pom.xml b/spring-amqp-simple/pom.xml index 3d9ea55cfa..57d84acee6 100644 --- a/spring-amqp-simple/pom.xml +++ b/spring-amqp-simple/pom.xml @@ -5,7 +5,7 @@ com.baeldung spring-amqp-simple 1.0.0-SNAPSHOT - Spring AMQP Simple App + spring-amqp-simple parent-boot-1 diff --git a/spring-aop/pom.xml b/spring-aop/pom.xml index b9b97eb076..368f3ada14 100644 --- a/spring-aop/pom.xml +++ b/spring-aop/pom.xml @@ -1,9 +1,7 @@ 4.0.0 - com.baeldung spring-aop - 0.0.1-SNAPSHOT war spring-aop diff --git a/spring-boot-admin/pom.xml b/spring-boot-admin/pom.xml index 58cea728cc..23852dee57 100644 --- a/spring-boot-admin/pom.xml +++ b/spring-boot-admin/pom.xml @@ -3,6 +3,7 @@ 4.0.0 spring-boot-admin 0.0.1-SNAPSHOT + spring-boot-admin pom diff --git a/spring-boot-autoconfiguration/pom.xml b/spring-boot-autoconfiguration/pom.xml index b88587f731..1c3d8796ed 100644 --- a/spring-boot-autoconfiguration/pom.xml +++ b/spring-boot-autoconfiguration/pom.xml @@ -5,7 +5,7 @@ spring-boot-autoconfiguration 0.0.1-SNAPSHOT war - spring-boot-auto-configuration + spring-boot-autoconfiguration This is simple boot application demonstrating a custom auto-configuration diff --git a/spring-boot-autoconfiguration/src/main/java/com/baeldung/autoconfiguration/MySQLAutoconfiguration.java b/spring-boot-autoconfiguration/src/main/java/com/baeldung/autoconfiguration/MySQLAutoconfiguration.java index d6fc1836c7..295e0d74c9 100644 --- a/spring-boot-autoconfiguration/src/main/java/com/baeldung/autoconfiguration/MySQLAutoconfiguration.java +++ b/spring-boot-autoconfiguration/src/main/java/com/baeldung/autoconfiguration/MySQLAutoconfiguration.java @@ -47,7 +47,7 @@ public class MySQLAutoconfiguration { final DriverManagerDataSource dataSource = new DriverManagerDataSource(); dataSource.setDriverClassName("com.mysql.cj.jdbc.Driver"); - dataSource.setUrl("jdbc:mysql://localhost:3306/myDb?createDatabaseIfNotExist=true"); + dataSource.setUrl("jdbc:mysql://localhost:3306/myDb?createDatabaseIfNotExist=true&&serverTimezone=UTC"); dataSource.setUsername("mysqluser"); dataSource.setPassword("mysqlpass"); diff --git a/spring-boot-autoconfiguration/src/main/resources/META-INF/spring.factories b/spring-boot-autoconfiguration/src/main/resources/META-INF/spring.factories index 5f55544eff..11c775fc6c 100644 --- a/spring-boot-autoconfiguration/src/main/resources/META-INF/spring.factories +++ b/spring-boot-autoconfiguration/src/main/resources/META-INF/spring.factories @@ -1,3 +1 @@ -org.springframework.boot.diagnostics.FailureAnalyzer=com.baeldung.failureanalyzer.MyBeanNotOfRequiredTypeFailureAnalyzer - -org.springframework.boot.autoconfigure.EnableAutoConfiguration=com.baeldung.autoconfiguration.MySQLAutoconfiguration \ No newline at end of file +org.springframework.boot.autoconfigure.EnableAutoConfiguration=com.baeldung.autoconfiguration.MySQLAutoconfiguration diff --git a/spring-boot-autoconfiguration/src/test/java/com/baeldung/autoconfiguration/AutoconfigurationIntegrationTest.java b/spring-boot-autoconfiguration/src/test/java/com/baeldung/autoconfiguration/AutoconfigurationLiveTest.java similarity index 95% rename from spring-boot-autoconfiguration/src/test/java/com/baeldung/autoconfiguration/AutoconfigurationIntegrationTest.java rename to spring-boot-autoconfiguration/src/test/java/com/baeldung/autoconfiguration/AutoconfigurationLiveTest.java index 30ba397b46..df4c1fcd14 100644 --- a/spring-boot-autoconfiguration/src/test/java/com/baeldung/autoconfiguration/AutoconfigurationIntegrationTest.java +++ b/spring-boot-autoconfiguration/src/test/java/com/baeldung/autoconfiguration/AutoconfigurationLiveTest.java @@ -13,7 +13,7 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; @RunWith(SpringJUnit4ClassRunner.class) @SpringBootTest(classes = AutoconfigurationApplication.class) @EnableJpaRepositories(basePackages = { "com.baeldung.autoconfiguration.example" }) -public class AutoconfigurationIntegrationTest { +public class AutoconfigurationLiveTest { @Autowired private MyUserRepository userRepository; diff --git a/spring-boot-autoconfiguration/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-boot-autoconfiguration/src/test/java/com/baeldung/autoconfiguration/SpringContextLiveTest.java similarity index 88% rename from spring-boot-autoconfiguration/src/test/java/org/baeldung/SpringContextIntegrationTest.java rename to spring-boot-autoconfiguration/src/test/java/com/baeldung/autoconfiguration/SpringContextLiveTest.java index 136ea2481f..acd4b10ae9 100644 --- a/spring-boot-autoconfiguration/src/test/java/org/baeldung/SpringContextIntegrationTest.java +++ b/spring-boot-autoconfiguration/src/test/java/com/baeldung/autoconfiguration/SpringContextLiveTest.java @@ -1,4 +1,4 @@ -package org.baeldung; +package com.baeldung.autoconfiguration; import org.junit.Test; import org.junit.runner.RunWith; @@ -11,7 +11,7 @@ import com.baeldung.autoconfiguration.example.AutoconfigurationApplication; @RunWith(SpringRunner.class) @SpringBootTest(classes = AutoconfigurationApplication.class) @EnableJpaRepositories(basePackages = { "com.baeldung.autoconfiguration.example" }) -public class SpringContextIntegrationTest { +public class SpringContextLiveTest { @Test public void whenSpringContextIsBootstrapped_thenNoExceptions() { diff --git a/spring-boot-bootstrap/README.md b/spring-boot-bootstrap/README.md index 08fdb1bdc9..76b977c129 100644 --- a/spring-boot-bootstrap/README.md +++ b/spring-boot-bootstrap/README.md @@ -4,3 +4,4 @@ - [Thin JARs with Spring Boot](http://www.baeldung.com/spring-boot-thin-jar) - [Deploying a Spring Boot Application to Cloud Foundry](https://www.baeldung.com/spring-boot-app-deploy-to-cloud-foundry) - [Deploy a Spring Boot Application to Google App Engine](https://www.baeldung.com/spring-boot-google-app-engine) +- [Deploy a Spring Boot Application to OpenShift](https://www.baeldung.com/spring-boot-deploy-openshift) diff --git a/spring-boot-bootstrap/openshift/configmap.yml b/spring-boot-bootstrap/openshift/configmap.yml new file mode 100644 index 0000000000..931a614436 --- /dev/null +++ b/spring-boot-bootstrap/openshift/configmap.yml @@ -0,0 +1,7 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: spring-boot-bootstrap +data: + application.properties: |- + spring.datasource.url=jdbc:mysql://baeldung-db:3306/baeldung_db \ No newline at end of file diff --git a/spring-boot-bootstrap/pom.xml b/spring-boot-bootstrap/pom.xml index b5bcc587b1..7cafc5aa24 100644 --- a/spring-boot-bootstrap/pom.xml +++ b/spring-boot-bootstrap/pom.xml @@ -1,231 +1,311 @@ - 4.0.0 - org.baeldung - spring-boot-bootstrap - jar - spring-boot-bootstrap - Demo project for Spring Boot + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + 4.0.0 + com.baeldung + spring-boot-bootstrap + jar + spring-boot-bootstrap + Demo project for Spring Boot + + parent-boot-2 + com.baeldung + 0.0.1-SNAPSHOT + ../parent-boot-2 + + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework.boot + spring-boot-starter-thymeleaf + + + org.springframework.boot + spring-boot-starter-data-jpa + + + com.h2database + h2 + + + mysql + mysql-connector-java + + + org.springframework.boot + spring-boot-starter-security + + + org.springframework.boot + spring-boot-starter-test + test + + + io.rest-assured + rest-assured + ${rest-assured.version} + test + + + javax.servlet + javax.servlet-api + ${servlet.version} + + - - parent-boot-2 - com.baeldung - 0.0.1-SNAPSHOT - ../parent-boot-2 - - - - - org.springframework.cloud - spring-cloud-dependencies - Finchley.SR1 - pom - import - - - - - - - org.springframework.boot - spring-boot-starter-web - - - org.springframework.boot - spring-boot-starter-thymeleaf - - - org.springframework.boot - spring-boot-starter-data-jpa - - - org.springframework.cloud - spring-cloud-starter - - - org.springframework.boot - spring-boot-starter-cloud-connectors - - - com.h2database - h2 - - - mysql - mysql-connector-java - - - org.springframework.boot - spring-boot-starter-security - - - org.springframework.boot - spring-boot-starter-test - test - - - io.rest-assured - rest-assured - ${rest-assured.version} - test - - - javax.servlet - javax.servlet-api - ${servlet.version} - - - - - - cloud-gcp - - - org.springframework.cloud - spring-cloud-gcp-starter - 1.0.0.RELEASE - - - org.springframework.cloud - spring-cloud-gcp-starter-sql-mysql - 1.0.0.RELEASE - - - - ${project.name}-gcp - - - src/main/resources - - **/logback.xml - - - - - - com.google.cloud.tools - appengine-maven-plugin - 1.3.2 - - - org.springframework.boot - spring-boot-maven-plugin - - - - - - cloudfoundry - - - org.springframework.cloud - spring-cloud-starter - - - org.springframework.boot - spring-boot-starter-cloud-connectors - - - - ${project.name}-cf - - - src/main/resources - - **/logback.xml - - - - - - org.springframework.boot - spring-boot-maven-plugin - - - org.apache.maven.plugins - maven-compiler-plugin - - - **/cloud/config/*.java - - - - - - - - autoconfiguration - - - - org.apache.maven.plugins - maven-surefire-plugin - - - integration-test - - test - - - - **/*LiveTest.java - **/*IntegrationTest.java - **/*IntTest.java - - - **/AutoconfigurationTest.java - - - - - - - json - - - - - - - - thin-jar - - - - org.springframework.boot.experimental - spring-boot-thin-maven-plugin - ${thin.version} - - - - resolve - - resolve - - false - - - - - - - - - - - org.apache.maven.plugins - maven-compiler-plugin - - - **/cloud/*.java - - - - - - - 4.0.0 - + + + openshift + + 0.3.0.RELEASE + Finchley.SR2 + 3.5.37 + + + + + org.springframework.cloud + spring-cloud-kubernetes-dependencies + ${spring-cloud-k8s.version} + pom + import + + + org.springframework.cloud + spring-cloud-dependencies + ${spring-cloud.version} + pom + import + + + + + + org.springframework.cloud + spring-cloud-starter-kubernetes-config + + + org.springframework.boot + spring-boot-starter-actuator + + + org.springframework.boot + spring-boot-actuator + + + + + + src/main/resources + + **/logback.xml + + + + + + org.apache.maven.plugins + maven-compiler-plugin + + + **/cloud/config/*.java + + + + + org.springframework.boot + spring-boot-maven-plugin + + + io.fabric8 + fabric8-maven-plugin + ${fabric8.maven.plugin.version} + + + fmp + + resource + build + + + + + + + + + cloud-gcp + + + + org.springframework.cloud + spring-cloud-dependencies + Finchley.SR1 + pom + import + + + + + + org.springframework.cloud + spring-cloud-gcp-starter + 1.0.0.RELEASE + + + org.springframework.cloud + spring-cloud-gcp-starter-sql-mysql + 1.0.0.RELEASE + + + + ${project.name}-gcp + + + src/main/resources + + **/logback.xml + + + + + + com.google.cloud.tools + appengine-maven-plugin + 1.3.2 + + + org.springframework.boot + spring-boot-maven-plugin + + + + + + cloudfoundry + + + + org.springframework.cloud + spring-cloud-dependencies + Finchley.SR1 + pom + import + + + + + + org.springframework.cloud + spring-cloud-starter + + + org.springframework.boot + spring-boot-starter-cloud-connectors + + + + ${project.name}-cf + + + src/main/resources + + **/logback.xml + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + org.apache.maven.plugins + maven-compiler-plugin + + + **/cloud/config/*.java + + + + + + + + autoconfiguration + + + + org.apache.maven.plugins + maven-surefire-plugin + + + integration-test + + test + + + + **/*LiveTest.java + **/*IntegrationTest.java + **/*IntTest.java + + + **/AutoconfigurationTest.java + + + + + + + json + + + + + + + + thin-jar + + + + org.springframework.boot.experimental + spring-boot-thin-maven-plugin + ${thin.version} + + + + resolve + + resolve + + false + + + + + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + + + **/cloud/config/*.java + + + + + + + 4.0.0 + diff --git a/spring-boot-bootstrap/src/main/fabric8/deployment.yml b/spring-boot-bootstrap/src/main/fabric8/deployment.yml new file mode 100644 index 0000000000..1bdf1ff167 --- /dev/null +++ b/spring-boot-bootstrap/src/main/fabric8/deployment.yml @@ -0,0 +1,29 @@ +spec: + template: + spec: + containers: + - env: + - name: SPRING_PROFILES_ACTIVE + value: mysql + - name: SPRING_DATASOURCE_USER + valueFrom: + secretKeyRef: + name: baeldung-db + key: database-user + - name: SPRING_DATASOURCE_PASSWORD + valueFrom: + secretKeyRef: + name: baeldung-db + key: database-password + livenessProbe: + httpGet: + path: /actuator/health + port: 8080 + scheme: HTTP + initialDelaySeconds: 180 + readinessProbe: + httpGet: + path: /actuator/health + port: 8080 + scheme: HTTP + initialDelaySeconds: 20 \ No newline at end of file diff --git a/spring-boot-bootstrap/src/main/java/org/baeldung/Application.java b/spring-boot-bootstrap/src/main/java/com/baeldung/Application.java similarity index 78% rename from spring-boot-bootstrap/src/main/java/org/baeldung/Application.java rename to spring-boot-bootstrap/src/main/java/com/baeldung/Application.java index ba1b444e44..567e9b2678 100644 --- a/spring-boot-bootstrap/src/main/java/org/baeldung/Application.java +++ b/spring-boot-bootstrap/src/main/java/com/baeldung/Application.java @@ -1,4 +1,4 @@ -package org.baeldung; +package com.baeldung; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @@ -9,9 +9,9 @@ import org.springframework.data.jpa.repository.config.EnableJpaRepositories; @ServletComponentScan @SpringBootApplication -@ComponentScan("org.baeldung") -@EnableJpaRepositories("org.baeldung.persistence.repo") -@EntityScan("org.baeldung.persistence.model") +@ComponentScan("com.baeldung") +@EnableJpaRepositories("com.baeldung.persistence.repo") +@EntityScan("com.baeldung.persistence.model") public class Application { public static void main(String[] args) { diff --git a/spring-boot-bootstrap/src/main/java/org/baeldung/cloud/config/CloudDataSourceConfig.java b/spring-boot-bootstrap/src/main/java/com/baeldung/cloud/config/CloudDataSourceConfig.java similarity index 93% rename from spring-boot-bootstrap/src/main/java/org/baeldung/cloud/config/CloudDataSourceConfig.java rename to spring-boot-bootstrap/src/main/java/com/baeldung/cloud/config/CloudDataSourceConfig.java index b9f9598ca3..7afc036be5 100755 --- a/spring-boot-bootstrap/src/main/java/org/baeldung/cloud/config/CloudDataSourceConfig.java +++ b/spring-boot-bootstrap/src/main/java/com/baeldung/cloud/config/CloudDataSourceConfig.java @@ -1,4 +1,4 @@ -package org.baeldung.cloud.config; +package com.baeldung.cloud.config; import org.springframework.cloud.config.java.AbstractCloudConfig; import org.springframework.context.annotation.Bean; diff --git a/spring-boot-bootstrap/src/main/java/org/baeldung/config/SecurityConfig.java b/spring-boot-bootstrap/src/main/java/com/baeldung/config/SecurityConfig.java similarity index 95% rename from spring-boot-bootstrap/src/main/java/org/baeldung/config/SecurityConfig.java rename to spring-boot-bootstrap/src/main/java/com/baeldung/config/SecurityConfig.java index fd37d2ad54..8e403f3976 100644 --- a/spring-boot-bootstrap/src/main/java/org/baeldung/config/SecurityConfig.java +++ b/spring-boot-bootstrap/src/main/java/com/baeldung/config/SecurityConfig.java @@ -1,4 +1,4 @@ -package org.baeldung.config; +package com.baeldung.config; import org.springframework.context.annotation.Configuration; import org.springframework.security.config.annotation.web.builders.HttpSecurity; diff --git a/spring-boot-bootstrap/src/main/java/org/baeldung/persistence/model/Book.java b/spring-boot-bootstrap/src/main/java/com/baeldung/persistence/model/Book.java similarity index 98% rename from spring-boot-bootstrap/src/main/java/org/baeldung/persistence/model/Book.java rename to spring-boot-bootstrap/src/main/java/com/baeldung/persistence/model/Book.java index 745a1d0460..6be27d4cf0 100644 --- a/spring-boot-bootstrap/src/main/java/org/baeldung/persistence/model/Book.java +++ b/spring-boot-bootstrap/src/main/java/com/baeldung/persistence/model/Book.java @@ -1,4 +1,4 @@ -package org.baeldung.persistence.model; +package com.baeldung.persistence.model; import javax.persistence.Column; import javax.persistence.Entity; diff --git a/spring-boot-bootstrap/src/main/java/org/baeldung/persistence/repo/BookRepository.java b/spring-boot-bootstrap/src/main/java/com/baeldung/persistence/repo/BookRepository.java similarity index 72% rename from spring-boot-bootstrap/src/main/java/org/baeldung/persistence/repo/BookRepository.java rename to spring-boot-bootstrap/src/main/java/com/baeldung/persistence/repo/BookRepository.java index 011f3dcb60..cfd0018145 100644 --- a/spring-boot-bootstrap/src/main/java/org/baeldung/persistence/repo/BookRepository.java +++ b/spring-boot-bootstrap/src/main/java/com/baeldung/persistence/repo/BookRepository.java @@ -1,8 +1,9 @@ -package org.baeldung.persistence.repo; +package com.baeldung.persistence.repo; -import org.baeldung.persistence.model.Book; import org.springframework.data.repository.CrudRepository; +import com.baeldung.persistence.model.Book; + import java.util.List; import java.util.Optional; diff --git a/spring-boot-bootstrap/src/main/java/org/baeldung/web/BookController.java b/spring-boot-bootstrap/src/main/java/com/baeldung/web/BookController.java similarity index 89% rename from spring-boot-bootstrap/src/main/java/org/baeldung/web/BookController.java rename to spring-boot-bootstrap/src/main/java/com/baeldung/web/BookController.java index 44129fc7f8..7c86bb833f 100644 --- a/spring-boot-bootstrap/src/main/java/org/baeldung/web/BookController.java +++ b/spring-boot-bootstrap/src/main/java/com/baeldung/web/BookController.java @@ -1,9 +1,5 @@ -package org.baeldung.web; +package com.baeldung.web; -import org.baeldung.persistence.model.Book; -import org.baeldung.persistence.repo.BookRepository; -import org.baeldung.web.exception.BookIdMismatchException; -import org.baeldung.web.exception.BookNotFoundException; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; import org.springframework.web.bind.annotation.CrossOrigin; @@ -17,6 +13,11 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseStatus; import org.springframework.web.bind.annotation.RestController; +import com.baeldung.persistence.model.Book; +import com.baeldung.persistence.repo.BookRepository; +import com.baeldung.web.exception.BookIdMismatchException; +import com.baeldung.web.exception.BookNotFoundException; + import java.util.List; @RestController diff --git a/spring-boot-bootstrap/src/main/java/org/baeldung/web/RestExceptionHandler.java b/spring-boot-bootstrap/src/main/java/com/baeldung/web/RestExceptionHandler.java similarity index 90% rename from spring-boot-bootstrap/src/main/java/org/baeldung/web/RestExceptionHandler.java rename to spring-boot-bootstrap/src/main/java/com/baeldung/web/RestExceptionHandler.java index cc5b8ee394..dca2e33c52 100644 --- a/spring-boot-bootstrap/src/main/java/org/baeldung/web/RestExceptionHandler.java +++ b/spring-boot-bootstrap/src/main/java/com/baeldung/web/RestExceptionHandler.java @@ -1,7 +1,5 @@ -package org.baeldung.web; +package com.baeldung.web; -import org.baeldung.web.exception.BookIdMismatchException; -import org.baeldung.web.exception.BookNotFoundException; import org.hibernate.exception.ConstraintViolationException; import org.springframework.dao.DataIntegrityViolationException; import org.springframework.http.HttpHeaders; @@ -12,6 +10,9 @@ import org.springframework.web.bind.annotation.ExceptionHandler; import org.springframework.web.context.request.WebRequest; import org.springframework.web.servlet.mvc.method.annotation.ResponseEntityExceptionHandler; +import com.baeldung.web.exception.BookIdMismatchException; +import com.baeldung.web.exception.BookNotFoundException; + @ControllerAdvice public class RestExceptionHandler extends ResponseEntityExceptionHandler { diff --git a/spring-boot-bootstrap/src/main/java/org/baeldung/web/SimpleController.java b/spring-boot-bootstrap/src/main/java/com/baeldung/web/SimpleController.java similarity index 94% rename from spring-boot-bootstrap/src/main/java/org/baeldung/web/SimpleController.java rename to spring-boot-bootstrap/src/main/java/com/baeldung/web/SimpleController.java index 809d6c1094..ee0ba75443 100644 --- a/spring-boot-bootstrap/src/main/java/org/baeldung/web/SimpleController.java +++ b/spring-boot-bootstrap/src/main/java/com/baeldung/web/SimpleController.java @@ -1,4 +1,4 @@ -package org.baeldung.web; +package com.baeldung.web; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Controller; diff --git a/spring-boot-bootstrap/src/main/java/org/baeldung/web/exception/BookIdMismatchException.java b/spring-boot-bootstrap/src/main/java/com/baeldung/web/exception/BookIdMismatchException.java similarity index 92% rename from spring-boot-bootstrap/src/main/java/org/baeldung/web/exception/BookIdMismatchException.java rename to spring-boot-bootstrap/src/main/java/com/baeldung/web/exception/BookIdMismatchException.java index 23c55e2d38..bafecd59b6 100644 --- a/spring-boot-bootstrap/src/main/java/org/baeldung/web/exception/BookIdMismatchException.java +++ b/spring-boot-bootstrap/src/main/java/com/baeldung/web/exception/BookIdMismatchException.java @@ -1,4 +1,4 @@ -package org.baeldung.web.exception; +package com.baeldung.web.exception; public class BookIdMismatchException extends RuntimeException { diff --git a/spring-boot-bootstrap/src/main/java/org/baeldung/web/exception/BookNotFoundException.java b/spring-boot-bootstrap/src/main/java/com/baeldung/web/exception/BookNotFoundException.java similarity index 91% rename from spring-boot-bootstrap/src/main/java/org/baeldung/web/exception/BookNotFoundException.java rename to spring-boot-bootstrap/src/main/java/com/baeldung/web/exception/BookNotFoundException.java index 3ff416b3f3..42f49e58a3 100644 --- a/spring-boot-bootstrap/src/main/java/org/baeldung/web/exception/BookNotFoundException.java +++ b/spring-boot-bootstrap/src/main/java/com/baeldung/web/exception/BookNotFoundException.java @@ -1,4 +1,4 @@ -package org.baeldung.web.exception; +package com.baeldung.web.exception; public class BookNotFoundException extends RuntimeException { diff --git a/spring-boot-bootstrap/src/test/java/org/baeldung/SpringBootBootstrapIntegrationTest.java b/spring-boot-bootstrap/src/test/java/com/baeldung/SpringBootBootstrapLiveTest.java similarity index 89% rename from spring-boot-bootstrap/src/test/java/org/baeldung/SpringBootBootstrapIntegrationTest.java rename to spring-boot-bootstrap/src/test/java/com/baeldung/SpringBootBootstrapLiveTest.java index 8993617d5c..3af7f2104d 100644 --- a/spring-boot-bootstrap/src/test/java/org/baeldung/SpringBootBootstrapIntegrationTest.java +++ b/spring-boot-bootstrap/src/test/java/com/baeldung/SpringBootBootstrapLiveTest.java @@ -1,28 +1,24 @@ -package org.baeldung; +package com.baeldung; import static org.apache.commons.lang3.RandomStringUtils.randomAlphabetic; import static org.apache.commons.lang3.RandomStringUtils.randomNumeric; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; -import io.restassured.RestAssured; -import io.restassured.response.Response; import java.util.List; -import org.baeldung.persistence.model.Book; 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.http.HttpStatus; import org.springframework.http.MediaType; -import org.springframework.test.context.junit4.SpringRunner; -@RunWith(SpringRunner.class) -@SpringBootTest(classes = Application.class, webEnvironment = WebEnvironment.DEFINED_PORT) -public class SpringBootBootstrapIntegrationTest { +import com.baeldung.persistence.model.Book; - private static final String API_ROOT = "http://localhost:8081/api/books"; +import io.restassured.RestAssured; +import io.restassured.response.Response; + +public class SpringBootBootstrapLiveTest { + + private static final String API_ROOT = "http://localhost:8080/api/books"; @Test public void whenGetAllBooks_thenOK() { diff --git a/spring-boot-bootstrap/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-boot-bootstrap/src/test/java/com/baeldung/SpringContextIntegrationTest.java similarity index 93% rename from spring-boot-bootstrap/src/test/java/org/baeldung/SpringContextIntegrationTest.java rename to spring-boot-bootstrap/src/test/java/com/baeldung/SpringContextIntegrationTest.java index 9ae417a546..08c6692689 100644 --- a/spring-boot-bootstrap/src/test/java/org/baeldung/SpringContextIntegrationTest.java +++ b/spring-boot-bootstrap/src/test/java/com/baeldung/SpringContextIntegrationTest.java @@ -1,4 +1,4 @@ -package org.baeldung; +package com.baeldung; import org.junit.Test; import org.junit.runner.RunWith; diff --git a/spring-boot-camel/pom.xml b/spring-boot-camel/pom.xml index 19a0bec809..8bab0ed5c8 100644 --- a/spring-boot-camel/pom.xml +++ b/spring-boot-camel/pom.xml @@ -5,7 +5,8 @@ com.example spring-boot-camel 0.0.1-SNAPSHOT - + spring-boot-camel + com.baeldung parent-modules diff --git a/spring-boot-client/src/test/java/org/baeldung/boot/client/DetailsServiceClientIntegrationTest.java b/spring-boot-client/src/test/java/org/baeldung/boot/client/DetailsServiceClientIntegrationTest.java index 71fb330663..d423300b85 100644 --- a/spring-boot-client/src/test/java/org/baeldung/boot/client/DetailsServiceClientIntegrationTest.java +++ b/spring-boot-client/src/test/java/org/baeldung/boot/client/DetailsServiceClientIntegrationTest.java @@ -10,7 +10,6 @@ import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.autoconfigure.web.client.RestClientTest; -import org.springframework.boot.test.context.SpringBootTest; import org.springframework.http.MediaType; import org.springframework.test.context.junit4.SpringRunner; import org.springframework.test.web.client.MockRestServiceServer; @@ -18,8 +17,7 @@ import org.springframework.test.web.client.MockRestServiceServer; import com.fasterxml.jackson.databind.ObjectMapper; @RunWith(SpringRunner.class) -@SpringBootTest(classes = Application.class) -@RestClientTest(DetailsServiceClient.class) +@RestClientTest({ DetailsServiceClient.class, Application.class }) public class DetailsServiceClientIntegrationTest { @Autowired @@ -34,7 +32,8 @@ public class DetailsServiceClientIntegrationTest { @Before public void setUp() throws Exception { String detailsString = objectMapper.writeValueAsString(new Details("John Smith", "john")); - this.server.expect(requestTo("/john/details")).andRespond(withSuccess(detailsString, MediaType.APPLICATION_JSON)); + this.server.expect(requestTo("/john/details")) + .andRespond(withSuccess(detailsString, MediaType.APPLICATION_JSON)); } @Test diff --git a/spring-boot-crud/README.md b/spring-boot-crud/README.md new file mode 100644 index 0000000000..566cb327a8 --- /dev/null +++ b/spring-boot-crud/README.md @@ -0,0 +1,2 @@ +### Relevant Articles: +- [Spring Boot CRUD Application with Thymeleaf](https://www.baeldung.com/spring-boot-crud-thymeleaf) diff --git a/spring-boot-crud/pom.xml b/spring-boot-crud/pom.xml new file mode 100644 index 0000000000..749bf9cb5a --- /dev/null +++ b/spring-boot-crud/pom.xml @@ -0,0 +1,65 @@ + + + 4.0.0 + com.baeldung.spring-boot-crud + spring-boot-crud + 0.1.0 + spring-boot-crud + + + org.springframework.boot + spring-boot-starter-parent + 2.0.6.RELEASE + + + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework.boot + spring-boot-starter-thymeleaf + + + org.springframework.boot + spring-boot-starter-data-jpa + + + org.springframework.boot + spring-boot-starter-test + + + org.mockito + mockito-core + test + + + com.h2database + h2 + runtime + + + + UTF-8 + 1.8 + + + + spring-boot-crud + + + src/main/resources + true + + + + + org.springframework.boot + spring-boot-maven-plugin + + + + \ No newline at end of file diff --git a/spring-boot-crud/src/main/java/com/baeldung/crud/Application.java b/spring-boot-crud/src/main/java/com/baeldung/crud/Application.java new file mode 100644 index 0000000000..0b686e90e9 --- /dev/null +++ b/spring-boot-crud/src/main/java/com/baeldung/crud/Application.java @@ -0,0 +1,23 @@ +package com.baeldung.crud; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.boot.autoconfigure.EnableAutoConfiguration; +import org.springframework.boot.autoconfigure.domain.EntityScan; +import org.springframework.context.annotation.ComponentScan; +import org.springframework.data.jpa.repository.config.EnableJpaRepositories; +import org.springframework.transaction.annotation.EnableTransactionManagement; + +@SpringBootApplication +@EnableAutoConfiguration +@ComponentScan(basePackages={"com.baeldung.crud"}) +@EnableJpaRepositories(basePackages="com.baeldung.crud.repositories") +@EnableTransactionManagement +@EntityScan(basePackages="com.baeldung.crud.entities") +public class Application { + + public static void main(String[] args) { + SpringApplication.run(Application.class, args); + } + +} diff --git a/spring-boot-crud/src/main/java/com/baeldung/crud/controllers/UserController.java b/spring-boot-crud/src/main/java/com/baeldung/crud/controllers/UserController.java new file mode 100644 index 0000000000..9a6cb477aa --- /dev/null +++ b/spring-boot-crud/src/main/java/com/baeldung/crud/controllers/UserController.java @@ -0,0 +1,68 @@ +package com.baeldung.crud.controllers; + +import javax.validation.Valid; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.ui.Model; +import org.springframework.validation.BindingResult; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; + +import com.baeldung.crud.entities.User; +import com.baeldung.crud.repositories.UserRepository; + +@Controller +public class UserController { + + private final UserRepository userRepository; + + @Autowired + public UserController(UserRepository userRepository) { + this.userRepository = userRepository; + } + + @GetMapping("/signup") + public String showSignUpForm(User user) { + return "add-user"; + } + + @PostMapping("/adduser") + public String addUser(@Valid User user, BindingResult result, Model model) { + if (result.hasErrors()) { + return "add-user"; + } + + userRepository.save(user); + model.addAttribute("users", userRepository.findAll()); + return "index"; + } + + @GetMapping("/edit/{id}") + public String showUpdateForm(@PathVariable("id") long id, Model model) { + User user = userRepository.findById(id).orElseThrow(() -> new IllegalArgumentException("Invalid user Id:" + id)); + model.addAttribute("user", user); + return "update-user"; + } + + @PostMapping("/update/{id}") + public String updateUser(@PathVariable("id") long id, @Valid User user, BindingResult result, Model model) { + if (result.hasErrors()) { + user.setId(id); + return "update-user"; + } + + userRepository.save(user); + model.addAttribute("users", userRepository.findAll()); + return "index"; + } + + @GetMapping("/delete/{id}") + public String deleteUser(@PathVariable("id") long id, Model model) { + User user = userRepository.findById(id).orElseThrow(() -> new IllegalArgumentException("Invalid user Id:" + id)); + userRepository.delete(user); + model.addAttribute("users", userRepository.findAll()); + return "index"; + } +} diff --git a/spring-boot-crud/src/main/java/com/baeldung/crud/entities/User.java b/spring-boot-crud/src/main/java/com/baeldung/crud/entities/User.java new file mode 100644 index 0000000000..2074268179 --- /dev/null +++ b/spring-boot-crud/src/main/java/com/baeldung/crud/entities/User.java @@ -0,0 +1,56 @@ +package com.baeldung.crud.entities; + +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.validation.constraints.NotBlank; + +@Entity +public class User { + + @Id + @GeneratedValue(strategy = GenerationType.AUTO) + private long id; + @NotBlank(message = "Name is mandatory") + private String name; + + @NotBlank(message = "Email is mandatory") + private String email; + + public User() {} + + public User(String name, String email) { + this.name = name; + this.email = email; + } + + public void setId(long id) { + this.id = id; + } + + public long getId() { + return id; + } + + public void setName(String name) { + this.name = name; + } + + public void setEmail(String email) { + this.email = email; + } + + public String getName() { + return name; + } + + public String getEmail() { + return email; + } + + @Override + public String toString() { + return "User{" + "id=" + id + ", name=" + name + ", email=" + email + '}'; + } +} diff --git a/spring-boot-crud/src/main/java/com/baeldung/crud/repositories/UserRepository.java b/spring-boot-crud/src/main/java/com/baeldung/crud/repositories/UserRepository.java new file mode 100644 index 0000000000..72348463f2 --- /dev/null +++ b/spring-boot-crud/src/main/java/com/baeldung/crud/repositories/UserRepository.java @@ -0,0 +1,13 @@ +package com.baeldung.crud.repositories; + +import com.baeldung.crud.entities.User; +import java.util.List; +import org.springframework.data.repository.CrudRepository; +import org.springframework.stereotype.Repository; + +@Repository +public interface UserRepository extends CrudRepository { + + List findByName(String name); + +} diff --git a/spring-boot-crud/src/main/resources/css/shards.min.css b/spring-boot-crud/src/main/resources/css/shards.min.css new file mode 100644 index 0000000000..02260d25fa --- /dev/null +++ b/spring-boot-crud/src/main/resources/css/shards.min.css @@ -0,0 +1,2 @@ +@import url(https://fonts.googleapis.com/css?family=Poppins:300,400,500,600|Roboto+Mono);:root{--blue:#007bff;--indigo:#674eec;--purple:#8445f7;--pink:#ff4169;--red:#c4183c;--orange:#fb7906;--yellow:#ffb400;--green:#17c671;--teal:#1adba2;--cyan:#00b8d8;--white:#fff;--gray:#868e96;--gray-dark:#343a40;--primary:#007bff;--secondary:#5A6169;--success:#17c671;--info:#00b8d8;--warning:#ffb400;--danger:#c4183c;--light:#e9ecef;--dark:#212529;--breakpoint-xs:0;--breakpoint-sm:576px;--breakpoint-md:768px;--breakpoint-lg:992px;--breakpoint-xl:1200px;--font-family-sans-serif:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif;--font-family-monospace:"Roboto Mono",Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace}@media (max-width:575.98px){html{font-size:15px}}body{font-size:1rem;font-weight:300;color:#5a6169;background-color:#fff}a{color:#007bff;text-decoration:none}a:hover{color:#0056b3;text-decoration:underline}b,strong{font-weight:500}h1,h2,h3,h4,h5,h6{margin-top:0;margin-bottom:.5rem}.h1,.h2,.h3,.h4,.h5,.h6{display:block}.h1,.h2,.h3,.h4,.h5,.h6,h1,h2,h3,h4,h5,h6{margin-bottom:.75rem;font-family:Poppins,-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif;font-weight:400;color:#212529}.h1,h1{font-size:3.052rem;letter-spacing:-.0625rem;line-height:3rem}.h2,h2{font-size:2.441rem;letter-spacing:-.0625rem;line-height:2.25rem}.h3,h3{font-size:1.953rem;line-height:2.25rem}.h4,h4{font-size:1.563rem;line-height:2rem}.h5,h5{font-size:1.25rem;line-height:1.5rem}.h6,h6{font-size:1rem;line-height:1.5rem}.lead{line-height:1.875rem}.display-1,.display-2,.display-3,.display-4{margin-bottom:.75rem}.display-1{font-size:7.451rem;line-height:1}.display-2{font-size:5.96rem;line-height:1}.display-3{font-size:4.768rem;line-height:1}.display-4{font-size:3.815rem;line-height:1}p{margin-bottom:1.75rem}hr{margin-top:1.125rem;margin-bottom:1.125rem;border-top:1px solid rgba(0,0,0,.1)}.small,small{font-size:80%;font-weight:300}.mark,mark{padding:.2em;background-color:#fff09e}.blockquote{margin-bottom:.75rem;font-size:1.5rem}.blockquote-footer{font-size:1.125rem}.img-thumbnail{padding:0;border:none;background-color:#fff;border-radius:.375rem;box-shadow:none}.figure-img{margin-bottom:.75rem}.figure-caption{font-size:1rem;color:#868e96}code,kbd,pre,samp{font-family:"Roboto Mono",Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace}code{font-size:.75rem;padding:.1875rem .8125rem}kbd{padding:.1875rem .8125rem;font-size:.75rem;color:#fff;background-color:#212529;border-radius:.625rem;box-shadow:none}kbd kbd{font-weight:500}pre{margin-bottom:.75rem;font-size:.75rem;color:#212529;line-height:1.375rem}.pre-scrollable{max-height:340px}.table{background-color:transparent}.table td,.table th{padding:.75rem}.table .table{background-color:#fff}.table-sm td,.table-sm th{padding:.3rem}.table-primary,.table-primary>td,.table-primary>th{background-color:#b8daff}.table-hover .table-primary:hover{background-color:#9fcdff}.table-hover .table-primary:hover>td,.table-hover .table-primary:hover>th{background-color:#9fcdff}.table-secondary,.table-secondary>td,.table-secondary>th{background-color:#d1d3d5}.table-hover .table-secondary:hover{background-color:#c4c6c9}.table-hover .table-secondary:hover>td,.table-hover .table-secondary:hover>th{background-color:#c4c6c9}.table-success,.table-success>td,.table-success>th{background-color:#beefd7}.table-hover .table-success:hover{background-color:#aaeaca}.table-hover .table-success:hover>td,.table-hover .table-success:hover>th{background-color:#aaeaca}.table-info,.table-info>td,.table-info>th{background-color:#b8ebf4}.table-hover .table-info:hover{background-color:#a2e5f1}.table-hover .table-info:hover>td,.table-hover .table-info:hover>th{background-color:#a2e5f1}.table-warning,.table-warning>td,.table-warning>th{background-color:#ffeab8}.table-hover .table-warning:hover{background-color:#ffe29f}.table-hover .table-warning:hover>td,.table-hover .table-warning:hover>th{background-color:#ffe29f}.table-danger,.table-danger>td,.table-danger>th{background-color:#eebec8}.table-hover .table-danger:hover{background-color:#e9aab7}.table-hover .table-danger:hover>td,.table-hover .table-danger:hover>th{background-color:#e9aab7}.table-light,.table-light>td,.table-light>th{background-color:#f9fafb}.table-hover .table-light:hover{background-color:#eaedf1}.table-hover .table-light:hover>td,.table-hover .table-light:hover>th{background-color:#eaedf1}.table-dark,.table-dark>td,.table-dark>th{background-color:#c1c2c3}.table-hover .table-dark:hover{background-color:#b4b5b6}.table-hover .table-dark:hover>td,.table-hover .table-dark:hover>th{background-color:#b4b5b6}.table-active,.table-active>td,.table-active>th{background-color:rgba(0,0,0,.075)}.table-hover .table-active:hover{background-color:rgba(0,0,0,.075)}.table-hover .table-active:hover>td,.table-hover .table-active:hover>th{background-color:rgba(0,0,0,.075)}.table .thead-dark th{color:#fff;background-color:#212529;border-color:#32383e}.table .thead-light th{color:#495057;background-color:#e9ecef;border-color:#dee2e6}.table-dark{color:#fff;background-color:#212529}.table-dark td,.table-dark th,.table-dark thead th{border-color:#32383e}.table-dark.table-striped tbody tr:nth-of-type(odd){background-color:rgba(255,255,255,.05)}.table-dark.table-hover tbody tr:hover{background-color:rgba(255,255,255,.075)}.form-control{height:auto;padding:.5rem 1rem;font-size:.95rem;line-height:1.5;color:#495057;background-color:#fff;border:1px solid #becad6;font-weight:300;will-change:border-color,box-shadow;border-radius:.375rem;box-shadow:none;transition:box-shadow 250ms cubic-bezier(.27,.01,.38,1.06),border 250ms cubic-bezier(.27,.01,.38,1.06)}.form-control:hover{border-color:#8fa4b8}.form-control:focus{color:#495057;background-color:#fff;border-color:#007bff;box-shadow:0 .313rem .719rem rgba(0,123,255,.1),0 .156rem .125rem rgba(0,0,0,.06)}.form-control:focus:hover{border-color:#007bff}.form-control::-webkit-input-placeholder{color:#868e96}.form-control:-ms-input-placeholder{color:#868e96}.form-control::-ms-input-placeholder{color:#868e96}.form-control::placeholder{color:#868e96}.form-control:disabled,.form-control[readonly]{background-color:#f5f6f7}.form-control:disabled:hover,.form-control[readonly]:hover{border-color:#becad6;cursor:not-allowed}.form-control[readonly]:not(:disabled):focus{box-shadow:none;border-color:#becad6}select.form-control:not([size]):not([multiple]){height:calc(2.425rem + 2px)}select.form-control:focus::-ms-value{color:#495057;background-color:#fff}select.form-control:hover{cursor:pointer}form label:hover{cursor:pointer}.col-form-label{padding-top:calc(.5rem + 1px);padding-bottom:calc(.5rem + 1px);line-height:1.5}.col-form-label-lg{padding-top:calc(.75rem + 1px);padding-bottom:calc(.75rem + 1px);font-size:1.25rem;line-height:1.5}.col-form-label-sm{padding-top:calc(.35rem + 1px);padding-bottom:calc(.35rem + 1px);font-size:.875rem;line-height:1.5}.form-control-plaintext{padding-top:.5rem;padding-bottom:.5rem;line-height:1.5;font-weight:300}.form-control-sm,.input-group-sm>.form-control,.input-group-sm>.input-group-append>.btn,.input-group-sm>.input-group-append>.input-group-text,.input-group-sm>.input-group-middle>.input-group-text,.input-group-sm>.input-group-prepend>.btn,.input-group-sm>.input-group-prepend>.input-group-text{padding:.35rem .75rem;font-size:.875rem;line-height:1.5;border-radius:.35rem}.input-group-sm>.input-group-append>select.btn:not([size]):not([multiple]),.input-group-sm>.input-group-append>select.input-group-text:not([size]):not([multiple]),.input-group-sm>.input-group-middle>select.input-group-text:not([size]):not([multiple]),.input-group-sm>.input-group-prepend>select.btn:not([size]):not([multiple]),.input-group-sm>.input-group-prepend>select.input-group-text:not([size]):not([multiple]),.input-group-sm>select.form-control:not([size]):not([multiple]),select.form-control-sm:not([size]):not([multiple]){height:calc(2.0125rem + 2px)}.form-control-lg,.input-group-lg>.form-control,.input-group-lg>.input-group-append>.btn,.input-group-lg>.input-group-append>.input-group-text,.input-group-lg>.input-group-middle>.input-group-text,.input-group-lg>.input-group-prepend>.btn,.input-group-lg>.input-group-prepend>.input-group-text{padding:.75rem 1rem;font-size:1.25rem;line-height:1.5;border-radius:.5rem}.input-group-lg>.input-group-append>select.btn:not([size]):not([multiple]),.input-group-lg>.input-group-append>select.input-group-text:not([size]):not([multiple]),.input-group-lg>.input-group-middle>select.input-group-text:not([size]):not([multiple]),.input-group-lg>.input-group-prepend>select.btn:not([size]):not([multiple]),.input-group-lg>.input-group-prepend>select.input-group-text:not([size]):not([multiple]),.input-group-lg>select.form-control:not([size]):not([multiple]),select.form-control-lg:not([size]):not([multiple]){height:calc(3.375rem + 2px)}.form-group{margin-bottom:1rem}.form-text{margin-top:.25rem}.form-check{padding-left:1.25rem}.form-check-input{margin-top:.313rem;margin-left:-1.25rem}.form-check-input:disabled~.form-check-label{color:#868e96}.form-check-inline{margin-right:.75rem}.form-check-inline .form-check-input{margin-right:.3125rem}.valid-feedback{margin-top:.25rem;font-size:80%;color:#17c671}.valid-tooltip{background-color:rgba(23,198,113,.8)}.custom-select.is-valid,.form-control.is-valid,.was-validated .custom-select:valid,.was-validated .form-control:valid{border-color:#17c671;box-shadow:0 5px 11.5px rgba(23,198,113,.1)}.custom-select.is-valid:focus,.form-control.is-valid:focus,.was-validated .custom-select:valid:focus,.was-validated .form-control:valid:focus{box-shadow:0 5px 11.5px rgba(23,198,113,.1),0 1px 1px .1rem rgba(23,198,113,.2)}.custom-select.is-valid:hover,.form-control.is-valid:hover,.was-validated .custom-select:valid:hover,.was-validated .form-control:valid:hover{border-color:#17c671}.form-check-input.is-valid~.form-check-label,.was-validated .form-check-input:valid~.form-check-label{color:#17c671}.custom-control-input.is-valid~.custom-control-label,.was-validated .custom-control-input:valid~.custom-control-label{color:#17c671}.custom-control-input.is-valid~.custom-control-label::before,.was-validated .custom-control-input:valid~.custom-control-label::before{background-color:#57eca4;border-color:#2ae68b}.custom-control-input.is-valid:checked~.custom-control-label::before,.was-validated .custom-control-input:valid:checked~.custom-control-label::before{background-color:#2ae68b}.custom-control-input.is-valid:focus~.custom-control-label::before,.was-validated .custom-control-input:valid:focus~.custom-control-label::before{box-shadow:0 .313rem .719rem rgba(23,198,113,.1),0 .156rem .125rem rgba(0,0,0,.06)}.custom-file-input.is-valid~.custom-file-label,.was-validated .custom-file-input:valid~.custom-file-label{color:#17c671;border-color:#17c671}.custom-file-input.is-valid~.custom-file-label::after,.was-validated .custom-file-input:valid~.custom-file-label::after{background-color:#b3f6d5;border-color:#2ae68b;color:#17c671}.custom-file-input:focus.is-valid~.custom-file-label,.was-validated .custom-file-input:focus:valid~.custom-file-label{border-color:#17c671;box-shadow:0 5px 11.5px rgba(23,198,113,.1),0 1px 1px .1rem rgba(23,198,113,.2)}.custom-file-input:hover.is-valid~.custom-file-label,.was-validated .custom-file-input:hover:valid~.custom-file-label{border-color:#17c671}.custom-toggle .custom-control-input:not(:checked).is-valid~.custom-control-label::before,.was-validated .custom-toggle .custom-control-input:not(:checked):valid~.custom-control-label::before{background-color:#fff}.custom-toggle .custom-control-input.is-valid~.custom-control-label::before,.was-validated .custom-toggle .custom-control-input:valid~.custom-control-label::before{background-color:#17c671}.custom-toggle .custom-control-input.is-invalid~.custom-control-label::after,.was-validated .custom-toggle .custom-control-input:invalid~.custom-control-label::after{background-color:#eb8c95}.custom-toggle .custom-control-input.is-invalid:focus~.custom-control-label::before,.was-validated .custom-toggle .custom-control-input:invalid:focus~.custom-control-label::before{box-shadow:0 .313rem .719rem rgba(23,198,113,.1),0 .156rem .125rem rgba(0,0,0,.06)}.invalid-feedback{margin-top:.25rem;font-size:80%;color:#c4183c}.invalid-tooltip{background-color:rgba(196,24,60,.8)}.custom-select.is-invalid,.form-control.is-invalid,.was-validated .custom-select:invalid,.was-validated .form-control:invalid{border-color:#c4183c;box-shadow:0 5px 11.5px rgba(196,24,60,.1)}.custom-select.is-invalid:focus,.form-control.is-invalid:focus,.was-validated .custom-select:invalid:focus,.was-validated .form-control:invalid:focus{box-shadow:0 5px 11.5px rgba(196,24,60,.1),0 1px 1px .1rem rgba(196,24,60,.2)}.custom-select.is-invalid:hover,.form-control.is-invalid:hover,.was-validated .custom-select:invalid:hover,.was-validated .form-control:invalid:hover{border-color:#c4183c}.form-check-input.is-invalid~.form-check-label,.was-validated .form-check-input:invalid~.form-check-label{color:#c4183c}.custom-control-input.is-invalid~.custom-control-label,.was-validated .custom-control-input:invalid~.custom-control-label{color:#c4183c}.custom-control-input.is-invalid~.custom-control-label::before,.was-validated .custom-control-input:invalid~.custom-control-label::before{background-color:#ea5876;border-color:#e52a51}.custom-control-input.is-invalid:checked~.custom-control-label::before,.was-validated .custom-control-input:invalid:checked~.custom-control-label::before{background-color:#e52a51}.custom-control-input.is-invalid:focus~.custom-control-label::before,.was-validated .custom-control-input:invalid:focus~.custom-control-label::before{box-shadow:0 .313rem .719rem rgba(196,24,60,.1),0 .156rem .125rem rgba(0,0,0,.06)}.custom-file-input.is-invalid~.custom-file-label,.was-validated .custom-file-input:invalid~.custom-file-label{color:#c4183c;border-color:#c4183c}.custom-file-input.is-invalid~.custom-file-label::after,.was-validated .custom-file-input:invalid~.custom-file-label::after{background-color:#f6b2c0;border-color:#e52a51;color:#c4183c}.custom-file-input:focus.is-invalid~.custom-file-label,.was-validated .custom-file-input:focus:invalid~.custom-file-label{border-color:#c4183c;box-shadow:0 5px 11.5px rgba(196,24,60,.1),0 1px 1px .1rem rgba(196,24,60,.2)}.custom-file-input:hover.is-invalid~.custom-file-label,.was-validated .custom-file-input:hover:invalid~.custom-file-label{border-color:#c4183c}.custom-toggle .custom-control-input:not(:checked).is-invalid~.custom-control-label::before,.was-validated .custom-toggle .custom-control-input:not(:checked):invalid~.custom-control-label::before{background-color:#fff}.custom-toggle .custom-control-input.is-valid~.custom-control-label::before,.was-validated .custom-toggle .custom-control-input:valid~.custom-control-label::before{background-color:#17c671}.custom-toggle .custom-control-input.is-invalid~.custom-control-label::after,.was-validated .custom-toggle .custom-control-input:invalid~.custom-control-label::after{background-color:#eb8c95}.custom-toggle .custom-control-input.is-invalid:focus~.custom-control-label::before,.was-validated .custom-toggle .custom-control-input:invalid:focus~.custom-control-label::before{box-shadow:0 .313rem .719rem rgba(196,24,60,.1),0 .156rem .125rem rgba(0,0,0,.06)}@media (min-width:576px){.form-inline .form-check-input{margin-right:.313rem}}.btn{font-weight:300;font-family:Poppins,-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif;border:1px solid transparent;padding:.75rem 1.25rem;font-size:.875rem;line-height:1.125;border-radius:.375rem;transition:all 250ms cubic-bezier(.27,.01,.38,1.06)}.btn.hover,.btn:hover{cursor:pointer}.btn.focus,.btn:focus{box-shadow:none}.btn:not([disabled]):not(.disabled).active,.btn:not([disabled]):not(.disabled):active{background-image:none;box-shadow:none}.btn.btn-squared{border-radius:0}.btn.btn-pill{border-radius:50px}.btn-primary{color:#fff;border-color:#007bff;background-color:#007bff;box-shadow:none}.btn-primary:hover{color:#fff;background-color:#006fe6;border-color:#006fe6;box-shadow:0 5px 15px rgba(0,0,0,.05),0 4px 10px rgba(0,123,255,.25)}.btn-primary.focus,.btn-primary:focus{box-shadow:0 0 0 3px rgba(0,123,255,.15),0 3px 15px rgba(0,123,255,.2),0 2px 5px rgba(0,0,0,.1)}.btn-primary.disabled,.btn-primary:disabled{background-color:#007bff;border-color:#007bff;box-shadow:none;cursor:not-allowed}.btn-primary:not(:disabled):not(.disabled).active,.btn-primary:not(:disabled):not(.disabled):active,.show>.btn-primary.dropdown-toggle{color:#fff;background-color:#006fe6;border-color:#0062cc;background-image:none;box-shadow:inset 0 3px 5px rgba(0,0,0,.125)!important}.btn-secondary{color:#fff;border-color:#5a6169;background-color:#5a6169;box-shadow:none}.btn-secondary:hover{color:#fff;background-color:#4e545b;border-color:#4e545b;box-shadow:0 5px 15px rgba(0,0,0,.05),0 4px 10px rgba(90,97,105,.25)}.btn-secondary.focus,.btn-secondary:focus{box-shadow:0 0 0 3px rgba(90,97,105,.15),0 3px 15px rgba(90,97,105,.2),0 2px 5px rgba(0,0,0,.1)}.btn-secondary.disabled,.btn-secondary:disabled{background-color:#5a6169;border-color:#5a6169;box-shadow:none;cursor:not-allowed}.btn-secondary:not(:disabled):not(.disabled).active,.btn-secondary:not(:disabled):not(.disabled):active,.show>.btn-secondary.dropdown-toggle{color:#fff;background-color:#4e545b;border-color:#42484e;background-image:none;box-shadow:inset 0 3px 5px rgba(0,0,0,.125)!important}.btn-success{color:#fff;border-color:#17c671;background-color:#17c671;box-shadow:none}.btn-success:hover{color:#fff;background-color:#14af64;border-color:#14af64;box-shadow:0 5px 15px rgba(0,0,0,.05),0 4px 10px rgba(23,198,113,.25)}.btn-success.focus,.btn-success:focus{box-shadow:0 0 0 3px rgba(23,198,113,.15),0 3px 15px rgba(23,198,113,.2),0 2px 5px rgba(0,0,0,.1)}.btn-success.disabled,.btn-success:disabled{background-color:#17c671;border-color:#17c671;box-shadow:none;cursor:not-allowed}.btn-success:not(:disabled):not(.disabled).active,.btn-success:not(:disabled):not(.disabled):active,.show>.btn-success.dropdown-toggle{color:#fff;background-color:#14af64;border-color:#129857;background-image:none;box-shadow:inset 0 3px 5px rgba(0,0,0,.125)!important}.btn-info{color:#fff;border-color:#00b8d8;background-color:#00b8d8;box-shadow:none}.btn-info:hover{color:#fff;background-color:#00a2bf;border-color:#00a2bf;box-shadow:0 5px 15px rgba(0,0,0,.05),0 4px 10px rgba(0,184,216,.25)}.btn-info.focus,.btn-info:focus{box-shadow:0 0 0 3px rgba(0,184,216,.15),0 3px 15px rgba(0,184,216,.2),0 2px 5px rgba(0,0,0,.1)}.btn-info.disabled,.btn-info:disabled{background-color:#00b8d8;border-color:#00b8d8;box-shadow:none;cursor:not-allowed}.btn-info:not(:disabled):not(.disabled).active,.btn-info:not(:disabled):not(.disabled):active,.show>.btn-info.dropdown-toggle{color:#fff;background-color:#00a2bf;border-color:#008da5;background-image:none;box-shadow:inset 0 3px 5px rgba(0,0,0,.125)!important}.btn-warning{color:#212529;border-color:#ffb400;background-color:#ffb400;box-shadow:none}.btn-warning:hover{color:#212529;background-color:#e6a200;border-color:#e6a200;box-shadow:0 5px 15px rgba(0,0,0,.05),0 4px 10px rgba(255,180,0,.25)}.btn-warning.focus,.btn-warning:focus{box-shadow:0 0 0 3px rgba(255,180,0,.15),0 3px 15px rgba(255,180,0,.2),0 2px 5px rgba(0,0,0,.1)}.btn-warning.disabled,.btn-warning:disabled{background-color:#ffb400;border-color:#ffb400;box-shadow:none;cursor:not-allowed}.btn-warning:not(:disabled):not(.disabled).active,.btn-warning:not(:disabled):not(.disabled):active,.show>.btn-warning.dropdown-toggle{color:#212529;background-color:#e6a200;border-color:#cc9000;background-image:none;box-shadow:inset 0 3px 5px rgba(0,0,0,.125)!important}.btn-danger{color:#fff;border-color:#c4183c;background-color:#c4183c;box-shadow:none}.btn-danger:hover{color:#fff;background-color:#ad1535;border-color:#ad1535;box-shadow:0 5px 15px rgba(0,0,0,.05),0 4px 10px rgba(196,24,60,.25)}.btn-danger.focus,.btn-danger:focus{box-shadow:0 0 0 3px rgba(196,24,60,.15),0 3px 15px rgba(196,24,60,.2),0 2px 5px rgba(0,0,0,.1)}.btn-danger.disabled,.btn-danger:disabled{background-color:#c4183c;border-color:#c4183c;box-shadow:none;cursor:not-allowed}.btn-danger:not(:disabled):not(.disabled).active,.btn-danger:not(:disabled):not(.disabled):active,.show>.btn-danger.dropdown-toggle{color:#fff;background-color:#ad1535;border-color:#97122e;background-image:none;box-shadow:inset 0 3px 5px rgba(0,0,0,.125)!important}.btn-light{color:#212529;border-color:#e9ecef;background-color:#e9ecef;box-shadow:none}.btn-light:hover{color:#212529;background-color:#dadfe4;border-color:#dadfe4;box-shadow:0 5px 15px rgba(0,0,0,.05),0 4px 10px rgba(233,236,239,.25)}.btn-light.focus,.btn-light:focus{box-shadow:0 0 0 3px rgba(233,236,239,.15),0 3px 15px rgba(233,236,239,.2),0 2px 5px rgba(0,0,0,.1)}.btn-light.disabled,.btn-light:disabled{background-color:#e9ecef;border-color:#e9ecef;box-shadow:none;cursor:not-allowed}.btn-light:not(:disabled):not(.disabled).active,.btn-light:not(:disabled):not(.disabled):active,.show>.btn-light.dropdown-toggle{color:#212529;background-color:#dadfe4;border-color:#cbd3da;background-image:none;box-shadow:inset 0 3px 5px rgba(0,0,0,.125)!important}.btn-dark{color:#fff;border-color:#212529;background-color:#212529;box-shadow:none}.btn-dark:hover{color:#fff;background-color:#16181b;border-color:#16181b;box-shadow:0 5px 15px rgba(0,0,0,.05),0 4px 10px rgba(33,37,41,.25)}.btn-dark.focus,.btn-dark:focus{box-shadow:0 0 0 3px rgba(33,37,41,.15),0 3px 15px rgba(33,37,41,.2),0 2px 5px rgba(0,0,0,.1)}.btn-dark.disabled,.btn-dark:disabled{background-color:#212529;border-color:#212529;box-shadow:none;cursor:not-allowed}.btn-dark:not(:disabled):not(.disabled).active,.btn-dark:not(:disabled):not(.disabled):active,.show>.btn-dark.dropdown-toggle{color:#fff;background-color:#16181b;border-color:#0a0c0d;background-image:none;box-shadow:inset 0 3px 5px rgba(0,0,0,.125)!important}.btn-white{color:#212529;border-color:#fff;background-color:#fff;box-shadow:none}.btn-white:hover{color:#212529;background-color:#f2f2f2;border-color:#f2f2f2;box-shadow:0 5px 15px rgba(0,0,0,.05),0 4px 10px rgba(255,255,255,.25)}.btn-white.focus,.btn-white:focus{box-shadow:0 0 0 3px rgba(255,255,255,.15),0 3px 15px rgba(255,255,255,.2),0 2px 5px rgba(0,0,0,.1)}.btn-white.disabled,.btn-white:disabled{background-color:#fff;border-color:#fff;box-shadow:none;cursor:not-allowed}.btn-white:not(:disabled):not(.disabled).active,.btn-white:not(:disabled):not(.disabled):active,.show>.btn-white.dropdown-toggle{color:#212529;background-color:#f2f2f2;border-color:#e6e6e6;background-image:none;box-shadow:inset 0 3px 5px rgba(0,0,0,.125)!important}.btn-black{color:#fff;border-color:#000;background-color:#000;box-shadow:none}.btn-black:hover{color:#fff;background-color:#000;border-color:#000;box-shadow:0 5px 15px rgba(0,0,0,.05),0 4px 10px rgba(0,0,0,.25)}.btn-black.focus,.btn-black:focus{box-shadow:0 0 0 3px rgba(0,0,0,.15),0 3px 15px rgba(0,0,0,.2),0 2px 5px rgba(0,0,0,.1)}.btn-black.disabled,.btn-black:disabled{background-color:#000;border-color:#000;box-shadow:none;cursor:not-allowed}.btn-black:not(:disabled):not(.disabled).active,.btn-black:not(:disabled):not(.disabled):active,.show>.btn-black.dropdown-toggle{color:#fff;background-color:#000;border-color:#000;background-image:none;box-shadow:inset 0 3px 5px rgba(0,0,0,.125)!important}.btn-outline-primary{background-color:transparent;background-image:none;border-color:#007bff;color:#007bff}.btn-outline-primary:hover{color:#fff;background-color:#007bff;border-color:#007bff;box-shadow:0 5px 15px rgba(0,0,0,.05),0 4px 10px rgba(0,123,255,.25)}.btn-outline-primary.focus,.btn-outline-primary:focus{box-shadow:0 0 0 3px rgba(0,123,255,.15),0 3px 15px rgba(0,123,255,.2),0 2px 5px rgba(0,0,0,.1)!important}.btn-outline-primary.disabled,.btn-outline-primary:disabled{color:#007bff;background-color:transparent;box-shadow:none}.btn-outline-primary:not(:disabled):not(.disabled).active,.btn-outline-primary:not(:disabled):not(.disabled):active,.show>.btn-outline-primary.dropdown-toggle{color:#fff;background-color:#007bff;border-color:#007bff}.btn-outline-primary:not(:disabled):not(.disabled).active:focus,.btn-outline-primary:not(:disabled):not(.disabled):active:focus,.show>.btn-outline-primary.dropdown-toggle:focus{box-shadow:inset 0 3px 5px rgba(0,0,0,.125)!important}.btn-outline-secondary{background-color:transparent;background-image:none;border-color:#5a6169;color:#5a6169}.btn-outline-secondary:hover{color:#fff;background-color:#5a6169;border-color:#5a6169;box-shadow:0 5px 15px rgba(0,0,0,.05),0 4px 10px rgba(90,97,105,.25)}.btn-outline-secondary.focus,.btn-outline-secondary:focus{box-shadow:0 0 0 3px rgba(90,97,105,.15),0 3px 15px rgba(90,97,105,.2),0 2px 5px rgba(0,0,0,.1)!important}.btn-outline-secondary.disabled,.btn-outline-secondary:disabled{color:#5a6169;background-color:transparent;box-shadow:none}.btn-outline-secondary:not(:disabled):not(.disabled).active,.btn-outline-secondary:not(:disabled):not(.disabled):active,.show>.btn-outline-secondary.dropdown-toggle{color:#fff;background-color:#5a6169;border-color:#5a6169}.btn-outline-secondary:not(:disabled):not(.disabled).active:focus,.btn-outline-secondary:not(:disabled):not(.disabled):active:focus,.show>.btn-outline-secondary.dropdown-toggle:focus{box-shadow:inset 0 3px 5px rgba(0,0,0,.125)!important}.btn-outline-success{background-color:transparent;background-image:none;border-color:#17c671;color:#17c671}.btn-outline-success:hover{color:#fff;background-color:#17c671;border-color:#17c671;box-shadow:0 5px 15px rgba(0,0,0,.05),0 4px 10px rgba(23,198,113,.25)}.btn-outline-success.focus,.btn-outline-success:focus{box-shadow:0 0 0 3px rgba(23,198,113,.15),0 3px 15px rgba(23,198,113,.2),0 2px 5px rgba(0,0,0,.1)!important}.btn-outline-success.disabled,.btn-outline-success:disabled{color:#17c671;background-color:transparent;box-shadow:none}.btn-outline-success:not(:disabled):not(.disabled).active,.btn-outline-success:not(:disabled):not(.disabled):active,.show>.btn-outline-success.dropdown-toggle{color:#fff;background-color:#17c671;border-color:#17c671}.btn-outline-success:not(:disabled):not(.disabled).active:focus,.btn-outline-success:not(:disabled):not(.disabled):active:focus,.show>.btn-outline-success.dropdown-toggle:focus{box-shadow:inset 0 3px 5px rgba(0,0,0,.125)!important}.btn-outline-info{background-color:transparent;background-image:none;border-color:#00b8d8;color:#00b8d8}.btn-outline-info:hover{color:#fff;background-color:#00b8d8;border-color:#00b8d8;box-shadow:0 5px 15px rgba(0,0,0,.05),0 4px 10px rgba(0,184,216,.25)}.btn-outline-info.focus,.btn-outline-info:focus{box-shadow:0 0 0 3px rgba(0,184,216,.15),0 3px 15px rgba(0,184,216,.2),0 2px 5px rgba(0,0,0,.1)!important}.btn-outline-info.disabled,.btn-outline-info:disabled{color:#00b8d8;background-color:transparent;box-shadow:none}.btn-outline-info:not(:disabled):not(.disabled).active,.btn-outline-info:not(:disabled):not(.disabled):active,.show>.btn-outline-info.dropdown-toggle{color:#fff;background-color:#00b8d8;border-color:#00b8d8}.btn-outline-info:not(:disabled):not(.disabled).active:focus,.btn-outline-info:not(:disabled):not(.disabled):active:focus,.show>.btn-outline-info.dropdown-toggle:focus{box-shadow:inset 0 3px 5px rgba(0,0,0,.125)!important}.btn-outline-warning{background-color:transparent;background-image:none;border-color:#ffb400;color:#ffb400}.btn-outline-warning:hover{color:#212529;background-color:#ffb400;border-color:#ffb400;box-shadow:0 5px 15px rgba(0,0,0,.05),0 4px 10px rgba(255,180,0,.25)}.btn-outline-warning.focus,.btn-outline-warning:focus{box-shadow:0 0 0 3px rgba(255,180,0,.15),0 3px 15px rgba(255,180,0,.2),0 2px 5px rgba(0,0,0,.1)!important}.btn-outline-warning.disabled,.btn-outline-warning:disabled{color:#ffb400;background-color:transparent;box-shadow:none}.btn-outline-warning:not(:disabled):not(.disabled).active,.btn-outline-warning:not(:disabled):not(.disabled):active,.show>.btn-outline-warning.dropdown-toggle{color:#212529;background-color:#ffb400;border-color:#ffb400}.btn-outline-warning:not(:disabled):not(.disabled).active:focus,.btn-outline-warning:not(:disabled):not(.disabled):active:focus,.show>.btn-outline-warning.dropdown-toggle:focus{box-shadow:inset 0 3px 5px rgba(0,0,0,.125)!important}.btn-outline-danger{background-color:transparent;background-image:none;border-color:#c4183c;color:#c4183c}.btn-outline-danger:hover{color:#fff;background-color:#c4183c;border-color:#c4183c;box-shadow:0 5px 15px rgba(0,0,0,.05),0 4px 10px rgba(196,24,60,.25)}.btn-outline-danger.focus,.btn-outline-danger:focus{box-shadow:0 0 0 3px rgba(196,24,60,.15),0 3px 15px rgba(196,24,60,.2),0 2px 5px rgba(0,0,0,.1)!important}.btn-outline-danger.disabled,.btn-outline-danger:disabled{color:#c4183c;background-color:transparent;box-shadow:none}.btn-outline-danger:not(:disabled):not(.disabled).active,.btn-outline-danger:not(:disabled):not(.disabled):active,.show>.btn-outline-danger.dropdown-toggle{color:#fff;background-color:#c4183c;border-color:#c4183c}.btn-outline-danger:not(:disabled):not(.disabled).active:focus,.btn-outline-danger:not(:disabled):not(.disabled):active:focus,.show>.btn-outline-danger.dropdown-toggle:focus{box-shadow:inset 0 3px 5px rgba(0,0,0,.125)!important}.btn-outline-light{background-color:transparent;background-image:none;border-color:#e9ecef;color:#212529}.btn-outline-light:hover{color:#212529;background-color:#e9ecef;border-color:#e9ecef;box-shadow:0 5px 15px rgba(0,0,0,.05),0 4px 10px rgba(233,236,239,.25)}.btn-outline-light.focus,.btn-outline-light:focus{box-shadow:0 0 0 3px rgba(233,236,239,.15),0 3px 15px rgba(233,236,239,.2),0 2px 5px rgba(0,0,0,.1)!important}.btn-outline-light.disabled,.btn-outline-light:disabled{color:#e9ecef;background-color:transparent;box-shadow:none}.btn-outline-light:not(:disabled):not(.disabled).active,.btn-outline-light:not(:disabled):not(.disabled):active,.show>.btn-outline-light.dropdown-toggle{color:#212529;background-color:#e9ecef;border-color:#e9ecef}.btn-outline-light:not(:disabled):not(.disabled).active:focus,.btn-outline-light:not(:disabled):not(.disabled):active:focus,.show>.btn-outline-light.dropdown-toggle:focus{box-shadow:inset 0 3px 5px rgba(0,0,0,.125)!important}.btn-outline-dark{background-color:transparent;background-image:none;border-color:#212529;color:#212529}.btn-outline-dark:hover{color:#fff;background-color:#212529;border-color:#212529;box-shadow:0 5px 15px rgba(0,0,0,.05),0 4px 10px rgba(33,37,41,.25)}.btn-outline-dark.focus,.btn-outline-dark:focus{box-shadow:0 0 0 3px rgba(33,37,41,.15),0 3px 15px rgba(33,37,41,.2),0 2px 5px rgba(0,0,0,.1)!important}.btn-outline-dark.disabled,.btn-outline-dark:disabled{color:#212529;background-color:transparent;box-shadow:none}.btn-outline-dark:not(:disabled):not(.disabled).active,.btn-outline-dark:not(:disabled):not(.disabled):active,.show>.btn-outline-dark.dropdown-toggle{color:#fff;background-color:#212529;border-color:#212529}.btn-outline-dark:not(:disabled):not(.disabled).active:focus,.btn-outline-dark:not(:disabled):not(.disabled):active:focus,.show>.btn-outline-dark.dropdown-toggle:focus{box-shadow:inset 0 3px 5px rgba(0,0,0,.125)!important}.btn-outline-white{background-color:transparent;background-image:none;border-color:#fff;color:#212529;color:#fff}.btn-outline-white:hover{color:#212529;background-color:#fff;border-color:#fff;box-shadow:0 5px 15px rgba(0,0,0,.05),0 4px 10px rgba(255,255,255,.25)}.btn-outline-white.focus,.btn-outline-white:focus{box-shadow:0 0 0 3px rgba(255,255,255,.15),0 3px 15px rgba(255,255,255,.2),0 2px 5px rgba(0,0,0,.1)!important}.btn-outline-white.disabled,.btn-outline-white:disabled{color:#fff;background-color:transparent;box-shadow:none}.btn-outline-white:not(:disabled):not(.disabled).active,.btn-outline-white:not(:disabled):not(.disabled):active,.show>.btn-outline-white.dropdown-toggle{color:#212529;background-color:#fff;border-color:#fff}.btn-outline-white:not(:disabled):not(.disabled).active:focus,.btn-outline-white:not(:disabled):not(.disabled):active:focus,.show>.btn-outline-white.dropdown-toggle:focus{box-shadow:inset 0 3px 5px rgba(0,0,0,.125)!important}.btn-outline-white:not(:disabled):not(.disabled).active,.btn-outline-white:not(:disabled):not(.disabled):active{color:#000}.btn-outline-black{background-color:transparent;background-image:none;border-color:#000;color:#000;color:#000}.btn-outline-black:hover{color:#fff;background-color:#000;border-color:#000;box-shadow:0 5px 15px rgba(0,0,0,.05),0 4px 10px rgba(0,0,0,.25)}.btn-outline-black.focus,.btn-outline-black:focus{box-shadow:0 0 0 3px rgba(0,0,0,.15),0 3px 15px rgba(0,0,0,.2),0 2px 5px rgba(0,0,0,.1)!important}.btn-outline-black.disabled,.btn-outline-black:disabled{color:#000;background-color:transparent;box-shadow:none}.btn-outline-black:not(:disabled):not(.disabled).active,.btn-outline-black:not(:disabled):not(.disabled):active,.show>.btn-outline-black.dropdown-toggle{color:#fff;background-color:#000;border-color:#000}.btn-outline-black:not(:disabled):not(.disabled).active:focus,.btn-outline-black:not(:disabled):not(.disabled):active:focus,.show>.btn-outline-black.dropdown-toggle:focus{box-shadow:inset 0 3px 5px rgba(0,0,0,.125)!important}.btn-outline-black:not(:disabled):not(.disabled).active,.btn-outline-black:not(:disabled):not(.disabled):active{color:#fff}.btn-link{font-weight:300;color:#007bff}.btn-link:hover{color:#0056b3;text-decoration:underline}.btn-link.focus,.btn-link:focus{text-decoration:underline}.btn-link:disabled{color:#868e96}.btn-group-lg>.btn,.btn-lg{padding:.75rem 1.75rem;font-size:1.125rem;line-height:1.5;border-radius:.5rem}.btn-group-sm>.btn,.btn-sm{padding:.35rem 1rem;font-size:.75rem;line-height:1.5;border-radius:.35rem}.btn-block+.btn-block{margin-top:.5rem}.fade{transition:opacity .2s ease-in-out}.collapsing{transition:height 350ms ease-in-out}i.material-icons{font-size:inherit;position:relative;top:2px}.dropdown-menu{z-index:1000;min-width:10rem;padding:.5rem 0;margin:0 0 0;font-size:1rem;color:#5a6169;background-color:#fff;border:1px solid rgba(0,0,0,.05);border-radius:.375rem;box-shadow:0 .5rem 4rem rgba(0,0,0,.11),0 10px 20px rgba(0,0,0,.05),0 2px 3px rgba(0,0,0,.06)}.dropdown-menu-small{box-shadow:0 .5rem 2rem rgba(0,0,0,.11),0 3px 10px rgba(0,0,0,.05),0 2px 3px rgba(0,0,0,.06);padding:.25rem 0;font-size:.813rem}.dropdown-menu-small .dropdown-item{padding:.375rem .875rem;font-size:.813rem}.dropdown-menu-small .dropdown-divider{margin:.25rem 0}.dropup .dropdown-menu{margin-bottom:0}.dropright .dropdown-menu{margin-left:0}.dropleft .dropdown-menu{margin-right:0}.dropdown-divider{height:0;margin:.75rem 0;overflow:hidden;border-top:1px solid #e9ecef}.dropdown-item{padding:.5rem 1.25rem;font-weight:300;color:#212529;font-size:.9375rem;transition:background-color 250ms cubic-bezier(.27,.01,.38,1.06),color 250ms cubic-bezier(.27,.01,.38,1.06)}.dropdown-item:focus,.dropdown-item:hover{color:#16181b;background-color:#eceeef}.dropdown-item.active,.dropdown-item:active{color:#fff;background-color:#c3c7cc}.dropdown-item.disabled,.dropdown-item:disabled{color:#868e96}.dropdown-item.disabled:hover,.dropdown-item:disabled:hover{background:0 0;cursor:not-allowed}.dropdown-header{padding:.5rem 1.25rem;font-size:.875rem;color:#868e96}.btn-group .btn+.btn,.btn-group .btn+.btn-group,.btn-group .btn-group+.btn,.btn-group .btn-group+.btn-group,.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-left:-1px}.btn-group>.btn-group:not(:last-child)>.btn,.btn-group>.btn:not(:last-child):not(.dropdown-toggle){border-top-right-radius:0;border-bottom-right-radius:0}.btn-group>.btn-group:not(:first-child)>.btn,.btn-group>.btn:not(:first-child){border-top-left-radius:0;border-bottom-left-radius:0}.dropdown-toggle-split{padding-right:.9375rem;padding-left:.9375rem}.btn-group-sm>.btn+.dropdown-toggle-split,.btn-sm+.dropdown-toggle-split{padding-right:.75rem;padding-left:.75rem}.btn-group-lg>.btn+.dropdown-toggle-split,.btn-lg+.dropdown-toggle-split{padding-right:1.3125rem;padding-left:1.3125rem}.btn-group.show .dropdown-toggle{box-shadow:inset 0 3px 5px rgba(0,0,0,.125)}.btn-group.show .dropdown-toggle.btn-link{box-shadow: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}.btn-group-vertical>.btn-group:not(:last-child)>.btn,.btn-group-vertical>.btn:not(:last-child):not(.dropdown-toggle){border-bottom-right-radius:0;border-bottom-left-radius:0}.btn-group-vertical>.btn-group:not(:first-child)>.btn,.btn-group-vertical>.btn:not(:first-child){border-top-left-radius:0;border-top-right-radius:0}.input-group>.custom-file+.custom-file,.input-group>.custom-file+.custom-select,.input-group>.custom-file+.form-control,.input-group>.custom-select+.custom-file,.input-group>.custom-select+.custom-select,.input-group>.custom-select+.form-control,.input-group>.form-control+.custom-file,.input-group>.form-control+.custom-select,.input-group>.form-control+.form-control{margin-left:-1px}.input-group>.custom-select:not(:last-child),.input-group>.form-control:not(:last-child){border-top-right-radius:0;border-bottom-right-radius:0}.input-group>.custom-select:not(:first-child),.input-group>.form-control:not(:first-child){border-top-left-radius:0;border-bottom-left-radius:0}.input-group>.custom-file:not(:last-child) .custom-file-label,.input-group>.custom-file:not(:last-child) .custom-file-label::after{border-top-right-radius:0;border-bottom-right-radius:0}.input-group>.custom-file:not(:first-child) .custom-file-label,.input-group>.custom-file:not(:first-child) .custom-file-label::after{border-top-left-radius:0;border-bottom-left-radius:0}.input-group.input-group-seamless>.form-control{border-radius:.375rem}.input-group.input-group-seamless>.input-group-append,.input-group.input-group-seamless>.input-group-prepend{position:absolute;top:0;bottom:0;z-index:4}.input-group.input-group-seamless>.input-group-append .input-group-text,.input-group.input-group-seamless>.input-group-prepend .input-group-text{padding:12px 14px;background:0 0;border:none}.input-group.input-group-seamless>.input-group-append{right:0}.input-group.input-group-seamless>.input-group-middle{right:0;left:0}.input-group.input-group-seamless>.input-group-prepend{left:0}.input-group.input-group-seamless>.custom-select:not(:last-child),.input-group.input-group-seamless>.form-control:not(:last-child){padding-right:40px}.input-group.input-group-seamless>.custom-select:not(:first-child),.input-group.input-group-seamless>.form-control:not(:first-child){padding-left:40px}.input-group-append .btn+.btn,.input-group-append .btn+.input-group-text,.input-group-append .input-group-text+.btn,.input-group-append .input-group-text+.input-group-text,.input-group-prepend .btn+.btn,.input-group-prepend .btn+.input-group-text,.input-group-prepend .input-group-text+.btn,.input-group-prepend .input-group-text+.input-group-text{margin-left:-1px}.input-group-prepend{margin-right:-1px}.input-group-append{margin-left:-1px}.input-group-text{font-size:1rem;font-weight:300;line-height:1.5;color:#abb6bf;background-color:#f9fafb;border:1px solid #becad6;border-radius:.375rem}.input-group>.input-group-append:last-child>.btn:not(:last-child):not(.dropdown-toggle),.input-group>.input-group-append:last-child>.input-group-text:not(:last-child),.input-group>.input-group-append:not(:last-child)>.btn,.input-group>.input-group-append:not(:last-child)>.input-group-text,.input-group>.input-group-prepend>.btn,.input-group>.input-group-prepend>.input-group-text{border-top-right-radius:0;border-bottom-right-radius:0}.input-group>.input-group-append>.btn,.input-group>.input-group-append>.input-group-text,.input-group>.input-group-prepend:first-child>.btn:not(:first-child),.input-group>.input-group-prepend:first-child>.input-group-text:not(:first-child),.input-group>.input-group-prepend:not(:first-child)>.btn,.input-group>.input-group-prepend:not(:first-child)>.input-group-text{border-top-left-radius:0;border-bottom-left-radius:0}.input-group>.input-group-middle>.btn,.input-group>.input-group-middle>.input-group-text{border-left:0;border-right:0;border-radius:0}.input-group-middle{display:-ms-flexbox;display:flex}.custom-control{min-height:1.5rem;padding-left:1.688rem}.custom-control:hover{cursor:pointer}.custom-control .custom-control-label:before{pointer-events:all}.custom-control-inline{margin-right:1rem}.custom-control-input:checked~.custom-control-label::before{color:#fff;border-color:transparent;background-color:#007bff;box-shadow:none}.custom-control-input:focus~.custom-control-label::before{box-shadow:0 .313rem .719rem rgba(0,123,255,.1),0 .156rem .125rem rgba(0,0,0,.06)}.custom-control-input:active~.custom-control-label::before{color:#fff;background-color:#b3d7ff;box-shadow:none}.custom-control-input:disabled~.custom-control-label{color:#868e96}.custom-control-input:disabled~.custom-control-label:hover{cursor:not-allowed}.custom-control-input:disabled~.custom-control-label::before{background-color:#e9ecef}.custom-control-label{position:static}.custom-control-label:hover{cursor:pointer}.custom-control-label::before{top:.1875rem;left:0;width:1.125rem;height:1.125rem;background-color:#fff;border:1px solid #becad6;transition:all 250ms cubic-bezier(.27,.01,.38,1.06);box-shadow:none}.custom-control-label::after{top:.1875rem;width:1.125rem;height:1.125rem;background-size:50% 50%}.custom-checkbox .custom-control-label::before{border-radius:2px}.custom-checkbox .custom-control-label::after{content:'';position:absolute;top:5px;left:7px;width:5px;height:11px;opacity:0;-webkit-transform:rotate(45deg) scale(0);transform:rotate(45deg) scale(0);border-right:2px solid #fff;border-bottom:2px solid #fff;transition:border 250ms cubic-bezier(.27,.01,.38,1.06),-webkit-transform 250ms cubic-bezier(.27,.01,.38,1.06);transition:transform 250ms cubic-bezier(.27,.01,.38,1.06),border 250ms cubic-bezier(.27,.01,.38,1.06);transition:transform 250ms cubic-bezier(.27,.01,.38,1.06),border 250ms cubic-bezier(.27,.01,.38,1.06),-webkit-transform 250ms cubic-bezier(.27,.01,.38,1.06);transition-delay:.1s}.custom-checkbox .custom-control-input:checked~.custom-control-label::before{background-image:none}.custom-checkbox .custom-control-input:checked~.custom-control-label::after{opacity:1;-webkit-transform:rotate(45deg) scale(1);transform:rotate(45deg) scale(1);background-image:none}.custom-checkbox .custom-control-input:indeterminate~.custom-control-label::before{border:none;background-color:#007bff;box-shadow:none}.custom-checkbox .custom-control-input:indeterminate~.custom-control-label::after{content:'';position:absolute;-webkit-transform:scale(1);transform:scale(1);background-image:none;background-color:#fff;border:none;width:10px;height:2px;top:11px;left:4px;opacity:1;transition:none}.custom-checkbox .custom-control-input:disabled:checked~.custom-control-label::before{background:#e9ecef;border-color:#becad6}.custom-checkbox .custom-control-input:disabled:checked~.custom-control-label::after{border-color:#becad6}.custom-radio .custom-control-label::before{border-radius:50%}.custom-radio .custom-control-label::after{content:'';border-radius:50%;-webkit-transform:scale(0);transform:scale(0);background-image:none!important;position:absolute;background:#fff;width:8px;height:8px;top:8px;left:5px;transition:all 250ms cubic-bezier(.27,.01,.38,1.06);transition-delay:.1s;opacity:0;transform:scale(0)}.custom-radio .custom-control-input:checked~.custom-control-label::before{background-color:#007bff}.custom-radio .custom-control-input:checked~.custom-control-label::after{opacity:1;-webkit-transform:scale(1);transform:scale(1)}.custom-radio .custom-control-input:disabled:checked~.custom-control-label::before{background-color:#a8aeb4}.custom-radio .custom-control-input:disabled:checked~.custom-control-label::before{background:#e9ecef;border-color:#becad6}.custom-radio .custom-control-input:disabled:checked~.custom-control-label::after{background:#becad6}.custom-select{height:calc(2.425rem + 2px);padding:.375rem 1.75rem .375rem .75rem;line-height:1.2;color:#495057;background:#fff url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 4 5'%3E%3Cpath fill='%23333' d='M2 0L0 2h4zm0 5L0 3h4z'/%3E%3C/svg%3E") no-repeat right .75rem center;background-size:8px 10px;border:1px solid #becad6;font-weight:300;font-size:.95rem;transition:box-shadow 250ms cubic-bezier(.27,.01,.38,1.06),border 250ms cubic-bezier(.27,.01,.38,1.06);border-radius:.375rem}.custom-select:focus{border-color:#007bff;box-shadow:0 .313rem .719rem rgba(0,123,255,.1),0 .156rem .125rem rgba(0,0,0,.06)}.custom-select:focus::-ms-value{color:#495057;background-color:#fff}.custom-select:hover:not(:focus):not(:disabled){cursor:pointer;border-color:#8fa4b8}.custom-select[multiple],.custom-select[size]:not([size="1"]){padding-right:.75rem}.custom-select:disabled{color:#868e96;background-color:#e9ecef}.custom-select-sm{height:calc(2.0125rem + 2px);padding-top:.375rem;padding-bottom:.375rem;font-size:.75rem}.custom-select-lg{height:calc(3.375rem + 2px);font-size:1.25rem;padding-top:.375rem;padding-bottom:.375rem}.custom-file{height:calc(2.428rem + 2px);font-size:.95rem;transition:box-shadow 250ms cubic-bezier(.27,.01,.38,1.06),border 250ms cubic-bezier(.27,.01,.38,1.06)}.custom-file-input{min-width:14rem;height:calc(2.428rem + 2px)}.custom-file-input:focus~.custom-file-label{border-color:#007bff;color:#495057;box-shadow:0 .313rem .719rem rgba(0,123,255,.1),0 .156rem .125rem rgba(0,0,0,.06)}.custom-file-input:focus~.custom-file-label::after{border-color:#007bff;color:#007bff;background:#e6f2ff}.custom-file-input:focus~.custom-file-label:hover{border-color:#007bff}.custom-file-input:lang(en)~.custom-file-label::after{content:"Browse"}.custom-file-input:not(:disabled):hover{cursor:pointer}.custom-file-input:not(:disabled):hover~.custom-file-label,.custom-file-input:not(:disabled):hover~.custom-file-label:before{border-color:#8fa4b8}.custom-file-input:disabled+.custom-file-label{color:#868e96;background-color:#f8f9fa}.custom-file-label{height:calc(2.428rem + 2px);padding:.5rem 1rem;line-height:1.5;color:#495057;background-color:#fff;border:1px solid #becad6;font-weight:300;box-shadow:none;transition:box-shadow 250ms cubic-bezier(.27,.01,.38,1.06),border-color 250ms cubic-bezier(.27,.01,.38,1.06);border-radius:.375rem}.custom-file-label::after{padding:.5rem 1rem;height:calc(calc(2.428rem + 2px) - 1px * 2);line-height:1.5;color:#495057;border-left:1px solid #becad6;background-color:#e9ecef;border-radius:0 .375rem .375rem 0}.custom-toggle{position:relative;padding-left:3.75rem}.custom-toggle .custom-control-label::before{position:absolute;top:0;left:0;display:block;width:3.125rem;height:1.75rem;background:#fff;border-radius:100px;border:.0625rem solid #becad6}.custom-toggle .custom-control-label::after{content:'';position:absolute;top:.25rem;left:.25rem;width:1.25rem;height:1.25rem;background:#becad6;border-radius:6.25rem;transition:350ms}.custom-toggle .custom-control-input:checked~.custom-control-label::before{background:#17c671;border-color:#17c671}.custom-toggle .custom-control-input:checked~.custom-control-label::after{left:2.875rem;-webkit-transform:translateX(-100%);transform:translateX(-100%);background:#fff}.custom-toggle .custom-control-input:checked:disabled~.custom-control-label::before{background:#e9ecef;border-color:#becad6}.custom-toggle .custom-control-input:checked:disabled~.custom-control-label::after{background:#becad6}.custom-toggle .custom-control-input:active:not(:disabled)~.custom-control-label::after{width:1.625rem}.custom-toggle .custom-control-input:active:not(:checked)~.custom-control-label::before{background-color:#fff}.custom-toggle .custom-control-input:disabled:active~.custom-control-label::before{background-color:#e9ecef}.custom-toggle .custom-control-input:focus~.custom-control-label::before{box-shadow:0 .313rem .719rem rgba(23,198,113,.1),0 .156rem .125rem rgba(0,0,0,.06)}.custom-toggle .custom-control-input:focus:not(:checked)~.custom-control-label::before{box-shadow:0 .313rem .719rem rgba(0,123,255,.1),0 .156rem .125rem rgba(0,0,0,.06)}.custom-toggle.custom-toggle-sm{padding-left:2.625rem}.custom-toggle.custom-toggle-sm .custom-control-label::before{top:.1875rem;position:absolute;display:block;width:2.1875rem;height:1.125rem;background:#fff;border-radius:100px;border:.0625rem solid #becad6}.custom-toggle.custom-toggle-sm .custom-control-label::after{content:'';position:absolute;top:.375rem;left:.1875rem;width:.75rem;height:.75rem}.custom-toggle.custom-toggle-sm .custom-control-input:checked~.custom-control-label::after{left:1.9375rem}.custom-toggle.custom-toggle-sm .custom-control-input:active:not(:disabled)~.custom-control-label::after{width:1rem}.nav{font-size:.875rem;font-family:Poppins,-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif}.nav-link{padding:.625rem 1.125rem;transition:all 250ms cubic-bezier(.27,.01,.38,1.06)}.nav-link.disabled{color:#868e96}.nav-tabs{border-bottom:1px solid #d1d4d8}.nav-tabs .nav-item{margin-bottom:-1px}.nav-tabs .nav-link{border:1px solid transparent;border-top-left-radius:.375rem;border-top-right-radius:.375rem}.nav-tabs .nav-link:focus,.nav-tabs .nav-link:hover{border-color:#e9ecef}.nav-tabs .nav-link.disabled{color:#868e96}.nav-tabs .nav-link.disabled:hover{cursor:not-allowed;border-color:transparent}.nav-tabs .nav-link:hover{border-color:#e7e9ea}.nav-tabs .nav-item.show .nav-link,.nav-tabs .nav-link.active{color:#495057;background-color:#fff;border-color:#ddd}.nav-tabs .dropdown-menu{margin-top:-1px;border-top-left-radius:0;border-top-right-radius:0}.nav-pills .nav-link{border-radius:.375rem}.nav-pills .nav-link.active,.nav-pills .show>.nav-link{color:#fff;background-color:#007bff}.nav-pills:hover{background-color:#fdfdfd}.nav-outlined-pills .nav-link{border-radius:.375rem;border:1px solid transparent}.nav-outlined-pills .nav-link.active,.show>.nav-outlined-pills .nav-link{background:0 0;color:#007bff;border-color:#007bff}.nav-outlined-pills .nav-link:hover{border-color:#e7e9ea}.nav-blue .nav-link.active{background-color:#007bff;border-color:#0074f0;color:#fff}.nav-blue .nav-link.disabled{color:#868e96}.nav-blue .nav-link.disabled:hover{cursor:not-allowed;border-color:transparent}.nav-blue .nav-link{color:#007bff}.nav-blue.nav-outlined-pills .nav-link.active{background:0 0;border-color:#3395ff;color:#007bff}.nav-blue.nav-outlined-pills .nav-link.active:hover{border-color:#3395ff}.nav-blue.nav-outlined-pills .nav-link{color:#007bff}.nav-indigo .nav-link.active{background-color:#674eec;border-color:#5b40eb;color:#fff}.nav-indigo .nav-link.disabled{color:#868e96}.nav-indigo .nav-link.disabled:hover{cursor:not-allowed;border-color:transparent}.nav-indigo .nav-link{color:#674eec}.nav-indigo.nav-outlined-pills .nav-link.active{background:0 0;border-color:#8f7cf1;color:#674eec}.nav-indigo.nav-outlined-pills .nav-link.active:hover{border-color:#8f7cf1}.nav-indigo.nav-outlined-pills .nav-link{color:#674eec}.nav-purple .nav-link.active{background-color:#8445f7;border-color:#7a36f6;color:#fff}.nav-purple .nav-link.disabled{color:#868e96}.nav-purple .nav-link.disabled:hover{cursor:not-allowed;border-color:transparent}.nav-purple .nav-link{color:#8445f7}.nav-purple.nav-outlined-pills .nav-link.active{background:0 0;border-color:#a476f9;color:#8445f7}.nav-purple.nav-outlined-pills .nav-link.active:hover{border-color:#a476f9}.nav-purple.nav-outlined-pills .nav-link{color:#8445f7}.nav-pink .nav-link.active{background-color:#ff4169;border-color:#ff325d;color:#fff}.nav-pink .nav-link.disabled{color:#868e96}.nav-pink .nav-link.disabled:hover{cursor:not-allowed;border-color:transparent}.nav-pink .nav-link{color:#ff4169}.nav-pink.nav-outlined-pills .nav-link.active{background:0 0;border-color:#ff7491;color:#ff4169}.nav-pink.nav-outlined-pills .nav-link.active:hover{border-color:#ff7491}.nav-pink.nav-outlined-pills .nav-link{color:#ff4169}.nav-red .nav-link.active{background-color:#c4183c;border-color:#b61638;color:#fff}.nav-red .nav-link.disabled{color:#868e96}.nav-red .nav-link.disabled:hover{cursor:not-allowed;border-color:transparent}.nav-red .nav-link{color:#c4183c}.nav-red.nav-outlined-pills .nav-link.active{background:0 0;border-color:#e52a51;color:#c4183c}.nav-red.nav-outlined-pills .nav-link.active:hover{border-color:#e52a51}.nav-red.nav-outlined-pills .nav-link{color:#c4183c}.nav-orange .nav-link.active{background-color:#fb7906;border-color:#ee7204;color:#fff}.nav-orange .nav-link.disabled{color:#868e96}.nav-orange .nav-link.disabled:hover{cursor:not-allowed;border-color:transparent}.nav-orange .nav-link{color:#fb7906}.nav-orange.nav-outlined-pills .nav-link.active{background:0 0;border-color:#fc9438;color:#fb7906}.nav-orange.nav-outlined-pills .nav-link.active:hover{border-color:#fc9438}.nav-orange.nav-outlined-pills .nav-link{color:#fb7906}.nav-yellow .nav-link.active{background-color:#ffb400;border-color:#f0a900;color:#212529}.nav-yellow .nav-link.disabled{color:#868e96}.nav-yellow .nav-link.disabled:hover{cursor:not-allowed;border-color:transparent}.nav-yellow .nav-link{color:#ffb400}.nav-yellow.nav-outlined-pills .nav-link.active{background:0 0;border-color:#ffc333;color:#ffb400}.nav-yellow.nav-outlined-pills .nav-link.active:hover{border-color:#ffc333}.nav-yellow.nav-outlined-pills .nav-link{color:#ffb400}.nav-green .nav-link.active{background-color:#17c671;border-color:#15b869;color:#fff}.nav-green .nav-link.disabled{color:#868e96}.nav-green .nav-link.disabled:hover{cursor:not-allowed;border-color:transparent}.nav-green .nav-link{color:#17c671}.nav-green.nav-outlined-pills .nav-link.active{background:0 0;border-color:#2ae68b;color:#17c671}.nav-green.nav-outlined-pills .nav-link.active:hover{border-color:#2ae68b}.nav-green.nav-outlined-pills .nav-link{color:#17c671}.nav-teal .nav-link.active{background-color:#1adba2;border-color:#18cd98;color:#212529}.nav-teal .nav-link.disabled{color:#868e96}.nav-teal .nav-link.disabled:hover{cursor:not-allowed;border-color:transparent}.nav-teal .nav-link{color:#1adba2}.nav-teal.nav-outlined-pills .nav-link.active{background:0 0;border-color:#40e8b7;color:#1adba2}.nav-teal.nav-outlined-pills .nav-link.active:hover{border-color:#40e8b7}.nav-teal.nav-outlined-pills .nav-link{color:#1adba2}.nav-cyan .nav-link.active{background-color:#00b8d8;border-color:#00abc9;color:#fff}.nav-cyan .nav-link.disabled{color:#868e96}.nav-cyan .nav-link.disabled:hover{cursor:not-allowed;border-color:transparent}.nav-cyan .nav-link{color:#00b8d8}.nav-cyan.nav-outlined-pills .nav-link.active{background:0 0;border-color:#0cdbff;color:#00b8d8}.nav-cyan.nav-outlined-pills .nav-link.active:hover{border-color:#0cdbff}.nav-cyan.nav-outlined-pills .nav-link{color:#00b8d8}.nav-white .nav-link.active{background-color:#fff;border-color:#f7f7f7;color:#212529}.nav-white .nav-link.disabled{color:#868e96}.nav-white .nav-link.disabled:hover{cursor:not-allowed;border-color:transparent}.nav-white .nav-link{color:#fff}.nav-white.nav-outlined-pills .nav-link.active{background:0 0;border-color:#fff;color:#fff}.nav-white.nav-outlined-pills .nav-link.active:hover{border-color:#fff}.nav-white.nav-outlined-pills .nav-link{color:#fff}.nav-gray .nav-link.active{background-color:#868e96;border-color:#7e868f;color:#fff}.nav-gray .nav-link.disabled{color:#868e96}.nav-gray .nav-link.disabled:hover{cursor:not-allowed;border-color:transparent}.nav-gray .nav-link{color:#868e96}.nav-gray.nav-outlined-pills .nav-link.active{background:0 0;border-color:#a1a8ae;color:#868e96}.nav-gray.nav-outlined-pills .nav-link.active:hover{border-color:#a1a8ae}.nav-gray.nav-outlined-pills .nav-link{color:#868e96}.nav-gray-dark .nav-link.active{background-color:#343a40;border-color:#2d3238;color:#fff}.nav-gray-dark .nav-link.disabled{color:#868e96}.nav-gray-dark .nav-link.disabled:hover{cursor:not-allowed;border-color:transparent}.nav-gray-dark .nav-link{color:#343a40}.nav-gray-dark.nav-outlined-pills .nav-link.active{background:0 0;border-color:#4b545c;color:#343a40}.nav-gray-dark.nav-outlined-pills .nav-link.active:hover{border-color:#4b545c}.nav-gray-dark.nav-outlined-pills .nav-link{color:#343a40}.navbar{padding:.75rem 1.5rem}.navbar-brand{padding-top:.625rem;padding-bottom:.625rem;margin-right:1.5rem;font-size:1rem;font-family:Poppins,-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif;font-weight:400}.navbar-text{padding-top:.625rem;padding-bottom:.625rem}.navbar-toggler{padding:.5rem .5rem;font-size:1rem;background:#fff;border:1px solid transparent;border-radius:.375rem}@media (min-width:576px){.navbar-expand-sm .navbar-nav .nav-link{padding-right:.625rem;padding-left:.625rem}}@media (min-width:768px){.navbar-expand-md .navbar-nav .nav-link{padding-right:.625rem;padding-left:.625rem}}@media (min-width:992px){.navbar-expand-lg .navbar-nav .nav-link{padding-right:.625rem;padding-left:.625rem}}@media (min-width:1200px){.navbar-expand-xl .navbar-nav .nav-link{padding-right:.625rem;padding-left:.625rem}}.navbar-expand .navbar-nav .nav-link{padding-right:.625rem;padding-left:.625rem}.navbar-light .navbar-brand{color:rgba(0,0,0,.9)}.navbar-light .navbar-brand:focus,.navbar-light .navbar-brand:hover{color:rgba(0,0,0,.9)}.navbar-light .navbar-nav .nav-link{color:rgba(0,0,0,.5)}.navbar-light .navbar-nav .nav-link:focus,.navbar-light .navbar-nav .nav-link:hover{color:rgba(0,0,0,.7)}.navbar-light .navbar-nav .nav-link.disabled{color:rgba(0,0,0,.3)}.navbar-light .navbar-nav .active>.nav-link,.navbar-light .navbar-nav .nav-link.active,.navbar-light .navbar-nav .nav-link.show,.navbar-light .navbar-nav .show>.nav-link{color:rgba(0,0,0,.9)}.navbar-light .navbar-toggler{color:rgba(0,0,0,.5);border-color:rgba(0,0,0,.1);background:0 0}.navbar-light .navbar-toggler-icon{background-image:url("data:image/svg+xml;charset=utf8,%3Csvg viewBox='0 0 30 30' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath stroke='rgba(0, 0, 0, 0.5)' stroke-width='2' stroke-linecap='round' stroke-miterlimit='10' d='M4 7h22M4 15h22M4 23h22'/%3E%3C/svg%3E")}.navbar-light .navbar-text{color:rgba(0,0,0,.5)}.navbar-light .navbar-text a{color:rgba(0,0,0,.9)}.navbar-light .navbar-text a:focus,.navbar-light .navbar-text a:hover{color:rgba(0,0,0,.9)}.navbar-dark .navbar-brand{color:#fff}.navbar-dark .navbar-brand:focus,.navbar-dark .navbar-brand:hover{color:#fff}.navbar-dark .navbar-nav .nav-link{color:rgba(255,255,255,.5)}.navbar-dark .navbar-nav .nav-link:focus,.navbar-dark .navbar-nav .nav-link:hover{color:rgba(255,255,255,.75)}.navbar-dark .navbar-nav .nav-link.disabled{color:rgba(255,255,255,.25)}.navbar-dark .navbar-nav .active>.nav-link,.navbar-dark .navbar-nav .nav-link.active,.navbar-dark .navbar-nav .nav-link.show,.navbar-dark .navbar-nav .show>.nav-link{color:#fff}.navbar-dark .navbar-toggler{color:rgba(255,255,255,.5);border-color:rgba(255,255,255,.1);background:0 0}.navbar-dark .navbar-toggler-icon{background-image:url("data:image/svg+xml;charset=utf8,%3Csvg viewBox='0 0 30 30' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath stroke='rgba(255, 255, 255, 0.5)' stroke-width='2' stroke-linecap='round' stroke-miterlimit='10' d='M4 7h22M4 15h22M4 23h22'/%3E%3C/svg%3E")}.navbar-dark .navbar-text{color:rgba(255,255,255,.5)}.navbar-dark .navbar-text a{color:#fff}.navbar-dark .navbar-text a:focus,.navbar-dark .navbar-text a:hover{color:#fff}.card{background-color:#fff;border:none;border-radius:.625rem;box-shadow:0 .46875rem 2.1875rem rgba(90,97,105,.1),0 .9375rem 1.40625rem rgba(90,97,105,.1),0 .25rem .53125rem rgba(90,97,105,.12),0 .125rem .1875rem rgba(90,97,105,.1)}.card>.list-group:first-child .list-group-item:first-child{border-top-left-radius:.625rem;border-top-right-radius:.625rem}.card>.list-group:last-child .list-group-item:last-child{border-bottom-right-radius:.625rem;border-bottom-left-radius:.625rem}.card .list-group-item{padding:.8125rem 1.875rem}.card .card-text{margin-bottom:1.5625rem}.card a:hover{text-decoration:none}.card-small{box-shadow:0 2px 0 rgba(90,97,105,.11),0 4px 8px rgba(90,97,105,.12),0 10px 10px rgba(90,97,105,.06),0 7px 70px rgba(90,97,105,.1)}.card-small .card-body,.card-small .card-footer,.card-small .card-header{padding:1rem 1rem}.card-body{padding:1.875rem}.card-body>p:last-child{margin-bottom:0}.card-title{font-weight:500;margin-bottom:.75rem}.card-subtitle{margin-top:-1.09375rem}.card-link{font-family:Poppins,-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif}.card-link+.card-link{margin-left:1.875rem}.card-header{padding:1.09375rem 1.875rem;background-color:rgba(90,97,105,.06);border-bottom:none}.card-header:first-child{border-radius:.625rem .625rem 0 0}.card-footer{padding:1.09375rem 1.875rem;background-color:rgba(90,97,105,.06);border-top:none}.card-footer:last-child{border-radius:0 0 .625rem .625rem}.card-header-tabs{margin-bottom:-1rem;border-bottom:0}.card-header-tabs .nav-link,.card-header-tabs .nav-link:hover{border-bottom:transparent}.card-header-pills{margin-right:-.9375rem;margin-left:-.9375rem}.card-header-pills:hover{background:0 0}.card-img-overlay{padding:1.875rem 2.1875rem;background:rgba(90,97,105,.5);border-radius:.625rem}.card-img-overlay .card-title{color:#fff}.card-img{border-radius:.625rem}.card-img-top{border-top-left-radius:.625rem;border-top-right-radius:.625rem}.card-img-bottom{border-bottom-right-radius:.625rem;border-bottom-left-radius:.625rem}.card-deck .card{margin-bottom:.9375rem}@media (min-width:576px){.card-deck{margin-right:-.9375rem;margin-left:-.9375rem}.card-deck .card{margin-right:.9375rem;margin-left:.9375rem}}.card-group>.card{box-shadow:0 .46875rem 2.1875rem rgba(90,97,105,.1),0 .9375rem 1.40625rem rgba(90,97,105,.1),0 .25rem .53125rem rgba(90,97,105,.12),0 .125rem .1875rem rgba(90,97,105,.1)}.card-group>.card:last-child .card-body,.card-group>.card:last-child .card-footer{border-right:none}.card-group .card-body,.card-group .card-footer{border-right:1px solid #e7e9ea}@media (min-width:576px){.card-group{box-shadow:0 .46875rem 2.1875rem rgba(90,97,105,.1),0 .9375rem 1.40625rem rgba(90,97,105,.1),0 .25rem .53125rem rgba(90,97,105,.12),0 .125rem .1875rem rgba(90,97,105,.1);border-radius:.625rem}.card-group>.card{box-shadow:none}.card-group>.card:first-child{border-top-right-radius:0;border-bottom-right-radius:0}.card-group>.card:last-child{border-top-left-radius:0;border-bottom-left-radius:0}.card-group>.card:only-child{border-radius:.625rem}.card-group>.card:only-child .card-header,.card-group>.card:only-child .card-img-top{border-top-left-radius:.625rem;border-top-right-radius:.625rem}.card-group>.card:only-child .card-footer,.card-group>.card:only-child .card-img-bottom{border-bottom-right-radius:.625rem;border-bottom-left-radius:.625rem}.card-group>.card:not(:first-child):not(:last-child):not(:only-child){border-radius:0}.card-group>.card:not(:first-child):not(:last-child):not(:only-child) .card-footer,.card-group>.card:not(:first-child):not(:last-child):not(:only-child) .card-header,.card-group>.card:not(:first-child):not(:last-child):not(:only-child) .card-img-bottom,.card-group>.card:not(:first-child):not(:last-child):not(:only-child) .card-img-top{border-radius:0}}.card-columns .card{margin-bottom:2.1875rem}@media (min-width:576px){.card-columns{-webkit-column-count:3;column-count:3;-webkit-column-gap:1.25rem;column-gap:1.25rem}}.pagination{padding-left:0;list-style:none;border-radius:.375rem;font-family:Poppins,-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif;font-size:.875rem}.page-link{padding:.5rem .75rem;line-height:1.25;color:#007bff;background-color:#fff;border:none;margin:0;transition:all 250ms cubic-bezier(.27,.01,.38,1.06)}.page-link:focus,.page-link:hover{color:#0056b3;background-color:#f5f5f6;border-color:#dfe1e3}.page-item{box-shadow:0 .125rem .9375rem rgba(90,97,105,.1),0 .125rem .1875rem rgba(90,97,105,.15)}.page-item:first-child{border-top-left-radius:.375rem;border-bottom-left-radius:.375rem;overflow:hidden}.page-item:last-child{border-top-right-radius:.375rem;border-bottom-right-radius:.375rem;overflow:hidden}.page-item:last-child .page-link{border-right:none}.page-item.active .page-link{color:#fff;background-color:#007bff;border-color:#007bff}.page-item.disabled .page-link{color:#a8aeb4;background-color:#fff;border-color:#dfe1e3}.pagination-lg .page-link{padding:.9375rem 1.5625rem;font-size:1.25rem;line-height:1.5}.pagination-lg .page-item:first-child .page-link{border-top-left-radius:.5rem;border-bottom-left-radius:.5rem}.pagination-lg .page-item:last-child .page-link{border-top-right-radius:.5rem;border-bottom-right-radius:.5rem}.pagination-sm .page-link{padding:.25rem .6875rem;font-size:.875rem;line-height:1.5}.pagination-sm .page-item:first-child .page-link{border-top-left-radius:.35rem;border-bottom-left-radius:.35rem}.pagination-sm .page-item:last-child .page-link{border-top-right-radius:.35rem;border-bottom-right-radius:.35rem}.badge{padding:.375rem .5rem;font-size:75%;font-weight:500;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif;color:#fff;border-radius:.375rem}a.badge{transition:all 250ms cubic-bezier(.27,.01,.38,1.06)}.badge-pill{padding-right:.5rem;padding-left:.5rem;border-radius:10rem}.badge-squared{border-radius:0}.badge-primary{color:#fff;background-color:#007bff}.badge-primary[href]:focus,.badge-primary[href]:hover{color:#fff;text-decoration:none;background-color:#0062cc}.badge-outline-primary{background:0 0;border:1px solid #007bff;color:#007bff}.badge-secondary{color:#fff;background-color:#5a6169}.badge-secondary[href]:focus,.badge-secondary[href]:hover{color:#fff;text-decoration:none;background-color:#42484e}.badge-outline-secondary{background:0 0;border:1px solid #5a6169;color:#5a6169}.badge-success{color:#fff;background-color:#17c671}.badge-success[href]:focus,.badge-success[href]:hover{color:#fff;text-decoration:none;background-color:#129857}.badge-outline-success{background:0 0;border:1px solid #17c671;color:#17c671}.badge-info{color:#fff;background-color:#00b8d8}.badge-info[href]:focus,.badge-info[href]:hover{color:#fff;text-decoration:none;background-color:#008da5}.badge-outline-info{background:0 0;border:1px solid #00b8d8;color:#00b8d8}.badge-warning{color:#212529;background-color:#ffb400}.badge-warning[href]:focus,.badge-warning[href]:hover{color:#212529;text-decoration:none;background-color:#cc9000}.badge-outline-warning{background:0 0;border:1px solid #ffb400;color:#ffb400}.badge-danger{color:#fff;background-color:#c4183c}.badge-danger[href]:focus,.badge-danger[href]:hover{color:#fff;text-decoration:none;background-color:#97122e}.badge-outline-danger{background:0 0;border:1px solid #c4183c;color:#c4183c}.badge-light{color:#212529;background-color:#e9ecef}.badge-light[href]:focus,.badge-light[href]:hover{color:#212529;text-decoration:none;background-color:#cbd3da}.badge-outline-light{background:0 0;border:1px solid #e9ecef;color:#e9ecef;color:#212529}.badge-dark{color:#fff;background-color:#212529}.badge-dark[href]:focus,.badge-dark[href]:hover{color:#fff;text-decoration:none;background-color:#0a0c0d}.badge-outline-dark{background:0 0;border:1px solid #212529;color:#212529}.jumbotron{padding:38px 42px;margin-bottom:2rem;background-color:#eceeef;border-radius:.5rem}@media (min-width:576px){.jumbotron{padding:4rem 2rem}}.alert{padding:.75rem 1.25rem;margin-bottom:1rem;border:none;border-radius:0}.alert-link{font-weight:500}.alert-dismissible .close{top:0;right:0;padding:.75rem 1.25rem;transition:all 250ms cubic-bezier(.27,.01,.38,1.06)}.alert-dismissible .close:hover{cursor:pointer}.alert-primary{color:#f5faff;background-color:#007bff}.alert-primary .alert-link{color:#f5faff}.alert-secondary{color:#d9dcdf;background-color:#5a6169}.alert-secondary .alert-link{color:#d9dcdf}.alert-success{color:#d7fae9;background-color:#17c671}.alert-success .alert-link{color:#d7fae9}.alert-info{color:#cef8ff;background-color:#00b8d8}.alert-info .alert-link{color:#cef8ff}.alert-warning{color:#fffcf5;background-color:#ffb400}.alert-warning .alert-link{color:#fffcf5}.alert-danger{color:#fad7de;background-color:#c4183c}.alert-danger .alert-link{color:#fad7de}.alert-light{color:#fff;background-color:#e9ecef;color:#212529}.alert-light .alert-link{color:#fff}.alert-light .alert-link{color:#212529}.alert-dark{color:#959faa;background-color:#212529}.alert-dark .alert-link{color:#959faa}.progress-wrapper{position:relative;color:#5a6169}.progress-wrapper .progress-label{font-size:.8125rem}.progress-wrapper .progress-value{position:absolute;top:6px;right:0;color:#5a6169}.progress{height:.625rem;font-size:.625rem;line-height:.625rem;background-color:#f5f5f6;margin-top:6px;border-radius:1.25rem;box-shadow:inset 0 .1rem .1rem rgba(90,97,105,.15)}.progress-sm{height:.3125rem}.progress-lg{height:.9375rem}.progress-lg .progress-bar{height:.9375rem}.progress-bar{height:.625rem;line-height:.625rem;color:#fff;background-color:#007bff;transition:width .6s ease}.progress-bar-striped{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);background-size:.625rem .625rem}.progress-bar-animated{-webkit-animation:progress-bar-stripes 1s linear infinite;animation:progress-bar-stripes 1s linear infinite}.list-group-small .list-group-item{padding:.625rem 1rem;font-size:.8125rem}.list-group-item-action{color:#5a6169;transition:all 250ms cubic-bezier(.27,.01,.38,1.06)}.list-group-item-action:focus,.list-group-item-action:hover{color:#5a6169;background-color:#f7f8f8}.list-group-item-action:active{color:#5a6169;background-color:#eceeef}.list-group-item{padding:.75rem 1.25rem;margin-bottom:-1px;background-color:#fff;border:1px solid rgba(0,0,0,.125);font-weight:300}.list-group-item:first-child{border-top-left-radius:.375rem;border-top-right-radius:.375rem}.list-group-item:last-child{border-bottom-right-radius:.375rem;border-bottom-left-radius:.375rem}.list-group-item.disabled,.list-group-item:disabled{color:#868e96;background-color:#fff}.list-group-item.active{color:#fff;background-color:#007bff;border-color:#007bff}.list-group-item-primary{color:#004085;background-color:#b8daff}a.list-group-item-primary,button.list-group-item-primary{color:#004085}a.list-group-item-primary:focus,a.list-group-item-primary:hover,button.list-group-item-primary:focus,button.list-group-item-primary:hover{color:#004085;background-color:#9fcdff}a.list-group-item-primary.active,button.list-group-item-primary.active{background-color:#004085;border-color:#004085}.list-group-item-secondary{color:#2f3237;background-color:#d1d3d5}a.list-group-item-secondary,button.list-group-item-secondary{color:#2f3237}a.list-group-item-secondary:focus,a.list-group-item-secondary:hover,button.list-group-item-secondary:focus,button.list-group-item-secondary:hover{color:#2f3237;background-color:#c4c6c9}a.list-group-item-secondary.active,button.list-group-item-secondary.active{background-color:#2f3237;border-color:#2f3237}.list-group-item-success{color:#0c673b;background-color:#beefd7}a.list-group-item-success,button.list-group-item-success{color:#0c673b}a.list-group-item-success:focus,a.list-group-item-success:hover,button.list-group-item-success:focus,button.list-group-item-success:hover{color:#0c673b;background-color:#aaeaca}a.list-group-item-success.active,button.list-group-item-success.active{background-color:#0c673b;border-color:#0c673b}.list-group-item-info{color:#006070;background-color:#b8ebf4}a.list-group-item-info,button.list-group-item-info{color:#006070}a.list-group-item-info:focus,a.list-group-item-info:hover,button.list-group-item-info:focus,button.list-group-item-info:hover{color:#006070;background-color:#a2e5f1}a.list-group-item-info.active,button.list-group-item-info.active{background-color:#006070;border-color:#006070}.list-group-item-warning{color:#855e00;background-color:#ffeab8}a.list-group-item-warning,button.list-group-item-warning{color:#855e00}a.list-group-item-warning:focus,a.list-group-item-warning:hover,button.list-group-item-warning:focus,button.list-group-item-warning:hover{color:#855e00;background-color:#ffe29f}a.list-group-item-warning.active,button.list-group-item-warning.active{background-color:#855e00;border-color:#855e00}.list-group-item-danger{color:#660c1f;background-color:#eebec8}a.list-group-item-danger,button.list-group-item-danger{color:#660c1f}a.list-group-item-danger:focus,a.list-group-item-danger:hover,button.list-group-item-danger:focus,button.list-group-item-danger:hover{color:#660c1f;background-color:#e9aab7}a.list-group-item-danger.active,button.list-group-item-danger.active{background-color:#660c1f;border-color:#660c1f}.list-group-item-light{color:#797b7c;background-color:#f9fafb}a.list-group-item-light,button.list-group-item-light{color:#797b7c}a.list-group-item-light:focus,a.list-group-item-light:hover,button.list-group-item-light:focus,button.list-group-item-light:hover{color:#797b7c;background-color:#eaedf1}a.list-group-item-light.active,button.list-group-item-light.active{background-color:#797b7c;border-color:#797b7c}.list-group-item-dark{color:#111315;background-color:#c1c2c3}a.list-group-item-dark,button.list-group-item-dark{color:#111315}a.list-group-item-dark:focus,a.list-group-item-dark:hover,button.list-group-item-dark:focus,button.list-group-item-dark:hover{color:#111315;background-color:#b4b5b6}a.list-group-item-dark.active,button.list-group-item-dark.active{background-color:#111315;border-color:#111315}.close{font-size:1.5rem;font-weight:500;color:#8c949d;text-shadow:none;transition:all 250ms cubic-bezier(.27,.01,.38,1.06)}.close:focus,.close:hover{color:#8c949d}.modal{z-index:1050}.modal-dialog{margin:.625rem}.modal.fade .modal-dialog{transition:-webkit-transform .3s ease-out;transition:transform .3s ease-out;transition:transform .3s ease-out,-webkit-transform .3s ease-out}.modal-dialog-centered{min-height:calc(100% - (.625rem * 2))}.modal-content{background-color:#fff;border:none;border-radius:.5rem;box-shadow:0 .46875rem 2.1875rem rgba(90,97,105,.1),0 .9375rem 1.40625rem rgba(90,97,105,.1),0 .25rem .53125rem rgba(90,97,105,.12),0 .125rem .1875rem rgba(90,97,105,.1)}.modal-backdrop{z-index:1040;background-color:#5a6169}.modal-backdrop.show{opacity:.12}.modal-header{padding:.9375rem 2.1875rem;border-bottom:1px solid #dfe1e3}.modal-title{line-height:1.5}.modal-body{padding:1.875rem 2.1875rem}.modal-footer{padding:.9375rem 2.1875rem;border-top:1px solid #dfe1e3}@media (min-width:576px){.modal-dialog{max-width:500px;margin:1.875rem auto}.modal-dialog-centered{min-height:calc(100% - (1.875rem * 2))}.modal-content{box-shadow:0 .46875rem 2.1875rem rgba(90,97,105,.1),0 .9375rem 1.40625rem rgba(90,97,105,.1),0 .25rem .53125rem rgba(90,97,105,.12),0 .125rem .1875rem rgba(90,97,105,.1)}.modal-sm{max-width:300px}}@media (min-width:992px){.modal-lg{max-width:800px}}.tooltip{z-index:1070;margin:0;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif;font-style:normal;font-weight:300;line-height:1.5;text-align:left;text-align:start;text-decoration:none;text-shadow:none;text-transform:none;letter-spacing:normal;word-break:normal;word-spacing:normal;white-space:normal;line-break:auto;font-size:.875rem}.tooltip.show{opacity:1}.tooltip .arrow{width:5px;height:5px}.bs-tooltip-auto[x-placement^=top],.bs-tooltip-top{padding:5px 0}.bs-tooltip-auto[x-placement^=top] .arrow::before,.bs-tooltip-top .arrow::before{border-width:5px 2.5px 0;border-top-color:#fff}.bs-tooltip-auto[x-placement^=right],.bs-tooltip-right{padding:0 5px}.bs-tooltip-auto[x-placement^=right] .arrow,.bs-tooltip-right .arrow{width:5px;height:5px}.bs-tooltip-auto[x-placement^=right] .arrow::before,.bs-tooltip-right .arrow::before{border-width:2.5px 5px 2.5px 0;border-right-color:#fff}.bs-tooltip-auto[x-placement^=bottom],.bs-tooltip-bottom{padding:5px 0}.bs-tooltip-auto[x-placement^=bottom] .arrow::before,.bs-tooltip-bottom .arrow::before{border-width:0 2.5px 5px;border-bottom-color:#fff}.bs-tooltip-auto[x-placement^=left],.bs-tooltip-left{padding:0 5px}.bs-tooltip-auto[x-placement^=left] .arrow,.bs-tooltip-left .arrow{width:5px;height:5px}.bs-tooltip-auto[x-placement^=left] .arrow::before,.bs-tooltip-left .arrow::before{border-width:2.5px 0 2.5px 5px;border-left-color:#fff}.tooltip-inner{max-width:200px;padding:7px 13px;color:#5a6169;background-color:#fff;box-shadow:0 3px 15px rgba(90,97,105,.1),0 2px 3px rgba(90,97,105,.2);border-radius:.375rem}.popover{z-index:1060;max-width:276px;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif;font-style:normal;font-weight:300;line-height:1.5;text-align:left;text-align:start;text-decoration:none;text-shadow:none;text-transform:none;letter-spacing:normal;word-break:normal;word-spacing:normal;white-space:normal;line-break:auto;font-size:.875rem;background-color:#fff;border:none;padding:0;border-radius:.5rem;box-shadow:0 3px 15px rgba(90,97,105,.1),0 2px 3px rgba(90,97,105,.2)}.popover .arrow{width:10px;height:5px;margin:0 .5rem}.popover .arrow::before{border-width:11px}.popover .arrow::after{border-width:11px}.bs-popover-auto[x-placement^=top],.bs-popover-top{margin-bottom:5px}.bs-popover-auto[x-placement^=top] .arrow,.bs-popover-top .arrow{bottom:calc((5px + 1px) * -1)}.bs-popover-auto[x-placement^=top] .arrow::after,.bs-popover-auto[x-placement^=top] .arrow::before,.bs-popover-top .arrow::after,.bs-popover-top .arrow::before{border-width:5px 5px 0}.bs-popover-auto[x-placement^=top] .arrow::before,.bs-popover-top .arrow::before{border-top-color:rgba(0,0,0,.05)}.bs-popover-auto[x-placement^=top] .arrow::after,.bs-popover-top .arrow::after{bottom:1px;border-top-color:#fff}.bs-popover-auto[x-placement^=right],.bs-popover-right{margin-left:5px}.bs-popover-auto[x-placement^=right] .arrow,.bs-popover-right .arrow{left:calc((5px + 1px) * -1);width:5px;height:10px;margin:.5rem 0}.bs-popover-auto[x-placement^=right] .arrow::after,.bs-popover-auto[x-placement^=right] .arrow::before,.bs-popover-right .arrow::after,.bs-popover-right .arrow::before{border-width:5px 5px 5px 0}.bs-popover-auto[x-placement^=right] .arrow::before,.bs-popover-right .arrow::before{border-right-color:rgba(0,0,0,.05)}.bs-popover-auto[x-placement^=right] .arrow::after,.bs-popover-right .arrow::after{left:1px;border-right-color:#fff}.bs-popover-auto[x-placement^=bottom],.bs-popover-bottom{margin-top:5px}.bs-popover-auto[x-placement^=bottom] .arrow,.bs-popover-bottom .arrow{top:calc((5px + 1px) * -1)}.bs-popover-auto[x-placement^=bottom] .arrow::after,.bs-popover-auto[x-placement^=bottom] .arrow::before,.bs-popover-bottom .arrow::after,.bs-popover-bottom .arrow::before{border-width:0 5px 5px 5px}.bs-popover-auto[x-placement^=bottom] .arrow::before,.bs-popover-bottom .arrow::before{border-bottom-color:rgba(0,0,0,.05)}.bs-popover-auto[x-placement^=bottom] .arrow::after,.bs-popover-bottom .arrow::after{top:1px;border-bottom-color:#fff}.bs-popover-auto[x-placement^=bottom] .popover-header::before,.bs-popover-bottom .popover-header::before{width:10px;margin-left:-5px;border-bottom:1px solid #f5f5f6}.bs-popover-auto[x-placement^=left],.bs-popover-left{margin-right:5px}.bs-popover-auto[x-placement^=left] .arrow,.bs-popover-left .arrow{right:calc((5px + 1px) * -1);width:5px;height:10px;margin:.5rem 0}.bs-popover-auto[x-placement^=left] .arrow::after,.bs-popover-auto[x-placement^=left] .arrow::before,.bs-popover-left .arrow::after,.bs-popover-left .arrow::before{border-width:5px 0 5px 5px}.bs-popover-auto[x-placement^=left] .arrow::before,.bs-popover-left .arrow::before{border-left-color:rgba(0,0,0,.05)}.bs-popover-auto[x-placement^=left] .arrow::after,.bs-popover-left .arrow::after{right:1px;border-left-color:#fff}.popover-header{padding:14px 20px;font-size:1rem;color:#212529;line-height:14px;background-color:#f5f5f6;border-bottom:1px solid #e7e9ea;border-top-left-radius:calc(.5rem - 1px);border-top-right-radius:calc(.5rem - 1px)}.popover-body{padding:15px 20px;color:#5a6169}.carousel{box-shadow:0 .46875rem 2.1875rem rgba(90,97,105,.1),0 .9375rem 1.40625rem rgba(90,97,105,.1),0 .25rem .53125rem rgba(90,97,105,.12),0 .125rem .1875rem rgba(90,97,105,.1)}.carousel-item{transition:-webkit-transform .6s ease;transition:transform .6s ease;transition:transform .6s ease,-webkit-transform .6s ease}.carousel-control-next,.carousel-control-prev{width:15%;color:#fff;opacity:.5}.carousel-control-next:focus,.carousel-control-next:hover,.carousel-control-prev:focus,.carousel-control-prev:hover{color:#fff}.carousel-control-next-icon,.carousel-control-prev-icon{width:20px;height:20px}.carousel-control-prev-icon{background-image:url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='%23fff' viewBox='0 0 8 8'%3E%3Cpath d='M4 0l-4 4 4 4 1.5-1.5-2.5-2.5 2.5-2.5-1.5-1.5z'/%3E%3C/svg%3E")}.carousel-control-next-icon{background-image:url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='%23fff' viewBox='0 0 8 8'%3E%3Cpath d='M1.5 0l-1.5 1.5 2.5 2.5-2.5 2.5 1.5 1.5 4-4-4-4z'/%3E%3C/svg%3E")}.carousel-indicators{margin-right:15%;margin-left:15%}.carousel-indicators li{width:30px;height:3px;margin-right:3px;margin-left:3px;background-color:rgba(255,255,255,.5);border-radius:3px}.carousel-indicators .active{background-color:#fff}.carousel-caption{right:15%;left:15%;color:#fff}.noUi-target,.noUi-target *{-webkit-touch-callout:none;-webkit-tap-highlight-color:transparent;-webkit-user-select:none;-ms-touch-action:none;touch-action:none;-ms-user-select:none;-moz-user-select:none;user-select:none;box-sizing:border-box}.noUi-target{position:relative;direction:ltr;background:#eceeef;border-radius:5px;box-shadow:inset 0 1px 2px rgba(90,97,105,.1);margin:35px 0}.noUi-target:focus{outline:0;box-shadow:0 0 8px rgba(0,123,255,.65),0 3px 15px rgba(90,97,105,.1),0 2px 3px rgba(90,97,105,.2)}.noUi-base,.noUi-connects{width:100%;height:100%;position:relative;z-index:1}.noUi-connects{overflow:hidden;z-index:0}.noUi-connect,.noUi-origin{position:absolute;will-change:transform;z-index:1;top:0;left:0;height:100%;width:100%;-webkit-transform-origin:0 0;transform-origin:0 0}.noUi-connect:focus,.noUi-origin:focus{outline:0}.noUi-connect{background:#007bff;border-radius:5px}html:not([dir=rtl]) .noUi-horizontal .noUi-origin{left:auto;right:0}html:not([dir=rtl]) .noUi-horizontal .noUi-handle{right:-17px;left:auto}.noUi-rtl .noUi-value-horizontal{-webkit-transform:translate(50%,50%);transform:translate(50%,50%)}.noUi-rtl .noUi-value-vertical{-webkit-transform:translate(0,50%);transform:translate(0,50%)}.noUi-vertical{width:5px}.noUi-vertical .noUi-origin{width:0}.noUi-vertical .noUi-handle{left:-10px;top:-11.5px}.noUi-vertical .noUi-handle:after,.noUi-vertical .noUi-handle:before{width:14px;height:1px;left:6px;top:14px}.noUi-vertical .noUi-handle:after{top:17px}.noUi-vertical .noUi-tooltip{-webkit-transform:translate(0,-50%);transform:translate(0,-50%);top:50%;right:30px}.noUi-vertical .noUi-draggable{cursor:ns-resize}.noUi-horizontal{height:5px}.noUi-horizontal .noUi-origin{height:0}.noUi-horizontal .noUi-handle{left:-11.5px;top:-10px}.noUi-horizontal .noUi-tooltip{-webkit-transform:translate(-50%,0);transform:translate(-50%,0);left:50%;bottom:30px}.noUi-handle{position:absolute;border:1px solid #e7e9ea;border-radius:50%;width:23px;height:23px;box-shadow:0 3px 15px rgba(90,97,105,.1),0 2px 3px rgba(90,97,105,.2);background:#fff;transition:all 250ms cubic-bezier(.27,.01,.38,1.06)}.noUi-handle:hover{cursor:grab;cursor:-webkit-grab;cursor:-moz-grab}.noUi-handle:active{cursor:grabbing;cursor:-webkit-grabbing;cursor:-moz-grabbing}.noUi-handle:focus{outline:0;box-shadow:0 0 8px rgba(0,123,255,.65),0 3px 15px rgba(90,97,105,.1),0 2px 3px rgba(90,97,105,.2)}.noUi-handle:after{left:17px}.noUi-state-tap .noUi-connect,.noUi-state-tap .noUi-origin{transition:-webkit-transform .3s;transition:transform .3s;transition:transform .3s,-webkit-transform .3s}.noUi-state-drag *{cursor:inherit!important}.noUi-connects{border-radius:5px}.noUi-draggable{cursor:ew-resize}.noUi-active{-webkit-transform:scale(1.1);transform:scale(1.1)}[disabled] .noUi-connect{background:#b8b8b8}[disabled] .noUi-handle,[disabled].noUi-handle,[disabled].noUi-target{cursor:not-allowed}[disabled] .noUi-handle{background:#f2f3f4}[disabled] .noUi-handle:focus{box-shadow:0 3px 15px rgba(90,97,105,.1),0 2px 3px rgba(90,97,105,.2)}.noUi-pips,.noUi-pips *{box-sizing:border-box}.noUi-pips{position:absolute;color:#a8aeb4;font-size:12px}.noUi-value{position:absolute;white-space:nowrap;text-align:center}.noUi-value-sub{color:#a8aeb4;font-size:10px}.noUi-marker{position:absolute;background:#a8aeb4}.noUi-marker-sub{background:#a8aeb4}.noUi-marker-large{background:#a8aeb4}.noUi-pips-horizontal{padding:10px 0;height:auto;top:100%;left:0;width:100%}.noUi-value-horizontal{-webkit-transform:translate3d(-50%,50%,0);transform:translate3d(-50%,50%,0)}.noUi-marker-horizontal.noUi-marker{margin-left:-1px;width:1px;height:4px}.noUi-marker-horizontal.noUi-marker-sub{height:5px}.noUi-marker-horizontal.noUi-marker-large{height:7px}.noUi-pips-vertical{padding:0 10px;height:100%;top:0;left:100%}.noUi-value-vertical{-webkit-transform:translate3d(0,-50%,0);transform:translate3d(0,-50%,0);padding-left:15px}.noUi-marker-vertical.noUi-marker{width:4px;height:1px;margin-top:-1px}.noUi-marker-vertical.noUi-marker-sub{width:10px}.noUi-marker-vertical.noUi-marker-large{width:7px}.noUi-tooltip{display:block;position:absolute;text-align:center;white-space:nowrap;border-radius:.375rem;border-radius:.375rem;background:#fff;color:#5a6169;box-shadow:0 3px 15px rgba(90,97,105,.1),0 2px 3px rgba(90,97,105,.2);font-size:.75rem;padding:5px 10px}.slider-primary .noUi-connect{background:#007bff}.slider-secondary .noUi-connect{background:#5a6169}.slider-success .noUi-connect{background:#17c671}.slider-info .noUi-connect{background:#00b8d8}.slider-warning .noUi-connect{background:#ffb400}.slider-danger .noUi-connect{background:#c4183c}.slider-light .noUi-connect{background:#e9ecef}.slider-dark .noUi-connect{background:#212529}.datepicker{border-radius:.625rem;direction:ltr}.datepicker-inline{width:220px}.datepicker-rtl{direction:rtl}.datepicker-rtl.dropdown-menu{left:auto}.datepicker-rtl table tr td span{float:right}.datepicker-dropdown{top:0;left:0;padding:20px 22px}.datepicker-dropdown:after,.datepicker-dropdown:before{content:'';display:inline-block;border-top:0;position:absolute}.datepicker-dropdown:before{border-left:7px solid transparent;border-right:7px solid transparent;border-bottom:7px solid #c3c7cc;border-bottom-color:rgba(0,0,0,.2)}.datepicker-dropdown:after{border-left:6px solid transparent;border-right:6px solid transparent;border-bottom:6px solid #fff}.datepicker-dropdown.datepicker-orient-left:before{left:6px}.datepicker-dropdown.datepicker-orient-left:after{left:7px}.datepicker-dropdown.datepicker-orient-right:before{right:6px}.datepicker-dropdown.datepicker-orient-right:after{right:7px}.datepicker-dropdown.datepicker-orient-bottom:before{top:-7px}.datepicker-dropdown.datepicker-orient-bottom:after{top:-6px}.datepicker-dropdown.datepicker-orient-top:before{bottom:-7px;border-bottom:0;border-top:7px solid #c3c7cc}.datepicker-dropdown.datepicker-orient-top:after{bottom:-6px;border-bottom:0;border-top:6px solid #fff}.datepicker table{margin:0;-webkit-touch-callout:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.datepicker table tr td{border-radius:50%}.datepicker table tr th{border-radius:.375rem;font-weight:500}.datepicker table tr td,.datepicker table tr th{transition:all 250ms cubic-bezier(.27,.01,.38,1.06);width:36px;height:36px;border:none;text-align:center}.table-striped .datepicker table tr td,.table-striped .datepicker table tr th{background-color:transparent}.datepicker table tr td.new,.datepicker table tr td.old{color:#c3c7cc}.datepicker table tr td.day:hover,.datepicker table tr td.focused{background:#eceeef;cursor:pointer}.datepicker table tr td.disabled,.datepicker table tr td.disabled:hover{background:0 0;color:#e7e9ea;cursor:default}.datepicker table tr td.highlighted{border-radius:0}.datepicker table tr td.highlighted.focused{background:#007bff}.datepicker table tr td.highlighted.disabled,.datepicker table tr td.highlighted.disabled:active{background:#007bff;color:#5a6169}.datepicker table tr td.today{background:#e6f2ff}.datepicker table tr td.today.focused{background:#f5f5f6}.datepicker table tr td.today.disabled,.datepicker table tr td.today.disabled:active{background:#f5f5f6;color:#868e96}.datepicker table tr td.range{background:#007bff;color:#fff;border-radius:0}.datepicker table tr td.range.focused{background:#0067d6}.datepicker table tr td.range.day.disabled:hover,.datepicker table tr td.range.disabled,.datepicker table tr td.range.disabled:active{background:#0062cc;color:#3395ff}.datepicker table tr td.range.highlighted.focused{background:#cbd3da}.datepicker table tr td.range.highlighted.disabled,.datepicker table tr td.range.highlighted.disabled:active{background:#e9ecef;color:#e7e9ea}.datepicker table tr td.range.today.disabled,.datepicker table tr td.range.today.disabled:active{background:#007bff;color:#fff}.datepicker table tr td.day.range-start{border-top-right-radius:0;border-bottom-right-radius:0}.datepicker table tr td.day.range-end{border-top-left-radius:0;border-bottom-left-radius:0}.datepicker table tr td.day.range-start.range-end{border-radius:50%}.datepicker table tr td.day.range:hover,.datepicker table tr td.selected,.datepicker table tr td.selected.highlighted,.datepicker table tr td.selected.highlighted:hover,.datepicker table tr td.selected:hover{background:#007bff;color:#fff}.datepicker table tr td.active,.datepicker table tr td.active.highlighted,.datepicker table tr td.active.highlighted:hover,.datepicker table tr td.active:hover{background:#007bff;color:#fff}.datepicker table tr td span{display:block;width:23%;height:54px;line-height:54px;float:left;margin:1%;cursor:pointer;border-radius:4px}.datepicker table tr td span.focused,.datepicker table tr td span:hover{background:#e9ecef}.datepicker table tr td span.disabled,.datepicker table tr td span.disabled:hover{background:0 0;color:#e7e9ea;cursor:default}.datepicker table tr td span.active,.datepicker table tr td span.active.disabled,.datepicker table tr td span.active.disabled:hover,.datepicker table tr td span.active:hover{text-shadow:0 -1px 0 rgba(0,0,0,.25)}.datepicker table tr td span.new,.datepicker table tr td span.old{color:#868e96}.datepicker .datepicker-switch{width:145px}.datepicker .datepicker-switch,.datepicker .next,.datepicker .prev,.datepicker tfoot tr th{cursor:pointer}.datepicker .datepicker-switch:hover,.datepicker .next:hover,.datepicker .prev:hover,.datepicker tfoot tr th:hover{background:#e9ecef}.datepicker .next.disabled,.datepicker .prev.disabled{visibility:hidden}.datepicker .cw{font-size:10px;width:12px;padding:0 2px 0 5px;vertical-align:middle}.input-daterange input{text-align:center}.bg-primary{background-color:#007bff!important}.bg-primary.card .card-body,.bg-primary.card .card-footer,.bg-primary.card .card-header,.bg-primary.card .card-title{background-color:#0062cc!important}.bg-primary.card .card-footer,.bg-primary.card .card-header{background:#0074f0}a.bg-primary:focus,a.bg-primary:hover{background-color:#0062cc!important}.bg-secondary{background-color:#5a6169!important}.bg-secondary.card .card-body,.bg-secondary.card .card-footer,.bg-secondary.card .card-header,.bg-secondary.card .card-title{background-color:#42484e!important}.bg-secondary.card .card-footer,.bg-secondary.card .card-header{background:#535961}a.bg-secondary:focus,a.bg-secondary:hover{background-color:#42484e!important}.bg-success{background-color:#17c671!important}.bg-success.card .card-body,.bg-success.card .card-footer,.bg-success.card .card-header,.bg-success.card .card-title{background-color:#129857!important}.bg-success.card .card-footer,.bg-success.card .card-header{background:#15b869}a.bg-success:focus,a.bg-success:hover{background-color:#129857!important}.bg-info{background-color:#00b8d8!important}.bg-info.card .card-body,.bg-info.card .card-footer,.bg-info.card .card-header,.bg-info.card .card-title{background-color:#008da5!important}.bg-info.card .card-footer,.bg-info.card .card-header{background:#00abc9}a.bg-info:focus,a.bg-info:hover{background-color:#008da5!important}.bg-warning{background-color:#ffb400!important}.bg-warning.card .card-body,.bg-warning.card .card-footer,.bg-warning.card .card-header,.bg-warning.card .card-title{background-color:#cc9000!important}.bg-warning.card .card-footer,.bg-warning.card .card-header{background:#f0a900}a.bg-warning:focus,a.bg-warning:hover{background-color:#cc9000!important}.bg-danger{background-color:#c4183c!important}.bg-danger.card .card-body,.bg-danger.card .card-footer,.bg-danger.card .card-header,.bg-danger.card .card-title{background-color:#97122e!important}.bg-danger.card .card-footer,.bg-danger.card .card-header{background:#b61638}a.bg-danger:focus,a.bg-danger:hover{background-color:#97122e!important}.bg-light{background-color:#e9ecef!important}.bg-light.card .card-body,.bg-light.card .card-footer,.bg-light.card .card-header,.bg-light.card .card-title{background-color:#cbd3da!important}.bg-light.card .card-footer,.bg-light.card .card-header{background:#e0e4e9}a.bg-light:focus,a.bg-light:hover{background-color:#cbd3da!important}.bg-dark{background-color:#212529!important}.bg-dark.card .card-body,.bg-dark.card .card-footer,.bg-dark.card .card-header,.bg-dark.card .card-title{background-color:#0a0c0d!important}.bg-dark.card .card-footer,.bg-dark.card .card-header{background:#1a1d21}a.bg-dark:focus,a.bg-dark:hover{background-color:#0a0c0d!important}.border{border:1px solid #becad6!important}.border-top{border-top:1px solid #becad6!important}.border-right{border-right:1px solid #becad6!important}.border-bottom{border-bottom:1px solid #becad6!important}.border-left{border-left:1px solid #becad6!important}.border-primary{border-color:#007bff!important}.border-secondary{border-color:#5a6169!important}.border-success{border-color:#17c671!important}.border-info{border-color:#00b8d8!important}.border-warning{border-color:#ffb400!important}.border-danger{border-color:#c4183c!important}.border-light{border-color:#e9ecef!important}.border-dark{border-color:#212529!important}.rounded{border-radius:.375rem!important}.rounded-top{border-top-left-radius:.375rem!important;border-top-right-radius:.375rem!important}.rounded-right{border-top-right-radius:.375rem!important;border-bottom-right-radius:.375rem!important}.rounded-bottom{border-bottom-right-radius:.375rem!important;border-bottom-left-radius:.375rem!important}.rounded-left{border-top-left-radius:.375rem!important;border-bottom-left-radius:.375rem!important}.text-monospace{font-family:"Roboto Mono",Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace}.font-weight-normal{font-weight:300}.font-weight-bold{font-weight:500}.text-primary{color:#007bff!important}a.text-primary:focus,a.text-primary:hover{color:#0062cc!important}.text-secondary{color:#5a6169!important}a.text-secondary:focus,a.text-secondary:hover{color:#42484e!important}.text-success{color:#17c671!important}a.text-success:focus,a.text-success:hover{color:#129857!important}.text-info{color:#00b8d8!important}a.text-info:focus,a.text-info:hover{color:#008da5!important}.text-warning{color:#ffb400!important}a.text-warning:focus,a.text-warning:hover{color:#cc9000!important}.text-danger{color:#c4183c!important}a.text-danger:focus,a.text-danger:hover{color:#97122e!important}.text-light{color:#e9ecef!important}a.text-light:focus,a.text-light:hover{color:#cbd3da!important}.text-dark{color:#212529!important}a.text-dark:focus,a.text-dark:hover{color:#0a0c0d!important}.text-body{color:#5a6169!important}a.text-white:focus,a.text-white:hover{color:#e6e6e6!important}.text-black{color:#000}a.text-black:focus,a.text-black:hover{color:#000!important}.text-muted{color:#868e96!important}.with-shadows{box-shadow:0 .46875rem 2.1875rem rgba(90,97,105,.1),0 .9375rem 1.40625rem rgba(90,97,105,.1),0 .25rem .53125rem rgba(90,97,105,.12),0 .125rem .1875rem rgba(90,97,105,.1)} +/*# sourceMappingURL=shards.min.css.map */ \ No newline at end of file diff --git a/spring-boot-crud/src/main/resources/templates/add-user.html b/spring-boot-crud/src/main/resources/templates/add-user.html new file mode 100644 index 0000000000..31d38f2cb5 --- /dev/null +++ b/spring-boot-crud/src/main/resources/templates/add-user.html @@ -0,0 +1,40 @@ + + + + + + Add User + + + + + + +
+

New User

+
+
+
+
+
+ + + +
+
+ + + +
+
+
+
+ +
+
+ +
+
+
+ + \ No newline at end of file diff --git a/spring-boot-crud/src/main/resources/templates/index.html b/spring-boot-crud/src/main/resources/templates/index.html new file mode 100644 index 0000000000..2634e10380 --- /dev/null +++ b/spring-boot-crud/src/main/resources/templates/index.html @@ -0,0 +1,43 @@ + + + + + + Users + + + + + + +
+
+
+

No users yet!

+
+

Users

+
+ + + + + + + + + + + + + + + + +
NameEmailEditDelete
+ +

+ + + + + \ No newline at end of file diff --git a/spring-boot-crud/src/main/resources/templates/update-user.html b/spring-boot-crud/src/main/resources/templates/update-user.html new file mode 100644 index 0000000000..f94e8eb987 --- /dev/null +++ b/spring-boot-crud/src/main/resources/templates/update-user.html @@ -0,0 +1,40 @@ + + + + + + Update User + + + + + + +
+

Update User

+
+
+
+
+
+ + + +
+
+ + + +
+
+
+
+ +
+
+
+
+
+
+ + \ No newline at end of file diff --git a/spring-boot-crud/src/test/java/com/baeldung/crud/UserControllerUnitTest.java b/spring-boot-crud/src/test/java/com/baeldung/crud/UserControllerUnitTest.java new file mode 100644 index 0000000000..2de0828ae5 --- /dev/null +++ b/spring-boot-crud/src/test/java/com/baeldung/crud/UserControllerUnitTest.java @@ -0,0 +1,83 @@ +package com.baeldung.crud; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; + +import org.junit.BeforeClass; +import org.junit.Test; +import org.springframework.ui.Model; +import org.springframework.validation.BindingResult; + +import com.baeldung.crud.controllers.UserController; +import com.baeldung.crud.entities.User; +import com.baeldung.crud.repositories.UserRepository; + +public class UserControllerUnitTest { + + private static UserController userController; + private static UserRepository mockedUserRepository; + private static BindingResult mockedBindingResult; + private static Model mockedModel; + + @BeforeClass + public static void setUpUserControllerInstance() { + mockedUserRepository = mock(UserRepository.class); + mockedBindingResult = mock(BindingResult.class); + mockedModel = mock(Model.class); + userController = new UserController(mockedUserRepository); + } + + @Test + public void whenCalledshowSignUpForm_thenCorrect() { + User user = new User("John", "john@domain.com"); + + assertThat(userController.showSignUpForm(user)).isEqualTo("add-user"); + } + + @Test + public void whenCalledaddUserAndValidUser_thenCorrect() { + User user = new User("John", "john@domain.com"); + + when(mockedBindingResult.hasErrors()).thenReturn(false); + + assertThat(userController.addUser(user, mockedBindingResult, mockedModel)).isEqualTo("index"); + } + + @Test + public void whenCalledaddUserAndInValidUser_thenCorrect() { + User user = new User("John", "john@domain.com"); + + when(mockedBindingResult.hasErrors()).thenReturn(true); + + assertThat(userController.addUser(user, mockedBindingResult, mockedModel)).isEqualTo("add-user"); + } + + @Test(expected = IllegalArgumentException.class) + public void whenCalledshowUpdateForm_thenIllegalArgumentException() { + assertThat(userController.showUpdateForm(0, mockedModel)).isEqualTo("update-user"); + } + + @Test + public void whenCalledupdateUserAndValidUser_thenCorrect() { + User user = new User("John", "john@domain.com"); + + when(mockedBindingResult.hasErrors()).thenReturn(false); + + assertThat(userController.updateUser(1l, user, mockedBindingResult, mockedModel)).isEqualTo("index"); + } + + @Test + public void whenCalledupdateUserAndInValidUser_thenCorrect() { + User user = new User("John", "john@domain.com"); + + when(mockedBindingResult.hasErrors()).thenReturn(true); + + assertThat(userController.updateUser(1l, user, mockedBindingResult, mockedModel)).isEqualTo("update-user"); + } + + @Test(expected = IllegalArgumentException.class) + public void whenCalleddeleteUser_thenIllegalArgumentException() { + assertThat(userController.deleteUser(1l, mockedModel)).isEqualTo("index"); + } +} diff --git a/spring-boot-crud/src/test/java/com/baeldung/crud/UserUnitTest.java b/spring-boot-crud/src/test/java/com/baeldung/crud/UserUnitTest.java new file mode 100644 index 0000000000..565f6727c3 --- /dev/null +++ b/spring-boot-crud/src/test/java/com/baeldung/crud/UserUnitTest.java @@ -0,0 +1,48 @@ +package com.baeldung.crud; + +import static org.assertj.core.api.Assertions.assertThat; + +import org.junit.Test; + +import com.baeldung.crud.entities.User; + +public class UserUnitTest { + + @Test + public void whenCalledGetName_thenCorrect() { + User user = new User("Julie", "julie@domain.com"); + + assertThat(user.getName()).isEqualTo("Julie"); + } + + @Test + public void whenCalledGetEmail_thenCorrect() { + User user = new User("Julie", "julie@domain.com"); + + assertThat(user.getEmail()).isEqualTo("julie@domain.com"); + } + + @Test + public void whenCalledSetName_thenCorrect() { + User user = new User("Julie", "julie@domain.com"); + + user.setName("John"); + + assertThat(user.getName()).isEqualTo("John"); + } + + @Test + public void whenCalledSetEmail_thenCorrect() { + User user = new User("Julie", "julie@domain.com"); + + user.setEmail("john@domain.com"); + + assertThat(user.getEmail()).isEqualTo("john@domain.com"); + } + + @Test + public void whenCalledtoString_thenCorrect() { + User user = new User("Julie", "julie@domain.com"); + assertThat(user.toString()).isEqualTo("User{id=0, name=Julie, email=julie@domain.com}"); + } +} diff --git a/spring-boot-ctx-fluent/pom.xml b/spring-boot-ctx-fluent/pom.xml index f9b691aea7..b238374612 100644 --- a/spring-boot-ctx-fluent/pom.xml +++ b/spring-boot-ctx-fluent/pom.xml @@ -1,10 +1,10 @@ 4.0.0 - com.baeldung spring-boot-ctx-fluent 0.0.1-SNAPSHOT + spring-boot-ctx-fluent jar diff --git a/spring-boot-custom-starter/greeter-library/pom.xml b/spring-boot-custom-starter/greeter-library/pom.xml index 3717ba005c..7e0c5c4d22 100644 --- a/spring-boot-custom-starter/greeter-library/pom.xml +++ b/spring-boot-custom-starter/greeter-library/pom.xml @@ -1,10 +1,11 @@ 4.0.0 - com.baeldung greeter-library 0.0.1-SNAPSHOT + greeter-library + spring-boot-custom-starter com.baeldung 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 5862bdd6c8..1e4ee698c6 100644 --- a/spring-boot-custom-starter/greeter-spring-boot-autoconfigure/pom.xml +++ b/spring-boot-custom-starter/greeter-spring-boot-autoconfigure/pom.xml @@ -1,10 +1,10 @@ 4.0.0 - com.baeldung greeter-spring-boot-autoconfigure 0.0.1-SNAPSHOT + greeter-spring-boot-autoconfigure spring-boot-custom-starter diff --git a/spring-boot-custom-starter/greeter-spring-boot-sample-app/pom.xml b/spring-boot-custom-starter/greeter-spring-boot-sample-app/pom.xml index 4eac7eba19..91cc41d669 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,17 +1,29 @@ 4.0.0 - com.baeldung greeter-spring-boot-sample-app 0.0.1-SNAPSHOT + greeter-spring-boot-sample-app - parent-boot-1 + spring-boot-custom-starter com.baeldung 0.0.1-SNAPSHOT - ../../parent-boot-1 + ../../spring-boot-custom-starter + + + + + org.springframework.boot + spring-boot-dependencies + ${spring-boot.version} + pom + import + + + @@ -19,9 +31,27 @@ greeter-spring-boot-starter ${greeter-starter.version} + + org.springframework.boot + spring-boot-starter-test + test + + + + + + + org.springframework.boot + spring-boot-maven-plugin + ${spring-boot.version} + + + + + 1.5.15.RELEASE 0.0.1-SNAPSHOT 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 e71882db29..560d6fa79b 100644 --- a/spring-boot-custom-starter/greeter-spring-boot-starter/pom.xml +++ b/spring-boot-custom-starter/greeter-spring-boot-starter/pom.xml @@ -1,10 +1,10 @@ 4.0.0 - com.baeldung greeter-spring-boot-starter 0.0.1-SNAPSHOT + greeter-spring-boot-starter spring-boot-custom-starter diff --git a/spring-boot-custom-starter/greeter/pom.xml b/spring-boot-custom-starter/greeter/pom.xml index 3cfd6da09e..95fcaa66c8 100644 --- a/spring-boot-custom-starter/greeter/pom.xml +++ b/spring-boot-custom-starter/greeter/pom.xml @@ -1,10 +1,11 @@ 4.0.0 - com.baeldung greeter 0.0.1-SNAPSHOT + greeter + parent-boot-1 com.baeldung diff --git a/spring-boot-custom-starter/pom.xml b/spring-boot-custom-starter/pom.xml index b8ad8fa12c..9c03cfdd0e 100644 --- a/spring-boot-custom-starter/pom.xml +++ b/spring-boot-custom-starter/pom.xml @@ -4,6 +4,7 @@ com.baeldung spring-boot-custom-starter 0.0.1-SNAPSHOT + spring-boot-custom-starter pom @@ -18,5 +19,6 @@ greeter-spring-boot-starter greeter-spring-boot-sample-app + \ No newline at end of file diff --git a/spring-boot-disable-console-logging/README.md b/spring-boot-disable-console-logging/README.md new file mode 100644 index 0000000000..3d75fddc8e --- /dev/null +++ b/spring-boot-disable-console-logging/README.md @@ -0,0 +1,2 @@ +### Relevant Articles: +- [How to Disable Console Logging in Spring Boot](https://www.baeldung.com/spring-boot-disable-console-logging) diff --git a/spring-boot-disable-console-logging/disabling-console-jul/.gitignore b/spring-boot-disable-console-logging/disabling-console-jul/.gitignore new file mode 100644 index 0000000000..ff56635e49 --- /dev/null +++ b/spring-boot-disable-console-logging/disabling-console-jul/.gitignore @@ -0,0 +1 @@ +baeldung.log diff --git a/spring-boot-logging-log4j2/disabling-console-logging/disabling-console-jul/pom.xml b/spring-boot-disable-console-logging/disabling-console-jul/pom.xml similarity index 83% rename from spring-boot-logging-log4j2/disabling-console-logging/disabling-console-jul/pom.xml rename to spring-boot-disable-console-logging/disabling-console-jul/pom.xml index c3bad74352..9ccbd56231 100644 --- a/spring-boot-logging-log4j2/disabling-console-logging/disabling-console-jul/pom.xml +++ b/spring-boot-disable-console-logging/disabling-console-jul/pom.xml @@ -2,11 +2,13 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 disabling-console-jul - + disabling-console-jul + + - com.baeldung - disabling-console-logging - 0.0.1-SNAPSHOT + org.springframework.boot + spring-boot-starter-parent + 2.1.1.RELEASE diff --git a/spring-boot-logging-log4j2/disabling-console-logging/disabling-console-jul/src/main/java/com/baeldung/springbootlogging/disablingconsole/jul/properties/DisablingConsoleJulApp.java b/spring-boot-disable-console-logging/disabling-console-jul/src/main/java/com/baeldung/springbootlogging/disablingconsole/jul/properties/DisablingConsoleJulApp.java similarity index 100% rename from spring-boot-logging-log4j2/disabling-console-logging/disabling-console-jul/src/main/java/com/baeldung/springbootlogging/disablingconsole/jul/properties/DisablingConsoleJulApp.java rename to spring-boot-disable-console-logging/disabling-console-jul/src/main/java/com/baeldung/springbootlogging/disablingconsole/jul/properties/DisablingConsoleJulApp.java diff --git a/spring-boot-logging-log4j2/disabling-console-logging/disabling-console-jul/src/main/java/com/baeldung/springbootlogging/disablingconsole/jul/properties/controllers/DisabledConsoleRestController.java b/spring-boot-disable-console-logging/disabling-console-jul/src/main/java/com/baeldung/springbootlogging/disablingconsole/jul/properties/controllers/DisabledConsoleRestController.java similarity index 100% rename from spring-boot-logging-log4j2/disabling-console-logging/disabling-console-jul/src/main/java/com/baeldung/springbootlogging/disablingconsole/jul/properties/controllers/DisabledConsoleRestController.java rename to spring-boot-disable-console-logging/disabling-console-jul/src/main/java/com/baeldung/springbootlogging/disablingconsole/jul/properties/controllers/DisabledConsoleRestController.java diff --git a/spring-boot-logging-log4j2/disabling-console-logging/disabling-console-jul/src/main/resources/application.properties b/spring-boot-disable-console-logging/disabling-console-jul/src/main/resources/application.properties similarity index 100% rename from spring-boot-logging-log4j2/disabling-console-logging/disabling-console-jul/src/main/resources/application.properties rename to spring-boot-disable-console-logging/disabling-console-jul/src/main/resources/application.properties diff --git a/spring-boot-logging-log4j2/disabling-console-logging/disabling-console-jul/src/main/resources/logging.properties b/spring-boot-disable-console-logging/disabling-console-jul/src/main/resources/logging.properties similarity index 100% rename from spring-boot-logging-log4j2/disabling-console-logging/disabling-console-jul/src/main/resources/logging.properties rename to spring-boot-disable-console-logging/disabling-console-jul/src/main/resources/logging.properties diff --git a/spring-boot-disable-console-logging/disabling-console-log4j2/.gitignore b/spring-boot-disable-console-logging/disabling-console-log4j2/.gitignore new file mode 100644 index 0000000000..d3ae44ddfc --- /dev/null +++ b/spring-boot-disable-console-logging/disabling-console-log4j2/.gitignore @@ -0,0 +1 @@ +all.log diff --git a/spring-boot-logging-log4j2/disabling-console-logging/disabling-console-log4j2/pom.xml b/spring-boot-disable-console-logging/disabling-console-log4j2/pom.xml similarity index 79% rename from spring-boot-logging-log4j2/disabling-console-logging/disabling-console-log4j2/pom.xml rename to spring-boot-disable-console-logging/disabling-console-log4j2/pom.xml index f9b34ec7d9..0b360bb366 100644 --- a/spring-boot-logging-log4j2/disabling-console-logging/disabling-console-log4j2/pom.xml +++ b/spring-boot-disable-console-logging/disabling-console-log4j2/pom.xml @@ -2,11 +2,13 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 disabling-console-log4j2 + disabling-console-log4j2 + - com.baeldung - disabling-console-logging - 0.0.1-SNAPSHOT + org.springframework.boot + spring-boot-starter-parent + 2.1.1.RELEASE diff --git a/spring-boot-logging-log4j2/disabling-console-logging/disabling-console-log4j2/src/main/java/com/baeldung/springbootlogging/disablingconsole/log4j2/xml/DisablingConsoleLog4j2App.java b/spring-boot-disable-console-logging/disabling-console-log4j2/src/main/java/com/baeldung/springbootlogging/disablingconsole/log4j2/xml/DisablingConsoleLog4j2App.java similarity index 100% rename from spring-boot-logging-log4j2/disabling-console-logging/disabling-console-log4j2/src/main/java/com/baeldung/springbootlogging/disablingconsole/log4j2/xml/DisablingConsoleLog4j2App.java rename to spring-boot-disable-console-logging/disabling-console-log4j2/src/main/java/com/baeldung/springbootlogging/disablingconsole/log4j2/xml/DisablingConsoleLog4j2App.java diff --git a/spring-boot-logging-log4j2/disabling-console-logging/disabling-console-log4j2/src/main/java/com/baeldung/springbootlogging/disablingconsole/log4j2/xml/controllers/DisabledConsoleRestController.java b/spring-boot-disable-console-logging/disabling-console-log4j2/src/main/java/com/baeldung/springbootlogging/disablingconsole/log4j2/xml/controllers/DisabledConsoleRestController.java similarity index 100% rename from spring-boot-logging-log4j2/disabling-console-logging/disabling-console-log4j2/src/main/java/com/baeldung/springbootlogging/disablingconsole/log4j2/xml/controllers/DisabledConsoleRestController.java rename to spring-boot-disable-console-logging/disabling-console-log4j2/src/main/java/com/baeldung/springbootlogging/disablingconsole/log4j2/xml/controllers/DisabledConsoleRestController.java diff --git a/spring-boot-logging-log4j2/disabling-console-logging/disabling-console-log4j2/src/main/resources/log4j2.xml b/spring-boot-disable-console-logging/disabling-console-log4j2/src/main/resources/log4j2.xml similarity index 100% rename from spring-boot-logging-log4j2/disabling-console-logging/disabling-console-log4j2/src/main/resources/log4j2.xml rename to spring-boot-disable-console-logging/disabling-console-log4j2/src/main/resources/log4j2.xml diff --git a/spring-boot-disable-console-logging/disabling-console-logback/.gitignore b/spring-boot-disable-console-logging/disabling-console-logback/.gitignore new file mode 100644 index 0000000000..4e6aa917ed --- /dev/null +++ b/spring-boot-disable-console-logging/disabling-console-logback/.gitignore @@ -0,0 +1 @@ +disabled-console.log diff --git a/spring-boot-disable-console-logging/disabling-console-logback/pom.xml b/spring-boot-disable-console-logging/disabling-console-logback/pom.xml new file mode 100644 index 0000000000..4b64885c66 --- /dev/null +++ b/spring-boot-disable-console-logging/disabling-console-logback/pom.xml @@ -0,0 +1,22 @@ + + 4.0.0 + disabling-console-logback + disabling-console-logback + + + spring-boot-disable-console-logging + com.baeldung + 0.0.1-SNAPSHOT + ../ + + + + + org.springframework.boot + spring-boot-starter-web + + + + \ No newline at end of file diff --git a/spring-boot-logging-log4j2/disabling-console-logging/disabling-console-logback/src/main/java/com/baeldung/springbootlogging/disablingconsole/logback/xml/DisablingConsoleLogbackApp.java b/spring-boot-disable-console-logging/disabling-console-logback/src/main/java/com/baeldung/springbootlogging/disablingconsole/logback/xml/DisablingConsoleLogbackApp.java similarity index 100% rename from spring-boot-logging-log4j2/disabling-console-logging/disabling-console-logback/src/main/java/com/baeldung/springbootlogging/disablingconsole/logback/xml/DisablingConsoleLogbackApp.java rename to spring-boot-disable-console-logging/disabling-console-logback/src/main/java/com/baeldung/springbootlogging/disablingconsole/logback/xml/DisablingConsoleLogbackApp.java diff --git a/spring-boot-logging-log4j2/disabling-console-logging/disabling-console-logback/src/main/java/com/baeldung/springbootlogging/disablingconsole/logback/xml/controllers/DisabledConsoleRestController.java b/spring-boot-disable-console-logging/disabling-console-logback/src/main/java/com/baeldung/springbootlogging/disablingconsole/logback/xml/controllers/DisabledConsoleRestController.java similarity index 100% rename from spring-boot-logging-log4j2/disabling-console-logging/disabling-console-logback/src/main/java/com/baeldung/springbootlogging/disablingconsole/logback/xml/controllers/DisabledConsoleRestController.java rename to spring-boot-disable-console-logging/disabling-console-logback/src/main/java/com/baeldung/springbootlogging/disablingconsole/logback/xml/controllers/DisabledConsoleRestController.java diff --git a/spring-boot-logging-log4j2/disabling-console-logging/disabling-console-logback/src/main/resources/application.properties b/spring-boot-disable-console-logging/disabling-console-logback/src/main/resources/application.properties similarity index 100% rename from spring-boot-logging-log4j2/disabling-console-logging/disabling-console-logback/src/main/resources/application.properties rename to spring-boot-disable-console-logging/disabling-console-logback/src/main/resources/application.properties diff --git a/spring-boot-logging-log4j2/disabling-console-logging/disabling-console-logback/src/main/resources/logback-spring.xml b/spring-boot-disable-console-logging/disabling-console-logback/src/main/resources/logback-spring.xml similarity index 100% rename from spring-boot-logging-log4j2/disabling-console-logging/disabling-console-logback/src/main/resources/logback-spring.xml rename to spring-boot-disable-console-logging/disabling-console-logback/src/main/resources/logback-spring.xml diff --git a/spring-boot-logging-log4j2/disabling-console-logging/pom.xml b/spring-boot-disable-console-logging/pom.xml similarity index 74% rename from spring-boot-logging-log4j2/disabling-console-logging/pom.xml rename to spring-boot-disable-console-logging/pom.xml index 39a4a40f12..63ed129347 100644 --- a/spring-boot-logging-log4j2/disabling-console-logging/pom.xml +++ b/spring-boot-disable-console-logging/pom.xml @@ -1,14 +1,16 @@ 4.0.0 - disabling-console-logging + spring-boot-disable-console-logging + spring-boot-disable-console-logging pom Projects for Disabling Spring Boot Console Logging tutorials + parent-boot-2 com.baeldung - spring-boot-logging-log4j2 0.0.1-SNAPSHOT + ../parent-boot-2 diff --git a/spring-boot-logging-log4j2/README.md b/spring-boot-logging-log4j2/README.md index 305957ed8d..ea968d7fae 100644 --- a/spring-boot-logging-log4j2/README.md +++ b/spring-boot-logging-log4j2/README.md @@ -1,3 +1,4 @@ ### Relevant Articles: - [Logging in Spring Boot](http://www.baeldung.com/spring-boot-logging) -- [How to Disable Console Logging in Spring Boot](https://www.baeldung.com/spring-boot-disable-console-logging) +- [Logging to Graylog with Spring Boot](https://www.baeldung.com/graylog-with-spring-boot) + diff --git a/spring-boot-logging-log4j2/disabling-console-logging/disabling-console-logback/pom.xml b/spring-boot-logging-log4j2/disabling-console-logging/disabling-console-logback/pom.xml deleted file mode 100644 index 6f2170390b..0000000000 --- a/spring-boot-logging-log4j2/disabling-console-logging/disabling-console-logback/pom.xml +++ /dev/null @@ -1,9 +0,0 @@ - - 4.0.0 - - com.baeldung - disabling-console-logging - 0.0.1-SNAPSHOT - - disabling-console-logback - \ No newline at end of file diff --git a/spring-boot-logging-log4j2/pom.xml b/spring-boot-logging-log4j2/pom.xml index 7caf1e8690..ad678a14cf 100644 --- a/spring-boot-logging-log4j2/pom.xml +++ b/spring-boot-logging-log4j2/pom.xml @@ -2,43 +2,74 @@ 4.0.0 - spring-boot-logging-log4j2 - pom - Projects for Spring Boot Logging tutorials + jar + spring-boot-logging-log4j2 + Demo project for Spring Boot Logging with Log4J2 + + - parent-boot-2 - com.baeldung - 0.0.1-SNAPSHOT - ../parent-boot-2 + spring-boot-starter-parent + org.springframework.boot + 2.0.5.RELEASE org.springframework.boot spring-boot-starter-web + + + org.springframework.boot + spring-boot-starter-logging + + - org.springframework.boot spring-boot-starter-test - test + + + org.springframework.boot + spring-boot-starter-log4j2 + + + + + + org.springframework.boot + spring-boot-starter-log4j + 1.3.8.RELEASE + + + org.graylog2 + gelfj + 1.1.16 + compile - - spring-boot-logging-log4j2-app - disabling-console-logging - - - - - org.springframework.boot - spring-boot-maven-plugin - - + + + org.apache.maven.plugins + maven-surefire-plugin + + 3 + true + + **/*IntegrationTest.java + **/*IntTest.java + **/*ManualTest.java + **/*LiveTest.java + + + + - + + + com.baeldung.springbootlogging.SpringBootLoggingApplication + diff --git a/spring-boot/src/main/java/com/baeldung/graylog/GraylogDemoApplication.java b/spring-boot-logging-log4j2/src/main/java/com/baeldung/graylog/GraylogDemoApplication.java similarity index 100% rename from spring-boot/src/main/java/com/baeldung/graylog/GraylogDemoApplication.java rename to spring-boot-logging-log4j2/src/main/java/com/baeldung/graylog/GraylogDemoApplication.java diff --git a/spring-boot-logging-log4j2/spring-boot-logging-log4j2-app/src/main/java/com/baeldung/springbootlogging/LoggingController.java b/spring-boot-logging-log4j2/src/main/java/com/baeldung/springbootlogging/LoggingController.java similarity index 97% rename from spring-boot-logging-log4j2/spring-boot-logging-log4j2-app/src/main/java/com/baeldung/springbootlogging/LoggingController.java rename to spring-boot-logging-log4j2/src/main/java/com/baeldung/springbootlogging/LoggingController.java index 07763c8c3b..d462926616 100644 --- a/spring-boot-logging-log4j2/spring-boot-logging-log4j2-app/src/main/java/com/baeldung/springbootlogging/LoggingController.java +++ b/spring-boot-logging-log4j2/src/main/java/com/baeldung/springbootlogging/LoggingController.java @@ -32,6 +32,6 @@ public class LoggingController { loggerNative.warn("This WARN message been printed by Log4j2 without passing through SLF4J"); loggerNative.error("This ERROR message been printed by Log4j2 without passing through SLF4J"); loggerNative.fatal("This FATAL message been printed by Log4j2 without passing through SLF4J"); - return "Howdy! Check out the Logs to see the output printed directly throguh Log4j2..."; + return "Howdy! Check out the Logs to see the output printed directly through Log4j2..."; } } diff --git a/spring-boot-logging-log4j2/spring-boot-logging-log4j2-app/src/main/java/com/baeldung/springbootlogging/SpringBootLoggingApplication.java b/spring-boot-logging-log4j2/src/main/java/com/baeldung/springbootlogging/SpringBootLoggingApplication.java similarity index 100% rename from spring-boot-logging-log4j2/spring-boot-logging-log4j2-app/src/main/java/com/baeldung/springbootlogging/SpringBootLoggingApplication.java rename to spring-boot-logging-log4j2/src/main/java/com/baeldung/springbootlogging/SpringBootLoggingApplication.java diff --git a/spring-boot-logging-log4j2/src/main/resources/application.properties b/spring-boot-logging-log4j2/src/main/resources/application.properties new file mode 100644 index 0000000000..e69de29bb2 diff --git a/spring-boot/src/main/resources/log4j.xml b/spring-boot-logging-log4j2/src/main/resources/log4j.xml similarity index 100% rename from spring-boot/src/main/resources/log4j.xml rename to spring-boot-logging-log4j2/src/main/resources/log4j.xml diff --git a/spring-boot-logging-log4j2/spring-boot-logging-log4j2-app/src/main/resources/log4j2-spring.xml b/spring-boot-logging-log4j2/src/main/resources/log4j2-spring.xml similarity index 100% rename from spring-boot-logging-log4j2/spring-boot-logging-log4j2-app/src/main/resources/log4j2-spring.xml rename to spring-boot-logging-log4j2/src/main/resources/log4j2-spring.xml diff --git a/spring-boot-logging-log4j2/spring-boot-logging-log4j2-app/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-boot-logging-log4j2/src/test/java/org/baeldung/SpringContextIntegrationTest.java similarity index 100% rename from spring-boot-logging-log4j2/spring-boot-logging-log4j2-app/src/test/java/org/baeldung/SpringContextIntegrationTest.java rename to spring-boot-logging-log4j2/src/test/java/org/baeldung/SpringContextIntegrationTest.java diff --git a/spring-boot-mvc/README.md b/spring-boot-mvc/README.md index b46dbe3bae..bf32e4fc7c 100644 --- a/spring-boot-mvc/README.md +++ b/spring-boot-mvc/README.md @@ -7,4 +7,6 @@ - [Spring Web Annotations](http://www.baeldung.com/spring-mvc-annotations) - [Spring Core Annotations](http://www.baeldung.com/spring-core-annotations) - [Display RSS Feed with Spring MVC](http://www.baeldung.com/spring-mvc-rss-feed) - +- [A Controller, Service and DAO Example with Spring Boot and JSF](https://www.baeldung.com/jsf-spring-boot-controller-service-dao) +- [Cache Eviction in Spring Boot](https://www.baeldung.com/spring-boot-evict-cache) +- [Setting Up Swagger 2 with a Spring REST API](http://www.baeldung.com/swagger-2-documentation-for-spring-rest-api) \ No newline at end of file diff --git a/spring-boot-mvc/pom.xml b/spring-boot-mvc/pom.xml index 65d23ebfc6..b219e53431 100644 --- a/spring-boot-mvc/pom.xml +++ b/spring-boot-mvc/pom.xml @@ -8,13 +8,14 @@ Module For Spring Boot MVC - parent-boot-2 - com.baeldung - 0.0.1-SNAPSHOT - ../parent-boot-2 - + parent-boot-2 + com.baeldung + 0.0.1-SNAPSHOT + ../parent-boot-2 + + org.springframework.boot spring-boot-starter-web @@ -23,30 +24,54 @@ org.apache.tomcat.embed tomcat-embed-jasper - + + org.glassfish javax.faces 2.3.7 + org.springframework.boot spring-boot-starter-test test - - - org.springframework.boot - spring-boot-starter-validation - - - + + com.rometools rome ${rome.version} + + + + org.hibernate.validator + hibernate-validator + + + javax.validation + validation-api + + + org.springframework.boot + spring-boot-starter-validation + + + + + io.springfox + springfox-swagger2 + ${spring.fox.version} + + + io.springfox + springfox-swagger-ui + ${spring.fox.version} + + @@ -55,17 +80,18 @@ org.springframework.boot spring-boot-maven-plugin - com.baeldung.springbootmvc.SpringBootMvcApplication - JAR - + com.baeldung.springbootmvc.SpringBootMvcApplication + JAR +
- - - 1.10.0 - com.baeldung.springbootmvc.SpringBootMvcApplication - + + 2.9.2 + + 1.10.0 + com.baeldung.springbootmvc.SpringBootMvcApplication +
diff --git a/spring-boot-mvc/src/main/java/com/baeldung/annotations/VehicleFactoryApplication.java b/spring-boot-mvc/src/main/java/com/baeldung/annotations/VehicleFactoryApplication.java index ab90d8cef2..9ace79c085 100644 --- a/spring-boot-mvc/src/main/java/com/baeldung/annotations/VehicleFactoryApplication.java +++ b/spring-boot-mvc/src/main/java/com/baeldung/annotations/VehicleFactoryApplication.java @@ -3,11 +3,11 @@ package com.baeldung.annotations; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; -// @SpringBootApplication + @SpringBootApplication public class VehicleFactoryApplication { -// public static void main(String[] args) { -// SpringApplication.run(VehicleFactoryApplication.class, args); -// } + public static void main(String[] args) { + SpringApplication.run(VehicleFactoryApplication.class, args); + } } diff --git a/spring-boot-mvc/src/main/java/com/baeldung/swaggerboot/Application.java b/spring-boot-mvc/src/main/java/com/baeldung/swaggerboot/Application.java new file mode 100644 index 0000000000..14e46b2306 --- /dev/null +++ b/spring-boot-mvc/src/main/java/com/baeldung/swaggerboot/Application.java @@ -0,0 +1,13 @@ +package com.baeldung.swaggerboot; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication +public class Application { + + public static void main(String[] args) { + SpringApplication.run(Application.class, args); + } + +} \ No newline at end of file diff --git a/spring-boot-mvc/src/main/java/com/baeldung/swaggerboot/configuration/SpringFoxConfig.java b/spring-boot-mvc/src/main/java/com/baeldung/swaggerboot/configuration/SpringFoxConfig.java new file mode 100644 index 0000000000..3041dfdcc8 --- /dev/null +++ b/spring-boot-mvc/src/main/java/com/baeldung/swaggerboot/configuration/SpringFoxConfig.java @@ -0,0 +1,68 @@ +package com.baeldung.swaggerboot.configuration; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.ComponentScan; +import org.springframework.context.annotation.Configuration; +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.web.plugins.Docket; +import springfox.documentation.swagger.web.*; +import springfox.documentation.swagger2.annotations.EnableSwagger2; + +import java.util.Collections; + +@Configuration +@EnableSwagger2 +@ComponentScan("com.baeldung.swaggerboot.controller") +public class SpringFoxConfig { + + private ApiInfo apiInfo() { + return new ApiInfo( + "My REST API", + "Some custom description of API.", + "API TOS", + "Terms of service", + new Contact("John Doe", "www.example.com", "myeaddress@company.com"), + "License of API", + "API license URL", + Collections.emptyList()); + } + + @Bean + public Docket api() { + return new Docket(DocumentationType.SWAGGER_2) + .apiInfo(apiInfo()) + .select() + .apis(RequestHandlerSelectors.any()) + .paths(PathSelectors.any()) + .build(); + } + + /** + * SwaggerUI information + */ + + @Bean + UiConfiguration uiConfig() { + return UiConfigurationBuilder.builder() + .deepLinking(true) + .displayOperationId(false) + .defaultModelsExpandDepth(1) + .defaultModelExpandDepth(1) + .defaultModelRendering(ModelRendering.EXAMPLE) + .displayRequestDuration(false) + .docExpansion(DocExpansion.NONE) + .filter(false) + .maxDisplayedTags(null) + .operationsSorter(OperationsSorter.ALPHA) + .showExtensions(false) + .tagsSorter(TagsSorter.ALPHA) + .supportedSubmitMethods(UiConfiguration.Constants.DEFAULT_SUBMIT_METHODS) + .validatorUrl(null) + .build(); + } + +} diff --git a/spring-boot-mvc/src/main/java/com/baeldung/swaggerboot/controller/RegularRestController.java b/spring-boot-mvc/src/main/java/com/baeldung/swaggerboot/controller/RegularRestController.java new file mode 100644 index 0000000000..676937f7d7 --- /dev/null +++ b/spring-boot-mvc/src/main/java/com/baeldung/swaggerboot/controller/RegularRestController.java @@ -0,0 +1,14 @@ +package com.baeldung.swaggerboot.controller; + +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RestController; + +@RestController +public class RegularRestController { + + @GetMapping("home") + public String getSession() { + return "Hello"; + } + +} \ No newline at end of file diff --git a/spring-boot-mvc/src/main/resources/application.properties b/spring-boot-mvc/src/main/resources/application.properties index e69de29bb2..709574239b 100644 --- a/spring-boot-mvc/src/main/resources/application.properties +++ b/spring-boot-mvc/src/main/resources/application.properties @@ -0,0 +1 @@ +spring.main.allow-bean-definition-overriding=true \ No newline at end of file diff --git a/spring-boot-ops/pom.xml b/spring-boot-ops/pom.xml index 57779c3f8e..9717a352d3 100644 --- a/spring-boot-ops/pom.xml +++ b/spring-boot-ops/pom.xml @@ -86,6 +86,12 @@ ${jquery.version} + + org.springframework.cloud + spring-cloud-context + ${springcloud.version} + +
@@ -153,6 +159,7 @@ 2.2 18.0 3.1.7 + 2.0.2.RELEASE diff --git a/spring-boot-ops/pom.xml~ b/spring-boot-ops/pom.xml~ new file mode 100644 index 0000000000..2c3b650c30 --- /dev/null +++ b/spring-boot-ops/pom.xml~ @@ -0,0 +1,164 @@ + + + 4.0.0 + + spring-boot-ops + war + spring-boot-ops + Demo project for Spring Boot + + + parent-boot-2 + com.baeldung + 0.0.1-SNAPSHOT + ../parent-boot-2 + + + + + + org.springframework.boot + spring-boot-starter-web + + + + org.springframework.boot + spring-boot-starter-thymeleaf + provided + + + + org.springframework.boot + spring-boot-starter-test + test + + + + org.springframework.boot + spring-boot-starter-data-jpa + + + + org.springframework.boot + spring-boot-starter-mail + + + + org.springframework.boot + spring-boot-starter-actuator + + + + com.h2database + h2 + runtime + + + + javax.persistence + javax.persistence-api + ${jpa.version} + + + + com.google.guava + guava + ${guava.version} + + + + org.subethamail + subethasmtp + ${subethasmtp.version} + test + + + + org.webjars + bootstrap + ${bootstrap.version} + + + + org.webjars + jquery + ${jquery.version} + + + + org.springframework.cloud + spring-cloud-context + ${springcloud.version} + + + + + + ${project.artifactId} + + + org.springframework.boot + spring-boot-maven-plugin + + + + repackage + + + com.baeldung.webjar.WebjarsdemoApplication + + + + + + + + + + autoconfiguration + + + + org.apache.maven.plugins + maven-surefire-plugin + + + integration-test + + test + + + + **/*LiveTest.java + **/*IntegrationTest.java + **/*IntTest.java + + + **/AutoconfigurationTest.java + + + + + + + json + + + + + + + + + + + org.baeldung.boot.Application + 3.1.1 + 3.3.7-1 + 2.2 + 18.0 + 3.1.7 + + + diff --git a/spring-boot-ops/src/main/java/com/baeldung/restart/Application.java b/spring-boot-ops/src/main/java/com/baeldung/restart/Application.java new file mode 100644 index 0000000000..a6605a0baa --- /dev/null +++ b/spring-boot-ops/src/main/java/com/baeldung/restart/Application.java @@ -0,0 +1,30 @@ +package com.baeldung.restart; + +import org.springframework.boot.ApplicationArguments; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.boot.web.servlet.support.SpringBootServletInitializer; +import org.springframework.context.ConfigurableApplicationContext; + +@SpringBootApplication +public class Application extends SpringBootServletInitializer { + + private static ConfigurableApplicationContext context; + + public static void main(String[] args) { + context = SpringApplication.run(Application.class, args); + } + + public static void restart() { + ApplicationArguments args = context.getBean(ApplicationArguments.class); + + Thread thread = new Thread(() -> { + context.close(); + context = SpringApplication.run(Application.class, args.getSourceArgs()); + }); + + thread.setDaemon(false); + thread.start(); + } + +} \ No newline at end of file diff --git a/spring-boot-ops/src/main/java/com/baeldung/restart/RestartController.java b/spring-boot-ops/src/main/java/com/baeldung/restart/RestartController.java new file mode 100644 index 0000000000..68a8dc7073 --- /dev/null +++ b/spring-boot-ops/src/main/java/com/baeldung/restart/RestartController.java @@ -0,0 +1,23 @@ +package com.baeldung.restart; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RestController; + +@RestController +public class RestartController { + + @Autowired + private RestartService restartService; + + @PostMapping("/restart") + public void restart() { + Application.restart(); + } + + @PostMapping("/restartApp") + public void restartUsingActuator() { + restartService.restartApp(); + } + +} diff --git a/spring-boot-ops/src/main/java/com/baeldung/restart/RestartService.java b/spring-boot-ops/src/main/java/com/baeldung/restart/RestartService.java new file mode 100644 index 0000000000..9883ec653b --- /dev/null +++ b/spring-boot-ops/src/main/java/com/baeldung/restart/RestartService.java @@ -0,0 +1,17 @@ +package com.baeldung.restart; + +import org.springframework.stereotype.Service; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.cloud.context.restart.RestartEndpoint; + +@Service +public class RestartService { + + @Autowired + private RestartEndpoint restartEndpoint; + + public void restartApp() { + restartEndpoint.restart(); + } + +} \ No newline at end of file diff --git a/spring-boot-ops/src/main/java/org/baeldung/boot/config/WebConfig.java b/spring-boot-ops/src/main/java/org/baeldung/boot/config/WebConfig.java index 6d8708b06a..6373553837 100644 --- a/spring-boot-ops/src/main/java/org/baeldung/boot/config/WebConfig.java +++ b/spring-boot-ops/src/main/java/org/baeldung/boot/config/WebConfig.java @@ -1,16 +1,17 @@ package org.baeldung.boot.config; +import java.util.List; + import org.baeldung.boot.converter.GenericBigDecimalConverter; +import org.baeldung.boot.converter.StringToAbstractEntityConverterFactory; import org.baeldung.boot.converter.StringToEmployeeConverter; -import org.baeldung.boot.converter.StringToEnumConverterFactory; +import org.baeldung.boot.converter.StringToEnumConverter; import org.baeldung.boot.web.resolver.HeaderVersionArgumentResolver; import org.springframework.context.annotation.Configuration; import org.springframework.format.FormatterRegistry; import org.springframework.web.method.support.HandlerMethodArgumentResolver; import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; -import java.util.List; - @Configuration public class WebConfig implements WebMvcConfigurer { @@ -22,7 +23,8 @@ public class WebConfig implements WebMvcConfigurer { @Override public void addFormatters(FormatterRegistry registry) { registry.addConverter(new StringToEmployeeConverter()); - registry.addConverterFactory(new StringToEnumConverterFactory()); + registry.addConverter(new StringToEnumConverter()); + registry.addConverterFactory(new StringToAbstractEntityConverterFactory()); registry.addConverter(new GenericBigDecimalConverter()); } } diff --git a/spring-boot-ops/src/main/java/org/baeldung/boot/converter/StringToAbstractEntityConverterFactory.java b/spring-boot-ops/src/main/java/org/baeldung/boot/converter/StringToAbstractEntityConverterFactory.java new file mode 100644 index 0000000000..9e7fd8f858 --- /dev/null +++ b/spring-boot-ops/src/main/java/org/baeldung/boot/converter/StringToAbstractEntityConverterFactory.java @@ -0,0 +1,39 @@ +package org.baeldung.boot.converter; + +import org.baeldung.boot.domain.AbstractEntity; +import org.baeldung.boot.domain.Bar; +import org.baeldung.boot.domain.Foo; +import org.springframework.core.convert.converter.Converter; +import org.springframework.core.convert.converter.ConverterFactory; + +public class StringToAbstractEntityConverterFactory implements ConverterFactory{ + + @Override + public Converter getConverter(Class targetClass) { + + return new StringToAbstractEntityConverter<>(targetClass); + } + + + private static class StringToAbstractEntityConverter implements Converter { + + private Class targetClass; + + public StringToAbstractEntityConverter(Class targetClass) { + this.targetClass = targetClass; + } + + @Override + public T convert(String source) { + long id = Long.parseLong(source); + if(this.targetClass == Foo.class) { + return (T) new Foo(id); + } + else if(this.targetClass == Bar.class) { + return (T) new Bar(id); + } else { + return null; + } + } + } +} diff --git a/spring-boot-ops/src/main/java/org/baeldung/boot/converter/StringToEnumConverter.java b/spring-boot-ops/src/main/java/org/baeldung/boot/converter/StringToEnumConverter.java new file mode 100644 index 0000000000..498b44abec --- /dev/null +++ b/spring-boot-ops/src/main/java/org/baeldung/boot/converter/StringToEnumConverter.java @@ -0,0 +1,12 @@ +package org.baeldung.boot.converter; + +import org.baeldung.boot.domain.Modes; +import org.springframework.core.convert.converter.Converter; + +public class StringToEnumConverter implements Converter { + + @Override + public Modes convert(String from) { + return Modes.valueOf(from); + } +} \ No newline at end of file diff --git a/spring-boot-ops/src/main/java/org/baeldung/boot/converter/StringToEnumConverterFactory.java b/spring-boot-ops/src/main/java/org/baeldung/boot/converter/StringToEnumConverterFactory.java deleted file mode 100644 index 6fa51bfdcc..0000000000 --- a/spring-boot-ops/src/main/java/org/baeldung/boot/converter/StringToEnumConverterFactory.java +++ /dev/null @@ -1,27 +0,0 @@ -package org.baeldung.boot.converter; - -import org.springframework.core.convert.converter.Converter; -import org.springframework.core.convert.converter.ConverterFactory; -import org.springframework.stereotype.Component; - -@Component -public class StringToEnumConverterFactory implements ConverterFactory { - - private static class StringToEnumConverter implements Converter { - - private Class enumType; - - public StringToEnumConverter(Class enumType) { - this.enumType = enumType; - } - - public T convert(String source) { - return (T) Enum.valueOf(this.enumType, source.trim()); - } - } - - @Override - public Converter getConverter(final Class targetType) { - return new StringToEnumConverter(targetType); - } -} diff --git a/spring-boot-ops/src/main/java/org/baeldung/boot/converter/controller/AbstractEntityController.java b/spring-boot-ops/src/main/java/org/baeldung/boot/converter/controller/AbstractEntityController.java new file mode 100644 index 0000000000..d3c012ba31 --- /dev/null +++ b/spring-boot-ops/src/main/java/org/baeldung/boot/converter/controller/AbstractEntityController.java @@ -0,0 +1,31 @@ +package org.baeldung.boot.converter.controller; + +import org.baeldung.boot.domain.Bar; +import org.baeldung.boot.domain.Foo; +import org.baeldung.boot.domain.Modes; +import org.springframework.http.ResponseEntity; +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.RequestParam; +import org.springframework.web.bind.annotation.RestController; + +@RestController +@RequestMapping("/string-to-abstract") +public class AbstractEntityController { + + @GetMapping("/foo/{foo}") + public ResponseEntity getStringToFoo(@PathVariable Foo foo) { + return ResponseEntity.ok(foo); + } + + @GetMapping("/bar/{bar}") + public ResponseEntity getStringToBar(@PathVariable Bar bar) { + return ResponseEntity.ok(bar); + } + + @GetMapping + public ResponseEntity getStringToMode(@RequestParam("mode") Modes mode) { + return ResponseEntity.ok(mode); + } +} diff --git a/spring-boot-ops/src/main/java/org/baeldung/boot/domain/AbstractEntity.java b/spring-boot-ops/src/main/java/org/baeldung/boot/domain/AbstractEntity.java new file mode 100644 index 0000000000..30e0d1e5fe --- /dev/null +++ b/spring-boot-ops/src/main/java/org/baeldung/boot/domain/AbstractEntity.java @@ -0,0 +1,10 @@ +package org.baeldung.boot.domain; + +public abstract class AbstractEntity { + + long id; + public AbstractEntity(long id){ + this.id = id; + } + +} diff --git a/spring-boot-ops/src/main/java/org/baeldung/boot/domain/Bar.java b/spring-boot-ops/src/main/java/org/baeldung/boot/domain/Bar.java new file mode 100644 index 0000000000..724f5e4bca --- /dev/null +++ b/spring-boot-ops/src/main/java/org/baeldung/boot/domain/Bar.java @@ -0,0 +1,29 @@ +package org.baeldung.boot.domain; + +public class Bar extends AbstractEntity { + + private int value; + + public Bar(long id) { + super(id); + } + + public Bar(long id, int value) { + super(id); + this.value = value; + } + + public int getValue() { + return value; + } + + public void setValue(int value) { + this.value = value; + } + + @Override + public String toString() { + return "Bar [value=" + value + ", id=" + id + "]"; + } + +} diff --git a/spring-boot-ops/src/main/java/org/baeldung/boot/domain/Foo.java b/spring-boot-ops/src/main/java/org/baeldung/boot/domain/Foo.java new file mode 100644 index 0000000000..a2ff354e59 --- /dev/null +++ b/spring-boot-ops/src/main/java/org/baeldung/boot/domain/Foo.java @@ -0,0 +1,31 @@ +package org.baeldung.boot.domain; + +import static org.apache.commons.lang3.RandomStringUtils.randomAlphanumeric; +public class Foo extends AbstractEntity { + + private String name; + + public Foo(long id) { + super(id); + name = randomAlphanumeric(4); + } + + public Foo(long id, String name) { + super(id); + this.name = name; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + @Override + public String toString() { + return "Foo [name=" + name + ", id=" + id + "]"; + } + +} diff --git a/spring-boot-ops/src/main/resources/application.properties b/spring-boot-ops/src/main/resources/application.properties index a86bd3052e..644a3edabc 100644 --- a/spring-boot-ops/src/main/resources/application.properties +++ b/spring-boot-ops/src/main/resources/application.properties @@ -1,3 +1,4 @@ management.endpoints.web.exposure.include=* management.metrics.enable.root=true -management.metrics.enable.jvm=true \ No newline at end of file +management.metrics.enable.jvm=true +management.endpoint.restart.enabled=true \ No newline at end of file diff --git a/spring-boot-ops/src/test/java/com/baeldung/restart/RestartApplicationIntegrationTest.java b/spring-boot-ops/src/test/java/com/baeldung/restart/RestartApplicationIntegrationTest.java new file mode 100644 index 0000000000..1bec3c6a90 --- /dev/null +++ b/spring-boot-ops/src/test/java/com/baeldung/restart/RestartApplicationIntegrationTest.java @@ -0,0 +1,34 @@ +package com.baeldung.restart; + +import static org.junit.Assert.assertEquals; + +import org.junit.Test; +import org.springframework.boot.test.web.client.TestRestTemplate; +import org.springframework.http.HttpMethod; +import org.springframework.http.ResponseEntity; + +public class RestartApplicationIntegrationTest { + + private TestRestTemplate template = new TestRestTemplate(); + + @Test + public void givenBootApp_whenRestart_thenOk() throws Exception { + Application.main(new String[0]); + + ResponseEntity response = template.exchange("http://localhost:8080/restart", + HttpMethod.POST, null, Object.class); + + assertEquals(200, response.getStatusCode().value()); + } + + @Test + public void givenBootApp_whenRestartUsingActuator_thenOk() throws Exception { + Application.main(new String[] { "--server.port=8090" }); + + ResponseEntity response = template.exchange("http://localhost:8090/restartApp", + HttpMethod.POST, null, Object.class); + + assertEquals(200, response.getStatusCode().value()); + } + +} diff --git a/spring-boot-ops/src/test/resources/application.properties b/spring-boot-ops/src/test/resources/application.properties index 2095a82a14..0adf2998d7 100644 --- a/spring-boot-ops/src/test/resources/application.properties +++ b/spring-boot-ops/src/test/resources/application.properties @@ -4,4 +4,6 @@ spring.mail.properties.mail.smtp.auth=false management.endpoints.web.exposure.include=* management.endpoint.shutdown.enabled=true -endpoints.shutdown.enabled=true \ No newline at end of file +endpoints.shutdown.enabled=true + +management.endpoint.restart.enabled=true \ No newline at end of file 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 ab22c5ad30..9988924408 100644 --- a/spring-boot-property-exp/property-exp-custom-config/pom.xml +++ b/spring-boot-property-exp/property-exp-custom-config/pom.xml @@ -1,11 +1,10 @@ 4.0.0 - property-exp-custom - com.baeldung property-exp-custom-config 0.0.1-SNAPSHOT + property-exp-custom-config jar 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 4ede36e61a..7892288f45 100644 --- a/spring-boot-property-exp/property-exp-default-config/pom.xml +++ b/spring-boot-property-exp/property-exp-default-config/pom.xml @@ -1,11 +1,10 @@ 4.0.0 - property-exp-default - com.baeldung property-exp-default-config 0.0.1-SNAPSHOT + property-exp-default-config jar diff --git a/spring-boot-security/pom.xml b/spring-boot-security/pom.xml index 6bc013d1ed..d5c7976ba2 100644 --- a/spring-boot-security/pom.xml +++ b/spring-boot-security/pom.xml @@ -3,29 +3,17 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 spring-boot-security - 0.0.1-SNAPSHOT jar spring-boot-security Spring Boot Security Auto-Configuration + parent-boot-1 com.baeldung - parent-modules - 1.0.0-SNAPSHOT + 0.0.1-SNAPSHOT + ../parent-boot-1 - - - - org.springframework.boot - spring-boot-dependencies - ${spring-boot.version} - pom - import - - - - org.springframework.boot @@ -39,7 +27,7 @@ org.springframework.boot spring-boot-starter-web - + org.springframework.security @@ -74,14 +62,8 @@ org.springframework.boot spring-boot-maven-plugin - ${spring-boot-maven-plugin.version} - - 1.5.9.RELEASE - 2.0.4.RELEASE - - diff --git a/spring-boot-vue/src/test/java/com/baeldung/springbootmvc/SpringBootMvcApplicationUnitTest.java b/spring-boot-vue/src/test/java/com/baeldung/springbootmvc/SpringBootMvcApplicationIntegrationTest.java similarity index 95% rename from spring-boot-vue/src/test/java/com/baeldung/springbootmvc/SpringBootMvcApplicationUnitTest.java rename to spring-boot-vue/src/test/java/com/baeldung/springbootmvc/SpringBootMvcApplicationIntegrationTest.java index 567b239ed2..7d8accf813 100644 --- a/spring-boot-vue/src/test/java/com/baeldung/springbootmvc/SpringBootMvcApplicationUnitTest.java +++ b/spring-boot-vue/src/test/java/com/baeldung/springbootmvc/SpringBootMvcApplicationIntegrationTest.java @@ -16,7 +16,7 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers. @RunWith(SpringRunner.class) @SpringBootTest @AutoConfigureMockMvc -public class SpringBootMvcApplicationUnitTest { +public class SpringBootMvcApplicationIntegrationTest { @Autowired private MockMvc mockMvc; diff --git a/spring-boot/.attach_pid12812 b/spring-boot/.attach_pid12812 new file mode 100644 index 0000000000..e69de29bb2 diff --git a/spring-boot/README.MD b/spring-boot/README.MD index 192c4f9fed..016d2841d7 100644 --- a/spring-boot/README.MD +++ b/spring-boot/README.MD @@ -34,3 +34,5 @@ The "REST With Spring" Classes: http://bit.ly/restwithspring - [Introduction to Chaos Monkey](https://www.baeldung.com/spring-boot-chaos-monkey) - [Spring Component Scanning](https://www.baeldung.com/spring-component-scanning) - [Load Spring Boot Properties From a JSON File](https://www.baeldung.com/spring-boot-json-properties) +- [Display Auto-Configuration Report in Spring Boot](https://www.baeldung.com/spring-boot-auto-configuration-report) +- [Injecting Git Information Into Spring](https://www.baeldung.com/spring-git-information) diff --git a/spring-boot/pom.xml b/spring-boot/pom.xml index 0ea6b6156f..87c782b044 100644 --- a/spring-boot/pom.xml +++ b/spring-boot/pom.xml @@ -1,9 +1,8 @@ - 4.0.0 - com.baeldung spring-boot - 0.0.1-SNAPSHOT war spring-boot This is simple boot application for Spring boot actuator test @@ -57,6 +56,14 @@ org.springframework.boot spring-boot-starter-data-jpa + + org.ehcache + ehcache + + + org.hibernate + hibernate-ehcache + org.springframework.boot spring-boot-starter-actuator @@ -72,6 +79,11 @@ graphql-java-tools ${graphql-java-tools.version} + + com.graphql-java + graphiql-spring-boot-starter + ${graphiql-spring-boot-starter.version} + org.springframework.boot @@ -146,18 +158,9 @@ ${chaos.monkey.version} - - - org.springframework.boot - spring-boot-starter-log4j - 1.3.8.RELEASE - - - org.graylog2 - gelfj - 1.1.16 - compile + javax.validation + validation-api @@ -181,6 +184,26 @@ pl.project13.maven git-commit-id-plugin ${git-commit-id-plugin.version} + + + get-the-git-infos + + revision + + initialize + + + validate-the-git-infos + + validateRevision + + package + + + + true + ${project.build.outputDirectory}/git.properties + @@ -226,16 +249,16 @@ - org.baeldung.demo.DemoApplication + com.baeldung.intro.App 8.5.11 2.4.1.Final 1.9.0 2.0.0 - 3.6.0 - 3.2.0 + 5.0.2 + 5.0.2 + 5.2.4 18.0 - 1.2.0 - 2.2.4 + 2.2.4 diff --git a/spring-boot/src/main/java/com/baeldung/dynamicvalidation/ContactInfoValidator.java b/spring-boot/src/main/java/com/baeldung/dynamicvalidation/ContactInfoValidator.java index e079b9a665..cc05fd4fbd 100644 --- a/spring-boot/src/main/java/com/baeldung/dynamicvalidation/ContactInfoValidator.java +++ b/spring-boot/src/main/java/com/baeldung/dynamicvalidation/ContactInfoValidator.java @@ -30,7 +30,7 @@ public class ContactInfoValidator implements ConstraintValidator { - Optional findOne(String id); + Optional findById(String id); } diff --git a/spring-boot/src/main/java/com/baeldung/failureanalyzer/FailureAnalyzerApplication.java b/spring-boot/src/main/java/com/baeldung/failureanalyzer/FailureAnalyzerApplication.java index 3489732b6f..7bd5c36786 100644 --- a/spring-boot/src/main/java/com/baeldung/failureanalyzer/FailureAnalyzerApplication.java +++ b/spring-boot/src/main/java/com/baeldung/failureanalyzer/FailureAnalyzerApplication.java @@ -9,7 +9,6 @@ import org.springframework.boot.autoconfigure.SpringBootApplication; public class FailureAnalyzerApplication { @RolesAllowed("*") public static void main(String[] args) { - System.setProperty("security.basic.enabled", "false"); SpringApplication.run(FailureAnalyzerApplication.class, args); } } diff --git a/spring-boot/src/main/java/com/baeldung/internationalization/InternationalizationApp.java b/spring-boot/src/main/java/com/baeldung/internationalization/InternationalizationApp.java index c92d1c32e6..c3af611f3b 100644 --- a/spring-boot/src/main/java/com/baeldung/internationalization/InternationalizationApp.java +++ b/spring-boot/src/main/java/com/baeldung/internationalization/InternationalizationApp.java @@ -9,7 +9,6 @@ import org.springframework.boot.autoconfigure.SpringBootApplication; public class InternationalizationApp { @RolesAllowed("*") public static void main(String[] args) { - System.setProperty("security.basic.enabled", "false"); SpringApplication.run(InternationalizationApp.class, args); } } diff --git a/spring-boot/src/main/java/com/baeldung/rss/RssApp.java b/spring-boot/src/main/java/com/baeldung/rss/RssApp.java index d3d3d0241f..e067d3cfd1 100644 --- a/spring-boot/src/main/java/com/baeldung/rss/RssApp.java +++ b/spring-boot/src/main/java/com/baeldung/rss/RssApp.java @@ -1,18 +1,17 @@ package com.baeldung.rss; +import javax.annotation.security.RolesAllowed; + import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.context.annotation.ComponentScan; -import javax.annotation.security.RolesAllowed; - @SpringBootApplication @ComponentScan(basePackages = "com.baeldung.rss") public class RssApp { @RolesAllowed("*") public static void main(String[] args) { - System.setProperty("security.basic.enabled", "false"); SpringApplication.run(RssApp.class, args); } diff --git a/spring-boot/src/main/java/com/baeldung/toggle/ToggleApplication.java b/spring-boot/src/main/java/com/baeldung/toggle/ToggleApplication.java index 27be6b7cca..fa84cf0d9b 100644 --- a/spring-boot/src/main/java/com/baeldung/toggle/ToggleApplication.java +++ b/spring-boot/src/main/java/com/baeldung/toggle/ToggleApplication.java @@ -9,7 +9,6 @@ import org.springframework.boot.autoconfigure.SpringBootApplication; public class ToggleApplication { @RolesAllowed("*") public static void main(String[] args) { - System.setProperty("security.basic.enabled", "false"); SpringApplication.run(ToggleApplication.class, args); } } diff --git a/spring-boot/src/main/java/org/baeldung/session/exception/Application.java b/spring-boot/src/main/java/org/baeldung/session/exception/Application.java index 9132e710d1..354c64c258 100644 --- a/spring-boot/src/main/java/org/baeldung/session/exception/Application.java +++ b/spring-boot/src/main/java/org/baeldung/session/exception/Application.java @@ -4,8 +4,6 @@ import org.baeldung.demo.model.Foo; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.domain.EntityScan; -import org.springframework.context.annotation.Bean; -import org.springframework.orm.jpa.vendor.HibernateJpaSessionFactoryBean; @EntityScan(basePackageClasses = Foo.class) @SpringBootApplication @@ -15,9 +13,4 @@ public class Application { System.setProperty("spring.profiles.active", "exception"); SpringApplication.run(Application.class, args); } - - @Bean - public HibernateJpaSessionFactoryBean sessionFactory() { - return new HibernateJpaSessionFactoryBean(); - } } diff --git a/spring-boot/src/main/java/org/baeldung/session/exception/repository/FooRepositoryImpl.java b/spring-boot/src/main/java/org/baeldung/session/exception/repository/FooRepositoryImpl.java index 52407a2117..607bae83ba 100644 --- a/spring-boot/src/main/java/org/baeldung/session/exception/repository/FooRepositoryImpl.java +++ b/spring-boot/src/main/java/org/baeldung/session/exception/repository/FooRepositoryImpl.java @@ -1,5 +1,7 @@ package org.baeldung.session.exception.repository; +import javax.persistence.EntityManagerFactory; + import org.baeldung.demo.model.Foo; import org.hibernate.SessionFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -10,16 +12,15 @@ import org.springframework.stereotype.Repository; @Repository public class FooRepositoryImpl implements FooRepository { @Autowired - private SessionFactory sessionFactory; + private EntityManagerFactory emf; @Override public void save(Foo foo) { - sessionFactory.getCurrentSession().saveOrUpdate(foo); + emf.unwrap(SessionFactory.class).getCurrentSession().saveOrUpdate(foo); } @Override public Foo get(Integer id) { - return sessionFactory.getCurrentSession().get(Foo.class, id); + return emf.unwrap(SessionFactory.class).getCurrentSession().get(Foo.class, id); } - } \ No newline at end of file diff --git a/spring-boot/src/main/resources/META-INF/spring.factories b/spring-boot/src/main/resources/META-INF/spring.factories new file mode 100644 index 0000000000..e3d3aa4c8e --- /dev/null +++ b/spring-boot/src/main/resources/META-INF/spring.factories @@ -0,0 +1 @@ +org.springframework.boot.diagnostics.FailureAnalyzer=com.baeldung.failureanalyzer.MyBeanNotOfRequiredTypeFailureAnalyzer \ No newline at end of file diff --git a/spring-boot/src/main/resources/application.properties b/spring-boot/src/main/resources/application.properties index 629e880940..6a52dd1f70 100644 --- a/spring-boot/src/main/resources/application.properties +++ b/spring-boot/src/main/resources/application.properties @@ -7,7 +7,7 @@ spring.jpa.show-sql=true spring.jpa.hibernate.ddl-auto = update management.endpoints.jmx.domain=Spring Sample Application -management.endpoints.jmx.uniqueNames=true +spring.jmx.unique-names=true management.endpoints.web.exposure.include=* management.endpoint.shutdown.enabled=true @@ -17,7 +17,6 @@ management.endpoint.shutdown.enabled=true ##endpoints.jolokia.path=jolokia spring.jmx.enabled=true -management.endpoints.jmx.enabled=true ## for pretty printing of json when endpoints accessed over HTTP http.mappers.jsonPrettyPrint=true diff --git a/spring-boot/src/main/resources/demo.properties b/spring-boot/src/main/resources/demo.properties index 649b64f59b..6b4cbeb7a0 100644 --- a/spring-boot/src/main/resources/demo.properties +++ b/spring-boot/src/main/resources/demo.properties @@ -1,6 +1,2 @@ spring.output.ansi.enabled=never server.port=7070 - -# Security -security.user.name=admin -security.user.password=password \ No newline at end of file diff --git a/spring-boot/src/main/resources/templates/customer.html b/spring-boot/src/main/resources/templates/customer.html new file mode 100644 index 0000000000..c8f5a25d5e --- /dev/null +++ b/spring-boot/src/main/resources/templates/customer.html @@ -0,0 +1,16 @@ + + + +Customer Page + + + +
+
+Contact Info:
+ +
+

+
+ + \ No newline at end of file diff --git a/spring-boot/src/main/resources/templates/customers.html b/spring-boot/src/main/resources/templates/customers.html new file mode 100644 index 0000000000..5a060d31da --- /dev/null +++ b/spring-boot/src/main/resources/templates/customers.html @@ -0,0 +1,33 @@ + + + + + +
+

+ Hello, --name--. +

+ + + + + + + + + + + + + + + + + +
IDNameAddressService Rendered
Text ...Text ...Text ...Text...
+ +
+ + + diff --git a/spring-boot/src/main/resources/templates/displayallbeans.html b/spring-boot/src/main/resources/templates/displayallbeans.html new file mode 100644 index 0000000000..5fc78a7fca --- /dev/null +++ b/spring-boot/src/main/resources/templates/displayallbeans.html @@ -0,0 +1,10 @@ + + + + Baeldung + + +

+

+ + diff --git a/spring-boot/src/main/resources/templates/error-404.html b/spring-boot/src/main/resources/templates/error-404.html new file mode 100644 index 0000000000..cf68032596 --- /dev/null +++ b/spring-boot/src/main/resources/templates/error-404.html @@ -0,0 +1,14 @@ + + + + + + + +
+
+

Sorry, we couldn't find the page you were looking for.

+

Go Home

+
+ + \ No newline at end of file diff --git a/spring-boot/src/main/resources/templates/error-500.html b/spring-boot/src/main/resources/templates/error-500.html new file mode 100644 index 0000000000..5ddf458229 --- /dev/null +++ b/spring-boot/src/main/resources/templates/error-500.html @@ -0,0 +1,16 @@ + + + + + + + +
+
+

Sorry, something went wrong!

+ +

We're fixing it.

+

Go Home

+
+ + \ No newline at end of file diff --git a/spring-boot/src/main/resources/templates/error.html b/spring-boot/src/main/resources/templates/error.html new file mode 100644 index 0000000000..bc517913b2 --- /dev/null +++ b/spring-boot/src/main/resources/templates/error.html @@ -0,0 +1,16 @@ + + + + + + + +
+
+

Something went wrong!

+ +

Our Engineers are on it.

+

Go Home

+
+ + diff --git a/spring-custom-aop/src/main/resources/public/error/404.html b/spring-boot/src/main/resources/templates/error/404.html similarity index 100% rename from spring-custom-aop/src/main/resources/public/error/404.html rename to spring-boot/src/main/resources/templates/error/404.html diff --git a/spring-boot/src/main/resources/templates/external.html b/spring-boot/src/main/resources/templates/external.html new file mode 100644 index 0000000000..2f9cc76961 --- /dev/null +++ b/spring-boot/src/main/resources/templates/external.html @@ -0,0 +1,31 @@ + + + + + +
+
+

Customer Portal

+
+
+

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam + erat lectus, vehicula feugiat ultricies at, tempus sed ante. Cras + arcu erat, lobortis vitae quam et, mollis pharetra odio. Nullam sit + amet congue ipsum. Nunc dapibus odio ut ligula venenatis porta non + id dui. Duis nec tempor tellus. Suspendisse id blandit ligula, sit + amet varius mauris. Nulla eu eros pharetra, tristique dui quis, + vehicula libero. Aenean a neque sit amet tellus porttitor rutrum nec + at leo.

+ +

Existing Customers

+
+ Enter the intranet: customers +
+
+ +
+ + + + diff --git a/spring-custom-aop/src/main/resources/templates/index.html b/spring-boot/src/main/resources/templates/index.html similarity index 95% rename from spring-custom-aop/src/main/resources/templates/index.html rename to spring-boot/src/main/resources/templates/index.html index 2c4387ed10..c1314558f6 100644 --- a/spring-custom-aop/src/main/resources/templates/index.html +++ b/spring-boot/src/main/resources/templates/index.html @@ -4,7 +4,7 @@ - +

Welcome Home


× diff --git a/spring-custom-aop/src/main/resources/templates/international.html b/spring-boot/src/main/resources/templates/international.html similarity index 61% rename from spring-custom-aop/src/main/resources/templates/international.html rename to spring-boot/src/main/resources/templates/international.html index a2a5fbb591..e0cfb5143b 100644 --- a/spring-custom-aop/src/main/resources/templates/international.html +++ b/spring-boot/src/main/resources/templates/international.html @@ -4,16 +4,7 @@ Home - +

diff --git a/spring-boot/src/main/resources/templates/layout.html b/spring-boot/src/main/resources/templates/layout.html new file mode 100644 index 0000000000..bab0c2982b --- /dev/null +++ b/spring-boot/src/main/resources/templates/layout.html @@ -0,0 +1,18 @@ + + + +Customer Portal + + + + + \ No newline at end of file diff --git a/spring-custom-aop/src/main/resources/templates/other.html b/spring-boot/src/main/resources/templates/other.html similarity index 100% rename from spring-custom-aop/src/main/resources/templates/other.html rename to spring-boot/src/main/resources/templates/other.html diff --git a/spring-custom-aop/src/main/resources/templates/utils.html b/spring-boot/src/main/resources/templates/utils.html similarity index 100% rename from spring-custom-aop/src/main/resources/templates/utils.html rename to spring-boot/src/main/resources/templates/utils.html diff --git a/spring-boot/src/test/java/com/baeldung/annotation/servletcomponentscan/SpringBootWithServletComponentIntegrationTest.java b/spring-boot/src/test/java/com/baeldung/annotation/servletcomponentscan/SpringBootWithServletComponentIntegrationTest.java index 2c3ac2e159..8c85934fac 100644 --- a/spring-boot/src/test/java/com/baeldung/annotation/servletcomponentscan/SpringBootWithServletComponentIntegrationTest.java +++ b/spring-boot/src/test/java/com/baeldung/annotation/servletcomponentscan/SpringBootWithServletComponentIntegrationTest.java @@ -20,7 +20,6 @@ import static org.junit.Assert.assertTrue; @RunWith(SpringRunner.class) @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = SpringBootAnnotatedApp.class) -@TestPropertySource(properties = { "security.basic.enabled=false" }) public class SpringBootWithServletComponentIntegrationTest { @Autowired diff --git a/spring-boot/src/test/java/com/baeldung/annotation/servletcomponentscan/SpringBootWithoutServletComponentIntegrationTest.java b/spring-boot/src/test/java/com/baeldung/annotation/servletcomponentscan/SpringBootWithoutServletComponentIntegrationTest.java index a30d3ed3f2..c29cd75e9d 100644 --- a/spring-boot/src/test/java/com/baeldung/annotation/servletcomponentscan/SpringBootWithoutServletComponentIntegrationTest.java +++ b/spring-boot/src/test/java/com/baeldung/annotation/servletcomponentscan/SpringBootWithoutServletComponentIntegrationTest.java @@ -19,7 +19,6 @@ import org.springframework.test.context.junit4.SpringRunner; @RunWith(SpringRunner.class) @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = SpringBootPlainApp.class) -@TestPropertySource(properties = { "security.basic.enabled=false" }) public class SpringBootWithoutServletComponentIntegrationTest { @Autowired diff --git a/spring-boot/src/test/java/com/baeldung/displayallbeans/DisplayBeanIntegrationTest.java b/spring-boot/src/test/java/com/baeldung/displayallbeans/DisplayBeanIntegrationTest.java index aab4836b6f..e933920a96 100644 --- a/spring-boot/src/test/java/com/baeldung/displayallbeans/DisplayBeanIntegrationTest.java +++ b/spring-boot/src/test/java/com/baeldung/displayallbeans/DisplayBeanIntegrationTest.java @@ -1,31 +1,34 @@ package com.baeldung.displayallbeans; +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.BDDAssertions.then; + +import java.net.URI; +import java.util.Arrays; +import java.util.Collection; +import java.util.List; +import java.util.Map; + import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; +import org.springframework.boot.actuate.beans.BeansEndpoint.ContextBeans; 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.core.ParameterizedTypeReference; import org.springframework.http.HttpStatus; +import org.springframework.http.MediaType; +import org.springframework.http.RequestEntity; import org.springframework.http.ResponseEntity; import org.springframework.test.context.TestPropertySource; import org.springframework.test.context.junit4.SpringRunner; import org.springframework.web.context.WebApplicationContext; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.stream.Collectors; - -import static org.assertj.core.api.BDDAssertions.then; -import static org.hamcrest.CoreMatchers.hasItem; -import static org.junit.Assert.assertThat; -import static org.junit.Assert.assertTrue; - @RunWith(SpringRunner.class) @SpringBootTest(classes = Application.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) -@TestPropertySource(properties = { "management.port=0", "endpoints.beans.id=springbeans", "endpoints.beans.sensitive=false" }) +@TestPropertySource(properties = { "management.port=0", "management.endpoints.web.exposure.include=*" }) public class DisplayBeanIntegrationTest { @LocalServerPort @@ -40,6 +43,8 @@ public class DisplayBeanIntegrationTest { @Autowired private WebApplicationContext context; + private static final String ACTUATOR_PATH = "/actuator"; + @Test public void givenRestTemplate_whenAccessServerUrl_thenHttpStatusOK() throws Exception { ResponseEntity entity = this.testRestTemplate.getForEntity("http://localhost:" + this.port + "/displayallbeans", String.class); @@ -49,22 +54,27 @@ public class DisplayBeanIntegrationTest { @Test public void givenRestTemplate_whenAccessEndpointUrl_thenHttpStatusOK() throws Exception { - @SuppressWarnings("rawtypes") - ResponseEntity entity = this.testRestTemplate.getForEntity("http://localhost:" + this.mgt + "/springbeans", List.class); + ParameterizedTypeReference> responseType = new ParameterizedTypeReference>() { + }; + RequestEntity requestEntity = RequestEntity.get(new URI("http://localhost:" + this.mgt + ACTUATOR_PATH + "/beans")) + .accept(MediaType.APPLICATION_JSON) + .build(); + ResponseEntity> entity = this.testRestTemplate.exchange(requestEntity, responseType); then(entity.getStatusCode()).isEqualTo(HttpStatus.OK); } @Test public void givenRestTemplate_whenAccessEndpointUrl_thenReturnsBeanNames() throws Exception { - @SuppressWarnings("rawtypes") - ResponseEntity entity = this.testRestTemplate.getForEntity("http://localhost:" + this.mgt + "/springbeans", List.class); + RequestEntity requestEntity = RequestEntity.get(new URI("http://localhost:" + this.mgt + ACTUATOR_PATH + "/beans")) + .accept(MediaType.APPLICATION_JSON) + .build(); + ResponseEntity entity = this.testRestTemplate.exchange(requestEntity, BeanActuatorResponse.class); - List> allBeans = (List) ((Map) entity.getBody().get(0)).get("beans"); - List beanNamesList = allBeans.stream().map(x -> (String) x.get("bean")).collect(Collectors.toList()); + Collection beanNamesList = entity.getBody() + .getBeans(); - assertThat(beanNamesList, hasItem("fooController")); - assertThat(beanNamesList, hasItem("fooService")); + assertThat(beanNamesList).contains("fooController", "fooService"); } @Test @@ -72,7 +82,20 @@ public class DisplayBeanIntegrationTest { String[] beanNames = context.getBeanDefinitionNames(); List beanNamesList = Arrays.asList(beanNames); - assertTrue(beanNamesList.contains("fooController")); - assertTrue(beanNamesList.contains("fooService")); + assertThat(beanNamesList).contains("fooController", "fooService"); + } + + private static class BeanActuatorResponse { + private Map>>> contexts; + + public Collection getBeans() { + return this.contexts.get("application") + .get("beans") + .keySet(); + } + + public Map>>> getContexts() { + return contexts; + } } } diff --git a/spring-boot/src/test/java/com/baeldung/failureanalyzer/FailureAnalyzerAppIntegrationTest.java b/spring-boot/src/test/java/com/baeldung/failureanalyzer/FailureAnalyzerAppIntegrationTest.java new file mode 100644 index 0000000000..b3555f55da --- /dev/null +++ b/spring-boot/src/test/java/com/baeldung/failureanalyzer/FailureAnalyzerAppIntegrationTest.java @@ -0,0 +1,47 @@ +package com.baeldung.failureanalyzer; + +import static org.assertj.core.api.Assertions.assertThat; + +import java.util.Collection; +import java.util.stream.Collectors; + +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.springframework.beans.factory.BeanCreationException; +import org.springframework.boot.SpringApplication; + +import com.baeldung.failureanalyzer.utils.ListAppender; + +import ch.qos.logback.classic.spi.ILoggingEvent; + +public class FailureAnalyzerAppIntegrationTest { + + private static final String EXPECTED_ANALYSIS_DESCRIPTION_TITLE = "Description:"; + private static final String EXPECTED_ANALYSIS_DESCRIPTION_CONTENT = "The bean myDAO could not be injected as com.baeldung.failureanalyzer.MyDAO because it is of type com.baeldung.failureanalyzer.MySecondDAO"; + private static final String EXPECTED_ANALYSIS_ACTION_TITLE = "Action:"; + private static final String EXPECTED_ANALYSIS_ACTION_CONTENT = "Consider creating a bean with name myDAO of type com.baeldung.failureanalyzer.MyDAO"; + + @BeforeEach + public void clearLogList() { + ListAppender.clearEventList(); + } + + @Test + public void givenBeanCreationErrorInContext_whenContextLoaded_thenFailureAnalyzerLogsReport() { + try { + SpringApplication.run(FailureAnalyzerApplication.class); + } catch (BeanCreationException e) { + Collection allLoggedEntries = ListAppender.getEvents() + .stream() + .map(ILoggingEvent::getFormattedMessage) + .collect(Collectors.toList()); + assertThat(allLoggedEntries).anyMatch(entry -> entry.contains(EXPECTED_ANALYSIS_DESCRIPTION_TITLE)) + .anyMatch(entry -> entry.contains(EXPECTED_ANALYSIS_DESCRIPTION_CONTENT)) + .anyMatch(entry -> entry.contains(EXPECTED_ANALYSIS_ACTION_TITLE)) + .anyMatch(entry -> entry.contains(EXPECTED_ANALYSIS_ACTION_CONTENT)); + return; + } + throw new IllegalStateException("Context load should be failing due to a BeanCreationException!"); + } + +} diff --git a/spring-boot/src/test/java/com/baeldung/failureanalyzer/utils/ListAppender.java b/spring-boot/src/test/java/com/baeldung/failureanalyzer/utils/ListAppender.java new file mode 100644 index 0000000000..a298f49ff5 --- /dev/null +++ b/spring-boot/src/test/java/com/baeldung/failureanalyzer/utils/ListAppender.java @@ -0,0 +1,25 @@ +package com.baeldung.failureanalyzer.utils; + +import java.util.ArrayList; +import java.util.List; + +import ch.qos.logback.classic.spi.ILoggingEvent; +import ch.qos.logback.core.AppenderBase; + +public class ListAppender extends AppenderBase { + + static private List events = new ArrayList<>(); + + @Override + protected void append(ILoggingEvent eventObject) { + events.add(eventObject); + } + + public static List getEvents() { + return events; + } + + public static void clearEventList() { + events.clear(); + } +} \ No newline at end of file diff --git a/spring-boot/src/test/java/com/baeldung/git/CommitIdIntegrationTest.java b/spring-boot/src/test/java/com/baeldung/git/CommitIdIntegrationTest.java index 348d594c05..d7399a4ff5 100644 --- a/spring-boot/src/test/java/com/baeldung/git/CommitIdIntegrationTest.java +++ b/spring-boot/src/test/java/com/baeldung/git/CommitIdIntegrationTest.java @@ -1,17 +1,19 @@ package com.baeldung.git; +import static org.assertj.core.api.Assertions.assertThat; + import org.junit.Test; import org.junit.runner.RunWith; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Value; import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.TestPropertySource; import org.springframework.test.context.junit4.SpringRunner; -import static org.assertj.core.api.Assertions.assertThat; - @RunWith(SpringRunner.class) @ContextConfiguration(classes = CommitIdApplication.class) +@TestPropertySource(properties = { "spring.jmx.default-domain=test" }) public class CommitIdIntegrationTest { private static final Logger LOG = LoggerFactory.getLogger(CommitIdIntegrationTest.class); diff --git a/spring-boot/src/test/java/com/baeldung/intro/AppLiveTest.java b/spring-boot/src/test/java/com/baeldung/intro/AppLiveTest.java index 83b893ae5c..2785054153 100644 --- a/spring-boot/src/test/java/com/baeldung/intro/AppLiveTest.java +++ b/spring-boot/src/test/java/com/baeldung/intro/AppLiveTest.java @@ -1,24 +1,22 @@ package com.baeldung.intro; +import static org.hamcrest.Matchers.equalTo; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; + import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.http.MediaType; -import org.springframework.test.context.TestPropertySource; import org.springframework.test.context.junit4.SpringRunner; import org.springframework.test.web.servlet.MockMvc; import org.springframework.test.web.servlet.request.MockMvcRequestBuilders; -import static org.hamcrest.Matchers.equalTo; -import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content; -import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; - @RunWith(SpringRunner.class) @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.MOCK) @AutoConfigureMockMvc -@TestPropertySource(properties = { "security.basic.enabled=false" }) public class AppLiveTest { @Autowired diff --git a/spring-boot/src/test/java/com/baeldung/kong/KongAdminAPILiveTest.java b/spring-boot/src/test/java/com/baeldung/kong/KongAdminAPILiveTest.java index 5cf19dd1db..92d2286518 100644 --- a/spring-boot/src/test/java/com/baeldung/kong/KongAdminAPILiveTest.java +++ b/spring-boot/src/test/java/com/baeldung/kong/KongAdminAPILiveTest.java @@ -55,7 +55,7 @@ public class KongAdminAPILiveTest { public void givenKongAdminAPI_whenAddAPI_thenAPIAccessibleViaKong() throws Exception { restTemplate.delete("http://localhost:8001/apis/stock-api"); - APIObject stockAPI = new APIObject("stock-api", "stock.api", "http://localhost:8080", "/"); + APIObject stockAPI = new APIObject("stock-api", "stock.api", "http://localhost:9090", "/"); HttpEntity apiEntity = new HttpEntity<>(stockAPI); ResponseEntity addAPIResp = restTemplate.postForEntity("http://localhost:8001/apis", apiEntity, String.class); @@ -69,7 +69,7 @@ public class KongAdminAPILiveTest { HttpHeaders headers = new HttpHeaders(); headers.set("Host", "stock.api"); - RequestEntity requestEntity = new RequestEntity<>(headers, HttpMethod.GET, new URI("http://localhost:8000/stock/btc")); + RequestEntity requestEntity = new RequestEntity<>(headers, HttpMethod.GET, new URI("http://localhost:8000/springbootapp/stock/btc")); ResponseEntity stockPriceResp = restTemplate.exchange(requestEntity, String.class); assertEquals("10000", stockPriceResp.getBody()); @@ -126,22 +126,26 @@ public class KongAdminAPILiveTest { givenKongAdminAPI_whenAddAPIConsumer_thenAdded(); } + PluginObject authPlugin = new PluginObject("key-auth"); + ResponseEntity enableAuthResp = restTemplate.postForEntity("http://localhost:8001/apis/stock-api/plugins", new HttpEntity<>(authPlugin), String.class); + assertTrue(HttpStatus.CREATED == enableAuthResp.getStatusCode() || HttpStatus.CONFLICT == enableAuthResp.getStatusCode()); + final String consumerKey = "eugenp.pass"; KeyAuthObject keyAuth = new KeyAuthObject(consumerKey); ResponseEntity keyAuthResp = restTemplate.postForEntity("http://localhost:8001/consumers/eugenp/key-auth", new HttpEntity<>(keyAuth), String.class); - + assertTrue(HttpStatus.CREATED == keyAuthResp.getStatusCode() || HttpStatus.CONFLICT == keyAuthResp.getStatusCode()); HttpHeaders headers = new HttpHeaders(); headers.set("Host", "stock.api"); headers.set("apikey", consumerKey); - RequestEntity requestEntity = new RequestEntity<>(headers, HttpMethod.GET, new URI("http://localhost:8000/stock/btc")); + RequestEntity requestEntity = new RequestEntity<>(headers, HttpMethod.GET, new URI("http://localhost:8000/springbootapp/stock/btc")); ResponseEntity stockPriceResp = restTemplate.exchange(requestEntity, String.class); assertEquals("10000", stockPriceResp.getBody()); headers.set("apikey", "wrongpass"); - requestEntity = new RequestEntity<>(headers, HttpMethod.GET, new URI("http://localhost:8000/stock/btc")); + requestEntity = new RequestEntity<>(headers, HttpMethod.GET, new URI("http://localhost:8000/springbootapp/stock/btc")); stockPriceResp = restTemplate.exchange(requestEntity, String.class); assertEquals(HttpStatus.FORBIDDEN, stockPriceResp.getStatusCode()); } diff --git a/spring-boot/src/test/java/com/baeldung/kong/KongLoadBalanceLiveTest.java b/spring-boot/src/test/java/com/baeldung/kong/KongLoadBalanceLiveTest.java index abc7151720..7cf67453a6 100644 --- a/spring-boot/src/test/java/com/baeldung/kong/KongLoadBalanceLiveTest.java +++ b/spring-boot/src/test/java/com/baeldung/kong/KongLoadBalanceLiveTest.java @@ -1,28 +1,34 @@ package com.baeldung.kong; -import com.baeldung.kong.domain.APIObject; -import com.baeldung.kong.domain.TargetObject; -import com.baeldung.kong.domain.UpstreamObject; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; +import static org.springframework.boot.test.context.SpringBootTest.WebEnvironment.DEFINED_PORT; + +import java.net.URI; + 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.boot.test.web.client.TestRestTemplate; -import org.springframework.http.*; +import org.springframework.http.HttpEntity; +import org.springframework.http.HttpHeaders; +import org.springframework.http.HttpMethod; +import org.springframework.http.HttpStatus; +import org.springframework.http.RequestEntity; +import org.springframework.http.ResponseEntity; import org.springframework.test.context.junit4.SpringRunner; -import java.net.URI; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; -import static org.springframework.boot.test.context.SpringBootTest.WebEnvironment.DEFINED_PORT; +import com.baeldung.kong.domain.APIObject; +import com.baeldung.kong.domain.TargetObject; +import com.baeldung.kong.domain.UpstreamObject; /** * @author aiet */ @RunWith(SpringRunner.class) -@SpringBootTest(webEnvironment = DEFINED_PORT, classes = StockApp.class) +@SpringBootTest(webEnvironment = DEFINED_PORT, classes = StockApp.class, properties = "server.servlet.contextPath=/springbootapp") public class KongLoadBalanceLiveTest { @Before @@ -55,13 +61,13 @@ public class KongLoadBalanceLiveTest { HttpHeaders headers = new HttpHeaders(); headers.set("Host", "balanced.stock.api"); for (int i = 0; i < 1000; i++) { - RequestEntity requestEntity = new RequestEntity<>(headers, HttpMethod.GET, new URI("http://localhost:8000/stock/btc")); + RequestEntity requestEntity = new RequestEntity<>(headers, HttpMethod.GET, new URI("http://localhost:8000/springbootapp/stock/btc")); ResponseEntity stockPriceResp = restTemplate.exchange(requestEntity, String.class); assertEquals("10000", stockPriceResp.getBody()); } - int releaseCount = restTemplate.getForObject("http://localhost:9090/stock/reqcount", Integer.class); - int testCount = restTemplate.getForObject("http://localhost:8080/stock/reqcount", Integer.class); + int releaseCount = restTemplate.getForObject("http://localhost:9090/springbootapp/stock/reqcount", Integer.class); + int testCount = restTemplate.getForObject("http://localhost:8080/springbootapp/stock/reqcount", Integer.class); assertTrue(Math.round(releaseCount * 1.0 / testCount) == 4); } diff --git a/spring-boot/src/test/java/com/baeldung/mongodb/ManualEmbeddedMongoDbIntegrationTest.java b/spring-boot/src/test/java/com/baeldung/mongodb/ManualEmbeddedMongoDbIntegrationTest.java index 30a4d61fbd..c49b99ed99 100644 --- a/spring-boot/src/test/java/com/baeldung/mongodb/ManualEmbeddedMongoDbIntegrationTest.java +++ b/spring-boot/src/test/java/com/baeldung/mongodb/ManualEmbeddedMongoDbIntegrationTest.java @@ -7,6 +7,7 @@ import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; import org.springframework.data.mongodb.core.MongoTemplate; +import org.springframework.util.SocketUtils; import com.mongodb.BasicDBObjectBuilder; import com.mongodb.DBObject; @@ -32,16 +33,16 @@ class ManualEmbeddedMongoDbIntegrationTest { @BeforeEach void setup() throws Exception { String ip = "localhost"; - int port = 27017; + int randomPort = SocketUtils.findAvailableTcpPort(); IMongodConfig mongodConfig = new MongodConfigBuilder().version(Version.Main.PRODUCTION) - .net(new Net(ip, port, Network.localhostIsIPv6())) + .net(new Net(ip, randomPort, Network.localhostIsIPv6())) .build(); MongodStarter starter = MongodStarter.getDefaultInstance(); mongodExecutable = starter.prepare(mongodConfig); mongodExecutable.start(); - mongoTemplate = new MongoTemplate(new MongoClient(ip, port), "test"); + mongoTemplate = new MongoTemplate(new MongoClient(ip, randomPort), "test"); } @DisplayName("Given object When save object using MongoDB template Then object can be found") diff --git a/spring-boot/src/test/java/com/baeldung/mongodb/MongoDbSpringIntegrationTest.java b/spring-boot/src/test/java/com/baeldung/mongodb/MongoDbSpringIntegrationTest.java index 5431217c3e..39127f62e9 100644 --- a/spring-boot/src/test/java/com/baeldung/mongodb/MongoDbSpringIntegrationTest.java +++ b/spring-boot/src/test/java/com/baeldung/mongodb/MongoDbSpringIntegrationTest.java @@ -2,6 +2,7 @@ package com.baeldung.mongodb; import static org.assertj.core.api.Assertions.assertThat; +import org.baeldung.boot.Application; import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; diff --git a/spring-boot/src/test/java/org/baeldung/boot/DemoApplicationIntegrationTest.java b/spring-boot/src/test/java/org/baeldung/boot/DemoApplicationIntegrationTest.java index fba816c681..0541da3199 100644 --- a/spring-boot/src/test/java/org/baeldung/boot/DemoApplicationIntegrationTest.java +++ b/spring-boot/src/test/java/org/baeldung/boot/DemoApplicationIntegrationTest.java @@ -4,12 +4,11 @@ import org.baeldung.demo.DemoApplication; 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.SpringJUnit4ClassRunner; -import org.springframework.test.context.web.WebAppConfiguration; @RunWith(SpringJUnit4ClassRunner.class) -@SpringBootTest(classes = DemoApplication.class) -@WebAppConfiguration +@SpringBootTest(classes = DemoApplication.class, webEnvironment = WebEnvironment.RANDOM_PORT) public class DemoApplicationIntegrationTest { @Test diff --git a/spring-boot/src/test/java/org/baeldung/demo/boottest/EmployeeRestControllerIntegrationTest.java b/spring-boot/src/test/java/org/baeldung/demo/boottest/EmployeeRestControllerIntegrationTest.java index d76dbfc803..a4b35889d6 100644 --- a/spring-boot/src/test/java/org/baeldung/demo/boottest/EmployeeRestControllerIntegrationTest.java +++ b/spring-boot/src/test/java/org/baeldung/demo/boottest/EmployeeRestControllerIntegrationTest.java @@ -22,13 +22,14 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.autoconfigure.jdbc.AutoConfigureTestDatabase; import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc; import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; import org.springframework.http.MediaType; import org.springframework.test.context.junit4.SpringRunner; import org.springframework.test.web.servlet.MockMvc; @RunWith(SpringRunner.class) -@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.MOCK, classes = DemoApplication.class) -@AutoConfigureMockMvc +@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT, classes = DemoApplication.class) +@AutoConfigureMockMvc // @TestPropertySource(locations = "classpath:application-integrationtest.properties") @AutoConfigureTestDatabase public class EmployeeRestControllerIntegrationTest { diff --git a/spring-boot/src/test/resources/application.properties b/spring-boot/src/test/resources/application.properties index 85e4e6e66f..9ad65e1815 100644 --- a/spring-boot/src/test/resources/application.properties +++ b/spring-boot/src/test/resources/application.properties @@ -2,7 +2,6 @@ spring.mail.host=localhost spring.mail.port=8025 spring.mail.properties.mail.smtp.auth=false -security.basic.enabled=false # spring.datasource.x spring.datasource.driver-class-name=org.h2.Driver @@ -11,9 +10,10 @@ spring.datasource.username=sa spring.datasource.password=sa # hibernate.X -hibernate.dialect=org.hibernate.dialect.H2Dialect -hibernate.show_sql=true -hibernate.hbm2ddl.auto=create-drop -hibernate.cache.use_second_level_cache=true -hibernate.cache.use_query_cache=true -hibernate.cache.region.factory_class=org.hibernate.cache.ehcache.EhCacheRegionFactory \ No newline at end of file +spring.jpa.hibernate.dialect=org.hibernate.dialect.H2Dialect +spring.jpa.hibernate.ddl-auto=create-drop +spring.jpa.hibernate.show_sql=true +spring.jpa.hibernate.hbm2ddl.auto=create-drop +spring.jpa.hibernate.cache.use_second_level_cache=true +spring.jpa.hibernate.cache.use_query_cache=true +spring.jpa.hibernate.cache.region.factory_class=org.hibernate.cache.ehcache.EhCacheRegionFactory diff --git a/spring-boot/src/test/resources/exception.properties b/spring-boot/src/test/resources/exception.properties index c55e415a3a..2d17b64a25 100644 --- a/spring-boot/src/test/resources/exception.properties +++ b/spring-boot/src/test/resources/exception.properties @@ -1,6 +1,2 @@ -# Security -security.user.name=admin -security.user.password=password - spring.dao.exceptiontranslation.enabled=false -spring.profiles.active=exception \ No newline at end of file +spring.profiles.active=exception diff --git a/spring-boot/src/test/resources/logback-test.xml b/spring-boot/src/test/resources/logback-test.xml new file mode 100644 index 0000000000..9e0f4e221f --- /dev/null +++ b/spring-boot/src/test/resources/logback-test.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/spring-cloud-bus/pom.xml b/spring-cloud-bus/pom.xml index d493c4e984..784e4cbae6 100644 --- a/spring-cloud-bus/pom.xml +++ b/spring-cloud-bus/pom.xml @@ -7,6 +7,7 @@ spring-cloud-bus 1.0.0-SNAPSHOT pom + spring-cloud-bus parent-boot-1 diff --git a/spring-cloud-data-flow/data-flow-server/pom.xml b/spring-cloud-data-flow/data-flow-server/pom.xml index 0133d65978..a02d2984c1 100644 --- a/spring-cloud-data-flow/data-flow-server/pom.xml +++ b/spring-cloud-data-flow/data-flow-server/pom.xml @@ -3,7 +3,6 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 - org.baeldung.spring.cloud data-flow-server 0.0.1-SNAPSHOT jar diff --git a/spring-cloud-data-flow/data-flow-shell/pom.xml b/spring-cloud-data-flow/data-flow-shell/pom.xml index e4ec145277..3b155736c3 100644 --- a/spring-cloud-data-flow/data-flow-shell/pom.xml +++ b/spring-cloud-data-flow/data-flow-shell/pom.xml @@ -3,7 +3,6 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 - org.baeldung.spring.cloud data-flow-shell 0.0.1-SNAPSHOT jar diff --git a/spring-cloud-data-flow/etl/README.MD b/spring-cloud-data-flow/etl/README.MD index 0cbb460b01..ee9c3a19c3 100644 --- a/spring-cloud-data-flow/etl/README.MD +++ b/spring-cloud-data-flow/etl/README.MD @@ -7,3 +7,7 @@ JDBC Source - Application Starter distributed by default customer-transform - Custom application to transform the data customer-mongodb-sink - Custom application to sink the data + +# Relevant Articles + +* [ETL with Spring Cloud Data Flow](https://www.baeldung.com/spring-cloud-data-flow-etl) diff --git a/spring-cloud-data-flow/etl/customer-mongodb-sink/pom.xml b/spring-cloud-data-flow/etl/customer-mongodb-sink/pom.xml index 468d8e17d0..392244dc84 100644 --- a/spring-cloud-data-flow/etl/customer-mongodb-sink/pom.xml +++ b/spring-cloud-data-flow/etl/customer-mongodb-sink/pom.xml @@ -4,7 +4,6 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 - com.customer customer-mongodb-sink jar @@ -17,12 +16,12 @@ 0.0.1-SNAPSHOT ../../../parent-boot-2 - + UTF-8 UTF-8 1.8 - Finchley.SR1 + Greenwich.M3 @@ -71,5 +70,16 @@ + + + spring-milestones + Spring Milestones + http://repo.spring.io/milestone + + false + + + + diff --git a/spring-cloud-data-flow/etl/customer-transform/pom.xml b/spring-cloud-data-flow/etl/customer-transform/pom.xml index bc4b648907..0e429cb593 100644 --- a/spring-cloud-data-flow/etl/customer-transform/pom.xml +++ b/spring-cloud-data-flow/etl/customer-transform/pom.xml @@ -4,7 +4,6 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 - com.customer customer-transform 0.0.1-SNAPSHOT jar @@ -23,7 +22,7 @@ UTF-8 UTF-8 1.8 - Finchley.SR1 + Greenwich.M3 @@ -64,5 +63,15 @@ + + + spring-milestones + Spring Milestones + http://repo.spring.io/milestone + + false + + + diff --git a/spring-cloud-data-flow/etl/pom.xml b/spring-cloud-data-flow/etl/pom.xml index 2b904f6e0d..7d5040e8ad 100644 --- a/spring-cloud-data-flow/etl/pom.xml +++ b/spring-cloud-data-flow/etl/pom.xml @@ -1,13 +1,13 @@ 4.0.0 - org.baeldung.spring.cloud - etl-spring-cloud-data-flow + etl + etl 0.0.1-SNAPSHOT pom - + - org.baeldung.spring.cloud + com.baeldung spring-cloud-data-flow 0.0.1-SNAPSHOT diff --git a/spring-cloud-data-flow/log-sink/pom.xml b/spring-cloud-data-flow/log-sink/pom.xml index 33a0a4df45..69de679c2a 100644 --- a/spring-cloud-data-flow/log-sink/pom.xml +++ b/spring-cloud-data-flow/log-sink/pom.xml @@ -3,7 +3,6 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 - org.baeldung.spring.cloud log-sink 0.0.1-SNAPSHOT jar diff --git a/spring-cloud-data-flow/pom.xml b/spring-cloud-data-flow/pom.xml index 5a007f3c7d..b5ef5d2c2a 100644 --- a/spring-cloud-data-flow/pom.xml +++ b/spring-cloud-data-flow/pom.xml @@ -1,11 +1,11 @@ 4.0.0 - org.baeldung.spring.cloud spring-cloud-data-flow 0.0.1-SNAPSHOT pom - + spring-cloud-data-flow + com.baeldung parent-modules diff --git a/spring-cloud-data-flow/time-processor/pom.xml b/spring-cloud-data-flow/time-processor/pom.xml index 4f31e55b96..e630df1865 100644 --- a/spring-cloud-data-flow/time-processor/pom.xml +++ b/spring-cloud-data-flow/time-processor/pom.xml @@ -3,7 +3,6 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 - org.baeldung.spring.cloud time-processor 0.0.1-SNAPSHOT jar diff --git a/spring-cloud-data-flow/time-source/pom.xml b/spring-cloud-data-flow/time-source/pom.xml index dc593fdb14..649af32cf0 100644 --- a/spring-cloud-data-flow/time-source/pom.xml +++ b/spring-cloud-data-flow/time-source/pom.xml @@ -3,7 +3,6 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 - org.baeldung.spring.cloud time-source 0.0.1-SNAPSHOT jar diff --git a/spring-cloud/README.md b/spring-cloud/README.md index 16bc2d110a..dc43bd1a66 100644 --- a/spring-cloud/README.md +++ b/spring-cloud/README.md @@ -30,3 +30,4 @@ - [Introduction to Netflix Archaius with Spring Cloud](https://www.baeldung.com/netflix-archaius-spring-cloud-integration) - [An Intro to Spring Cloud Vault](https://www.baeldung.com/spring-cloud-vault) - [Netflix Archaius with Various Database Configurations](https://www.baeldung.com/netflix-archaius-database-configurations) +- [Rate Limiting in Spring Cloud Netflix Zuul](https://www.baeldung.com/spring-cloud-zuul-rate-limit) diff --git a/spring-cloud/pom.xml b/spring-cloud/pom.xml index 924ea2be36..39cda888c5 100644 --- a/spring-cloud/pom.xml +++ b/spring-cloud/pom.xml @@ -35,8 +35,9 @@ spring-cloud-archaius spring-cloud-functions spring-cloud-vault - spring-cloud-security + spring-cloud-task + spring-cloud-zuul @@ -56,8 +57,8 @@ Brixton.SR7 1.2.2.RELEASE 1.2.2.RELEASE - 1.2.3.RELEASE - 1.2.3.RELEASE + 2.0.2.RELEASE + 1.4.6.RELEASE 1.2.3.RELEASE 1.3.0.RELEASE 1.4.2.RELEASE diff --git a/spring-cloud/spring-cloud-archaius/dynamodb-config/pom.xml b/spring-cloud/spring-cloud-archaius/dynamodb-config/pom.xml index 3ffbf8f619..96f6c8711e 100644 --- a/spring-cloud/spring-cloud-archaius/dynamodb-config/pom.xml +++ b/spring-cloud/spring-cloud-archaius/dynamodb-config/pom.xml @@ -3,6 +3,7 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 dynamodb-config + dynamodb-config jar diff --git a/spring-cloud/spring-cloud-archaius/jdbc-config/pom.xml b/spring-cloud/spring-cloud-archaius/jdbc-config/pom.xml index bb283576d8..59dea4890e 100644 --- a/spring-cloud/spring-cloud-archaius/jdbc-config/pom.xml +++ b/spring-cloud/spring-cloud-archaius/jdbc-config/pom.xml @@ -3,6 +3,7 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 jdbc-config + jdbc-config jar diff --git a/spring-cloud/spring-cloud-archaius/zookeeper-config/pom.xml b/spring-cloud/spring-cloud-archaius/zookeeper-config/pom.xml index 8f8ec99ad8..51010eefb2 100644 --- a/spring-cloud/spring-cloud-archaius/zookeeper-config/pom.xml +++ b/spring-cloud/spring-cloud-archaius/zookeeper-config/pom.xml @@ -3,6 +3,7 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 zookeeper-config + zookeeper-config jar diff --git a/spring-cloud/spring-cloud-aws/pom.xml b/spring-cloud/spring-cloud-aws/pom.xml index 6933845173..7edabd03f5 100644 --- a/spring-cloud/spring-cloud-aws/pom.xml +++ b/spring-cloud/spring-cloud-aws/pom.xml @@ -5,7 +5,7 @@ com.baeldung.spring.cloud spring-cloud-aws jar - Spring Cloud AWS + spring-cloud-aws Spring Cloud AWS Examples @@ -49,8 +49,8 @@ org.springframework.cloud - spring-cloud-dependencies - ${spring-cloud.version} + spring-cloud-aws + 2.0.1.RELEASE pom import diff --git a/spring-cloud/spring-cloud-bootstrap/config/pom.xml b/spring-cloud/spring-cloud-bootstrap/config/pom.xml index 14a926fc2c..1379af0b05 100644 --- a/spring-cloud/spring-cloud-bootstrap/config/pom.xml +++ b/spring-cloud/spring-cloud-bootstrap/config/pom.xml @@ -4,6 +4,7 @@ 4.0.0 config 1.0.0-SNAPSHOT + config parent-boot-1 diff --git a/spring-cloud/spring-cloud-bootstrap/discovery/pom.xml b/spring-cloud/spring-cloud-bootstrap/discovery/pom.xml index f94d8829f6..735d3745d7 100644 --- a/spring-cloud/spring-cloud-bootstrap/discovery/pom.xml +++ b/spring-cloud/spring-cloud-bootstrap/discovery/pom.xml @@ -2,9 +2,9 @@ 4.0.0 - discovery 1.0.0-SNAPSHOT + discovery parent-boot-1 diff --git a/spring-cloud/spring-cloud-bootstrap/gateway/pom.xml b/spring-cloud/spring-cloud-bootstrap/gateway/pom.xml index fc69c16738..2efa926e3a 100644 --- a/spring-cloud/spring-cloud-bootstrap/gateway/pom.xml +++ b/spring-cloud/spring-cloud-bootstrap/gateway/pom.xml @@ -4,6 +4,7 @@ 4.0.0 gateway 1.0.0-SNAPSHOT + gateway parent-boot-1 diff --git a/spring-cloud/spring-cloud-bootstrap/pom.xml b/spring-cloud/spring-cloud-bootstrap/pom.xml index 74801159eb..46460c0d74 100644 --- a/spring-cloud/spring-cloud-bootstrap/pom.xml +++ b/spring-cloud/spring-cloud-bootstrap/pom.xml @@ -4,6 +4,7 @@ 4.0.0 spring-cloud-bootstrap 1.0.0-SNAPSHOT + spring-cloud-bootstrap pom diff --git a/spring-cloud/spring-cloud-bootstrap/svc-book/pom.xml b/spring-cloud/spring-cloud-bootstrap/svc-book/pom.xml index c0d920d373..eb855a91e3 100644 --- a/spring-cloud/spring-cloud-bootstrap/svc-book/pom.xml +++ b/spring-cloud/spring-cloud-bootstrap/svc-book/pom.xml @@ -2,10 +2,10 @@ 4.0.0 - com.baeldung.spring.cloud svc-book 1.0.0-SNAPSHOT + svc-book parent-boot-1 diff --git a/spring-cloud/spring-cloud-bootstrap/svc-rating/pom.xml b/spring-cloud/spring-cloud-bootstrap/svc-rating/pom.xml index 3aa2db8f65..7c1e93bad1 100644 --- a/spring-cloud/spring-cloud-bootstrap/svc-rating/pom.xml +++ b/spring-cloud/spring-cloud-bootstrap/svc-rating/pom.xml @@ -2,10 +2,10 @@ 4.0.0 - com.baeldung.spring.cloud svc-rating 1.0.0-SNAPSHOT + svc-rating parent-boot-1 diff --git a/spring-cloud/spring-cloud-bootstrap/zipkin/pom.xml b/spring-cloud/spring-cloud-bootstrap/zipkin/pom.xml index 8735e24d48..1bf9ecb9e7 100644 --- a/spring-cloud/spring-cloud-bootstrap/zipkin/pom.xml +++ b/spring-cloud/spring-cloud-bootstrap/zipkin/pom.xml @@ -4,6 +4,7 @@ 4.0.0 zipkin 1.0.0-SNAPSHOT + zipkin parent-boot-1 diff --git a/spring-cloud/spring-cloud-config/client/pom.xml b/spring-cloud/spring-cloud-config/client/pom.xml index 800a496a82..c55f9bc471 100644 --- a/spring-cloud/spring-cloud-config/client/pom.xml +++ b/spring-cloud/spring-cloud-config/client/pom.xml @@ -3,13 +3,14 @@ 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"> 4.0.0 - + client + client + com.baeldung.spring.cloud spring-cloud-config 1.0-SNAPSHOT - client diff --git a/spring-cloud/spring-cloud-config/pom.xml b/spring-cloud/spring-cloud-config/pom.xml index b28828bf37..1a4efc7a60 100644 --- a/spring-cloud/spring-cloud-config/pom.xml +++ b/spring-cloud/spring-cloud-config/pom.xml @@ -5,6 +5,7 @@ com.baeldung.spring.cloud spring-cloud-config 1.0-SNAPSHOT + spring-cloud-config pom diff --git a/spring-cloud/spring-cloud-config/server/pom.xml b/spring-cloud/spring-cloud-config/server/pom.xml index 7bbb903cf9..b4be7663e2 100644 --- a/spring-cloud/spring-cloud-config/server/pom.xml +++ b/spring-cloud/spring-cloud-config/server/pom.xml @@ -3,13 +3,14 @@ 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"> 4.0.0 - + server + server + com.baeldung.spring.cloud spring-cloud-config 1.0-SNAPSHOT - server diff --git a/spring-cloud/spring-cloud-connectors-heroku/pom.xml b/spring-cloud/spring-cloud-connectors-heroku/pom.xml index f00c9eb1fc..d2e9292511 100644 --- a/spring-cloud/spring-cloud-connectors-heroku/pom.xml +++ b/spring-cloud/spring-cloud-connectors-heroku/pom.xml @@ -5,6 +5,7 @@ com.baeldung.spring.cloud spring-cloud-connectors-heroku 1.0.0-SNAPSHOT + spring-cloud-connectors-heroku parent-boot-1 diff --git a/spring-cloud/spring-cloud-contract/pom.xml b/spring-cloud/spring-cloud-contract/pom.xml index 5dde6a7a99..3563d0ee58 100644 --- a/spring-cloud/spring-cloud-contract/pom.xml +++ b/spring-cloud/spring-cloud-contract/pom.xml @@ -6,6 +6,7 @@ com.baeldung.spring.cloud spring-cloud-contract 1.0.0-SNAPSHOT + spring-cloud-contract com.baeldung.spring.cloud diff --git a/spring-cloud/spring-cloud-eureka/pom.xml b/spring-cloud/spring-cloud-eureka/pom.xml index 37571bc29a..99d8c0ed40 100644 --- a/spring-cloud/spring-cloud-eureka/pom.xml +++ b/spring-cloud/spring-cloud-eureka/pom.xml @@ -6,7 +6,7 @@ spring-cloud-eureka 1.0.0-SNAPSHOT pom - Spring Cloud Eureka + spring-cloud-eureka Spring Cloud Eureka Server and Sample Clients @@ -23,7 +23,8 @@ - 1.4.2.RELEASE + 2.0.1.RELEASE + Finchley.SR2 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 8bc51adcab..5378095af0 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 @@ -2,12 +2,10 @@ 4.0.0 - spring-cloud-eureka-client 1.0.0-SNAPSHOT jar - - Spring Cloud Eureka Client + spring-cloud-eureka-client Spring Cloud Eureka Sample Client @@ -20,32 +18,20 @@ org.springframework.cloud - spring-cloud-starter-eureka + spring-cloud-starter-netflix-eureka-client ${spring-cloud-starter-eureka.version} org.springframework.boot spring-boot-starter-web - ${spring-boot-starter-web.version} + ${spring-boot.version} org.springframework.boot spring-boot-starter-test - 1.5.10.RELEASE + ${spring-boot.version} test - - org.springframework.boot - spring-boot-test - 1.5.10.RELEASE - test - - - org.springframework - spring-test - 4.0.5.RELEASE - test - diff --git a/spring-cloud/spring-cloud-eureka/spring-cloud-eureka-client/src/main/java/com/baeldung/spring/cloud/eureka/client/EurekaClientApplication.java b/spring-cloud/spring-cloud-eureka/spring-cloud-eureka-client/src/main/java/com/baeldung/spring/cloud/eureka/client/EurekaClientApplication.java index 48099eeaa2..82b5f6acb1 100644 --- a/spring-cloud/spring-cloud-eureka/spring-cloud-eureka-client/src/main/java/com/baeldung/spring/cloud/eureka/client/EurekaClientApplication.java +++ b/spring-cloud/spring-cloud-eureka/spring-cloud-eureka-client/src/main/java/com/baeldung/spring/cloud/eureka/client/EurekaClientApplication.java @@ -5,13 +5,10 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; -import org.springframework.cloud.netflix.eureka.EnableEurekaClient; import org.springframework.context.annotation.Lazy; -import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; @SpringBootApplication -@EnableEurekaClient @RestController public class EurekaClientApplication implements GreetingController { @Autowired 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 4552c458ec..f2057c8a76 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 @@ -5,7 +5,7 @@ spring-cloud-eureka-feign-client 1.0.0-SNAPSHOT jar - Spring Cloud Eureka Feign Client + spring-cloud-eureka-feign-client Spring Cloud Eureka - Sample Feign Client @@ -16,25 +16,25 @@ - - com.baeldung.spring.cloud - spring-cloud-eureka-client - ${spring-cloud-eureka-client.version} - org.springframework.cloud spring-cloud-starter-feign ${spring-cloud-starter-feign.version} + + org.springframework.cloud + spring-cloud-starter-netflix-eureka-client + ${spring-cloud-starter-eureka.version} + org.springframework.boot spring-boot-starter-web - ${spring-boot-starter-web.version} + ${spring-boot.version} org.springframework.boot spring-boot-starter-thymeleaf - ${spring-boot-starter-web.version} + ${spring-boot.version} diff --git a/spring-cloud/spring-cloud-eureka/spring-cloud-eureka-feign-client/src/main/java/com/baeldung/spring/cloud/feign/client/FeignClientApplication.java b/spring-cloud/spring-cloud-eureka/spring-cloud-eureka-feign-client/src/main/java/com/baeldung/spring/cloud/feign/client/FeignClientApplication.java index 7beb51d1ac..b8a6c8232d 100644 --- a/spring-cloud/spring-cloud-eureka/spring-cloud-eureka-feign-client/src/main/java/com/baeldung/spring/cloud/feign/client/FeignClientApplication.java +++ b/spring-cloud/spring-cloud-eureka/spring-cloud-eureka-feign-client/src/main/java/com/baeldung/spring/cloud/feign/client/FeignClientApplication.java @@ -3,14 +3,12 @@ package com.baeldung.spring.cloud.feign.client; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; -import org.springframework.cloud.netflix.eureka.EnableEurekaClient; -import org.springframework.cloud.netflix.feign.EnableFeignClients; +import org.springframework.cloud.openfeign.EnableFeignClients; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.RequestMapping; @SpringBootApplication -@EnableEurekaClient @EnableFeignClients @Controller public class FeignClientApplication { diff --git a/spring-cloud/spring-cloud-eureka/spring-cloud-eureka-feign-client/src/main/java/com/baeldung/spring/cloud/feign/client/GreetingClient.java b/spring-cloud/spring-cloud-eureka/spring-cloud-eureka-feign-client/src/main/java/com/baeldung/spring/cloud/feign/client/GreetingClient.java index 6bd444b347..a9977d86d6 100644 --- a/spring-cloud/spring-cloud-eureka/spring-cloud-eureka-feign-client/src/main/java/com/baeldung/spring/cloud/feign/client/GreetingClient.java +++ b/spring-cloud/spring-cloud-eureka/spring-cloud-eureka-feign-client/src/main/java/com/baeldung/spring/cloud/feign/client/GreetingClient.java @@ -1,8 +1,10 @@ package com.baeldung.spring.cloud.feign.client; -import com.baeldung.spring.cloud.eureka.client.GreetingController; -import org.springframework.cloud.netflix.feign.FeignClient; +import org.springframework.cloud.openfeign.FeignClient; +import org.springframework.web.bind.annotation.RequestMapping; @FeignClient("spring-cloud-eureka-client") -public interface GreetingClient extends GreetingController { +public interface GreetingClient { + @RequestMapping("/greeting") + String greeting(); } 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 8082b30c33..587aed6c49 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 @@ -5,7 +5,7 @@ spring-cloud-eureka-server 1.0.0-SNAPSHOT jar - Spring Cloud Eureka Server + spring-cloud-eureka-server Spring Cloud Eureka Server Demo @@ -18,7 +18,7 @@ org.springframework.cloud - spring-cloud-starter-eureka-server + spring-cloud-starter-netflix-eureka-server ${spring-cloud-starter-eureka.version} diff --git a/spring-cloud/spring-cloud-functions/pom.xml b/spring-cloud/spring-cloud-functions/pom.xml index 8b2b0ad385..5686fc8c64 100644 --- a/spring-cloud/spring-cloud-functions/pom.xml +++ b/spring-cloud/spring-cloud-functions/pom.xml @@ -3,13 +3,11 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 - com.baeldung.spring - cloudfunction-aws + spring-cloud-functions 0.0.1-SNAPSHOT jar - - cloudfunction-aws + spring-cloud-functions Demo project for Spring Cloud Function diff --git a/spring-cloud/spring-cloud-gateway/pom.xml b/spring-cloud/spring-cloud-gateway/pom.xml index 4d8b57d4cf..c297d90896 100644 --- a/spring-cloud/spring-cloud-gateway/pom.xml +++ b/spring-cloud/spring-cloud-gateway/pom.xml @@ -4,7 +4,7 @@ 4.0.0 spring-cloud-gateway jar - Spring Cloud Gateway + spring-cloud-gateway com.baeldung.spring.cloud diff --git a/spring-cloud/spring-cloud-kubernetes/demo-backend/pom.xml b/spring-cloud/spring-cloud-kubernetes/demo-backend/pom.xml index 308a81fd74..f7b04baec3 100644 --- a/spring-cloud/spring-cloud-kubernetes/demo-backend/pom.xml +++ b/spring-cloud/spring-cloud-kubernetes/demo-backend/pom.xml @@ -3,7 +3,8 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 demo-backend - + demo-backend + com.baeldung.spring.cloud spring-cloud-kubernetes diff --git a/spring-cloud/spring-cloud-kubernetes/demo-frontend/pom.xml b/spring-cloud/spring-cloud-kubernetes/demo-frontend/pom.xml index 968529c648..da55ca5034 100644 --- a/spring-cloud/spring-cloud-kubernetes/demo-frontend/pom.xml +++ b/spring-cloud/spring-cloud-kubernetes/demo-frontend/pom.xml @@ -3,7 +3,8 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 demo-frontend - + demo-frontend + com.baeldung.spring.cloud spring-cloud-kubernetes diff --git a/spring-cloud/spring-cloud-kubernetes/liveness-example/Dockerfile b/spring-cloud/spring-cloud-kubernetes/liveness-example/Dockerfile new file mode 100644 index 0000000000..0fc0a9bd64 --- /dev/null +++ b/spring-cloud/spring-cloud-kubernetes/liveness-example/Dockerfile @@ -0,0 +1,11 @@ +FROM openjdk:8-jdk-alpine + +# Create app directory +RUN mkdir -p /usr/opt/service + +# Copy app +COPY target/*.jar /usr/opt/service/service.jar + +EXPOSE 8080 + +ENTRYPOINT exec java -jar /usr/opt/service/service.jar \ No newline at end of file diff --git a/spring-cloud/spring-cloud-kubernetes/liveness-example/pom.xml b/spring-cloud/spring-cloud-kubernetes/liveness-example/pom.xml new file mode 100644 index 0000000000..e963dafe67 --- /dev/null +++ b/spring-cloud/spring-cloud-kubernetes/liveness-example/pom.xml @@ -0,0 +1,51 @@ + + + + + org.springframework.boot + spring-boot-starter-parent + 1.5.17.RELEASE + + + + 4.0.0 + + liveness-example + 1.0-SNAPSHOT + + + UTF-8 + UTF-8 + 1.8 + + + + + org.springframework.boot + spring-boot-starter-web + + + + org.springframework.boot + spring-boot-starter-actuator + + + + org.springframework.boot + spring-boot-starter-test + test + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + + + \ No newline at end of file diff --git a/spring-custom-aop/src/main/java/com/baeldung/intro/App.java b/spring-cloud/spring-cloud-kubernetes/liveness-example/src/main/java/com/baeldung/liveness/Application.java similarity index 62% rename from spring-custom-aop/src/main/java/com/baeldung/intro/App.java rename to spring-cloud/spring-cloud-kubernetes/liveness-example/src/main/java/com/baeldung/liveness/Application.java index 77cdf4ddb9..2cfa242965 100644 --- a/spring-custom-aop/src/main/java/com/baeldung/intro/App.java +++ b/spring-cloud/spring-cloud-kubernetes/liveness-example/src/main/java/com/baeldung/liveness/Application.java @@ -1,11 +1,12 @@ -package com.baeldung.intro; +package com.baeldung.liveness; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication -public class App { +public class Application { + public static void main(String[] args) { - SpringApplication.run(App.class, args); + SpringApplication.run(Application.class, args); } -} +} \ No newline at end of file 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/liveness-example/src/main/java/com/baeldung/liveness/health/CustomHealthIndicator.java new file mode 100644 index 0000000000..715c4cb178 --- /dev/null +++ b/spring-cloud/spring-cloud-kubernetes/liveness-example/src/main/java/com/baeldung/liveness/health/CustomHealthIndicator.java @@ -0,0 +1,27 @@ +package com.baeldung.liveness.health; + +import org.springframework.boot.actuate.health.Health; +import org.springframework.boot.actuate.health.HealthIndicator; +import org.springframework.stereotype.Component; + +import java.util.concurrent.Executors; +import java.util.concurrent.ScheduledExecutorService; +import java.util.concurrent.TimeUnit; + +@Component +public class CustomHealthIndicator implements HealthIndicator { + + private boolean isHealthy = true; + + public CustomHealthIndicator() { + ScheduledExecutorService scheduled = Executors.newSingleThreadScheduledExecutor(); + scheduled.schedule(() -> { + isHealthy = false; + }, 30, TimeUnit.SECONDS); + } + + @Override + public Health health() { + return isHealthy ? Health.up().build() : Health.down().build(); + } +} diff --git a/spring-cloud/spring-cloud-kubernetes/liveness-example/src/main/resources/resources/application.properties b/spring-cloud/spring-cloud-kubernetes/liveness-example/src/main/resources/resources/application.properties new file mode 100644 index 0000000000..a3ac65cee5 --- /dev/null +++ b/spring-cloud/spring-cloud-kubernetes/liveness-example/src/main/resources/resources/application.properties @@ -0,0 +1 @@ +server.port=8080 \ No newline at end of file diff --git a/spring-data-keyvalue/src/main/resources/logback.xml b/spring-cloud/spring-cloud-kubernetes/liveness-example/src/main/resources/resources/logback.xml similarity index 100% rename from spring-data-keyvalue/src/main/resources/logback.xml rename to spring-cloud/spring-cloud-kubernetes/liveness-example/src/main/resources/resources/logback.xml 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 new file mode 100644 index 0000000000..60b4a28aa6 --- /dev/null +++ b/spring-cloud/spring-cloud-kubernetes/liveness-example/src/test/java/com/baeldung/SpringContextIntegrationTest.java @@ -0,0 +1,17 @@ +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/object-configurations/liveness-example-k8s-template.yaml b/spring-cloud/spring-cloud-kubernetes/object-configurations/liveness-example-k8s-template.yaml new file mode 100644 index 0000000000..9fd3fd5674 --- /dev/null +++ b/spring-cloud/spring-cloud-kubernetes/object-configurations/liveness-example-k8s-template.yaml @@ -0,0 +1,54 @@ +apiVersion: v1 +kind: Service +metadata: + name: liveness-example +spec: + selector: + app: liveness-example + ports: + - port: 8080 + +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: liveness-example +spec: + selector: + matchLabels: + app: liveness-example + replicas: 1 + strategy: + rollingUpdate: + maxUnavailable: 0 + template: + metadata: + labels: + app: liveness-example + spec: + containers: + - name: liveness-example + image: dbdock/liveness-example:1.0.0 + imagePullPolicy: IfNotPresent + resources: + requests: + memory: 400Mi + cpu: 400m + ports: + - containerPort: 8080 + readinessProbe: + httpGet: + path: /health + port: 8080 + initialDelaySeconds: 10 + timeoutSeconds: 2 + periodSeconds: 3 + failureThreshold: 1 + livenessProbe: + httpGet: + path: /health + port: 8080 + initialDelaySeconds: 20 + timeoutSeconds: 2 + periodSeconds: 8 + failureThreshold: 1 \ No newline at end of file diff --git a/spring-cloud/spring-cloud-kubernetes/object-configurations/readiness-example-k8s-template.yaml b/spring-cloud/spring-cloud-kubernetes/object-configurations/readiness-example-k8s-template.yaml new file mode 100644 index 0000000000..010c468107 --- /dev/null +++ b/spring-cloud/spring-cloud-kubernetes/object-configurations/readiness-example-k8s-template.yaml @@ -0,0 +1,54 @@ +apiVersion: v1 +kind: Service +metadata: + name: readiness-example +spec: + selector: + app: readiness-example + ports: + - port: 8080 + +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: readiness-example +spec: + selector: + matchLabels: + app: readiness-example + replicas: 1 + strategy: + rollingUpdate: + maxUnavailable: 0 + template: + metadata: + labels: + app: readiness-example + spec: + containers: + - name: readiness-example + image: dbdock/readiness-example:1.0.0 + imagePullPolicy: IfNotPresent + resources: + requests: + memory: 400Mi + cpu: 400m + ports: + - containerPort: 8080 + readinessProbe: + httpGet: + path: /health + port: 8080 + initialDelaySeconds: 40 + timeoutSeconds: 2 + periodSeconds: 3 + failureThreshold: 5 + livenessProbe: + httpGet: + path: /health + port: 8080 + initialDelaySeconds: 100 + timeoutSeconds: 2 + periodSeconds: 8 + failureThreshold: 1 \ No newline at end of file diff --git a/spring-cloud/spring-cloud-kubernetes/pom.xml b/spring-cloud/spring-cloud-kubernetes/pom.xml index fd9f7b5876..de0718633e 100644 --- a/spring-cloud/spring-cloud-kubernetes/pom.xml +++ b/spring-cloud/spring-cloud-kubernetes/pom.xml @@ -2,15 +2,17 @@ 4.0.0 - com.baeldung.spring.cloud spring-cloud-kubernetes 1.0-SNAPSHOT pom + spring-cloud-kubernetes demo-frontend demo-backend + liveness-example + readiness-example diff --git a/spring-cloud/spring-cloud-kubernetes/readiness-example/Dockerfile b/spring-cloud/spring-cloud-kubernetes/readiness-example/Dockerfile new file mode 100644 index 0000000000..0fc0a9bd64 --- /dev/null +++ b/spring-cloud/spring-cloud-kubernetes/readiness-example/Dockerfile @@ -0,0 +1,11 @@ +FROM openjdk:8-jdk-alpine + +# Create app directory +RUN mkdir -p /usr/opt/service + +# Copy app +COPY target/*.jar /usr/opt/service/service.jar + +EXPOSE 8080 + +ENTRYPOINT exec java -jar /usr/opt/service/service.jar \ No newline at end of file diff --git a/spring-cloud/spring-cloud-kubernetes/readiness-example/pom.xml b/spring-cloud/spring-cloud-kubernetes/readiness-example/pom.xml new file mode 100644 index 0000000000..fa85120d21 --- /dev/null +++ b/spring-cloud/spring-cloud-kubernetes/readiness-example/pom.xml @@ -0,0 +1,49 @@ + + + + org.springframework.boot + spring-boot-starter-parent + 1.5.17.RELEASE + + + 4.0.0 + + readiness-example + 1.0-SNAPSHOT + + + UTF-8 + UTF-8 + 1.8 + + + + + org.springframework.boot + spring-boot-starter-web + + + + org.springframework.boot + spring-boot-starter-actuator + + + + org.springframework.boot + spring-boot-starter-test + test + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + + + \ No newline at end of file diff --git a/spring-cloud/spring-cloud-kubernetes/readiness-example/src/main/java/com/baeldung/readiness/Application.java b/spring-cloud/spring-cloud-kubernetes/readiness-example/src/main/java/com/baeldung/readiness/Application.java new file mode 100644 index 0000000000..11ffe577c3 --- /dev/null +++ b/spring-cloud/spring-cloud-kubernetes/readiness-example/src/main/java/com/baeldung/readiness/Application.java @@ -0,0 +1,12 @@ +package com.baeldung.readiness; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication +public class Application { + + public static void main(String[] args) { + SpringApplication.run(Application.class, args); + } +} \ No newline at end of file diff --git a/spring-cloud/spring-cloud-kubernetes/readiness-example/src/main/java/com/baeldung/readiness/health/CustomHealthIndicator.java b/spring-cloud/spring-cloud-kubernetes/readiness-example/src/main/java/com/baeldung/readiness/health/CustomHealthIndicator.java new file mode 100644 index 0000000000..d37a1905f6 --- /dev/null +++ b/spring-cloud/spring-cloud-kubernetes/readiness-example/src/main/java/com/baeldung/readiness/health/CustomHealthIndicator.java @@ -0,0 +1,27 @@ +package com.baeldung.readiness.health; + +import org.springframework.boot.actuate.health.Health; +import org.springframework.boot.actuate.health.HealthIndicator; +import org.springframework.stereotype.Component; + +import java.util.concurrent.Executors; +import java.util.concurrent.ScheduledExecutorService; +import java.util.concurrent.TimeUnit; + +@Component +public class CustomHealthIndicator implements HealthIndicator { + + private boolean isHealthy = false; + + public CustomHealthIndicator() { + ScheduledExecutorService scheduled = Executors.newSingleThreadScheduledExecutor(); + scheduled.schedule(() -> { + isHealthy = true; + }, 40, TimeUnit.SECONDS); + } + + @Override + public Health health() { + return isHealthy ? Health.up().build() : Health.down().build(); + } +} diff --git a/spring-cloud/spring-cloud-kubernetes/readiness-example/src/main/resources/resources/application.properties b/spring-cloud/spring-cloud-kubernetes/readiness-example/src/main/resources/resources/application.properties new file mode 100644 index 0000000000..a3ac65cee5 --- /dev/null +++ b/spring-cloud/spring-cloud-kubernetes/readiness-example/src/main/resources/resources/application.properties @@ -0,0 +1 @@ +server.port=8080 \ No newline at end of file diff --git a/spring-ejb/ejb-remote-for-spring/src/main/resources/logback.xml b/spring-cloud/spring-cloud-kubernetes/readiness-example/src/main/resources/resources/logback.xml similarity index 100% rename from spring-ejb/ejb-remote-for-spring/src/main/resources/logback.xml rename to spring-cloud/spring-cloud-kubernetes/readiness-example/src/main/resources/resources/logback.xml 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 new file mode 100644 index 0000000000..18458182c7 --- /dev/null +++ b/spring-cloud/spring-cloud-kubernetes/readiness-example/src/test/java/com/baeldung/SpringContextIntegrationTest.java @@ -0,0 +1,17 @@ +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-security/auth-client/pom.xml b/spring-cloud/spring-cloud-security/auth-client/pom.xml index 340c276c2d..5d15c6c726 100644 --- a/spring-cloud/spring-cloud-security/auth-client/pom.xml +++ b/spring-cloud/spring-cloud-security/auth-client/pom.xml @@ -5,8 +5,8 @@ auth-client jar auth-client - Spring Cloud Security APP Client Module - + Spring Cloud Security APP Client Module + spring-cloud-security com.baeldung @@ -61,6 +61,10 @@ org.springframework.boot spring-boot-starter-thymeleaf + + org.springframework.security.oauth + spring-security-oauth2 + diff --git a/spring-cloud/spring-cloud-security/auth-resource/pom.xml b/spring-cloud/spring-cloud-security/auth-resource/pom.xml index 09474b2a4d..0367baa990 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 @@ + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 auth-resource @@ -14,16 +14,16 @@ com.baeldung 1.0.0-SNAPSHOT - + + + org.springframework.boot + spring-boot-starter-web + org.springframework.security.oauth spring-security-oauth2 - - org.springframework.cloud - spring-cloud-starter-security - org.springframework.boot spring-boot-starter-test diff --git a/spring-cloud/spring-cloud-security/auth-server/pom.xml b/spring-cloud/spring-cloud-security/auth-server/pom.xml index 92f92808f6..4b3f94b825 100644 --- a/spring-cloud/spring-cloud-security/auth-server/pom.xml +++ b/spring-cloud/spring-cloud-security/auth-server/pom.xml @@ -3,6 +3,7 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 auth-server + auth-server Spring Cloud Security APP Server Module diff --git a/spring-cloud/spring-cloud-task/pom.xml b/spring-cloud/spring-cloud-task/pom.xml index ef76d464bc..748cc378f1 100644 --- a/spring-cloud/spring-cloud-task/pom.xml +++ b/spring-cloud/spring-cloud-task/pom.xml @@ -6,6 +6,7 @@ spring-cloud-task 1.0.0-SNAPSHOT pom + spring-cloud-task parent-boot-1 diff --git a/spring-cloud/spring-cloud-vault/pom.xml b/spring-cloud/spring-cloud-vault/pom.xml index 68b8e44875..3a7198ecc3 100644 --- a/spring-cloud/spring-cloud-vault/pom.xml +++ b/spring-cloud/spring-cloud-vault/pom.xml @@ -24,7 +24,7 @@ UTF-8 UTF-8 1.8 - Finchley.SR1 + Greenwich.M3 @@ -82,6 +82,17 @@ + + + + spring-milestones + Spring Milestones + http://repo.spring.io/milestone + + false + + + diff --git a/spring-cloud/spring-cloud-zookeeper/pom.xml b/spring-cloud/spring-cloud-zookeeper/pom.xml index 4535c2072d..9661f2b71a 100644 --- a/spring-cloud/spring-cloud-zookeeper/pom.xml +++ b/spring-cloud/spring-cloud-zookeeper/pom.xml @@ -4,7 +4,8 @@ 4.0.0 spring-cloud-zookeeper pom - + spring-cloud-zookeeper + com.baeldung.spring.cloud spring-cloud 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 9c27affb8b..c4f7ae704a 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 @@ -5,7 +5,7 @@ eureka-client 1.0.0-SNAPSHOT jar - Spring Cloud Eureka Client + eureka-client Spring Cloud Eureka Sample Client @@ -17,7 +17,7 @@ org.springframework.cloud - spring-cloud-starter-eureka + spring-cloud-starter-netflix-eureka-client ${spring-cloud-starter-eureka.version} 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 d694c9058b..0256ee7000 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 @@ -5,7 +5,7 @@ eureka-server 1.0.0-SNAPSHOT jar - Spring Cloud Eureka Server + eureka-server Spring Cloud Eureka Server Demo @@ -17,7 +17,7 @@ org.springframework.cloud - spring-cloud-starter-eureka-server + spring-cloud-starter-netflix-eureka-server ${spring-cloud-starter-eureka.version} diff --git a/spring-cloud/spring-cloud-zuul-eureka-integration/pom.xml b/spring-cloud/spring-cloud-zuul-eureka-integration/pom.xml index f4166c7d34..edd7b9d99e 100644 --- a/spring-cloud/spring-cloud-zuul-eureka-integration/pom.xml +++ b/spring-cloud/spring-cloud-zuul-eureka-integration/pom.xml @@ -7,7 +7,7 @@ spring-cloud-zuul-eureka-integration 1.0.0-SNAPSHOT pom - Spring Cloud Zuul and Eureka Integration + spring-cloud-zuul-eureka-integration Spring Cloud Zuul and Eureka Integration @@ -24,9 +24,11 @@ - 1.4.2.RELEASE + 2.0.1.RELEASE 1.10 1.2.10 + 2.0.1.RELEASE + Finchley.SR2 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 103b8334d3..39f94efdf0 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 @@ -2,6 +2,7 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 zuul-server + zuul-server com.baeldung.spring.cloud @@ -16,11 +17,11 @@ org.springframework.cloud - spring-cloud-starter-zuul + spring-cloud-starter-netflix-zuul org.springframework.cloud - spring-cloud-starter-eureka + spring-cloud-starter-netflix-eureka-client commons-configuration @@ -32,10 +33,6 @@ rxjava ${rxjava.version} - - org.springframework.boot - spring-boot-starter-security - diff --git a/spring-cloud/spring-cloud-zuul-eureka-integration/zuul-server/src/main/resources/application.properties b/spring-cloud/spring-cloud-zuul-eureka-integration/zuul-server/src/main/resources/application.properties index cb1dca78c2..42b4f5eee4 100644 --- a/spring-cloud/spring-cloud-zuul-eureka-integration/zuul-server/src/main/resources/application.properties +++ b/spring-cloud/spring-cloud-zuul-eureka-integration/zuul-server/src/main/resources/application.properties @@ -3,7 +3,4 @@ spring.application.name=zuul-server eureka.instance.preferIpAddress=true eureka.client.registerWithEureka=true eureka.client.fetchRegistry=true -eureka.serviceurl.defaultzone=http://localhost:8761/eureka/ -management.security.enabled=false -security.basic.enabled=false -hystrix.command.default.execution.timeout.enabled=false +eureka.client.serviceUrl.defaultZone=${EUREKA_URI:http://localhost:8761/eureka} \ No newline at end of file diff --git a/spring-cloud/spring-cloud-zuul/pom.xml b/spring-cloud/spring-cloud-zuul/pom.xml new file mode 100644 index 0000000000..e387bacb4e --- /dev/null +++ b/spring-cloud/spring-cloud-zuul/pom.xml @@ -0,0 +1,80 @@ + + + 4.0.0 + + com.baeldung.spring.cloud + spring-cloud-zuul + 0.0.1-SNAPSHOT + jar + + spring-cloud-zuul + Demo project for Spring Boot + + + org.springframework.boot + spring-boot-starter-parent + 2.0.6.RELEASE + + + + + UTF-8 + UTF-8 + 1.8 + Finchley.SR1 + + + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework.cloud + spring-cloud-starter-netflix-zuul + + + com.marcosbarbero.cloud + spring-cloud-zuul-ratelimit + 2.2.0.RELEASE + + + org.springframework.boot + spring-boot-starter-data-jpa + + + com.h2database + h2 + + + + org.springframework.boot + spring-boot-starter-test + test + + + + + + + org.springframework.cloud + spring-cloud-dependencies + ${spring-cloud.version} + pom + import + + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + + + + diff --git a/spring-cloud/spring-cloud-zuul/src/main/java/com/baeldung/spring/cloud/zuulratelimitdemo/ZuulRatelimitDemoApplication.java b/spring-cloud/spring-cloud-zuul/src/main/java/com/baeldung/spring/cloud/zuulratelimitdemo/ZuulRatelimitDemoApplication.java new file mode 100644 index 0000000000..9b53099768 --- /dev/null +++ b/spring-cloud/spring-cloud-zuul/src/main/java/com/baeldung/spring/cloud/zuulratelimitdemo/ZuulRatelimitDemoApplication.java @@ -0,0 +1,14 @@ +package com.baeldung.spring.cloud.zuulratelimitdemo; + +import org.springframework.boot.SpringApplication; +import org.springframework.cloud.client.SpringCloudApplication; +import org.springframework.cloud.netflix.zuul.EnableZuulProxy; + +@EnableZuulProxy +@SpringCloudApplication +public class ZuulRatelimitDemoApplication { + + public static void main(String[] args) { + SpringApplication.run(ZuulRatelimitDemoApplication.class, args); + } +} 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/src/main/java/com/baeldung/spring/cloud/zuulratelimitdemo/controller/GreetingController.java new file mode 100644 index 0000000000..3f2ec4822f --- /dev/null +++ b/spring-cloud/spring-cloud-zuul/src/main/java/com/baeldung/spring/cloud/zuulratelimitdemo/controller/GreetingController.java @@ -0,0 +1,21 @@ +package com.baeldung.spring.cloud.zuulratelimitdemo.controller; + +import org.springframework.http.ResponseEntity; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; + +@Controller +@RequestMapping("/greeting") +public class GreetingController { + + @GetMapping("/simple") + public ResponseEntity getSimple() { + return ResponseEntity.ok("Hi!"); + } + + @GetMapping("/advanced") + public ResponseEntity getAdvanced() { + return ResponseEntity.ok("Hello, how you doing?"); + } +} diff --git a/spring-cloud/spring-cloud-zuul/src/main/resources/application.yml b/spring-cloud/spring-cloud-zuul/src/main/resources/application.yml new file mode 100644 index 0000000000..86a29ca06d --- /dev/null +++ b/spring-cloud/spring-cloud-zuul/src/main/resources/application.yml @@ -0,0 +1,23 @@ +zuul: + routes: + serviceSimple: + path: /greeting/simple + url: forward:/ + serviceAdvanced: + path: /greeting/advanced + url: forward:/ + ratelimit: + enabled: true + repository: JPA + policy-list: + serviceSimple: + - limit: 5 + refresh-interval: 60 + type: + - origin + serviceAdvanced: + - limit: 1 + refresh-interval: 2 + type: + - origin + strip-prefix: true \ No newline at end of file diff --git a/spring-cloud/spring-cloud-zuul/src/test/java/com/baeldung/spring/cloud/zuulratelimitdemo/controller/GreetingControllerTest.java b/spring-cloud/spring-cloud-zuul/src/test/java/com/baeldung/spring/cloud/zuulratelimitdemo/controller/GreetingControllerTest.java new file mode 100644 index 0000000000..d51f881112 --- /dev/null +++ b/spring-cloud/spring-cloud-zuul/src/test/java/com/baeldung/spring/cloud/zuulratelimitdemo/controller/GreetingControllerTest.java @@ -0,0 +1,112 @@ +package com.baeldung.spring.cloud.zuulratelimitdemo.controller; + +import static com.marcosbarbero.cloud.autoconfigure.zuul.ratelimit.support.RateLimitConstants.HEADER_LIMIT; +import static com.marcosbarbero.cloud.autoconfigure.zuul.ratelimit.support.RateLimitConstants.HEADER_QUOTA; +import static com.marcosbarbero.cloud.autoconfigure.zuul.ratelimit.support.RateLimitConstants.HEADER_REMAINING; +import static com.marcosbarbero.cloud.autoconfigure.zuul.ratelimit.support.RateLimitConstants.HEADER_REMAINING_QUOTA; +import static com.marcosbarbero.cloud.autoconfigure.zuul.ratelimit.support.RateLimitConstants.HEADER_RESET; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; +import static org.springframework.http.HttpStatus.OK; +import static org.springframework.http.HttpStatus.TOO_MANY_REQUESTS; + +import java.util.concurrent.TimeUnit; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.autoconfigure.jdbc.AutoConfigureTestDatabase; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.test.web.client.TestRestTemplate; +import org.springframework.http.HttpHeaders; +import org.springframework.http.ResponseEntity; +import org.springframework.test.context.junit4.SpringRunner; + +@AutoConfigureTestDatabase +@RunWith(SpringRunner.class) +@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) +public class GreetingControllerTest { + + private static final String SIMPLE_GREETING = "/greeting/simple"; + private static final String ADVANCED_GREETING = "/greeting/advanced"; + + @Autowired + private TestRestTemplate restTemplate; + + @Test + public void whenRequestNotExceedingCapacity_thenReturnOkResponse() { + ResponseEntity response = this.restTemplate.getForEntity(SIMPLE_GREETING, String.class); + HttpHeaders headers = response.getHeaders(); + String key = "rate-limit-application_serviceSimple_127.0.0.1"; + + String limit = headers.getFirst(HEADER_LIMIT + key); + String remaining = headers.getFirst(HEADER_REMAINING + key); + String reset = headers.getFirst(HEADER_RESET + key); + + assertEquals(limit, "5"); + assertEquals(remaining, "4"); + assertEquals(reset, "60000"); + + assertEquals(OK, response.getStatusCode()); + } + + @Test + public void whenRequestExceedingCapacity_thenReturnTooManyRequestsResponse() throws InterruptedException { + ResponseEntity response = this.restTemplate.getForEntity(ADVANCED_GREETING, String.class); + HttpHeaders headers = response.getHeaders(); + String key = "rate-limit-application_serviceAdvanced_127.0.0.1"; + assertHeaders(headers, key, false, false); + assertEquals(OK, response.getStatusCode()); + + for (int i = 0; i < 2; i++) { + response = this.restTemplate.getForEntity(ADVANCED_GREETING, String.class); + } + + headers = response.getHeaders(); + String limit = headers.getFirst(HEADER_LIMIT + key); + String remaining = headers.getFirst(HEADER_REMAINING + key); + String reset = headers.getFirst(HEADER_RESET + key); + + assertEquals(limit, "1"); + assertEquals(remaining, "0"); + assertNotEquals(reset, "2000"); + + assertEquals(TOO_MANY_REQUESTS, response.getStatusCode()); + + TimeUnit.SECONDS.sleep(2); + + response = this.restTemplate.getForEntity(ADVANCED_GREETING, String.class); + headers = response.getHeaders(); + assertHeaders(headers, key, false, false); + assertEquals(OK, response.getStatusCode()); + } + + private void assertHeaders(HttpHeaders headers, String key, boolean nullable, boolean quotaHeaders) { + String quota = headers.getFirst(HEADER_QUOTA + key); + String remainingQuota = headers.getFirst(HEADER_REMAINING_QUOTA + key); + String limit = headers.getFirst(HEADER_LIMIT + key); + String remaining = headers.getFirst(HEADER_REMAINING + key); + String reset = headers.getFirst(HEADER_RESET + key); + + if (nullable) { + if (quotaHeaders) { + assertNull(quota); + assertNull(remainingQuota); + } else { + assertNull(limit); + assertNull(remaining); + } + assertNull(reset); + } else { + if (quotaHeaders) { + assertNotNull(quota); + assertNotNull(remainingQuota); + } else { + assertNotNull(limit); + assertNotNull(remaining); + } + assertNotNull(reset); + } + } +} diff --git a/spring-core/src/main/java/com/baeldung/collection/CollectionInjectionDemo.java b/spring-core/src/main/java/com/baeldung/collection/CollectionInjectionDemo.java index 2e0d9eb8d8..2ee265f134 100644 --- a/spring-core/src/main/java/com/baeldung/collection/CollectionInjectionDemo.java +++ b/spring-core/src/main/java/com/baeldung/collection/CollectionInjectionDemo.java @@ -16,5 +16,6 @@ public class CollectionInjectionDemo { collectionsBean.printNameSet(); collectionsBean.printNameMap(); collectionsBean.printBeanList(); + collectionsBean.printNameListWithDefaults(); } } diff --git a/spring-core/src/main/java/com/baeldung/collection/CollectionsBean.java b/spring-core/src/main/java/com/baeldung/collection/CollectionsBean.java index a0e985267f..fc90f2c6ff 100644 --- a/spring-core/src/main/java/com/baeldung/collection/CollectionsBean.java +++ b/spring-core/src/main/java/com/baeldung/collection/CollectionsBean.java @@ -1,13 +1,14 @@ package com.baeldung.collection; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Qualifier; - import java.util.ArrayList; import java.util.List; import java.util.Map; import java.util.Set; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.beans.factory.annotation.Value; + /** * Created by Gebruiker on 5/18/2018. */ @@ -24,6 +25,9 @@ public class CollectionsBean { @Qualifier("CollectionsBean") private List beanList = new ArrayList<>(); + @Value("${names.list:}#{T(java.util.Collections).emptyList()}") + private List nameListWithDefaultValue; + public CollectionsBean() { } @@ -51,4 +55,8 @@ public class CollectionsBean { public void printBeanList() { System.out.println(beanList); } + + public void printNameListWithDefaults() { + System.out.println(nameListWithDefaultValue); + } } diff --git a/spring-custom-aop/README.MD b/spring-custom-aop/README.MD deleted file mode 100644 index 9fe18aaacc..0000000000 --- a/spring-custom-aop/README.MD +++ /dev/null @@ -1,13 +0,0 @@ -###The Course -The "REST With Spring" Classes: http://bit.ly/restwithspring - -###Relevant Articles: -- [Quick Guide to @RestClientTest in Spring Boot](http://www.baeldung.com/restclienttest-in-spring-boot) -- [Intro to Spring Boot Starters](http://www.baeldung.com/spring-boot-starters) -- [A Guide to Spring in Eclipse STS](http://www.baeldung.com/eclipse-sts-spring) -- [Introduction to WebJars](http://www.baeldung.com/maven-webjars) -- [Create a Fat Jar App with Spring Boot](http://www.baeldung.com/deployable-fat-jar-spring-boot) -- [The @ServletComponentScan Annotation in Spring Boot](http://www.baeldung.com/spring-servletcomponentscan) -- [A Custom Data Binder in Spring MVC](http://www.baeldung.com/spring-mvc-custom-data-binder) -- [Intro to Building an Application with Spring Boot](http://www.baeldung.com/intro-to-spring-boot) -- [How to Register a Servlet in a Java Web Application](http://www.baeldung.com/register-servlet) diff --git a/spring-custom-aop/pom.xml b/spring-custom-aop/pom.xml deleted file mode 100644 index f0b1dbb5ac..0000000000 --- a/spring-custom-aop/pom.xml +++ /dev/null @@ -1,155 +0,0 @@ - - 4.0.0 - com.baeldung - spring-custom-aop - 0.0.1-SNAPSHOT - war - spring-boot - This is simple boot application for Spring boot actuator test - - - parent-boot-1 - com.baeldung - 0.0.1-SNAPSHOT - ../parent-boot-1 - - - - - org.springframework.boot - spring-boot-starter-thymeleaf - - - org.springframework.boot - spring-boot-starter-web - - - - org.springframework.boot - spring-boot-starter-data-jpa - - - - org.springframework.boot - spring-boot-starter-actuator - - - - org.springframework.boot - spring-boot-starter-security - - - - org.springframework.boot - spring-boot-starter-tomcat - - - - org.apache.tomcat.embed - tomcat-embed-core - ${tomcat.version} - - - - org.apache.tomcat.embed - tomcat-embed-jasper - ${tomcat.version} - - - - io.dropwizard.metrics - metrics-core - - - - com.h2database - h2 - - - - org.springframework.boot - spring-boot-starter - - - com.jayway.jsonpath - json-path - test - - - org.springframework.boot - spring-boot-starter-mail - - - org.subethamail - subethasmtp - ${subethasmtp.version} - test - - - - org.webjars - bootstrap - ${bootstrap.version} - - - org.webjars - jquery - ${jquery.version} - - - - com.google.guava - guava - ${guava.version} - - - - org.apache.tomcat - tomcat-servlet-api - ${tomee-servlet-api.version} - provided - - - - - - spring-boot - - - src/main/resources - true - - - - - - - org.apache.maven.plugins - maven-war-plugin - - - - pl.project13.maven - git-commit-id-plugin - ${git-commit-id-plugin.version} - - - - - - - - - org.baeldung.boot.DemoApplication - 4.3.4.RELEASE - 2.2.1 - 3.1.1 - 3.3.7-1 - 3.1.7 - 8.5.11 - 18.0 - 8.0.43 - - - diff --git a/spring-custom-aop/src/main/java/com/baeldung/annotation/servletcomponentscan/SpringBootAnnotatedApp.java b/spring-custom-aop/src/main/java/com/baeldung/annotation/servletcomponentscan/SpringBootAnnotatedApp.java deleted file mode 100644 index b4d416dd96..0000000000 --- a/spring-custom-aop/src/main/java/com/baeldung/annotation/servletcomponentscan/SpringBootAnnotatedApp.java +++ /dev/null @@ -1,25 +0,0 @@ -package com.baeldung.annotation.servletcomponentscan; - -import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.SpringBootApplication; -import org.springframework.boot.web.servlet.ServletComponentScan; - -/** - * using the following annotations are equivalent: - *
  • - * @ServletComponentScan - *
  • - * @ServletComponentScan(basePackages = "com.baeldung.annotation.servletcomponentscan.components") - *
  • - * @ServletComponentScan(basePackageClasses = {AttrListener.class, HelloFilter.class, HelloServlet.class, EchoServlet.class}) - *
- */ -@SpringBootApplication -@ServletComponentScan("com.baeldung.annotation.servletcomponentscan.components") -public class SpringBootAnnotatedApp { - - public static void main(String[] args) { - SpringApplication.run(SpringBootAnnotatedApp.class, args); - } - -} diff --git a/spring-custom-aop/src/main/java/com/baeldung/annotation/servletcomponentscan/SpringBootPlainApp.java b/spring-custom-aop/src/main/java/com/baeldung/annotation/servletcomponentscan/SpringBootPlainApp.java deleted file mode 100644 index 8a39078aac..0000000000 --- a/spring-custom-aop/src/main/java/com/baeldung/annotation/servletcomponentscan/SpringBootPlainApp.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.baeldung.annotation.servletcomponentscan; - -import org.springframework.boot.autoconfigure.SpringBootApplication; -import org.springframework.context.annotation.ComponentScan; - -@SpringBootApplication -@ComponentScan(basePackages = "com.baeldung.annotation.servletcomponentscan.components") -public class SpringBootPlainApp { - - public static void main(String[] args) { - } - -} diff --git a/spring-custom-aop/src/main/java/com/baeldung/annotation/servletcomponentscan/components/AttrListener.java b/spring-custom-aop/src/main/java/com/baeldung/annotation/servletcomponentscan/components/AttrListener.java deleted file mode 100644 index b1bdc7d781..0000000000 --- a/spring-custom-aop/src/main/java/com/baeldung/annotation/servletcomponentscan/components/AttrListener.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.baeldung.annotation.servletcomponentscan.components; - -import javax.servlet.ServletContextEvent; -import javax.servlet.ServletContextListener; -import javax.servlet.annotation.WebListener; - -@WebListener -public class AttrListener implements ServletContextListener { - - @Override - public void contextInitialized(ServletContextEvent servletContextEvent) { - servletContextEvent.getServletContext().setAttribute("servlet-context-attr", "test"); - System.out.println("context init"); - } - - @Override - public void contextDestroyed(ServletContextEvent servletContextEvent) { - System.out.println("context destroy"); - } - -} diff --git a/spring-custom-aop/src/main/java/com/baeldung/annotation/servletcomponentscan/components/EchoServlet.java b/spring-custom-aop/src/main/java/com/baeldung/annotation/servletcomponentscan/components/EchoServlet.java deleted file mode 100644 index d8192c2cb1..0000000000 --- a/spring-custom-aop/src/main/java/com/baeldung/annotation/servletcomponentscan/components/EchoServlet.java +++ /dev/null @@ -1,27 +0,0 @@ -package com.baeldung.annotation.servletcomponentscan.components; - -import javax.servlet.annotation.WebServlet; -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import java.io.File; -import java.io.IOException; -import java.nio.file.Files; -import java.nio.file.Path; -import java.nio.file.StandardCopyOption; - -@WebServlet(name = "echo servlet", urlPatterns = "/echo") -public class EchoServlet extends HttpServlet { - - @Override - public void doPost(HttpServletRequest request, HttpServletResponse response) { - try { - Path path = File.createTempFile("echo", "tmp").toPath(); - Files.copy(request.getInputStream(), path, StandardCopyOption.REPLACE_EXISTING); - Files.copy(path, response.getOutputStream()); - Files.delete(path); - } catch (IOException e) { - e.printStackTrace(); - } - } -} diff --git a/spring-custom-aop/src/main/java/com/baeldung/annotation/servletcomponentscan/components/HelloFilter.java b/spring-custom-aop/src/main/java/com/baeldung/annotation/servletcomponentscan/components/HelloFilter.java deleted file mode 100644 index 146e5ae386..0000000000 --- a/spring-custom-aop/src/main/java/com/baeldung/annotation/servletcomponentscan/components/HelloFilter.java +++ /dev/null @@ -1,30 +0,0 @@ -package com.baeldung.annotation.servletcomponentscan.components; - -import javax.servlet.*; -import javax.servlet.annotation.WebFilter; -import javax.servlet.annotation.WebInitParam; -import java.io.IOException; - -@WebFilter(urlPatterns = "/hello", description = "a filter for hello servlet", initParams = { @WebInitParam(name = "msg", value = "filtering ") }, filterName = "hello filter", servletNames = { "echo servlet" }) -public class HelloFilter implements Filter { - - private FilterConfig filterConfig; - - @Override - public void init(FilterConfig filterConfig) throws ServletException { - System.out.println("filter init"); - this.filterConfig = filterConfig; - } - - @Override - public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException { - servletResponse.getOutputStream().print(filterConfig.getInitParameter("msg")); - filterChain.doFilter(servletRequest, servletResponse); - } - - @Override - public void destroy() { - System.out.println("filter destroy"); - } - -} diff --git a/spring-custom-aop/src/main/java/com/baeldung/annotation/servletcomponentscan/components/HelloServlet.java b/spring-custom-aop/src/main/java/com/baeldung/annotation/servletcomponentscan/components/HelloServlet.java deleted file mode 100644 index 5269c1bf29..0000000000 --- a/spring-custom-aop/src/main/java/com/baeldung/annotation/servletcomponentscan/components/HelloServlet.java +++ /dev/null @@ -1,30 +0,0 @@ -package com.baeldung.annotation.servletcomponentscan.components; - -import javax.servlet.ServletConfig; -import javax.servlet.annotation.WebInitParam; -import javax.servlet.annotation.WebServlet; -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import java.io.IOException; - -@WebServlet(urlPatterns = "/hello", initParams = { @WebInitParam(name = "msg", value = "hello") }) -public class HelloServlet extends HttpServlet { - - private ServletConfig servletConfig; - - @Override - public void init(ServletConfig servletConfig) { - this.servletConfig = servletConfig; - } - - @Override - public void doGet(HttpServletRequest request, HttpServletResponse response) { - try { - response.getOutputStream().write(servletConfig.getInitParameter("msg").getBytes()); - } catch (IOException e) { - e.printStackTrace(); - } - } - -} diff --git a/spring-custom-aop/src/main/java/com/baeldung/git/CommitIdApplication.java b/spring-custom-aop/src/main/java/com/baeldung/git/CommitIdApplication.java deleted file mode 100644 index cd696eae70..0000000000 --- a/spring-custom-aop/src/main/java/com/baeldung/git/CommitIdApplication.java +++ /dev/null @@ -1,23 +0,0 @@ -package com.baeldung.git; - -import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.SpringBootApplication; -import org.springframework.context.annotation.Bean; -import org.springframework.context.support.PropertySourcesPlaceholderConfigurer; -import org.springframework.core.io.ClassPathResource; - -@SpringBootApplication(scanBasePackages = { "com.baeldung.git" }) -public class CommitIdApplication { - public static void main(String[] args) { - SpringApplication.run(CommitIdApplication.class, args); - } - - @Bean - public static PropertySourcesPlaceholderConfigurer placeholderConfigurer() { - PropertySourcesPlaceholderConfigurer c = new PropertySourcesPlaceholderConfigurer(); - c.setLocation(new ClassPathResource("git.properties")); - c.setIgnoreResourceNotFound(true); - c.setIgnoreUnresolvablePlaceholders(true); - return c; - } -} diff --git a/spring-custom-aop/src/main/java/com/baeldung/git/CommitInfoController.java b/spring-custom-aop/src/main/java/com/baeldung/git/CommitInfoController.java deleted file mode 100644 index 6d44e02ec2..0000000000 --- a/spring-custom-aop/src/main/java/com/baeldung/git/CommitInfoController.java +++ /dev/null @@ -1,30 +0,0 @@ -package com.baeldung.git; - -import org.springframework.beans.factory.annotation.Value; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; - -import java.util.HashMap; -import java.util.Map; - -@RestController -public class CommitInfoController { - - @Value("${git.commit.message.short}") - private String commitMessage; - - @Value("${git.branch}") - private String branch; - - @Value("${git.commit.id}") - private String commitId; - - @RequestMapping("/commitId") - public Map getCommitId() { - Map result = new HashMap<>(); - result.put("Commit message", commitMessage); - result.put("Commit branch", branch); - result.put("Commit id", commitId); - return result; - } -} diff --git a/spring-custom-aop/src/main/java/com/baeldung/git/README.md b/spring-custom-aop/src/main/java/com/baeldung/git/README.md deleted file mode 100644 index 7e6a597c28..0000000000 --- a/spring-custom-aop/src/main/java/com/baeldung/git/README.md +++ /dev/null @@ -1,2 +0,0 @@ -### Relevant Articles: -- [Injecting Git Information Into Spring](http://www.baeldung.com/spring-git-information) diff --git a/spring-custom-aop/src/main/java/com/baeldung/internationalization/InternationalizationApp.java b/spring-custom-aop/src/main/java/com/baeldung/internationalization/InternationalizationApp.java deleted file mode 100644 index c92d1c32e6..0000000000 --- a/spring-custom-aop/src/main/java/com/baeldung/internationalization/InternationalizationApp.java +++ /dev/null @@ -1,15 +0,0 @@ -package com.baeldung.internationalization; - -import javax.annotation.security.RolesAllowed; - -import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.SpringBootApplication; - -@SpringBootApplication -public class InternationalizationApp { - @RolesAllowed("*") - public static void main(String[] args) { - System.setProperty("security.basic.enabled", "false"); - SpringApplication.run(InternationalizationApp.class, args); - } -} diff --git a/spring-custom-aop/src/main/java/com/baeldung/internationalization/config/MvcConfig.java b/spring-custom-aop/src/main/java/com/baeldung/internationalization/config/MvcConfig.java deleted file mode 100644 index 59f7fd3ba5..0000000000 --- a/spring-custom-aop/src/main/java/com/baeldung/internationalization/config/MvcConfig.java +++ /dev/null @@ -1,38 +0,0 @@ -package com.baeldung.internationalization.config; - -import java.util.Locale; - -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.ComponentScan; -import org.springframework.context.annotation.Configuration; -import org.springframework.web.servlet.LocaleResolver; -import org.springframework.web.servlet.config.annotation.EnableWebMvc; -import org.springframework.web.servlet.config.annotation.InterceptorRegistry; -import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter; -import org.springframework.web.servlet.i18n.LocaleChangeInterceptor; -import org.springframework.web.servlet.i18n.SessionLocaleResolver; - -@Configuration -@EnableWebMvc -@ComponentScan(basePackages = "com.baeldung.internationalization.config") -public class MvcConfig extends WebMvcConfigurerAdapter { - - @Bean - public LocaleResolver localeResolver() { - SessionLocaleResolver slr = new SessionLocaleResolver(); - slr.setDefaultLocale(Locale.US); - return slr; - } - - @Bean - public LocaleChangeInterceptor localeChangeInterceptor() { - LocaleChangeInterceptor lci = new LocaleChangeInterceptor(); - lci.setParamName("lang"); - return lci; - } - - @Override - public void addInterceptors(InterceptorRegistry registry) { - registry.addInterceptor(localeChangeInterceptor()); - } -} diff --git a/spring-custom-aop/src/main/java/com/baeldung/internationalization/config/PageController.java b/spring-custom-aop/src/main/java/com/baeldung/internationalization/config/PageController.java deleted file mode 100644 index 96a534b853..0000000000 --- a/spring-custom-aop/src/main/java/com/baeldung/internationalization/config/PageController.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.baeldung.internationalization.config; - -import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.GetMapping; - -@Controller -public class PageController { - - @GetMapping("/international") - public String getInternationalPage() { - return "international"; - } - -} diff --git a/spring-custom-aop/src/main/java/com/baeldung/intro/controller/HomeController.java b/spring-custom-aop/src/main/java/com/baeldung/intro/controller/HomeController.java deleted file mode 100644 index 5c0cb2d2de..0000000000 --- a/spring-custom-aop/src/main/java/com/baeldung/intro/controller/HomeController.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.baeldung.intro.controller; - -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; - -@RestController -public class HomeController { - - @RequestMapping("/") - public String root() { - return "Index Page"; - } - - @RequestMapping("/local") - public String local() { - return "/local"; - } -} diff --git a/spring-custom-aop/src/main/java/com/baeldung/servlets/ApplicationMain.java b/spring-custom-aop/src/main/java/com/baeldung/servlets/ApplicationMain.java deleted file mode 100644 index a6ea3757fe..0000000000 --- a/spring-custom-aop/src/main/java/com/baeldung/servlets/ApplicationMain.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.baeldung.servlets; - -import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.SpringBootApplication; -import org.springframework.boot.builder.SpringApplicationBuilder; -import org.springframework.boot.web.support.SpringBootServletInitializer; - -@SpringBootApplication -public class ApplicationMain extends SpringBootServletInitializer { - - public static void main(String[] args) { - SpringApplication.run(ApplicationMain.class, args); - } - - @Override - protected SpringApplicationBuilder configure(SpringApplicationBuilder application) { - return application.sources(ApplicationMain.class); - } -} diff --git a/spring-custom-aop/src/main/java/com/baeldung/servlets/configuration/WebAppInitializer.java b/spring-custom-aop/src/main/java/com/baeldung/servlets/configuration/WebAppInitializer.java deleted file mode 100644 index eadd40355a..0000000000 --- a/spring-custom-aop/src/main/java/com/baeldung/servlets/configuration/WebAppInitializer.java +++ /dev/null @@ -1,32 +0,0 @@ -package com.baeldung.servlets.configuration; - -import org.springframework.web.WebApplicationInitializer; -import org.springframework.web.context.support.AnnotationConfigWebApplicationContext; -import org.springframework.web.context.support.XmlWebApplicationContext; -import org.springframework.web.servlet.DispatcherServlet; -import javax.servlet.ServletContext; -import javax.servlet.ServletException; -import javax.servlet.ServletRegistration; - -public class WebAppInitializer implements WebApplicationInitializer { - - public void onStartup(ServletContext container) throws ServletException { - - AnnotationConfigWebApplicationContext ctx = new AnnotationConfigWebApplicationContext(); - ctx.register(WebMvcConfigure.class); - ctx.setServletContext(container); - - ServletRegistration.Dynamic servletOne = container.addServlet("SpringProgrammaticDispatcherServlet", new DispatcherServlet(ctx)); - servletOne.setLoadOnStartup(1); - servletOne.addMapping("/"); - - XmlWebApplicationContext xctx = new XmlWebApplicationContext(); - xctx.setConfigLocation("/WEB-INF/context.xml"); - xctx.setServletContext(container); - - ServletRegistration.Dynamic servletTwo = container.addServlet("SpringProgrammaticXMLDispatcherServlet", new DispatcherServlet(xctx)); - servletTwo.setLoadOnStartup(1); - servletTwo.addMapping("/"); - } - -} diff --git a/spring-custom-aop/src/main/java/com/baeldung/servlets/configuration/WebMvcConfigure.java b/spring-custom-aop/src/main/java/com/baeldung/servlets/configuration/WebMvcConfigure.java deleted file mode 100644 index 8dea814bc7..0000000000 --- a/spring-custom-aop/src/main/java/com/baeldung/servlets/configuration/WebMvcConfigure.java +++ /dev/null @@ -1,38 +0,0 @@ -package com.baeldung.servlets.configuration; - -import org.springframework.boot.web.support.ErrorPageFilter; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.web.servlet.ViewResolver; -import org.springframework.web.servlet.config.annotation.DefaultServletHandlerConfigurer; -import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry; -import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter; -import org.springframework.web.servlet.resource.PathResourceResolver; -import org.springframework.web.servlet.view.InternalResourceViewResolver; - -@Configuration -public class WebMvcConfigure extends WebMvcConfigurerAdapter { - - @Bean - public ViewResolver getViewResolver() { - InternalResourceViewResolver resolver = new InternalResourceViewResolver(); - resolver.setPrefix("/WEB-INF/"); - resolver.setSuffix(".jsp"); - return resolver; - } - - @Override - public void configureDefaultServletHandling(DefaultServletHandlerConfigurer configurer) { - configurer.enable(); - } - - @Override - public void addResourceHandlers(ResourceHandlerRegistry registry) { - registry.addResourceHandler("/resources/**").addResourceLocations("/resources/").setCachePeriod(3600).resourceChain(true).addResolver(new PathResourceResolver()); - } - - @Bean - public ErrorPageFilter errorPageFilter() { - return new ErrorPageFilter(); - } -} diff --git a/spring-custom-aop/src/main/java/com/baeldung/servlets/props/Constants.java b/spring-custom-aop/src/main/java/com/baeldung/servlets/props/Constants.java deleted file mode 100644 index 6345d1f969..0000000000 --- a/spring-custom-aop/src/main/java/com/baeldung/servlets/props/Constants.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.baeldung.servlets.props; - -import org.springframework.beans.factory.annotation.Autowired; - -import java.util.Properties; - -public final class Constants { - - @Autowired - PropertySourcesLoader psl; - - public static final String breakLine = System.getProperty("line.separator"); - private static final PropertyLoader pl = new PropertyLoader(); - private static final Properties mainProps = pl.getProperties("custom.properties"); - public static final String DISPATCHER_SERVLET_NAME = mainProps.getProperty("dispatcher.servlet.name"); - public static final String DISPATCHER_SERVLET_MAPPING = mainProps.getProperty("dispatcher.servlet.mapping"); - private final String EXAMPLE_SERVLET_NAME = psl.getProperty("example.servlet.name"); - private final String EXAMPLE_SERVLET_MAPPING = psl.getProperty("example.servlet.mapping"); - -} diff --git a/spring-custom-aop/src/main/java/com/baeldung/servlets/props/PropertyLoader.java b/spring-custom-aop/src/main/java/com/baeldung/servlets/props/PropertyLoader.java deleted file mode 100644 index c29da45929..0000000000 --- a/spring-custom-aop/src/main/java/com/baeldung/servlets/props/PropertyLoader.java +++ /dev/null @@ -1,27 +0,0 @@ -package com.baeldung.servlets.props; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.io.IOException; -import java.io.InputStream; -import java.util.Properties; - -public class PropertyLoader { - private static final Logger log = LoggerFactory.getLogger(PropertyLoader.class); - - public Properties getProperties(String file) { - Properties prop = new Properties(); - InputStream input = null; - try { - input = getClass().getResourceAsStream(file); - prop.load(input); - if (input != null) { - input.close(); - } - } catch (IOException ex) { - log.error("IOException: " + ex); - } - return prop; - } -} diff --git a/spring-custom-aop/src/main/java/com/baeldung/servlets/props/PropertySourcesLoader.java b/spring-custom-aop/src/main/java/com/baeldung/servlets/props/PropertySourcesLoader.java deleted file mode 100644 index 21e8949653..0000000000 --- a/spring-custom-aop/src/main/java/com/baeldung/servlets/props/PropertySourcesLoader.java +++ /dev/null @@ -1,24 +0,0 @@ -package com.baeldung.servlets.props; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.context.annotation.ComponentScan; -import org.springframework.context.annotation.Configuration; -import org.springframework.context.annotation.PropertySource; -import org.springframework.core.env.ConfigurableEnvironment; - -@Configuration -@ComponentScan(basePackages = { "com.baeldung.*" }) -@PropertySource("classpath:custom.properties") -public class PropertySourcesLoader { - - private static final Logger log = LoggerFactory.getLogger(PropertySourcesLoader.class); - - @Autowired - ConfigurableEnvironment env; - - public String getProperty(String key) { - return env.getProperty(key); - } -} diff --git a/spring-custom-aop/src/main/java/com/baeldung/servlets/servlets/GenericCustomServlet.java b/spring-custom-aop/src/main/java/com/baeldung/servlets/servlets/GenericCustomServlet.java deleted file mode 100644 index 49dd9404b7..0000000000 --- a/spring-custom-aop/src/main/java/com/baeldung/servlets/servlets/GenericCustomServlet.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.baeldung.servlets.servlets; - -import javax.servlet.ServletException; -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import java.io.IOException; -import java.io.PrintWriter; - -public class GenericCustomServlet extends HttpServlet { - - @Override - protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { - response.setContentType("text/html"); - PrintWriter out = response.getWriter(); - out.println("

Hello World

"); - } -} diff --git a/spring-custom-aop/src/main/java/com/baeldung/servlets/servlets/javaee/AnnotationServlet.java b/spring-custom-aop/src/main/java/com/baeldung/servlets/servlets/javaee/AnnotationServlet.java deleted file mode 100644 index 992976ca0e..0000000000 --- a/spring-custom-aop/src/main/java/com/baeldung/servlets/servlets/javaee/AnnotationServlet.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.baeldung.servlets.servlets.javaee; - -import javax.servlet.ServletException; -import javax.servlet.annotation.WebServlet; -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import java.io.IOException; - -@WebServlet(name = "AnnotationServlet", description = "Example Servlet Using Annotations", urlPatterns = { "/annotationservlet" }) -public class AnnotationServlet extends HttpServlet { - private static final long serialVersionUID = 1L; - - @Override - protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { - request.getRequestDispatcher("/annotationservlet.jsp").forward(request, response); - } -} diff --git a/spring-custom-aop/src/main/java/com/baeldung/servlets/servlets/javaee/EEWebXmlServlet.java b/spring-custom-aop/src/main/java/com/baeldung/servlets/servlets/javaee/EEWebXmlServlet.java deleted file mode 100644 index c7b373064f..0000000000 --- a/spring-custom-aop/src/main/java/com/baeldung/servlets/servlets/javaee/EEWebXmlServlet.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.baeldung.servlets.servlets.javaee; - -import javax.servlet.ServletException; -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import java.io.IOException; -import java.io.PrintWriter; - -public class EEWebXmlServlet extends HttpServlet { - - private static final long serialVersionUID = 1L; - - @Override - protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { - response.setContentType("text/html"); - PrintWriter out = response.getWriter(); - out.println("

Hello World

"); - } -} diff --git a/spring-custom-aop/src/main/java/com/baeldung/servlets/servlets/springboot/SpringRegistrationBeanServlet.java b/spring-custom-aop/src/main/java/com/baeldung/servlets/servlets/springboot/SpringRegistrationBeanServlet.java deleted file mode 100644 index e3c225d429..0000000000 --- a/spring-custom-aop/src/main/java/com/baeldung/servlets/servlets/springboot/SpringRegistrationBeanServlet.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.baeldung.servlets.servlets.springboot; - -import com.baeldung.servlets.servlets.GenericCustomServlet; -import org.springframework.boot.web.servlet.ServletRegistrationBean; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; - -@Configuration -public class SpringRegistrationBeanServlet { - - @Bean - public ServletRegistrationBean genericCustomServlet() { - ServletRegistrationBean bean = new ServletRegistrationBean(new GenericCustomServlet(), "/springregistrationbeanservlet/*"); - bean.setLoadOnStartup(1); - return bean; - } -} diff --git a/spring-custom-aop/src/main/java/com/baeldung/servlets/servlets/springboot/embedded/EmbeddedTomcatExample.java b/spring-custom-aop/src/main/java/com/baeldung/servlets/servlets/springboot/embedded/EmbeddedTomcatExample.java deleted file mode 100644 index 9e460d03a8..0000000000 --- a/spring-custom-aop/src/main/java/com/baeldung/servlets/servlets/springboot/embedded/EmbeddedTomcatExample.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.baeldung.servlets.servlets.springboot.embedded; - -import org.springframework.boot.context.embedded.EmbeddedServletContainerFactory; -import org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; - -@Configuration -public class EmbeddedTomcatExample { - - @Bean - public EmbeddedServletContainerFactory servletContainer() { - TomcatEmbeddedServletContainerFactory tomcat = new TomcatEmbeddedServletContainerFactory(); - return tomcat; - } -} diff --git a/spring-custom-aop/src/main/java/com/baeldung/utils/controller/UtilsController.java b/spring-custom-aop/src/main/java/com/baeldung/utils/controller/UtilsController.java deleted file mode 100644 index 8c7f2f932a..0000000000 --- a/spring-custom-aop/src/main/java/com/baeldung/utils/controller/UtilsController.java +++ /dev/null @@ -1,48 +0,0 @@ -package com.baeldung.utils.controller; - -import javax.servlet.http.HttpServletRequest; - -import org.springframework.stereotype.Controller; -import org.springframework.ui.Model; -import org.springframework.web.bind.ServletRequestUtils; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.util.WebUtils; - -@Controller -public class UtilsController { - - @GetMapping("/utils") - public String webUtils(Model model) { - return "utils"; - } - - @PostMapping("/setParam") - public String post(HttpServletRequest request, Model model) { - String param = ServletRequestUtils.getStringParameter(request, "param", "DEFAULT"); - - // Long param = ServletRequestUtils.getLongParameter(request, "param",1L); - // boolean param = ServletRequestUtils.getBooleanParameter(request, "param", true); - // double param = ServletRequestUtils.getDoubleParameter(request, "param", 1000); - // float param = ServletRequestUtils.getFloatParameter(request, "param", (float) 1.00); - // int param = ServletRequestUtils.getIntParameter(request, "param", 100); - - // try { - // ServletRequestUtils.getRequiredStringParameter(request, "param"); - // } catch (ServletRequestBindingException e) { - // e.printStackTrace(); - // } - - WebUtils.setSessionAttribute(request, "parameter", param); - model.addAttribute("parameter", "You set: " + (String) WebUtils.getSessionAttribute(request, "parameter")); - return "utils"; - } - - @GetMapping("/other") - public String other(HttpServletRequest request, Model model) { - String param = (String) WebUtils.getSessionAttribute(request, "parameter"); - model.addAttribute("parameter", param); - return "other"; - } - -} diff --git a/spring-custom-aop/src/main/java/com/baeldung/webjar/TestController.java b/spring-custom-aop/src/main/java/com/baeldung/webjar/TestController.java deleted file mode 100644 index e8e7fd5ce9..0000000000 --- a/spring-custom-aop/src/main/java/com/baeldung/webjar/TestController.java +++ /dev/null @@ -1,15 +0,0 @@ -package com.baeldung.webjar; - -import org.springframework.stereotype.Controller; -import org.springframework.ui.Model; -import org.springframework.web.bind.annotation.RequestMapping; - -@Controller -public class TestController { - - @RequestMapping(value = "/") - public String welcome(Model model) { - return "index"; - } - -} diff --git a/spring-custom-aop/src/main/java/org/baeldung/Application.java b/spring-custom-aop/src/main/java/org/baeldung/Application.java deleted file mode 100644 index aae0c427a9..0000000000 --- a/spring-custom-aop/src/main/java/org/baeldung/Application.java +++ /dev/null @@ -1,13 +0,0 @@ -package org.baeldung; - -import org.springframework.boot.SpringApplication; -import org.springframework.context.ApplicationContext; - -@org.springframework.boot.autoconfigure.SpringBootApplication -public class Application { - private static ApplicationContext applicationContext; - - public static void main(String[] args) { - applicationContext = SpringApplication.run(Application.class, args); - } -} diff --git a/spring-custom-aop/src/main/java/org/baeldung/boot/components/FooService.java b/spring-custom-aop/src/main/java/org/baeldung/boot/components/FooService.java deleted file mode 100644 index 4ff8e9fdd4..0000000000 --- a/spring-custom-aop/src/main/java/org/baeldung/boot/components/FooService.java +++ /dev/null @@ -1,21 +0,0 @@ -package org.baeldung.boot.components; - -import org.baeldung.boot.model.Foo; -import org.baeldung.boot.repository.FooRepository; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; - -@Component -public class FooService { - - @Autowired - private FooRepository fooRepository; - - public Foo getFooWithId(Integer id) throws Exception { - return fooRepository.findOne(id); - } - - public Foo getFooWithName(String name) { - return fooRepository.findByName(name); - } -} \ No newline at end of file diff --git a/spring-custom-aop/src/main/java/org/baeldung/boot/exceptions/CommonException.java b/spring-custom-aop/src/main/java/org/baeldung/boot/exceptions/CommonException.java deleted file mode 100644 index e03b859eab..0000000000 --- a/spring-custom-aop/src/main/java/org/baeldung/boot/exceptions/CommonException.java +++ /dev/null @@ -1,13 +0,0 @@ -package org.baeldung.boot.exceptions; - -public class CommonException extends RuntimeException { - - /** - * - */ - private static final long serialVersionUID = 3080004140659213332L; - - public CommonException(String message) { - super(message); - } -} diff --git a/spring-custom-aop/src/main/java/org/baeldung/boot/exceptions/FooNotFoundException.java b/spring-custom-aop/src/main/java/org/baeldung/boot/exceptions/FooNotFoundException.java deleted file mode 100644 index 0b04bd2759..0000000000 --- a/spring-custom-aop/src/main/java/org/baeldung/boot/exceptions/FooNotFoundException.java +++ /dev/null @@ -1,13 +0,0 @@ -package org.baeldung.boot.exceptions; - -public class FooNotFoundException extends RuntimeException { - - /** - * - */ - private static final long serialVersionUID = 9042200028456133589L; - - public FooNotFoundException(String message) { - super(message); - } -} diff --git a/spring-custom-aop/src/main/java/org/baeldung/boot/model/Foo.java b/spring-custom-aop/src/main/java/org/baeldung/boot/model/Foo.java deleted file mode 100644 index d373e25b85..0000000000 --- a/spring-custom-aop/src/main/java/org/baeldung/boot/model/Foo.java +++ /dev/null @@ -1,45 +0,0 @@ -package org.baeldung.boot.model; - -import java.io.Serializable; - -import javax.persistence.Entity; -import javax.persistence.GeneratedValue; -import javax.persistence.Id; - -@Entity -public class Foo implements Serializable { - private static final long serialVersionUID = 1L; - @Id - @GeneratedValue - private Integer id; - private String name; - - public Foo() { - } - - public Foo(String name) { - this.name = name; - } - - public Foo(Integer id, String name) { - super(); - this.id = id; - this.name = name; - } - - 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; - } -} diff --git a/spring-custom-aop/src/main/java/org/baeldung/boot/repository/FooRepository.java b/spring-custom-aop/src/main/java/org/baeldung/boot/repository/FooRepository.java deleted file mode 100644 index 09d6975dba..0000000000 --- a/spring-custom-aop/src/main/java/org/baeldung/boot/repository/FooRepository.java +++ /dev/null @@ -1,8 +0,0 @@ -package org.baeldung.boot.repository; - -import org.baeldung.boot.model.Foo; -import org.springframework.data.jpa.repository.JpaRepository; - -public interface FooRepository extends JpaRepository { - public Foo findByName(String name); -} diff --git a/spring-custom-aop/src/main/java/org/baeldung/boot/service/FooController.java b/spring-custom-aop/src/main/java/org/baeldung/boot/service/FooController.java deleted file mode 100644 index d400c3bf9e..0000000000 --- a/spring-custom-aop/src/main/java/org/baeldung/boot/service/FooController.java +++ /dev/null @@ -1,26 +0,0 @@ -package org.baeldung.boot.service; - -import org.baeldung.boot.components.FooService; -import org.baeldung.boot.model.Foo; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.RequestParam; -import org.springframework.web.bind.annotation.RestController; - -@RestController -public class FooController { - - @Autowired - private FooService fooService; - - @GetMapping("/{id}") - public Foo getFooWithId(@PathVariable Integer id) throws Exception { - return fooService.getFooWithId(id); - } - - @GetMapping("/") - public Foo getFooWithName(@RequestParam String name) throws Exception { - return fooService.getFooWithName(name); - } -} \ No newline at end of file diff --git a/spring-custom-aop/src/main/java/org/baeldung/client/Details.java b/spring-custom-aop/src/main/java/org/baeldung/client/Details.java deleted file mode 100644 index 2ae3adc38f..0000000000 --- a/spring-custom-aop/src/main/java/org/baeldung/client/Details.java +++ /dev/null @@ -1,32 +0,0 @@ -package org.baeldung.client; - -public class Details { - - private String name; - - private String login; - - public Details() { - } - - public Details(String name, String login) { - this.name = name; - this.login = login; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getLogin() { - return login; - } - - public void setLogin(String login) { - this.login = login; - } -} diff --git a/spring-custom-aop/src/main/java/org/baeldung/client/DetailsServiceClient.java b/spring-custom-aop/src/main/java/org/baeldung/client/DetailsServiceClient.java deleted file mode 100644 index 51fa7c6181..0000000000 --- a/spring-custom-aop/src/main/java/org/baeldung/client/DetailsServiceClient.java +++ /dev/null @@ -1,20 +0,0 @@ -package org.baeldung.client; - -import org.springframework.boot.web.client.RestTemplateBuilder; -import org.springframework.stereotype.Service; -import org.springframework.web.client.RestTemplate; - -@Service -public class DetailsServiceClient { - - private final RestTemplate restTemplate; - - public DetailsServiceClient(RestTemplateBuilder restTemplateBuilder) { - restTemplate = restTemplateBuilder.build(); - } - - public Details getUserDetails(String name) { - return restTemplate.getForObject("/{name}/details", Details.class, name); - } - -} \ No newline at end of file diff --git a/spring-custom-aop/src/main/java/org/baeldung/common/error/MyCustomErrorController.java b/spring-custom-aop/src/main/java/org/baeldung/common/error/MyCustomErrorController.java deleted file mode 100644 index a50b88f94b..0000000000 --- a/spring-custom-aop/src/main/java/org/baeldung/common/error/MyCustomErrorController.java +++ /dev/null @@ -1,24 +0,0 @@ -package org.baeldung.common.error; - -import org.springframework.boot.autoconfigure.web.ErrorController; -import org.springframework.web.bind.annotation.RequestMapping; - -public class MyCustomErrorController implements ErrorController { - - private static final String PATH = "/error"; - - public MyCustomErrorController() { - // TODO Auto-generated constructor stub - } - - @RequestMapping(value = PATH) - public String error() { - return "Error heaven"; - } - - @Override - public String getErrorPath() { - return PATH; - } - -} diff --git a/spring-custom-aop/src/main/java/org/baeldung/common/error/SpringHelloServletRegistrationBean.java b/spring-custom-aop/src/main/java/org/baeldung/common/error/SpringHelloServletRegistrationBean.java deleted file mode 100644 index 774cf1b970..0000000000 --- a/spring-custom-aop/src/main/java/org/baeldung/common/error/SpringHelloServletRegistrationBean.java +++ /dev/null @@ -1,15 +0,0 @@ -package org.baeldung.common.error; - -import org.springframework.boot.web.servlet.ServletRegistrationBean; - -import javax.servlet.Servlet; - -public class SpringHelloServletRegistrationBean extends ServletRegistrationBean { - - public SpringHelloServletRegistrationBean() { - } - - public SpringHelloServletRegistrationBean(Servlet servlet, String... urlMappings) { - super(servlet, urlMappings); - } -} diff --git a/spring-custom-aop/src/main/java/org/baeldung/common/error/controller/ErrorController.java b/spring-custom-aop/src/main/java/org/baeldung/common/error/controller/ErrorController.java deleted file mode 100644 index 9e63418a02..0000000000 --- a/spring-custom-aop/src/main/java/org/baeldung/common/error/controller/ErrorController.java +++ /dev/null @@ -1,22 +0,0 @@ -package org.baeldung.common.error.controller; - -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; - -@RestController -public class ErrorController { - - public ErrorController() { - } - - @RequestMapping("/400") - String error400() { - return "Error Code: 400 occured."; - } - - @RequestMapping("/errorHeaven") - String errorHeaven() { - return "You have reached the heaven of errors!!!"; - } - -} diff --git a/spring-custom-aop/src/main/java/org/baeldung/common/properties/MyServletContainerCustomizationBean.java b/spring-custom-aop/src/main/java/org/baeldung/common/properties/MyServletContainerCustomizationBean.java deleted file mode 100644 index 3d239f8944..0000000000 --- a/spring-custom-aop/src/main/java/org/baeldung/common/properties/MyServletContainerCustomizationBean.java +++ /dev/null @@ -1,25 +0,0 @@ -package org.baeldung.common.properties; - -import org.springframework.boot.context.embedded.ConfigurableEmbeddedServletContainer; -import org.springframework.boot.context.embedded.EmbeddedServletContainerCustomizer; -import org.springframework.boot.web.servlet.ErrorPage; -import org.springframework.http.HttpStatus; -import org.springframework.stereotype.Component; - -@Component -public class MyServletContainerCustomizationBean implements EmbeddedServletContainerCustomizer { - - public MyServletContainerCustomizationBean() { - - } - - @Override - public void customize(ConfigurableEmbeddedServletContainer container) { - container.setPort(8084); - container.setContextPath("/springbootapp"); - - container.addErrorPages(new ErrorPage(HttpStatus.BAD_REQUEST, "/400")); - container.addErrorPages(new ErrorPage("/errorHeaven")); - } - -} diff --git a/spring-custom-aop/src/main/java/org/baeldung/common/resources/ExecutorServiceExitCodeGenerator.java b/spring-custom-aop/src/main/java/org/baeldung/common/resources/ExecutorServiceExitCodeGenerator.java deleted file mode 100644 index 07f57ec1ef..0000000000 --- a/spring-custom-aop/src/main/java/org/baeldung/common/resources/ExecutorServiceExitCodeGenerator.java +++ /dev/null @@ -1,29 +0,0 @@ -package org.baeldung.common.resources; - -import java.util.Objects; -import java.util.concurrent.ExecutorService; - -import org.springframework.boot.ExitCodeGenerator; - -public class ExecutorServiceExitCodeGenerator implements ExitCodeGenerator { - - private ExecutorService executorService; - - public ExecutorServiceExitCodeGenerator(ExecutorService executorService) { - } - - @Override - public int getExitCode() { - int returnCode = 0; - try { - if (!Objects.isNull(executorService)) { - executorService.shutdownNow(); - returnCode = 1; - } - } catch (SecurityException ex) { - returnCode = 0; - } - return returnCode; - } - -} diff --git a/spring-custom-aop/src/main/java/org/baeldung/config/WebConfig.java b/spring-custom-aop/src/main/java/org/baeldung/config/WebConfig.java deleted file mode 100644 index 4ef407823e..0000000000 --- a/spring-custom-aop/src/main/java/org/baeldung/config/WebConfig.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.baeldung.config; - -import org.baeldung.web.resolver.HeaderVersionArgumentResolver; -import org.springframework.context.annotation.Configuration; -import org.springframework.web.method.support.HandlerMethodArgumentResolver; -import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter; - -import java.util.List; - -@Configuration -public class WebConfig extends WebMvcConfigurerAdapter { - - @Override - public void addArgumentResolvers(final List argumentResolvers) { - argumentResolvers.add(new HeaderVersionArgumentResolver()); - } -} diff --git a/spring-custom-aop/src/main/java/org/baeldung/controller/GenericEntityController.java b/spring-custom-aop/src/main/java/org/baeldung/controller/GenericEntityController.java deleted file mode 100644 index 7d1ad7d899..0000000000 --- a/spring-custom-aop/src/main/java/org/baeldung/controller/GenericEntityController.java +++ /dev/null @@ -1,59 +0,0 @@ -package org.baeldung.controller; - -import org.baeldung.domain.GenericEntity; -import org.baeldung.domain.Modes; -import org.baeldung.web.resolver.Version; -import org.springframework.http.HttpStatus; -import org.springframework.http.ResponseEntity; -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; - -import java.time.LocalDateTime; -import java.util.ArrayList; -import java.util.List; - -@RestController -public class GenericEntityController { - private List entityList = new ArrayList<>(); - - { - entityList.add(new GenericEntity(1l, "entity_1")); - entityList.add(new GenericEntity(2l, "entity_2")); - entityList.add(new GenericEntity(3l, "entity_3")); - entityList.add(new GenericEntity(4l, "entity_4")); - } - - @RequestMapping("/entity/all") - public List findAll() { - return entityList; - } - - @RequestMapping(value = "/entity", method = RequestMethod.POST) - public GenericEntity addEntity(GenericEntity entity) { - entityList.add(entity); - return entity; - } - - @RequestMapping("/entity/findby/{id}") - public GenericEntity findById(@PathVariable Long id) { - return entityList.stream().filter(entity -> entity.getId().equals(id)).findFirst().get(); - } - - @GetMapping("/entity/findbydate/{date}") - public GenericEntity findByDate(@PathVariable("date") LocalDateTime date) { - return entityList.stream().findFirst().get(); - } - - @GetMapping("/entity/findbymode/{mode}") - public GenericEntity findByEnum(@PathVariable("mode") Modes mode) { - return entityList.stream().findFirst().get(); - } - - @GetMapping("/entity/findbyversion") - public ResponseEntity findByVersion(@Version String version) { - return version != null ? new ResponseEntity(entityList.stream().findFirst().get(), HttpStatus.OK) : new ResponseEntity(HttpStatus.NOT_FOUND); - } -} diff --git a/spring-custom-aop/src/main/java/org/baeldung/controller/servlet/HelloWorldServlet.java b/spring-custom-aop/src/main/java/org/baeldung/controller/servlet/HelloWorldServlet.java deleted file mode 100644 index fc8fefd77e..0000000000 --- a/spring-custom-aop/src/main/java/org/baeldung/controller/servlet/HelloWorldServlet.java +++ /dev/null @@ -1,43 +0,0 @@ -package org.baeldung.controller.servlet; - -import java.io.IOException; -import java.io.PrintWriter; -import java.util.Objects; - -import javax.servlet.ServletException; -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -public class HelloWorldServlet extends HttpServlet { - private static final long serialVersionUID = 1L; - - public HelloWorldServlet() { - super(); - } - - protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { - PrintWriter out = null; - try { - out = response.getWriter(); - out.println("HelloWorldServlet: GET METHOD"); - out.flush(); - } finally { - if (!Objects.isNull(out)) - out.close(); - } - } - - protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { - PrintWriter out = null; - try { - out = response.getWriter(); - out.println("HelloWorldServlet: POST METHOD"); - out.flush(); - } finally { - if (!Objects.isNull(out)) - out.close(); - } - } - -} diff --git a/spring-custom-aop/src/main/java/org/baeldung/controller/servlet/SpringHelloWorldServlet.java b/spring-custom-aop/src/main/java/org/baeldung/controller/servlet/SpringHelloWorldServlet.java deleted file mode 100644 index 16cff5b1fa..0000000000 --- a/spring-custom-aop/src/main/java/org/baeldung/controller/servlet/SpringHelloWorldServlet.java +++ /dev/null @@ -1,43 +0,0 @@ -package org.baeldung.controller.servlet; - -import java.io.IOException; -import java.io.PrintWriter; -import java.util.Objects; - -import javax.servlet.ServletException; -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -public class SpringHelloWorldServlet extends HttpServlet { - private static final long serialVersionUID = 1L; - - public SpringHelloWorldServlet() { - super(); - } - - protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { - PrintWriter out = null; - try { - out = response.getWriter(); - out.println("SpringHelloWorldServlet: GET METHOD"); - out.flush(); - } finally { - if (!Objects.isNull(out)) - out.close(); - } - } - - protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { - PrintWriter out = null; - try { - out = response.getWriter(); - out.println("SpringHelloWorldServlet: POST METHOD"); - out.flush(); - } finally { - if (!Objects.isNull(out)) - out.close(); - } - } - -} diff --git a/spring-custom-aop/src/main/java/org/baeldung/converter/StringToEnumConverterFactory.java b/spring-custom-aop/src/main/java/org/baeldung/converter/StringToEnumConverterFactory.java deleted file mode 100644 index 17c6fd06de..0000000000 --- a/spring-custom-aop/src/main/java/org/baeldung/converter/StringToEnumConverterFactory.java +++ /dev/null @@ -1,27 +0,0 @@ -package org.baeldung.converter; - -import org.springframework.core.convert.converter.Converter; -import org.springframework.core.convert.converter.ConverterFactory; -import org.springframework.stereotype.Component; - -@Component -public class StringToEnumConverterFactory implements ConverterFactory { - - private static class StringToEnumConverter implements Converter { - - private Class enumType; - - public StringToEnumConverter(Class enumType) { - this.enumType = enumType; - } - - public T convert(String source) { - return (T) Enum.valueOf(this.enumType, source.trim()); - } - } - - @Override - public Converter getConverter(final Class targetType) { - return new StringToEnumConverter(targetType); - } -} diff --git a/spring-custom-aop/src/main/java/org/baeldung/converter/StringToLocalDateTimeConverter.java b/spring-custom-aop/src/main/java/org/baeldung/converter/StringToLocalDateTimeConverter.java deleted file mode 100644 index cbb9e6ddb4..0000000000 --- a/spring-custom-aop/src/main/java/org/baeldung/converter/StringToLocalDateTimeConverter.java +++ /dev/null @@ -1,16 +0,0 @@ -package org.baeldung.converter; - -import org.springframework.core.convert.converter.Converter; -import org.springframework.stereotype.Component; - -import java.time.LocalDateTime; -import java.time.format.DateTimeFormatter; - -@Component -public class StringToLocalDateTimeConverter implements Converter { - - @Override - public LocalDateTime convert(final String source) { - return LocalDateTime.parse(source, DateTimeFormatter.ISO_LOCAL_DATE_TIME); - } -} diff --git a/spring-custom-aop/src/main/java/org/baeldung/domain/GenericEntity.java b/spring-custom-aop/src/main/java/org/baeldung/domain/GenericEntity.java deleted file mode 100644 index 7b1d27cb66..0000000000 --- a/spring-custom-aop/src/main/java/org/baeldung/domain/GenericEntity.java +++ /dev/null @@ -1,42 +0,0 @@ -package org.baeldung.domain; - -import javax.persistence.Entity; -import javax.persistence.GeneratedValue; -import javax.persistence.GenerationType; -import javax.persistence.Id; - -@Entity -public class GenericEntity { - @Id - @GeneratedValue(strategy = GenerationType.AUTO) - private Long id; - private String value; - - public GenericEntity() { - } - - public GenericEntity(String value) { - this.value = value; - } - - public GenericEntity(Long id, String value) { - this.id = id; - this.value = value; - } - - public Long getId() { - return id; - } - - public void setId(Long id) { - this.id = id; - } - - public String getValue() { - return value; - } - - public void setValue(String value) { - this.value = value; - } -} diff --git a/spring-custom-aop/src/main/java/org/baeldung/domain/Modes.java b/spring-custom-aop/src/main/java/org/baeldung/domain/Modes.java deleted file mode 100644 index 473406ef26..0000000000 --- a/spring-custom-aop/src/main/java/org/baeldung/domain/Modes.java +++ /dev/null @@ -1,6 +0,0 @@ -package org.baeldung.domain; - -public enum Modes { - - ALPHA, BETA; -} diff --git a/spring-custom-aop/src/main/java/org/baeldung/endpoints/CustomEndpoint.java b/spring-custom-aop/src/main/java/org/baeldung/endpoints/CustomEndpoint.java deleted file mode 100644 index 222a54c6ef..0000000000 --- a/spring-custom-aop/src/main/java/org/baeldung/endpoints/CustomEndpoint.java +++ /dev/null @@ -1,35 +0,0 @@ -package org.baeldung.endpoints; - -import java.util.ArrayList; -import java.util.List; - -import org.springframework.boot.actuate.endpoint.Endpoint; -import org.springframework.stereotype.Component; - -@Component -public class CustomEndpoint implements Endpoint> { - - public CustomEndpoint() { - - } - - public String getId() { - return "customEndpoint"; - } - - public boolean isEnabled() { - return true; - } - - public boolean isSensitive() { - return true; - } - - public List invoke() { - // Your logic to display the output - List messages = new ArrayList(); - messages.add("This is message 1"); - messages.add("This is message 2"); - return messages; - } -} diff --git a/spring-custom-aop/src/main/java/org/baeldung/endpoints/EndpointDTO.java b/spring-custom-aop/src/main/java/org/baeldung/endpoints/EndpointDTO.java deleted file mode 100644 index d12d6419e1..0000000000 --- a/spring-custom-aop/src/main/java/org/baeldung/endpoints/EndpointDTO.java +++ /dev/null @@ -1,39 +0,0 @@ -package org.baeldung.endpoints; - -public class EndpointDTO { - private String id; - private boolean enabled; - private boolean sensitive; - - public EndpointDTO(String id, boolean enabled, boolean sensitive) { - super(); - this.id = id; - this.enabled = enabled; - this.sensitive = sensitive; - } - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public boolean isEnabled() { - return enabled; - } - - public void setEnabled(boolean enabled) { - this.enabled = enabled; - } - - public boolean isSensitive() { - return sensitive; - } - - public void setSensitive(boolean sensitive) { - this.sensitive = sensitive; - } - -} diff --git a/spring-custom-aop/src/main/java/org/baeldung/endpoints/ListEndpoints.java b/spring-custom-aop/src/main/java/org/baeldung/endpoints/ListEndpoints.java deleted file mode 100644 index f434351a51..0000000000 --- a/spring-custom-aop/src/main/java/org/baeldung/endpoints/ListEndpoints.java +++ /dev/null @@ -1,24 +0,0 @@ -package org.baeldung.endpoints; - -import java.util.List; -import java.util.stream.Collectors; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.actuate.endpoint.AbstractEndpoint; -import org.springframework.boot.actuate.endpoint.Endpoint; -import org.springframework.stereotype.Component; - -@Component -public class ListEndpoints extends AbstractEndpoint> { - private List endpointDTOs; - - @Autowired - public ListEndpoints(List endpoints) { - super("listEndpoints"); - this.endpointDTOs = endpoints.stream().map(endpoint -> new EndpointDTO(endpoint.getId(), endpoint.isEnabled(), endpoint.isSensitive())).collect(Collectors.toList()); - } - - public List invoke() { - return this.endpointDTOs; - } -} \ No newline at end of file diff --git a/spring-custom-aop/src/main/java/org/baeldung/endpoints/MyHealthCheck.java b/spring-custom-aop/src/main/java/org/baeldung/endpoints/MyHealthCheck.java deleted file mode 100644 index 4410a02d47..0000000000 --- a/spring-custom-aop/src/main/java/org/baeldung/endpoints/MyHealthCheck.java +++ /dev/null @@ -1,22 +0,0 @@ -package org.baeldung.endpoints; - -import org.springframework.boot.actuate.health.Health; -import org.springframework.boot.actuate.health.HealthIndicator; -import org.springframework.stereotype.Component; - -@Component -public class MyHealthCheck implements HealthIndicator { - - public Health health() { - int errorCode = check(); // perform some specific health check - if (errorCode != 0) { - return Health.down().withDetail("Error Code", errorCode).withDetail("Description", "You custom MyHealthCheck endpoint is down").build(); - } - return Health.up().build(); - } - - public int check() { - // Your logic to check health - return 1; - } -} diff --git a/spring-custom-aop/src/main/java/org/baeldung/main/SpringBootApplication.java b/spring-custom-aop/src/main/java/org/baeldung/main/SpringBootApplication.java deleted file mode 100644 index b828a5b841..0000000000 --- a/spring-custom-aop/src/main/java/org/baeldung/main/SpringBootApplication.java +++ /dev/null @@ -1,68 +0,0 @@ -package org.baeldung.main; - -import org.baeldung.common.error.SpringHelloServletRegistrationBean; -import org.baeldung.common.resources.ExecutorServiceExitCodeGenerator; -import org.baeldung.controller.servlet.HelloWorldServlet; -import org.baeldung.controller.servlet.SpringHelloWorldServlet; -import org.baeldung.service.LoginService; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.EnableAutoConfiguration; -import org.springframework.context.ApplicationContext; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.ComponentScan; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; - -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; - -@RestController -@EnableAutoConfiguration -@ComponentScan({ "org.baeldung.common.error", "org.baeldung.common.error.controller", "org.baeldung.common.properties", "org.baeldung.common.resources", "org.baeldung.endpoints", "org.baeldung.service", "org.baeldung.monitor.jmx", "org.baeldung.service" }) -public class SpringBootApplication { - - private static ApplicationContext applicationContext; - - @Autowired - private LoginService service; - - @RequestMapping("/") - String home() { - service.login("admin", "admin".toCharArray()); - return "TADA!!! You are in Spring Boot Actuator test application."; - } - - public static void main(String[] args) { - applicationContext = SpringApplication.run(SpringBootApplication.class, args); - } - - @Bean - public ExecutorService executorService() { - return Executors.newFixedThreadPool(10); - } - - @Bean - public HelloWorldServlet helloWorldServlet() { - return new HelloWorldServlet(); - } - - @Bean - public SpringHelloServletRegistrationBean servletRegistrationBean() { - SpringHelloServletRegistrationBean bean = new SpringHelloServletRegistrationBean(new SpringHelloWorldServlet(), "/springHelloWorld/*"); - bean.setLoadOnStartup(1); - bean.addInitParameter("message", "SpringHelloWorldServlet special message"); - return bean; - } - - @Bean - @Autowired - public ExecutorServiceExitCodeGenerator executorServiceExitCodeGenerator(ExecutorService executorService) { - return new ExecutorServiceExitCodeGenerator(executorService); - } - - public void shutDown(ExecutorServiceExitCodeGenerator executorServiceExitCodeGenerator) { - SpringApplication.exit(applicationContext, executorServiceExitCodeGenerator); - } - -} diff --git a/spring-custom-aop/src/main/java/org/baeldung/monitor/jmx/MonitoringConfig.java b/spring-custom-aop/src/main/java/org/baeldung/monitor/jmx/MonitoringConfig.java deleted file mode 100644 index febe3336eb..0000000000 --- a/spring-custom-aop/src/main/java/org/baeldung/monitor/jmx/MonitoringConfig.java +++ /dev/null @@ -1,21 +0,0 @@ -package org.baeldung.monitor.jmx; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; - -import com.codahale.metrics.JmxReporter; -import com.codahale.metrics.MetricRegistry; - -@Configuration -public class MonitoringConfig { - @Autowired - private MetricRegistry registry; - - @Bean - public JmxReporter jmxReporter() { - JmxReporter reporter = JmxReporter.forRegistry(registry).build(); - reporter.start(); - return reporter; - } -} diff --git a/spring-custom-aop/src/main/java/org/baeldung/repository/GenericEntityRepository.java b/spring-custom-aop/src/main/java/org/baeldung/repository/GenericEntityRepository.java deleted file mode 100644 index 7bb1e6dcdc..0000000000 --- a/spring-custom-aop/src/main/java/org/baeldung/repository/GenericEntityRepository.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.baeldung.repository; - -import org.baeldung.domain.GenericEntity; -import org.springframework.data.jpa.repository.JpaRepository; - -public interface GenericEntityRepository extends JpaRepository { -} diff --git a/spring-custom-aop/src/main/java/org/baeldung/service/LoginService.java b/spring-custom-aop/src/main/java/org/baeldung/service/LoginService.java deleted file mode 100644 index 34840fad67..0000000000 --- a/spring-custom-aop/src/main/java/org/baeldung/service/LoginService.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.baeldung.service; - -public interface LoginService { - public boolean login(String userName, char[] password); -} diff --git a/spring-custom-aop/src/main/java/org/baeldung/service/LoginServiceImpl.java b/spring-custom-aop/src/main/java/org/baeldung/service/LoginServiceImpl.java deleted file mode 100644 index 2e5ef89c48..0000000000 --- a/spring-custom-aop/src/main/java/org/baeldung/service/LoginServiceImpl.java +++ /dev/null @@ -1,29 +0,0 @@ -package org.baeldung.service; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.actuate.metrics.CounterService; -import org.springframework.stereotype.Service; - -@Service -public class LoginServiceImpl implements LoginService { - - private CounterService counterService; - - @Autowired - public LoginServiceImpl(CounterService counterService) { - this.counterService = counterService; - } - - public boolean login(String userName, char[] password) { - boolean success; - if (userName.equals("admin") && "secret".toCharArray().equals(password)) { - counterService.increment("counter.login.success"); - success = true; - } else { - counterService.increment("counter.login.failure"); - success = false; - } - return success; - } - -} diff --git a/spring-custom-aop/src/main/java/org/baeldung/session/exception/Application.java b/spring-custom-aop/src/main/java/org/baeldung/session/exception/Application.java deleted file mode 100644 index 23d741b98c..0000000000 --- a/spring-custom-aop/src/main/java/org/baeldung/session/exception/Application.java +++ /dev/null @@ -1,23 +0,0 @@ -package org.baeldung.session.exception; - -import org.baeldung.boot.model.Foo; -import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.SpringBootApplication; -import org.springframework.boot.autoconfigure.domain.EntityScan; -import org.springframework.context.annotation.Bean; -import org.springframework.orm.jpa.vendor.HibernateJpaSessionFactoryBean; - -@EntityScan(basePackageClasses = Foo.class) -@SpringBootApplication -public class Application { - public static void main(String[] args) { - System.setProperty("spring.config.name", "exception"); - System.setProperty("spring.profiles.active", "exception"); - SpringApplication.run(Application.class, args); - } - - @Bean - public HibernateJpaSessionFactoryBean sessionFactory() { - return new HibernateJpaSessionFactoryBean(); - } -} diff --git a/spring-custom-aop/src/main/java/org/baeldung/session/exception/repository/FooRepository.java b/spring-custom-aop/src/main/java/org/baeldung/session/exception/repository/FooRepository.java deleted file mode 100644 index 679d691b26..0000000000 --- a/spring-custom-aop/src/main/java/org/baeldung/session/exception/repository/FooRepository.java +++ /dev/null @@ -1,10 +0,0 @@ -package org.baeldung.session.exception.repository; - -import org.baeldung.boot.model.Foo; - -public interface FooRepository { - - void save(Foo foo); - - Foo get(Integer id); -} diff --git a/spring-custom-aop/src/main/java/org/baeldung/session/exception/repository/FooRepositoryImpl.java b/spring-custom-aop/src/main/java/org/baeldung/session/exception/repository/FooRepositoryImpl.java deleted file mode 100644 index 83de888e5e..0000000000 --- a/spring-custom-aop/src/main/java/org/baeldung/session/exception/repository/FooRepositoryImpl.java +++ /dev/null @@ -1,25 +0,0 @@ -package org.baeldung.session.exception.repository; - -import org.baeldung.boot.model.Foo; -import org.hibernate.SessionFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.context.annotation.Profile; -import org.springframework.stereotype.Repository; - -@Profile("exception") -@Repository -public class FooRepositoryImpl implements FooRepository { - @Autowired - private SessionFactory sessionFactory; - - @Override - public void save(Foo foo) { - sessionFactory.getCurrentSession().saveOrUpdate(foo); - } - - @Override - public Foo get(Integer id) { - return sessionFactory.getCurrentSession().get(Foo.class, id); - } - -} \ No newline at end of file diff --git a/spring-custom-aop/src/main/java/org/baeldung/web/resolver/HeaderVersionArgumentResolver.java b/spring-custom-aop/src/main/java/org/baeldung/web/resolver/HeaderVersionArgumentResolver.java deleted file mode 100644 index 89a77f38d1..0000000000 --- a/spring-custom-aop/src/main/java/org/baeldung/web/resolver/HeaderVersionArgumentResolver.java +++ /dev/null @@ -1,26 +0,0 @@ -package org.baeldung.web.resolver; - -import org.springframework.core.MethodParameter; -import org.springframework.stereotype.Component; -import org.springframework.web.bind.support.WebDataBinderFactory; -import org.springframework.web.context.request.NativeWebRequest; -import org.springframework.web.method.support.HandlerMethodArgumentResolver; -import org.springframework.web.method.support.ModelAndViewContainer; - -import javax.servlet.http.HttpServletRequest; - -@Component -public class HeaderVersionArgumentResolver implements HandlerMethodArgumentResolver { - - @Override - public boolean supportsParameter(final MethodParameter methodParameter) { - return methodParameter.getParameterAnnotation(Version.class) != null; - } - - @Override - public Object resolveArgument(final MethodParameter methodParameter, final ModelAndViewContainer modelAndViewContainer, final NativeWebRequest nativeWebRequest, final WebDataBinderFactory webDataBinderFactory) throws Exception { - HttpServletRequest request = (HttpServletRequest) nativeWebRequest.getNativeRequest(); - - return request.getHeader("Version"); - } -} diff --git a/spring-custom-aop/src/main/java/org/baeldung/web/resolver/Version.java b/spring-custom-aop/src/main/java/org/baeldung/web/resolver/Version.java deleted file mode 100644 index 2a9e6e60b3..0000000000 --- a/spring-custom-aop/src/main/java/org/baeldung/web/resolver/Version.java +++ /dev/null @@ -1,11 +0,0 @@ -package org.baeldung.web.resolver; - -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.PARAMETER) -public @interface Version { -} diff --git a/spring-custom-aop/src/main/resources/application.properties b/spring-custom-aop/src/main/resources/application.properties deleted file mode 100644 index 72ed8795c9..0000000000 --- a/spring-custom-aop/src/main/resources/application.properties +++ /dev/null @@ -1,43 +0,0 @@ -server.port=8080 -server.contextPath=/springbootapp -management.port=8081 -management.address=127.0.0.1 - -endpoints.shutdown.enabled=true - -endpoints.jmx.domain=Spring Sample Application -endpoints.jmx.uniqueNames=true - -##jolokia.config.debug=true -##endpoints.jolokia.enabled=true -##endpoints.jolokia.path=jolokia - -spring.jmx.enabled=true -endpoints.jmx.enabled=true - -## for pretty printing of json when endpoints accessed over HTTP -http.mappers.jsonPrettyPrint=true - -## Configuring info endpoint -info.app.name=Spring Sample Application -info.app.description=This is my first spring boot application G1 -info.app.version=1.0.0 - -## Spring Security Configurations -security.user.name=admin1 -security.user.password=secret1 -management.security.role=SUPERUSER - -logging.level.org.springframework=INFO - -#Servlet Configuration -servlet.name=dispatcherExample -servlet.mapping=/dispatcherExampleURL - -#banner.charset=UTF-8 -#banner.location=classpath:banner.txt -#banner.image.location=classpath:banner.gif -#banner.image.width= //TODO -#banner.image.height= //TODO -#banner.image.margin= //TODO -#banner.image.invert= //TODO \ No newline at end of file diff --git a/spring-custom-aop/src/main/resources/banner.txt b/spring-custom-aop/src/main/resources/banner.txt deleted file mode 100644 index abfa666eb6..0000000000 --- a/spring-custom-aop/src/main/resources/banner.txt +++ /dev/null @@ -1,14 +0,0 @@ -@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ -@@@@@@@@@@@@@@@@@@@@@@@@@#@@@@@########@@@@@@@@@@@@@@@@@@@@@@@@...@@@@@@@@@:..@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ -@@@@@@@@@@@@@@@@@@@@@@#. @@@@@* *@@@@@@@@@@@@@@@@@@@@@ @@@@@@@@@. @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ -@@@@@@@@@@@@@@@@@#o @@@@@* @@@@@* @@@:*.*@@@@@@@: *8@@@ @@@@&:.#@. @o**@@@@**:@o*o@@:.:@@@@@:.o#@&*:@@@@ -@@@@@@@@@@@@* @@@@@* 8888 8@ @@@8 #@o 8@# .@ @@* :. @* @@@@ @. : &@ ** .@@@@ -@@@@@@@@@@. @ o@@@@@* *@@@o::& .* 8@@@@. @@ 8@@@@. @* @@@@ @. @@@& * @@@@# .@@@@ -@@@@@@@@@& @ @@@@@@* @@@@@@ 8 @@@@ .. o&&&&&&& @@ #@@@@. @* @@@@ @. @@@# * @@@@@ .@@@@ -@@@@@@@@@ @@o @@@@@@@* oooo* 8 @@@& @* @@@ # 88. 88. *& o#: @. @@@# *@ &#& .@@@@ -@@@@@@@@# @@@8 @@@@@@@* .*@@@#. *@@ @@@& :#@@@o .@@: *&@8 @o o@@: @. @@@# *@@#. :8# .@@@@ -@@@@@@@@@ @@@@ &@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@# o@@@@ @@@@@ -@@@@@& &@@@@ 8@@@@@@@@@8&8@@@@@#8#@@@o8@#&@@o&@@@&@@8@@&@@@@88@@8#@8&@@##@@@@@@#8@@#8@@88@@@@@ *@@@@@@@ -@@@# #@@@@#. @@@@@@@@@@@@@8@@8#o@&#@@@@o.@o*@@*.@@@.@&:8o8*@@@8&@@#@@@8@@@@8@#@@@8&@@@@@@#@@@@@@@@@@@@@@@@@@@ -@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ -@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ \ No newline at end of file diff --git a/spring-custom-aop/src/main/resources/custom.properties b/spring-custom-aop/src/main/resources/custom.properties deleted file mode 100644 index 34f31bcd50..0000000000 --- a/spring-custom-aop/src/main/resources/custom.properties +++ /dev/null @@ -1,4 +0,0 @@ -dispatcher.servlet.name=dispatcherExample -dispatcher.servlet.mapping=/dispatcherExampleURL -example.servlet.name=dispatcherExample -example.servlet.mapping=/dispatcherExampleURL \ No newline at end of file diff --git a/spring-custom-aop/src/main/resources/demo.properties b/spring-custom-aop/src/main/resources/demo.properties deleted file mode 100644 index 649b64f59b..0000000000 --- a/spring-custom-aop/src/main/resources/demo.properties +++ /dev/null @@ -1,6 +0,0 @@ -spring.output.ansi.enabled=never -server.port=7070 - -# Security -security.user.name=admin -security.user.password=password \ No newline at end of file diff --git a/spring-custom-aop/src/main/resources/messages.properties b/spring-custom-aop/src/main/resources/messages.properties deleted file mode 100644 index e4dbc44c3f..0000000000 --- a/spring-custom-aop/src/main/resources/messages.properties +++ /dev/null @@ -1,4 +0,0 @@ -greeting=Hello! Welcome to our website! -lang.change=Change the language -lang.eng=English -lang.fr=French \ No newline at end of file diff --git a/spring-custom-aop/src/main/resources/messages_fr.properties b/spring-custom-aop/src/main/resources/messages_fr.properties deleted file mode 100644 index ac5853717d..0000000000 --- a/spring-custom-aop/src/main/resources/messages_fr.properties +++ /dev/null @@ -1,4 +0,0 @@ -greeting=Bonjour! Bienvenue sur notre site! -lang.change=Changez la langue -lang.eng=Anglais -lang.fr=Francais \ No newline at end of file diff --git a/spring-custom-aop/src/main/webapp/WEB-INF/context.xml b/spring-custom-aop/src/main/webapp/WEB-INF/context.xml deleted file mode 100644 index 263bed4430..0000000000 --- a/spring-custom-aop/src/main/webapp/WEB-INF/context.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/spring-custom-aop/src/main/webapp/WEB-INF/dispatcher.xml b/spring-custom-aop/src/main/webapp/WEB-INF/dispatcher.xml deleted file mode 100644 index ade8e66777..0000000000 --- a/spring-custom-aop/src/main/webapp/WEB-INF/dispatcher.xml +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - - - - \ No newline at end of file diff --git a/spring-custom-aop/src/main/webapp/WEB-INF/web.xml b/spring-custom-aop/src/main/webapp/WEB-INF/web.xml deleted file mode 100644 index 60a4b079de..0000000000 --- a/spring-custom-aop/src/main/webapp/WEB-INF/web.xml +++ /dev/null @@ -1,40 +0,0 @@ - - - JSP - - index.html - index.htm - index.jsp - - - - - EEWebXmlServlet - com.baeldung.servlets.javaee.EEWebXmlServlet - - - - EEWebXmlServlet - /eewebxmlservlet - - - - - SpringBootWebXmlServlet - org.springframework.web.servlet.DispatcherServlet - - contextConfigLocation - /WEB-INF/dispatcher.xml - - 1 - - - - SpringBootWebXmlServlet - / - - - - diff --git a/spring-custom-aop/src/main/webapp/annotationservlet.jsp b/spring-custom-aop/src/main/webapp/annotationservlet.jsp deleted file mode 100644 index f21748df50..0000000000 --- a/spring-custom-aop/src/main/webapp/annotationservlet.jsp +++ /dev/null @@ -1 +0,0 @@ -

Annotation Servlet!

\ No newline at end of file diff --git a/spring-custom-aop/src/main/webapp/index.jsp b/spring-custom-aop/src/main/webapp/index.jsp deleted file mode 100644 index e534282777..0000000000 --- a/spring-custom-aop/src/main/webapp/index.jsp +++ /dev/null @@ -1 +0,0 @@ -

Hello!

\ No newline at end of file diff --git a/spring-custom-aop/src/test/java/com/baeldung/annotation/servletcomponentscan/SpringBootWithServletComponentIntegrationTest.java b/spring-custom-aop/src/test/java/com/baeldung/annotation/servletcomponentscan/SpringBootWithServletComponentIntegrationTest.java deleted file mode 100644 index f6d2a8c465..0000000000 --- a/spring-custom-aop/src/test/java/com/baeldung/annotation/servletcomponentscan/SpringBootWithServletComponentIntegrationTest.java +++ /dev/null @@ -1,61 +0,0 @@ -package com.baeldung.annotation.servletcomponentscan; - -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.boot.test.web.client.TestRestTemplate; -import org.springframework.http.HttpStatus; -import org.springframework.http.ResponseEntity; -import org.springframework.test.context.TestPropertySource; -import org.springframework.test.context.junit4.SpringRunner; - -import javax.servlet.FilterRegistration; -import javax.servlet.ServletContext; - -import static org.junit.Assert.*; - -@RunWith(SpringRunner.class) -@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.MOCK, classes = SpringBootAnnotatedApp.class) -@AutoConfigureMockMvc -@TestPropertySource(properties = { "security.basic.enabled=false" }) -public class SpringBootWithServletComponentIntegrationTest { - - @Autowired - private ServletContext servletContext; - - @Test - public void givenServletContext_whenAccessAttrs_thenFoundAttrsPutInServletListner() { - assertNotNull(servletContext); - assertNotNull(servletContext.getAttribute("servlet-context-attr")); - assertEquals("test", servletContext.getAttribute("servlet-context-attr")); - } - - @Test - public void givenServletContext_whenCheckHelloFilterMappings_thenCorrect() { - assertNotNull(servletContext); - FilterRegistration filterRegistration = servletContext.getFilterRegistration("hello filter"); - - assertNotNull(filterRegistration); - assertTrue(filterRegistration.getServletNameMappings().contains("echo servlet")); - } - - @Autowired - private TestRestTemplate restTemplate; - - @Test - public void givenServletFilter_whenGetHello_thenRequestFiltered() { - ResponseEntity responseEntity = this.restTemplate.getForEntity("/hello", String.class); - assertEquals(HttpStatus.OK, responseEntity.getStatusCode()); - assertEquals("filtering hello", responseEntity.getBody()); - } - - @Test - public void givenFilterAndServlet_whenPostEcho_thenEchoFiltered() { - ResponseEntity responseEntity = this.restTemplate.postForEntity("/echo", "echo", String.class); - assertEquals(HttpStatus.OK, responseEntity.getStatusCode()); - assertEquals("filtering echo", responseEntity.getBody()); - } - -} diff --git a/spring-custom-aop/src/test/java/com/baeldung/annotation/servletcomponentscan/SpringBootWithoutServletComponentIntegrationTest.java b/spring-custom-aop/src/test/java/com/baeldung/annotation/servletcomponentscan/SpringBootWithoutServletComponentIntegrationTest.java deleted file mode 100644 index e7e1d5486c..0000000000 --- a/spring-custom-aop/src/test/java/com/baeldung/annotation/servletcomponentscan/SpringBootWithoutServletComponentIntegrationTest.java +++ /dev/null @@ -1,52 +0,0 @@ -package com.baeldung.annotation.servletcomponentscan; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; - -import javax.servlet.FilterRegistration; -import javax.servlet.ServletContext; - -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.boot.test.web.client.TestRestTemplate; -import org.springframework.http.HttpStatus; -import org.springframework.http.ResponseEntity; -import org.springframework.test.context.TestPropertySource; -import org.springframework.test.context.junit4.SpringRunner; - -@RunWith(SpringRunner.class) -@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.MOCK, classes = SpringBootPlainApp.class) -@AutoConfigureMockMvc -@TestPropertySource(properties = { "security.basic.enabled=false" }) -public class SpringBootWithoutServletComponentIntegrationTest { - - @Autowired - private ServletContext servletContext; - - @Autowired - private TestRestTemplate restTemplate; - - @Test - public void givenServletContext_whenAccessAttrs_thenNotFound() { - assertNull(servletContext.getAttribute("servlet-context-attr")); - } - - @Test - public void givenServletFilter_whenGetHello_thenEndpointNotFound() { - ResponseEntity responseEntity = this.restTemplate.getForEntity("/hello", String.class); - assertEquals(HttpStatus.NOT_FOUND, responseEntity.getStatusCode()); - } - - @Test - public void givenServletContext_whenCheckFilterMappings_thenEmpty() { - assertNotNull(servletContext); - FilterRegistration filterRegistration = servletContext.getFilterRegistration("hello filter"); - - assertNull(filterRegistration); - } - -} diff --git a/spring-custom-aop/src/test/java/com/baeldung/git/CommitIdIntegrationTest.java b/spring-custom-aop/src/test/java/com/baeldung/git/CommitIdIntegrationTest.java deleted file mode 100644 index 348d594c05..0000000000 --- a/spring-custom-aop/src/test/java/com/baeldung/git/CommitIdIntegrationTest.java +++ /dev/null @@ -1,41 +0,0 @@ -package com.baeldung.git; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringRunner; - -import static org.assertj.core.api.Assertions.assertThat; - -@RunWith(SpringRunner.class) -@ContextConfiguration(classes = CommitIdApplication.class) -public class CommitIdIntegrationTest { - - private static final Logger LOG = LoggerFactory.getLogger(CommitIdIntegrationTest.class); - - @Value("${git.commit.message.short:UNKNOWN}") - private String commitMessage; - - @Value("${git.branch:UNKNOWN}") - private String branch; - - @Value("${git.commit.id:UNKNOWN}") - private String commitId; - - @Test - public void whenInjecting_shouldDisplay() throws Exception { - - LOG.info(commitId); - LOG.info(commitMessage); - LOG.info(branch); - - assertThat(commitMessage).isNotEqualTo("UNKNOWN"); - - assertThat(branch).isNotEqualTo("UNKNOWN"); - - assertThat(commitId).isNotEqualTo("UNKNOWN"); - } -} \ No newline at end of file diff --git a/spring-custom-aop/src/test/java/com/baeldung/intro/AppLiveTest.java b/spring-custom-aop/src/test/java/com/baeldung/intro/AppLiveTest.java deleted file mode 100644 index 83b893ae5c..0000000000 --- a/spring-custom-aop/src/test/java/com/baeldung/intro/AppLiveTest.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.baeldung.intro; - -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.TestPropertySource; -import org.springframework.test.context.junit4.SpringRunner; -import org.springframework.test.web.servlet.MockMvc; -import org.springframework.test.web.servlet.request.MockMvcRequestBuilders; - -import static org.hamcrest.Matchers.equalTo; -import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content; -import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; - -@RunWith(SpringRunner.class) -@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.MOCK) -@AutoConfigureMockMvc -@TestPropertySource(properties = { "security.basic.enabled=false" }) -public class AppLiveTest { - - @Autowired - private MockMvc mvc; - - @Test - public void getIndex() throws Exception { - mvc.perform(MockMvcRequestBuilders.get("/").accept(MediaType.APPLICATION_JSON)).andExpect(status().isOk()).andExpect(content().string(equalTo("Index Page"))); - } - - @Test - public void getLocal() throws Exception { - mvc.perform(MockMvcRequestBuilders.get("/local").accept(MediaType.APPLICATION_JSON)).andExpect(status().isOk()).andExpect(content().string(equalTo("/local"))); - } - -} \ No newline at end of file diff --git a/spring-custom-aop/src/test/java/com/baeldung/utils/UtilsControllerIntegrationTest.java b/spring-custom-aop/src/test/java/com/baeldung/utils/UtilsControllerIntegrationTest.java deleted file mode 100644 index 99e719d7e9..0000000000 --- a/spring-custom-aop/src/test/java/com/baeldung/utils/UtilsControllerIntegrationTest.java +++ /dev/null @@ -1,35 +0,0 @@ -package com.baeldung.utils; - -import org.junit.Before; -import org.junit.Test; -import org.mockito.InjectMocks; -import org.mockito.MockitoAnnotations; -import org.springframework.test.web.servlet.MockMvc; -import org.springframework.test.web.servlet.setup.MockMvcBuilders; - -import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post; -import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; - -import com.baeldung.utils.controller.UtilsController; - -public class UtilsControllerIntegrationTest { - - @InjectMocks - private UtilsController utilsController; - - private MockMvc mockMvc; - - @Before - public void setup() { - MockitoAnnotations.initMocks(this); - this.mockMvc = MockMvcBuilders.standaloneSetup(utilsController).build(); - - } - - @Test - public void givenParameter_setRequestParam_andSetSessionAttribute() throws Exception { - String param = "testparam"; - this.mockMvc.perform(post("/setParam").param("param", param).sessionAttr("parameter", param)).andExpect(status().isOk()); - } - -} diff --git a/spring-custom-aop/src/test/java/com/baeldung/webjar/WebjarsdemoApplicationIntegrationTest.java b/spring-custom-aop/src/test/java/com/baeldung/webjar/WebjarsdemoApplicationIntegrationTest.java deleted file mode 100644 index d6e71dcf6b..0000000000 --- a/spring-custom-aop/src/test/java/com/baeldung/webjar/WebjarsdemoApplicationIntegrationTest.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.baeldung.webjar; - -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 = WebjarsdemoApplication.class) -@WebAppConfiguration -public class WebjarsdemoApplicationIntegrationTest { - - @Test - public void contextLoads() { - } - -} diff --git a/spring-custom-aop/src/test/java/org/baeldung/SpringBootApplicationIntegrationTest.java b/spring-custom-aop/src/test/java/org/baeldung/SpringBootApplicationIntegrationTest.java deleted file mode 100644 index 87c59a4662..0000000000 --- a/spring-custom-aop/src/test/java/org/baeldung/SpringBootApplicationIntegrationTest.java +++ /dev/null @@ -1,66 +0,0 @@ -package org.baeldung; - -import static org.hamcrest.Matchers.equalTo; -import static org.hamcrest.Matchers.hasSize; -import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath; - -import org.baeldung.domain.Modes; -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.http.MediaType; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; -import org.springframework.test.context.web.WebAppConfiguration; -import org.springframework.test.web.servlet.MockMvc; -import org.springframework.test.web.servlet.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 java.nio.charset.Charset; - -@RunWith(SpringJUnit4ClassRunner.class) -@SpringBootTest(classes = Application.class) -@WebAppConfiguration -public class SpringBootApplicationIntegrationTest { - @Autowired - private WebApplicationContext webApplicationContext; - private MockMvc mockMvc; - - @Before - public void setupMockMvc() { - mockMvc = MockMvcBuilders.webAppContextSetup(webApplicationContext).build(); - } - - @Test - public void givenRequestHasBeenMade_whenMeetsAllOfGivenConditions_thenCorrect() throws Exception { - MediaType contentType = new MediaType(MediaType.APPLICATION_JSON.getType(), MediaType.APPLICATION_JSON.getSubtype(), Charset.forName("utf8")); - - mockMvc.perform(MockMvcRequestBuilders.get("/entity/all")).andExpect(MockMvcResultMatchers.status().isOk()).andExpect(MockMvcResultMatchers.content().contentType(contentType)).andExpect(jsonPath("$", hasSize(4))); - } - - @Test - public void givenRequestHasBeenMade_whenMeetsFindByDateOfGivenConditions_thenCorrect() throws Exception { - MediaType contentType = new MediaType(MediaType.APPLICATION_JSON.getType(), MediaType.APPLICATION_JSON.getSubtype(), Charset.forName("utf8")); - - mockMvc.perform(MockMvcRequestBuilders.get("/entity/findbydate/{date}", "2011-12-03T10:15:30")).andExpect(MockMvcResultMatchers.status().isOk()).andExpect(MockMvcResultMatchers.content().contentType(contentType)) - .andExpect(jsonPath("$.id", equalTo(1))); - } - - @Test - public void givenRequestHasBeenMade_whenMeetsFindByModeOfGivenConditions_thenCorrect() throws Exception { - MediaType contentType = new MediaType(MediaType.APPLICATION_JSON.getType(), MediaType.APPLICATION_JSON.getSubtype(), Charset.forName("utf8")); - - mockMvc.perform(MockMvcRequestBuilders.get("/entity/findbymode/{mode}", Modes.ALPHA.name())).andExpect(MockMvcResultMatchers.status().isOk()).andExpect(MockMvcResultMatchers.content().contentType(contentType)).andExpect(jsonPath("$.id", equalTo(1))); - } - - @Test - public void givenRequestHasBeenMade_whenMeetsFindByVersionOfGivenConditions_thenCorrect() throws Exception { - MediaType contentType = new MediaType(MediaType.APPLICATION_JSON.getType(), MediaType.APPLICATION_JSON.getSubtype(), Charset.forName("utf8")); - - mockMvc.perform(MockMvcRequestBuilders.get("/entity/findbyversion").header("Version", "1.0.0")).andExpect(MockMvcResultMatchers.status().isOk()).andExpect(MockMvcResultMatchers.content().contentType(contentType)) - .andExpect(jsonPath("$.id", equalTo(1))); - } -} diff --git a/spring-custom-aop/src/test/java/org/baeldung/SpringBootJPAIntegrationTest.java b/spring-custom-aop/src/test/java/org/baeldung/SpringBootJPAIntegrationTest.java deleted file mode 100644 index d4b19e6a1d..0000000000 --- a/spring-custom-aop/src/test/java/org/baeldung/SpringBootJPAIntegrationTest.java +++ /dev/null @@ -1,27 +0,0 @@ -package org.baeldung; - -import org.baeldung.domain.GenericEntity; -import org.baeldung.repository.GenericEntityRepository; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; - -@RunWith(SpringJUnit4ClassRunner.class) -@SpringBootTest(classes = Application.class) -public class SpringBootJPAIntegrationTest { - @Autowired - private GenericEntityRepository genericEntityRepository; - - @Test - public void givenGenericEntityRepository_whenSaveAndRetreiveEntity_thenOK() { - GenericEntity genericEntity = genericEntityRepository.save(new GenericEntity("test")); - GenericEntity foundedEntity = genericEntityRepository.findOne(genericEntity.getId()); - assertNotNull(foundedEntity); - assertEquals(genericEntity.getValue(), foundedEntity.getValue()); - } -} diff --git a/spring-custom-aop/src/test/java/org/baeldung/SpringBootMailIntegrationTest.java b/spring-custom-aop/src/test/java/org/baeldung/SpringBootMailIntegrationTest.java deleted file mode 100644 index 14386d73c1..0000000000 --- a/spring-custom-aop/src/test/java/org/baeldung/SpringBootMailIntegrationTest.java +++ /dev/null @@ -1,79 +0,0 @@ -package org.baeldung; - -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.mail.SimpleMailMessage; -import org.springframework.mail.javamail.JavaMailSender; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; -import org.subethamail.wiser.Wiser; -import org.subethamail.wiser.WiserMessage; - -import javax.mail.MessagingException; -import java.io.IOException; -import java.util.List; - -import static org.hamcrest.Matchers.hasSize; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertThat; - -@RunWith(SpringJUnit4ClassRunner.class) -@SpringBootTest(classes = Application.class) -public class SpringBootMailIntegrationTest { - @Autowired - private JavaMailSender javaMailSender; - - private Wiser wiser; - - private String userTo = "user2@localhost"; - private String userFrom = "user1@localhost"; - private String subject = "Test subject"; - private String textMail = "Text subject mail"; - - @Before - public void setUp() throws Exception { - final int TEST_PORT = 8025; - wiser = new Wiser(TEST_PORT); - wiser.start(); - } - - @After - public void tearDown() throws Exception { - wiser.stop(); - } - - @Test - public void givenMail_whenSendAndReceived_thenCorrect() throws Exception { - SimpleMailMessage message = composeEmailMessage(); - javaMailSender.send(message); - List messages = wiser.getMessages(); - - assertThat(messages, hasSize(1)); - WiserMessage wiserMessage = messages.get(0); - assertEquals(userFrom, wiserMessage.getEnvelopeSender()); - assertEquals(userTo, wiserMessage.getEnvelopeReceiver()); - assertEquals(subject, getSubject(wiserMessage)); - assertEquals(textMail, getMessage(wiserMessage)); - } - - private String getMessage(WiserMessage wiserMessage) throws MessagingException, IOException { - return wiserMessage.getMimeMessage().getContent().toString().trim(); - } - - private String getSubject(WiserMessage wiserMessage) throws MessagingException { - return wiserMessage.getMimeMessage().getSubject(); - } - - private SimpleMailMessage composeEmailMessage() { - SimpleMailMessage mailMessage = new SimpleMailMessage(); - mailMessage.setTo(userTo); - mailMessage.setReplyTo(userFrom); - mailMessage.setFrom(userFrom); - mailMessage.setSubject(subject); - mailMessage.setText(textMail); - return mailMessage; - } -} diff --git a/spring-custom-aop/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-custom-aop/src/test/java/org/baeldung/SpringContextIntegrationTest.java deleted file mode 100644 index 0384c67e26..0000000000 --- a/spring-custom-aop/src/test/java/org/baeldung/SpringContextIntegrationTest.java +++ /dev/null @@ -1,25 +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.annotation.servletcomponentscan.SpringBootAnnotatedApp; -import com.baeldung.annotation.servletcomponentscan.SpringBootPlainApp; -import com.baeldung.git.CommitIdApplication; -import com.baeldung.internationalization.InternationalizationApp; -import com.baeldung.intro.App; -import com.baeldung.servlets.ApplicationMain; -import com.baeldung.webjar.WebjarsdemoApplication; - -@RunWith(SpringRunner.class) -@SpringBootTest(classes = { SpringBootAnnotatedApp.class, SpringBootPlainApp.class, CommitIdApplication.class, - InternationalizationApp.class, App.class, ApplicationMain.class, Application.class, - WebjarsdemoApplication.class }) -public class SpringContextIntegrationTest { - - @Test - public void whenSpringContextIsBootstrapped_thenNoExceptions() { - } -} diff --git a/spring-custom-aop/src/test/java/org/baeldung/boot/ApplicationIntegrationTest.java b/spring-custom-aop/src/test/java/org/baeldung/boot/ApplicationIntegrationTest.java deleted file mode 100644 index 57a8abc1ee..0000000000 --- a/spring-custom-aop/src/test/java/org/baeldung/boot/ApplicationIntegrationTest.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.baeldung.boot; - -import org.baeldung.session.exception.Application; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.TestPropertySource; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; - -@RunWith(SpringJUnit4ClassRunner.class) -@SpringBootTest(classes = Application.class) -@TestPropertySource("classpath:exception.properties") -public class ApplicationIntegrationTest { - @Test - public void contextLoads() { - } -} diff --git a/spring-custom-aop/src/test/java/org/baeldung/boot/DemoApplicationIntegrationTest.java b/spring-custom-aop/src/test/java/org/baeldung/boot/DemoApplicationIntegrationTest.java deleted file mode 100644 index 4fcea35b4a..0000000000 --- a/spring-custom-aop/src/test/java/org/baeldung/boot/DemoApplicationIntegrationTest.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.baeldung.boot; - -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 = DemoApplication.class) -@WebAppConfiguration -public class DemoApplicationIntegrationTest { - - @Test - public void contextLoads() { - } -} diff --git a/spring-custom-aop/src/test/java/org/baeldung/boot/FooComponentIntegrationTest.java b/spring-custom-aop/src/test/java/org/baeldung/boot/FooComponentIntegrationTest.java deleted file mode 100644 index 07a5495e8a..0000000000 --- a/spring-custom-aop/src/test/java/org/baeldung/boot/FooComponentIntegrationTest.java +++ /dev/null @@ -1,68 +0,0 @@ -package org.baeldung.boot; - -import org.baeldung.boot.components.FooService; -import org.baeldung.boot.model.Foo; -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.boot.test.context.SpringBootTest.WebEnvironment; -import org.springframework.boot.test.mock.mockito.SpyBean; -import org.springframework.boot.test.web.client.TestRestTemplate; -import org.springframework.http.HttpStatus; -import org.springframework.http.ResponseEntity; -import org.springframework.test.context.junit4.SpringRunner; - -import java.util.HashMap; -import java.util.Map; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.mockito.Matchers.anyInt; -import static org.mockito.Mockito.doReturn; - -@RunWith(SpringRunner.class) -@SpringBootTest(classes = DemoApplication.class, webEnvironment = WebEnvironment.RANDOM_PORT) -public class FooComponentIntegrationTest { - - @Autowired - private TestRestTemplate testRestTemplate; - - @SpyBean - private FooService fooService; - - @Before - public void init() throws Exception { - Foo foo = new Foo(); - foo.setId(5); - foo.setName("MOCKED_FOO"); - - doReturn(foo).when(fooService).getFooWithId(anyInt()); - - // doCallRealMethod().when(fooComponent).getFooWithName(anyString()); - } - - @Test - public void givenInquiryingFooWithId_whenFooComponentIsMocked_thenAssertMockedResult() { - Map pathVariables = new HashMap<>(); - pathVariables.put("id", "1"); - ResponseEntity fooResponse = testRestTemplate.getForEntity("/{id}", Foo.class, pathVariables); - - assertNotNull(fooResponse); - assertEquals(HttpStatus.OK, fooResponse.getStatusCode()); - assertEquals(5, fooResponse.getBody().getId().longValue()); - assertEquals("MOCKED_FOO", fooResponse.getBody().getName()); - } - - @Test - public void givenInquiryingFooWithName_whenFooComponentIsMocked_thenAssertMockedResult() { - Map pathVariables = new HashMap<>(); - pathVariables.put("name", "Foo_Name"); - ResponseEntity fooResponse = testRestTemplate.getForEntity("/?name={name}", Foo.class, pathVariables); - - assertNotNull(fooResponse); - assertEquals(HttpStatus.OK, fooResponse.getStatusCode()); - assertEquals(1, fooResponse.getBody().getId().longValue()); - } -} \ No newline at end of file diff --git a/spring-custom-aop/src/test/java/org/baeldung/boot/FooIntegrationTest.java b/spring-custom-aop/src/test/java/org/baeldung/boot/FooIntegrationTest.java deleted file mode 100644 index 52728fbb5b..0000000000 --- a/spring-custom-aop/src/test/java/org/baeldung/boot/FooIntegrationTest.java +++ /dev/null @@ -1,43 +0,0 @@ -package org.baeldung.boot; - -import java.util.HashMap; -import java.util.Map; - -import org.baeldung.boot.DemoApplication; -import org.baeldung.boot.model.Foo; -import org.junit.Assert; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; -import org.springframework.boot.test.web.client.TestRestTemplate; -import org.springframework.http.HttpStatus; -import org.springframework.http.ResponseEntity; -import org.springframework.test.context.junit4.SpringRunner; - -@RunWith(SpringRunner.class) -@SpringBootTest(classes = DemoApplication.class, webEnvironment = WebEnvironment.RANDOM_PORT) -public class FooIntegrationTest { - - @Autowired - private TestRestTemplate testRestTemplate; - - @Test - public void givenInquiryingFooWithId_whenIdIsValid_thenHttpStatusOK() { - Map pathVariables = new HashMap(); - pathVariables.put("id", "1"); - ResponseEntity fooResponse = testRestTemplate.getForEntity("/{id}", Foo.class, pathVariables); - Assert.assertNotNull(fooResponse); - Assert.assertEquals(HttpStatus.OK, fooResponse.getStatusCode()); - } - - @Test - public void givenInquiryingFooWithName_whenNameIsValid_thenHttpStatusOK() { - Map pathVariables = new HashMap(); - pathVariables.put("name", "Foo_Name"); - ResponseEntity fooResponse = testRestTemplate.getForEntity("/?name={name}", Foo.class, pathVariables); - Assert.assertNotNull(fooResponse); - Assert.assertEquals(HttpStatus.OK, fooResponse.getStatusCode()); - } -} \ No newline at end of file diff --git a/spring-custom-aop/src/test/java/org/baeldung/boot/FooJPAIntegrationTest.java b/spring-custom-aop/src/test/java/org/baeldung/boot/FooJPAIntegrationTest.java deleted file mode 100644 index 40f1892be8..0000000000 --- a/spring-custom-aop/src/test/java/org/baeldung/boot/FooJPAIntegrationTest.java +++ /dev/null @@ -1,34 +0,0 @@ -package org.baeldung.boot; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; - -import org.baeldung.boot.model.Foo; -import org.baeldung.boot.repository.FooRepository; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest; -import org.springframework.boot.test.autoconfigure.orm.jpa.TestEntityManager; -import org.springframework.test.context.junit4.SpringRunner; - -@RunWith(SpringRunner.class) -@DataJpaTest -public class FooJPAIntegrationTest { - - @Autowired - private TestEntityManager entityManager; - - @Autowired - private FooRepository repository; - - @Test - public void findFooByName() { - this.entityManager.persist(new Foo("Foo_Name_2")); - Foo foo = this.repository.findByName("Foo_Name_2"); - assertNotNull(foo); - assertEquals("Foo_Name_2", foo.getName()); - // Due to having Insert query for Foo with Id 1, so TestEntityManager generates new Id of 2 - assertEquals(2l, foo.getId().longValue()); - } -} \ No newline at end of file diff --git a/spring-custom-aop/src/test/java/org/baeldung/boot/FooJsonIntegrationTest.java b/spring-custom-aop/src/test/java/org/baeldung/boot/FooJsonIntegrationTest.java deleted file mode 100644 index 939e66f356..0000000000 --- a/spring-custom-aop/src/test/java/org/baeldung/boot/FooJsonIntegrationTest.java +++ /dev/null @@ -1,34 +0,0 @@ -package org.baeldung.boot; - -import static org.assertj.core.api.Assertions.assertThat; - -import org.baeldung.boot.model.Foo; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.autoconfigure.json.JsonTest; -import org.springframework.boot.test.json.JacksonTester; -import org.springframework.test.context.junit4.SpringRunner; - -@RunWith(SpringRunner.class) -@JsonTest -public class FooJsonIntegrationTest { - - @Autowired - private JacksonTester json; - - @Test - public void testSerialize() throws Exception { - Foo foo = new Foo(3, "Foo_Name_3"); - assertThat(this.json.write(foo)).isEqualToJson("expected.json"); - assertThat(this.json.write(foo)).hasJsonPathStringValue("@.name"); - assertThat(this.json.write(foo)).extractingJsonPathStringValue("@.name").isEqualTo("Foo_Name_3"); - } - - @Test - public void testDeserialize() throws Exception { - String content = "{\"id\":4,\"name\":\"Foo_Name_4\"}"; - assertThat(this.json.parseObject(content).getName()).isEqualTo("Foo_Name_4"); - assertThat(this.json.parseObject(content).getId() == 4); - } -} \ No newline at end of file diff --git a/spring-custom-aop/src/test/java/org/baeldung/boot/repository/FooRepositoryIntegrationTest.java b/spring-custom-aop/src/test/java/org/baeldung/boot/repository/FooRepositoryIntegrationTest.java deleted file mode 100644 index a844b26b2d..0000000000 --- a/spring-custom-aop/src/test/java/org/baeldung/boot/repository/FooRepositoryIntegrationTest.java +++ /dev/null @@ -1,34 +0,0 @@ -package org.baeldung.boot.repository; - -import static org.junit.Assert.assertThat; - -import org.baeldung.boot.DemoApplicationIntegrationTest; -import org.baeldung.boot.model.Foo; - -import static org.hamcrest.Matchers.notNullValue; -import static org.hamcrest.Matchers.is; - -import org.junit.Before; -import org.junit.Test; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.transaction.annotation.Transactional; - -@Transactional -public class FooRepositoryIntegrationTest extends DemoApplicationIntegrationTest { - @Autowired - private FooRepository fooRepository; - - @Before - public void setUp() { - fooRepository.save(new Foo("Foo")); - fooRepository.save(new Foo("Bar")); - } - - @Test - public void testFindByName() { - Foo foo = fooRepository.findByName("Bar"); - assertThat(foo, notNullValue()); - assertThat(foo.getId(), is(2)); - } - -} diff --git a/spring-custom-aop/src/test/java/org/baeldung/boot/repository/HibernateSessionIntegrationTest.java b/spring-custom-aop/src/test/java/org/baeldung/boot/repository/HibernateSessionIntegrationTest.java deleted file mode 100644 index be992bcc36..0000000000 --- a/spring-custom-aop/src/test/java/org/baeldung/boot/repository/HibernateSessionIntegrationTest.java +++ /dev/null @@ -1,32 +0,0 @@ -package org.baeldung.boot.repository; - -import static org.hamcrest.CoreMatchers.is; -import static org.hamcrest.CoreMatchers.notNullValue; -import static org.junit.Assert.assertThat; - -import org.baeldung.boot.ApplicationIntegrationTest; -import org.baeldung.boot.model.Foo; -import org.baeldung.session.exception.repository.FooRepository; -import org.junit.Test; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.test.context.TestPropertySource; -import org.springframework.transaction.annotation.Transactional; - -@Transactional -@TestPropertySource("classpath:exception-hibernate.properties") -public class HibernateSessionIntegrationTest extends ApplicationIntegrationTest { - @Autowired - private FooRepository fooRepository; - - @Test - public void whenSavingWithCurrentSession_thenThrowNoException() { - Foo foo = new Foo("Exception Solved"); - fooRepository.save(foo); - foo = null; - foo = fooRepository.get(1); - - assertThat(foo, notNullValue()); - assertThat(foo.getId(), is(1)); - assertThat(foo.getName(), is("Exception Solved")); - } -} diff --git a/spring-custom-aop/src/test/java/org/baeldung/boot/repository/NoHibernateSessionIntegrationTest.java b/spring-custom-aop/src/test/java/org/baeldung/boot/repository/NoHibernateSessionIntegrationTest.java deleted file mode 100644 index 55b7fa7216..0000000000 --- a/spring-custom-aop/src/test/java/org/baeldung/boot/repository/NoHibernateSessionIntegrationTest.java +++ /dev/null @@ -1,21 +0,0 @@ -package org.baeldung.boot.repository; - -import org.baeldung.boot.ApplicationIntegrationTest; -import org.baeldung.boot.model.Foo; -import org.baeldung.session.exception.repository.FooRepository; -import org.hibernate.HibernateException; -import org.junit.Test; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.transaction.annotation.Transactional; - -@Transactional -public class NoHibernateSessionIntegrationTest extends ApplicationIntegrationTest { - @Autowired - private FooRepository fooRepository; - - @Test(expected = HibernateException.class) - public void whenSavingWithoutCurrentSession_thenThrowException() { - Foo foo = new Foo("Exception Thrown"); - fooRepository.save(foo); - } -} diff --git a/spring-custom-aop/src/test/java/org/baeldung/client/DetailsServiceClientIntegrationTest.java b/spring-custom-aop/src/test/java/org/baeldung/client/DetailsServiceClientIntegrationTest.java deleted file mode 100644 index 5627855aa3..0000000000 --- a/spring-custom-aop/src/test/java/org/baeldung/client/DetailsServiceClientIntegrationTest.java +++ /dev/null @@ -1,46 +0,0 @@ -package org.baeldung.client; - -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.boot.test.autoconfigure.web.client.RestClientTest; -import org.springframework.http.MediaType; -import org.springframework.test.context.junit4.SpringRunner; -import org.springframework.test.web.client.MockRestServiceServer; - -import static org.assertj.core.api.Assertions.assertThat; -import static org.springframework.test.web.client.match.MockRestRequestMatchers.requestTo; -import static org.springframework.test.web.client.response.MockRestResponseCreators.withSuccess; - -@RunWith(SpringRunner.class) -@RestClientTest(DetailsServiceClient.class) -public class DetailsServiceClientIntegrationTest { - - @Autowired - private DetailsServiceClient client; - - @Autowired - private MockRestServiceServer server; - - @Autowired - private ObjectMapper objectMapper; - - @Before - public void setUp() throws Exception { - String detailsString = objectMapper.writeValueAsString(new Details("John Smith", "john")); - this.server.expect(requestTo("/john/details")).andRespond(withSuccess(detailsString, MediaType.APPLICATION_JSON)); - } - - @Test - public void whenCallingGetUserDetails_thenClientExecutesCorrectCall() throws Exception { - - Details details = this.client.getUserDetails("john"); - - assertThat(details.getLogin()).isEqualTo("john"); - assertThat(details.getName()).isEqualTo("John Smith"); - - } - -} diff --git a/spring-custom-aop/src/test/resources/application.properties b/spring-custom-aop/src/test/resources/application.properties deleted file mode 100644 index 0e6cb86bc5..0000000000 --- a/spring-custom-aop/src/test/resources/application.properties +++ /dev/null @@ -1,5 +0,0 @@ -spring.mail.host=localhost -spring.mail.port=8025 -spring.mail.properties.mail.smtp.auth=false - -security.basic.enabled=false \ No newline at end of file diff --git a/spring-custom-aop/src/test/resources/exception-hibernate.properties b/spring-custom-aop/src/test/resources/exception-hibernate.properties deleted file mode 100644 index cde746acb9..0000000000 --- a/spring-custom-aop/src/test/resources/exception-hibernate.properties +++ /dev/null @@ -1,2 +0,0 @@ -spring.profiles.active=exception -spring.jpa.properties.hibernate.current_session_context_class=org.springframework.orm.hibernate4.SpringSessionContext diff --git a/spring-custom-aop/src/test/resources/exception.properties b/spring-custom-aop/src/test/resources/exception.properties deleted file mode 100644 index c55e415a3a..0000000000 --- a/spring-custom-aop/src/test/resources/exception.properties +++ /dev/null @@ -1,6 +0,0 @@ -# Security -security.user.name=admin -security.user.password=password - -spring.dao.exceptiontranslation.enabled=false -spring.profiles.active=exception \ No newline at end of file diff --git a/spring-custom-aop/src/test/resources/import.sql b/spring-custom-aop/src/test/resources/import.sql deleted file mode 100644 index a382410271..0000000000 --- a/spring-custom-aop/src/test/resources/import.sql +++ /dev/null @@ -1 +0,0 @@ -Insert into Foo values(1,'Foo_Name'); \ No newline at end of file diff --git a/spring-custom-aop/src/test/resources/org/baeldung/boot/expected.json b/spring-custom-aop/src/test/resources/org/baeldung/boot/expected.json deleted file mode 100644 index f5409421a6..0000000000 --- a/spring-custom-aop/src/test/resources/org/baeldung/boot/expected.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "id":3, - "name":"Foo_Name_3" -} \ No newline at end of file diff --git a/spring-data-rest/README.md b/spring-data-rest/README.md index 09f8391406..1624a3abfd 100644 --- a/spring-data-rest/README.md +++ b/spring-data-rest/README.md @@ -20,3 +20,5 @@ To view the running application, visit [http://localhost:8080](http://localhost: - [List of In-Memory Databases](http://www.baeldung.com/java-in-memory-databases) - [Projections and Excerpts in Spring Data REST](http://www.baeldung.com/spring-data-rest-projections-excerpts) - [Spring Data REST Events with @RepositoryEventHandler](http://www.baeldung.com/spring-data-rest-events) +- [Customizing HTTP Endpoints in Spring Data REST](https://www.baeldung.com/spring-data-rest-customize-http-endpoints) +- [Spring Boot with SQLite](https://www.baeldung.com/spring-boot-sqlite) diff --git a/spring-data-rest/pom.xml b/spring-data-rest/pom.xml index a756ef0497..2fe4715bac 100644 --- a/spring-data-rest/pom.xml +++ b/spring-data-rest/pom.xml @@ -33,6 +33,15 @@ com.h2database h2 + + org.springframework.boot + spring-boot-autoconfigure + + + org.xerial + sqlite-jdbc + ${sqlite.version} + @@ -42,4 +51,10 @@ ${project.artifactId} + + com.baeldung.SpringDataRestApplication + 3.25.2 + 2.1.0.RELEASE + + diff --git a/spring-data-rest/src/main/java/com/baeldung/config/DbConfig.java b/spring-data-rest/src/main/java/com/baeldung/config/DbConfig.java index 8d1f9de497..26d882d6a0 100644 --- a/spring-data-rest/src/main/java/com/baeldung/config/DbConfig.java +++ b/spring-data-rest/src/main/java/com/baeldung/config/DbConfig.java @@ -7,6 +7,7 @@ import javax.sql.DataSource; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.Profile; import org.springframework.context.annotation.PropertySource; import org.springframework.core.env.Environment; import org.springframework.data.jpa.repository.config.EnableJpaRepositories; @@ -14,11 +15,12 @@ import org.springframework.jdbc.datasource.DriverManagerDataSource; import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean; import org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter; -//@Configuration +@Configuration @EnableJpaRepositories(basePackages = "com.baeldung.repositories") // @PropertySource("persistence-h2.properties") // @PropertySource("persistence-hsqldb.properties") // @PropertySource("persistence-derby.properties") +//@PropertySource("persistence-sqlite.properties") public class DbConfig { @Autowired @@ -59,3 +61,25 @@ public class DbConfig { } } + +@Configuration +@Profile("h2") +@PropertySource("persistence-h2.properties") +class H2Config {} + +@Configuration +@Profile("hsqldb") +@PropertySource("persistence-hsqldb.properties") +class HsqldbConfig {} + + +@Configuration +@Profile("derby") +@PropertySource("persistence-derby.properties") +class DerbyConfig {} + + +@Configuration +@Profile("sqlite") +@PropertySource("persistence-sqlite.properties") +class SqliteConfig {} diff --git a/spring-data-rest/src/main/java/com/baeldung/config/RestConfig.java b/spring-data-rest/src/main/java/com/baeldung/config/RestConfig.java index 7434dde394..39f90e867b 100644 --- a/spring-data-rest/src/main/java/com/baeldung/config/RestConfig.java +++ b/spring-data-rest/src/main/java/com/baeldung/config/RestConfig.java @@ -1,17 +1,21 @@ package com.baeldung.config; +import com.baeldung.models.WebsiteUser; +import com.baeldung.projections.CustomBook; import org.springframework.context.annotation.Configuration; import org.springframework.data.rest.core.config.RepositoryRestConfiguration; -import org.springframework.data.rest.webmvc.config.RepositoryRestConfigurerAdapter; - -import com.baeldung.projections.CustomBook; - +import org.springframework.data.rest.core.mapping.ExposureConfiguration; +import org.springframework.data.rest.webmvc.config.RepositoryRestConfigurer; +import org.springframework.http.HttpMethod; @Configuration -public class RestConfig extends RepositoryRestConfigurerAdapter{ +public class RestConfig implements RepositoryRestConfigurer { @Override public void configureRepositoryRestConfiguration(RepositoryRestConfiguration repositoryRestConfiguration){ repositoryRestConfiguration.getProjectionConfiguration().addProjection(CustomBook.class); + ExposureConfiguration config = repositoryRestConfiguration.getExposureConfiguration(); + config.forDomainType(WebsiteUser.class).withItemExposure((metadata, httpMethods) -> + httpMethods.disable(HttpMethod.PATCH)); } } diff --git a/spring-data-rest/src/main/java/com/baeldung/dialect/SQLiteDialect.java b/spring-data-rest/src/main/java/com/baeldung/dialect/SQLiteDialect.java new file mode 100644 index 0000000000..4512f7d34d --- /dev/null +++ b/spring-data-rest/src/main/java/com/baeldung/dialect/SQLiteDialect.java @@ -0,0 +1,78 @@ +package com.baeldung.dialect; + +import org.hibernate.dialect.Dialect; +import org.hibernate.dialect.identity.IdentityColumnSupport; + +import java.sql.Types; + +public class SQLiteDialect extends Dialect { + + public SQLiteDialect() { + registerColumnType(Types.BIT, "integer"); + registerColumnType(Types.TINYINT, "tinyint"); + registerColumnType(Types.SMALLINT, "smallint"); + registerColumnType(Types.INTEGER, "integer"); + registerColumnType(Types.BIGINT, "bigint"); + registerColumnType(Types.FLOAT, "float"); + registerColumnType(Types.REAL, "real"); + registerColumnType(Types.DOUBLE, "double"); + registerColumnType(Types.NUMERIC, "numeric"); + registerColumnType(Types.DECIMAL, "decimal"); + registerColumnType(Types.CHAR, "char"); + registerColumnType(Types.VARCHAR, "varchar"); + registerColumnType(Types.LONGVARCHAR, "longvarchar"); + registerColumnType(Types.DATE, "date"); + registerColumnType(Types.TIME, "time"); + registerColumnType(Types.TIMESTAMP, "timestamp"); + registerColumnType(Types.BINARY, "blob"); + registerColumnType(Types.VARBINARY, "blob"); + registerColumnType(Types.LONGVARBINARY, "blob"); + registerColumnType(Types.BLOB, "blob"); + registerColumnType(Types.CLOB, "clob"); + registerColumnType(Types.BOOLEAN, "integer"); + } + + public IdentityColumnSupport getIdentityColumnSupport() { + return new SQLiteIdentityColumnSupport(); + } + + public boolean hasAlterTable() { + return false; + } + + public boolean dropConstraints() { + return false; + } + + public String getDropForeignKeyString() { + return ""; + } + + public String getAddForeignKeyConstraintString(String constraintName, String[] foreignKey, String referencedTable, String[] primaryKey, boolean referencesPrimaryKey) { + return ""; + } + + public String getAddPrimaryKeyConstraintString(String constraintName) { + return ""; + } + + public String getForUpdateString() { + return ""; + } + + public String getAddColumnString() { + return "add column"; + } + + public boolean supportsOuterJoinForUpdate() { + return false; + } + + public boolean supportsIfExistsBeforeTableName() { + return true; + } + + public boolean supportsCascadeDelete() { + return false; + } +} diff --git a/spring-data-rest/src/main/java/com/baeldung/dialect/SQLiteIdentityColumnSupport.java b/spring-data-rest/src/main/java/com/baeldung/dialect/SQLiteIdentityColumnSupport.java new file mode 100644 index 0000000000..cf6e3a9a97 --- /dev/null +++ b/spring-data-rest/src/main/java/com/baeldung/dialect/SQLiteIdentityColumnSupport.java @@ -0,0 +1,22 @@ +package com.baeldung.dialect; + +import org.hibernate.MappingException; +import org.hibernate.dialect.identity.IdentityColumnSupportImpl; + +public class SQLiteIdentityColumnSupport extends IdentityColumnSupportImpl { + + @Override + public boolean supportsIdentityColumns() { + return true; + } + + @Override + public String getIdentitySelectString(String table, String column, int type) throws MappingException { + return "select last_insert_rowid()"; + } + + @Override + public String getIdentityColumnString(int type) throws MappingException { + return "integer"; + } +} diff --git a/spring-data-rest/src/main/java/com/baeldung/repositories/UserRepository.java b/spring-data-rest/src/main/java/com/baeldung/repositories/UserRepository.java index 2bd9c025dd..a3fed1c318 100644 --- a/spring-data-rest/src/main/java/com/baeldung/repositories/UserRepository.java +++ b/spring-data-rest/src/main/java/com/baeldung/repositories/UserRepository.java @@ -1,12 +1,32 @@ package com.baeldung.repositories; import org.springframework.data.repository.CrudRepository; +import org.springframework.data.repository.query.Param; import org.springframework.data.rest.core.annotation.RepositoryRestResource; +import org.springframework.data.rest.core.annotation.RestResource; import org.springframework.web.bind.annotation.CrossOrigin; import com.baeldung.models.WebsiteUser; @CrossOrigin @RepositoryRestResource(collectionResourceRel = "users", path = "users") public interface UserRepository extends CrudRepository { - + + @Override + @RestResource(exported = false) + void delete(WebsiteUser entity); + + @Override + @RestResource(exported = false) + void deleteAll(); + + @Override + @RestResource(exported = false) + void deleteAll(Iterable entities); + + @Override + @RestResource(exported = false) + void deleteById(Long aLong); + + @RestResource(path = "byEmail", rel = "customFindMethod") + WebsiteUser findByEmail(@Param("email") String email); } diff --git a/spring-data-rest/src/main/resources/application.properties b/spring-data-rest/src/main/resources/application.properties index e69de29bb2..06cb22a4fe 100644 --- a/spring-data-rest/src/main/resources/application.properties +++ b/spring-data-rest/src/main/resources/application.properties @@ -0,0 +1 @@ +spring.profiles.default=h2 \ No newline at end of file diff --git a/spring-data-rest/src/main/resources/persistence-sqlite.properties b/spring-data-rest/src/main/resources/persistence-sqlite.properties index 018c2cbaca..b6b5f4e4d6 100644 --- a/spring-data-rest/src/main/resources/persistence-sqlite.properties +++ b/spring-data-rest/src/main/resources/persistence-sqlite.properties @@ -1,4 +1,7 @@ driverClassName=org.sqlite.JDBC -url=jdbc:sqlite:memory:myDb +url=jdbc:sqlite:memory:myDb?cache=shared username=sa -password=sa \ No newline at end of file +password=sa +hibernate.dialect=com.baeldung.dialect.SQLiteDialect +hibernate.hbm2ddl.auto=create-drop +hibernate.show_sql=true diff --git a/spring-data-rest/src/test/java/com/baeldung/validator/SpringDataRestValidatorIntegrationTest.java b/spring-data-rest/src/test/java/com/baeldung/validator/SpringDataRestValidatorIntegrationTest.java index 4c936ffc1c..d41736e434 100644 --- a/spring-data-rest/src/test/java/com/baeldung/validator/SpringDataRestValidatorIntegrationTest.java +++ b/spring-data-rest/src/test/java/com/baeldung/validator/SpringDataRestValidatorIntegrationTest.java @@ -1,11 +1,8 @@ package com.baeldung.validator; -import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; -import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post; -import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.redirectedUrl; -import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; -import static org.springframework.test.web.servlet.setup.MockMvcBuilders.webAppContextSetup; - +import com.baeldung.SpringDataRestApplication; +import com.baeldung.models.WebsiteUser; +import com.fasterxml.jackson.databind.ObjectMapper; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; @@ -17,9 +14,10 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import org.springframework.test.web.servlet.MockMvc; import org.springframework.web.context.WebApplicationContext; -import com.baeldung.SpringDataRestApplication; -import com.baeldung.models.WebsiteUser; -import com.fasterxml.jackson.databind.ObjectMapper; +import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.redirectedUrl; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; +import static org.springframework.test.web.servlet.setup.MockMvcBuilders.webAppContextSetup; @RunWith(SpringJUnit4ClassRunner.class) @SpringBootTest(classes = SpringDataRestApplication.class, webEnvironment = SpringBootTest.WebEnvironment.MOCK) @@ -84,4 +82,30 @@ public class SpringDataRestValidatorIntegrationTest { mockMvc.perform(post("/users", user).contentType(MediaType.APPLICATION_JSON).content(new ObjectMapper().writeValueAsString(user))).andExpect(status().isNotAcceptable()).andExpect(redirectedUrl(null)); } + @Test + public void whenDeletingCorrectUser_thenCorrectStatusCodeAndResponse() throws Exception { + WebsiteUser user = new WebsiteUser(); + user.setEmail("john.doe@john.com"); + user.setName("John Doe"); + mockMvc.perform(post("/users", user).contentType(MediaType.APPLICATION_JSON).content(new ObjectMapper().writeValueAsString(user))).andExpect(status().is2xxSuccessful()).andExpect(redirectedUrl("http://localhost/users/1")); + mockMvc.perform(delete("/users/1").contentType(MediaType.APPLICATION_JSON).content(new ObjectMapper().writeValueAsString(user))).andExpect(status().isMethodNotAllowed()); + } + + @Test + public void whenSearchingByEmail_thenCorrectStatusCodeAndResponse() throws Exception { + WebsiteUser user = new WebsiteUser(); + user.setEmail("john.doe@john.com"); + user.setName("John Doe"); + mockMvc.perform(post("/users", user).contentType(MediaType.APPLICATION_JSON).content(new ObjectMapper().writeValueAsString(user))).andExpect(status().is2xxSuccessful()).andExpect(redirectedUrl("http://localhost/users/1")); + mockMvc.perform(get("/users/search/byEmail").param("email", user.getEmail()).contentType(MediaType.APPLICATION_JSON)).andExpect(status().is2xxSuccessful()); + } + + @Test + public void whenSearchingByEmailWithOriginalMethodName_thenErrorStatusCodeAndResponse() throws Exception { + WebsiteUser user = new WebsiteUser(); + user.setEmail("john.doe@john.com"); + user.setName("John Doe"); + mockMvc.perform(post("/users", user).contentType(MediaType.APPLICATION_JSON).content(new ObjectMapper().writeValueAsString(user))).andExpect(status().is2xxSuccessful()).andExpect(redirectedUrl("http://localhost/users/1")); + mockMvc.perform(get("/users/search/findByEmail").param("email", user.getEmail()).contentType(MediaType.APPLICATION_JSON)).andExpect(status().isNotFound()); + } } diff --git a/spring-drools/pom.xml b/spring-drools/pom.xml index 8c65d5e34e..5bb2d6a8e9 100644 --- a/spring-drools/pom.xml +++ b/spring-drools/pom.xml @@ -5,7 +5,8 @@ com.baeldung spring-drools 1.0.0-SNAPSHOT - + spring-drools + com.baeldung parent-modules diff --git a/spring-ejb/README.md b/spring-ejb/README.md index d09b27db27..58ccb20e70 100644 --- a/spring-ejb/README.md +++ b/spring-ejb/README.md @@ -1,4 +1,9 @@ ### Relevant Articles +- [Guide to EJB Set-up](http://www.baeldung.com/ejb-intro) +- [Java EE Session Beans](http://www.baeldung.com/ejb-session-beans) +- [Introduction to EJB JNDI Lookup on WildFly Application Server](http://www.baeldung.com/wildfly-ejb-jndi) +- [A Guide to Message Driven Beans in EJB](http://www.baeldung.com/ejb-message-driven-beans) - [Integration Guide for Spring and EJB](http://www.baeldung.com/spring-ejb) - [Singleton Session Bean in Java EE](http://www.baeldung.com/java-ee-singleton-session-bean) + diff --git a/spring-ejb/ejb-beans/pom.xml b/spring-ejb/ejb-beans/pom.xml index 76c0afadee..168809ee6d 100644 --- a/spring-ejb/ejb-beans/pom.xml +++ b/spring-ejb/ejb-beans/pom.xml @@ -3,21 +3,31 @@ 4.0.0 com.baeldung.singletonsession ejb-beans - 1.0.0-SNAPSHOT - EJB Beans + spring-ejb-beans com.baeldung.spring.ejb spring-ejb - 1.0.1 + 1.0.0-SNAPSHOT + + + + org.jboss.arquillian + arquillian-bom + ${arquillian-bom.version} + import + pom + + + + javax javaee-api - ${javaee.version} provided @@ -26,10 +36,49 @@ tomee-embedded ${tomee-embedded.version} + + org.jboss.arquillian.junit + arquillian-junit-container + test + + + + arquillian-glassfish-embedded + + + org.jboss.arquillian.container + arquillian-glassfish-embedded-3.1 + ${arquillian-glassfish-embedded-3.1.version} + test + + + org.glassfish.main.extras + glassfish-embedded-all + ${glassfish-embedded-all.version} + test + + + + + + + + + maven-war-plugin + ${maven-war-plugin.version} + + false + + + + + 1.1.13.Final 1.7.5 + 3.1.2 + 1.0.0.CR4 diff --git a/ejb/ejb-session-beans/src/main/java/com/baeldung/ejb/stateful/EJBClient1.java b/spring-ejb/ejb-beans/src/main/java/com/baeldung/ejb/stateful/EJBClient1.java similarity index 100% rename from ejb/ejb-session-beans/src/main/java/com/baeldung/ejb/stateful/EJBClient1.java rename to spring-ejb/ejb-beans/src/main/java/com/baeldung/ejb/stateful/EJBClient1.java diff --git a/ejb/ejb-session-beans/src/main/java/com/baeldung/ejb/stateful/EJBClient2.java b/spring-ejb/ejb-beans/src/main/java/com/baeldung/ejb/stateful/EJBClient2.java similarity index 100% rename from ejb/ejb-session-beans/src/main/java/com/baeldung/ejb/stateful/EJBClient2.java rename to spring-ejb/ejb-beans/src/main/java/com/baeldung/ejb/stateful/EJBClient2.java diff --git a/ejb/ejb-session-beans/src/main/java/com/baeldung/ejb/stateful/StatefulEJB.java b/spring-ejb/ejb-beans/src/main/java/com/baeldung/ejb/stateful/StatefulEJB.java similarity index 100% rename from ejb/ejb-session-beans/src/main/java/com/baeldung/ejb/stateful/StatefulEJB.java rename to spring-ejb/ejb-beans/src/main/java/com/baeldung/ejb/stateful/StatefulEJB.java diff --git a/ejb/ejb-session-beans/src/main/java/com/baeldung/ejb/stateless/EJBClient1.java b/spring-ejb/ejb-beans/src/main/java/com/baeldung/ejb/stateless/EJBClient1.java similarity index 100% rename from ejb/ejb-session-beans/src/main/java/com/baeldung/ejb/stateless/EJBClient1.java rename to spring-ejb/ejb-beans/src/main/java/com/baeldung/ejb/stateless/EJBClient1.java diff --git a/ejb/ejb-session-beans/src/main/java/com/baeldung/ejb/stateless/EJBClient2.java b/spring-ejb/ejb-beans/src/main/java/com/baeldung/ejb/stateless/EJBClient2.java similarity index 100% rename from ejb/ejb-session-beans/src/main/java/com/baeldung/ejb/stateless/EJBClient2.java rename to spring-ejb/ejb-beans/src/main/java/com/baeldung/ejb/stateless/EJBClient2.java diff --git a/ejb/ejb-session-beans/src/main/java/com/baeldung/ejb/stateless/StatelessEJB.java b/spring-ejb/ejb-beans/src/main/java/com/baeldung/ejb/stateless/StatelessEJB.java similarity index 100% rename from ejb/ejb-session-beans/src/main/java/com/baeldung/ejb/stateless/StatelessEJB.java rename to spring-ejb/ejb-beans/src/main/java/com/baeldung/ejb/stateless/StatelessEJB.java diff --git a/ejb/ejb-session-beans/src/test/java/com/baeldung/ejb/test/stateful/StatefulEJBIntegrationTest.java b/spring-ejb/ejb-beans/src/test/java/com/baeldung/ejb/stateful/StatefulEJBIntegrationTest.java similarity index 97% rename from ejb/ejb-session-beans/src/test/java/com/baeldung/ejb/test/stateful/StatefulEJBIntegrationTest.java rename to spring-ejb/ejb-beans/src/test/java/com/baeldung/ejb/stateful/StatefulEJBIntegrationTest.java index cc35921e45..75f7132c62 100644 --- a/ejb/ejb-session-beans/src/test/java/com/baeldung/ejb/test/stateful/StatefulEJBIntegrationTest.java +++ b/spring-ejb/ejb-beans/src/test/java/com/baeldung/ejb/stateful/StatefulEJBIntegrationTest.java @@ -1,4 +1,4 @@ -package com.baeldung.ejb.test.stateful; +package com.baeldung.ejb.stateful; import org.jboss.arquillian.container.test.api.Deployment; import org.jboss.arquillian.junit.Arquillian; diff --git a/ejb/ejb-session-beans/src/test/java/com/baeldung/ejb/test/stateless/StatelessEJBIntegrationTest.java b/spring-ejb/ejb-beans/src/test/java/com/baeldung/ejb/stateless/StatelessEJBIntegrationTest.java similarity index 97% rename from ejb/ejb-session-beans/src/test/java/com/baeldung/ejb/test/stateless/StatelessEJBIntegrationTest.java rename to spring-ejb/ejb-beans/src/test/java/com/baeldung/ejb/stateless/StatelessEJBIntegrationTest.java index c80ca93c0d..a970ef90ae 100644 --- a/ejb/ejb-session-beans/src/test/java/com/baeldung/ejb/test/stateless/StatelessEJBIntegrationTest.java +++ b/spring-ejb/ejb-beans/src/test/java/com/baeldung/ejb/stateless/StatelessEJBIntegrationTest.java @@ -1,4 +1,4 @@ -package com.baeldung.ejb.test.stateless; +package com.baeldung.ejb.stateless; import org.jboss.arquillian.container.test.api.Deployment; import org.jboss.arquillian.junit.Arquillian; diff --git a/spring-ejb/ejb-beans/src/test/java/com/baeldung/singletonbean/CountryStateCacheBeanUnitTest.java b/spring-ejb/ejb-beans/src/test/java/com/baeldung/singletonbean/CountryStateCacheBeanUnitTest.java index 4cec01a4f7..615ddd1422 100644 --- a/spring-ejb/ejb-beans/src/test/java/com/baeldung/singletonbean/CountryStateCacheBeanUnitTest.java +++ b/spring-ejb/ejb-beans/src/test/java/com/baeldung/singletonbean/CountryStateCacheBeanUnitTest.java @@ -4,7 +4,6 @@ import static org.junit.Assert.assertArrayEquals; import static org.junit.Assert.assertNotNull; import java.util.Arrays; -import java.util.Collections; import java.util.List; import javax.ejb.embeddable.EJBContainer; @@ -22,7 +21,6 @@ public class CountryStateCacheBeanUnitTest { @Before public void init() { - ejbContainer = EJBContainer.createEJBContainer(); context = ejbContainer.getContext(); } diff --git a/spring-ejb/ejb-remote-for-spring/pom.xml b/spring-ejb/ejb-remote-for-spring/pom.xml deleted file mode 100755 index 21256fa801..0000000000 --- a/spring-ejb/ejb-remote-for-spring/pom.xml +++ /dev/null @@ -1,75 +0,0 @@ - - - 4.0.0 - ejb-remote-for-spring - ejb - - - com.baeldung.spring.ejb - spring-ejb - 1.0.1 - - - - - javax - javaee-api - provided - - - org.assertj - assertj-core - ${assertj.version} - test - - - - - - - - wildfly-standalone - - false - - - - - org.codehaus.cargo - cargo-maven2-plugin - ${cargo-maven2-plugin.version} - - - - - wildfly10x - - http://download.jboss.org/wildfly/12.0.0.Final/wildfly-12.0.0.Final.zip - - - - - - 127.0.0.1 - standalone-full - 9990 - testUser:admin1234! - - - - - - - - - - - - 3.9.0 - 1.6.1 - - - - - diff --git a/spring-ejb/pom.xml b/spring-ejb/pom.xml index 31cde720f9..688f692757 100755 --- a/spring-ejb/pom.xml +++ b/spring-ejb/pom.xml @@ -4,7 +4,6 @@ 4.0.0 com.baeldung.spring.ejb spring-ejb - 1.0.1 pom spring-ejb Spring EJB Tutorial @@ -36,8 +35,8 @@ com.baeldung.spring.ejb - ejb-remote-for-spring - ${ejb-remote-for-spring.version} + spring-ejb-remote + ${spring-ejb-remote.version} ejb @@ -71,12 +70,14 @@ - ejb-remote-for-spring + spring-ejb-remote ejb-beans + spring-ejb-client + wildfly - 1.0.1 + 1.0.0-SNAPSHOT 8.0 12.0.0.Final 2.4 diff --git a/spring-ejb/spring-ejb-client/pom.xml b/spring-ejb/spring-ejb-client/pom.xml index c935e1f14a..3d8003cbba 100644 --- a/spring-ejb/spring-ejb-client/pom.xml +++ b/spring-ejb/spring-ejb-client/pom.xml @@ -10,11 +10,22 @@ Spring EJB Client - com.baeldung - parent-boot-2 - 0.0.1-SNAPSHOT - ../../parent-boot-2 + com.baeldung.spring.ejb + spring-ejb + 1.0.0-SNAPSHOT + + + + + org.springframework.boot + spring-boot-dependencies + 2.0.4.RELEASE + pom + import + + + @@ -25,14 +36,12 @@ org.wildfly wildfly-ejb-client-bom - ${wildfly-ejb.version} pom com.baeldung.spring.ejb - ejb-remote-for-spring - ${ejb-remote-for-spring.version} + spring-ejb-remote ejb @@ -54,13 +63,9 @@ org.springframework.boot spring-boot-maven-plugin + 2.0.4.RELEASE - - 1.0.1 - 12.0.0.Final - - diff --git a/ejb/ejb-client/src/main/java/com/baeldung/ejb/client/EJBClient.java b/spring-ejb/spring-ejb-client/src/main/java/com/baeldung/ejb/client/EJBClient.java old mode 100755 new mode 100644 similarity index 97% rename from ejb/ejb-client/src/main/java/com/baeldung/ejb/client/EJBClient.java rename to spring-ejb/spring-ejb-client/src/main/java/com/baeldung/ejb/client/EJBClient.java index ebd6ef1b97..0c87e927a6 --- a/ejb/ejb-client/src/main/java/com/baeldung/ejb/client/EJBClient.java +++ b/spring-ejb/spring-ejb-client/src/main/java/com/baeldung/ejb/client/EJBClient.java @@ -41,7 +41,7 @@ public class EJBClient { // Since we haven't deployed the application as a .ear, the app name for // us will be an empty string final String appName = ""; - final String moduleName = "remote"; + final String moduleName = "spring-ejb-remote"; final String distinctName = ""; final String beanName = "HelloWorld"; final String viewClassName = HelloWorld.class.getName(); diff --git a/ejb/ejb-client/src/main/java/com/baeldung/ejb/wildfly/TextApplication.java b/spring-ejb/spring-ejb-client/src/main/java/com/baeldung/ejb/wildfly/TextApplication.java similarity index 96% rename from ejb/ejb-client/src/main/java/com/baeldung/ejb/wildfly/TextApplication.java rename to spring-ejb/spring-ejb-client/src/main/java/com/baeldung/ejb/wildfly/TextApplication.java index 3b63761c73..40264ff5e2 100644 --- a/ejb/ejb-client/src/main/java/com/baeldung/ejb/wildfly/TextApplication.java +++ b/spring-ejb/spring-ejb-client/src/main/java/com/baeldung/ejb/wildfly/TextApplication.java @@ -21,7 +21,7 @@ public class TextApplication { private static TextProcessorRemote lookupTextProcessorBean(String namespace) throws NamingException { Context ctx = createInitialContext(); final String appName = ""; - final String moduleName = "EJBModule"; + final String moduleName = "spring-ejb-remote"; final String distinctName = ""; final String beanName = TextProcessorBean.class.getSimpleName(); final String viewClassName = TextProcessorRemote.class.getName(); diff --git a/spring-ejb/spring-ejb-client/src/main/java/com/baeldung/springejbclient/SpringEjbClientApplication.java b/spring-ejb/spring-ejb-client/src/main/java/com/baeldung/springejbclient/SpringEjbClientApplication.java index 0a1e389113..554fac3417 100644 --- a/spring-ejb/spring-ejb-client/src/main/java/com/baeldung/springejbclient/SpringEjbClientApplication.java +++ b/spring-ejb/spring-ejb-client/src/main/java/com/baeldung/springejbclient/SpringEjbClientApplication.java @@ -37,7 +37,7 @@ public class SpringEjbClientApplication { @SuppressWarnings("rawtypes") private String getFullName(Class classType) { - String moduleName = "ejb-remote-for-spring/"; + String moduleName = "spring-ejb-remote/"; String beanName = classType.getSimpleName(); String viewClassName = classType.getName(); diff --git a/ejb/ejb-client/src/main/resources/jboss-ejb-client.properties b/spring-ejb/spring-ejb-client/src/main/resources/jboss-ejb-client.properties old mode 100755 new mode 100644 similarity index 100% rename from ejb/ejb-client/src/main/resources/jboss-ejb-client.properties rename to spring-ejb/spring-ejb-client/src/main/resources/jboss-ejb-client.properties diff --git a/ejb/ejb-client/src/test/java/com/baeldung/ejb/setup/test/EJBSetupIntegrationTest.java b/spring-ejb/spring-ejb-client/src/test/java/com/baeldung/ejb/setup/test/EJBSetupIntegrationTest.java old mode 100755 new mode 100644 similarity index 100% rename from ejb/ejb-client/src/test/java/com/baeldung/ejb/setup/test/EJBSetupIntegrationTest.java rename to spring-ejb/spring-ejb-client/src/test/java/com/baeldung/ejb/setup/test/EJBSetupIntegrationTest.java diff --git a/ejb/ejb-client/src/test/java/com/baeldung/ejb/wildfly/TextApplicationIntegrationTest.java b/spring-ejb/spring-ejb-client/src/test/java/com/baeldung/ejb/wildfly/TextApplicationIntegrationTest.java similarity index 100% rename from ejb/ejb-client/src/test/java/com/baeldung/ejb/wildfly/TextApplicationIntegrationTest.java rename to spring-ejb/spring-ejb-client/src/test/java/com/baeldung/ejb/wildfly/TextApplicationIntegrationTest.java diff --git a/ejb/ejb-remote/pom.xml b/spring-ejb/spring-ejb-remote/pom.xml old mode 100755 new mode 100644 similarity index 80% rename from ejb/ejb-remote/pom.xml rename to spring-ejb/spring-ejb-remote/pom.xml index dac2fefb84..797cc3ac68 --- a/ejb/ejb-remote/pom.xml +++ b/spring-ejb/spring-ejb-remote/pom.xml @@ -2,13 +2,14 @@ 4.0.0 - ejb-remote + spring-ejb-remote ejb - + spring-ejb-remote + - com.baeldung.ejb - ejb - 1.0-SNAPSHOT + com.baeldung.spring.ejb + spring-ejb + 1.0.0-SNAPSHOT @@ -17,14 +18,21 @@ javaee-api provided + + org.assertj + assertj-core + ${assertj.version} + test + + - + wildfly-standalone - true + false @@ -38,13 +46,14 @@ wildfly10x - http://download.jboss.org/wildfly/10.1.0.Final/wildfly-10.1.0.Final.zip + http://download.jboss.org/wildfly/12.0.0.Final/wildfly-12.0.0.Final.zip 127.0.0.1 + standalone-full 9990 testUser:admin1234! @@ -82,7 +91,7 @@ - 7.0 + 3.9.0 1.6.1 1.1.0.Alpha5 diff --git a/spring-ejb/ejb-remote-for-spring/src/main/java/com/baeldung/ejb/tutorial/HelloStatefulWorld.java b/spring-ejb/spring-ejb-remote/src/main/java/com/baeldung/ejb/tutorial/HelloStatefulWorld.java similarity index 100% rename from spring-ejb/ejb-remote-for-spring/src/main/java/com/baeldung/ejb/tutorial/HelloStatefulWorld.java rename to spring-ejb/spring-ejb-remote/src/main/java/com/baeldung/ejb/tutorial/HelloStatefulWorld.java diff --git a/spring-ejb/ejb-remote-for-spring/src/main/java/com/baeldung/ejb/tutorial/HelloStatefulWorldBean.java b/spring-ejb/spring-ejb-remote/src/main/java/com/baeldung/ejb/tutorial/HelloStatefulWorldBean.java similarity index 100% rename from spring-ejb/ejb-remote-for-spring/src/main/java/com/baeldung/ejb/tutorial/HelloStatefulWorldBean.java rename to spring-ejb/spring-ejb-remote/src/main/java/com/baeldung/ejb/tutorial/HelloStatefulWorldBean.java diff --git a/spring-ejb/ejb-remote-for-spring/src/main/java/com/baeldung/ejb/tutorial/HelloStatelessWorld.java b/spring-ejb/spring-ejb-remote/src/main/java/com/baeldung/ejb/tutorial/HelloStatelessWorld.java old mode 100755 new mode 100644 similarity index 100% rename from spring-ejb/ejb-remote-for-spring/src/main/java/com/baeldung/ejb/tutorial/HelloStatelessWorld.java rename to spring-ejb/spring-ejb-remote/src/main/java/com/baeldung/ejb/tutorial/HelloStatelessWorld.java diff --git a/spring-ejb/ejb-remote-for-spring/src/main/java/com/baeldung/ejb/tutorial/HelloStatelessWorldBean.java b/spring-ejb/spring-ejb-remote/src/main/java/com/baeldung/ejb/tutorial/HelloStatelessWorldBean.java old mode 100755 new mode 100644 similarity index 100% rename from spring-ejb/ejb-remote-for-spring/src/main/java/com/baeldung/ejb/tutorial/HelloStatelessWorldBean.java rename to spring-ejb/spring-ejb-remote/src/main/java/com/baeldung/ejb/tutorial/HelloStatelessWorldBean.java diff --git a/ejb/ejb-remote/src/main/java/com/baeldung/ejb/tutorial/HelloWorld.java b/spring-ejb/spring-ejb-remote/src/main/java/com/baeldung/ejb/tutorial/HelloWorld.java old mode 100755 new mode 100644 similarity index 100% rename from ejb/ejb-remote/src/main/java/com/baeldung/ejb/tutorial/HelloWorld.java rename to spring-ejb/spring-ejb-remote/src/main/java/com/baeldung/ejb/tutorial/HelloWorld.java diff --git a/ejb/ejb-remote/src/main/java/com/baeldung/ejb/tutorial/HelloWorldBean.java b/spring-ejb/spring-ejb-remote/src/main/java/com/baeldung/ejb/tutorial/HelloWorldBean.java old mode 100755 new mode 100644 similarity index 100% rename from ejb/ejb-remote/src/main/java/com/baeldung/ejb/tutorial/HelloWorldBean.java rename to spring-ejb/spring-ejb-remote/src/main/java/com/baeldung/ejb/tutorial/HelloWorldBean.java diff --git a/ejb/ejb-remote/src/main/java/com/baeldung/ejb/wildfly/TextProcessorBean.java b/spring-ejb/spring-ejb-remote/src/main/java/com/baeldung/ejb/wildfly/TextProcessorBean.java similarity index 100% rename from ejb/ejb-remote/src/main/java/com/baeldung/ejb/wildfly/TextProcessorBean.java rename to spring-ejb/spring-ejb-remote/src/main/java/com/baeldung/ejb/wildfly/TextProcessorBean.java diff --git a/ejb/ejb-remote/src/main/java/com/baeldung/ejb/wildfly/TextProcessorRemote.java b/spring-ejb/spring-ejb-remote/src/main/java/com/baeldung/ejb/wildfly/TextProcessorRemote.java similarity index 100% rename from ejb/ejb-remote/src/main/java/com/baeldung/ejb/wildfly/TextProcessorRemote.java rename to spring-ejb/spring-ejb-remote/src/main/java/com/baeldung/ejb/wildfly/TextProcessorRemote.java diff --git a/spring-ejb/ejb-remote-for-spring/src/main/resources/META-INF/ejb-jar.xml b/spring-ejb/spring-ejb-remote/src/main/resources/META-INF/ejb-jar.xml old mode 100755 new mode 100644 similarity index 84% rename from spring-ejb/ejb-remote-for-spring/src/main/resources/META-INF/ejb-jar.xml rename to spring-ejb/spring-ejb-remote/src/main/resources/META-INF/ejb-jar.xml index f51523ac14..e53ed00e98 --- a/spring-ejb/ejb-remote-for-spring/src/main/resources/META-INF/ejb-jar.xml +++ b/spring-ejb/spring-ejb-remote/src/main/resources/META-INF/ejb-jar.xml @@ -2,6 +2,6 @@ - ejb-remote-for-spring + spring-ejb-remote diff --git a/spring-hibernate3/src/main/resources/logback.xml b/spring-ejb/spring-ejb-remote/src/main/resources/logback.xml similarity index 100% rename from spring-hibernate3/src/main/resources/logback.xml rename to spring-ejb/spring-ejb-remote/src/main/resources/logback.xml diff --git a/spring-ejb/ejb-remote-for-spring/src/test/java/com/baeldung/ejb/tutorial/HelloStatefulWorldTestUnitTest.java b/spring-ejb/spring-ejb-remote/src/test/java/com/baeldung/ejb/tutorial/HelloStatefulWorldTestUnitTest.java similarity index 100% rename from spring-ejb/ejb-remote-for-spring/src/test/java/com/baeldung/ejb/tutorial/HelloStatefulWorldTestUnitTest.java rename to spring-ejb/spring-ejb-remote/src/test/java/com/baeldung/ejb/tutorial/HelloStatefulWorldTestUnitTest.java diff --git a/spring-ejb/ejb-remote-for-spring/src/test/java/com/baeldung/ejb/tutorial/HelloStatelessWorldTestUnitTest.java b/spring-ejb/spring-ejb-remote/src/test/java/com/baeldung/ejb/tutorial/HelloStatelessWorldTestUnitTest.java similarity index 100% rename from spring-ejb/ejb-remote-for-spring/src/test/java/com/baeldung/ejb/tutorial/HelloStatelessWorldTestUnitTest.java rename to spring-ejb/spring-ejb-remote/src/test/java/com/baeldung/ejb/tutorial/HelloStatelessWorldTestUnitTest.java diff --git a/ejb/wildfly/pom.xml b/spring-ejb/wildfly/pom.xml similarity index 96% rename from ejb/wildfly/pom.xml rename to spring-ejb/wildfly/pom.xml index 53d10a90ed..f50dad82f1 100644 --- a/ejb/wildfly/pom.xml +++ b/spring-ejb/wildfly/pom.xml @@ -8,9 +8,9 @@ wildfly - com.baeldung.ejb - ejb - 1.0-SNAPSHOT + com.baeldung.spring.ejb + spring-ejb + 1.0.0-SNAPSHOT diff --git a/ejb/wildfly/widlfly-web/pom.xml b/spring-ejb/wildfly/widlfly-web/pom.xml similarity index 94% rename from ejb/wildfly/widlfly-web/pom.xml rename to spring-ejb/wildfly/widlfly-web/pom.xml index 559c5f1755..f0baac10dd 100644 --- a/ejb/wildfly/widlfly-web/pom.xml +++ b/spring-ejb/wildfly/widlfly-web/pom.xml @@ -3,10 +3,11 @@ 4.0.0 widlfly-web war - + widlfly-web + com.baeldung.wildfly - wildfly-example + wildfly 0.0.1-SNAPSHOT diff --git a/ejb/wildfly/widlfly-web/src/main/java/TestEJBServlet.java b/spring-ejb/wildfly/widlfly-web/src/main/java/TestEJBServlet.java similarity index 100% rename from ejb/wildfly/widlfly-web/src/main/java/TestEJBServlet.java rename to spring-ejb/wildfly/widlfly-web/src/main/java/TestEJBServlet.java diff --git a/ejb/wildfly/widlfly-web/src/main/java/TestJPAServlet.java b/spring-ejb/wildfly/widlfly-web/src/main/java/TestJPAServlet.java similarity index 100% rename from ejb/wildfly/widlfly-web/src/main/java/TestJPAServlet.java rename to spring-ejb/wildfly/widlfly-web/src/main/java/TestJPAServlet.java diff --git a/spring-ejb/wildfly/widlfly-web/src/main/resources/logback.xml b/spring-ejb/wildfly/widlfly-web/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/spring-ejb/wildfly/widlfly-web/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/ejb/wildfly/widlfly-web/src/main/webapp/WEB-INF/web.xml b/spring-ejb/wildfly/widlfly-web/src/main/webapp/WEB-INF/web.xml similarity index 100% rename from ejb/wildfly/widlfly-web/src/main/webapp/WEB-INF/web.xml rename to spring-ejb/wildfly/widlfly-web/src/main/webapp/WEB-INF/web.xml diff --git a/ejb/wildfly/wildfly-ear/pom.xml b/spring-ejb/wildfly/wildfly-ear/pom.xml similarity index 96% rename from ejb/wildfly/wildfly-ear/pom.xml rename to spring-ejb/wildfly/wildfly-ear/pom.xml index d1e47ecd0f..93d6df96e5 100644 --- a/ejb/wildfly/wildfly-ear/pom.xml +++ b/spring-ejb/wildfly/wildfly-ear/pom.xml @@ -3,10 +3,11 @@ 4.0.0 wildfly-ear ear - + wildfly-ear + com.baeldung.wildfly - wildfly-example + wildfly 0.0.1-SNAPSHOT diff --git a/ejb/wildfly/wildfly-ejb-interfaces/pom.xml b/spring-ejb/wildfly/wildfly-ejb-interfaces/pom.xml similarity index 92% rename from ejb/wildfly/wildfly-ejb-interfaces/pom.xml rename to spring-ejb/wildfly/wildfly-ejb-interfaces/pom.xml index ec502f2ab3..41c7012ea9 100644 --- a/ejb/wildfly/wildfly-ejb-interfaces/pom.xml +++ b/spring-ejb/wildfly/wildfly-ejb-interfaces/pom.xml @@ -2,10 +2,11 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 wildfly-ejb-interfaces - + wildfly-ejb-interfaces + com.baeldung.wildfly - wildfly-example + wildfly 0.0.1-SNAPSHOT diff --git a/ejb/wildfly/wildfly-ejb-interfaces/src/main/java/wildfly/beans/UserBeanLocal.java b/spring-ejb/wildfly/wildfly-ejb-interfaces/src/main/java/wildfly/beans/UserBeanLocal.java similarity index 100% rename from ejb/wildfly/wildfly-ejb-interfaces/src/main/java/wildfly/beans/UserBeanLocal.java rename to spring-ejb/wildfly/wildfly-ejb-interfaces/src/main/java/wildfly/beans/UserBeanLocal.java diff --git a/ejb/wildfly/wildfly-ejb-interfaces/src/main/java/wildfly/beans/UserBeanRemote.java b/spring-ejb/wildfly/wildfly-ejb-interfaces/src/main/java/wildfly/beans/UserBeanRemote.java similarity index 100% rename from ejb/wildfly/wildfly-ejb-interfaces/src/main/java/wildfly/beans/UserBeanRemote.java rename to spring-ejb/wildfly/wildfly-ejb-interfaces/src/main/java/wildfly/beans/UserBeanRemote.java diff --git a/spring-ejb/wildfly/wildfly-ejb-interfaces/src/main/resources/logback.xml b/spring-ejb/wildfly/wildfly-ejb-interfaces/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/spring-ejb/wildfly/wildfly-ejb-interfaces/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/ejb/wildfly/wildfly-ejb/pom.xml b/spring-ejb/wildfly/wildfly-ejb/pom.xml similarity index 95% rename from ejb/wildfly/wildfly-ejb/pom.xml rename to spring-ejb/wildfly/wildfly-ejb/pom.xml index 2c87ec8449..12bfc9c1bf 100644 --- a/ejb/wildfly/wildfly-ejb/pom.xml +++ b/spring-ejb/wildfly/wildfly-ejb/pom.xml @@ -3,10 +3,11 @@ 4.0.0 wildfly-ejb ejb - + wildfly-ejb + com.baeldung.wildfly - wildfly-example + wildfly 0.0.1-SNAPSHOT diff --git a/ejb/wildfly/wildfly-ejb/src/main/java/wildfly/beans/UserBean.java b/spring-ejb/wildfly/wildfly-ejb/src/main/java/wildfly/beans/UserBean.java similarity index 100% rename from ejb/wildfly/wildfly-ejb/src/main/java/wildfly/beans/UserBean.java rename to spring-ejb/wildfly/wildfly-ejb/src/main/java/wildfly/beans/UserBean.java diff --git a/spring-ejb/wildfly/wildfly-ejb/src/main/resources/logback.xml b/spring-ejb/wildfly/wildfly-ejb/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/spring-ejb/wildfly/wildfly-ejb/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/ejb/wildfly/wildfly-jpa/pom.xml b/spring-ejb/wildfly/wildfly-jpa/pom.xml similarity index 89% rename from ejb/wildfly/wildfly-jpa/pom.xml rename to spring-ejb/wildfly/wildfly-jpa/pom.xml index 12cf2c81e4..3005ab714c 100644 --- a/ejb/wildfly/wildfly-jpa/pom.xml +++ b/spring-ejb/wildfly/wildfly-jpa/pom.xml @@ -2,10 +2,11 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 wildfly-jpa - + wildfly-jpa + com.baeldung.wildfly - wildfly-example + wildfly 0.0.1-SNAPSHOT diff --git a/ejb/wildfly/wildfly-jpa/src/main/java/model/User.java b/spring-ejb/wildfly/wildfly-jpa/src/main/java/model/User.java similarity index 100% rename from ejb/wildfly/wildfly-jpa/src/main/java/model/User.java rename to spring-ejb/wildfly/wildfly-jpa/src/main/java/model/User.java diff --git a/ejb/wildfly/wildfly-jpa/src/main/resources/META-INF/persistence.xml b/spring-ejb/wildfly/wildfly-jpa/src/main/resources/META-INF/persistence.xml similarity index 100% rename from ejb/wildfly/wildfly-jpa/src/main/resources/META-INF/persistence.xml rename to spring-ejb/wildfly/wildfly-jpa/src/main/resources/META-INF/persistence.xml diff --git a/ejb/wildfly/wildfly-jpa/src/main/resources/data.sql b/spring-ejb/wildfly/wildfly-jpa/src/main/resources/data.sql similarity index 100% rename from ejb/wildfly/wildfly-jpa/src/main/resources/data.sql rename to spring-ejb/wildfly/wildfly-jpa/src/main/resources/data.sql diff --git a/spring-ejb/wildfly/wildfly-jpa/src/main/resources/logback.xml b/spring-ejb/wildfly/wildfly-jpa/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/spring-ejb/wildfly/wildfly-jpa/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/ejb/wildfly/wildfly-mdb/pom.xml b/spring-ejb/wildfly/wildfly-mdb/pom.xml similarity index 92% rename from ejb/wildfly/wildfly-mdb/pom.xml rename to spring-ejb/wildfly/wildfly-mdb/pom.xml index 186ddc50c0..a2ffca2fc5 100644 --- a/ejb/wildfly/wildfly-mdb/pom.xml +++ b/spring-ejb/wildfly/wildfly-mdb/pom.xml @@ -6,7 +6,7 @@ com.baeldung.wildfly - wildfly-example + wildfly 0.0.1-SNAPSHOT diff --git a/ejb/wildfly/wildfly-mdb/src/com/baeldung/wildfly/mdb/ReadMessageMDB.java b/spring-ejb/wildfly/wildfly-mdb/src/com/baeldung/wildfly/mdb/ReadMessageMDB.java similarity index 100% rename from ejb/wildfly/wildfly-mdb/src/com/baeldung/wildfly/mdb/ReadMessageMDB.java rename to spring-ejb/wildfly/wildfly-mdb/src/com/baeldung/wildfly/mdb/ReadMessageMDB.java diff --git a/ejb/wildfly/wildfly-mdb/src/com/baeldung/wildfly/mdb/SendMessageServlet.java b/spring-ejb/wildfly/wildfly-mdb/src/com/baeldung/wildfly/mdb/SendMessageServlet.java similarity index 100% rename from ejb/wildfly/wildfly-mdb/src/com/baeldung/wildfly/mdb/SendMessageServlet.java rename to spring-ejb/wildfly/wildfly-mdb/src/com/baeldung/wildfly/mdb/SendMessageServlet.java diff --git a/spring-freemarker/pom.xml b/spring-freemarker/pom.xml index 4ff57e27f0..02f2a3fd06 100644 --- a/spring-freemarker/pom.xml +++ b/spring-freemarker/pom.xml @@ -5,7 +5,7 @@ spring-freemarker war 1.0-SNAPSHOT - Spring Freemarker Example + spring-freemarker com.baeldung diff --git a/spring-hibernate3/README.md b/spring-hibernate3/README.md deleted file mode 100644 index 02928dfb51..0000000000 --- a/spring-hibernate3/README.md +++ /dev/null @@ -1,2 +0,0 @@ -## Relevant articles: -- [HibernateException: No Hibernate Session Bound to Thread in Hibernate 3](http://www.baeldung.com/no-hibernate-session-bound-to-thread-exception) diff --git a/spring-integration/README.md b/spring-integration/README.md index e116f934c8..244cf1fb14 100644 --- a/spring-integration/README.md +++ b/spring-integration/README.md @@ -2,6 +2,7 @@ - [Introduction to Spring Integration](http://www.baeldung.com/spring-integration) - [Security In Spring Integration](http://www.baeldung.com/spring-integration-security) - [Spring Integration Java DSL](https://www.baeldung.com/spring-integration-java-dsl) +- [Using Subflows in Spring Integration](https://www.baeldung.com/spring-integration-subflows) ### Running the Sample Executing the `mvn exec:java` maven command (either from the command line or from an IDE) will start up the application. Follow the command prompt for further instructions. diff --git a/spring-integration/src/main/java/com/baeldung/subflows/discardflow/FilterExample.java b/spring-integration/src/main/java/com/baeldung/subflows/discardflow/FilterExample.java new file mode 100644 index 0000000000..f0e12f9333 --- /dev/null +++ b/spring-integration/src/main/java/com/baeldung/subflows/discardflow/FilterExample.java @@ -0,0 +1,57 @@ +package com.baeldung.subflows.discardflow; + +import java.util.Collection; +import org.springframework.context.annotation.Bean; +import org.springframework.integration.annotation.Gateway; +import org.springframework.integration.annotation.IntegrationComponentScan; +import org.springframework.integration.annotation.MessagingGateway; +import org.springframework.integration.channel.QueueChannel; +import org.springframework.integration.config.EnableIntegration; +import org.springframework.integration.dsl.IntegrationFlow; + +@EnableIntegration +@IntegrationComponentScan +public class FilterExample { + @MessagingGateway + public interface NumbersClassifier { + @Gateway(requestChannel = "classify.input") + void classify(Collection numbers); + } + + @Bean + QueueChannel multipleofThreeChannel() { + return new QueueChannel(); + } + + @Bean + QueueChannel remainderIsOneChannel() { + return new QueueChannel(); + } + + @Bean + QueueChannel remainderIsTwoChannel() { + return new QueueChannel(); + } + boolean isMultipleOfThree(Integer number) { + return number % 3 == 0; + } + + boolean isRemainderOne(Integer number) { + return number % 3 == 1; + } + + boolean isRemainderTwo(Integer number) { + return number % 3 == 2; + } + @Bean + public IntegrationFlow classify() { + return flow -> flow.split() + . filter(this::isMultipleOfThree, notMultiple -> notMultiple + .discardFlow(oneflow -> oneflow + . filter(this::isRemainderOne, + twoflow -> twoflow .discardChannel("remainderIsTwoChannel")) + .channel("remainderIsOneChannel"))) + .channel("multipleofThreeChannel"); + } + +} \ No newline at end of file diff --git a/spring-integration/src/main/java/com/baeldung/subflows/publishsubscribechannel/PublishSubscibeChannelExample.java b/spring-integration/src/main/java/com/baeldung/subflows/publishsubscribechannel/PublishSubscibeChannelExample.java new file mode 100644 index 0000000000..a1a448fc03 --- /dev/null +++ b/spring-integration/src/main/java/com/baeldung/subflows/publishsubscribechannel/PublishSubscibeChannelExample.java @@ -0,0 +1,60 @@ +package com.baeldung.subflows.publishsubscribechannel; + +import java.util.Collection; + +import org.springframework.context.annotation.Bean; +import org.springframework.integration.annotation.Gateway; +import org.springframework.integration.annotation.IntegrationComponentScan; +import org.springframework.integration.annotation.MessagingGateway; + +import org.springframework.integration.channel.QueueChannel; +import org.springframework.integration.config.EnableIntegration; +import org.springframework.integration.dsl.IntegrationFlow; + +@EnableIntegration +@IntegrationComponentScan +public class PublishSubscibeChannelExample { + @MessagingGateway + public interface NumbersClassifier { + @Gateway(requestChannel = "classify.input") + void classify(Collection numbers); + } + + @Bean + QueueChannel multipleofThreeChannel() { + return new QueueChannel(); + } + + @Bean + QueueChannel remainderIsOneChannel() { + return new QueueChannel(); + } + + @Bean + QueueChannel remainderIsTwoChannel() { + return new QueueChannel(); + } + boolean isMultipleOfThree(Integer number) { + return number % 3 == 0; + } + + boolean isRemainderOne(Integer number) { + return number % 3 == 1; + } + + boolean isRemainderTwo(Integer number) { + return number % 3 == 2; + } + @Bean + public IntegrationFlow classify() { + return flow -> flow.split() + .publishSubscribeChannel(subscription -> subscription.subscribe(subflow -> subflow. filter(this::isMultipleOfThree) + .channel("multipleofThreeChannel")) + .subscribe(subflow -> subflow. filter(this::isRemainderOne) + .channel("remainderIsOneChannel")) + .subscribe(subflow -> subflow. filter(this::isRemainderTwo) + .channel("remainderIsTwoChannel"))); + } + + +} diff --git a/spring-integration/src/main/java/com/baeldung/subflows/routeToRecipients/RouteToRecipientsExample.java b/spring-integration/src/main/java/com/baeldung/subflows/routeToRecipients/RouteToRecipientsExample.java new file mode 100644 index 0000000000..e0b4841736 --- /dev/null +++ b/spring-integration/src/main/java/com/baeldung/subflows/routeToRecipients/RouteToRecipientsExample.java @@ -0,0 +1,60 @@ +package com.baeldung.subflows.routetorecipients; + +import java.util.Collection; + +import org.springframework.context.annotation.Bean; +import org.springframework.integration.annotation.Gateway; +import org.springframework.integration.annotation.IntegrationComponentScan; +import org.springframework.integration.annotation.MessagingGateway; +import org.springframework.integration.channel.QueueChannel; +import org.springframework.integration.config.EnableIntegration; +import org.springframework.integration.dsl.IntegrationFlow; + +@EnableIntegration +@IntegrationComponentScan +public class RouteToRecipientsExample { + @MessagingGateway + public interface NumbersClassifier { + @Gateway(requestChannel = "classify.input") + void classify(Collection numbers); + } + + @Bean + QueueChannel multipleofThreeChannel() { + return new QueueChannel(); + } + + @Bean + QueueChannel remainderIsOneChannel() { + return new QueueChannel(); + } + + @Bean + QueueChannel remainderIsTwoChannel() { + return new QueueChannel(); + } + boolean isMultipleOfThree(Integer number) { + return number % 3 == 0; + } + + boolean isRemainderOne(Integer number) { + return number % 3 == 1; + } + + boolean isRemainderTwo(Integer number) { + return number % 3 == 2; + } + + @Bean + public IntegrationFlow classify() { + return flow -> flow.split() + .routeToRecipients(route -> route + .recipientFlow(subflow -> subflow + . filter(this::isMultipleOfThree) + .channel("multipleofThreeChannel")) + . recipient("remainderIsOneChannel",this::isRemainderOne) + . recipient("remainderIsTwoChannel",this::isRemainderTwo)); + } + + +} \ No newline at end of file diff --git a/spring-integration/src/main/java/com/baeldung/subflows/separateflows/SeparateFlowsExample.java b/spring-integration/src/main/java/com/baeldung/subflows/separateflows/SeparateFlowsExample.java new file mode 100644 index 0000000000..457b8045c5 --- /dev/null +++ b/spring-integration/src/main/java/com/baeldung/subflows/separateflows/SeparateFlowsExample.java @@ -0,0 +1,77 @@ +package com.baeldung.subflows.separateflows; + +import java.util.Collection; + +import org.springframework.context.annotation.Bean; +import org.springframework.integration.annotation.Gateway; +import org.springframework.integration.annotation.IntegrationComponentScan; +import org.springframework.integration.annotation.MessagingGateway; + +import org.springframework.integration.channel.QueueChannel; +import org.springframework.integration.config.EnableIntegration; +import org.springframework.integration.dsl.IntegrationFlow; + +@EnableIntegration +@IntegrationComponentScan +public class SeparateFlowsExample { + @MessagingGateway + public interface NumbersClassifier { + @Gateway(requestChannel = "multipleOfThreeFlow.input") + void multipleofThree(Collection numbers); + + @Gateway(requestChannel = "remainderIsOneFlow.input") + void remainderIsOne(Collection numbers); + + @Gateway(requestChannel = "remainderIsTwoFlow.input") + void remainderIsTwo(Collection numbers); + } + + @Bean + QueueChannel multipleOfThreeChannel() { + return new QueueChannel(); + } + + @Bean + QueueChannel remainderIsOneChannel() { + return new QueueChannel(); + } + + @Bean + QueueChannel remainderIsTwoChannel() { + return new QueueChannel(); + } + + boolean isMultipleOfThree(Integer number) { + return number % 3 == 0; + } + + boolean isRemainderOne(Integer number) { + return number % 3 == 1; + } + + boolean isRemainderTwo(Integer number) { + return number % 3 == 2; + } + + @Bean + public IntegrationFlow multipleOfThreeFlow() { + return flow -> flow.split() + . filter(this::isMultipleOfThree) + .channel("multipleOfThreeChannel"); + } + + @Bean + public IntegrationFlow remainderIsOneFlow() { + return flow -> flow.split() + . filter(this::isRemainderOne) + .channel("remainderIsOneChannel"); + } + + @Bean + public IntegrationFlow remainderIsTwoFlow() { + return flow -> flow.split() + . filter(this::isRemainderTwo) + .channel("remainderIsTwoChannel"); + } + +} \ No newline at end of file diff --git a/spring-integration/src/main/java/com/baeldung/subflows/subflowmapping/RouterExample.java b/spring-integration/src/main/java/com/baeldung/subflows/subflowmapping/RouterExample.java new file mode 100644 index 0000000000..c0e902e739 --- /dev/null +++ b/spring-integration/src/main/java/com/baeldung/subflows/subflowmapping/RouterExample.java @@ -0,0 +1,62 @@ +package com.baeldung.subflows.subflowmapping; + +import java.util.Collection; +import org.springframework.context.annotation.Bean; +import org.springframework.integration.annotation.Gateway; +import org.springframework.integration.annotation.IntegrationComponentScan; +import org.springframework.integration.annotation.MessagingGateway; +import org.springframework.integration.channel.QueueChannel; +import org.springframework.integration.config.EnableIntegration; +import org.springframework.integration.dsl.IntegrationFlow; + +@EnableIntegration +@IntegrationComponentScan +public class RouterExample { + @MessagingGateway + public interface NumbersClassifier { + @Gateway(requestChannel = "classify.input") + void classify(Collection numbers); + } + + @Bean + QueueChannel multipleofThreeChannel() { + return new QueueChannel(); + } + + @Bean + QueueChannel remainderIsOneChannel() { + return new QueueChannel(); + } + + @Bean + QueueChannel remainderIsTwoChannel() { + return new QueueChannel(); + } + + boolean isMultipleOfThree(Integer number) { + return number % 3 == 0; + } + + boolean isRemainderOne(Integer number) { + return number % 3 == 1; + } + + boolean isRemainderTwo(Integer number) { + return number % 3 == 2; + } + + @Bean + public IntegrationFlow classify() { + return flow -> flow.split() + . route(number -> number % 3, + mapping -> mapping + .channelMapping(0, "multipleofThreeChannel") + .subFlowMapping(1, subflow -> subflow.channel("remainderIsOneChannel")) + .subFlowMapping(2, subflow -> subflow + . handle((payload, headers) -> { + // do extra work on the payload + return payload; + }))).channel("remainderIsTwoChannel"); + } + +} \ No newline at end of file diff --git a/spring-integration/src/test/java/com/baeldung/subflows/discardflow/FilterUnitTest.java b/spring-integration/src/test/java/com/baeldung/subflows/discardflow/FilterUnitTest.java new file mode 100644 index 0000000000..3b3106212b --- /dev/null +++ b/spring-integration/src/test/java/com/baeldung/subflows/discardflow/FilterUnitTest.java @@ -0,0 +1,62 @@ +package com.baeldung.subflows.discardflow; + +import static org.junit.Assert.assertEquals; + +import java.util.Arrays; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.integration.channel.QueueChannel; +import org.springframework.messaging.Message; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; + +import com.baeldung.subflows.discardflow.FilterExample.NumbersClassifier; + +@RunWith(SpringJUnit4ClassRunner.class) +@ContextConfiguration(classes = { FilterExample.class }) +public class FilterUnitTest { + @Autowired + private QueueChannel multipleofThreeChannel; + + @Autowired + private QueueChannel remainderIsOneChannel; + + @Autowired + private QueueChannel remainderIsTwoChannel; + + @Autowired + private NumbersClassifier numbersClassifier; + + @Test + public void whenSendMessagesToFlow_thenNumbersAreClassified() { + + numbersClassifier.classify(Arrays.asList(1, 2, 3, 4, 5, 6)); + + Message outMessage = multipleofThreeChannel.receive(0); + + assertEquals(outMessage.getPayload(), 3); + + outMessage = multipleofThreeChannel.receive(0); + + assertEquals(outMessage.getPayload(), 6); + + outMessage = remainderIsOneChannel.receive(0); + + assertEquals(outMessage.getPayload(), 1); + outMessage = remainderIsOneChannel.receive(0); + + assertEquals(outMessage.getPayload(), 4); + + outMessage = remainderIsTwoChannel.receive(0); + + assertEquals(outMessage.getPayload(), 2); + + outMessage = remainderIsTwoChannel.receive(0); + + assertEquals(outMessage.getPayload(), 5); + + } + +} diff --git a/spring-integration/src/test/java/com/baeldung/subflows/publishsubscribechannel/PublishSubscribeChannelUnitTest.java b/spring-integration/src/test/java/com/baeldung/subflows/publishsubscribechannel/PublishSubscribeChannelUnitTest.java new file mode 100644 index 0000000000..91bf38c626 --- /dev/null +++ b/spring-integration/src/test/java/com/baeldung/subflows/publishsubscribechannel/PublishSubscribeChannelUnitTest.java @@ -0,0 +1,62 @@ +package com.baeldung.subflows.publishsubscribechannel; + +import static org.junit.Assert.assertEquals; + +import java.util.Arrays; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.integration.channel.QueueChannel; +import org.springframework.messaging.Message; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; + +import com.baeldung.subflows.publishsubscribechannel.PublishSubscibeChannelExample.NumbersClassifier; + +@RunWith(SpringJUnit4ClassRunner.class) +@ContextConfiguration(classes = { PublishSubscibeChannelExample.class }) +public class PublishSubscribeChannelUnitTest { + @Autowired + private QueueChannel multipleofThreeChannel; + + @Autowired + private QueueChannel remainderIsOneChannel; + + @Autowired + private QueueChannel remainderIsTwoChannel; + + @Autowired + private NumbersClassifier numbersClassifier; + + @Test + public void whenSendMessagesToFlow_thenNumbersAreClassified() { + + numbersClassifier.classify(Arrays.asList(1, 2, 3, 4, 5, 6)); + + Message outMessage = multipleofThreeChannel.receive(0); + + assertEquals(outMessage.getPayload(), 3); + + outMessage = multipleofThreeChannel.receive(0); + + assertEquals(outMessage.getPayload(), 6); + + outMessage = remainderIsOneChannel.receive(0); + + assertEquals(outMessage.getPayload(), 1); + outMessage = remainderIsOneChannel.receive(0); + + assertEquals(outMessage.getPayload(), 4); + + outMessage = remainderIsTwoChannel.receive(0); + + assertEquals(outMessage.getPayload(), 2); + + outMessage = remainderIsTwoChannel.receive(0); + + assertEquals(outMessage.getPayload(), 5); + + } + +} diff --git a/spring-integration/src/test/java/com/baeldung/subflows/routetorecipients/RouteToRecipientsUnitTest.java b/spring-integration/src/test/java/com/baeldung/subflows/routetorecipients/RouteToRecipientsUnitTest.java new file mode 100644 index 0000000000..d7a768dcd9 --- /dev/null +++ b/spring-integration/src/test/java/com/baeldung/subflows/routetorecipients/RouteToRecipientsUnitTest.java @@ -0,0 +1,63 @@ +package com.baeldung.subflows.routetorecipients; + +import static org.junit.Assert.assertEquals; + +import java.util.Arrays; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.integration.channel.QueueChannel; +import org.springframework.messaging.Message; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; + +import com.baeldung.subflows.routetorecipients.RouteToRecipientsExample; +import com.baeldung.subflows.routetorecipients.RouteToRecipientsExample.NumbersClassifier; + +@RunWith(SpringJUnit4ClassRunner.class) +@ContextConfiguration(classes = { RouteToRecipientsExample.class }) +public class RouteToRecipientsUnitTest { + @Autowired + private QueueChannel multipleofThreeChannel; + + @Autowired + private QueueChannel remainderIsOneChannel; + + @Autowired + private QueueChannel remainderIsTwoChannel; + + @Autowired + private NumbersClassifier numbersClassifier; + + @Test + public void whenSendMessagesToFlow_thenNumbersAreClassified() { + + numbersClassifier.classify(Arrays.asList(1, 2, 3, 4, 5, 6)); + + Message outMessage = multipleofThreeChannel.receive(0); + + assertEquals(outMessage.getPayload(), 3); + + outMessage = multipleofThreeChannel.receive(0); + + assertEquals(outMessage.getPayload(), 6); + + outMessage = remainderIsOneChannel.receive(0); + + assertEquals(outMessage.getPayload(), 1); + outMessage = remainderIsOneChannel.receive(0); + + assertEquals(outMessage.getPayload(), 4); + + outMessage = remainderIsTwoChannel.receive(0); + + assertEquals(outMessage.getPayload(), 2); + + outMessage = remainderIsTwoChannel.receive(0); + + assertEquals(outMessage.getPayload(), 5); + + } + +} diff --git a/spring-integration/src/test/java/com/baeldung/subflows/separateflows/SeparateFlowsUnitTest.java b/spring-integration/src/test/java/com/baeldung/subflows/separateflows/SeparateFlowsUnitTest.java new file mode 100644 index 0000000000..c02badcb1a --- /dev/null +++ b/spring-integration/src/test/java/com/baeldung/subflows/separateflows/SeparateFlowsUnitTest.java @@ -0,0 +1,75 @@ +package com.baeldung.subflows.separateflows; + +import java.util.Arrays; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.integration.channel.QueueChannel; +import org.springframework.messaging.Message; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNull; +import com.baeldung.subflows.separateflows.SeparateFlowsExample.NumbersClassifier; + +@RunWith(SpringJUnit4ClassRunner.class) +@ContextConfiguration(classes = { SeparateFlowsExample.class }) +public class SeparateFlowsUnitTest { + @Autowired + private QueueChannel multipleOfThreeChannel; + @Autowired + private QueueChannel remainderIsOneChannel; + @Autowired + private QueueChannel remainderIsTwoChannel; + + @Autowired + private NumbersClassifier numbersClassifier; + + @Test + public void whenSendMessagesToMultipleOf3Flow_thenOutputMultiplesOf3() { + + numbersClassifier.multipleofThree(Arrays.asList(1, 2, 3, 4, 5, 6)); + + Message outMessage = multipleOfThreeChannel.receive(0); + + assertEquals(outMessage.getPayload(), 3); + + outMessage = multipleOfThreeChannel.receive(0); + + assertEquals(outMessage.getPayload(), 6); + outMessage = multipleOfThreeChannel.receive(0); + assertNull(outMessage); + } + + @Test + public void whenSendMessagesToRemainderIs1Flow_thenOutputRemainderIs1() { + + numbersClassifier.remainderIsOne(Arrays.asList(1, 2, 3, 4, 5, 6)); + + Message outMessage = remainderIsOneChannel.receive(0); + + assertEquals(outMessage.getPayload(), 1); + + outMessage = remainderIsOneChannel.receive(0); + + assertEquals(outMessage.getPayload(), 4); + + } + + @Test + public void whenSendMessagesToRemainderIs2Flow_thenOutputRemainderIs2() { + + numbersClassifier.remainderIsTwo(Arrays.asList(1, 2, 3, 4, 5, 6)); + + Message outMessage = remainderIsTwoChannel.receive(0); + + assertEquals(outMessage.getPayload(), 2); + + outMessage = remainderIsTwoChannel.receive(0); + + assertEquals(outMessage.getPayload(), 5); + + } + +} diff --git a/spring-integration/src/test/java/com/baeldung/subflows/subflowmapping/RouterUnitTest.java b/spring-integration/src/test/java/com/baeldung/subflows/subflowmapping/RouterUnitTest.java new file mode 100644 index 0000000000..9ecbb22a9b --- /dev/null +++ b/spring-integration/src/test/java/com/baeldung/subflows/subflowmapping/RouterUnitTest.java @@ -0,0 +1,62 @@ +package com.baeldung.subflows.subflowmapping; + +import static org.junit.Assert.assertEquals; + +import java.util.Arrays; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.integration.channel.QueueChannel; +import org.springframework.messaging.Message; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; + +import com.baeldung.subflows.subflowmapping.RouterExample.NumbersClassifier; + +@RunWith(SpringJUnit4ClassRunner.class) +@ContextConfiguration(classes = { RouterExample.class }) +public class RouterUnitTest { + @Autowired + private QueueChannel multipleofThreeChannel; + + @Autowired + private QueueChannel remainderIsOneChannel; + + @Autowired + private QueueChannel remainderIsTwoChannel; + + @Autowired + private NumbersClassifier numbersClassifier; + + @Test + public void whenSendMessagesToFlow_thenNumbersAreClassified() { + + numbersClassifier.classify(Arrays.asList(1, 2, 3, 4, 5, 6)); + + Message outMessage = multipleofThreeChannel.receive(0); + + assertEquals(outMessage.getPayload(), 3); + + outMessage = multipleofThreeChannel.receive(0); + + assertEquals(outMessage.getPayload(), 6); + + outMessage = remainderIsOneChannel.receive(0); + + assertEquals(outMessage.getPayload(), 1); + outMessage = remainderIsOneChannel.receive(0); + + assertEquals(outMessage.getPayload(), 4); + + outMessage = remainderIsTwoChannel.receive(0); + + assertEquals(outMessage.getPayload(), 2); + + outMessage = remainderIsTwoChannel.receive(0); + + assertEquals(outMessage.getPayload(), 5); + + } + +} diff --git a/spring-jenkins-pipeline/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-jenkins-pipeline/src/test/java/org/baeldung/SpringContextIntegrationTest.java index 8eb1589de7..0354f7211c 100644 --- a/spring-jenkins-pipeline/src/test/java/org/baeldung/SpringContextIntegrationTest.java +++ b/spring-jenkins-pipeline/src/test/java/org/baeldung/SpringContextIntegrationTest.java @@ -3,12 +3,14 @@ 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 diff --git a/spring-jersey/pom.xml b/spring-jersey/pom.xml index 872835177d..5e7b50d291 100644 --- a/spring-jersey/pom.xml +++ b/spring-jersey/pom.xml @@ -6,7 +6,8 @@ spring-jersey 0.1-SNAPSHOT war - + spring-jersey + com.baeldung parent-modules diff --git a/spring-jooq/pom.xml b/spring-jooq/pom.xml index 744ae34cc8..bbd6025418 100644 --- a/spring-jooq/pom.xml +++ b/spring-jooq/pom.xml @@ -2,7 +2,8 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 spring-jooq - + spring-jooq + parent-boot-1 com.baeldung diff --git a/spring-katharsis/pom.xml b/spring-katharsis/pom.xml index 39648a982c..756aae93d3 100644 --- a/spring-katharsis/pom.xml +++ b/spring-katharsis/pom.xml @@ -5,7 +5,8 @@ spring-katharsis 0.0.1-SNAPSHOT war - + spring-katharsis + parent-boot-1 com.baeldung diff --git a/spring-ldap/pom.xml b/spring-ldap/pom.xml index 3b2525d899..7399a84c2b 100644 --- a/spring-ldap/pom.xml +++ b/spring-ldap/pom.xml @@ -5,6 +5,7 @@ spring-ldap 0.1-SNAPSHOT jar + spring-ldap com.baeldung diff --git a/spring-mvc-forms-thymeleaf/pom.xml b/spring-mvc-forms-thymeleaf/pom.xml index 504ad1dcb2..67a2696c8a 100644 --- a/spring-mvc-forms-thymeleaf/pom.xml +++ b/spring-mvc-forms-thymeleaf/pom.xml @@ -9,10 +9,10 @@ spring forms examples using thymeleaf - parent-boot-2 + parent-boot-2.0-temp com.baeldung 0.0.1-SNAPSHOT - ../parent-boot-2 + ../parent-boot-2.0-temp diff --git a/spring-mvc-java/README.md b/spring-mvc-java/README.md index 3a580202cf..c7fcbd400b 100644 --- a/spring-mvc-java/README.md +++ b/spring-mvc-java/README.md @@ -32,3 +32,4 @@ The "REST With Spring" Classes: http://bit.ly/restwithspring - [Using Spring @ResponseStatus to Set HTTP Status Code](http://www.baeldung.com/spring-response-status) - [Bootstrap a Web Application with Spring 5](https://www.baeldung.com/bootstraping-a-web-application-with-spring-and-java-based-configuration) - [Spring MVC Tutorial](https://www.baeldung.com/spring-mvc-tutorial) +- [Working with Date Parameters in Spring](https://www.baeldung.com/spring-date-parameters) diff --git a/spring-mvc-java/src/main/java/com/baeldung/datetime/DateTimeConfig.java b/spring-mvc-java/src/main/java/com/baeldung/datetime/DateTimeConfig.java new file mode 100644 index 0000000000..8a5d1c71af --- /dev/null +++ b/spring-mvc-java/src/main/java/com/baeldung/datetime/DateTimeConfig.java @@ -0,0 +1,29 @@ +package com.baeldung.datetime; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.format.datetime.standard.DateTimeFormatterRegistrar; +import org.springframework.format.number.NumberFormatAnnotationFormatterFactory; +import org.springframework.format.support.DefaultFormattingConversionService; +import org.springframework.format.support.FormattingConversionService; + +import java.time.format.DateTimeFormatter; + +@Configuration +class DateTimeConfig { + + @Bean + public FormattingConversionService conversionService() { + DefaultFormattingConversionService conversionService = new DefaultFormattingConversionService(false); + + conversionService.addFormatterForFieldAnnotation(new NumberFormatAnnotationFormatterFactory()); + + DateTimeFormatterRegistrar registrar = new DateTimeFormatterRegistrar(); + registrar.setDateFormatter(DateTimeFormatter.ofPattern("dd.MM.yyyy")); + registrar.setDateTimeFormatter(DateTimeFormatter.ofPattern("dd.MM.yyyy HH:mm:ss")); + registrar.registerFormatters(conversionService); + + return conversionService; + } + +} \ No newline at end of file diff --git a/spring-mvc-java/src/main/java/com/baeldung/datetime/DateTimeController.java b/spring-mvc-java/src/main/java/com/baeldung/datetime/DateTimeController.java new file mode 100644 index 0000000000..5741b35530 --- /dev/null +++ b/spring-mvc-java/src/main/java/com/baeldung/datetime/DateTimeController.java @@ -0,0 +1,29 @@ +package com.baeldung.datetime; + +import org.springframework.format.annotation.DateTimeFormat; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; + +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.util.Date; + +@RestController +public class DateTimeController { + + @PostMapping("/date") + public void date(@RequestParam("date") @DateTimeFormat(pattern = "dd.MM.yyyy") Date date) { + // ... + } + + @PostMapping("/localdate") + public void localDate(@RequestParam("localDate") @DateTimeFormat(iso = DateTimeFormat.ISO.DATE) LocalDate localDate) { + // ... + } + + @PostMapping("/localdatetime") + public void dateTime(@RequestParam("localDateTime") @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME) LocalDateTime localDateTime) { + // ... + } +} \ No newline at end of file diff --git a/spring-mvc-simple/README.md b/spring-mvc-simple/README.md index 39053534fa..755e0932fc 100644 --- a/spring-mvc-simple/README.md +++ b/spring-mvc-simple/README.md @@ -6,3 +6,5 @@ - [Servlet Redirect vs Forward](http://www.baeldung.com/servlet-redirect-forward) - [Apache Tiles Integration with Spring MVC](http://www.baeldung.com/spring-mvc-apache-tiles) - [Guide to Spring Email](http://www.baeldung.com/spring-email) +- [Request Method Not Supported (405) in Spring](https://www.baeldung.com/spring-request-method-not-supported-405) +- [Spring @RequestParam Annotation](https://www.baeldung.com/spring-request-param) diff --git a/spring-mvc-simple/pom.xml b/spring-mvc-simple/pom.xml index bd63b5ed1c..8d7ad0fa7f 100644 --- a/spring-mvc-simple/pom.xml +++ b/spring-mvc-simple/pom.xml @@ -4,8 +4,7 @@ spring-mvc-simple war 0.0.1-SNAPSHOT - Spring MVC simple Maven Webapp - http://maven.apache.org + spring-mvc-simple com.baeldung @@ -20,10 +19,6 @@ spring-oxm ${spring-oxm.version} - - org.springframework - spring-context-support - com.sun.mail javax.mail diff --git a/spring-mvc-simple/src/main/java/com/baeldung/spring/configuration/ApplicationConfiguration.java b/spring-mvc-simple/src/main/java/com/baeldung/spring/configuration/ApplicationConfiguration.java index 284be6c212..941a984684 100644 --- a/spring-mvc-simple/src/main/java/com/baeldung/spring/configuration/ApplicationConfiguration.java +++ b/spring-mvc-simple/src/main/java/com/baeldung/spring/configuration/ApplicationConfiguration.java @@ -1,7 +1,9 @@ package com.baeldung.spring.configuration; -import com.baeldung.spring.controller.rss.ArticleRssFeedViewResolver; -import com.baeldung.spring.controller.rss.JsonChannelHttpMessageConverter; +import java.util.ArrayList; +import java.util.List; +import java.util.Properties; + import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration; @@ -21,13 +23,12 @@ import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; import org.springframework.web.servlet.view.ContentNegotiatingViewResolver; import org.springframework.web.servlet.view.InternalResourceViewResolver; -import java.util.ArrayList; -import java.util.List; -import java.util.Properties; +import com.baeldung.spring.controller.rss.ArticleRssFeedViewResolver; +import com.baeldung.spring.controller.rss.JsonChannelHttpMessageConverter; @Configuration @EnableWebMvc -@ComponentScan(basePackages = { "com.baeldung.springmvcforms", "com.baeldung.spring.controller", "com.baeldung.spring.validator", "com.baeldung.spring.mail" }) +@ComponentScan(basePackages = { "com.baeldung.springmvcforms", "com.baeldung.spring.controller", "com.baeldung.spring.validator", "com.baeldung.spring.mail", "com.baeldung.spring.service" }) public class ApplicationConfiguration implements WebMvcConfigurer { @Override diff --git a/spring-mvc-simple/src/main/java/com/baeldung/spring/configuration/PushConfiguration.java b/spring-mvc-simple/src/main/java/com/baeldung/spring/configuration/PushConfiguration.java index 3072501cfa..3aba7e9d89 100644 --- a/spring-mvc-simple/src/main/java/com/baeldung/spring/configuration/PushConfiguration.java +++ b/spring-mvc-simple/src/main/java/com/baeldung/spring/configuration/PushConfiguration.java @@ -8,9 +8,10 @@ import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; import org.springframework.web.servlet.view.InternalResourceViewResolver; +// needs HTTP 2 https://github.com/spring-projects/spring-framework/wiki/HTTP-2-support @Configuration @EnableWebMvc -@ComponentScan(basePackages = "com.baeldung.spring.controller.push") +@ComponentScan(basePackages = "com.baeldung.spring.push.controller") public class PushConfiguration implements WebMvcConfigurer { @Bean diff --git a/spring-mvc-simple/src/main/java/com/baeldung/spring/controller/RequestMethodController.java b/spring-mvc-simple/src/main/java/com/baeldung/spring/controller/RequestMethodController.java new file mode 100644 index 0000000000..03cf729ddf --- /dev/null +++ b/spring-mvc-simple/src/main/java/com/baeldung/spring/controller/RequestMethodController.java @@ -0,0 +1,25 @@ +package com.baeldung.spring.controller; + +import com.baeldung.spring.domain.Employee; +import com.baeldung.spring.exception.InvalidRequestException; +import com.baeldung.spring.service.EmployeeService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.RestController; + +import java.util.List; + +@RestController +@RequestMapping(value="/api") +public class RequestMethodController { + + @Autowired + EmployeeService service; + + @RequestMapping(value = "/employees", produces = "application/json", method={RequestMethod.GET,RequestMethod.POST}) + public List findEmployees() + throws InvalidRequestException { + return service.getEmployeeList(); + } +} diff --git a/spring-mvc-simple/src/main/java/com/baeldung/spring/controller/RequestParamController.java b/spring-mvc-simple/src/main/java/com/baeldung/spring/controller/RequestParamController.java new file mode 100644 index 0000000000..a9846f1ba9 --- /dev/null +++ b/spring-mvc-simple/src/main/java/com/baeldung/spring/controller/RequestParamController.java @@ -0,0 +1,79 @@ +package com.baeldung.spring.controller; + +import java.util.List; +import java.util.Map; + +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.RequestParam; +import org.springframework.web.bind.annotation.ResponseBody; + + +@Controller +public class RequestParamController { + + @GetMapping("/api/foos") + @ResponseBody + public String getFoos(@RequestParam String id){ + return "ID: " + id; + } + + @PostMapping("/api/foos") + @ResponseBody + public String addFoo(@RequestParam(name = "id") String fooId, @RequestParam String name){ + return "ID: " + fooId; + } + + @GetMapping("/api/foos2") + @ResponseBody + public String getFoos2(@RequestParam(required = false) String id){ + return "ID: " + id; + } + + @GetMapping("/api/foos3") + @ResponseBody + public String getFoos3(@RequestParam(defaultValue = "test") String id){ + return "ID: " + id; + } + + @PostMapping("/api/foos1") + @ResponseBody + public String updateFoos(@RequestParam Map allParams){ + return "Parameters are " + allParams.entrySet(); + } + + @GetMapping("/api/foos4") + @ResponseBody + public String getFoos4(@RequestParam List id){ + return "ID are " + id; + } + + @GetMapping("/foos/{id}") + @ResponseBody + public String getFooById(@PathVariable String id){ + return "ID: " + id; + } + + @GetMapping("/foos") + @ResponseBody + public String getFooByIdUsingQueryParam(@RequestParam String id){ + return "ID: " + id; + } + + @GetMapping({"/myfoos/optional", "/myfoos/optional/{id}"}) + @ResponseBody + public String getFooByOptionalId(@PathVariable(required = false) String id){ + return "ID: " + id; + } + + @GetMapping("/myfoos/optionalParam") + @ResponseBody + public String getFooByOptionalIdUsingQueryParam(@RequestParam(required = false) String id){ + return "ID: " + id; + } + + + +} diff --git a/spring-mvc-simple/src/main/java/com/baeldung/spring/exception/InvalidRequestException.java b/spring-mvc-simple/src/main/java/com/baeldung/spring/exception/InvalidRequestException.java new file mode 100644 index 0000000000..4dcbe86735 --- /dev/null +++ b/spring-mvc-simple/src/main/java/com/baeldung/spring/exception/InvalidRequestException.java @@ -0,0 +1,26 @@ +package com.baeldung.spring.exception; + +public class InvalidRequestException extends RuntimeException { + + /** + * + */ + private static final long serialVersionUID = 4088649120307193208L; + + public InvalidRequestException() { + super(); + } + + public InvalidRequestException(final String message, final Throwable cause) { + super(message, cause); + } + + public InvalidRequestException(final String message) { + super(message); + } + + public InvalidRequestException(final Throwable cause) { + super(cause); + } + +} diff --git a/spring-mvc-simple/src/main/java/com/baeldung/spring/controller/push/PushController.java b/spring-mvc-simple/src/main/java/com/baeldung/spring/push/controller/PushController.java similarity index 92% rename from spring-mvc-simple/src/main/java/com/baeldung/spring/controller/push/PushController.java rename to spring-mvc-simple/src/main/java/com/baeldung/spring/push/controller/PushController.java index 88448d4885..e812e5df90 100644 --- a/spring-mvc-simple/src/main/java/com/baeldung/spring/controller/push/PushController.java +++ b/spring-mvc-simple/src/main/java/com/baeldung/spring/push/controller/PushController.java @@ -1,4 +1,4 @@ -package com.baeldung.spring.controller.push; +package com.baeldung.spring.push.controller; import javax.servlet.http.PushBuilder; diff --git a/spring-mvc-simple/src/main/java/com/baeldung/spring/service/EmployeeService.java b/spring-mvc-simple/src/main/java/com/baeldung/spring/service/EmployeeService.java new file mode 100644 index 0000000000..4d87352c42 --- /dev/null +++ b/spring-mvc-simple/src/main/java/com/baeldung/spring/service/EmployeeService.java @@ -0,0 +1,12 @@ +package com.baeldung.spring.service; + +import com.baeldung.spring.domain.Employee; +import org.springframework.stereotype.Service; + +import java.util.List; + +@Service +public interface EmployeeService { + + List getEmployeeList(); +} diff --git a/spring-mvc-simple/src/main/java/com/baeldung/spring/service/EmployeeServiceImpl.java b/spring-mvc-simple/src/main/java/com/baeldung/spring/service/EmployeeServiceImpl.java new file mode 100644 index 0000000000..18f2d70795 --- /dev/null +++ b/spring-mvc-simple/src/main/java/com/baeldung/spring/service/EmployeeServiceImpl.java @@ -0,0 +1,27 @@ +package com.baeldung.spring.service; + +import com.baeldung.spring.domain.Employee; +import org.springframework.stereotype.Service; + +import java.util.ArrayList; +import java.util.List; + +@Service +public class EmployeeServiceImpl implements EmployeeService{ + + @Override + public List getEmployeeList() { + List employeeList = new ArrayList<>(); + employeeList.add(createEmployee(100L, "Steve Martin", "333-777-999")); + employeeList.add(createEmployee(200L, "Adam Schawn", "444-111-777")); + return employeeList; + } + + private Employee createEmployee(long id, String name, String contactNumber) { + Employee employee = new Employee(); + employee.setId(id); + employee.setName(name); + employee.setContactNumber(contactNumber); + return employee; + } +} diff --git a/spring-mybatis/pom.xml b/spring-mybatis/pom.xml index 7b8b66fef1..af70cb6377 100644 --- a/spring-mybatis/pom.xml +++ b/spring-mybatis/pom.xml @@ -5,8 +5,7 @@ spring-mybatis jar 0.0.1-SNAPSHOT - spring-mybatis Maven Webapp - http://maven.apache.org + spring-mybatis com.baeldung diff --git a/spring-reactive-kotlin/pom.xml b/spring-reactive-kotlin/pom.xml index bff39984e0..7bd31396f7 100644 --- a/spring-reactive-kotlin/pom.xml +++ b/spring-reactive-kotlin/pom.xml @@ -4,7 +4,7 @@ 4.0.0 spring-reactive-kotlin jar - Spring Reactive Kotlin + spring-reactive-kotlin Demo project for Spring Boot diff --git a/spring-remoting/remoting-hessian-burlap/pom.xml b/spring-remoting/remoting-hessian-burlap/pom.xml index 6cb5a51812..e63d0ee22e 100644 --- a/spring-remoting/remoting-hessian-burlap/pom.xml +++ b/spring-remoting/remoting-hessian-burlap/pom.xml @@ -5,6 +5,7 @@ 4.0.0 remoting-hessian-burlap pom + remoting-hessian-burlap spring-remoting 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 f337d5e51f..104712c3d7 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 @@ -2,15 +2,16 @@ - + 4.0.0 + spring-remoting-hessian-burlap-client + spring-remoting-hessian-burlap-client + + remoting-hessian-burlap com.baeldung 1.0-SNAPSHOT - 4.0.0 - - spring-remoting-hessian-burlap-client - + org.springframework.boot 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 5b6e03348f..33b824442f 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 @@ -2,14 +2,15 @@ + 4.0.0 + remoting-hessian-burlap-server + remoting-hessian-burlap-server + remoting-hessian-burlap com.baeldung 1.0-SNAPSHOT - 4.0.0 - - remoting-hessian-burlap-server diff --git a/spring-remoting/remoting-http/pom.xml b/spring-remoting/remoting-http/pom.xml index 3262736ec8..886a28b886 100644 --- a/spring-remoting/remoting-http/pom.xml +++ b/spring-remoting/remoting-http/pom.xml @@ -4,8 +4,10 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 remoting-http - Parent for all modules related to HTTP Spring Remoting. pom + + remoting-http + Parent for all modules related to HTTP Spring Remoting. com.baeldung diff --git a/spring-remoting/remoting-http/remoting-http-client/pom.xml b/spring-remoting/remoting-http/remoting-http-client/pom.xml index 9a6e98ffdd..56412d3cdf 100644 --- a/spring-remoting/remoting-http/remoting-http-client/pom.xml +++ b/spring-remoting/remoting-http/remoting-http-client/pom.xml @@ -4,6 +4,7 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 remoting-http-client + remoting-http-client Shows how to invoke a remote service using Spring Remoting HTTP. diff --git a/spring-remoting/remoting-http/remoting-http-server/pom.xml b/spring-remoting/remoting-http/remoting-http-server/pom.xml index 53d27a5efa..c3f87e776e 100644 --- a/spring-remoting/remoting-http/remoting-http-server/pom.xml +++ b/spring-remoting/remoting-http/remoting-http-server/pom.xml @@ -4,6 +4,7 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 remoting-http-server + remoting-http-server Shows how to expose a service using Spring Remoting HTTP. diff --git a/spring-remoting/remoting-jms/pom.xml b/spring-remoting/remoting-jms/pom.xml index fe36431423..e24b5b7929 100644 --- a/spring-remoting/remoting-jms/pom.xml +++ b/spring-remoting/remoting-jms/pom.xml @@ -2,18 +2,20 @@ + 4.0.0 + remoting-jms + remoting-jms + pom + spring-remoting com.baeldung 1.0-SNAPSHOT - 4.0.0 - pom + remoting-jms-client remoting-jms-server - remoting-jms - \ No newline at end of file diff --git a/spring-remoting/remoting-jms/remoting-jms-client/pom.xml b/spring-remoting/remoting-jms/remoting-jms-client/pom.xml index ed27282a38..b7b1af5a1a 100644 --- a/spring-remoting/remoting-jms/remoting-jms-client/pom.xml +++ b/spring-remoting/remoting-jms/remoting-jms-client/pom.xml @@ -2,14 +2,15 @@ + 4.0.0 + remoting-jms-client + remoting-jms-client + remoting-jms com.baeldung 1.0-SNAPSHOT - 4.0.0 - - remoting-jms-client UTF-8 diff --git a/spring-remoting/remoting-jms/remoting-jms-server/pom.xml b/spring-remoting/remoting-jms/remoting-jms-server/pom.xml index 7657267f1d..8a17cdb0a9 100644 --- a/spring-remoting/remoting-jms/remoting-jms-server/pom.xml +++ b/spring-remoting/remoting-jms/remoting-jms-server/pom.xml @@ -2,14 +2,15 @@ + 4.0.0 + remoting-jms-server + remoting-jms-server + remoting-jms com.baeldung 1.0-SNAPSHOT - 4.0.0 - - remoting-jms-server UTF-8 diff --git a/spring-remoting/remoting-rmi/pom.xml b/spring-remoting/remoting-rmi/pom.xml index cd15a6ec60..b3b84786b8 100644 --- a/spring-remoting/remoting-rmi/pom.xml +++ b/spring-remoting/remoting-rmi/pom.xml @@ -3,8 +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"> 4.0.0 - pom remoting-rmi + pom + remoting-rmi spring-remoting diff --git a/spring-remoting/remoting-rmi/remoting-rmi-client/pom.xml b/spring-remoting/remoting-rmi/remoting-rmi-client/pom.xml index 1e3cd4b977..4ac0283e94 100644 --- a/spring-remoting/remoting-rmi/remoting-rmi-client/pom.xml +++ b/spring-remoting/remoting-rmi/remoting-rmi-client/pom.xml @@ -2,15 +2,16 @@ + 4.0.0 + remoting-rmi-client + remoting-rmi-client + remoting-rmi com.baeldung 1.0-SNAPSHOT - 4.0.0 - - remoting-rmi-client - + org.springframework.boot diff --git a/spring-remoting/remoting-rmi/remoting-rmi-server/pom.xml b/spring-remoting/remoting-rmi/remoting-rmi-server/pom.xml index 68b01829e1..7fb4d2c1bc 100644 --- a/spring-remoting/remoting-rmi/remoting-rmi-server/pom.xml +++ b/spring-remoting/remoting-rmi/remoting-rmi-server/pom.xml @@ -2,14 +2,15 @@ + 4.0.0 + remoting-rmi-server + remoting-rmi-server + remoting-rmi com.baeldung 1.0-SNAPSHOT - 4.0.0 - - remoting-rmi-server UTF-8 diff --git a/spring-rest-angular/README.md b/spring-rest-angular/README.md index 7ead9442fd..d2c2879649 100644 --- a/spring-rest-angular/README.md +++ b/spring-rest-angular/README.md @@ -2,5 +2,4 @@ ### Relevant Articles: -- [Spring’s RequestBody and ResponseBody Annotations](http://www.baeldung.com/spring-request-response-body) - [Pagination with Spring REST and AngularJS table](http://www.baeldung.com/pagination-with-a-spring-rest-api-and-an-angularjs-table) diff --git a/spring-rest-angular/pom.xml b/spring-rest-angular/pom.xml index 7aedfa486b..22ddabb4ea 100644 --- a/spring-rest-angular/pom.xml +++ b/spring-rest-angular/pom.xml @@ -8,10 +8,10 @@ war - parent-boot-1 + parent-boot-2.0-temp com.baeldung 0.0.1-SNAPSHOT - ../parent-boot-1 + ../parent-boot-2.0-temp diff --git a/spring-rest-angular/src/main/resources/application.properties b/spring-rest-angular/src/main/resources/application.properties index e24db89c8f..2571d286a3 100644 --- a/spring-rest-angular/src/main/resources/application.properties +++ b/spring-rest-angular/src/main/resources/application.properties @@ -1,4 +1,4 @@ -server.contextPath=/ +server.servlet.contextPath=/ spring.h2.console.enabled=true logging.level.org.hibernate.SQL=info spring.jpa.hibernate.ddl-auto=none \ No newline at end of file diff --git a/spring-rest-full/README.md b/spring-rest-full/README.md index b8fef9cb82..a5d72372f7 100644 --- a/spring-rest-full/README.md +++ b/spring-rest-full/README.md @@ -17,7 +17,7 @@ The "Learn Spring Security" Classes: http://github.learnspringsecurity.com - [Project Configuration with Spring](http://www.baeldung.com/project-configuration-with-spring) - [Metrics for your Spring REST API](http://www.baeldung.com/spring-rest-api-metrics) - [Bootstrap a Web Application with Spring 4](http://www.baeldung.com/bootstraping-a-web-application-with-spring-and-java-based-configuration) -- [Build a REST API with Spring 4 and Java Config](http://www.baeldung.com/building-a-restful-web-service-with-spring-and-java-based-configuration) +- [Build a REST API with Spring and Java Config](http://www.baeldung.com/building-a-restful-web-service-with-spring-and-java-based-configuration) - [Error Handling for REST with Spring](http://www.baeldung.com/exception-handling-for-rest-with-spring) diff --git a/spring-rest-hal-browser/pom.xml b/spring-rest-hal-browser/pom.xml index 6c56faf0b2..ee0a2c043d 100644 --- a/spring-rest-hal-browser/pom.xml +++ b/spring-rest-hal-browser/pom.xml @@ -3,10 +3,11 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 - com.baeldung spring-rest-hal-browser 1.0-SNAPSHOT + spring-rest-hal-browser + diff --git a/spring-rest-query-language/pom.xml b/spring-rest-query-language/pom.xml index 8b24c7b8fb..6f790f1f48 100644 --- a/spring-rest-query-language/pom.xml +++ b/spring-rest-query-language/pom.xml @@ -1,17 +1,16 @@ 4.0.0 - com.baeldung spring-rest-query-language 0.1-SNAPSHOT spring-rest-query-language war - parent-boot-1 + parent-boot-2.0-temp com.baeldung 0.0.1-SNAPSHOT - ../parent-boot-1 + ../parent-boot-2.0-temp @@ -149,6 +148,7 @@ org.javassist javassist + ${javassist.version} mysql @@ -349,13 +349,14 @@ 1.4.9 - + 3.21.0-GA + 19.0 3.5 - + - 1.6.1 + 1.7.0 1.1.3 diff --git a/spring-rest-query-language/src/main/java/org/baeldung/persistence/dao/GenericSpecificationsBuilder.java b/spring-rest-query-language/src/main/java/com/baeldung/persistence/dao/GenericSpecificationsBuilder.java similarity index 86% rename from spring-rest-query-language/src/main/java/org/baeldung/persistence/dao/GenericSpecificationsBuilder.java rename to spring-rest-query-language/src/main/java/com/baeldung/persistence/dao/GenericSpecificationsBuilder.java index 64bab9a435..75fb4456c4 100644 --- a/spring-rest-query-language/src/main/java/org/baeldung/persistence/dao/GenericSpecificationsBuilder.java +++ b/spring-rest-query-language/src/main/java/com/baeldung/persistence/dao/GenericSpecificationsBuilder.java @@ -1,4 +1,4 @@ -package org.baeldung.persistence.dao; +package com.baeldung.persistence.dao; import java.util.ArrayList; import java.util.Collections; @@ -8,10 +8,10 @@ import java.util.List; import java.util.function.Function; import java.util.stream.Collectors; -import org.baeldung.web.util.SearchOperation; -import org.baeldung.web.util.SpecSearchCriteria; import org.springframework.data.jpa.domain.Specification; -import org.springframework.data.jpa.domain.Specifications; + +import com.baeldung.web.util.SearchOperation; +import com.baeldung.web.util.SpecSearchCriteria; public class GenericSpecificationsBuilder { @@ -61,11 +61,12 @@ public class GenericSpecificationsBuilder { for (int idx = 1; idx < specs.size(); idx++) { result = params.get(idx) .isOrPredicate() - ? Specifications.where(result) + ? Specification.where(result) .or(specs.get(idx)) - : Specifications.where(result) + : Specification.where(result) .and(specs.get(idx)); } + return result; } @@ -84,10 +85,10 @@ public class GenericSpecificationsBuilder { Specification operand1 = specStack.pop(); Specification operand2 = specStack.pop(); if (mayBeOperand.equals(SearchOperation.AND_OPERATOR)) - specStack.push(Specifications.where(operand1) + specStack.push(Specification.where(operand1) .and(operand2)); else if (mayBeOperand.equals(SearchOperation.OR_OPERATOR)) - specStack.push(Specifications.where(operand1) + specStack.push(Specification.where(operand1) .or(operand2)); } diff --git a/spring-rest-query-language/src/main/java/org/baeldung/persistence/dao/IUserDAO.java b/spring-rest-query-language/src/main/java/com/baeldung/persistence/dao/IUserDAO.java similarity index 52% rename from spring-rest-query-language/src/main/java/org/baeldung/persistence/dao/IUserDAO.java rename to spring-rest-query-language/src/main/java/com/baeldung/persistence/dao/IUserDAO.java index 4e74e94925..4837795792 100644 --- a/spring-rest-query-language/src/main/java/org/baeldung/persistence/dao/IUserDAO.java +++ b/spring-rest-query-language/src/main/java/com/baeldung/persistence/dao/IUserDAO.java @@ -1,9 +1,9 @@ -package org.baeldung.persistence.dao; +package com.baeldung.persistence.dao; import java.util.List; -import org.baeldung.persistence.model.User; -import org.baeldung.web.util.SearchCriteria; +import com.baeldung.persistence.model.User; +import com.baeldung.web.util.SearchCriteria; public interface IUserDAO { List searchUser(List params); diff --git a/spring-rest-query-language/src/main/java/org/baeldung/persistence/dao/MyUserPredicate.java b/spring-rest-query-language/src/main/java/com/baeldung/persistence/dao/MyUserPredicate.java similarity index 92% rename from spring-rest-query-language/src/main/java/org/baeldung/persistence/dao/MyUserPredicate.java rename to spring-rest-query-language/src/main/java/com/baeldung/persistence/dao/MyUserPredicate.java index 5dd4cdd17e..0c3a4a51f9 100644 --- a/spring-rest-query-language/src/main/java/org/baeldung/persistence/dao/MyUserPredicate.java +++ b/spring-rest-query-language/src/main/java/com/baeldung/persistence/dao/MyUserPredicate.java @@ -1,8 +1,7 @@ -package org.baeldung.persistence.dao; - -import org.baeldung.persistence.model.MyUser; -import org.baeldung.web.util.SearchCriteria; +package com.baeldung.persistence.dao; +import com.baeldung.persistence.model.MyUser; +import com.baeldung.web.util.SearchCriteria; import com.querydsl.core.types.dsl.BooleanExpression; import com.querydsl.core.types.dsl.NumberPath; import com.querydsl.core.types.dsl.PathBuilder; diff --git a/spring-rest-query-language/src/main/java/com/baeldung/persistence/dao/MyUserPredicatesBuilder.java b/spring-rest-query-language/src/main/java/com/baeldung/persistence/dao/MyUserPredicatesBuilder.java new file mode 100644 index 0000000000..6aad1a3bab --- /dev/null +++ b/spring-rest-query-language/src/main/java/com/baeldung/persistence/dao/MyUserPredicatesBuilder.java @@ -0,0 +1,58 @@ +package com.baeldung.persistence.dao; + +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import java.util.stream.Collectors; + +import com.baeldung.web.util.SearchCriteria; +import com.querydsl.core.types.dsl.BooleanExpression; +import com.querydsl.core.types.dsl.Expressions; + +public final class MyUserPredicatesBuilder { + private final List params; + + public MyUserPredicatesBuilder() { + params = new ArrayList<>(); + } + + public MyUserPredicatesBuilder with(final String key, final String operation, final Object value) { + params.add(new SearchCriteria(key, operation, value)); + return this; + } + + public BooleanExpression build() { + if (params.size() == 0) { + return null; + } + + final List predicates = params.stream().map(param -> { + MyUserPredicate predicate = new MyUserPredicate(param); + return predicate.getPredicate(); + }).filter(Objects::nonNull).collect(Collectors.toList()); + + BooleanExpression result = Expressions.asBoolean(true).isTrue(); + for (BooleanExpression predicate : predicates) { + result = result.and(predicate); + } + + return result; + } + + static class BooleanExpressionWrapper { + + private BooleanExpression result; + + public BooleanExpressionWrapper(final BooleanExpression result) { + super(); + this.result = result; + } + + public BooleanExpression getResult() { + return result; + } + public void setResult(BooleanExpression result) { + this.result = result; + } + } +} diff --git a/spring-rest-query-language/src/main/java/org/baeldung/persistence/dao/MyUserRepository.java b/spring-rest-query-language/src/main/java/com/baeldung/persistence/dao/MyUserRepository.java similarity index 74% rename from spring-rest-query-language/src/main/java/org/baeldung/persistence/dao/MyUserRepository.java rename to spring-rest-query-language/src/main/java/com/baeldung/persistence/dao/MyUserRepository.java index 82ae1ee841..3be361e85a 100644 --- a/spring-rest-query-language/src/main/java/org/baeldung/persistence/dao/MyUserRepository.java +++ b/spring-rest-query-language/src/main/java/com/baeldung/persistence/dao/MyUserRepository.java @@ -1,17 +1,17 @@ -package org.baeldung.persistence.dao; +package com.baeldung.persistence.dao; -import com.querydsl.core.types.dsl.StringExpression; -import org.baeldung.persistence.model.MyUser; -import org.baeldung.persistence.model.QMyUser; +import com.baeldung.persistence.model.QMyUser; import org.springframework.data.jpa.repository.JpaRepository; -import org.springframework.data.querydsl.QueryDslPredicateExecutor; +import org.springframework.data.querydsl.QuerydslPredicateExecutor; import org.springframework.data.querydsl.binding.QuerydslBinderCustomizer; import org.springframework.data.querydsl.binding.QuerydslBindings; - -import com.querydsl.core.types.dsl.StringPath; import org.springframework.data.querydsl.binding.SingleValueBinding; -public interface MyUserRepository extends JpaRepository, QueryDslPredicateExecutor, QuerydslBinderCustomizer { +import com.baeldung.persistence.model.MyUser; +import com.querydsl.core.types.dsl.StringExpression; +import com.querydsl.core.types.dsl.StringPath; + +public interface MyUserRepository extends JpaRepository, QuerydslPredicateExecutor, QuerydslBinderCustomizer { @Override default public void customize(final QuerydslBindings bindings, final QMyUser root) { bindings.bind(String.class) diff --git a/spring-rest-query-language/src/main/java/com/baeldung/persistence/dao/UserDAO.java b/spring-rest-query-language/src/main/java/com/baeldung/persistence/dao/UserDAO.java new file mode 100644 index 0000000000..6bc899176a --- /dev/null +++ b/spring-rest-query-language/src/main/java/com/baeldung/persistence/dao/UserDAO.java @@ -0,0 +1,43 @@ +package com.baeldung.persistence.dao; + +import java.util.List; + +import javax.persistence.EntityManager; +import javax.persistence.PersistenceContext; +import javax.persistence.criteria.CriteriaBuilder; +import javax.persistence.criteria.CriteriaQuery; +import javax.persistence.criteria.Predicate; +import javax.persistence.criteria.Root; + +import org.springframework.stereotype.Repository; + +import com.baeldung.persistence.model.User; +import com.baeldung.web.util.SearchCriteria; + +@Repository +public class UserDAO implements IUserDAO { + + @PersistenceContext + private EntityManager entityManager; + + @Override + public List searchUser(final List params) { + final CriteriaBuilder builder = entityManager.getCriteriaBuilder(); + final CriteriaQuery query = builder.createQuery(User.class); + final Root r = query.from(User.class); + + Predicate predicate = builder.conjunction(); + UserSearchQueryCriteriaConsumer searchConsumer = new UserSearchQueryCriteriaConsumer(predicate, builder, r); + params.stream().forEach(searchConsumer); + predicate = searchConsumer.getPredicate(); + query.where(predicate); + + return entityManager.createQuery(query).getResultList(); + } + + @Override + public void save(final User entity) { + entityManager.persist(entity); + } + +} diff --git a/spring-rest-query-language/src/main/java/org/baeldung/persistence/dao/UserRepository.java b/spring-rest-query-language/src/main/java/com/baeldung/persistence/dao/UserRepository.java similarity index 74% rename from spring-rest-query-language/src/main/java/org/baeldung/persistence/dao/UserRepository.java rename to spring-rest-query-language/src/main/java/com/baeldung/persistence/dao/UserRepository.java index de7acf60d5..1a7eda07ed 100644 --- a/spring-rest-query-language/src/main/java/org/baeldung/persistence/dao/UserRepository.java +++ b/spring-rest-query-language/src/main/java/com/baeldung/persistence/dao/UserRepository.java @@ -1,9 +1,10 @@ -package org.baeldung.persistence.dao; +package com.baeldung.persistence.dao; -import org.baeldung.persistence.model.User; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.JpaSpecificationExecutor; +import com.baeldung.persistence.model.User; + public interface UserRepository extends JpaRepository, JpaSpecificationExecutor { } diff --git a/spring-rest-query-language/src/main/java/com/baeldung/persistence/dao/UserSearchQueryCriteriaConsumer.java b/spring-rest-query-language/src/main/java/com/baeldung/persistence/dao/UserSearchQueryCriteriaConsumer.java new file mode 100644 index 0000000000..a3e619ad21 --- /dev/null +++ b/spring-rest-query-language/src/main/java/com/baeldung/persistence/dao/UserSearchQueryCriteriaConsumer.java @@ -0,0 +1,43 @@ +package com.baeldung.persistence.dao; + +import java.util.function.Consumer; + +import javax.persistence.criteria.CriteriaBuilder; +import javax.persistence.criteria.Predicate; +import javax.persistence.criteria.Root; + +import com.baeldung.web.util.SearchCriteria; + +public class UserSearchQueryCriteriaConsumer implements Consumer{ + + private Predicate predicate; + private CriteriaBuilder builder; + private Root r; + + public UserSearchQueryCriteriaConsumer(Predicate predicate, CriteriaBuilder builder, Root r) { + super(); + this.predicate = predicate; + this.builder = builder; + this.r= r; + } + + @Override + public void accept(SearchCriteria param) { + + if (param.getOperation().equalsIgnoreCase(">")) { + predicate = builder.and(predicate, builder.greaterThanOrEqualTo(r.get(param.getKey()), param.getValue().toString())); + } else if (param.getOperation().equalsIgnoreCase("<")) { + predicate = builder.and(predicate, builder.lessThanOrEqualTo(r.get(param.getKey()), param.getValue().toString())); + } else if (param.getOperation().equalsIgnoreCase(":")) { + if (r.get(param.getKey()).getJavaType() == String.class) { + predicate = builder.and(predicate, builder.like(r.get(param.getKey()), "%" + param.getValue() + "%")); + } else { + predicate = builder.and(predicate, builder.equal(r.get(param.getKey()), param.getValue())); + } + } + } + + public Predicate getPredicate() { + return predicate; + } +} \ No newline at end of file diff --git a/spring-rest-query-language/src/main/java/org/baeldung/persistence/dao/UserSpecification.java b/spring-rest-query-language/src/main/java/com/baeldung/persistence/dao/UserSpecification.java similarity index 92% rename from spring-rest-query-language/src/main/java/org/baeldung/persistence/dao/UserSpecification.java rename to spring-rest-query-language/src/main/java/com/baeldung/persistence/dao/UserSpecification.java index b2d9394500..928e75aea7 100644 --- a/spring-rest-query-language/src/main/java/org/baeldung/persistence/dao/UserSpecification.java +++ b/spring-rest-query-language/src/main/java/com/baeldung/persistence/dao/UserSpecification.java @@ -1,9 +1,10 @@ -package org.baeldung.persistence.dao; +package com.baeldung.persistence.dao; -import org.baeldung.persistence.model.User; -import org.baeldung.web.util.SpecSearchCriteria; import org.springframework.data.jpa.domain.Specification; +import com.baeldung.persistence.model.User; +import com.baeldung.web.util.SpecSearchCriteria; + import javax.persistence.criteria.CriteriaBuilder; import javax.persistence.criteria.CriteriaQuery; import javax.persistence.criteria.Predicate; diff --git a/spring-rest-query-language/src/main/java/org/baeldung/persistence/dao/UserSpecificationsBuilder.java b/spring-rest-query-language/src/main/java/com/baeldung/persistence/dao/UserSpecificationsBuilder.java similarity index 77% rename from spring-rest-query-language/src/main/java/org/baeldung/persistence/dao/UserSpecificationsBuilder.java rename to spring-rest-query-language/src/main/java/com/baeldung/persistence/dao/UserSpecificationsBuilder.java index 918e77720f..72d7274226 100644 --- a/spring-rest-query-language/src/main/java/org/baeldung/persistence/dao/UserSpecificationsBuilder.java +++ b/spring-rest-query-language/src/main/java/com/baeldung/persistence/dao/UserSpecificationsBuilder.java @@ -1,14 +1,14 @@ -package org.baeldung.persistence.dao; - -import org.baeldung.persistence.model.User; -import org.baeldung.web.util.SearchOperation; -import org.baeldung.web.util.SpecSearchCriteria; -import org.springframework.data.jpa.domain.Specification; -import org.springframework.data.jpa.domain.Specifications; +package com.baeldung.persistence.dao; import java.util.ArrayList; import java.util.List; +import org.springframework.data.jpa.domain.Specification; + +import com.baeldung.persistence.model.User; +import com.baeldung.web.util.SearchOperation; +import com.baeldung.web.util.SpecSearchCriteria; + public final class UserSpecificationsBuilder { private final List params; @@ -44,22 +44,17 @@ public final class UserSpecificationsBuilder { } public Specification build() { - if (params.size() == 0) return null; Specification result = new UserSpecification(params.get(0)); - + for (int i = 1; i < params.size(); i++) { - result = params.get(i) - .isOrPredicate() - ? Specifications.where(result) - .or(new UserSpecification(params.get(i))) - : Specifications.where(result) - .and(new UserSpecification(params.get(i))); - + result = params.get(i).isOrPredicate() + ? Specification.where(result).or(new UserSpecification(params.get(i))) + : Specification.where(result).and(new UserSpecification(params.get(i))); } - + return result; } diff --git a/spring-rest-query-language/src/main/java/org/baeldung/persistence/dao/rsql/CustomRsqlVisitor.java b/spring-rest-query-language/src/main/java/com/baeldung/persistence/dao/rsql/CustomRsqlVisitor.java similarity index 95% rename from spring-rest-query-language/src/main/java/org/baeldung/persistence/dao/rsql/CustomRsqlVisitor.java rename to spring-rest-query-language/src/main/java/com/baeldung/persistence/dao/rsql/CustomRsqlVisitor.java index 89cec89951..9c399e97ed 100644 --- a/spring-rest-query-language/src/main/java/org/baeldung/persistence/dao/rsql/CustomRsqlVisitor.java +++ b/spring-rest-query-language/src/main/java/com/baeldung/persistence/dao/rsql/CustomRsqlVisitor.java @@ -1,4 +1,4 @@ -package org.baeldung.persistence.dao.rsql; +package com.baeldung.persistence.dao.rsql; import org.springframework.data.jpa.domain.Specification; diff --git a/spring-rest-query-language/src/main/java/com/baeldung/persistence/dao/rsql/GenericRsqlSpecBuilder.java b/spring-rest-query-language/src/main/java/com/baeldung/persistence/dao/rsql/GenericRsqlSpecBuilder.java new file mode 100644 index 0000000000..e81e9ab916 --- /dev/null +++ b/spring-rest-query-language/src/main/java/com/baeldung/persistence/dao/rsql/GenericRsqlSpecBuilder.java @@ -0,0 +1,53 @@ +package com.baeldung.persistence.dao.rsql; + +import java.util.List; +import java.util.Objects; +import java.util.stream.Collectors; + +import org.springframework.data.jpa.domain.Specification; + +import cz.jirutka.rsql.parser.ast.ComparisonNode; +import cz.jirutka.rsql.parser.ast.LogicalNode; +import cz.jirutka.rsql.parser.ast.LogicalOperator; +import cz.jirutka.rsql.parser.ast.Node; + +public class GenericRsqlSpecBuilder { + + public Specification createSpecification(final Node node) { + if (node instanceof LogicalNode) { + return createSpecification((LogicalNode) node); + } + if (node instanceof ComparisonNode) { + return createSpecification((ComparisonNode) node); + } + return null; + } + + public Specification createSpecification(final LogicalNode logicalNode) { + + List> specs = logicalNode.getChildren() + .stream() + .map(node -> createSpecification(node)) + .filter(Objects::nonNull) + .collect(Collectors.toList()); + + Specification result = specs.get(0); + if (logicalNode.getOperator() == LogicalOperator.AND) { + for (int i = 1; i < specs.size(); i++) { + result = Specification.where(result).and(specs.get(i)); + } + } + else if (logicalNode.getOperator() == LogicalOperator.OR) { + for (int i = 1; i < specs.size(); i++) { + result = Specification.where(result).or(specs.get(i)); + } + } + + return result; + } + + public Specification createSpecification(final ComparisonNode comparisonNode) { + return Specification.where(new GenericRsqlSpecification(comparisonNode.getSelector(), comparisonNode.getOperator(), comparisonNode.getArguments())); + } + +} diff --git a/spring-rest-query-language/src/main/java/org/baeldung/persistence/dao/rsql/GenericRsqlSpecification.java b/spring-rest-query-language/src/main/java/com/baeldung/persistence/dao/rsql/GenericRsqlSpecification.java similarity index 89% rename from spring-rest-query-language/src/main/java/org/baeldung/persistence/dao/rsql/GenericRsqlSpecification.java rename to spring-rest-query-language/src/main/java/com/baeldung/persistence/dao/rsql/GenericRsqlSpecification.java index 937c6d953c..87a46d4a85 100644 --- a/spring-rest-query-language/src/main/java/org/baeldung/persistence/dao/rsql/GenericRsqlSpecification.java +++ b/spring-rest-query-language/src/main/java/com/baeldung/persistence/dao/rsql/GenericRsqlSpecification.java @@ -1,14 +1,16 @@ -package org.baeldung.persistence.dao.rsql; +package com.baeldung.persistence.dao.rsql; -import cz.jirutka.rsql.parser.ast.ComparisonOperator; -import org.springframework.data.jpa.domain.Specification; +import java.util.List; +import java.util.stream.Collectors; import javax.persistence.criteria.CriteriaBuilder; import javax.persistence.criteria.CriteriaQuery; import javax.persistence.criteria.Predicate; import javax.persistence.criteria.Root; -import java.util.ArrayList; -import java.util.List; + +import org.springframework.data.jpa.domain.Specification; + +import cz.jirutka.rsql.parser.ast.ComparisonOperator; public class GenericRsqlSpecification implements Specification { @@ -71,18 +73,18 @@ public class GenericRsqlSpecification implements Specification { // === private private List castArguments(final Root root) { - final List args = new ArrayList(); + final Class type = root.get(property).getJavaType(); - - for (final String argument : arguments) { + + final List args = arguments.stream().map(arg -> { if (type.equals(Integer.class)) { - args.add(Integer.parseInt(argument)); + return Integer.parseInt(arg); } else if (type.equals(Long.class)) { - args.add(Long.parseLong(argument)); + return Long.parseLong(arg); } else { - args.add(argument); - } - } + return arg; + } + }).collect(Collectors.toList()); return args; } diff --git a/spring-rest-query-language/src/main/java/org/baeldung/persistence/dao/rsql/RsqlSearchOperation.java b/spring-rest-query-language/src/main/java/com/baeldung/persistence/dao/rsql/RsqlSearchOperation.java similarity index 95% rename from spring-rest-query-language/src/main/java/org/baeldung/persistence/dao/rsql/RsqlSearchOperation.java rename to spring-rest-query-language/src/main/java/com/baeldung/persistence/dao/rsql/RsqlSearchOperation.java index 673e78fbb4..81441fa609 100644 --- a/spring-rest-query-language/src/main/java/org/baeldung/persistence/dao/rsql/RsqlSearchOperation.java +++ b/spring-rest-query-language/src/main/java/com/baeldung/persistence/dao/rsql/RsqlSearchOperation.java @@ -1,4 +1,4 @@ -package org.baeldung.persistence.dao.rsql; +package com.baeldung.persistence.dao.rsql; import cz.jirutka.rsql.parser.ast.ComparisonOperator; import cz.jirutka.rsql.parser.ast.RSQLOperators; diff --git a/spring-rest-query-language/src/main/java/org/baeldung/persistence/model/MyUser.java b/spring-rest-query-language/src/main/java/com/baeldung/persistence/model/MyUser.java similarity index 98% rename from spring-rest-query-language/src/main/java/org/baeldung/persistence/model/MyUser.java rename to spring-rest-query-language/src/main/java/com/baeldung/persistence/model/MyUser.java index 9a7bb4da3d..f3b9dc3810 100644 --- a/spring-rest-query-language/src/main/java/org/baeldung/persistence/model/MyUser.java +++ b/spring-rest-query-language/src/main/java/com/baeldung/persistence/model/MyUser.java @@ -1,4 +1,4 @@ -package org.baeldung.persistence.model; +package com.baeldung.persistence.model; import javax.persistence.Entity; import javax.persistence.GeneratedValue; diff --git a/spring-rest-query-language/src/main/java/org/baeldung/persistence/model/User.java b/spring-rest-query-language/src/main/java/com/baeldung/persistence/model/User.java similarity index 97% rename from spring-rest-query-language/src/main/java/org/baeldung/persistence/model/User.java rename to spring-rest-query-language/src/main/java/com/baeldung/persistence/model/User.java index 670d4a2e74..dbc2b9360f 100644 --- a/spring-rest-query-language/src/main/java/org/baeldung/persistence/model/User.java +++ b/spring-rest-query-language/src/main/java/com/baeldung/persistence/model/User.java @@ -1,4 +1,4 @@ -package org.baeldung.persistence.model; +package com.baeldung.persistence.model; import javax.persistence.Entity; import javax.persistence.GeneratedValue; diff --git a/spring-rest-query-language/src/main/java/org/baeldung/persistence/model/User_.java b/spring-rest-query-language/src/main/java/com/baeldung/persistence/model/User_.java similarity index 92% rename from spring-rest-query-language/src/main/java/org/baeldung/persistence/model/User_.java rename to spring-rest-query-language/src/main/java/com/baeldung/persistence/model/User_.java index b705c51ff8..c101b1d9b3 100644 --- a/spring-rest-query-language/src/main/java/org/baeldung/persistence/model/User_.java +++ b/spring-rest-query-language/src/main/java/com/baeldung/persistence/model/User_.java @@ -1,4 +1,4 @@ -package org.baeldung.persistence.model; +package com.baeldung.persistence.model; import javax.persistence.metamodel.SingularAttribute; import javax.persistence.metamodel.StaticMetamodel; diff --git a/spring-rest-query-language/src/main/java/org/baeldung/spring/Application.java b/spring-rest-query-language/src/main/java/com/baeldung/spring/Application.java similarity index 90% rename from spring-rest-query-language/src/main/java/org/baeldung/spring/Application.java rename to spring-rest-query-language/src/main/java/com/baeldung/spring/Application.java index 7aa9ea5bc3..371377021a 100644 --- a/spring-rest-query-language/src/main/java/org/baeldung/spring/Application.java +++ b/spring-rest-query-language/src/main/java/com/baeldung/spring/Application.java @@ -1,4 +1,4 @@ -package org.baeldung.spring; +package com.baeldung.spring; import javax.servlet.ServletContext; import javax.servlet.ServletException; @@ -7,7 +7,7 @@ import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.builder.SpringApplicationBuilder; -import org.springframework.boot.web.support.SpringBootServletInitializer; +import org.springframework.boot.web.servlet.support.SpringBootServletInitializer; import org.springframework.context.annotation.ComponentScan; import org.springframework.scheduling.annotation.EnableScheduling; import org.springframework.web.context.request.RequestContextListener; @@ -19,7 +19,7 @@ import org.springframework.web.context.request.RequestContextListener; */ @EnableScheduling @EnableAutoConfiguration -@ComponentScan("org.baeldung") +@ComponentScan("com.baeldung") @SpringBootApplication public class Application extends SpringBootServletInitializer { diff --git a/spring-rest-query-language/src/main/java/org/baeldung/spring/PersistenceConfig.java b/spring-rest-query-language/src/main/java/com/baeldung/spring/PersistenceConfig.java similarity index 94% rename from spring-rest-query-language/src/main/java/org/baeldung/spring/PersistenceConfig.java rename to spring-rest-query-language/src/main/java/com/baeldung/spring/PersistenceConfig.java index f3a87b189e..4a4b9eee3f 100644 --- a/spring-rest-query-language/src/main/java/org/baeldung/spring/PersistenceConfig.java +++ b/spring-rest-query-language/src/main/java/com/baeldung/spring/PersistenceConfig.java @@ -1,4 +1,4 @@ -package org.baeldung.spring; +package com.baeldung.spring; import java.util.Properties; @@ -24,9 +24,9 @@ import com.google.common.base.Preconditions; @Configuration @EnableTransactionManagement @PropertySource({ "classpath:persistence-${envTarget:h2}.properties" }) -@ComponentScan({ "org.baeldung.persistence" }) +@ComponentScan({ "com.baeldung.persistence" }) // @ImportResource("classpath*:springDataPersistenceConfig.xml") -@EnableJpaRepositories(basePackages = "org.baeldung.persistence.dao") +@EnableJpaRepositories(basePackages = "com.baeldung.persistence.dao") public class PersistenceConfig { @Autowired @@ -40,7 +40,7 @@ public class PersistenceConfig { public LocalContainerEntityManagerFactoryBean entityManagerFactory() { final LocalContainerEntityManagerFactoryBean em = new LocalContainerEntityManagerFactoryBean(); em.setDataSource(dataSource()); - em.setPackagesToScan(new String[] { "org.baeldung.persistence.model" }); + em.setPackagesToScan(new String[] { "com.baeldung.persistence.model" }); final HibernateJpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter(); // vendorAdapter.set diff --git a/spring-rest-query-language/src/main/java/org/baeldung/spring/WebConfig.java b/spring-rest-query-language/src/main/java/com/baeldung/spring/WebConfig.java similarity index 80% rename from spring-rest-query-language/src/main/java/org/baeldung/spring/WebConfig.java rename to spring-rest-query-language/src/main/java/com/baeldung/spring/WebConfig.java index 41711ee1ad..f5a5bc4b5e 100644 --- a/spring-rest-query-language/src/main/java/org/baeldung/spring/WebConfig.java +++ b/spring-rest-query-language/src/main/java/com/baeldung/spring/WebConfig.java @@ -1,4 +1,4 @@ -package org.baeldung.spring; +package com.baeldung.spring; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.ComponentScan; @@ -6,17 +6,13 @@ import org.springframework.context.annotation.Configuration; import org.springframework.web.servlet.ViewResolver; import org.springframework.web.servlet.config.annotation.EnableWebMvc; import org.springframework.web.servlet.config.annotation.ViewControllerRegistry; -import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter; +import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; import org.springframework.web.servlet.view.InternalResourceViewResolver; @Configuration -@ComponentScan("org.baeldung.web") +@ComponentScan("com.baeldung.web") @EnableWebMvc -public class WebConfig extends WebMvcConfigurerAdapter { - - public WebConfig() { - super(); - } +public class WebConfig implements WebMvcConfigurer { @Bean public ViewResolver viewResolver() { @@ -29,7 +25,6 @@ public class WebConfig extends WebMvcConfigurerAdapter { // API @Override public void addViewControllers(final ViewControllerRegistry registry) { - super.addViewControllers(registry); registry.addViewController("/homepage.html"); } diff --git a/spring-rest-query-language/src/main/java/org/baeldung/web/controller/HomeController.java b/spring-rest-query-language/src/main/java/com/baeldung/web/controller/HomeController.java similarity index 87% rename from spring-rest-query-language/src/main/java/org/baeldung/web/controller/HomeController.java rename to spring-rest-query-language/src/main/java/com/baeldung/web/controller/HomeController.java index 9c4d14cae3..c82911211a 100644 --- a/spring-rest-query-language/src/main/java/org/baeldung/web/controller/HomeController.java +++ b/spring-rest-query-language/src/main/java/com/baeldung/web/controller/HomeController.java @@ -1,4 +1,4 @@ -package org.baeldung.web.controller; +package com.baeldung.web.controller; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; diff --git a/spring-rest-query-language/src/main/java/org/baeldung/web/controller/UserController.java b/spring-rest-query-language/src/main/java/com/baeldung/web/controller/UserController.java similarity index 87% rename from spring-rest-query-language/src/main/java/org/baeldung/web/controller/UserController.java rename to spring-rest-query-language/src/main/java/com/baeldung/web/controller/UserController.java index 8953a52a1b..101231c7ab 100644 --- a/spring-rest-query-language/src/main/java/org/baeldung/web/controller/UserController.java +++ b/spring-rest-query-language/src/main/java/com/baeldung/web/controller/UserController.java @@ -1,23 +1,10 @@ -package org.baeldung.web.controller; +package com.baeldung.web.controller; import java.util.ArrayList; import java.util.List; import java.util.regex.Matcher; import java.util.regex.Pattern; -import org.baeldung.persistence.dao.GenericSpecificationsBuilder; -import org.baeldung.persistence.dao.IUserDAO; -import org.baeldung.persistence.dao.MyUserPredicatesBuilder; -import org.baeldung.persistence.dao.MyUserRepository; -import org.baeldung.persistence.dao.UserRepository; -import org.baeldung.persistence.dao.UserSpecification; -import org.baeldung.persistence.dao.UserSpecificationsBuilder; -import org.baeldung.persistence.dao.rsql.CustomRsqlVisitor; -import org.baeldung.persistence.model.MyUser; -import org.baeldung.persistence.model.User; -import org.baeldung.web.util.CriteriaParser; -import org.baeldung.web.util.SearchCriteria; -import org.baeldung.web.util.SearchOperation; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.jpa.domain.Specification; import org.springframework.data.querydsl.binding.QuerydslPredicate; @@ -31,6 +18,19 @@ import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.ResponseStatus; +import com.baeldung.persistence.dao.GenericSpecificationsBuilder; +import com.baeldung.persistence.dao.IUserDAO; +import com.baeldung.persistence.dao.MyUserPredicatesBuilder; +import com.baeldung.persistence.dao.MyUserRepository; +import com.baeldung.persistence.dao.UserRepository; +import com.baeldung.persistence.dao.UserSpecification; +import com.baeldung.persistence.dao.UserSpecificationsBuilder; +import com.baeldung.persistence.dao.rsql.CustomRsqlVisitor; +import com.baeldung.persistence.model.MyUser; +import com.baeldung.persistence.model.User; +import com.baeldung.web.util.CriteriaParser; +import com.baeldung.web.util.SearchCriteria; +import com.baeldung.web.util.SearchOperation; import com.google.common.base.Joiner; import com.google.common.base.Preconditions; import com.querydsl.core.types.Predicate; diff --git a/spring-rest-query-language/src/main/java/org/baeldung/web/error/RestResponseEntityExceptionHandler.java b/spring-rest-query-language/src/main/java/com/baeldung/web/error/RestResponseEntityExceptionHandler.java similarity index 97% rename from spring-rest-query-language/src/main/java/org/baeldung/web/error/RestResponseEntityExceptionHandler.java rename to spring-rest-query-language/src/main/java/com/baeldung/web/error/RestResponseEntityExceptionHandler.java index b593116c4a..b30f435ee4 100644 --- a/spring-rest-query-language/src/main/java/org/baeldung/web/error/RestResponseEntityExceptionHandler.java +++ b/spring-rest-query-language/src/main/java/com/baeldung/web/error/RestResponseEntityExceptionHandler.java @@ -1,8 +1,7 @@ -package org.baeldung.web.error; +package com.baeldung.web.error; import javax.persistence.EntityNotFoundException; -import org.baeldung.web.exception.MyResourceNotFoundException; import org.hibernate.exception.ConstraintViolationException; import org.springframework.dao.DataAccessException; import org.springframework.dao.DataIntegrityViolationException; @@ -17,6 +16,8 @@ import org.springframework.web.bind.annotation.ExceptionHandler; import org.springframework.web.context.request.WebRequest; import org.springframework.web.servlet.mvc.method.annotation.ResponseEntityExceptionHandler; +import com.baeldung.web.exception.MyResourceNotFoundException; + @ControllerAdvice public class RestResponseEntityExceptionHandler extends ResponseEntityExceptionHandler { diff --git a/spring-rest-query-language/src/main/java/org/baeldung/web/exception/MyResourceNotFoundException.java b/spring-rest-query-language/src/main/java/com/baeldung/web/exception/MyResourceNotFoundException.java similarity index 92% rename from spring-rest-query-language/src/main/java/org/baeldung/web/exception/MyResourceNotFoundException.java rename to spring-rest-query-language/src/main/java/com/baeldung/web/exception/MyResourceNotFoundException.java index 14b61f9832..fd002efc28 100644 --- a/spring-rest-query-language/src/main/java/org/baeldung/web/exception/MyResourceNotFoundException.java +++ b/spring-rest-query-language/src/main/java/com/baeldung/web/exception/MyResourceNotFoundException.java @@ -1,4 +1,4 @@ -package org.baeldung.web.exception; +package com.baeldung.web.exception; public final class MyResourceNotFoundException extends RuntimeException { diff --git a/spring-rest-query-language/src/main/java/org/baeldung/web/util/CriteriaParser.java b/spring-rest-query-language/src/main/java/com/baeldung/web/util/CriteriaParser.java similarity index 94% rename from spring-rest-query-language/src/main/java/org/baeldung/web/util/CriteriaParser.java rename to spring-rest-query-language/src/main/java/com/baeldung/web/util/CriteriaParser.java index eabc938bce..26bfb7a78d 100644 --- a/spring-rest-query-language/src/main/java/org/baeldung/web/util/CriteriaParser.java +++ b/spring-rest-query-language/src/main/java/com/baeldung/web/util/CriteriaParser.java @@ -1,5 +1,6 @@ -package org.baeldung.web.util; +package com.baeldung.web.util; +import java.util.Arrays; import java.util.Collections; import java.util.Deque; import java.util.HashMap; @@ -45,7 +46,7 @@ public class CriteriaParser { Deque output = new LinkedList<>(); Deque stack = new LinkedList<>(); - for (String token : searchParam.split("\\s+")) { + Arrays.stream(searchParam.split("\\s+")).forEach(token -> { if (ops.containsKey(token)) { while (!stack.isEmpty() && isHigerPrecedenceOperator(token, stack.peek())) output.push(stack.pop() @@ -65,7 +66,7 @@ public class CriteriaParser { output.push(new SpecSearchCriteria(matcher.group(1), matcher.group(2), matcher.group(3), matcher.group(4), matcher.group(5))); } } - } + }); while (!stack.isEmpty()) output.push(stack.pop()); diff --git a/spring-rest-query-language/src/main/java/org/baeldung/web/util/SearchCriteria.java b/spring-rest-query-language/src/main/java/com/baeldung/web/util/SearchCriteria.java similarity index 96% rename from spring-rest-query-language/src/main/java/org/baeldung/web/util/SearchCriteria.java rename to spring-rest-query-language/src/main/java/com/baeldung/web/util/SearchCriteria.java index cbe1fe539e..75ecefb653 100644 --- a/spring-rest-query-language/src/main/java/org/baeldung/web/util/SearchCriteria.java +++ b/spring-rest-query-language/src/main/java/com/baeldung/web/util/SearchCriteria.java @@ -1,4 +1,4 @@ -package org.baeldung.web.util; +package com.baeldung.web.util; public class SearchCriteria { diff --git a/spring-rest-query-language/src/main/java/org/baeldung/web/util/SearchOperation.java b/spring-rest-query-language/src/main/java/com/baeldung/web/util/SearchOperation.java similarity index 93% rename from spring-rest-query-language/src/main/java/org/baeldung/web/util/SearchOperation.java rename to spring-rest-query-language/src/main/java/com/baeldung/web/util/SearchOperation.java index db2c0133cf..acc9e0c0a8 100644 --- a/spring-rest-query-language/src/main/java/org/baeldung/web/util/SearchOperation.java +++ b/spring-rest-query-language/src/main/java/com/baeldung/web/util/SearchOperation.java @@ -1,4 +1,4 @@ -package org.baeldung.web.util; +package com.baeldung.web.util; public enum SearchOperation { EQUALITY, NEGATION, GREATER_THAN, LESS_THAN, LIKE, STARTS_WITH, ENDS_WITH, CONTAINS; diff --git a/spring-rest-query-language/src/main/java/org/baeldung/web/util/SpecSearchCriteria.java b/spring-rest-query-language/src/main/java/com/baeldung/web/util/SpecSearchCriteria.java similarity index 95% rename from spring-rest-query-language/src/main/java/org/baeldung/web/util/SpecSearchCriteria.java rename to spring-rest-query-language/src/main/java/com/baeldung/web/util/SpecSearchCriteria.java index 3435ff3342..73b690673b 100644 --- a/spring-rest-query-language/src/main/java/org/baeldung/web/util/SpecSearchCriteria.java +++ b/spring-rest-query-language/src/main/java/com/baeldung/web/util/SpecSearchCriteria.java @@ -1,4 +1,4 @@ -package org.baeldung.web.util; +package com.baeldung.web.util; public class SpecSearchCriteria { diff --git a/spring-rest-query-language/src/main/java/org/baeldung/persistence/dao/MyUserPredicatesBuilder.java b/spring-rest-query-language/src/main/java/org/baeldung/persistence/dao/MyUserPredicatesBuilder.java deleted file mode 100644 index c7b9f8358e..0000000000 --- a/spring-rest-query-language/src/main/java/org/baeldung/persistence/dao/MyUserPredicatesBuilder.java +++ /dev/null @@ -1,42 +0,0 @@ -package org.baeldung.persistence.dao; - -import com.querydsl.core.types.dsl.BooleanExpression; -import org.baeldung.web.util.SearchCriteria; - -import java.util.ArrayList; -import java.util.List; - -public final class MyUserPredicatesBuilder { - private final List params; - - public MyUserPredicatesBuilder() { - params = new ArrayList<>(); - } - - public MyUserPredicatesBuilder with(final String key, final String operation, final Object value) { - params.add(new SearchCriteria(key, operation, value)); - return this; - } - - public BooleanExpression build() { - if (params.size() == 0) { - return null; - } - - final List predicates = new ArrayList<>(); - MyUserPredicate predicate; - for (final SearchCriteria param : params) { - predicate = new MyUserPredicate(param); - final BooleanExpression exp = predicate.getPredicate(); - if (exp != null) { - predicates.add(exp); - } - } - - BooleanExpression result = predicates.get(0); - for (int i = 1; i < predicates.size(); i++) { - result = result.and(predicates.get(i)); - } - return result; - } -} diff --git a/spring-rest-query-language/src/main/java/org/baeldung/persistence/dao/UserDAO.java b/spring-rest-query-language/src/main/java/org/baeldung/persistence/dao/UserDAO.java deleted file mode 100644 index 8a01f8c97c..0000000000 --- a/spring-rest-query-language/src/main/java/org/baeldung/persistence/dao/UserDAO.java +++ /dev/null @@ -1,52 +0,0 @@ -package org.baeldung.persistence.dao; - -import org.baeldung.persistence.model.User; -import org.baeldung.web.util.SearchCriteria; -import org.springframework.stereotype.Repository; - -import javax.persistence.EntityManager; -import javax.persistence.PersistenceContext; -import javax.persistence.criteria.CriteriaBuilder; -import javax.persistence.criteria.CriteriaQuery; -import javax.persistence.criteria.Predicate; -import javax.persistence.criteria.Root; -import java.util.List; - -@Repository -public class UserDAO implements IUserDAO { - - @PersistenceContext - private EntityManager entityManager; - - @Override - public List searchUser(final List params) { - final CriteriaBuilder builder = entityManager.getCriteriaBuilder(); - final CriteriaQuery query = builder.createQuery(User.class); - final Root r = query.from(User.class); - - Predicate predicate = builder.conjunction(); - - for (final SearchCriteria param : params) { - if (param.getOperation().equalsIgnoreCase(">")) { - predicate = builder.and(predicate, builder.greaterThanOrEqualTo(r.get(param.getKey()), param.getValue().toString())); - } else if (param.getOperation().equalsIgnoreCase("<")) { - predicate = builder.and(predicate, builder.lessThanOrEqualTo(r.get(param.getKey()), param.getValue().toString())); - } else if (param.getOperation().equalsIgnoreCase(":")) { - if (r.get(param.getKey()).getJavaType() == String.class) { - predicate = builder.and(predicate, builder.like(r.get(param.getKey()), "%" + param.getValue() + "%")); - } else { - predicate = builder.and(predicate, builder.equal(r.get(param.getKey()), param.getValue())); - } - } - } - query.where(predicate); - - return entityManager.createQuery(query).getResultList(); - } - - @Override - public void save(final User entity) { - entityManager.persist(entity); - } - -} diff --git a/spring-rest-query-language/src/main/java/org/baeldung/persistence/dao/rsql/GenericRsqlSpecBuilder.java b/spring-rest-query-language/src/main/java/org/baeldung/persistence/dao/rsql/GenericRsqlSpecBuilder.java deleted file mode 100644 index 4efec00ed6..0000000000 --- a/spring-rest-query-language/src/main/java/org/baeldung/persistence/dao/rsql/GenericRsqlSpecBuilder.java +++ /dev/null @@ -1,55 +0,0 @@ -package org.baeldung.persistence.dao.rsql; - -import cz.jirutka.rsql.parser.ast.ComparisonNode; -import cz.jirutka.rsql.parser.ast.LogicalNode; -import cz.jirutka.rsql.parser.ast.LogicalOperator; -import cz.jirutka.rsql.parser.ast.Node; -import org.springframework.data.jpa.domain.Specifications; - -import java.util.ArrayList; -import java.util.List; - -public class GenericRsqlSpecBuilder { - - public Specifications createSpecification(final Node node) { - if (node instanceof LogicalNode) { - return createSpecification((LogicalNode) node); - } - if (node instanceof ComparisonNode) { - return createSpecification((ComparisonNode) node); - } - return null; - } - - public Specifications createSpecification(final LogicalNode logicalNode) { - final List> specs = new ArrayList>(); - Specifications temp; - for (final Node node : logicalNode.getChildren()) { - temp = createSpecification(node); - if (temp != null) { - specs.add(temp); - } - } - - Specifications result = specs.get(0); - - if (logicalNode.getOperator() == LogicalOperator.AND) { - for (int i = 1; i < specs.size(); i++) { - result = Specifications.where(result).and(specs.get(i)); - } - } - - else if (logicalNode.getOperator() == LogicalOperator.OR) { - for (int i = 1; i < specs.size(); i++) { - result = Specifications.where(result).or(specs.get(i)); - } - } - - return result; - } - - public Specifications createSpecification(final ComparisonNode comparisonNode) { - return Specifications.where(new GenericRsqlSpecification(comparisonNode.getSelector(), comparisonNode.getOperator(), comparisonNode.getArguments())); - } - -} diff --git a/spring-rest-query-language/src/main/resources/application.properties b/spring-rest-query-language/src/main/resources/application.properties index 01eaee7040..4bbf3ed4fc 100644 --- a/spring-rest-query-language/src/main/resources/application.properties +++ b/spring-rest-query-language/src/main/resources/application.properties @@ -1,2 +1,2 @@ server.port=8082 -server.context-path=/spring-rest-query-language \ No newline at end of file +server.servlet.context-path=/spring-rest-query-language \ No newline at end of file diff --git a/spring-rest-query-language/src/main/resources/springDataPersistenceConfig.xml b/spring-rest-query-language/src/main/resources/springDataPersistenceConfig.xml index d6d0ec6e47..5ea2d9c05b 100644 --- a/spring-rest-query-language/src/main/resources/springDataPersistenceConfig.xml +++ b/spring-rest-query-language/src/main/resources/springDataPersistenceConfig.xml @@ -7,6 +7,6 @@ http://www.springframework.org/schema/data/jpa/spring-jpa.xsd" > - + \ No newline at end of file diff --git a/spring-rest-query-language/src/main/webapp/WEB-INF/web.xml b/spring-rest-query-language/src/main/webapp/WEB-INF/web.xml index 4472afd112..23869f5e4e 100644 --- a/spring-rest-query-language/src/main/webapp/WEB-INF/web.xml +++ b/spring-rest-query-language/src/main/webapp/WEB-INF/web.xml @@ -16,7 +16,7 @@ contextConfigLocation - org.baeldung.spring + com.baeldung.spring diff --git a/spring-boot-h2/spring-boot-h2-remote-app/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-rest-query-language/src/test/java/com/baeldung/SpringContextIntegrationTest.java similarity index 73% rename from spring-boot-h2/spring-boot-h2-remote-app/src/test/java/org/baeldung/SpringContextIntegrationTest.java rename to spring-rest-query-language/src/test/java/com/baeldung/SpringContextIntegrationTest.java index f48199d4e8..18fabce5ca 100644 --- a/spring-boot-h2/spring-boot-h2-remote-app/src/test/java/org/baeldung/SpringContextIntegrationTest.java +++ b/spring-rest-query-language/src/test/java/com/baeldung/SpringContextIntegrationTest.java @@ -1,14 +1,14 @@ -package org.baeldung; +package com.baeldung; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit4.SpringRunner; -import com.baeldung.h2db.demo.ClientSpringBootApp; +import com.baeldung.spring.Application; @RunWith(SpringRunner.class) -@SpringBootTest(classes = ClientSpringBootApp.class) +@SpringBootTest(classes = Application.class) public class SpringContextIntegrationTest { @Test diff --git a/spring-rest-query-language/src/test/java/org/baeldung/persistence/query/JPACriteriaQueryIntegrationTest.java b/spring-rest-query-language/src/test/java/com/baeldung/persistence/query/JPACriteriaQueryIntegrationTest.java similarity index 93% rename from spring-rest-query-language/src/test/java/org/baeldung/persistence/query/JPACriteriaQueryIntegrationTest.java rename to spring-rest-query-language/src/test/java/com/baeldung/persistence/query/JPACriteriaQueryIntegrationTest.java index e8e98074c6..6caabef628 100644 --- a/spring-rest-query-language/src/test/java/org/baeldung/persistence/query/JPACriteriaQueryIntegrationTest.java +++ b/spring-rest-query-language/src/test/java/com/baeldung/persistence/query/JPACriteriaQueryIntegrationTest.java @@ -1,4 +1,4 @@ -package org.baeldung.persistence.query; +package com.baeldung.persistence.query; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.collection.IsIn.isIn; @@ -7,10 +7,6 @@ import static org.hamcrest.core.IsNot.not; import java.util.ArrayList; import java.util.List; -import org.baeldung.persistence.dao.IUserDAO; -import org.baeldung.persistence.model.User; -import org.baeldung.spring.PersistenceConfig; -import org.baeldung.web.util.SearchCriteria; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; @@ -20,6 +16,11 @@ import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import org.springframework.transaction.annotation.Transactional; +import com.baeldung.persistence.dao.IUserDAO; +import com.baeldung.persistence.model.User; +import com.baeldung.spring.PersistenceConfig; +import com.baeldung.web.util.SearchCriteria; + @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(classes = { PersistenceConfig.class }) @Transactional diff --git a/spring-rest-query-language/src/test/java/org/baeldung/persistence/query/JPAQuerydslIntegrationTest.java b/spring-rest-query-language/src/test/java/com/baeldung/persistence/query/JPAQuerydslIntegrationTest.java similarity index 93% rename from spring-rest-query-language/src/test/java/org/baeldung/persistence/query/JPAQuerydslIntegrationTest.java rename to spring-rest-query-language/src/test/java/com/baeldung/persistence/query/JPAQuerydslIntegrationTest.java index d397c3aac4..c4c5d23ab5 100644 --- a/spring-rest-query-language/src/test/java/org/baeldung/persistence/query/JPAQuerydslIntegrationTest.java +++ b/spring-rest-query-language/src/test/java/com/baeldung/persistence/query/JPAQuerydslIntegrationTest.java @@ -1,4 +1,4 @@ -package org.baeldung.persistence.query; +package com.baeldung.persistence.query; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.collection.IsEmptyIterable.emptyIterable; @@ -6,10 +6,6 @@ import static org.hamcrest.collection.IsIterableContainingInAnyOrder.containsInA import static org.hamcrest.collection.IsIterableContainingInOrder.contains; import static org.hamcrest.core.IsNot.not; -import org.baeldung.persistence.dao.MyUserPredicatesBuilder; -import org.baeldung.persistence.dao.MyUserRepository; -import org.baeldung.persistence.model.MyUser; -import org.baeldung.spring.PersistenceConfig; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; @@ -19,6 +15,11 @@ import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import org.springframework.transaction.annotation.Transactional; +import com.baeldung.persistence.dao.MyUserPredicatesBuilder; +import com.baeldung.persistence.dao.MyUserRepository; +import com.baeldung.persistence.model.MyUser; +import com.baeldung.spring.PersistenceConfig; + @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(classes = { PersistenceConfig.class }) @Transactional diff --git a/spring-rest-query-language/src/test/java/org/baeldung/persistence/query/JPASpecificationIntegrationTest.java b/spring-rest-query-language/src/test/java/com/baeldung/persistence/query/JPASpecificationIntegrationTest.java similarity index 89% rename from spring-rest-query-language/src/test/java/org/baeldung/persistence/query/JPASpecificationIntegrationTest.java rename to spring-rest-query-language/src/test/java/com/baeldung/persistence/query/JPASpecificationIntegrationTest.java index d9ae95c876..707426769e 100644 --- a/spring-rest-query-language/src/test/java/org/baeldung/persistence/query/JPASpecificationIntegrationTest.java +++ b/spring-rest-query-language/src/test/java/com/baeldung/persistence/query/JPASpecificationIntegrationTest.java @@ -1,25 +1,25 @@ -package org.baeldung.persistence.query; +package com.baeldung.persistence.query; -import org.baeldung.persistence.dao.GenericSpecificationsBuilder; -import org.baeldung.persistence.dao.UserRepository; -import org.baeldung.persistence.dao.UserSpecification; -import org.baeldung.persistence.dao.UserSpecificationsBuilder; -import org.baeldung.persistence.model.User; -import org.baeldung.spring.PersistenceConfig; -import org.baeldung.web.util.CriteriaParser; -import org.baeldung.web.util.SearchOperation; -import org.baeldung.web.util.SpecSearchCriteria; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.jpa.domain.Specification; -import org.springframework.data.jpa.domain.Specifications; import org.springframework.test.annotation.Rollback; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import org.springframework.transaction.annotation.Transactional; +import com.baeldung.persistence.dao.GenericSpecificationsBuilder; +import com.baeldung.persistence.dao.UserRepository; +import com.baeldung.persistence.dao.UserSpecification; +import com.baeldung.persistence.dao.UserSpecificationsBuilder; +import com.baeldung.persistence.model.User; +import com.baeldung.spring.PersistenceConfig; +import com.baeldung.web.util.CriteriaParser; +import com.baeldung.web.util.SearchOperation; +import com.baeldung.web.util.SpecSearchCriteria; + import java.util.List; import java.util.function.Function; @@ -71,7 +71,7 @@ public class JPASpecificationIntegrationTest { public void givenFirstAndLastName_whenGettingListOfUsers_thenCorrect() { final UserSpecification spec = new UserSpecification(new SpecSearchCriteria("firstName", SearchOperation.EQUALITY, "john")); final UserSpecification spec1 = new UserSpecification(new SpecSearchCriteria("lastName", SearchOperation.EQUALITY, "doe")); - final List results = repository.findAll(Specifications + final List results = repository.findAll(Specification .where(spec) .and(spec1)); @@ -127,7 +127,7 @@ public class JPASpecificationIntegrationTest { @Test public void givenFirstNameInverse_whenGettingListOfUsers_thenCorrect() { final UserSpecification spec = new UserSpecification(new SpecSearchCriteria("firstName", SearchOperation.NEGATION, "john")); - final List results = repository.findAll(Specifications.where(spec)); + final List results = repository.findAll(Specification.where(spec)); assertThat(userTom, isIn(results)); assertThat(userJohn, not(isIn(results))); @@ -136,7 +136,7 @@ public class JPASpecificationIntegrationTest { @Test public void givenMinAge_whenGettingListOfUsers_thenCorrect() { final UserSpecification spec = new UserSpecification(new SpecSearchCriteria("age", SearchOperation.GREATER_THAN, "25")); - final List results = repository.findAll(Specifications.where(spec)); + final List results = repository.findAll(Specification.where(spec)); assertThat(userTom, isIn(results)); assertThat(userJohn, not(isIn(results))); } @@ -170,7 +170,7 @@ public class JPASpecificationIntegrationTest { public void givenAgeRange_whenGettingListOfUsers_thenCorrect() { final UserSpecification spec = new UserSpecification(new SpecSearchCriteria("age", SearchOperation.GREATER_THAN, "20")); final UserSpecification spec1 = new UserSpecification(new SpecSearchCriteria("age", SearchOperation.LESS_THAN, "25")); - final List results = repository.findAll(Specifications + final List results = repository.findAll(Specification .where(spec) .and(spec1)); diff --git a/spring-rest-query-language/src/test/java/org/baeldung/persistence/query/JPASpecificationLiveTest.java b/spring-rest-query-language/src/test/java/com/baeldung/persistence/query/JPASpecificationLiveTest.java similarity index 95% rename from spring-rest-query-language/src/test/java/org/baeldung/persistence/query/JPASpecificationLiveTest.java rename to spring-rest-query-language/src/test/java/com/baeldung/persistence/query/JPASpecificationLiveTest.java index 044029c679..ad6a4259e7 100644 --- a/spring-rest-query-language/src/test/java/org/baeldung/persistence/query/JPASpecificationLiveTest.java +++ b/spring-rest-query-language/src/test/java/com/baeldung/persistence/query/JPASpecificationLiveTest.java @@ -1,15 +1,16 @@ -package org.baeldung.persistence.query; +package com.baeldung.persistence.query; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; import io.restassured.RestAssured; import io.restassured.response.Response; -import org.baeldung.persistence.model.User; import org.junit.Before; import org.junit.Test; import org.springframework.test.context.ActiveProfiles; +import com.baeldung.persistence.model.User; + //@RunWith(SpringJUnit4ClassRunner.class) //@ContextConfiguration(classes = { ConfigTest.class, // PersistenceConfig.class }, loader = AnnotationConfigContextLoader.class) diff --git a/spring-rest-query-language/src/test/java/org/baeldung/persistence/query/RsqlIntegrationTest.java b/spring-rest-query-language/src/test/java/com/baeldung/persistence/query/RsqlIntegrationTest.java similarity index 93% rename from spring-rest-query-language/src/test/java/org/baeldung/persistence/query/RsqlIntegrationTest.java rename to spring-rest-query-language/src/test/java/com/baeldung/persistence/query/RsqlIntegrationTest.java index 16dfa8a12f..b7b454892a 100644 --- a/spring-rest-query-language/src/test/java/org/baeldung/persistence/query/RsqlIntegrationTest.java +++ b/spring-rest-query-language/src/test/java/com/baeldung/persistence/query/RsqlIntegrationTest.java @@ -1,4 +1,4 @@ -package org.baeldung.persistence.query; +package com.baeldung.persistence.query; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.collection.IsIn.isIn; @@ -6,10 +6,6 @@ import static org.hamcrest.core.IsNot.not; import java.util.List; -import org.baeldung.persistence.dao.UserRepository; -import org.baeldung.persistence.dao.rsql.CustomRsqlVisitor; -import org.baeldung.persistence.model.User; -import org.baeldung.spring.PersistenceConfig; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; @@ -20,6 +16,11 @@ import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import org.springframework.transaction.annotation.Transactional; +import com.baeldung.persistence.dao.UserRepository; +import com.baeldung.persistence.dao.rsql.CustomRsqlVisitor; +import com.baeldung.persistence.model.User; +import com.baeldung.spring.PersistenceConfig; + import cz.jirutka.rsql.parser.RSQLParser; import cz.jirutka.rsql.parser.ast.Node; diff --git a/spring-rest-query-language/src/test/java/org/baeldung/web/MyUserLiveTest.java b/spring-rest-query-language/src/test/java/com/baeldung/web/MyUserLiveTest.java similarity index 95% rename from spring-rest-query-language/src/test/java/org/baeldung/web/MyUserLiveTest.java rename to spring-rest-query-language/src/test/java/com/baeldung/web/MyUserLiveTest.java index a478016280..1d74ff1982 100644 --- a/spring-rest-query-language/src/test/java/org/baeldung/web/MyUserLiveTest.java +++ b/spring-rest-query-language/src/test/java/com/baeldung/web/MyUserLiveTest.java @@ -1,14 +1,15 @@ -package org.baeldung.web; +package com.baeldung.web; import static org.junit.Assert.assertEquals; import io.restassured.RestAssured; import io.restassured.response.Response; import io.restassured.specification.RequestSpecification; -import org.baeldung.persistence.model.MyUser; import org.junit.Test; import org.springframework.test.context.ActiveProfiles; +import com.baeldung.persistence.model.MyUser; + @ActiveProfiles("test") public class MyUserLiveTest { diff --git a/spring-rest-shell/pom.xml b/spring-rest-shell/pom.xml index 7a604946b6..8b7ce1770d 100644 --- a/spring-rest-shell/pom.xml +++ b/spring-rest-shell/pom.xml @@ -8,10 +8,10 @@ A simple project to demonstrate Spring REST Shell features. - parent-boot-1 + parent-boot-2.0-temp com.baeldung 0.0.1-SNAPSHOT - ../parent-boot-1 + ../parent-boot-2.0-temp diff --git a/spring-rest-simple/README.md b/spring-rest-simple/README.md index 57d6f50887..179e556202 100644 --- a/spring-rest-simple/README.md +++ b/spring-rest-simple/README.md @@ -2,7 +2,6 @@ - [Guide to UriComponentsBuilder in Spring](http://www.baeldung.com/spring-uricomponentsbuilder) - [Returning Custom Status Codes from Spring Controllers](http://www.baeldung.com/spring-mvc-controller-custom-http-status-code) -- [The Guide to RestTemplate](http://www.baeldung.com/rest-template) - [Spring RequestMapping](http://www.baeldung.com/spring-requestmapping) - [ETags for REST with Spring](http://www.baeldung.com/etags-for-rest-with-spring) - [Spring and Apache FileUpload](http://www.baeldung.com/spring-apache-file-upload) diff --git a/spring-rest-simple/pom.xml b/spring-rest-simple/pom.xml index d39e3a43c1..e5de463999 100644 --- a/spring-rest-simple/pom.xml +++ b/spring-rest-simple/pom.xml @@ -8,10 +8,10 @@ war - parent-boot-1 + parent-boot-2.0-temp com.baeldung 0.0.1-SNAPSHOT - ../parent-boot-1 + ../parent-boot-2.0-temp @@ -34,6 +34,10 @@ spring-boot-starter-test test + + org.springframework.boot + spring-boot-starter-web + diff --git a/spring-rest-simple/src/main/java/org/baeldung/config/Application.java b/spring-rest-simple/src/main/java/org/baeldung/config/Application.java index 3a98da82c9..5c9a186619 100644 --- a/spring-rest-simple/src/main/java/org/baeldung/config/Application.java +++ b/spring-rest-simple/src/main/java/org/baeldung/config/Application.java @@ -3,7 +3,7 @@ package org.baeldung.config; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.boot.autoconfigure.SpringBootApplication; -import org.springframework.boot.web.support.SpringBootServletInitializer; +import org.springframework.boot.web.servlet.support.SpringBootServletInitializer; import org.springframework.context.annotation.ComponentScan; @EnableAutoConfiguration diff --git a/spring-rest-simple/src/main/java/org/baeldung/config/WebConfig.java b/spring-rest-simple/src/main/java/org/baeldung/config/WebConfig.java index 309a36609a..191b87a8f2 100644 --- a/spring-rest-simple/src/main/java/org/baeldung/config/WebConfig.java +++ b/spring-rest-simple/src/main/java/org/baeldung/config/WebConfig.java @@ -14,7 +14,7 @@ import org.springframework.http.converter.xml.MarshallingHttpMessageConverter; import org.springframework.oxm.xstream.XStreamMarshaller; import org.springframework.web.servlet.config.annotation.ContentNegotiationConfigurer; import org.springframework.web.servlet.config.annotation.EnableWebMvc; -import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter; +import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; import java.text.SimpleDateFormat; import java.util.List; @@ -25,7 +25,7 @@ import java.util.List; @Configuration @EnableWebMvc @ComponentScan({ "org.baeldung.web" }) -public class WebConfig extends WebMvcConfigurerAdapter { +public class WebConfig implements WebMvcConfigurer { public WebConfig() { super(); @@ -48,7 +48,6 @@ public class WebConfig extends WebMvcConfigurerAdapter { messageConverters.add(new ProtobufHttpMessageConverter()); messageConverters.add(new KryoHttpMessageConverter()); messageConverters.add(new StringHttpMessageConverter()); - super.configureMessageConverters(messageConverters); } private HttpMessageConverter createXmlHttpMessageConverter() { diff --git a/spring-rest-simple/src/main/java/org/baeldung/web/controller/FooController.java b/spring-rest-simple/src/main/java/org/baeldung/web/controller/FooController.java index bf26eb3292..e8cb218258 100644 --- a/spring-rest-simple/src/main/java/org/baeldung/web/controller/FooController.java +++ b/spring-rest-simple/src/main/java/org/baeldung/web/controller/FooController.java @@ -5,13 +5,9 @@ import static org.apache.commons.lang3.RandomStringUtils.randomAlphabetic; import org.baeldung.web.dto.Foo; import org.baeldung.web.dto.FooProtos; import org.springframework.http.HttpStatus; +import org.springframework.http.MediaType; import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; -import org.springframework.web.bind.annotation.ResponseBody; -import org.springframework.web.bind.annotation.ResponseStatus; +import org.springframework.web.bind.annotation.*; @Controller public class FooController { @@ -47,7 +43,7 @@ public class FooController { } @RequestMapping(method = RequestMethod.POST, value = "/foos/new") - @ResponseStatus(HttpStatus.OK) + @ResponseStatus(HttpStatus.CREATED) @ResponseBody public Foo createFoo(@RequestBody final Foo foo) { return foo; @@ -60,4 +56,11 @@ public class FooController { return id; } + @RequestMapping(method = RequestMethod.POST, value = "/foos/form") + @ResponseStatus(HttpStatus.CREATED) + @ResponseBody + public String submitFoo(@RequestParam("id") String id) { + return id; + } + } diff --git a/spring-rest-simple/src/main/resources/application.properties b/spring-rest-simple/src/main/resources/application.properties index 300589f561..dd7e4e2f2d 100644 --- a/spring-rest-simple/src/main/resources/application.properties +++ b/spring-rest-simple/src/main/resources/application.properties @@ -1,2 +1,2 @@ server.port= 8082 -server.context-path=/spring-rest \ No newline at end of file +server.servlet.context-path=/spring-rest \ No newline at end of file diff --git a/spring-rest-template/README.md b/spring-rest-template/README.md index d69d5c01c7..2c31796080 100644 --- a/spring-rest-template/README.md +++ b/spring-rest-template/README.md @@ -5,3 +5,4 @@ The "REST With Spring" Classes: http://bit.ly/restwithspring ### Relevant Articles: - [Uploading MultipartFile with Spring RestTemplate](http://www.baeldung.com/spring-rest-template-multipart-upload) +- [Mocking a RestTemplate in Spring](https://www.baeldung.com/spring-mock-rest-template) diff --git a/spring-rest-template/pom.xml b/spring-rest-template/pom.xml index fa93308cf5..d86e208987 100644 --- a/spring-rest-template/pom.xml +++ b/spring-rest-template/pom.xml @@ -8,10 +8,10 @@ jar - parent-boot-2 + parent-boot-2.0-temp com.baeldung 0.0.1-SNAPSHOT - ../parent-boot-2 + ../parent-boot-2.0-temp diff --git a/spring-rest/README.md b/spring-rest/README.md index d449a4d92a..5b8a35a4a5 100644 --- a/spring-rest/README.md +++ b/spring-rest/README.md @@ -23,3 +23,4 @@ The "REST With Spring" Classes: http://bit.ly/restwithspring - [Using the Spring RestTemplate Interceptor](http://www.baeldung.com/spring-rest-template-interceptor) - [Get and Post Lists of Objects with RestTemplate](http://www.baeldung.com/spring-rest-template-list) - [How to Set a Header on a Response with Spring 5](http://www.baeldung.com/spring-response-header) +- [Spring’s RequestBody and ResponseBody Annotations](https://www.baeldung.com/spring-request-response-body) diff --git a/spring-rest/pom.xml b/spring-rest/pom.xml index ba74d26c35..ea4cfc26d7 100644 --- a/spring-rest/pom.xml +++ b/spring-rest/pom.xml @@ -7,10 +7,10 @@ war - parent-boot-2 + parent-boot-2.0-temp com.baeldung 0.0.1-SNAPSHOT - ../parent-boot-2 + ../parent-boot-2.0-temp @@ -183,9 +183,6 @@ org.springframework.boot spring-boot-maven-plugin - - true - org.apache.maven.plugins @@ -300,6 +297,7 @@ 2.2.0 3.5.11 3.1.0 + com.baeldung.sampleapp.config.MainApplication diff --git a/spring-rest/src/main/java/org/baeldung/resttemplate/lists/EmployeeApplication.java b/spring-rest/src/main/java/com/baeldung/resttemplate/lists/EmployeeApplication.java similarity index 90% rename from spring-rest/src/main/java/org/baeldung/resttemplate/lists/EmployeeApplication.java rename to spring-rest/src/main/java/com/baeldung/resttemplate/lists/EmployeeApplication.java index baaa4c4d80..1967d4f2aa 100644 --- a/spring-rest/src/main/java/org/baeldung/resttemplate/lists/EmployeeApplication.java +++ b/spring-rest/src/main/java/com/baeldung/resttemplate/lists/EmployeeApplication.java @@ -1,4 +1,4 @@ -package org.baeldung.resttemplate.lists; +package com.baeldung.resttemplate.lists; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; diff --git a/spring-rest/src/main/java/org/baeldung/resttemplate/lists/client/EmployeeClient.java b/spring-rest/src/main/java/com/baeldung/resttemplate/lists/client/EmployeeClient.java similarity index 94% rename from spring-rest/src/main/java/org/baeldung/resttemplate/lists/client/EmployeeClient.java rename to spring-rest/src/main/java/com/baeldung/resttemplate/lists/client/EmployeeClient.java index 729fa3ca3e..d811045733 100644 --- a/spring-rest/src/main/java/org/baeldung/resttemplate/lists/client/EmployeeClient.java +++ b/spring-rest/src/main/java/com/baeldung/resttemplate/lists/client/EmployeeClient.java @@ -1,11 +1,12 @@ -package org.baeldung.resttemplate.lists.client; +package com.baeldung.resttemplate.lists.client; -import org.baeldung.resttemplate.lists.dto.Employee; -import org.baeldung.resttemplate.lists.dto.EmployeeList; import org.springframework.core.ParameterizedTypeReference; import org.springframework.http.*; import org.springframework.web.client.RestTemplate; +import com.baeldung.resttemplate.lists.dto.Employee; +import com.baeldung.resttemplate.lists.dto.EmployeeList; + import java.util.ArrayList; import java.util.List; diff --git a/spring-rest/src/main/java/org/baeldung/resttemplate/lists/controller/EmployeeResource.java b/spring-rest/src/main/java/com/baeldung/resttemplate/lists/controller/EmployeeResource.java similarity index 85% rename from spring-rest/src/main/java/org/baeldung/resttemplate/lists/controller/EmployeeResource.java rename to spring-rest/src/main/java/com/baeldung/resttemplate/lists/controller/EmployeeResource.java index f051c6a78b..8a4d510f63 100644 --- a/spring-rest/src/main/java/org/baeldung/resttemplate/lists/controller/EmployeeResource.java +++ b/spring-rest/src/main/java/com/baeldung/resttemplate/lists/controller/EmployeeResource.java @@ -1,14 +1,15 @@ -package org.baeldung.resttemplate.lists.controller; +package com.baeldung.resttemplate.lists.controller; -import org.baeldung.resttemplate.lists.dto.Employee; -import org.baeldung.resttemplate.lists.dto.EmployeeList; -import org.baeldung.resttemplate.lists.service.EmployeeService; import org.springframework.beans.factory.annotation.Autowired; 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.resttemplate.lists.dto.Employee; +import com.baeldung.resttemplate.lists.dto.EmployeeList; +import com.baeldung.resttemplate.lists.service.EmployeeService; + import java.util.List; @RestController diff --git a/spring-rest/src/main/java/org/baeldung/resttemplate/lists/dto/Employee.java b/spring-rest/src/main/java/com/baeldung/resttemplate/lists/dto/Employee.java similarity index 92% rename from spring-rest/src/main/java/org/baeldung/resttemplate/lists/dto/Employee.java rename to spring-rest/src/main/java/com/baeldung/resttemplate/lists/dto/Employee.java index bd8ebbf969..0754c13c5b 100644 --- a/spring-rest/src/main/java/org/baeldung/resttemplate/lists/dto/Employee.java +++ b/spring-rest/src/main/java/com/baeldung/resttemplate/lists/dto/Employee.java @@ -1,4 +1,4 @@ -package org.baeldung.resttemplate.lists.dto; +package com.baeldung.resttemplate.lists.dto; public class Employee { diff --git a/spring-rest/src/main/java/org/baeldung/resttemplate/lists/dto/EmployeeList.java b/spring-rest/src/main/java/com/baeldung/resttemplate/lists/dto/EmployeeList.java similarity index 91% rename from spring-rest/src/main/java/org/baeldung/resttemplate/lists/dto/EmployeeList.java rename to spring-rest/src/main/java/com/baeldung/resttemplate/lists/dto/EmployeeList.java index 2bb86ac5b4..eeabbfe450 100644 --- a/spring-rest/src/main/java/org/baeldung/resttemplate/lists/dto/EmployeeList.java +++ b/spring-rest/src/main/java/com/baeldung/resttemplate/lists/dto/EmployeeList.java @@ -1,4 +1,4 @@ -package org.baeldung.resttemplate.lists.dto; +package com.baeldung.resttemplate.lists.dto; import java.util.ArrayList; import java.util.List; diff --git a/spring-rest/src/main/java/org/baeldung/resttemplate/lists/service/EmployeeService.java b/spring-rest/src/main/java/com/baeldung/resttemplate/lists/service/EmployeeService.java similarity index 83% rename from spring-rest/src/main/java/org/baeldung/resttemplate/lists/service/EmployeeService.java rename to spring-rest/src/main/java/com/baeldung/resttemplate/lists/service/EmployeeService.java index 08196dda77..226134787f 100644 --- a/spring-rest/src/main/java/org/baeldung/resttemplate/lists/service/EmployeeService.java +++ b/spring-rest/src/main/java/com/baeldung/resttemplate/lists/service/EmployeeService.java @@ -1,8 +1,9 @@ -package org.baeldung.resttemplate.lists.service; +package com.baeldung.resttemplate.lists.service; -import org.baeldung.resttemplate.lists.dto.Employee; import org.springframework.stereotype.Service; +import com.baeldung.resttemplate.lists.dto.Employee; + import java.util.ArrayList; import java.util.List; diff --git a/spring-rest/src/main/java/org/baeldung/config/MainApplication.java b/spring-rest/src/main/java/com/baeldung/sampleapp/config/MainApplication.java similarity index 85% rename from spring-rest/src/main/java/org/baeldung/config/MainApplication.java rename to spring-rest/src/main/java/com/baeldung/sampleapp/config/MainApplication.java index 6a7fdc041a..507f340e9d 100644 --- a/spring-rest/src/main/java/org/baeldung/config/MainApplication.java +++ b/spring-rest/src/main/java/com/baeldung/sampleapp/config/MainApplication.java @@ -1,4 +1,4 @@ -package org.baeldung.config; +package com.baeldung.sampleapp.config; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.EnableAutoConfiguration; @@ -6,7 +6,7 @@ import org.springframework.context.annotation.ComponentScan; import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; @EnableAutoConfiguration -@ComponentScan("org.baeldung") +@ComponentScan("com.baeldung.sampleapp") public class MainApplication implements WebMvcConfigurer { public static void main(final String[] args) { diff --git a/spring-rest/src/main/java/org/baeldung/config/RestClientConfig.java b/spring-rest/src/main/java/com/baeldung/sampleapp/config/RestClientConfig.java similarity index 85% rename from spring-rest/src/main/java/org/baeldung/config/RestClientConfig.java rename to spring-rest/src/main/java/com/baeldung/sampleapp/config/RestClientConfig.java index 8743af20fe..8abc368bdb 100644 --- a/spring-rest/src/main/java/org/baeldung/config/RestClientConfig.java +++ b/spring-rest/src/main/java/com/baeldung/sampleapp/config/RestClientConfig.java @@ -1,15 +1,16 @@ -package org.baeldung.config; +package com.baeldung.sampleapp.config; import java.util.ArrayList; import java.util.List; -import org.baeldung.interceptors.RestTemplateHeaderModifierInterceptor; 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 { diff --git a/spring-rest/src/main/java/org/baeldung/config/WebConfig.java b/spring-rest/src/main/java/com/baeldung/sampleapp/config/WebConfig.java similarity index 95% rename from spring-rest/src/main/java/org/baeldung/config/WebConfig.java rename to spring-rest/src/main/java/com/baeldung/sampleapp/config/WebConfig.java index b3e3cd179a..d5209a520b 100644 --- a/spring-rest/src/main/java/org/baeldung/config/WebConfig.java +++ b/spring-rest/src/main/java/com/baeldung/sampleapp/config/WebConfig.java @@ -1,4 +1,4 @@ -package org.baeldung.config; +package com.baeldung.sampleapp.config; import java.text.SimpleDateFormat; import java.util.List; @@ -18,7 +18,7 @@ import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; */ @Configuration @EnableWebMvc -@ComponentScan({ "org.baeldung.web" }) +@ComponentScan({ "com.baeldung.sampleapp.web" }) public class WebConfig implements WebMvcConfigurer { public WebConfig() { diff --git a/spring-rest/src/main/java/org/baeldung/interceptors/RestTemplateHeaderModifierInterceptor.java b/spring-rest/src/main/java/com/baeldung/sampleapp/interceptors/RestTemplateHeaderModifierInterceptor.java similarity index 91% rename from spring-rest/src/main/java/org/baeldung/interceptors/RestTemplateHeaderModifierInterceptor.java rename to spring-rest/src/main/java/com/baeldung/sampleapp/interceptors/RestTemplateHeaderModifierInterceptor.java index fabb904634..519e5ebf0d 100644 --- a/spring-rest/src/main/java/org/baeldung/interceptors/RestTemplateHeaderModifierInterceptor.java +++ b/spring-rest/src/main/java/com/baeldung/sampleapp/interceptors/RestTemplateHeaderModifierInterceptor.java @@ -1,4 +1,4 @@ -package org.baeldung.interceptors; +package com.baeldung.sampleapp.interceptors; import java.io.IOException; diff --git a/spring-rest/src/main/java/org/baeldung/repository/HeavyResourceRepository.java b/spring-rest/src/main/java/com/baeldung/sampleapp/repository/HeavyResourceRepository.java similarity index 72% rename from spring-rest/src/main/java/org/baeldung/repository/HeavyResourceRepository.java rename to spring-rest/src/main/java/com/baeldung/sampleapp/repository/HeavyResourceRepository.java index e4eb6d8875..ea9541c31a 100644 --- a/spring-rest/src/main/java/org/baeldung/repository/HeavyResourceRepository.java +++ b/spring-rest/src/main/java/com/baeldung/sampleapp/repository/HeavyResourceRepository.java @@ -1,10 +1,10 @@ -package org.baeldung.repository; - -import org.baeldung.web.dto.HeavyResource; -import org.baeldung.web.dto.HeavyResourceAddressOnly; +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) { diff --git a/spring-rest/src/main/java/org/baeldung/web/controller/BarMappingExamplesController.java b/spring-rest/src/main/java/com/baeldung/sampleapp/web/controller/BarMappingExamplesController.java similarity index 96% rename from spring-rest/src/main/java/org/baeldung/web/controller/BarMappingExamplesController.java rename to spring-rest/src/main/java/com/baeldung/sampleapp/web/controller/BarMappingExamplesController.java index 1c3a1086ca..c6b8d23944 100644 --- a/spring-rest/src/main/java/org/baeldung/web/controller/BarMappingExamplesController.java +++ b/spring-rest/src/main/java/com/baeldung/sampleapp/web/controller/BarMappingExamplesController.java @@ -1,4 +1,4 @@ -package org.baeldung.web.controller; +package com.baeldung.sampleapp.web.controller; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.PathVariable; diff --git a/spring-rest/src/main/java/org/baeldung/web/controller/CompanyController.java b/spring-rest/src/main/java/com/baeldung/sampleapp/web/controller/CompanyController.java similarity index 82% rename from spring-rest/src/main/java/org/baeldung/web/controller/CompanyController.java rename to spring-rest/src/main/java/com/baeldung/sampleapp/web/controller/CompanyController.java index aa694c08ed..bfda2fe0d6 100644 --- a/spring-rest/src/main/java/org/baeldung/web/controller/CompanyController.java +++ b/spring-rest/src/main/java/com/baeldung/sampleapp/web/controller/CompanyController.java @@ -1,10 +1,11 @@ -package org.baeldung.web.controller; +package com.baeldung.sampleapp.web.controller; -import org.baeldung.web.dto.Company; 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 { diff --git a/spring-rest/src/main/java/org/baeldung/web/controller/DeferredResultController.java b/spring-rest/src/main/java/com/baeldung/sampleapp/web/controller/DeferredResultController.java similarity index 98% rename from spring-rest/src/main/java/org/baeldung/web/controller/DeferredResultController.java rename to spring-rest/src/main/java/com/baeldung/sampleapp/web/controller/DeferredResultController.java index 5d039d2d02..8f4eb3218a 100644 --- a/spring-rest/src/main/java/org/baeldung/web/controller/DeferredResultController.java +++ b/spring-rest/src/main/java/com/baeldung/sampleapp/web/controller/DeferredResultController.java @@ -1,4 +1,4 @@ -package org.baeldung.web.controller; +package com.baeldung.sampleapp.web.controller; import java.util.concurrent.CompletableFuture; import java.util.function.Consumer; diff --git a/spring-rest/src/main/java/org/baeldung/web/controller/HeavyResourceController.java b/spring-rest/src/main/java/com/baeldung/sampleapp/web/controller/HeavyResourceController.java similarity index 88% rename from spring-rest/src/main/java/org/baeldung/web/controller/HeavyResourceController.java rename to spring-rest/src/main/java/com/baeldung/sampleapp/web/controller/HeavyResourceController.java index fed45066bd..8156fc14a9 100644 --- a/spring-rest/src/main/java/org/baeldung/web/controller/HeavyResourceController.java +++ b/spring-rest/src/main/java/com/baeldung/sampleapp/web/controller/HeavyResourceController.java @@ -1,11 +1,8 @@ -package org.baeldung.web.controller; +package com.baeldung.sampleapp.web.controller; import java.util.Map; -import org.baeldung.repository.HeavyResourceRepository; -import org.baeldung.web.dto.HeavyResource; -import org.baeldung.web.dto.HeavyResourceAddressOnly; import org.springframework.http.MediaType; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.PathVariable; @@ -14,6 +11,10 @@ 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 { diff --git a/spring-rest/src/main/java/org/baeldung/web/controller/ItemController.java b/spring-rest/src/main/java/com/baeldung/sampleapp/web/controller/ItemController.java similarity index 83% rename from spring-rest/src/main/java/org/baeldung/web/controller/ItemController.java rename to spring-rest/src/main/java/com/baeldung/sampleapp/web/controller/ItemController.java index 1cc3eae432..69bd458968 100644 --- a/spring-rest/src/main/java/org/baeldung/web/controller/ItemController.java +++ b/spring-rest/src/main/java/com/baeldung/sampleapp/web/controller/ItemController.java @@ -1,14 +1,14 @@ -package org.baeldung.web.controller; +package com.baeldung.sampleapp.web.controller; import java.util.Date; -import org.baeldung.web.dto.Item; -import org.baeldung.web.dto.ItemManager; -import org.baeldung.web.dto.Views; 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 diff --git a/spring-rest/src/main/java/org/baeldung/web/controller/MyFooController.java b/spring-rest/src/main/java/com/baeldung/sampleapp/web/controller/MyFooController.java similarity index 94% rename from spring-rest/src/main/java/org/baeldung/web/controller/MyFooController.java rename to spring-rest/src/main/java/com/baeldung/sampleapp/web/controller/MyFooController.java index 251e0b23e7..11ea5b70c9 100644 --- a/spring-rest/src/main/java/org/baeldung/web/controller/MyFooController.java +++ b/spring-rest/src/main/java/com/baeldung/sampleapp/web/controller/MyFooController.java @@ -1,4 +1,4 @@ -package org.baeldung.web.controller; +package com.baeldung.sampleapp.web.controller; import java.util.Collection; import java.util.HashMap; @@ -6,8 +6,6 @@ import java.util.Map; import javax.servlet.http.HttpServletResponse; -import org.baeldung.web.dto.Foo; -import org.baeldung.web.exception.ResourceNotFoundException; import org.springframework.http.HttpStatus; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.PathVariable; @@ -18,6 +16,9 @@ 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 { diff --git a/spring-rest/src/main/java/org/baeldung/web/controller/PactController.java b/spring-rest/src/main/java/com/baeldung/sampleapp/web/controller/PactController.java similarity index 90% rename from spring-rest/src/main/java/org/baeldung/web/controller/PactController.java rename to spring-rest/src/main/java/com/baeldung/sampleapp/web/controller/PactController.java index 4f586479ef..0f5d7f1acb 100644 --- a/spring-rest/src/main/java/org/baeldung/web/controller/PactController.java +++ b/spring-rest/src/main/java/com/baeldung/sampleapp/web/controller/PactController.java @@ -1,9 +1,8 @@ -package org.baeldung.web.controller; +package com.baeldung.sampleapp.web.controller; import java.util.ArrayList; import java.util.List; -import org.baeldung.web.dto.PactDto; import org.springframework.http.HttpStatus; import org.springframework.http.MediaType; import org.springframework.web.bind.annotation.GetMapping; @@ -12,6 +11,8 @@ 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 { diff --git a/spring-rest/src/main/java/org/baeldung/web/controller/SimplePostController.java b/spring-rest/src/main/java/com/baeldung/sampleapp/web/controller/SimplePostController.java similarity index 97% rename from spring-rest/src/main/java/org/baeldung/web/controller/SimplePostController.java rename to spring-rest/src/main/java/com/baeldung/sampleapp/web/controller/SimplePostController.java index f8407acb47..7b57d35088 100644 --- a/spring-rest/src/main/java/org/baeldung/web/controller/SimplePostController.java +++ b/spring-rest/src/main/java/com/baeldung/sampleapp/web/controller/SimplePostController.java @@ -1,4 +1,4 @@ -package org.baeldung.web.controller; +package com.baeldung.sampleapp.web.controller; import java.io.BufferedOutputStream; import java.io.File; @@ -7,7 +7,6 @@ import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.Date; -import org.baeldung.web.dto.Foo; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; @@ -15,6 +14,8 @@ 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 { diff --git a/spring-rest/src/main/java/org/baeldung/web/controller/advice/JsonpControllerAdvice.java b/spring-rest/src/main/java/com/baeldung/sampleapp/web/controller/advice/JsonpControllerAdvice.java similarity index 85% rename from spring-rest/src/main/java/org/baeldung/web/controller/advice/JsonpControllerAdvice.java rename to spring-rest/src/main/java/com/baeldung/sampleapp/web/controller/advice/JsonpControllerAdvice.java index 996f229128..853e417d46 100644 --- a/spring-rest/src/main/java/org/baeldung/web/controller/advice/JsonpControllerAdvice.java +++ b/spring-rest/src/main/java/com/baeldung/sampleapp/web/controller/advice/JsonpControllerAdvice.java @@ -1,4 +1,4 @@ -package org.baeldung.web.controller.advice; +package com.baeldung.sampleapp.web.controller.advice; import org.springframework.web.bind.annotation.ControllerAdvice; import org.springframework.web.servlet.mvc.method.annotation.AbstractJsonpResponseBodyAdvice; diff --git a/spring-rest/src/main/java/org/baeldung/web/controller/mediatypes/CustomMediaTypeController.java b/spring-rest/src/main/java/com/baeldung/sampleapp/web/controller/mediatypes/CustomMediaTypeController.java similarity index 85% rename from spring-rest/src/main/java/org/baeldung/web/controller/mediatypes/CustomMediaTypeController.java rename to spring-rest/src/main/java/com/baeldung/sampleapp/web/controller/mediatypes/CustomMediaTypeController.java index a0a6c6341e..fc73bade87 100644 --- a/spring-rest/src/main/java/org/baeldung/web/controller/mediatypes/CustomMediaTypeController.java +++ b/spring-rest/src/main/java/com/baeldung/sampleapp/web/controller/mediatypes/CustomMediaTypeController.java @@ -1,13 +1,14 @@ -package org.baeldung.web.controller.mediatypes; +package com.baeldung.sampleapp.web.controller.mediatypes; -import org.baeldung.web.dto.BaeldungItem; -import org.baeldung.web.dto.BaeldungItemV2; 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 { diff --git a/spring-rest/src/main/java/org/baeldung/web/controller/redirect/RedirectController.java b/spring-rest/src/main/java/com/baeldung/sampleapp/web/controller/redirect/RedirectController.java similarity index 98% rename from spring-rest/src/main/java/org/baeldung/web/controller/redirect/RedirectController.java rename to spring-rest/src/main/java/com/baeldung/sampleapp/web/controller/redirect/RedirectController.java index 59868593a3..321f3be3ef 100644 --- a/spring-rest/src/main/java/org/baeldung/web/controller/redirect/RedirectController.java +++ b/spring-rest/src/main/java/com/baeldung/sampleapp/web/controller/redirect/RedirectController.java @@ -1,4 +1,4 @@ -package org.baeldung.web.controller.redirect; +package com.baeldung.sampleapp.web.controller.redirect; import javax.servlet.http.HttpServletRequest; diff --git a/spring-rest/src/main/java/org/baeldung/web/dto/BaeldungItem.java b/spring-rest/src/main/java/com/baeldung/sampleapp/web/dto/BaeldungItem.java similarity index 83% rename from spring-rest/src/main/java/org/baeldung/web/dto/BaeldungItem.java rename to spring-rest/src/main/java/com/baeldung/sampleapp/web/dto/BaeldungItem.java index 9b3ecd33b9..807a254cfc 100644 --- a/spring-rest/src/main/java/org/baeldung/web/dto/BaeldungItem.java +++ b/spring-rest/src/main/java/com/baeldung/sampleapp/web/dto/BaeldungItem.java @@ -1,4 +1,4 @@ -package org.baeldung.web.dto; +package com.baeldung.sampleapp.web.dto; public class BaeldungItem { private final String itemId; diff --git a/spring-rest/src/main/java/org/baeldung/web/dto/BaeldungItemV2.java b/spring-rest/src/main/java/com/baeldung/sampleapp/web/dto/BaeldungItemV2.java similarity index 84% rename from spring-rest/src/main/java/org/baeldung/web/dto/BaeldungItemV2.java rename to spring-rest/src/main/java/com/baeldung/sampleapp/web/dto/BaeldungItemV2.java index 64df20a14e..f84591ea43 100644 --- a/spring-rest/src/main/java/org/baeldung/web/dto/BaeldungItemV2.java +++ b/spring-rest/src/main/java/com/baeldung/sampleapp/web/dto/BaeldungItemV2.java @@ -1,4 +1,4 @@ -package org.baeldung.web.dto; +package com.baeldung.sampleapp.web.dto; public class BaeldungItemV2 { diff --git a/spring-rest/src/main/java/org/baeldung/web/dto/Company.java b/spring-rest/src/main/java/com/baeldung/sampleapp/web/dto/Company.java similarity index 93% rename from spring-rest/src/main/java/org/baeldung/web/dto/Company.java rename to spring-rest/src/main/java/com/baeldung/sampleapp/web/dto/Company.java index 3164d604ad..6cfcc079d9 100644 --- a/spring-rest/src/main/java/org/baeldung/web/dto/Company.java +++ b/spring-rest/src/main/java/com/baeldung/sampleapp/web/dto/Company.java @@ -1,4 +1,4 @@ -package org.baeldung.web.dto; +package com.baeldung.sampleapp.web.dto; public class Company { diff --git a/spring-rest/src/main/java/org/baeldung/web/dto/Foo.java b/spring-rest/src/main/java/com/baeldung/sampleapp/web/dto/Foo.java similarity index 94% rename from spring-rest/src/main/java/org/baeldung/web/dto/Foo.java rename to spring-rest/src/main/java/com/baeldung/sampleapp/web/dto/Foo.java index 240b368b50..186df8e678 100644 --- a/spring-rest/src/main/java/org/baeldung/web/dto/Foo.java +++ b/spring-rest/src/main/java/com/baeldung/sampleapp/web/dto/Foo.java @@ -1,4 +1,4 @@ -package org.baeldung.web.dto; +package com.baeldung.sampleapp.web.dto; import com.thoughtworks.xstream.annotations.XStreamAlias; diff --git a/spring-rest/src/main/java/org/baeldung/web/dto/HeavyResource.java b/spring-rest/src/main/java/com/baeldung/sampleapp/web/dto/HeavyResource.java similarity index 96% rename from spring-rest/src/main/java/org/baeldung/web/dto/HeavyResource.java rename to spring-rest/src/main/java/com/baeldung/sampleapp/web/dto/HeavyResource.java index 934e76606f..2821341888 100644 --- a/spring-rest/src/main/java/org/baeldung/web/dto/HeavyResource.java +++ b/spring-rest/src/main/java/com/baeldung/sampleapp/web/dto/HeavyResource.java @@ -1,4 +1,4 @@ -package org.baeldung.web.dto; +package com.baeldung.sampleapp.web.dto; public class HeavyResource { diff --git a/spring-rest/src/main/java/org/baeldung/web/dto/HeavyResourceAddressOnly.java b/spring-rest/src/main/java/com/baeldung/sampleapp/web/dto/HeavyResourceAddressOnly.java similarity index 93% rename from spring-rest/src/main/java/org/baeldung/web/dto/HeavyResourceAddressOnly.java rename to spring-rest/src/main/java/com/baeldung/sampleapp/web/dto/HeavyResourceAddressOnly.java index f96347d60c..01ee6e7dd4 100644 --- a/spring-rest/src/main/java/org/baeldung/web/dto/HeavyResourceAddressOnly.java +++ b/spring-rest/src/main/java/com/baeldung/sampleapp/web/dto/HeavyResourceAddressOnly.java @@ -1,4 +1,4 @@ -package org.baeldung.web.dto; +package com.baeldung.sampleapp.web.dto; public class HeavyResourceAddressOnly { diff --git a/spring-rest/src/main/java/org/baeldung/web/dto/HeavyResourceAddressPartialUpdate.java b/spring-rest/src/main/java/com/baeldung/sampleapp/web/dto/HeavyResourceAddressPartialUpdate.java similarity index 93% rename from spring-rest/src/main/java/org/baeldung/web/dto/HeavyResourceAddressPartialUpdate.java rename to spring-rest/src/main/java/com/baeldung/sampleapp/web/dto/HeavyResourceAddressPartialUpdate.java index f90f02ea08..1832a1a58b 100644 --- a/spring-rest/src/main/java/org/baeldung/web/dto/HeavyResourceAddressPartialUpdate.java +++ b/spring-rest/src/main/java/com/baeldung/sampleapp/web/dto/HeavyResourceAddressPartialUpdate.java @@ -1,4 +1,4 @@ -package org.baeldung.web.dto; +package com.baeldung.sampleapp.web.dto; public class HeavyResourceAddressPartialUpdate { diff --git a/spring-rest/src/main/java/org/baeldung/web/dto/Item.java b/spring-rest/src/main/java/com/baeldung/sampleapp/web/dto/Item.java similarity index 94% rename from spring-rest/src/main/java/org/baeldung/web/dto/Item.java rename to spring-rest/src/main/java/com/baeldung/sampleapp/web/dto/Item.java index 536c72020f..a4fcef5dce 100644 --- a/spring-rest/src/main/java/org/baeldung/web/dto/Item.java +++ b/spring-rest/src/main/java/com/baeldung/sampleapp/web/dto/Item.java @@ -1,4 +1,4 @@ -package org.baeldung.web.dto; +package com.baeldung.sampleapp.web.dto; import com.fasterxml.jackson.annotation.JsonView; diff --git a/spring-rest/src/main/java/org/baeldung/web/dto/ItemManager.java b/spring-rest/src/main/java/com/baeldung/sampleapp/web/dto/ItemManager.java similarity index 80% rename from spring-rest/src/main/java/org/baeldung/web/dto/ItemManager.java rename to spring-rest/src/main/java/com/baeldung/sampleapp/web/dto/ItemManager.java index 74ffada300..0009c0180b 100644 --- a/spring-rest/src/main/java/org/baeldung/web/dto/ItemManager.java +++ b/spring-rest/src/main/java/com/baeldung/sampleapp/web/dto/ItemManager.java @@ -1,4 +1,4 @@ -package org.baeldung.web.dto; +package com.baeldung.sampleapp.web.dto; public class ItemManager { diff --git a/spring-rest/src/main/java/org/baeldung/web/dto/PactDto.java b/spring-rest/src/main/java/com/baeldung/sampleapp/web/dto/PactDto.java similarity index 93% rename from spring-rest/src/main/java/org/baeldung/web/dto/PactDto.java rename to spring-rest/src/main/java/com/baeldung/sampleapp/web/dto/PactDto.java index e34e2bdf3b..e184119611 100644 --- a/spring-rest/src/main/java/org/baeldung/web/dto/PactDto.java +++ b/spring-rest/src/main/java/com/baeldung/sampleapp/web/dto/PactDto.java @@ -1,4 +1,4 @@ -package org.baeldung.web.dto; +package com.baeldung.sampleapp.web.dto; public class PactDto { diff --git a/spring-rest/src/main/java/org/baeldung/web/dto/Views.java b/spring-rest/src/main/java/com/baeldung/sampleapp/web/dto/Views.java similarity index 75% rename from spring-rest/src/main/java/org/baeldung/web/dto/Views.java rename to spring-rest/src/main/java/com/baeldung/sampleapp/web/dto/Views.java index 6231e12bcc..e2d83fda22 100644 --- a/spring-rest/src/main/java/org/baeldung/web/dto/Views.java +++ b/spring-rest/src/main/java/com/baeldung/sampleapp/web/dto/Views.java @@ -1,4 +1,4 @@ -package org.baeldung.web.dto; +package com.baeldung.sampleapp.web.dto; public class Views { public static class Public { diff --git a/spring-rest/src/main/java/org/baeldung/web/exception/ResourceNotFoundException.java b/spring-rest/src/main/java/com/baeldung/sampleapp/web/exception/ResourceNotFoundException.java similarity index 82% rename from spring-rest/src/main/java/org/baeldung/web/exception/ResourceNotFoundException.java rename to spring-rest/src/main/java/com/baeldung/sampleapp/web/exception/ResourceNotFoundException.java index aab737b6ec..69532f196d 100644 --- a/spring-rest/src/main/java/org/baeldung/web/exception/ResourceNotFoundException.java +++ b/spring-rest/src/main/java/com/baeldung/sampleapp/web/exception/ResourceNotFoundException.java @@ -1,4 +1,4 @@ -package org.baeldung.web.exception; +package com.baeldung.sampleapp.web.exception; import org.springframework.http.HttpStatus; import org.springframework.web.bind.annotation.ResponseStatus; diff --git a/spring-rest/src/main/webapp/WEB-INF/api-servlet.xml b/spring-rest/src/main/webapp/WEB-INF/api-servlet.xml index 7e7d820836..ddb9c91792 100644 --- a/spring-rest/src/main/webapp/WEB-INF/api-servlet.xml +++ b/spring-rest/src/main/webapp/WEB-INF/api-servlet.xml @@ -6,7 +6,7 @@ http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-4.0.xsd" > - + diff --git a/spring-rest/src/main/webapp/WEB-INF/web.xml b/spring-rest/src/main/webapp/WEB-INF/web.xml index 1b8b767ae3..20a11f3422 100644 --- a/spring-rest/src/main/webapp/WEB-INF/web.xml +++ b/spring-rest/src/main/webapp/WEB-INF/web.xml @@ -16,7 +16,7 @@ contextConfigLocation - org.baeldung.config + com.baeldung.sampleapp.config @@ -229,12 +229,16 @@ - + + + 1.1.2 1.2 1.6.1 2.6.11 + 1.8 diff --git a/spring-security-mvc-boot/src/main/java/org/baeldung/ssl/HttpsEnabledApplication.java b/spring-security-mvc-boot/src/main/java/org/baeldung/ssl/HttpsEnabledApplication.java new file mode 100644 index 0000000000..70fe30abdc --- /dev/null +++ b/spring-security-mvc-boot/src/main/java/org/baeldung/ssl/HttpsEnabledApplication.java @@ -0,0 +1,14 @@ +package org.baeldung.ssl; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication +public class HttpsEnabledApplication { + + public static void main(String... args) { + SpringApplication application = new SpringApplication(HttpsEnabledApplication.class); + application.setAdditionalProfiles("ssl"); + application.run(args); + } +} diff --git a/spring-security-mvc-boot/src/main/java/org/baeldung/ssl/SecurityConfig.java b/spring-security-mvc-boot/src/main/java/org/baeldung/ssl/SecurityConfig.java new file mode 100644 index 0000000000..92f92d8fc7 --- /dev/null +++ b/spring-security-mvc-boot/src/main/java/org/baeldung/ssl/SecurityConfig.java @@ -0,0 +1,16 @@ +package org.baeldung.ssl; + +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; + +@EnableWebSecurity +public class SecurityConfig extends WebSecurityConfigurerAdapter { + + @Override + protected void configure(HttpSecurity http) throws Exception { + http.authorizeRequests() + .antMatchers("/**") + .permitAll(); + } +} diff --git a/spring-security-mvc-boot/src/main/java/org/baeldung/ssl/WelcomeController.java b/spring-security-mvc-boot/src/main/java/org/baeldung/ssl/WelcomeController.java new file mode 100644 index 0000000000..72ad8abb85 --- /dev/null +++ b/spring-security-mvc-boot/src/main/java/org/baeldung/ssl/WelcomeController.java @@ -0,0 +1,15 @@ +package org.baeldung.ssl; + +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.ResponseBody; + +@Controller +public class WelcomeController { + + @GetMapping("/welcome") + public String welcome() { + return "ssl/welcome"; + } + +} diff --git a/spring-security-mvc-boot/src/main/resources/application-ssl.properties b/spring-security-mvc-boot/src/main/resources/application-ssl.properties new file mode 100644 index 0000000000..090b775d03 --- /dev/null +++ b/spring-security-mvc-boot/src/main/resources/application-ssl.properties @@ -0,0 +1,20 @@ + +http.port=8080 + +server.port=8443 + +security.require-ssl=true + +# The format used for the keystore +server.ssl.key-store-type=PKCS12 +# The path to the keystore containing the certificate +server.ssl.key-store=classpath:keystore/baeldung.p12 +# The password used to generate the certificate +server.ssl.key-store-password=password +# The alias mapped to the certificate +server.ssl.key-alias=baeldung + +#trust store location +trust.store=classpath:keystore/baeldung.p12 +#trust store password +trust.store.password=password diff --git a/spring-security-mvc-boot/src/main/resources/keystore/baeldung.p12 b/spring-security-mvc-boot/src/main/resources/keystore/baeldung.p12 new file mode 100644 index 0000000000..cd8eb28429 Binary files /dev/null and b/spring-security-mvc-boot/src/main/resources/keystore/baeldung.p12 differ diff --git a/spring-security-mvc-boot/src/main/resources/templates/ssl/welcome.html b/spring-security-mvc-boot/src/main/resources/templates/ssl/welcome.html new file mode 100644 index 0000000000..93b3577f5c --- /dev/null +++ b/spring-security-mvc-boot/src/main/resources/templates/ssl/welcome.html @@ -0,0 +1 @@ +

Welcome to Secured Site

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

Welcome to Secured Site

", response.getBody()); + assertEquals(HttpStatus.OK, response.getStatusCode()); + } + + RestTemplate restTemplate() throws Exception { + SSLContext sslContext = new SSLContextBuilder().loadTrustMaterial(trustStore.getURL(), trustStorePassword.toCharArray()) + .build(); + SSLConnectionSocketFactory socketFactory = new SSLConnectionSocketFactory(sslContext); + HttpClient httpClient = HttpClients.custom() + .setSSLSocketFactory(socketFactory) + .build(); + HttpComponentsClientHttpRequestFactory factory = new HttpComponentsClientHttpRequestFactory(httpClient); + return new RestTemplate(factory); + } +} diff --git a/spring-security-mvc-login/pom.xml b/spring-security-mvc-login/pom.xml index f70cf256dc..5ee216548a 100644 --- a/spring-security-mvc-login/pom.xml +++ b/spring-security-mvc-login/pom.xml @@ -10,9 +10,9 @@ com.baeldung - parent-spring-4 + parent-spring-5 0.0.1-SNAPSHOT - ../parent-spring-4 + ../parent-spring-5 @@ -138,6 +138,15 @@ org.apache.maven.plugins maven-war-plugin ${maven-war-plugin.version} + + + default-war + prepare-package + + false + + +
@@ -167,7 +176,7 @@ - 4.2.6.RELEASE + 5.0.5.RELEASE 3.1.0 diff --git a/spring-security-mvc-login/src/main/java/com/baeldung/AppInitializer.java b/spring-security-mvc-login/src/main/java/com/baeldung/AppInitializer.java new file mode 100644 index 0000000000..4f38d190eb --- /dev/null +++ b/spring-security-mvc-login/src/main/java/com/baeldung/AppInitializer.java @@ -0,0 +1,33 @@ +package com.baeldung; + +import javax.servlet.ServletContext; +import javax.servlet.ServletException; +import javax.servlet.ServletRegistration; + +import org.springframework.web.WebApplicationInitializer; +import org.springframework.web.context.ContextLoaderListener; +import org.springframework.web.context.support.AnnotationConfigWebApplicationContext; +import org.springframework.web.context.support.GenericWebApplicationContext; +import org.springframework.web.filter.DelegatingFilterProxy; +import org.springframework.web.servlet.DispatcherServlet; + +public class AppInitializer implements WebApplicationInitializer { + + @Override + public void onStartup(final ServletContext sc) throws ServletException { + + AnnotationConfigWebApplicationContext root = new AnnotationConfigWebApplicationContext(); + + root.scan("com.baeldung"); + sc.addListener(new ContextLoaderListener(root)); + + ServletRegistration.Dynamic appServlet = sc.addServlet("mvc", new DispatcherServlet(new GenericWebApplicationContext())); + appServlet.setLoadOnStartup(1); + appServlet.addMapping("/"); + + sc.addFilter("securityFilter", new DelegatingFilterProxy("springSecurityFilterChain")) + .addMappingForUrlPatterns(null, false, "/*"); + + } + +} diff --git a/spring-security-mvc-login/src/main/java/org/baeldung/controller/SecuredResourceController.java b/spring-security-mvc-login/src/main/java/com/baeldung/controller/SecuredResourceController.java similarity index 93% rename from spring-security-mvc-login/src/main/java/org/baeldung/controller/SecuredResourceController.java rename to spring-security-mvc-login/src/main/java/com/baeldung/controller/SecuredResourceController.java index 4b68eee983..a458a5aeac 100644 --- a/spring-security-mvc-login/src/main/java/org/baeldung/controller/SecuredResourceController.java +++ b/spring-security-mvc-login/src/main/java/com/baeldung/controller/SecuredResourceController.java @@ -1,4 +1,4 @@ -package org.baeldung.controller; +package com.baeldung.controller; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; diff --git a/spring-security-mvc-login/src/main/java/org/baeldung/security/CustomAccessDeniedHandler.java b/spring-security-mvc-login/src/main/java/com/baeldung/security/CustomAccessDeniedHandler.java similarity index 97% rename from spring-security-mvc-login/src/main/java/org/baeldung/security/CustomAccessDeniedHandler.java rename to spring-security-mvc-login/src/main/java/com/baeldung/security/CustomAccessDeniedHandler.java index 64698072bc..9d9fa81dc0 100644 --- a/spring-security-mvc-login/src/main/java/org/baeldung/security/CustomAccessDeniedHandler.java +++ b/spring-security-mvc-login/src/main/java/com/baeldung/security/CustomAccessDeniedHandler.java @@ -1,4 +1,4 @@ -package org.baeldung.security; +package com.baeldung.security; import java.io.IOException; diff --git a/spring-security-mvc-login/src/main/java/org/baeldung/security/CustomAuthenticationFailureHandler.java b/spring-security-mvc-login/src/main/java/com/baeldung/security/CustomAuthenticationFailureHandler.java similarity index 96% rename from spring-security-mvc-login/src/main/java/org/baeldung/security/CustomAuthenticationFailureHandler.java rename to spring-security-mvc-login/src/main/java/com/baeldung/security/CustomAuthenticationFailureHandler.java index 5eddf3883e..410d3f1ce9 100644 --- a/spring-security-mvc-login/src/main/java/org/baeldung/security/CustomAuthenticationFailureHandler.java +++ b/spring-security-mvc-login/src/main/java/com/baeldung/security/CustomAuthenticationFailureHandler.java @@ -1,4 +1,4 @@ -package org.baeldung.security; +package com.baeldung.security; import org.springframework.http.HttpStatus; import org.springframework.security.core.AuthenticationException; diff --git a/spring-security-mvc-login/src/main/java/org/baeldung/security/CustomLogoutSuccessHandler.java b/spring-security-mvc-login/src/main/java/com/baeldung/security/CustomLogoutSuccessHandler.java similarity index 96% rename from spring-security-mvc-login/src/main/java/org/baeldung/security/CustomLogoutSuccessHandler.java rename to spring-security-mvc-login/src/main/java/com/baeldung/security/CustomLogoutSuccessHandler.java index 7360b4e03f..7949eee69a 100644 --- a/spring-security-mvc-login/src/main/java/org/baeldung/security/CustomLogoutSuccessHandler.java +++ b/spring-security-mvc-login/src/main/java/com/baeldung/security/CustomLogoutSuccessHandler.java @@ -1,4 +1,4 @@ -package org.baeldung.security; +package com.baeldung.security; import java.io.IOException; diff --git a/spring-security-mvc-login/src/main/java/org/baeldung/security/RefererAuthenticationSuccessHandler.java b/spring-security-mvc-login/src/main/java/com/baeldung/security/RefererAuthenticationSuccessHandler.java similarity index 92% rename from spring-security-mvc-login/src/main/java/org/baeldung/security/RefererAuthenticationSuccessHandler.java rename to spring-security-mvc-login/src/main/java/com/baeldung/security/RefererAuthenticationSuccessHandler.java index 5b025d9fd1..05a2463699 100644 --- a/spring-security-mvc-login/src/main/java/org/baeldung/security/RefererAuthenticationSuccessHandler.java +++ b/spring-security-mvc-login/src/main/java/com/baeldung/security/RefererAuthenticationSuccessHandler.java @@ -1,4 +1,4 @@ -package org.baeldung.security; +package com.baeldung.security; import org.springframework.security.web.authentication.AuthenticationSuccessHandler; import org.springframework.security.web.authentication.SimpleUrlAuthenticationSuccessHandler; diff --git a/spring-security-mvc-login/src/main/java/org/baeldung/spring/ChannelSecSecurityConfig.java b/spring-security-mvc-login/src/main/java/com/baeldung/spring/ChannelSecSecurityConfig.java similarity index 96% rename from spring-security-mvc-login/src/main/java/org/baeldung/spring/ChannelSecSecurityConfig.java rename to spring-security-mvc-login/src/main/java/com/baeldung/spring/ChannelSecSecurityConfig.java index 4f736360b9..e9a6a9e120 100644 --- a/spring-security-mvc-login/src/main/java/org/baeldung/spring/ChannelSecSecurityConfig.java +++ b/spring-security-mvc-login/src/main/java/com/baeldung/spring/ChannelSecSecurityConfig.java @@ -1,6 +1,5 @@ -package org.baeldung.spring; +package com.baeldung.spring; -import org.baeldung.security.CustomLogoutSuccessHandler; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Profile; @@ -10,6 +9,8 @@ import org.springframework.security.config.annotation.web.configuration.EnableWe import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; import org.springframework.security.web.authentication.logout.LogoutSuccessHandler; +import com.baeldung.security.CustomLogoutSuccessHandler; + @Configuration // @ImportResource({ "classpath:channelWebSecurityConfig.xml" }) @EnableWebSecurity diff --git a/spring-security-mvc-login/src/main/java/org/baeldung/spring/MvcConfig.java b/spring-security-mvc-login/src/main/java/com/baeldung/spring/MvcConfig.java similarity index 89% rename from spring-security-mvc-login/src/main/java/org/baeldung/spring/MvcConfig.java rename to spring-security-mvc-login/src/main/java/com/baeldung/spring/MvcConfig.java index b59dbee0cf..a9c7e0cf15 100644 --- a/spring-security-mvc-login/src/main/java/org/baeldung/spring/MvcConfig.java +++ b/spring-security-mvc-login/src/main/java/com/baeldung/spring/MvcConfig.java @@ -1,17 +1,18 @@ -package org.baeldung.spring; +package com.baeldung.spring; import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration; import org.springframework.web.servlet.ViewResolver; import org.springframework.web.servlet.config.annotation.EnableWebMvc; import org.springframework.web.servlet.config.annotation.ViewControllerRegistry; -import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter; +import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; import org.springframework.web.servlet.view.InternalResourceViewResolver; import org.springframework.web.servlet.view.JstlView; @EnableWebMvc @Configuration -public class MvcConfig extends WebMvcConfigurerAdapter { +public class MvcConfig implements WebMvcConfigurer { public MvcConfig() { super(); @@ -21,10 +22,8 @@ public class MvcConfig extends WebMvcConfigurerAdapter { @Override public void addViewControllers(final ViewControllerRegistry registry) { - super.addViewControllers(registry); registry.addViewController("/anonymous.html"); - registry.addViewController("/login.html"); registry.addViewController("/homepage.html"); registry.addViewController("/admin/adminpage.html"); diff --git a/spring-security-mvc-login/src/main/java/org/baeldung/spring/RedirectionSecurityConfig.java b/spring-security-mvc-login/src/main/java/com/baeldung/spring/RedirectionSecurityConfig.java similarity index 97% rename from spring-security-mvc-login/src/main/java/org/baeldung/spring/RedirectionSecurityConfig.java rename to spring-security-mvc-login/src/main/java/com/baeldung/spring/RedirectionSecurityConfig.java index 1472a1f89c..3516438a6e 100644 --- a/spring-security-mvc-login/src/main/java/org/baeldung/spring/RedirectionSecurityConfig.java +++ b/spring-security-mvc-login/src/main/java/com/baeldung/spring/RedirectionSecurityConfig.java @@ -1,4 +1,4 @@ -package org.baeldung.spring; +package com.baeldung.spring; import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder; import org.springframework.security.config.annotation.web.builders.HttpSecurity; diff --git a/spring-security-mvc-login/src/main/java/org/baeldung/spring/SecSecurityConfig.java b/spring-security-mvc-login/src/main/java/com/baeldung/spring/SecSecurityConfig.java similarity index 78% rename from spring-security-mvc-login/src/main/java/org/baeldung/spring/SecSecurityConfig.java rename to spring-security-mvc-login/src/main/java/com/baeldung/spring/SecSecurityConfig.java index accc7c9afd..08a83f8633 100644 --- a/spring-security-mvc-login/src/main/java/org/baeldung/spring/SecSecurityConfig.java +++ b/spring-security-mvc-login/src/main/java/com/baeldung/spring/SecSecurityConfig.java @@ -1,8 +1,5 @@ -package org.baeldung.spring; +package com.baeldung.spring; -import org.baeldung.security.CustomAccessDeniedHandler; -import org.baeldung.security.CustomAuthenticationFailureHandler; -import org.baeldung.security.CustomLogoutSuccessHandler; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Profile; @@ -10,10 +7,16 @@ import org.springframework.security.config.annotation.authentication.builders.Au import org.springframework.security.config.annotation.web.builders.HttpSecurity; import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; +import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; +import org.springframework.security.crypto.password.PasswordEncoder; import org.springframework.security.web.access.AccessDeniedHandler; import org.springframework.security.web.authentication.AuthenticationFailureHandler; import org.springframework.security.web.authentication.logout.LogoutSuccessHandler; +import com.baeldung.security.CustomAccessDeniedHandler; +import com.baeldung.security.CustomAuthenticationFailureHandler; +import com.baeldung.security.CustomLogoutSuccessHandler; + @Configuration // @ImportResource({ "classpath:webSecurityConfig.xml" }) @EnableWebSecurity @@ -28,11 +31,11 @@ public class SecSecurityConfig extends WebSecurityConfigurerAdapter { protected void configure(final AuthenticationManagerBuilder auth) throws Exception { // @formatter:off auth.inMemoryAuthentication() - .withUser("user1").password("user1Pass").roles("USER") + .withUser("user1").password(passwordEncoder().encode("user1Pass")).roles("USER") .and() - .withUser("user2").password("user2Pass").roles("USER") + .withUser("user2").password(passwordEncoder().encode("user2Pass")).roles("USER") .and() - .withUser("admin").password("adminPass").roles("ADMIN"); + .withUser("admin").password(passwordEncoder().encode("adminPass")).roles("ADMIN"); // @formatter:on } @@ -78,4 +81,9 @@ public class SecSecurityConfig extends WebSecurityConfigurerAdapter { public AuthenticationFailureHandler authenticationFailureHandler() { return new CustomAuthenticationFailureHandler(); } + + @Bean + public PasswordEncoder passwordEncoder() { + return new BCryptPasswordEncoder(); + } } diff --git a/spring-security-mvc-login/src/main/webapp/WEB-INF/web.xml b/spring-security-mvc-login/src/main/webapp/WEB-INF/web-old.xml similarity index 96% rename from spring-security-mvc-login/src/main/webapp/WEB-INF/web.xml rename to spring-security-mvc-login/src/main/webapp/WEB-INF/web-old.xml index eef48ec9b3..bc6f310147 100644 --- a/spring-security-mvc-login/src/main/webapp/WEB-INF/web.xml +++ b/spring-security-mvc-login/src/main/webapp/WEB-INF/web-old.xml @@ -15,7 +15,7 @@ contextConfigLocation - org.baeldung.spring + com.baeldung.spring diff --git a/spring-security-mvc-login/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-security-mvc-login/src/test/java/com/baeldung/SpringContextIntegrationTest.java similarity index 95% rename from spring-security-mvc-login/src/test/java/org/baeldung/SpringContextIntegrationTest.java rename to spring-security-mvc-login/src/test/java/com/baeldung/SpringContextIntegrationTest.java index 1d7f9ae497..20de02d5c5 100644 --- a/spring-security-mvc-login/src/test/java/org/baeldung/SpringContextIntegrationTest.java +++ b/spring-security-mvc-login/src/test/java/com/baeldung/SpringContextIntegrationTest.java @@ -1,4 +1,4 @@ -package org.baeldung; +package com.baeldung; import org.junit.Test; import org.junit.runner.RunWith; diff --git a/spring-security-mvc-login/src/test/java/org/baeldung/security/FormLoginUnitTest.java b/spring-security-mvc-login/src/test/java/com/baeldung/security/FormLoginUnitTest.java similarity index 96% rename from spring-security-mvc-login/src/test/java/org/baeldung/security/FormLoginUnitTest.java rename to spring-security-mvc-login/src/test/java/com/baeldung/security/FormLoginUnitTest.java index 4b3a091e6c..b7d959bf36 100644 --- a/spring-security-mvc-login/src/test/java/org/baeldung/security/FormLoginUnitTest.java +++ b/spring-security-mvc-login/src/test/java/com/baeldung/security/FormLoginUnitTest.java @@ -1,6 +1,5 @@ -package org.baeldung.security; +package com.baeldung.security; -import org.baeldung.spring.SecSecurityConfig; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; @@ -13,6 +12,8 @@ import org.springframework.test.web.servlet.MvcResult; import org.springframework.test.web.servlet.setup.MockMvcBuilders; import org.springframework.web.context.WebApplicationContext; +import com.baeldung.spring.SecSecurityConfig; + import javax.servlet.Filter; import static org.junit.Assert.assertTrue; diff --git a/spring-security-mvc-login/src/test/java/org/baeldung/security/RedirectionSecurityIntegrationTest.java b/spring-security-mvc-login/src/test/java/com/baeldung/security/RedirectionSecurityIntegrationTest.java similarity index 99% rename from spring-security-mvc-login/src/test/java/org/baeldung/security/RedirectionSecurityIntegrationTest.java rename to spring-security-mvc-login/src/test/java/com/baeldung/security/RedirectionSecurityIntegrationTest.java index 2b7a8ce5b9..1235e2e69f 100644 --- a/spring-security-mvc-login/src/test/java/org/baeldung/security/RedirectionSecurityIntegrationTest.java +++ b/spring-security-mvc-login/src/test/java/com/baeldung/security/RedirectionSecurityIntegrationTest.java @@ -1,4 +1,4 @@ -package org.baeldung.security; +package com.baeldung.security; import org.junit.Before; import org.junit.Test; diff --git a/spring-security-mvc-session/src/main/java/org/baeldung/security/SessionFilter.java b/spring-security-mvc-session/src/main/java/org/baeldung/security/SessionFilter.java new file mode 100644 index 0000000000..d37d46e478 --- /dev/null +++ b/spring-security-mvc-session/src/main/java/org/baeldung/security/SessionFilter.java @@ -0,0 +1,45 @@ +package org.baeldung.security; + +import java.io.IOException; +import java.util.Arrays; + +import javax.servlet.Filter; +import javax.servlet.FilterChain; +import javax.servlet.FilterConfig; +import javax.servlet.ServletException; +import javax.servlet.ServletRequest; +import javax.servlet.ServletResponse; +import javax.servlet.http.Cookie; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +public class SessionFilter implements Filter{ + + @Override + public void init(FilterConfig filterConfig) throws ServletException { + System.out.println("init filter"); + } + + @Override + public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { + HttpServletRequest req = (HttpServletRequest) request; + HttpServletResponse res = (HttpServletResponse) response; + Cookie[] allCookies = req.getCookies(); + if (allCookies != null) { + Cookie session = Arrays.stream(allCookies).filter(x -> x.getName().equals("JSESSIONID")).findFirst().orElse(null); + + if (session != null) { + session.setHttpOnly(true); + session.setSecure(true); + res.addCookie(session); + } + } + chain.doFilter(req, res); + } + + @Override + public void destroy() { + System.out.println("destroy filter"); + } + +} diff --git a/spring-security-mvc-session/src/main/webapp/WEB-INF/web.xml b/spring-security-mvc-session/src/main/webapp/WEB-INF/web.xml index 57826fadac..2ef734441b 100644 --- a/spring-security-mvc-session/src/main/webapp/WEB-INF/web.xml +++ b/spring-security-mvc-session/src/main/webapp/WEB-INF/web.xml @@ -8,6 +8,10 @@ 1 + org.baeldung.web.SessionListenerWithMetrics @@ -52,6 +56,15 @@ springSecurityFilterChain /* + + diff --git a/spring-security-openid/pom.xml b/spring-security-openid/pom.xml index 4343996e02..6a946792ba 100644 --- a/spring-security-openid/pom.xml +++ b/spring-security-openid/pom.xml @@ -9,10 +9,10 @@ Spring OpenID sample project - parent-boot-2 + parent-boot-2.0-temp com.baeldung 0.0.1-SNAPSHOT - ../parent-boot-2 + ../parent-boot-2.0-temp diff --git a/spring-security-rest/pom.xml b/spring-security-rest/pom.xml index 57ce5ddb92..ef16f2201b 100644 --- a/spring-security-rest/pom.xml +++ b/spring-security-rest/pom.xml @@ -2,7 +2,6 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 - com.baeldung spring-security-rest 0.1-SNAPSHOT spring-security-rest @@ -10,9 +9,9 @@ com.baeldung - parent-spring-4 + parent-spring-5 0.0.1-SNAPSHOT - ../parent-spring-4 + ../parent-spring-5 @@ -195,13 +194,6 @@ - - - org.apache.maven.plugins - maven-war-plugin - ${maven-war-plugin.version} - - org.codehaus.cargo cargo-maven2-plugin @@ -282,17 +274,17 @@ - 4.2.6.RELEASE - 0.21.0.RELEASE + 5.1.0.RELEASE + 0.25.0.RELEASE 3.1.0 1.1.0.Final 1.2 - 2.8.5 + 2.9.2 - 19.0 + 26.0-jre 3.5 1.3.2 @@ -303,8 +295,6 @@ 2.9.2 - 2.6 1.6.1 - diff --git a/spring-security-rest/src/main/java/org/baeldung/persistence/model/Foo.java b/spring-security-rest/src/main/java/org/baeldung/persistence/model/Foo.java index 1941e2aa51..05a7c7b9a0 100644 --- a/spring-security-rest/src/main/java/org/baeldung/persistence/model/Foo.java +++ b/spring-security-rest/src/main/java/org/baeldung/persistence/model/Foo.java @@ -6,6 +6,8 @@ import javax.validation.constraints.Size; public class Foo implements Serializable { + private static final long serialVersionUID = -5422285893276747592L; + private long id; @Size(min = 5, max = 14) diff --git a/spring-security-rest/src/main/java/org/baeldung/security/MySavedRequestAwareAuthenticationSuccessHandler.java b/spring-security-rest/src/main/java/org/baeldung/security/MySavedRequestAwareAuthenticationSuccessHandler.java index f4b8e7f5ac..6018264632 100644 --- a/spring-security-rest/src/main/java/org/baeldung/security/MySavedRequestAwareAuthenticationSuccessHandler.java +++ b/spring-security-rest/src/main/java/org/baeldung/security/MySavedRequestAwareAuthenticationSuccessHandler.java @@ -11,8 +11,10 @@ import org.springframework.security.web.authentication.SimpleUrlAuthenticationSu import org.springframework.security.web.savedrequest.HttpSessionRequestCache; import org.springframework.security.web.savedrequest.RequestCache; import org.springframework.security.web.savedrequest.SavedRequest; +import org.springframework.stereotype.Component; import org.springframework.util.StringUtils; +@Component public class MySavedRequestAwareAuthenticationSuccessHandler extends SimpleUrlAuthenticationSuccessHandler { private RequestCache requestCache = new HttpSessionRequestCache(); @@ -33,11 +35,6 @@ public class MySavedRequestAwareAuthenticationSuccessHandler extends SimpleUrlAu } clearAuthenticationAttributes(request); - - // Use the DefaultSavedRequest URL - // final String targetUrl = savedRequest.getRedirectUrl(); - // logger.debug("Redirecting to DefaultSavedRequest Url: " + targetUrl); - // getRedirectStrategy().sendRedirect(request, response, targetUrl); } public void setRequestCache(final RequestCache requestCache) { diff --git a/spring-security-rest/src/main/java/org/baeldung/security/RestAuthenticationEntryPoint.java b/spring-security-rest/src/main/java/org/baeldung/security/RestAuthenticationEntryPoint.java index 77aa32ff97..e448e6537f 100644 --- a/spring-security-rest/src/main/java/org/baeldung/security/RestAuthenticationEntryPoint.java +++ b/spring-security-rest/src/main/java/org/baeldung/security/RestAuthenticationEntryPoint.java @@ -16,7 +16,11 @@ import org.springframework.stereotype.Component; public final class RestAuthenticationEntryPoint implements AuthenticationEntryPoint { @Override - public void commence(final HttpServletRequest request, final HttpServletResponse response, final AuthenticationException authException) throws IOException { + public void commence( + final HttpServletRequest request, + final HttpServletResponse response, + final AuthenticationException authException) throws IOException { + response.sendError(HttpServletResponse.SC_UNAUTHORIZED, "Unauthorized"); } diff --git a/spring-security-rest/src/main/java/org/baeldung/spring/ClientWebConfig.java b/spring-security-rest/src/main/java/org/baeldung/spring/ClientWebConfig.java index 601ba66330..8e20358a5a 100644 --- a/spring-security-rest/src/main/java/org/baeldung/spring/ClientWebConfig.java +++ b/spring-security-rest/src/main/java/org/baeldung/spring/ClientWebConfig.java @@ -2,16 +2,9 @@ package org.baeldung.spring; import org.springframework.context.annotation.Configuration; import org.springframework.web.servlet.config.annotation.EnableWebMvc; -import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter; +import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; @EnableWebMvc @Configuration -public class ClientWebConfig extends WebMvcConfigurerAdapter { - - public ClientWebConfig() { - super(); - } - - // API - +public class ClientWebConfig implements WebMvcConfigurer { } \ No newline at end of file diff --git a/spring-security-rest/src/main/java/org/baeldung/spring/SecurityJavaConfig.java b/spring-security-rest/src/main/java/org/baeldung/spring/SecurityJavaConfig.java index c3e738297a..cc023110b6 100644 --- a/spring-security-rest/src/main/java/org/baeldung/spring/SecurityJavaConfig.java +++ b/spring-security-rest/src/main/java/org/baeldung/spring/SecurityJavaConfig.java @@ -1,6 +1,7 @@ package org.baeldung.spring; import org.baeldung.security.MySavedRequestAwareAuthenticationSuccessHandler; +import org.baeldung.security.RestAuthenticationEntryPoint; import org.baeldung.web.error.CustomAccessDeniedHandler; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; @@ -12,6 +13,8 @@ import org.springframework.security.config.annotation.web.builders.HttpSecurity; import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; import org.springframework.security.core.context.SecurityContextHolder; +import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; +import org.springframework.security.crypto.password.PasswordEncoder; import org.springframework.security.web.authentication.SimpleUrlAuthenticationFailureHandler; @Configuration @@ -23,56 +26,55 @@ public class SecurityJavaConfig extends WebSecurityConfigurerAdapter { @Autowired private CustomAccessDeniedHandler accessDeniedHandler; - // @Autowired - // private RestAuthenticationEntryPoint restAuthenticationEntryPoint; + @Autowired + private RestAuthenticationEntryPoint restAuthenticationEntryPoint; - // @Autowired - // private MySavedRequestAwareAuthenticationSuccessHandler authenticationSuccessHandler; + @Autowired + private MySavedRequestAwareAuthenticationSuccessHandler mySuccessHandler; + + private SimpleUrlAuthenticationFailureHandler myFailureHandler = new SimpleUrlAuthenticationFailureHandler(); public SecurityJavaConfig() { super(); SecurityContextHolder.setStrategyName(SecurityContextHolder.MODE_INHERITABLETHREADLOCAL); } - // - @Override protected void configure(final AuthenticationManagerBuilder auth) throws Exception { - auth.inMemoryAuthentication().withUser("temporary").password("temporary").roles("ADMIN").and().withUser("user").password("userPass").roles("USER"); + auth.inMemoryAuthentication() + .withUser("admin").password(encoder().encode("adminPass")).roles("ADMIN") + .and() + .withUser("user").password(encoder().encode("userPass")).roles("USER"); } @Override - protected void configure(final HttpSecurity http) throws Exception {// @formatter:off - http - .csrf().disable() - .authorizeRequests() - .and() - .exceptionHandling().accessDeniedHandler(accessDeniedHandler) - // .authenticationEntryPoint(restAuthenticationEntryPoint) - .and() - .authorizeRequests() - .antMatchers("/api/csrfAttacker*").permitAll() - .antMatchers("/api/customer/**").permitAll() - .antMatchers("/api/foos/**").authenticated() - .antMatchers("/api/async/**").permitAll() - .antMatchers("/api/admin/**").hasRole("ADMIN") - .and() - .httpBasic() -// .and() -// .successHandler(authenticationSuccessHandler) -// .failureHandler(new SimpleUrlAuthenticationFailureHandler()) - .and() - .logout(); - } // @formatter:on - - @Bean - public MySavedRequestAwareAuthenticationSuccessHandler mySuccessHandler() { - return new MySavedRequestAwareAuthenticationSuccessHandler(); + protected void configure(final HttpSecurity http) throws Exception { + http.csrf().disable() + .authorizeRequests() + .and() + .exceptionHandling() + .accessDeniedHandler(accessDeniedHandler) + .authenticationEntryPoint(restAuthenticationEntryPoint) + .and() + .authorizeRequests() + .antMatchers("/api/csrfAttacker*").permitAll() + .antMatchers("/api/customer/**").permitAll() + .antMatchers("/api/foos/**").authenticated() + .antMatchers("/api/async/**").permitAll() + .antMatchers("/api/admin/**").hasRole("ADMIN") + .and() + .formLogin() + .successHandler(mySuccessHandler) + .failureHandler(myFailureHandler) + .and() + .httpBasic() + .and() + .logout(); } - + @Bean - public SimpleUrlAuthenticationFailureHandler myFailureHandler() { - return new SimpleUrlAuthenticationFailureHandler(); + public PasswordEncoder encoder() { + return new BCryptPasswordEncoder(); } } \ No newline at end of file diff --git a/spring-security-rest/src/main/java/org/baeldung/spring/SwaggerConfig.java b/spring-security-rest/src/main/java/org/baeldung/spring/SwaggerConfig.java index bcf6657eee..aa00e8455e 100644 --- a/spring-security-rest/src/main/java/org/baeldung/spring/SwaggerConfig.java +++ b/spring-security-rest/src/main/java/org/baeldung/spring/SwaggerConfig.java @@ -24,8 +24,19 @@ public class SwaggerConfig { @Bean public Docket api() { - return new Docket(DocumentationType.SWAGGER_2).select().apis(RequestHandlerSelectors.basePackage("org.baeldung.web.controller")).paths(PathSelectors.ant("/foos/*")).build().apiInfo(apiInfo()).useDefaultResponseMessages(false) - .globalResponseMessage(RequestMethod.GET, newArrayList(new ResponseMessageBuilder().code(500).message("500 message").responseModel(new ModelRef("Error")).build(), new ResponseMessageBuilder().code(403).message("Forbidden!!!!!").build())); + return new Docket(DocumentationType.SWAGGER_2).select() + .apis(RequestHandlerSelectors.basePackage("org.baeldung.web.controller")) + .paths(PathSelectors.ant("/foos/*")) + .build() + .apiInfo(apiInfo()) + .useDefaultResponseMessages(false) + .globalResponseMessage(RequestMethod.GET, newArrayList(new ResponseMessageBuilder().code(500) + .message("500 message") + .responseModel(new ModelRef("Error")) + .build(), + new ResponseMessageBuilder().code(403) + .message("Forbidden!!!!!") + .build())); } private ApiInfo apiInfo() { diff --git a/spring-security-rest/src/main/java/org/baeldung/spring/WebConfig.java b/spring-security-rest/src/main/java/org/baeldung/spring/WebConfig.java index 92a3c548a2..dba07dc4e5 100644 --- a/spring-security-rest/src/main/java/org/baeldung/spring/WebConfig.java +++ b/spring-security-rest/src/main/java/org/baeldung/spring/WebConfig.java @@ -8,18 +8,14 @@ import org.springframework.web.servlet.ViewResolver; import org.springframework.web.servlet.config.annotation.EnableWebMvc; import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry; import org.springframework.web.servlet.config.annotation.ViewControllerRegistry; -import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter; +import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; import org.springframework.web.servlet.view.InternalResourceViewResolver; @Configuration @ComponentScan("org.baeldung.web") @EnableWebMvc @EnableAsync -public class WebConfig extends WebMvcConfigurerAdapter { - - public WebConfig() { - super(); - } +public class WebConfig implements WebMvcConfigurer { @Override public void addResourceHandlers(final ResourceHandlerRegistry registry) { @@ -38,7 +34,6 @@ public class WebConfig extends WebMvcConfigurerAdapter { @Override public void addViewControllers(final ViewControllerRegistry registry) { - super.addViewControllers(registry); registry.addViewController("/csrfAttacker.html"); } diff --git a/spring-security-rest/src/main/java/org/baeldung/web/controller/AsyncController.java b/spring-security-rest/src/main/java/org/baeldung/web/controller/AsyncController.java index 456eeaaeac..f6f1c392cb 100644 --- a/spring-security-rest/src/main/java/org/baeldung/web/controller/AsyncController.java +++ b/spring-security-rest/src/main/java/org/baeldung/web/controller/AsyncController.java @@ -24,9 +24,9 @@ public class AsyncController { @RequestMapping(method = RequestMethod.GET, value = "/async") @ResponseBody public Object standardProcessing() throws Exception { - log.info("Outside the @Async logic - before the async call: " + SecurityContextHolder.getContext().getAuthentication().getPrincipal()); + log.info("Outside the @Async logic - before the async call: {}", SecurityContextHolder.getContext().getAuthentication().getPrincipal()); asyncService.asyncCall(); - log.info("Inside the @Async logic - after the async call: " + SecurityContextHolder.getContext().getAuthentication().getPrincipal()); + log.info("Inside the @Async logic - after the async call: {}", SecurityContextHolder.getContext().getAuthentication().getPrincipal()); return SecurityContextHolder.getContext().getAuthentication().getPrincipal(); } diff --git a/spring-security-rest/src/main/java/org/baeldung/web/controller/CustomerController.java b/spring-security-rest/src/main/java/org/baeldung/web/controller/CustomerController.java index b8f67960f5..e1db105d18 100644 --- a/spring-security-rest/src/main/java/org/baeldung/web/controller/CustomerController.java +++ b/spring-security-rest/src/main/java/org/baeldung/web/controller/CustomerController.java @@ -48,7 +48,7 @@ public class CustomerController { } Link link =linkTo(methodOn(CustomerController.class).getOrdersForCustomer(customerId)).withSelfRel(); - Resources result = new Resources(orders,link); + Resources result = new Resources<>(orders,link); return result; } @@ -67,7 +67,7 @@ public class CustomerController { } Link link =linkTo(CustomerController.class).withSelfRel(); - Resources result = new Resources(allCustomers,link); + Resources result = new Resources<>(allCustomers,link); return result; } diff --git a/spring-security-rest/src/main/java/org/baeldung/web/controller/FooController.java b/spring-security-rest/src/main/java/org/baeldung/web/controller/FooController.java index 3b9e5d25c0..f914f82215 100644 --- a/spring-security-rest/src/main/java/org/baeldung/web/controller/FooController.java +++ b/spring-security-rest/src/main/java/org/baeldung/web/controller/FooController.java @@ -7,8 +7,6 @@ import java.util.List; import javax.servlet.http.HttpServletResponse; import org.baeldung.persistence.model.Foo; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.context.ApplicationEventPublisher; import org.springframework.http.HttpStatus; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.PathVariable; @@ -25,17 +23,9 @@ import com.google.common.collect.Lists; @RequestMapping(value = "/foos") public class FooController { - @Autowired - private ApplicationEventPublisher eventPublisher; - - public FooController() { - super(); - } - // API // read - single - @RequestMapping(value = "/{id}", method = RequestMethod.GET) @ResponseBody public Foo findById(@PathVariable("id") final Long id, final UriComponentsBuilder uriBuilder, final HttpServletResponse response) { @@ -43,7 +33,6 @@ public class FooController { } // read - multiple - @RequestMapping(method = RequestMethod.GET) @ResponseBody public List findAll() { diff --git a/spring-security-rest/src/main/java/org/baeldung/web/service/AsyncServiceImpl.java b/spring-security-rest/src/main/java/org/baeldung/web/service/AsyncServiceImpl.java index caaaa8e0dc..d6d7f53dd7 100644 --- a/spring-security-rest/src/main/java/org/baeldung/web/service/AsyncServiceImpl.java +++ b/spring-security-rest/src/main/java/org/baeldung/web/service/AsyncServiceImpl.java @@ -17,18 +17,18 @@ public class AsyncServiceImpl implements AsyncService { @Async @Override public void asyncCall() { - log.info("Inside the @Async logic: " + SecurityContextHolder.getContext().getAuthentication().getPrincipal()); + log.info("Inside the @Async logic: {}", SecurityContextHolder.getContext().getAuthentication().getPrincipal()); } @Override public Callable checkIfPrincipalPropagated() { Object before = SecurityContextHolder.getContext().getAuthentication().getPrincipal(); - log.info("Before new thread: " + before); + log.info("Before new thread: {}", before); return new Callable() { public Boolean call() throws Exception { Object after = SecurityContextHolder.getContext().getAuthentication().getPrincipal(); - log.info("New thread: " + after); + log.info("New thread: {}", after); return before == after; } }; diff --git a/spring-security-rest/src/main/resources/webSecurityConfig.xml b/spring-security-rest/src/main/resources/webSecurityConfig.xml index 4bb208a195..edd3cba39c 100644 --- a/spring-security-rest/src/main/resources/webSecurityConfig.xml +++ b/spring-security-rest/src/main/resources/webSecurityConfig.xml @@ -5,10 +5,12 @@ xmlns:p="http://www.springframework.org/schema/p" xsi:schemaLocation=" http://www.springframework.org/schema/security - http://www.springframework.org/schema/security/spring-security-4.2.xsd + http://www.springframework.org/schema/security/spring-security.xsd http://www.springframework.org/schema/beans - http://www.springframework.org/schema/beans/spring-beans-4.2.xsd"> + http://www.springframework.org/schema/beans/spring-beans.xsd"> + + + @@ -44,5 +46,5 @@ - +--> \ No newline at end of file diff --git a/spring-security-rest/src/main/webapp/WEB-INF/api-servlet.xml b/spring-security-rest/src/main/webapp/WEB-INF/api-servlet.xml index 5a68371f6c..89be8a5285 100644 --- a/spring-security-rest/src/main/webapp/WEB-INF/api-servlet.xml +++ b/spring-security-rest/src/main/webapp/WEB-INF/api-servlet.xml @@ -1,7 +1,7 @@ + xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd"> diff --git a/spring-security-sso/pom.xml b/spring-security-sso/pom.xml index 764e899640..4deab01464 100644 --- a/spring-security-sso/pom.xml +++ b/spring-security-sso/pom.xml @@ -9,10 +9,10 @@ pom - parent-boot-2 + parent-boot-2.0-temp com.baeldung 0.0.1-SNAPSHOT - ../parent-boot-2 + ../parent-boot-2.0-temp @@ -24,7 +24,7 @@ 3.1.0 2.3.3.RELEASE - 2.0.1.RELEASE + 2.0.1.RELEASE - \ No newline at end of file + diff --git a/spring-security-sso/spring-security-sso-auth-server/pom.xml b/spring-security-sso/spring-security-sso-auth-server/pom.xml index 1d57248b30..ff76f377c6 100644 --- a/spring-security-sso/spring-security-sso-auth-server/pom.xml +++ b/spring-security-sso/spring-security-sso-auth-server/pom.xml @@ -24,7 +24,6 @@ spring-security-oauth2 ${oauth.version} - - \ No newline at end of file + diff --git a/spring-security-sso/spring-security-sso-ui-2/pom.xml b/spring-security-sso/spring-security-sso-ui-2/pom.xml index afe7b59822..1f9a5754ae 100644 --- a/spring-security-sso/spring-security-sso-ui-2/pom.xml +++ b/spring-security-sso/spring-security-sso-ui-2/pom.xml @@ -42,4 +42,4 @@ - \ No newline at end of file + diff --git a/spring-security-sso/spring-security-sso-ui-2/src/main/java/org/baeldung/config/UiWebConfig.java b/spring-security-sso/spring-security-sso-ui-2/src/main/java/org/baeldung/config/UiWebConfig.java index 24d6c9b5d8..c17bb85173 100644 --- a/spring-security-sso/spring-security-sso-ui-2/src/main/java/org/baeldung/config/UiWebConfig.java +++ b/spring-security-sso/spring-security-sso-ui-2/src/main/java/org/baeldung/config/UiWebConfig.java @@ -3,15 +3,11 @@ package org.baeldung.config; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.context.support.PropertySourcesPlaceholderConfigurer; -import org.springframework.web.servlet.config.annotation.DefaultServletHandlerConfigurer; -import org.springframework.web.servlet.config.annotation.EnableWebMvc; -import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry; -import org.springframework.web.servlet.config.annotation.ViewControllerRegistry; -import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter; +import org.springframework.web.servlet.config.annotation.*; @Configuration @EnableWebMvc -public class UiWebConfig extends WebMvcConfigurerAdapter { +public class UiWebConfig implements WebMvcConfigurer { @Bean public static PropertySourcesPlaceholderConfigurer propertySourcesPlaceholderConfigurer() { @@ -25,7 +21,6 @@ public class UiWebConfig extends WebMvcConfigurerAdapter { @Override public void addViewControllers(final ViewControllerRegistry registry) { - super.addViewControllers(registry); registry.addViewController("/") .setViewName("forward:/index"); registry.addViewController("/index"); diff --git a/spring-security-sso/spring-security-sso-ui/pom.xml b/spring-security-sso/spring-security-sso-ui/pom.xml index deb0e081be..56131749ba 100644 --- a/spring-security-sso/spring-security-sso-ui/pom.xml +++ b/spring-security-sso/spring-security-sso-ui/pom.xml @@ -43,4 +43,4 @@
- \ No newline at end of file + diff --git a/spring-security-sso/spring-security-sso-ui/src/main/java/org/baeldung/config/UiWebConfig.java b/spring-security-sso/spring-security-sso-ui/src/main/java/org/baeldung/config/UiWebConfig.java index 24d6c9b5d8..c17bb85173 100644 --- a/spring-security-sso/spring-security-sso-ui/src/main/java/org/baeldung/config/UiWebConfig.java +++ b/spring-security-sso/spring-security-sso-ui/src/main/java/org/baeldung/config/UiWebConfig.java @@ -3,15 +3,11 @@ package org.baeldung.config; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.context.support.PropertySourcesPlaceholderConfigurer; -import org.springframework.web.servlet.config.annotation.DefaultServletHandlerConfigurer; -import org.springframework.web.servlet.config.annotation.EnableWebMvc; -import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry; -import org.springframework.web.servlet.config.annotation.ViewControllerRegistry; -import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter; +import org.springframework.web.servlet.config.annotation.*; @Configuration @EnableWebMvc -public class UiWebConfig extends WebMvcConfigurerAdapter { +public class UiWebConfig implements WebMvcConfigurer { @Bean public static PropertySourcesPlaceholderConfigurer propertySourcesPlaceholderConfigurer() { @@ -25,7 +21,6 @@ public class UiWebConfig extends WebMvcConfigurerAdapter { @Override public void addViewControllers(final ViewControllerRegistry registry) { - super.addViewControllers(registry); registry.addViewController("/") .setViewName("forward:/index"); registry.addViewController("/index"); diff --git a/spring-security-thymeleaf/pom.xml b/spring-security-thymeleaf/pom.xml index 5b7715bdeb..314783ebf2 100644 --- a/spring-security-thymeleaf/pom.xml +++ b/spring-security-thymeleaf/pom.xml @@ -11,10 +11,10 @@ Spring Security with Thymeleaf tutorial - parent-boot-2 + parent-boot-2.0-temp com.baeldung 0.0.1-SNAPSHOT - ../parent-boot-2 + ../parent-boot-2.0-temp diff --git a/spring-security-x509/pom.xml b/spring-security-x509/pom.xml index 0cee3b3129..658840e866 100644 --- a/spring-security-x509/pom.xml +++ b/spring-security-x509/pom.xml @@ -6,7 +6,8 @@ spring-security-x509 0.0.1-SNAPSHOT pom - + spring-security-x509 + parent-boot-1 com.baeldung diff --git a/spring-security-x509/spring-security-x509-basic-auth/pom.xml b/spring-security-x509/spring-security-x509-basic-auth/pom.xml index 67f2b4fbcd..5b68a8e63b 100644 --- a/spring-security-x509/spring-security-x509-basic-auth/pom.xml +++ b/spring-security-x509/spring-security-x509-basic-auth/pom.xml @@ -2,11 +2,10 @@ 4.0.0 - spring-security-x509-basic-auth 0.0.1-SNAPSHOT jar - Spring Security x.509 Basic Authentication + spring-security-x509-basic-auth Spring x.509 Authentication Demo diff --git a/spring-security-x509/spring-security-x509-client-auth/pom.xml b/spring-security-x509/spring-security-x509-client-auth/pom.xml index 5cb4001a94..47ec7f971d 100644 --- a/spring-security-x509/spring-security-x509-client-auth/pom.xml +++ b/spring-security-x509/spring-security-x509-client-auth/pom.xml @@ -2,11 +2,10 @@ 4.0.0 - spring-security-x509-client-auth 0.0.1-SNAPSHOT jar - Spring Security x.509 Client Authentication + spring-security-x509-client-auth Spring x.509 Client Authentication Demo diff --git a/spring-session/spring-session-jdbc/pom.xml b/spring-session/spring-session-jdbc/pom.xml index ce6b5f5908..a595a94914 100644 --- a/spring-session/spring-session-jdbc/pom.xml +++ b/spring-session/spring-session-jdbc/pom.xml @@ -15,10 +15,10 @@ - parent-boot-2 + parent-boot-2.0-temp com.baeldung 0.0.1-SNAPSHOT - ../../parent-boot-2 + ../../parent-boot-2.0-temp diff --git a/spring-session/spring-session-redis/pom.xml b/spring-session/spring-session-redis/pom.xml index 00da656226..96d90b2776 100644 --- a/spring-session/spring-session-redis/pom.xml +++ b/spring-session/spring-session-redis/pom.xml @@ -5,6 +5,7 @@ spring-session-redis 1.0.0-SNAPSHOT jar + spring-session-redis parent-boot-1 diff --git a/spring-sleuth/pom.xml b/spring-sleuth/pom.xml index a9a8d3e96e..5ce9e07858 100644 --- a/spring-sleuth/pom.xml +++ b/spring-sleuth/pom.xml @@ -6,7 +6,8 @@ spring-sleuth 1.0.0-SNAPSHOT jar - + spring-sleuth + parent-boot-1 com.baeldung diff --git a/spring-spel/pom.xml b/spring-spel/pom.xml index 4af318fde2..aa6eb45158 100644 --- a/spring-spel/pom.xml +++ b/spring-spel/pom.xml @@ -5,7 +5,7 @@ com.baeldung spring-spel 1.0-SNAPSHOT - Spring SpEL + spring-spel com.baeldung diff --git a/spring-state-machine/pom.xml b/spring-state-machine/pom.xml index 5d15e4dfad..b911b5b5ee 100644 --- a/spring-state-machine/pom.xml +++ b/spring-state-machine/pom.xml @@ -3,7 +3,8 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 spring-state-machine - + spring-state-machine + parent-modules com.baeldung diff --git a/spring-swagger-codegen/pom.xml b/spring-swagger-codegen/pom.xml index 8e551d850f..e1bb98360e 100644 --- a/spring-swagger-codegen/pom.xml +++ b/spring-swagger-codegen/pom.xml @@ -4,6 +4,7 @@ spring-swagger-codegen 0.0.1-SNAPSHOT pom + spring-swagger-codegen com.baeldung diff --git a/spring-swagger-codegen/spring-swagger-codegen-app/pom.xml b/spring-swagger-codegen/spring-swagger-codegen-app/pom.xml index 4aff696828..f9410b6865 100644 --- a/spring-swagger-codegen/spring-swagger-codegen-app/pom.xml +++ b/spring-swagger-codegen/spring-swagger-codegen-app/pom.xml @@ -2,7 +2,8 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 spring-swagger-codegen-app - + spring-swagger-codegen-app + com.baeldung spring-swagger-codegen diff --git a/spring-thymeleaf/pom.xml b/spring-thymeleaf/pom.xml index 0926728aba..78f95fe1df 100644 --- a/spring-thymeleaf/pom.xml +++ b/spring-thymeleaf/pom.xml @@ -5,6 +5,7 @@ spring-thymeleaf 0.1-SNAPSHOT war + spring-thymeleaf com.baeldung diff --git a/spring-thymeleaf/src/main/java/com/baeldung/thymeleaf/controller/BookController.java b/spring-thymeleaf/src/main/java/com/baeldung/thymeleaf/controller/BookController.java index b8132cddc8..d10caee9e7 100644 --- a/spring-thymeleaf/src/main/java/com/baeldung/thymeleaf/controller/BookController.java +++ b/spring-thymeleaf/src/main/java/com/baeldung/thymeleaf/controller/BookController.java @@ -21,16 +21,13 @@ import com.baeldung.thymeleaf.service.BookService; @Controller public class BookController { - private static int currentPage = 1; - private static int pageSize = 5; - @Autowired private BookService bookService; - + @RequestMapping(value = "/listBooks", method = RequestMethod.GET) public String listBooks(Model model, @RequestParam("page") Optional page, @RequestParam("size") Optional size) { - page.ifPresent(p -> currentPage = p); - size.ifPresent(s -> pageSize = s); + final int currentPage = page.orElse(1); + final int pageSize = size.orElse(5); Page bookPage = bookService.findPaginated(PageRequest.of(currentPage - 1, pageSize)); diff --git a/spring-userservice/pom.xml b/spring-userservice/pom.xml index 7144a57ca6..e562171103 100644 --- a/spring-userservice/pom.xml +++ b/spring-userservice/pom.xml @@ -1,12 +1,12 @@ 4.0.0 - spring-userservice spring-userservice 0.0.1-SNAPSHOT war - + spring-userservice + com.baeldung parent-spring-4 diff --git a/spring-vault/pom.xml b/spring-vault/pom.xml index 31616cdb16..6a7db5dd71 100644 --- a/spring-vault/pom.xml +++ b/spring-vault/pom.xml @@ -13,10 +13,10 @@ Spring Vault sample project - parent-boot-2 + parent-boot-2.0-temp com.baeldung 0.0.1-SNAPSHOT - ../parent-boot-2 + ../parent-boot-2.0-temp diff --git a/spring-vertx/pom.xml b/spring-vertx/pom.xml index 790eeff128..14ed77d359 100644 --- a/spring-vertx/pom.xml +++ b/spring-vertx/pom.xml @@ -2,10 +2,9 @@ 4.0.0 - spring-vertx jar - Spring Vertx + spring-vertx A demo project with vertx spring integration diff --git a/spring-webflux-amqp/pom.xml b/spring-webflux-amqp/pom.xml index 4faa165c50..e4e0d55ce3 100755 --- a/spring-webflux-amqp/pom.xml +++ b/spring-webflux-amqp/pom.xml @@ -11,10 +11,10 @@ Spring WebFlux AMQP Sample - parent-boot-2 + parent-boot-2.0-temp com.baeldung 0.0.1-SNAPSHOT - ../parent-boot-2 + ../parent-boot-2.0-temp diff --git a/spring-zuul/pom.xml b/spring-zuul/pom.xml index 35e419cdc7..266c20adee 100644 --- a/spring-zuul/pom.xml +++ b/spring-zuul/pom.xml @@ -38,7 +38,7 @@ - 1.2.3.RELEASE + 1.2.7.RELEASE 3.5 diff --git a/sse-jaxrs/pom.xml b/sse-jaxrs/pom.xml index ac9bff937f..68d1b1bc2b 100644 --- a/sse-jaxrs/pom.xml +++ b/sse-jaxrs/pom.xml @@ -3,10 +3,10 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 - com.baeldung.sse sse-jaxrs 1.0-SNAPSHOT + sse-jaxrs pom diff --git a/sse-jaxrs/sse-jaxrs-client/pom.xml b/sse-jaxrs/sse-jaxrs-client/pom.xml index a9068e133f..15a991bfc0 100644 --- a/sse-jaxrs/sse-jaxrs-client/pom.xml +++ b/sse-jaxrs/sse-jaxrs-client/pom.xml @@ -3,6 +3,8 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 + sse-jaxrs-client + sse-jaxrs-client com.baeldung.sse @@ -10,8 +12,6 @@ 1.0-SNAPSHOT - sse-jaxrs-client - 3.2.0 diff --git a/sse-jaxrs/sse-jaxrs-server/pom.xml b/sse-jaxrs/sse-jaxrs-server/pom.xml index 1e89c70e13..825dcddbdf 100644 --- a/sse-jaxrs/sse-jaxrs-server/pom.xml +++ b/sse-jaxrs/sse-jaxrs-server/pom.xml @@ -3,16 +3,16 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 - + sse-jaxrs-server + war + sse-jaxrs-server + com.baeldung.sse sse-jaxrs 1.0-SNAPSHOT - sse-jaxrs-server - war - 2.4.2 false diff --git a/static-analysis/pom.xml b/static-analysis/pom.xml index 14853d81f7..94d68f895b 100644 --- a/static-analysis/pom.xml +++ b/static-analysis/pom.xml @@ -2,10 +2,10 @@ 4.0.0 - com.baeldung static-analysis 1.0-SNAPSHOT + static-analysis com.baeldung diff --git a/structurizr/pom.xml b/structurizr/pom.xml index cbbbf8d68c..b9f9b68717 100644 --- a/structurizr/pom.xml +++ b/structurizr/pom.xml @@ -2,9 +2,8 @@ 4.0.0 - - com.baeldung structurizr + structurizr com.baeldung @@ -26,32 +25,24 @@ com.structurizr structurizr-client - ${structurizr-client.version} + ${structurizr.version} - org.springframework - spring-context - ${spring.version} + com.structurizr + structurizr-analysis + ${structurizr.version} + + + com.structurizr + structurizr-plantuml + ${structurizr.version} - - - - false - - central - bintray - http://jcenter.bintray.com - - - 1.8 1.8 - 1.0.0-RC3 - 0.6.0 - 4.3.8.RELEASE + 1.0.0-RC5 \ No newline at end of file diff --git a/structurizr/src/main/java/com/baeldung/structurizr/StructurizrSimple.java b/structurizr/src/main/java/com/baeldung/structurizr/StructurizrSimple.java index 6eb0c7de73..b33a1d9a77 100644 --- a/structurizr/src/main/java/com/baeldung/structurizr/StructurizrSimple.java +++ b/structurizr/src/main/java/com/baeldung/structurizr/StructurizrSimple.java @@ -4,12 +4,10 @@ import java.io.File; import java.io.StringWriter; import com.structurizr.Workspace; -import com.structurizr.api.StructurizrClient; -import com.structurizr.api.StructurizrClientException; -import com.structurizr.componentfinder.ComponentFinder; -import com.structurizr.componentfinder.ReferencedTypesSupportingTypesStrategy; -import com.structurizr.componentfinder.SourceCodeComponentFinderStrategy; -import com.structurizr.componentfinder.SpringComponentFinderStrategy; +import com.structurizr.analysis.ComponentFinder; +import com.structurizr.analysis.ReferencedTypesSupportingTypesStrategy; +import com.structurizr.analysis.SourceCodeComponentFinderStrategy; +import com.structurizr.analysis.SpringComponentFinderStrategy; import com.structurizr.io.WorkspaceWriterException; import com.structurizr.io.plantuml.PlantUMLWriter; import com.structurizr.model.Component; @@ -112,11 +110,6 @@ public class StructurizrSimple { view.addAllContainers(); } - private static void uploadToExternal(Workspace workspace) throws StructurizrClientException { - StructurizrClient client = new StructurizrClient("e94bc0c9-76ef-41b0-8de7-82afc1010d04", "78d555dd-2a31-487c-952c-50508f1da495"); - client.putWorkspace(32961L, workspace); - } - private static void exportToPlantUml(View view) throws WorkspaceWriterException { StringWriter stringWriter = new StringWriter(); PlantUMLWriter plantUMLWriter = new PlantUMLWriter(); diff --git a/struts-2/pom.xml b/struts-2/pom.xml index fee68c8303..ac8579d9e0 100644 --- a/struts-2/pom.xml +++ b/struts-2/pom.xml @@ -5,7 +5,7 @@ struts-2 0.0.1-SNAPSHOT pom - Struts 2 + struts-2 com.baeldung diff --git a/testing-modules/README.md b/testing-modules/README.md index b189b9819e..d69f07215e 100644 --- a/testing-modules/README.md +++ b/testing-modules/README.md @@ -14,3 +14,4 @@ - [JSON Schema Validation with REST-assured](http://www.baeldung.com/rest-assured-json-schema) - [Testing Callbacks with Mockito](http://www.baeldung.com/mockito-callbacks) - [Running JUnit Tests in Parallel with Maven](https://www.baeldung.com/maven-junit-parallel-tests) +- [Gatling vs JMeter vs The Grinder: Comparing Load Test Tools](https://www.baeldung.com/gatling-jmeter-grinder-comparison) diff --git a/testing-modules/gatling/pom.xml b/testing-modules/gatling/pom.xml index 8d4c89ec62..158da176c6 100644 --- a/testing-modules/gatling/pom.xml +++ b/testing-modules/gatling/pom.xml @@ -6,7 +6,8 @@ org.baeldung gatling 1.0-SNAPSHOT - + gatling + com.baeldung parent-modules diff --git a/testing-modules/groovy-spock/pom.xml b/testing-modules/groovy-spock/pom.xml index e0da345eb4..3dd01c29ab 100644 --- a/testing-modules/groovy-spock/pom.xml +++ b/testing-modules/groovy-spock/pom.xml @@ -6,6 +6,7 @@ groovy-spock 1.0-SNAPSHOT jar + groovy-spock com.baeldung diff --git a/testing-modules/junit-5/README.md b/testing-modules/junit-5/README.md index 836848282b..1fbd7a4a5e 100644 --- a/testing-modules/junit-5/README.md +++ b/testing-modules/junit-5/README.md @@ -15,3 +15,4 @@ - [The Order of Tests in JUnit](http://www.baeldung.com/junit-5-test-order) - [Running JUnit Tests Programmatically, from a Java Application](https://www.baeldung.com/junit-tests-run-programmatically-from-java) - [Testing an Abstract Class With JUnit](https://www.baeldung.com/junit-test-abstract-class) +- [A Quick JUnit vs TestNG Comparison](http://www.baeldung.com/junit-vs-testng) diff --git a/testing-modules/junit-5/pom.xml b/testing-modules/junit-5/pom.xml index 93365264ac..b7600267d9 100644 --- a/testing-modules/junit-5/pom.xml +++ b/testing-modules/junit-5/pom.xml @@ -72,6 +72,13 @@ + + org.mockito + mockito-junit-jupiter + ${mockito.junit.jupiter.version} + test + + org.powermock powermock-api-mockito2 @@ -118,13 +125,13 @@ - 5.2.0 + 5.3.1 + 2.23.0 1.2.0 5.2.0 2.8.2 1.4.196 - 2.8.9 - 1.7.4 + 2.0.0-RC.1 2.21.0 1.6.0 5.0.1.RELEASE diff --git a/testing-modules/junit-5/src/main/java/com/baeldung/throwsexception/Calculator.java b/testing-modules/junit-5/src/main/java/com/baeldung/junit5vstestng/Calculator.java similarity index 85% rename from testing-modules/junit-5/src/main/java/com/baeldung/throwsexception/Calculator.java rename to testing-modules/junit-5/src/main/java/com/baeldung/junit5vstestng/Calculator.java index 50dbc9c774..4ff303c031 100644 --- a/testing-modules/junit-5/src/main/java/com/baeldung/throwsexception/Calculator.java +++ b/testing-modules/junit-5/src/main/java/com/baeldung/junit5vstestng/Calculator.java @@ -1,4 +1,4 @@ -package com.baeldung.throwsexception; +package com.baeldung.junit5vstestng; public class Calculator { diff --git a/testing-modules/junit-5/src/main/java/com/baeldung/throwsexception/DivideByZeroException.java b/testing-modules/junit-5/src/main/java/com/baeldung/junit5vstestng/DivideByZeroException.java similarity index 79% rename from testing-modules/junit-5/src/main/java/com/baeldung/throwsexception/DivideByZeroException.java rename to testing-modules/junit-5/src/main/java/com/baeldung/junit5vstestng/DivideByZeroException.java index 4413374c99..4523f46590 100644 --- a/testing-modules/junit-5/src/main/java/com/baeldung/throwsexception/DivideByZeroException.java +++ b/testing-modules/junit-5/src/main/java/com/baeldung/junit5vstestng/DivideByZeroException.java @@ -1,4 +1,4 @@ -package com.baeldung.throwsexception; +package com.baeldung.junit5vstestng; public class DivideByZeroException extends RuntimeException { diff --git a/testing-modules/junit-5/src/test/java/com/baeldung/junit5/mockito/MockitoExtension.java b/testing-modules/junit-5/src/test/java/com/baeldung/junit5/mockito/MockitoExtension.java deleted file mode 100644 index 5836ef46e6..0000000000 --- a/testing-modules/junit-5/src/test/java/com/baeldung/junit5/mockito/MockitoExtension.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Copyright 2015-2016 the original author or authors. - * - * All rights reserved. This program and the accompanying materials are - * made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution and is available at - * - * http://www.eclipse.org/legal/epl-v10.html - */ - -package com.baeldung.junit5.mockito; - -import static org.mockito.Mockito.mock; - -import java.lang.reflect.Parameter; - -import org.junit.jupiter.api.extension.ExtensionContext; -import org.junit.jupiter.api.extension.ExtensionContext.Namespace; -import org.junit.jupiter.api.extension.ExtensionContext.Store; -import org.junit.jupiter.api.extension.ParameterContext; -import org.junit.jupiter.api.extension.ParameterResolver; -import org.junit.jupiter.api.extension.TestInstancePostProcessor; -import org.mockito.MockitoAnnotations; -import org.mockito.Mock; - -/** - * {@code MockitoExtension} showcases the {@link TestInstancePostProcessor} - * and {@link ParameterResolver} extension APIs of JUnit 5 by providing - * dependency injection support at the field level and at the method parameter - * level via Mockito 2.x's {@link Mock @Mock} annotation. - * - * @since 5.0 - */ -public class MockitoExtension implements TestInstancePostProcessor, ParameterResolver { - - @Override - public void postProcessTestInstance(Object testInstance, ExtensionContext context) { - MockitoAnnotations.initMocks(testInstance); - } - - @Override - public boolean supportsParameter(ParameterContext parameterContext, ExtensionContext extensionContext) { - return parameterContext.getParameter().isAnnotationPresent(Mock.class); - } - - @Override - public Object resolveParameter(ParameterContext parameterContext, ExtensionContext extensionContext) { - return getMock(parameterContext.getParameter(), extensionContext); - } - - private Object getMock(Parameter parameter, ExtensionContext extensionContext) { - Class mockType = parameter.getType(); - Store mocks = extensionContext.getStore(Namespace.create(MockitoExtension.class, mockType)); - String mockName = getMockName(parameter); - - if (mockName != null) { - return mocks.getOrComputeIfAbsent(mockName, key -> mock(mockType, mockName)); - } - else { - return mocks.getOrComputeIfAbsent(mockType.getCanonicalName(), key -> mock(mockType)); - } - } - - private String getMockName(Parameter parameter) { - String explicitMockName = parameter.getAnnotation(Mock.class).name().trim(); - if (!explicitMockName.isEmpty()) { - return explicitMockName; - } - else if (parameter.isNamePresent()) { - return parameter.getName(); - } - return null; - } - -} \ No newline at end of file diff --git a/testing-modules/junit-5/src/test/java/com/baeldung/junit5/mockito/UserServiceUnitTest.java b/testing-modules/junit-5/src/test/java/com/baeldung/junit5/mockito/UserServiceUnitTest.java index 1ddab0531a..d4195e3b12 100644 --- a/testing-modules/junit-5/src/test/java/com/baeldung/junit5/mockito/UserServiceUnitTest.java +++ b/testing-modules/junit-5/src/test/java/com/baeldung/junit5/mockito/UserServiceUnitTest.java @@ -3,9 +3,7 @@ package com.baeldung.junit5.mockito; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.fail; import static org.mockito.ArgumentMatchers.any; -import static org.mockito.Mockito.never; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; +import static org.mockito.Mockito.*; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.BeforeEach; @@ -16,6 +14,7 @@ import org.junit.runner.RunWith; import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.invocation.InvocationOnMock; +import org.mockito.junit.jupiter.MockitoExtension; import org.mockito.stubbing.Answer; import com.baeldung.junit5.mockito.repository.MailClient; @@ -25,21 +24,24 @@ import com.baeldung.junit5.mockito.service.DefaultUserService; import com.baeldung.junit5.mockito.service.Errors; import com.baeldung.junit5.mockito.service.UserService; -@RunWith(JUnitPlatform.class) @ExtendWith(MockitoExtension.class) +@RunWith(JUnitPlatform.class) public class UserServiceUnitTest { UserService userService; + SettingRepository settingRepository; @Mock UserRepository userRepository; - + @Mock MailClient mailClient; + User user; @BeforeEach - void init(@Mock SettingRepository settingRepository, @Mock MailClient mailClient) { + void init(@Mock SettingRepository settingRepository) { userService = new DefaultUserService(userRepository, settingRepository, mailClient); - when(settingRepository.getUserMinAge()).thenReturn(10); + lenient().when(settingRepository.getUserMinAge()).thenReturn(10); when(settingRepository.getUserNameMinLength()).thenReturn(4); - when(userRepository.isUsernameAlreadyExists(any(String.class))).thenReturn(false); + lenient().when(userRepository.isUsernameAlreadyExists(any(String.class))).thenReturn(false); + this.settingRepository = settingRepository; } @Test @@ -56,7 +58,9 @@ public class UserServiceUnitTest { return user; } }); - + + userService = new DefaultUserService(userRepository, settingRepository, mailClient); + // When User insertedUser = userService.register(user); diff --git a/testing-modules/junit-5/src/test/java/com/baeldung/throwsexception/CalculatorUnitTest.java b/testing-modules/junit-5/src/test/java/com/baeldung/junit5vstestng/CalculatorUnitTest.java similarity index 90% rename from testing-modules/junit-5/src/test/java/com/baeldung/throwsexception/CalculatorUnitTest.java rename to testing-modules/junit-5/src/test/java/com/baeldung/junit5vstestng/CalculatorUnitTest.java index ef838ed304..c563b01603 100644 --- a/testing-modules/junit-5/src/test/java/com/baeldung/throwsexception/CalculatorUnitTest.java +++ b/testing-modules/junit-5/src/test/java/com/baeldung/junit5vstestng/CalculatorUnitTest.java @@ -1,4 +1,4 @@ -package com.baeldung.throwsexception; +package com.baeldung.junit5vstestng; import org.junit.Test; diff --git a/testing-modules/junit-5/src/test/java/org/baeldung/java/suite/childpackage1/Class1UnitTest.java b/testing-modules/junit-5/src/test/java/com/baeldung/junit5vstestng/Class1UnitTest.java similarity index 81% rename from testing-modules/junit-5/src/test/java/org/baeldung/java/suite/childpackage1/Class1UnitTest.java rename to testing-modules/junit-5/src/test/java/com/baeldung/junit5vstestng/Class1UnitTest.java index 78469cb971..09c2b9108b 100644 --- a/testing-modules/junit-5/src/test/java/org/baeldung/java/suite/childpackage1/Class1UnitTest.java +++ b/testing-modules/junit-5/src/test/java/com/baeldung/junit5vstestng/Class1UnitTest.java @@ -1,4 +1,4 @@ -package org.baeldung.java.suite.childpackage1; +package com.baeldung.junit5vstestng; import static org.junit.jupiter.api.Assertions.assertTrue; diff --git a/testing-modules/junit-5/src/test/java/org/baeldung/java/suite/childpackage2/Class2UnitTest.java b/testing-modules/junit-5/src/test/java/com/baeldung/junit5vstestng/Class2UnitTest.java similarity index 81% rename from testing-modules/junit-5/src/test/java/org/baeldung/java/suite/childpackage2/Class2UnitTest.java rename to testing-modules/junit-5/src/test/java/com/baeldung/junit5vstestng/Class2UnitTest.java index 4463ecfad9..184ecafa1b 100644 --- a/testing-modules/junit-5/src/test/java/org/baeldung/java/suite/childpackage2/Class2UnitTest.java +++ b/testing-modules/junit-5/src/test/java/com/baeldung/junit5vstestng/Class2UnitTest.java @@ -1,4 +1,4 @@ -package org.baeldung.java.suite.childpackage2; +package com.baeldung.junit5vstestng; import static org.junit.jupiter.api.Assertions.assertTrue; diff --git a/testing-modules/junit-5/src/test/java/org/baeldung/java/customtestname/CustomNameUnitTest.java b/testing-modules/junit-5/src/test/java/com/baeldung/junit5vstestng/CustomNameUnitTest.java similarity index 91% rename from testing-modules/junit-5/src/test/java/org/baeldung/java/customtestname/CustomNameUnitTest.java rename to testing-modules/junit-5/src/test/java/com/baeldung/junit5vstestng/CustomNameUnitTest.java index f04b825c89..9cf03ad3de 100644 --- a/testing-modules/junit-5/src/test/java/org/baeldung/java/customtestname/CustomNameUnitTest.java +++ b/testing-modules/junit-5/src/test/java/com/baeldung/junit5vstestng/CustomNameUnitTest.java @@ -1,4 +1,4 @@ -package org.baeldung.java.customtestname; +package com.baeldung.junit5vstestng; import static org.junit.Assert.assertNotNull; diff --git a/testing-modules/junit-5/src/test/java/org/baeldung/java/parameterisedsource/ParameterizedUnitTest.java b/testing-modules/junit-5/src/test/java/com/baeldung/junit5vstestng/ParameterizedUnitTest.java similarity index 96% rename from testing-modules/junit-5/src/test/java/org/baeldung/java/parameterisedsource/ParameterizedUnitTest.java rename to testing-modules/junit-5/src/test/java/com/baeldung/junit5vstestng/ParameterizedUnitTest.java index 8d09161176..b5560650c4 100644 --- a/testing-modules/junit-5/src/test/java/org/baeldung/java/parameterisedsource/ParameterizedUnitTest.java +++ b/testing-modules/junit-5/src/test/java/com/baeldung/junit5vstestng/ParameterizedUnitTest.java @@ -1,4 +1,4 @@ -package org.baeldung.java.parameterisedsource; +package com.baeldung.junit5vstestng; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertTrue; diff --git a/testing-modules/junit-5/src/test/java/org/baeldung/java/parameterisedsource/PizzaDeliveryStrategy.java b/testing-modules/junit-5/src/test/java/com/baeldung/junit5vstestng/PizzaDeliveryStrategy.java similarity index 57% rename from testing-modules/junit-5/src/test/java/org/baeldung/java/parameterisedsource/PizzaDeliveryStrategy.java rename to testing-modules/junit-5/src/test/java/com/baeldung/junit5vstestng/PizzaDeliveryStrategy.java index ecfc7b4627..7f0a0ffa20 100644 --- a/testing-modules/junit-5/src/test/java/org/baeldung/java/parameterisedsource/PizzaDeliveryStrategy.java +++ b/testing-modules/junit-5/src/test/java/com/baeldung/junit5vstestng/PizzaDeliveryStrategy.java @@ -1,4 +1,4 @@ -package org.baeldung.java.parameterisedsource; +package com.baeldung.junit5vstestng; public enum PizzaDeliveryStrategy { EXPRESS, diff --git a/testing-modules/junit-5/src/test/java/org/baeldung/java/suite/SelectClassesSuiteUnitTest.java b/testing-modules/junit-5/src/test/java/com/baeldung/junit5vstestng/SelectClassesSuiteUnitTest.java similarity index 63% rename from testing-modules/junit-5/src/test/java/org/baeldung/java/suite/SelectClassesSuiteUnitTest.java rename to testing-modules/junit-5/src/test/java/com/baeldung/junit5vstestng/SelectClassesSuiteUnitTest.java index 220897eae7..7b4bd746bf 100644 --- a/testing-modules/junit-5/src/test/java/org/baeldung/java/suite/SelectClassesSuiteUnitTest.java +++ b/testing-modules/junit-5/src/test/java/com/baeldung/junit5vstestng/SelectClassesSuiteUnitTest.java @@ -1,7 +1,5 @@ -package org.baeldung.java.suite; +package com.baeldung.junit5vstestng; -import org.baeldung.java.suite.childpackage1.Class1UnitTest; -import org.baeldung.java.suite.childpackage2.Class2UnitTest; import org.junit.platform.runner.JUnitPlatform; import org.junit.platform.suite.api.SelectClasses; import org.junit.runner.RunWith; diff --git a/testing-modules/junit-5/src/test/java/org/baeldung/java/suite/SelectPackagesSuiteUnitTest.java b/testing-modules/junit-5/src/test/java/com/baeldung/junit5vstestng/SelectPackagesSuiteUnitTest.java similarity index 89% rename from testing-modules/junit-5/src/test/java/org/baeldung/java/suite/SelectPackagesSuiteUnitTest.java rename to testing-modules/junit-5/src/test/java/com/baeldung/junit5vstestng/SelectPackagesSuiteUnitTest.java index ae887ae43b..8f2eb2b5c5 100644 --- a/testing-modules/junit-5/src/test/java/org/baeldung/java/suite/SelectPackagesSuiteUnitTest.java +++ b/testing-modules/junit-5/src/test/java/com/baeldung/junit5vstestng/SelectPackagesSuiteUnitTest.java @@ -1,4 +1,4 @@ -package org.baeldung.java.suite; +package com.baeldung.junit5vstestng; import org.junit.platform.runner.JUnitPlatform; import org.junit.platform.suite.api.SelectPackages; diff --git a/testing-modules/junit-5/src/test/java/com/baeldung/junit5vstestng/SummationServiceIntegrationTest.java b/testing-modules/junit-5/src/test/java/com/baeldung/junit5vstestng/SummationServiceUnitTest.java similarity index 96% rename from testing-modules/junit-5/src/test/java/com/baeldung/junit5vstestng/SummationServiceIntegrationTest.java rename to testing-modules/junit-5/src/test/java/com/baeldung/junit5vstestng/SummationServiceUnitTest.java index 92e7a6f5db..a8c02e9968 100644 --- a/testing-modules/junit-5/src/test/java/com/baeldung/junit5vstestng/SummationServiceIntegrationTest.java +++ b/testing-modules/junit-5/src/test/java/com/baeldung/junit5vstestng/SummationServiceUnitTest.java @@ -11,7 +11,7 @@ import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -public class SummationServiceIntegrationTest { +public class SummationServiceUnitTest { private static List numbers; @BeforeAll diff --git a/testing-modules/load-testing-comparison/pom.xml b/testing-modules/load-testing-comparison/pom.xml new file mode 100644 index 0000000000..42614d310b --- /dev/null +++ b/testing-modules/load-testing-comparison/pom.xml @@ -0,0 +1,149 @@ + + + 4.0.0 + load-testing-comparison + load-testing-comparison + + + parent-modules + com.baeldung + 1.0.0-SNAPSHOT + ../../pom.xml + + + + 1.8 + 1.8 + UTF-8 + 2.11.12 + 2.2.5 + 3.2.2 + 2.2.1 + 5.0 + 3.11 + 2.0.5.RELEASE + + + + + io.gatling + gatling-app + ${gatling.version} + + + io.gatling + gatling-recorder + ${gatling.version} + + + io.gatling.highcharts + gatling-charts-highcharts + ${gatling.version} + + + org.scala-lang + scala-library + ${scala.version} + + + + + + + + com.fasterxml.jackson.core + jackson-databind + 2.9.4 + + + org.springframework.boot + spring-boot-starter + ${spring.boot.version} + + + org.springframework.boot + spring-boot-starter-web + ${spring.boot.version} + + + org.springframework.boot + spring-boot-starter-data-jpa + ${spring.boot.version} + + + org.springframework.boot + spring-boot-starter-test + ${spring.boot.version} + test + + + com.h2database + h2 + 1.4.197 + + + org.projectlombok + lombok + 1.18.2 + compile + + + + + + + + + + + + + + + + + org.springframework.boot + spring-boot-maven-plugin + 2.0.5.RELEASE + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/spring-custom-aop/src/main/java/com/baeldung/webjar/WebjarsdemoApplication.java b/testing-modules/load-testing-comparison/src/main/java/com/baeldung/loadtesting/Application.java similarity index 59% rename from spring-custom-aop/src/main/java/com/baeldung/webjar/WebjarsdemoApplication.java rename to testing-modules/load-testing-comparison/src/main/java/com/baeldung/loadtesting/Application.java index 2397861f1d..6647bcb640 100644 --- a/spring-custom-aop/src/main/java/com/baeldung/webjar/WebjarsdemoApplication.java +++ b/testing-modules/load-testing-comparison/src/main/java/com/baeldung/loadtesting/Application.java @@ -1,12 +1,12 @@ -package com.baeldung.webjar; +package com.baeldung.loadtesting; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication -public class WebjarsdemoApplication { +public class Application { public static void main(String[] args) { - SpringApplication.run(WebjarsdemoApplication.class, args); + SpringApplication.run(Application.class, args); } } diff --git a/testing-modules/load-testing-comparison/src/main/java/com/baeldung/loadtesting/RewardsController.java b/testing-modules/load-testing-comparison/src/main/java/com/baeldung/loadtesting/RewardsController.java new file mode 100644 index 0000000000..50cc6fb7ab --- /dev/null +++ b/testing-modules/load-testing-comparison/src/main/java/com/baeldung/loadtesting/RewardsController.java @@ -0,0 +1,51 @@ +package com.baeldung.loadtesting; + +import com.baeldung.loadtesting.model.CustomerRewardsAccount; +import com.baeldung.loadtesting.model.Transaction; +import com.baeldung.loadtesting.repository.CustomerRewardsRepository; +import com.baeldung.loadtesting.repository.TransactionRepository; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import java.util.Calendar; +import java.util.List; +import java.util.Optional; + +@RestController +public class RewardsController { + + @Autowired + private CustomerRewardsRepository customerRewardsRepository; + + @Autowired + private TransactionRepository transactionRepository; + + @PostMapping(path="/transactions/add") + public @ResponseBody Transaction saveTransactions(@RequestBody Transaction trnsctn){ + trnsctn.setTransactionDate(Calendar.getInstance().getTime()); + Transaction result = transactionRepository.save(trnsctn); + return result; + } + + @GetMapping(path="/transactions/findAll/{rewardId}") + public @ResponseBody Iterable getTransactions(@PathVariable Integer rewardId){ + return transactionRepository.findByCustomerRewardsId(rewardId); + } + + @PostMapping(path="/rewards/add") + public @ResponseBody CustomerRewardsAccount addRewardsAcount(@RequestBody CustomerRewardsAccount body) { + Optional acct = customerRewardsRepository.findByCustomerId(body.getCustomerId()); + return !acct.isPresent() ? customerRewardsRepository.save(body) : acct.get(); + } + + @GetMapping(path="/rewards/find/{customerId}") + public @ResponseBody + Optional find(@PathVariable Integer customerId) { + return customerRewardsRepository.findByCustomerId(customerId); + } + + @GetMapping(path="/rewards/all") + public @ResponseBody List findAll() { + return customerRewardsRepository.findAll(); + } +} diff --git a/testing-modules/load-testing-comparison/src/main/java/com/baeldung/loadtesting/TransactionController.java b/testing-modules/load-testing-comparison/src/main/java/com/baeldung/loadtesting/TransactionController.java new file mode 100644 index 0000000000..2ea2c06a41 --- /dev/null +++ b/testing-modules/load-testing-comparison/src/main/java/com/baeldung/loadtesting/TransactionController.java @@ -0,0 +1,26 @@ +package com.baeldung.loadtesting; + +import com.baeldung.loadtesting.model.Transaction; +import com.baeldung.loadtesting.repository.TransactionRepository; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +@RestController +@Deprecated +public class TransactionController { + + @Autowired + private TransactionRepository transactionRepository; + + @PostMapping(path="/addTransaction") + public @ResponseBody + String saveTransactions(@RequestBody Transaction trnsctn){ + transactionRepository.save(trnsctn); + return "Saved Transaction."; + } + + @GetMapping(path="/findAll/{rewardId}") + public @ResponseBody Iterable getTransactions(@RequestParam Integer id){ + return transactionRepository.findByCustomerRewardsId(id); + } +} diff --git a/testing-modules/load-testing-comparison/src/main/java/com/baeldung/loadtesting/model/CustomerRewardsAccount.java b/testing-modules/load-testing-comparison/src/main/java/com/baeldung/loadtesting/model/CustomerRewardsAccount.java new file mode 100644 index 0000000000..2c6742fbaf --- /dev/null +++ b/testing-modules/load-testing-comparison/src/main/java/com/baeldung/loadtesting/model/CustomerRewardsAccount.java @@ -0,0 +1,22 @@ +package com.baeldung.loadtesting.model; + +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; + +import lombok.Data; + +@Entity +@Data +public class CustomerRewardsAccount { + + @Id + @GeneratedValue(strategy= GenerationType.AUTO) + private Integer id; + private Integer customerId; + + public Integer getCustomerId(){ + return this.customerId; + } +} diff --git a/testing-modules/load-testing-comparison/src/main/java/com/baeldung/loadtesting/model/Transaction.java b/testing-modules/load-testing-comparison/src/main/java/com/baeldung/loadtesting/model/Transaction.java new file mode 100644 index 0000000000..312f52f4ab --- /dev/null +++ b/testing-modules/load-testing-comparison/src/main/java/com/baeldung/loadtesting/model/Transaction.java @@ -0,0 +1,30 @@ +package com.baeldung.loadtesting.model; + +import lombok.Data; + +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import java.util.Date; +import java.util.Calendar; + +@Entity +@Data +public class Transaction { + + @Id + @GeneratedValue(strategy= GenerationType.AUTO) + private Integer id; + private Integer customerRewardsId; + private Integer customerId; + private Date transactionDate; + + public Transaction(){ + transactionDate = Calendar.getInstance().getTime(); + } + + public void setTransactionDate(Date transactionDate){ + this.transactionDate = transactionDate; + } +} diff --git a/testing-modules/load-testing-comparison/src/main/java/com/baeldung/loadtesting/repository/CustomerRewardsRepository.java b/testing-modules/load-testing-comparison/src/main/java/com/baeldung/loadtesting/repository/CustomerRewardsRepository.java new file mode 100644 index 0000000000..f945359eb8 --- /dev/null +++ b/testing-modules/load-testing-comparison/src/main/java/com/baeldung/loadtesting/repository/CustomerRewardsRepository.java @@ -0,0 +1,11 @@ +package com.baeldung.loadtesting.repository; + +import com.baeldung.loadtesting.model.CustomerRewardsAccount; +import org.springframework.data.jpa.repository.JpaRepository; + +import java.util.Optional; + +public interface CustomerRewardsRepository extends JpaRepository { + + Optional findByCustomerId(Integer customerId); +} diff --git a/testing-modules/load-testing-comparison/src/main/java/com/baeldung/loadtesting/repository/TransactionRepository.java b/testing-modules/load-testing-comparison/src/main/java/com/baeldung/loadtesting/repository/TransactionRepository.java new file mode 100644 index 0000000000..af0b343c10 --- /dev/null +++ b/testing-modules/load-testing-comparison/src/main/java/com/baeldung/loadtesting/repository/TransactionRepository.java @@ -0,0 +1,11 @@ +package com.baeldung.loadtesting.repository; + +import com.baeldung.loadtesting.model.Transaction; +import org.springframework.data.jpa.repository.JpaRepository; + +import java.util.List; + +public interface TransactionRepository extends JpaRepository { + + List findByCustomerRewardsId(Integer rewardsId); +} diff --git a/testing-modules/load-testing-comparison/src/main/resources/scripts/Gatling/GatlingScenario.scala b/testing-modules/load-testing-comparison/src/main/resources/scripts/Gatling/GatlingScenario.scala new file mode 100644 index 0000000000..f9b3837759 --- /dev/null +++ b/testing-modules/load-testing-comparison/src/main/resources/scripts/Gatling/GatlingScenario.scala @@ -0,0 +1,52 @@ +package com.baeldung + +import scala.util._ +import io.gatling.core.Predef._ +import io.gatling.http.Predef._ +import scala.concurrent.duration._ + +class RewardsScenario extends Simulation { + + def randCustId() = Random.nextInt(99) + + val httpProtocol = http.baseUrl("http://localhost:8080") + .acceptHeader("text/html,application/json;q=0.9,*/*;q=0.8") + .doNotTrackHeader("1") + .acceptLanguageHeader("en-US,en;q=0.5") + .acceptEncodingHeader("gzip, deflate") + .userAgentHeader("Mozilla/5.0 (Windows NT 5.1; rv:31.0) Gecko/20100101 Firefox/31.0") + + val scn = scenario("RewardsScenario") + .repeat(10){ + exec(http("transactions_add") + .post("/transactions/add/") + .body(StringBody("""{ "customerRewardsId":null,"customerId":""""+ randCustId() + """","transactionDate":null }""")).asJson + .check(jsonPath("$.id").saveAs("txnId")) + .check(jsonPath("$.transactionDate").saveAs("txtDate")) + .check(jsonPath("$.customerId").saveAs("custId"))) + .pause(1) + + .exec(http("get_reward") + .get("/rewards/find/${custId}") + .check(jsonPath("$.id").saveAs("rwdId"))) + .pause(1) + + .doIf("${rwdId.isUndefined()}"){ + exec(http("rewards_add") + .post("/rewards/add") + .body(StringBody("""{ "customerId": "${custId}" }""")).asJson + .check(jsonPath("$.id").saveAs("rwdId"))) + } + + .exec(http("transactions_add") + .post("/transactions/add/") + .body(StringBody("""{ "customerRewardsId":"${rwdId}","customerId":"${custId}","transactionDate":"${txtDate}" }""")).asJson) + .pause(1) + + .exec(http("get_reward") + .get("/transactions/findAll/${rwdId}")) + } + setUp( + scn.inject(atOnceUsers(100)) + ).protocols(httpProtocol) +} \ No newline at end of file diff --git a/testing-modules/load-testing-comparison/src/main/resources/scripts/JMeter/Test Plan.jmx b/testing-modules/load-testing-comparison/src/main/resources/scripts/JMeter/Test Plan.jmx new file mode 100644 index 0000000000..da32a13a22 --- /dev/null +++ b/testing-modules/load-testing-comparison/src/main/resources/scripts/JMeter/Test Plan.jmx @@ -0,0 +1,293 @@ + + + + + + false + true + false + + + + + + + + continue + + false + 10 + + 100 + 0 + false + + + + + + true + 1 + + + + + + Content-Type + application/json + + + + + + true + + + + false + {"customerRewardsId":null,"customerId":${random},"transactionDate":null} + = + + + + localhost + 8080 + http + + /transactions/add + POST + true + false + true + false + + + + + + + txnId + $.id + 1 + all + foo + + + + txnDate + $.transactionDate + 1 + Never + + + + custId + $.customerId + 1 + all + bob + + + + + + + + localhost + 8080 + + + /rewards/find/${custId} + GET + true + false + true + false + + + + + + + rwdId + $.id + 1 + 0 + all + + + + + ${rwdId} == 0 + true + + + + true + + + + false + {"customerId":${custId}} + = + + + + localhost + 8080 + + + /rewards/add + POST + true + false + true + false + + + + + + + rwdId + $.id + 1 + bar + all + + + + + + true + + + + false + {"id":${txnId},"customerRewardsId":${rwdId},"customerId":${custId},"transactionDate":"${txnDate}"} + = + + + + localhost + 8080 + + + /transactions/add + POST + true + false + true + false + + + + + + + + + + localhost + 8080 + + + /transactions/findAll/${rwdId} + GET + true + false + true + false + + + + + + + + 10000 + 1 + + false + 67 + random + + + + false + + saveConfig + + + true + true + true + + true + true + true + true + false + true + true + false + false + false + true + false + false + false + true + 0 + true + true + true + true + true + true + + + + + + + false + + saveConfig + + + true + true + true + + true + true + true + true + false + true + true + false + false + false + true + false + false + false + true + 0 + true + true + true + true + true + true + + + + + + + + + diff --git a/testing-modules/load-testing-comparison/src/main/resources/scripts/The Grinder/grinder.properties b/testing-modules/load-testing-comparison/src/main/resources/scripts/The Grinder/grinder.properties new file mode 100644 index 0000000000..68adf90856 --- /dev/null +++ b/testing-modules/load-testing-comparison/src/main/resources/scripts/The Grinder/grinder.properties @@ -0,0 +1,5 @@ +grinder.script = grinder.py +grinder.threads = 100 +grinder.processes = 1 +grinder.runs = 10 +grinder.logDirectory = /logs diff --git a/testing-modules/load-testing-comparison/src/main/resources/scripts/The Grinder/grinder.py b/testing-modules/load-testing-comparison/src/main/resources/scripts/The Grinder/grinder.py new file mode 100644 index 0000000000..025f90d38b --- /dev/null +++ b/testing-modules/load-testing-comparison/src/main/resources/scripts/The Grinder/grinder.py @@ -0,0 +1,40 @@ +import java.util.Random +from net.grinder.script import Test +from net.grinder.script.Grinder import grinder +from net.grinder.plugin.http import HTTPRequest, HTTPPluginControl, HTTPUtilities +from HTTPClient import NVPair + +def parseJsonString(json, element): + for x in json.split(","): + pc = x.replace('"','').split(":") + if pc[0].replace("{","") == element: + ele = pc[1].replace("}","") + return ele + else: + return "" + +test1 = Test(1, "Request resource") +request1 = HTTPRequest() +headers = \ +( NVPair('Content-Type', 'application/json'), ) +request1.setHeaders(headers) +utilities = HTTPPluginControl.getHTTPUtilities() +test1.record(request1) +random=java.util.Random() + +class TestRunner: + def __call__(self): + customerId = str(random.nextInt()); + + result = request1.POST("http://localhost:8080/transactions/add", "{"'"customerRewardsId"'":null,"'"customerId"'":"+ customerId + ","'"transactionDate"'":null}") + txnId = parseJsonString(result.getText(), "id") + + result = request1.GET("http://localhost:8080/rewards/find/"+ customerId) + rwdId = parseJsonString(result.getText(), "id") + + if rwdId == "": + result = request1.POST("http://localhost:8080/rewards/add", "{"'"customerId"'":"+ customerId + "}") + rwdId = parseJsonString(result.getText(), "id") + + result = request1.POST("http://localhost:8080/transactions/add", "{"'"id"'":" + txnId + ","'"customerRewardsId"'":" + rwdId + ","'"customerId"'":"+ customerId + ","'"transactionDate"'":null}") + result = request1.GET("http://localhost:8080/transactions/findAll/" + rwdId) \ No newline at end of file diff --git a/testing-modules/mockito-2/pom.xml b/testing-modules/mockito-2/pom.xml index cab4d7977b..5f60566566 100644 --- a/testing-modules/mockito-2/pom.xml +++ b/testing-modules/mockito-2/pom.xml @@ -5,7 +5,7 @@ mockito-2 0.0.1-SNAPSHOT jar - mockito-2-with-java8 + mockito-2 com.baeldung diff --git a/testing-modules/mockito/src/test/java/org/baeldung/mockito/FinalList.java b/testing-modules/mockito/src/test/java/org/baeldung/mockito/FinalList.java index 3824de619c..c41021f7b6 100644 --- a/testing-modules/mockito/src/test/java/org/baeldung/mockito/FinalList.java +++ b/testing-modules/mockito/src/test/java/org/baeldung/mockito/FinalList.java @@ -1,6 +1,6 @@ package org.baeldung.mockito; -public class FinalList extends MyList { +public final class FinalList extends MyList { @Override public int size() { diff --git a/testing-modules/mockserver/pom.xml b/testing-modules/mockserver/pom.xml index c2fa2870e2..1db409bd7c 100644 --- a/testing-modules/mockserver/pom.xml +++ b/testing-modules/mockserver/pom.xml @@ -5,7 +5,8 @@ com.baeldung mockserver 1.0.0-SNAPSHOT - + mockserver + com.baeldung parent-modules diff --git a/testing-modules/parallel-tests-junit/pom.xml b/testing-modules/parallel-tests-junit/pom.xml index 3fd4e695e5..ecca8b3930 100644 --- a/testing-modules/parallel-tests-junit/pom.xml +++ b/testing-modules/parallel-tests-junit/pom.xml @@ -5,6 +5,8 @@ parallel-tests-junit 0.0.1-SNAPSHOT pom + parallel-tests-junit + math-test-functions string-test-functions diff --git a/testing-modules/rest-assured/src/test/java/com/baeldung/restassured/Odd.java b/testing-modules/rest-assured/src/test/java/com/baeldung/restassured/Odd.java new file mode 100644 index 0000000000..f60f1764c6 --- /dev/null +++ b/testing-modules/rest-assured/src/test/java/com/baeldung/restassured/Odd.java @@ -0,0 +1,49 @@ +package com.baeldung.restassured; + +public class Odd { + + float price; + int status; + float ck; + String name; + + Odd(float price, int status, float ck, String name) { + this.price = price; + this.status = status; + this.ck = ck; + this.name = name; + } + + public float getPrice() { + return price; + } + + public void setPrice(float price) { + this.price = price; + } + + public int getStatus() { + return status; + } + + public void setStatus(int status) { + this.status = status; + } + + public float getCk() { + return ck; + } + + public void setCk(float ck) { + this.ck = ck; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + +} diff --git a/testing-modules/rest-assured/src/test/java/com/baeldung/restassured/RestAssured2IntegrationTest.java b/testing-modules/rest-assured/src/test/java/com/baeldung/restassured/RestAssured2IntegrationTest.java index 1b691414db..805d67271d 100644 --- a/testing-modules/rest-assured/src/test/java/com/baeldung/restassured/RestAssured2IntegrationTest.java +++ b/testing-modules/rest-assured/src/test/java/com/baeldung/restassured/RestAssured2IntegrationTest.java @@ -5,13 +5,15 @@ import io.restassured.RestAssured; import org.junit.AfterClass; import org.junit.BeforeClass; import org.junit.Test; - import static com.github.tomakehurst.wiremock.client.WireMock.aResponse; import static com.github.tomakehurst.wiremock.client.WireMock.configureFor; +import static com.github.tomakehurst.wiremock.client.WireMock.containing; import static com.github.tomakehurst.wiremock.client.WireMock.get; +import static com.github.tomakehurst.wiremock.client.WireMock.post; import static com.github.tomakehurst.wiremock.client.WireMock.stubFor; import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo; import static io.restassured.RestAssured.get; +import static io.restassured.RestAssured.with; import static org.hamcrest.Matchers.hasItems; public class RestAssured2IntegrationTest { @@ -32,6 +34,9 @@ public class RestAssured2IntegrationTest { aResponse().withStatus(200) .withHeader("Content-Type", APPLICATION_JSON) .withBody(ODDS))); + stubFor(post(urlEqualTo("/odds/new")) + .withRequestBody(containing("{\"price\":5.25,\"status\":1,\"ck\":13.1,\"name\":\"X\"}")) + .willReturn(aResponse().withStatus(201))); } @Test @@ -40,6 +45,15 @@ public class RestAssured2IntegrationTest { hasItems(5.25f, 1.2f)); } + @Test + public void whenRequestedPost_thenCreated() { + with().body(new Odd(5.25f, 1, 13.1f, "X")) + .when() + .request("POST", "/odds/new") + .then() + .statusCode(201); + } + private static String getJson() { return Util.inputStreamToString(RestAssured2IntegrationTest.class .getResourceAsStream("/odds.json")); diff --git a/testing-modules/selenium-junit-testng/pom.xml b/testing-modules/selenium-junit-testng/pom.xml index e22f7421cf..ae15fc97c0 100644 --- a/testing-modules/selenium-junit-testng/pom.xml +++ b/testing-modules/selenium-junit-testng/pom.xml @@ -4,7 +4,8 @@ com.baeldung selenium-junit-testng 0.0.1-SNAPSHOT - + selenium-junit-testng + com.baeldung parent-modules diff --git a/testing-modules/spring-testing/README.md b/testing-modules/spring-testing/README.md index e22c3e84e7..02ab7b24bd 100644 --- a/testing-modules/spring-testing/README.md +++ b/testing-modules/spring-testing/README.md @@ -2,3 +2,4 @@ - [Mockito.mock() vs @Mock vs @MockBean](http://www.baeldung.com/java-spring-mockito-mock-mockbean) - [A Quick Guide to @TestPropertySource](https://www.baeldung.com/spring-test-property-source) +- [Guide to ReflectionTestUtils for Unit Testing](https://www.baeldung.com/spring-reflection-test-utils) diff --git a/testing-modules/spring-testing/src/main/java/org/baeldung/reflectiontestutils/repository/Employee.java b/testing-modules/spring-testing/src/main/java/org/baeldung/reflectiontestutils/repository/Employee.java new file mode 100644 index 0000000000..0677b05d66 --- /dev/null +++ b/testing-modules/spring-testing/src/main/java/org/baeldung/reflectiontestutils/repository/Employee.java @@ -0,0 +1,23 @@ +package org.baeldung.reflectiontestutils.repository; + +public class Employee { + private Integer id; + private String name; + + public Integer getId() { + return id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + private String employeeToString() { + return "id: " + getId() + "; name: " + getName(); + } + +} diff --git a/testing-modules/spring-testing/src/main/java/org/baeldung/reflectiontestutils/repository/EmployeeService.java b/testing-modules/spring-testing/src/main/java/org/baeldung/reflectiontestutils/repository/EmployeeService.java new file mode 100644 index 0000000000..699ec3236c --- /dev/null +++ b/testing-modules/spring-testing/src/main/java/org/baeldung/reflectiontestutils/repository/EmployeeService.java @@ -0,0 +1,14 @@ +package org.baeldung.reflectiontestutils.repository; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +@Component +public class EmployeeService { + @Autowired + private HRService hrService; + + public String findEmployeeStatus(Integer employeeId) { + return "Employee " + employeeId + " status: " + hrService.getEmployeeStatus(employeeId); + } +} diff --git a/testing-modules/spring-testing/src/main/java/org/baeldung/reflectiontestutils/repository/HRService.java b/testing-modules/spring-testing/src/main/java/org/baeldung/reflectiontestutils/repository/HRService.java new file mode 100644 index 0000000000..e693aca764 --- /dev/null +++ b/testing-modules/spring-testing/src/main/java/org/baeldung/reflectiontestutils/repository/HRService.java @@ -0,0 +1,11 @@ +package org.baeldung.reflectiontestutils.repository; + +import org.springframework.stereotype.Component; + +@Component +public class HRService { + + public String getEmployeeStatus(Integer employeeId) { + return "Inactive"; + } +} diff --git a/testing-modules/spring-testing/src/test/java/org/baeldung/reflectiontestutils/ReflectionTestUtilsUnitTest.java b/testing-modules/spring-testing/src/test/java/org/baeldung/reflectiontestutils/ReflectionTestUtilsUnitTest.java new file mode 100644 index 0000000000..64c7ca19ef --- /dev/null +++ b/testing-modules/spring-testing/src/test/java/org/baeldung/reflectiontestutils/ReflectionTestUtilsUnitTest.java @@ -0,0 +1,46 @@ +package org.baeldung.reflectiontestutils; + +import static org.junit.Assert.*; +import static org.mockito.Mockito.mock; + +import org.baeldung.reflectiontestutils.repository.Employee; +import org.baeldung.reflectiontestutils.repository.EmployeeService; +import org.baeldung.reflectiontestutils.repository.HRService; +import org.junit.Test; +import org.springframework.test.util.ReflectionTestUtils; + +import static org.mockito.Mockito.when; + +public class ReflectionTestUtilsUnitTest { + + @Test + public void whenNonPublicField_thenReflectionTestUtilsSetField() { + Employee employee = new Employee(); + ReflectionTestUtils.setField(employee, "id", 1); + assertTrue(employee.getId().equals(1)); + + } + + @Test + public void whenNonPublicMethod_thenReflectionTestUtilsInvokeMethod() { + Employee employee = new Employee(); + ReflectionTestUtils.setField(employee, "id", 1); + employee.setName("Smith, John"); + assertTrue(ReflectionTestUtils.invokeMethod(employee, "employeeToString").equals("id: 1; name: Smith, John")); + } + + @Test + public void whenInjectingMockOfDependency_thenReflectionTestUtilsSetField() { + Employee employee = new Employee(); + ReflectionTestUtils.setField(employee, "id", 1); + employee.setName("Smith, John"); + + HRService hrService = mock(HRService.class); + when(hrService.getEmployeeStatus(employee.getId())).thenReturn("Active"); + EmployeeService employeeService = new EmployeeService(); + + // Inject mock into the private field + ReflectionTestUtils.setField(employeeService, "hrService", hrService); + assertEquals("Employee " + employee.getId() + " status: Active", employeeService.findEmployeeStatus(employee.getId())); + } +} diff --git a/testing-modules/testng/README.md b/testing-modules/testng/README.md index e54ee1dbf2..a7e0e29d62 100644 --- a/testing-modules/testng/README.md +++ b/testing-modules/testng/README.md @@ -2,3 +2,4 @@ - [Introduction to TestNG](http://www.baeldung.com/testng) - [Custom Reporting with TestNG](http://www.baeldung.com/testng-custom-reporting) +- [A Quick JUnit vs TestNG Comparison](https://www.baeldung.com/junit-vs-testng) diff --git a/twilio/pom.xml b/twilio/pom.xml index 610cc04b60..81fbf8ab20 100644 --- a/twilio/pom.xml +++ b/twilio/pom.xml @@ -4,7 +4,8 @@ 4.0.0 twilio 1.0-SNAPSHOT - + twilio + parent-modules com.baeldung diff --git a/vaadin/pom.xml b/vaadin/pom.xml index c34ffa3636..1111c0aa0c 100644 --- a/vaadin/pom.xml +++ b/vaadin/pom.xml @@ -10,10 +10,10 @@ Vaadin - parent-boot-2 + parent-boot-2.0-temp com.baeldung 0.0.1-SNAPSHOT - ../parent-boot-2 + ../parent-boot-2.0-temp diff --git a/vavr/pom.xml b/vavr/pom.xml index ae495e9830..fa8eff1ce7 100644 --- a/vavr/pom.xml +++ b/vavr/pom.xml @@ -7,10 +7,10 @@ vavr - parent-boot-2 + parent-boot-2.0-temp com.baeldung 0.0.1-SNAPSHOT - ../parent-boot-2 + ../parent-boot-2.0-temp diff --git a/vertx-and-rxjava/pom.xml b/vertx-and-rxjava/pom.xml index cbc94dd8f1..389eaf687b 100644 --- a/vertx-and-rxjava/pom.xml +++ b/vertx-and-rxjava/pom.xml @@ -3,7 +3,8 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 vertx-and-rxjava - + vertx-and-rxjava + com.baeldung parent-modules diff --git a/video-tutorials/jackson-annotations/pom.xml b/video-tutorials/jackson-annotations/pom.xml index 748721b83c..121609ad4d 100644 --- a/video-tutorials/jackson-annotations/pom.xml +++ b/video-tutorials/jackson-annotations/pom.xml @@ -1,11 +1,10 @@ 4.0.0 - com.baeldung jackson-annotations 1.0.0-SNAPSHOT - jacksonannotation + jackson-annotations com.baeldung diff --git a/vraptor/pom.xml b/vraptor/pom.xml index ae43d8e083..97005bd158 100644 --- a/vraptor/pom.xml +++ b/vraptor/pom.xml @@ -1,11 +1,11 @@ 4.0.0 - com.baeldung vraptor 1.0.0 war + vraptor A demo project to start using VRaptor 4 diff --git a/xml/README.md b/xml/README.md index 80c6a069f0..fb070100db 100644 --- a/xml/README.md +++ b/xml/README.md @@ -3,3 +3,4 @@ - [Introduction to JiBX](http://www.baeldung.com/jibx) - [XML Libraries Support in Java](http://www.baeldung.com/java-xml-libraries) - [DOM parsing with Xerces](http://www.baeldung.com/java-xerces-dom-parsing) +- [Write an org.w3.dom.Document to a File](https://www.baeldung.com/java-write-xml-document-file) diff --git a/xmlunit-2/pom.xml b/xmlunit-2/pom.xml index 806ebb6c0e..faefeca7a1 100644 --- a/xmlunit-2/pom.xml +++ b/xmlunit-2/pom.xml @@ -4,6 +4,7 @@ com.baeldung xmlunit-2 1.0 + xmlunit-2 com.baeldung