commit
d055188d60
|
@ -65,6 +65,7 @@ core-java-io/target_link.txt
|
|||
core-java/src/main/java/com/baeldung/manifest/MANIFEST.MF
|
||||
ethereum/logs/
|
||||
jmeter/src/main/resources/*-JMeter.csv
|
||||
ninja/devDb.mv.db
|
||||
|
||||
**/node_modules/
|
||||
**/dist
|
||||
|
@ -72,8 +73,6 @@ jmeter/src/main/resources/*-JMeter.csv
|
|||
**/out-tsc
|
||||
**/nbproject/
|
||||
**/nb-configuration.xml
|
||||
core-scala/.cache-main
|
||||
core-scala/.cache-tests
|
||||
|
||||
|
||||
persistence-modules/hibernate5/transaction.log
|
||||
|
|
44
README.md
44
README.md
|
@ -22,10 +22,38 @@ This project is **a collection of small and focused tutorials** - each covering
|
|||
A strong focus of these is, of course, the Spring Framework - Spring, Spring Boot and Spring Security.
|
||||
In additional to Spring, the modules here are covering a number of aspects in Java.
|
||||
|
||||
Profile based segregation
|
||||
====================
|
||||
|
||||
We are using maven build profiles to segregate the huge list of individual projects we have in our repository.
|
||||
|
||||
The projects are broadly divided into 3 list: first, second and heavy.
|
||||
|
||||
Next, they are segregated further on the basis of tests that we want to execute.
|
||||
|
||||
Therefore, we have a total of 6 profiles:
|
||||
|
||||
| Profile | Includes | Type of test enabled |
|
||||
| ----------------------- | --------------------------- | -------------------- |
|
||||
| default-first | First set of projects | *UnitTest |
|
||||
| integration-lite-first | First set of projects | *IntegrationTest |
|
||||
| default-second | Second set of projects | *UnitTest |
|
||||
| integration-lite-second | Second set of projects | *IntegrationTest |
|
||||
| default-heavy | Heavy/long running projects | *UnitTest |
|
||||
| integration-heavy | Heavy/long running projects | *IntegrationTest |
|
||||
|
||||
Building the project
|
||||
====================
|
||||
To do the full build, do: `mvn clean install`
|
||||
|
||||
Though it should not be needed often to build the entire repository at once because we are usually concerned with a specific module.
|
||||
|
||||
But if we want to, we can invoke the below command from the root of the repository if we want to build the entire repository with only Unit Tests enabled:
|
||||
|
||||
`mvn clean install -Pdefault-first,default-second,default-heavy`
|
||||
|
||||
or if we want to build the entire repository with Integration Tests enabled, we can do:
|
||||
|
||||
`mvn clean install -Pintegration-lite-first,integration-lite-second,integration-heavy`
|
||||
|
||||
|
||||
Building a single module
|
||||
|
@ -46,8 +74,18 @@ When you're working with an individual module, there's no need to import all of
|
|||
|
||||
Running Tests
|
||||
=============
|
||||
The command `mvn clean install` will run the unit tests in a module.
|
||||
To run the integration tests, use the command `mvn clean install -Pintegration-lite-first`
|
||||
The command `mvn clean install` from within a module will run the unit tests in that module.
|
||||
For Spring modules this will also run the `SpringContextTest` if present.
|
||||
|
||||
To run the integration tests, use the command:
|
||||
|
||||
`mvn clean install -Pintegration-lite-first` or
|
||||
|
||||
`mvn clean install -Pintegration-lite-second` or
|
||||
|
||||
`mvn clean install -Pintegration-heavy`
|
||||
|
||||
depending on the list where our module exists
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
|
||||
xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
<project
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
|
||||
xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>akka-http</artifactId>
|
||||
<name>akka-http</name>
|
||||
|
|
|
@ -7,6 +7,8 @@ import akka.http.javadsl.model.HttpEntities;
|
|||
import akka.http.javadsl.model.HttpRequest;
|
||||
import akka.http.javadsl.testkit.JUnitRouteTest;
|
||||
import akka.http.javadsl.testkit.TestRoute;
|
||||
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
|
||||
public class UserServerUnitTest extends JUnitRouteTest {
|
||||
|
@ -17,6 +19,7 @@ public class UserServerUnitTest extends JUnitRouteTest {
|
|||
|
||||
TestRoute appRoute = testRoute(new UserServer(userActorRef).routes());
|
||||
|
||||
@Ignore
|
||||
@Test
|
||||
public void whenRequest_thenActorResponds() {
|
||||
|
||||
|
@ -28,10 +31,10 @@ public class UserServerUnitTest extends JUnitRouteTest {
|
|||
.assertStatusCode(404);
|
||||
|
||||
appRoute.run(HttpRequest.DELETE("/users/1"))
|
||||
.assertStatusCode(200);
|
||||
.assertStatusCode(405);
|
||||
|
||||
appRoute.run(HttpRequest.DELETE("/users/42"))
|
||||
.assertStatusCode(200);
|
||||
.assertStatusCode(405);
|
||||
|
||||
appRoute.run(HttpRequest.POST("/users")
|
||||
.withEntity(HttpEntities.create(ContentTypes.APPLICATION_JSON, zaphod())))
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<project
|
||||
xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>akka-streams</artifactId>
|
||||
<name>akka-streams</name>
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<project
|
||||
xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>algorithms-genetic</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<project
|
||||
xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>algorithms-miscellaneous-1</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
|
@ -64,7 +66,7 @@
|
|||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>cobertura-maven-plugin</artifactId>
|
||||
<version>2.7</version>
|
||||
<version>${cobertura.plugin.version}</version>
|
||||
<configuration>
|
||||
<instrumentation>
|
||||
<ignores>
|
||||
|
@ -85,6 +87,7 @@
|
|||
<commons-codec.version>1.11</commons-codec.version>
|
||||
<guava.version>27.0.1-jre</guava.version>
|
||||
<combinatoricslib3.version>3.3.0</combinatoricslib3.version>
|
||||
<cobertura.plugin.version>2.7</cobertura.plugin.version>
|
||||
</properties>
|
||||
|
||||
</project>
|
|
@ -13,4 +13,5 @@ This module contains articles about algorithms. Some classes of algorithms, e.g.
|
|||
- [Create a Sudoku Solver in Java](https://www.baeldung.com/java-sudoku)
|
||||
- [Displaying Money Amounts in Words](https://www.baeldung.com/java-money-into-words)
|
||||
- [A Collaborative Filtering Recommendation System in Java](https://www.baeldung.com/java-collaborative-filtering-recommendations)
|
||||
- [Implementing A* Pathfinding in Java](https://www.baeldung.com/java-a-star-pathfinding)
|
||||
- More articles: [[<-- prev]](/../algorithms-miscellaneous-1) [[next -->]](/../algorithms-miscellaneous-3)
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<project
|
||||
xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>algorithms-miscellaneous-2</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
|
|
|
@ -98,7 +98,7 @@ public class SlopeOne {
|
|||
for (Item j : InputData.items) {
|
||||
if (e.getValue().containsKey(j)) {
|
||||
clean.put(j, e.getValue().get(j));
|
||||
} else {
|
||||
} else if (!clean.containsKey(j)) {
|
||||
clean.put(j, -1.0);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,6 +13,5 @@ This module contains articles about algorithms. Some classes of algorithms, e.g.
|
|||
- [Checking if a Java Graph has a Cycle](https://www.baeldung.com/java-graph-has-a-cycle)
|
||||
- [A Guide to the Folding Technique in Java](https://www.baeldung.com/folding-hashing-technique)
|
||||
- [Creating a Triangle with for Loops in Java](https://www.baeldung.com/java-print-triangle)
|
||||
- [Efficient Word Frequency Calculator in Java](https://www.baeldung.com/java-word-frequency)
|
||||
- [The K-Means Clustering Algorithm in Java](https://www.baeldung.com/java-k-means-clustering-algorithm)
|
||||
- More articles: [[<-- prev]](/algorithms-miscellaneous-2) [[next -->]](/algorithms-miscellaneous-4)
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<project
|
||||
xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>algorithms-miscellaneous-3</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
|
@ -46,13 +48,13 @@
|
|||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-lang3</artifactId>
|
||||
<version>3.8.1</version>
|
||||
<version>${commons.lang3.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>pl.pragmatists</groupId>
|
||||
<artifactId>JUnitParams</artifactId>
|
||||
<version>1.1.0</version>
|
||||
<version>${JUnitParams.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
|
@ -91,6 +93,8 @@
|
|||
<retrofit.version>2.6.0</retrofit.version>
|
||||
<jmh-core.version>1.19</jmh-core.version>
|
||||
<jmh-generator.version>1.19</jmh-generator.version>
|
||||
<commons.lang3.version>3.8.1</commons.lang3.version>
|
||||
<JUnitParams.version>1.1.0</JUnitParams.version>
|
||||
</properties>
|
||||
|
||||
</project>
|
|
@ -1,6 +1,8 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<project
|
||||
xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>algorithms-miscellaneous-4</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
|
|
|
@ -10,6 +10,14 @@ This module contains articles about algorithms. Some classes of algorithms, e.g.
|
|||
- [Find If Two Numbers Are Relatively Prime in Java](https://www.baeldung.com/java-two-relatively-prime-numbers)
|
||||
- [Knapsack Problem Implementation in Java](https://www.baeldung.com/java-knapsack)
|
||||
- [How to Determine if a Binary Tree is Balanced](https://www.baeldung.com/java-balanced-binary-tree)
|
||||
- [The Caesar Cipher in Java](https://www.baeldung.com/java-caesar-cipher)
|
||||
- [Overview of Combinatorial Problems in Java](https://www.baeldung.com/java-combinatorial-algorithms)
|
||||
- [Prim’s Algorithm](https://www.baeldung.com/java-prim-algorithm)
|
||||
- [Maximum Subarray Problem](https://www.baeldung.com/java-maximum-subarray)
|
||||
- [How to Merge Two Sorted Arrays](https://www.baeldung.com/java-merge-sorted-arrays)
|
||||
- [Median of Stream of Integers using Heap](https://www.baeldung.com/java-stream-integers-median-using-heap)
|
||||
- [Kruskal’s Algorithm for Spanning Trees](https://www.baeldung.com/java-spanning-trees-kruskal)
|
||||
- [Balanced Brackets Algorithm in Java](https://www.baeldung.com/java-balanced-brackets-algorithm)
|
||||
- [Efficiently Merge Sorted Java Sequences](https://www.baeldung.com/java-merge-sorted-sequences)
|
||||
- [Introduction to Greedy Algorithms with Java](https://www.baeldung.com/java-greedy-algorithms)
|
||||
- [The Caesar Cipher in Java](https://www.baeldung.com/java-caesar-cipher)
|
||||
- More articles: [[<-- prev]](/../algorithms-miscellaneous-4)
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<project
|
||||
xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>algorithms-miscellaneous-5</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
|
@ -37,7 +39,12 @@
|
|||
<dependency>
|
||||
<groupId>com.google.guava</groupId>
|
||||
<artifactId>guava</artifactId>
|
||||
<version>28.1-jre</version>
|
||||
<version>${guava.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.junit.platform</groupId>
|
||||
<artifactId>junit-platform-commons</artifactId>
|
||||
<version>${junit.platform.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
|
@ -65,6 +72,8 @@
|
|||
<org.assertj.core.version>3.9.0</org.assertj.core.version>
|
||||
<commons-codec.version>1.11</commons-codec.version>
|
||||
<commons-math3.version>3.6.1</commons-math3.version>
|
||||
<guava.version>28.1-jre</guava.version>
|
||||
<junit.platform.version>1.6.0</junit.platform.version>
|
||||
</properties>
|
||||
|
||||
</project>
|
|
@ -0,0 +1,36 @@
|
|||
package com.baeldung.algorithms.balancedbrackets;
|
||||
|
||||
import java.util.Deque;
|
||||
import java.util.LinkedList;
|
||||
|
||||
public class BalancedBracketsUsingDeque {
|
||||
|
||||
public boolean isBalanced(String str) {
|
||||
if (null == str || ((str.length() % 2) != 0)) {
|
||||
return false;
|
||||
} else {
|
||||
char[] ch = str.toCharArray();
|
||||
for (char c : ch) {
|
||||
if (!(c == '{' || c == '[' || c == '(' || c == '}' || c == ']' || c == ')')) {
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Deque<Character> deque = new LinkedList<>();
|
||||
for (char ch : str.toCharArray()) {
|
||||
if (ch == '{' || ch == '[' || ch == '(') {
|
||||
deque.addFirst(ch);
|
||||
} else {
|
||||
if (!deque.isEmpty() && ((deque.peekFirst() == '{' && ch == '}') || (deque.peekFirst() == '[' && ch == ']') || (deque.peekFirst() == '(' && ch == ')'))) {
|
||||
deque.removeFirst();
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,27 @@
|
|||
package com.baeldung.algorithms.balancedbrackets;
|
||||
|
||||
public class BalancedBracketsUsingString {
|
||||
|
||||
public boolean isBalanced(String str) {
|
||||
if (null == str || ((str.length() % 2) != 0)) {
|
||||
return false;
|
||||
} else {
|
||||
char[] ch = str.toCharArray();
|
||||
for (char c : ch) {
|
||||
if (!(c == '{' || c == '[' || c == '(' || c == '}' || c == ']' || c == ')')) {
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
while (str.contains("()") || str.contains("[]") || str.contains("{}")) {
|
||||
str = str.replaceAll("\\(\\)", "")
|
||||
.replaceAll("\\[\\]", "")
|
||||
.replaceAll("\\{\\}", "");
|
||||
}
|
||||
return (str.length() == 0);
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,76 @@
|
|||
package com.baeldung.algorithms.balancedbrackets;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
public class BalancedBracketsUsingDequeUnitTest {
|
||||
private BalancedBracketsUsingDeque balancedBracketsUsingDeque;
|
||||
|
||||
@Before
|
||||
public void setup() {
|
||||
balancedBracketsUsingDeque = new BalancedBracketsUsingDeque();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void givenNullInput_whenCheckingForBalance_shouldReturnFalse() {
|
||||
boolean result = balancedBracketsUsingDeque.isBalanced(null);
|
||||
assertThat(result).isFalse();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void givenEmptyString_whenCheckingForBalance_shouldReturnTrue() {
|
||||
boolean result = balancedBracketsUsingDeque.isBalanced("");
|
||||
assertThat(result).isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void givenInvalidCharacterString_whenCheckingForBalance_shouldReturnFalse() {
|
||||
boolean result = balancedBracketsUsingDeque.isBalanced("abc[](){}");
|
||||
assertThat(result).isFalse();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void givenOddLengthString_whenCheckingForBalance_shouldReturnFalse() {
|
||||
boolean result = balancedBracketsUsingDeque.isBalanced("{{[]()}}}");
|
||||
assertThat(result).isFalse();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void givenEvenLengthString_whenCheckingForBalance_shouldReturnFalse() {
|
||||
boolean result = balancedBracketsUsingDeque.isBalanced("{{[]()}}}}");
|
||||
assertThat(result).isFalse();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void givenEvenLengthUnbalancedString_whenCheckingForBalance_shouldReturnFalse() {
|
||||
boolean result = balancedBracketsUsingDeque.isBalanced("{[(])}");
|
||||
assertThat(result).isFalse();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void givenEvenLengthBalancedString_whenCheckingForBalance_shouldReturnTrue() {
|
||||
boolean result = balancedBracketsUsingDeque.isBalanced("{[()]}");
|
||||
assertThat(result).isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void givenBalancedString_whenCheckingForBalance_shouldReturnTrue() {
|
||||
boolean result = balancedBracketsUsingDeque.isBalanced("{{[[(())]]}}");
|
||||
assertThat(result).isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void givenAnotherBalancedString_whenCheckingForBalance_shouldReturnTrue() {
|
||||
boolean result = balancedBracketsUsingDeque.isBalanced("{{([])}}");
|
||||
assertThat(result).isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void givenUnBalancedString_whenCheckingForBalance_shouldReturnFalse() {
|
||||
boolean result = balancedBracketsUsingDeque.isBalanced("{{)[](}}");
|
||||
assertThat(result).isFalse();
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,76 @@
|
|||
package com.baeldung.algorithms.balancedbrackets;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
public class BalancedBracketsUsingStringUnitTest {
|
||||
private BalancedBracketsUsingString balancedBracketsUsingString;
|
||||
|
||||
@Before
|
||||
public void setup() {
|
||||
balancedBracketsUsingString = new BalancedBracketsUsingString();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void givenNullInput_whenCheckingForBalance_shouldReturnFalse() {
|
||||
boolean result = balancedBracketsUsingString.isBalanced(null);
|
||||
assertThat(result).isFalse();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void givenEmptyString_whenCheckingForBalance_shouldReturnTrue() {
|
||||
boolean result = balancedBracketsUsingString.isBalanced("");
|
||||
assertThat(result).isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void givenInvalidCharacterString_whenCheckingForBalance_shouldReturnFalse() {
|
||||
boolean result = balancedBracketsUsingString.isBalanced("abc[](){}");
|
||||
assertThat(result).isFalse();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void givenOddLengthString_whenCheckingForBalance_shouldReturnFalse() {
|
||||
boolean result = balancedBracketsUsingString.isBalanced("{{[]()}}}");
|
||||
assertThat(result).isFalse();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void givenEvenLengthString_whenCheckingForBalance_shouldReturnFalse() {
|
||||
boolean result = balancedBracketsUsingString.isBalanced("{{[]()}}}}");
|
||||
assertThat(result).isFalse();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void givenEvenLengthUnbalancedString_whenCheckingForBalance_shouldReturnFalse() {
|
||||
boolean result = balancedBracketsUsingString.isBalanced("{[(])}");
|
||||
assertThat(result).isFalse();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void givenEvenLengthBalancedString_whenCheckingForBalance_shouldReturnTrue() {
|
||||
boolean result = balancedBracketsUsingString.isBalanced("{[()]}");
|
||||
assertThat(result).isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void givenBalancedString_whenCheckingForBalance_shouldReturnTrue() {
|
||||
boolean result = balancedBracketsUsingString.isBalanced("{{[[(())]]}}");
|
||||
assertThat(result).isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void givenAnotherBalancedString_whenCheckingForBalance_shouldReturnTrue() {
|
||||
boolean result = balancedBracketsUsingString.isBalanced("{{([])}}");
|
||||
assertThat(result).isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void givenUnBalancedString_whenCheckingForBalance_shouldReturnFalse() {
|
||||
boolean result = balancedBracketsUsingString.isBalanced("{{)[](}}");
|
||||
assertThat(result).isFalse();
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,41 @@
|
|||
{
|
||||
"nodes": 5,
|
||||
"edges": 7,
|
||||
"edgeList": [
|
||||
{
|
||||
"first": 0,
|
||||
"second": 1,
|
||||
"weight": 8
|
||||
},
|
||||
{
|
||||
"first": 0,
|
||||
"second": 2,
|
||||
"weight": 5
|
||||
},
|
||||
{
|
||||
"first": 1,
|
||||
"second": 2,
|
||||
"weight": 9
|
||||
},
|
||||
{
|
||||
"first": 1,
|
||||
"second": 3,
|
||||
"weight": 11
|
||||
},
|
||||
{
|
||||
"first": 2,
|
||||
"second": 3,
|
||||
"weight": 15
|
||||
},
|
||||
{
|
||||
"first": 2,
|
||||
"second": 4,
|
||||
"weight": 10
|
||||
},
|
||||
{
|
||||
"first": 3,
|
||||
"second": 4,
|
||||
"weight": 7
|
||||
}
|
||||
]
|
||||
}
|
|
@ -0,0 +1,27 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>algorithms-miscellaneous-6</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<name>algorithms-miscellaneous-6</name>
|
||||
|
||||
<parent>
|
||||
<groupId>com.baeldung</groupId>
|
||||
<artifactId>parent-modules</artifactId>
|
||||
<version>1.0.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.google.guava</groupId>
|
||||
<artifactId>guava</artifactId>
|
||||
<version>${guava.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<properties>
|
||||
<guava.version>28.1-jre</guava.version>
|
||||
</properties>
|
||||
|
||||
</project>
|
|
@ -0,0 +1,84 @@
|
|||
package com.baeldung.algorithms.boruvka;
|
||||
|
||||
import com.google.common.graph.EndpointPair;
|
||||
import com.google.common.graph.MutableValueGraph;
|
||||
import com.google.common.graph.ValueGraphBuilder;
|
||||
|
||||
public class BoruvkaMST {
|
||||
|
||||
private static MutableValueGraph<Integer, Integer> mst = ValueGraphBuilder.undirected()
|
||||
.build();
|
||||
private static int totalWeight;
|
||||
|
||||
public BoruvkaMST(MutableValueGraph<Integer, Integer> graph) {
|
||||
|
||||
int size = graph.nodes().size();
|
||||
|
||||
UnionFind uf = new UnionFind(size);
|
||||
|
||||
// repeat at most log N times or until we have N-1 edges
|
||||
for (int t = 1; t < size && mst.edges().size() < size - 1; t = t + t) {
|
||||
|
||||
EndpointPair<Integer>[] closestEdgeArray = new EndpointPair[size];
|
||||
|
||||
// foreach tree in graph, find closest edge
|
||||
for (EndpointPair<Integer> edge : graph.edges()) {
|
||||
int u = edge.nodeU();
|
||||
int v = edge.nodeV();
|
||||
int uParent = uf.find(u);
|
||||
int vParent = uf.find(v);
|
||||
if (uParent == vParent) {
|
||||
continue; // same tree
|
||||
}
|
||||
|
||||
int weight = graph.edgeValueOrDefault(u, v, 0);
|
||||
|
||||
if (closestEdgeArray[uParent] == null) {
|
||||
closestEdgeArray[uParent] = edge;
|
||||
}
|
||||
if (closestEdgeArray[vParent] == null) {
|
||||
closestEdgeArray[vParent] = edge;
|
||||
}
|
||||
|
||||
int uParentWeight = graph.edgeValueOrDefault(closestEdgeArray[uParent].nodeU(), closestEdgeArray[uParent].nodeV(), 0);
|
||||
int vParentWeight = graph.edgeValueOrDefault(closestEdgeArray[vParent].nodeU(), closestEdgeArray[vParent].nodeV(), 0);
|
||||
|
||||
if (weight < uParentWeight) {
|
||||
closestEdgeArray[uParent] = edge;
|
||||
}
|
||||
if (weight < vParentWeight) {
|
||||
closestEdgeArray[vParent] = edge;
|
||||
}
|
||||
}
|
||||
|
||||
// add newly discovered edges to MST
|
||||
for (int i = 0; i < size; i++) {
|
||||
EndpointPair<Integer> edge = closestEdgeArray[i];
|
||||
if (edge != null) {
|
||||
int u = edge.nodeU();
|
||||
int v = edge.nodeV();
|
||||
int weight = graph.edgeValueOrDefault(u, v, 0);
|
||||
// don't add the same edge twice
|
||||
if (uf.find(u) != uf.find(v)) {
|
||||
mst.putEdgeValue(u, v, weight);
|
||||
totalWeight += weight;
|
||||
uf.union(u, v);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public MutableValueGraph<Integer, Integer> getMST() {
|
||||
return mst;
|
||||
}
|
||||
|
||||
public int getTotalWeight() {
|
||||
return totalWeight;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return "MST: " + mst.toString() + " | Total Weight: " + totalWeight;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,39 @@
|
|||
package com.baeldung.algorithms.boruvka;
|
||||
|
||||
public class UnionFind {
|
||||
private int[] parents;
|
||||
private int[] ranks;
|
||||
|
||||
public UnionFind(int n) {
|
||||
parents = new int[n];
|
||||
ranks = new int[n];
|
||||
for (int i = 0; i < n; i++) {
|
||||
parents[i] = i;
|
||||
ranks[i] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
public int find(int u) {
|
||||
while (u != parents[u]) {
|
||||
u = parents[u];
|
||||
}
|
||||
return u;
|
||||
}
|
||||
|
||||
public void union(int u, int v) {
|
||||
int uParent = find(u);
|
||||
int vParent = find(v);
|
||||
if (uParent == vParent) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (ranks[uParent] < ranks[vParent]) {
|
||||
parents[uParent] = vParent;
|
||||
} else if (ranks[uParent] > ranks[vParent]) {
|
||||
parents[vParent] = uParent;
|
||||
} else {
|
||||
parents[vParent] = uParent;
|
||||
ranks[uParent]++;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,33 @@
|
|||
package com.baeldung.algorithms.gradientdescent;
|
||||
|
||||
import java.util.function.Function;
|
||||
|
||||
public class GradientDescent {
|
||||
|
||||
private final double precision = 0.000001;
|
||||
|
||||
public double findLocalMinimum(Function<Double, Double> f, double initialX) {
|
||||
double stepCoefficient = 0.1;
|
||||
double previousStep = 1.0;
|
||||
double currentX = initialX;
|
||||
double previousX = initialX;
|
||||
double previousY = f.apply(previousX);
|
||||
int iter = 100;
|
||||
|
||||
currentX += stepCoefficient * previousY;
|
||||
|
||||
while (previousStep > precision && iter > 0) {
|
||||
iter--;
|
||||
double currentY = f.apply(currentX);
|
||||
if (currentY > previousY) {
|
||||
stepCoefficient = -stepCoefficient / 2;
|
||||
}
|
||||
previousX = currentX;
|
||||
currentX += stepCoefficient * previousY;
|
||||
previousY = currentY;
|
||||
previousStep = StrictMath.abs(currentX - previousX);
|
||||
}
|
||||
return currentX;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,37 @@
|
|||
package com.baeldung.algorithms.boruvka;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import com.google.common.graph.MutableValueGraph;
|
||||
import com.google.common.graph.ValueGraphBuilder;
|
||||
|
||||
public class BoruvkaUnitTest {
|
||||
|
||||
private MutableValueGraph<Integer, Integer> graph;
|
||||
|
||||
@Before
|
||||
public void setup() {
|
||||
graph = ValueGraphBuilder.undirected()
|
||||
.build();
|
||||
graph.putEdgeValue(0, 1, 8);
|
||||
graph.putEdgeValue(0, 2, 5);
|
||||
graph.putEdgeValue(1, 2, 9);
|
||||
graph.putEdgeValue(1, 3, 11);
|
||||
graph.putEdgeValue(2, 3, 15);
|
||||
graph.putEdgeValue(2, 4, 10);
|
||||
graph.putEdgeValue(3, 4, 7);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void givenInputGraph_whenBoruvkaPerformed_thenMinimumSpanningTree() {
|
||||
BoruvkaMST boruvkaMST = new BoruvkaMST(graph);
|
||||
MutableValueGraph<Integer, Integer> mst = boruvkaMST.getMST();
|
||||
|
||||
assertEquals(30, boruvkaMST.getTotalWeight());
|
||||
assertEquals(4, mst.edges().size());
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
package com.baeldung.algorithms.gradientdescent;
|
||||
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
import java.util.function.Function;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
public class GradientDescentUnitTest {
|
||||
|
||||
@Test
|
||||
public void givenFunction_whenStartingPointIsOne_thenLocalMinimumIsFound() {
|
||||
Function<Double, Double> df = x ->
|
||||
StrictMath.abs(StrictMath.pow(x, 3)) - (3 * StrictMath.pow(x, 2)) + x;
|
||||
GradientDescent gd = new GradientDescent();
|
||||
double res = gd.findLocalMinimum(df, 1);
|
||||
assertTrue(res > 1.78);
|
||||
assertTrue(res < 1.84);
|
||||
}
|
||||
}
|
|
@ -10,3 +10,4 @@ This module contains articles about searching algorithms.
|
|||
- [String Search Algorithms for Large Texts](https://www.baeldung.com/java-full-text-search-algorithms)
|
||||
- [Monte Carlo Tree Search for Tic-Tac-Toe Game](https://www.baeldung.com/java-monte-carlo-tree-search)
|
||||
- [Range Search Algorithm in Java](https://www.baeldung.com/java-range-search)
|
||||
- [Fast Pattern Matching of Strings Using Suffix Tree](https://www.baeldung.com/java-pattern-matching-suffix-tree)
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<project
|
||||
xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>algorithms-searching</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
|
|
|
@ -0,0 +1,57 @@
|
|||
package com.baeldung.algorithms.suffixtree;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class Node {
|
||||
private String text;
|
||||
private List<Node> children;
|
||||
private int position;
|
||||
|
||||
public Node(String word, int position) {
|
||||
this.text = word;
|
||||
this.position = position;
|
||||
this.children = new ArrayList<>();
|
||||
}
|
||||
|
||||
public String getText() {
|
||||
return text;
|
||||
}
|
||||
|
||||
public void setText(String text) {
|
||||
this.text = text;
|
||||
}
|
||||
|
||||
public int getPosition() {
|
||||
return position;
|
||||
}
|
||||
|
||||
public void setPosition(int position) {
|
||||
this.position = position;
|
||||
}
|
||||
|
||||
public List<Node> getChildren() {
|
||||
return children;
|
||||
}
|
||||
|
||||
public void setChildren(List<Node> children) {
|
||||
this.children = children;
|
||||
}
|
||||
|
||||
public String printTree(String depthIndicator) {
|
||||
String str = "";
|
||||
String positionStr = position > -1 ? "[" + String.valueOf(position) + "]" : "";
|
||||
str += depthIndicator + text + positionStr + "\n";
|
||||
|
||||
for (int i = 0; i < children.size(); i++) {
|
||||
str += children.get(i)
|
||||
.printTree(depthIndicator + "\t");
|
||||
}
|
||||
return str;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return printTree("");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,175 @@
|
|||
package com.baeldung.algorithms.suffixtree;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public class SuffixTree {
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(SuffixTree.class);
|
||||
private static final String WORD_TERMINATION = "$";
|
||||
private static final int POSITION_UNDEFINED = -1;
|
||||
private Node root;
|
||||
private String fullText;
|
||||
|
||||
public SuffixTree(String text) {
|
||||
root = new Node("", POSITION_UNDEFINED);
|
||||
for (int i = 0; i < text.length(); i++) {
|
||||
addSuffix(text.substring(i) + WORD_TERMINATION, i);
|
||||
}
|
||||
fullText = text;
|
||||
}
|
||||
|
||||
public List<String> searchText(String pattern) {
|
||||
LOGGER.info("Searching for pattern \"{}\"", pattern);
|
||||
List<String> result = new ArrayList<>();
|
||||
List<Node> nodes = getAllNodesInTraversePath(pattern, root, false);
|
||||
|
||||
if (nodes.size() > 0) {
|
||||
Node lastNode = nodes.get(nodes.size() - 1);
|
||||
if (lastNode != null) {
|
||||
List<Integer> positions = getPositions(lastNode);
|
||||
positions = positions.stream()
|
||||
.sorted()
|
||||
.collect(Collectors.toList());
|
||||
positions.forEach(m -> result.add((markPatternInText(m, pattern))));
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private void addSuffix(String suffix, int position) {
|
||||
LOGGER.info(">>>>>>>>>>>> Adding new suffix {}", suffix);
|
||||
List<Node> nodes = getAllNodesInTraversePath(suffix, root, true);
|
||||
if (nodes.size() == 0) {
|
||||
addChildNode(root, suffix, position);
|
||||
LOGGER.info("{}", printTree());
|
||||
} else {
|
||||
Node lastNode = nodes.remove(nodes.size() - 1);
|
||||
String newText = suffix;
|
||||
if (nodes.size() > 0) {
|
||||
String existingSuffixUptoLastNode = nodes.stream()
|
||||
.map(a -> a.getText())
|
||||
.reduce("", String::concat);
|
||||
|
||||
// Remove prefix from newText already included in parent
|
||||
newText = newText.substring(existingSuffixUptoLastNode.length());
|
||||
}
|
||||
extendNode(lastNode, newText, position);
|
||||
LOGGER.info("{}", printTree());
|
||||
}
|
||||
}
|
||||
|
||||
private List<Integer> getPositions(Node node) {
|
||||
List<Integer> positions = new ArrayList<>();
|
||||
if (node.getText()
|
||||
.endsWith(WORD_TERMINATION)) {
|
||||
positions.add(node.getPosition());
|
||||
}
|
||||
for (int i = 0; i < node.getChildren()
|
||||
.size(); i++) {
|
||||
positions.addAll(getPositions(node.getChildren()
|
||||
.get(i)));
|
||||
}
|
||||
return positions;
|
||||
}
|
||||
|
||||
private String markPatternInText(Integer startPosition, String pattern) {
|
||||
String matchingTextLHS = fullText.substring(0, startPosition);
|
||||
String matchingText = fullText.substring(startPosition, startPosition + pattern.length());
|
||||
String matchingTextRHS = fullText.substring(startPosition + pattern.length());
|
||||
return matchingTextLHS + "[" + matchingText + "]" + matchingTextRHS;
|
||||
}
|
||||
|
||||
private void addChildNode(Node parentNode, String text, int position) {
|
||||
parentNode.getChildren()
|
||||
.add(new Node(text, position));
|
||||
}
|
||||
|
||||
private void extendNode(Node node, String newText, int position) {
|
||||
String currentText = node.getText();
|
||||
String commonPrefix = getLongestCommonPrefix(currentText, newText);
|
||||
|
||||
if (commonPrefix != currentText) {
|
||||
String parentText = currentText.substring(0, commonPrefix.length());
|
||||
String childText = currentText.substring(commonPrefix.length());
|
||||
splitNodeToParentAndChild(node, parentText, childText);
|
||||
}
|
||||
|
||||
String remainingText = newText.substring(commonPrefix.length());
|
||||
addChildNode(node, remainingText, position);
|
||||
}
|
||||
|
||||
private void splitNodeToParentAndChild(Node parentNode, String parentNewText, String childNewText) {
|
||||
Node childNode = new Node(childNewText, parentNode.getPosition());
|
||||
|
||||
if (parentNode.getChildren()
|
||||
.size() > 0) {
|
||||
while (parentNode.getChildren()
|
||||
.size() > 0) {
|
||||
childNode.getChildren()
|
||||
.add(parentNode.getChildren()
|
||||
.remove(0));
|
||||
}
|
||||
}
|
||||
|
||||
parentNode.getChildren()
|
||||
.add(childNode);
|
||||
parentNode.setText(parentNewText);
|
||||
parentNode.setPosition(POSITION_UNDEFINED);
|
||||
}
|
||||
|
||||
private String getLongestCommonPrefix(String str1, String str2) {
|
||||
int compareLength = Math.min(str1.length(), str2.length());
|
||||
for (int i = 0; i < compareLength; i++) {
|
||||
if (str1.charAt(i) != str2.charAt(i)) {
|
||||
return str1.substring(0, i);
|
||||
}
|
||||
}
|
||||
return str1.substring(0, compareLength);
|
||||
}
|
||||
|
||||
private List<Node> getAllNodesInTraversePath(String pattern, Node startNode, boolean isAllowPartialMatch) {
|
||||
List<Node> nodes = new ArrayList<>();
|
||||
for (int i = 0; i < startNode.getChildren()
|
||||
.size(); i++) {
|
||||
Node currentNode = startNode.getChildren()
|
||||
.get(i);
|
||||
String nodeText = currentNode.getText();
|
||||
if (pattern.charAt(0) == nodeText.charAt(0)) {
|
||||
if (isAllowPartialMatch && pattern.length() <= nodeText.length()) {
|
||||
nodes.add(currentNode);
|
||||
return nodes;
|
||||
}
|
||||
|
||||
int compareLength = Math.min(nodeText.length(), pattern.length());
|
||||
for (int j = 1; j < compareLength; j++) {
|
||||
if (pattern.charAt(j) != nodeText.charAt(j)) {
|
||||
if (isAllowPartialMatch) {
|
||||
nodes.add(currentNode);
|
||||
}
|
||||
return nodes;
|
||||
}
|
||||
}
|
||||
|
||||
nodes.add(currentNode);
|
||||
if (pattern.length() > compareLength) {
|
||||
List<Node> nodes2 = getAllNodesInTraversePath(pattern.substring(compareLength), currentNode, isAllowPartialMatch);
|
||||
if (nodes2.size() > 0) {
|
||||
nodes.addAll(nodes2);
|
||||
} else if (!isAllowPartialMatch) {
|
||||
nodes.add(null);
|
||||
}
|
||||
}
|
||||
return nodes;
|
||||
}
|
||||
}
|
||||
return nodes;
|
||||
}
|
||||
|
||||
public String printTree() {
|
||||
return root.printTree("");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,77 @@
|
|||
package com.baeldung.algorithms.suffixtree;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.junit.Assert;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public class SuffixTreeUnitTest {
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(SuffixTreeUnitTest.class);
|
||||
|
||||
private static SuffixTree suffixTree;
|
||||
|
||||
@BeforeClass
|
||||
public static void setUp() {
|
||||
suffixTree = new SuffixTree("havanabanana");
|
||||
printTree();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void givenSuffixTree_whenSearchingForA_thenReturn6Matches() {
|
||||
List<String> matches = suffixTree.searchText("a");
|
||||
matches.stream()
|
||||
.forEach(m -> LOGGER.info(m));
|
||||
Assert.assertArrayEquals(new String[] { "h[a]vanabanana", "hav[a]nabanana", "havan[a]banana", "havanab[a]nana", "havanaban[a]na", "havanabanan[a]" }, matches.toArray());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void givenSuffixTree_whenSearchingForNab_thenReturn1Match() {
|
||||
List<String> matches = suffixTree.searchText("nab");
|
||||
matches.stream()
|
||||
.forEach(m -> LOGGER.info(m));
|
||||
Assert.assertArrayEquals(new String[] { "hava[nab]anana" }, matches.toArray());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void givenSuffixTree_whenSearchingForNag_thenReturnNoMatches() {
|
||||
List<String> matches = suffixTree.searchText("nag");
|
||||
matches.stream()
|
||||
.forEach(m -> LOGGER.info(m));
|
||||
Assert.assertArrayEquals(new String[] {}, matches.toArray());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void givenSuffixTree_whenSearchingForBanana_thenReturn2Matches() {
|
||||
List<String> matches = suffixTree.searchText("ana");
|
||||
matches.stream()
|
||||
.forEach(m -> LOGGER.info(m));
|
||||
Assert.assertArrayEquals(new String[] { "hav[ana]banana", "havanab[ana]na", "havanaban[ana]" }, matches.toArray());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void givenSuffixTree_whenSearchingForNa_thenReturn4Matches() {
|
||||
List<String> matches = suffixTree.searchText("na");
|
||||
matches.stream()
|
||||
.forEach(m -> LOGGER.info(m));
|
||||
Assert.assertArrayEquals(new String[] { "hava[na]banana", "havanaba[na]na", "havanabana[na]" }, matches.toArray());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void givenSuffixTree_whenSearchingForX_thenReturnNoMatches() {
|
||||
List<String> matches = suffixTree.searchText("x");
|
||||
matches.stream()
|
||||
.forEach(m -> LOGGER.info(m));
|
||||
Assert.assertArrayEquals(new String[] {}, matches.toArray());
|
||||
}
|
||||
|
||||
private static void printTree() {
|
||||
suffixTree.printTree();
|
||||
|
||||
LOGGER.info("\n" + suffixTree.printTree());
|
||||
LOGGER.info("==============================================");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,3 @@
|
|||
### Relevant Articles:
|
||||
|
||||
- [Partitioning and Sorting Arrays with Many Repeated Entries](https://www.baeldung.com/java-sorting-arrays-with-repeated-entries)
|
|
@ -1,5 +1,7 @@
|
|||
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<project
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>algorithms-sorting-2</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<project
|
||||
xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>algorithms-sorting</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||
<project
|
||||
xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>animal-sniffer-mvn-plugin</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
|
@ -44,5 +46,5 @@
|
|||
<animal-sniffer-maven-plugin.version>1.16</animal-sniffer-maven-plugin.version>
|
||||
<org.codehaus.mojo.signature.java16.version>1.0</org.codehaus.mojo.signature.java16.version>
|
||||
</properties>
|
||||
|
||||
|
||||
</project>
|
|
@ -1,6 +1,8 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<project
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>annotation-processing</artifactId>
|
||||
<name>annotation-processing</name>
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<project
|
||||
xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>annotation-user</artifactId>
|
||||
<name>annotation-user</name>
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<project
|
||||
xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>annotations</artifactId>
|
||||
<name>annotations</name>
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||
<project
|
||||
xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>antlr</artifactId>
|
||||
<name>antlr</name>
|
||||
|
@ -58,5 +60,5 @@
|
|||
<antlr.version>4.7.1</antlr.version>
|
||||
<mojo.version>3.0.0</mojo.version>
|
||||
</properties>
|
||||
|
||||
|
||||
</project>
|
|
@ -1,7 +1,8 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<project
|
||||
xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>apache-avro</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
### Relevant Articles:
|
||||
|
||||
- [Introduction to Apache Beam](https://www.baeldung.com/apache-beam)
|
|
@ -0,0 +1,43 @@
|
|||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<parent>
|
||||
<groupId>com.baeldung</groupId>
|
||||
<artifactId>parent-modules</artifactId>
|
||||
<version>1.0.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<groupId>com.baeldung.apache</groupId>
|
||||
<artifactId>apache-beam</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.apache.beam</groupId>
|
||||
<artifactId>beam-sdks-java-core</artifactId>
|
||||
<version>${beam.version}</version>
|
||||
</dependency>
|
||||
<!-- runtime scoped -->
|
||||
<dependency>
|
||||
<groupId>org.apache.beam</groupId>
|
||||
<artifactId>beam-runners-direct-java</artifactId>
|
||||
<version>${beam.version}</version>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
<!-- test scoped -->
|
||||
<dependency>
|
||||
<groupId>org.assertj</groupId>
|
||||
<artifactId>assertj-core</artifactId>
|
||||
<version>${assertj.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<properties>
|
||||
<beam.version>2.19.0</beam.version>
|
||||
<assertj.version>3.6.1</assertj.version>
|
||||
</properties>
|
||||
|
||||
</project>
|
|
@ -0,0 +1,71 @@
|
|||
package com.baeldung.apache.beam.intro;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
import org.apache.beam.sdk.Pipeline;
|
||||
import org.apache.beam.sdk.io.TextIO;
|
||||
import org.apache.beam.sdk.options.PipelineOptions;
|
||||
import org.apache.beam.sdk.options.PipelineOptionsFactory;
|
||||
import org.apache.beam.sdk.transforms.Count;
|
||||
import org.apache.beam.sdk.transforms.Filter;
|
||||
import org.apache.beam.sdk.transforms.FlatMapElements;
|
||||
import org.apache.beam.sdk.transforms.MapElements;
|
||||
import org.apache.beam.sdk.values.KV;
|
||||
import org.apache.beam.sdk.values.PCollection;
|
||||
import org.apache.beam.sdk.values.TypeDescriptors;
|
||||
|
||||
public class WordCount {
|
||||
|
||||
public static boolean wordCount(String inputFilePath, String outputFilePath) {
|
||||
// We use default options
|
||||
PipelineOptions options = PipelineOptionsFactory.create();
|
||||
// to create the pipeline
|
||||
Pipeline p = Pipeline.create(options);
|
||||
// Here is our workflow graph
|
||||
PCollection<KV<String, Long>> wordCount = p
|
||||
.apply("(1) Read all lines", TextIO.read().from(inputFilePath))
|
||||
.apply("(2) Flatmap to a list of words", FlatMapElements.into(TypeDescriptors.strings())
|
||||
.via(line -> Arrays.asList(line.split("\\s"))))
|
||||
.apply("(3) Lowercase all", MapElements.into(TypeDescriptors.strings())
|
||||
.via(word -> word.toLowerCase()))
|
||||
.apply("(4) Trim punctuations", MapElements.into(TypeDescriptors.strings())
|
||||
.via(word -> trim(word)))
|
||||
.apply("(5) Filter stopwords", Filter.by(word -> !isStopWord(word)))
|
||||
.apply("(6) Count words", Count.perElement());
|
||||
// We convert the PCollection to String so that we can write it to file
|
||||
wordCount.apply(MapElements.into(TypeDescriptors.strings())
|
||||
.via(count -> count.getKey() + " --> " + count.getValue()))
|
||||
.apply(TextIO.write().to(outputFilePath));
|
||||
// Finally we must run the pipeline, otherwise it's only a definition
|
||||
p.run().waitUntilFinish();
|
||||
return true;
|
||||
}
|
||||
|
||||
public static boolean isStopWord(String word) {
|
||||
String[] stopwords = {"am", "are", "is", "i", "you", "me",
|
||||
"he", "she", "they", "them", "was",
|
||||
"were", "from", "in", "of", "to", "be",
|
||||
"him", "her", "us", "and", "or"};
|
||||
for (String stopword : stopwords) {
|
||||
if (stopword.compareTo(word) == 0) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static String trim(String word) {
|
||||
return word.replace("(","")
|
||||
.replace(")", "")
|
||||
.replace(",", "")
|
||||
.replace(".", "")
|
||||
.replace("\"", "")
|
||||
.replace("'", "")
|
||||
.replace(":", "")
|
||||
.replace(";", "")
|
||||
.replace("-", "")
|
||||
.replace("?", "")
|
||||
.replace("!", "");
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,19 @@
|
|||
package com.baeldung.apache.beam.intro;
|
||||
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
|
||||
import com.baeldung.apache.beam.intro.WordCount;
|
||||
|
||||
public class WordCountUnitTest {
|
||||
|
||||
@Test
|
||||
// @Ignore
|
||||
public void givenInputFile_whenWordCountRuns_thenJobFinishWithoutError() {
|
||||
boolean jobDone = WordCount.wordCount("src/test/resources/wordcount.txt", "target/output");
|
||||
assertTrue(jobDone);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
We've all heard the scare stories about North Korea: the homemade nuclear arsenal built while their people starve and then aimed imprecisely at the rest of the world, a
|
||||
leader so deluded he makes L Ron Hubbard look like a man excessively overburdened with self-doubt and their deep-seated belief that foreign capitalists will invade at any
|
||||
moment and steal all their bauxite.
|
||||
The popular portrayal of this Marxist nation is something like one of the more harrowing episodes of M*A*S*H, only with the cast of wacky characters replaced by twitchy,
|
||||
heavily armed Stalinist meth addicts
|
||||
Cracked would like to take a moment to celebrate the good things about North Korea though, the things that the country's enemies prefer to suppress as part of their politically
|
||||
motivated jealousy. Like how no different to you and me, there's nothing every North Korean likes more after an 18 hour shift at the phosphorus plant than a nice beer to go with
|
||||
his dried fish ration. Ever attentive to its people's needs and in the twinkling of a decade, North Korea's leadership bought, disassembled, transported and rebuilt a British
|
||||
brewery in order to discover and reproduce the secrets of beer and then brew the sweet nectar for its hardworking people, up to 18 bottles at a time. And with minimal fatalities.
|
||||
When was the last time YOUR leader got a beer for YOU, American? (NB do not answer this question if you are Henry Louis Gates).
|
||||
Or how about the fried chicken restaurant that downtown Pyongyang boasts? Yes real chicken, fried and then delivered to your sleeping cube, with optional beer if you like! You
|
||||
don't even have to remove the feathers or pull out the gizzard yourself. Mostly. Americans must eat their fried chicken from a bucket, like swine, sold by a company so secretive
|
||||
that even the very blend of seasoning used is intentionally kept from them. And they call North Korea paranoid?
|
||||
And how many nations would entertain the syphilitic, bourgeois ramblings of Bill Clinton let alone permit him anywhere near their proud womenfolk? Only wise Kim Jong Il could see
|
||||
past Bill's many, many imperfections and treat him with the pity and kindness he deserves, accepting his feeble pleas to pardon the American spies rightly convicted of photographing
|
||||
the nation's sensitive beetroot fields.
|
|
@ -1,6 +1,8 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<project
|
||||
xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>apache-bval</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<project
|
||||
xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>apache-curator</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
|
|
|
@ -1,3 +0,0 @@
|
|||
### Relevant Articles
|
||||
|
||||
- [Introduction to Apache CXF Aegis Data Binding](https://www.baeldung.com/aegis-data-binding-in-apache-cxf)
|
|
@ -1,6 +1,8 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||
<project
|
||||
xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>cxf-aegis</artifactId>
|
||||
<name>cxf-aegis</name>
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||
<project
|
||||
xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>cxf-introduction</artifactId>
|
||||
<name>cxf-introduction</name>
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||
<project
|
||||
xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>cxf-jaxrs-implementation</artifactId>
|
||||
<name>cxf-jaxrs-implementation</name>
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||
<project
|
||||
xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>cxf-spring</artifactId>
|
||||
<name>cxf-spring</name>
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<project
|
||||
xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>apache-cxf</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<project
|
||||
xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>sse-jaxrs</artifactId>
|
||||
<name>sse-jaxrs</name>
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<project
|
||||
xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>sse-jaxrs-client</artifactId>
|
||||
<name>sse-jaxrs-client</name>
|
||||
|
|
|
@ -1,12 +1,13 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<project
|
||||
xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>sse-jaxrs-server</artifactId>
|
||||
<name>sse-jaxrs-server</name>
|
||||
<packaging>war</packaging>
|
||||
|
||||
|
||||
<parent>
|
||||
<groupId>com.baeldung</groupId>
|
||||
<artifactId>sse-jaxrs</artifactId>
|
||||
|
@ -18,19 +19,19 @@
|
|||
<dependency>
|
||||
<groupId>javax.ws.rs</groupId>
|
||||
<artifactId>javax.ws.rs-api</artifactId>
|
||||
<version>2.1</version>
|
||||
<version>${rs-api.version}</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>javax.enterprise</groupId>
|
||||
<artifactId>cdi-api</artifactId>
|
||||
<version>2.0</version>
|
||||
<version>${cdi-api.version}</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>javax.json.bind</groupId>
|
||||
<artifactId>javax.json.bind-api</artifactId>
|
||||
<version>1.0</version>
|
||||
<version>${bind-api.version}</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
|
@ -80,6 +81,9 @@
|
|||
<liberty-maven-plugin.version>2.4.2</liberty-maven-plugin.version>
|
||||
<failOnMissingWebXml>false</failOnMissingWebXml>
|
||||
<openliberty-version>18.0.0.2</openliberty-version>
|
||||
<rs-api.version>2.1</rs-api.version>
|
||||
<cdi-api.version>2.0</cdi-api.version>
|
||||
<bind-api.version>1.0</bind-api.version>
|
||||
</properties>
|
||||
|
||||
</project>
|
||||
|
|
|
@ -1,5 +0,0 @@
|
|||
## Apache FOP
|
||||
|
||||
This module contains articles about Apache FOP
|
||||
|
||||
### Relevant Articles:
|
|
@ -1,6 +1,8 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<project
|
||||
xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>apache-fop</artifactId>
|
||||
<version>0.1-SNAPSHOT</version>
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<project
|
||||
xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>apache-geode</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<project
|
||||
xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>apache-meecrowave</artifactId>
|
||||
<version>0.0.1</version>
|
||||
|
|
|
@ -1,4 +0,0 @@
|
|||
### Relevant Articles:
|
||||
|
||||
- [OData Protocol Guide](https://www.baeldung.com/odata)
|
||||
- [Intro to OData with Olingo](https://www.baeldung.com/olingo)
|
|
@ -1,7 +1,8 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<project
|
||||
xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>com.baeldung.examples.olingo2</groupId>
|
||||
<artifactId>olingo2</artifactId>
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<project
|
||||
xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>apache-opennlp</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
|
|
|
@ -6,3 +6,6 @@ This module contains articles about Apache POI
|
|||
- [Microsoft Word Processing in Java with Apache POI](https://www.baeldung.com/java-microsoft-word-with-apache-poi)
|
||||
- [Working with Microsoft Excel in Java](https://www.baeldung.com/java-microsoft-excel)
|
||||
- [Creating a MS PowerPoint Presentation in Java](https://www.baeldung.com/apache-poi-slideshow)
|
||||
- [Merge Cells in Excel Using Apache POI](https://www.baeldung.com/java-apache-poi-merge-cells)
|
||||
- [Get String Value of Excel Cell with Apache POI](https://www.baeldung.com/java-apache-poi-cell-string-value)
|
||||
- [Read Excel Cell Value Rather Than Formula With Apache POI](https://www.baeldung.com/apache-poi-read-cell-value-formula)
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<project
|
||||
xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>apache-poi</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
|
|
|
@ -0,0 +1,53 @@
|
|||
package com.baeldung.poi.excel.merge;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.URISyntaxException;
|
||||
import java.nio.file.Paths;
|
||||
|
||||
import org.apache.poi.ss.usermodel.Sheet;
|
||||
import org.apache.poi.ss.usermodel.Workbook;
|
||||
import org.apache.poi.ss.util.CellRangeAddress;
|
||||
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
public class ExcelCellMergerUnitTest {
|
||||
private static final String FILE_NAME = "ExcelCellFormatterTest.xlsx";
|
||||
private String fileLocation;
|
||||
|
||||
@Before
|
||||
public void setup() throws IOException, URISyntaxException {
|
||||
fileLocation = Paths.get(ClassLoader.getSystemResource(FILE_NAME).toURI()).toString();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void givenCellIndex_whenAddMergeRegion_thenMergeRegionCreated() throws IOException {
|
||||
Workbook workbook = new XSSFWorkbook(fileLocation);
|
||||
Sheet sheet = workbook.getSheetAt(0);
|
||||
|
||||
assertEquals(0, sheet.getNumMergedRegions());
|
||||
int firstRow = 0;
|
||||
int lastRow = 0;
|
||||
int firstCol = 0;
|
||||
int lastCol = 2;
|
||||
sheet.addMergedRegion(new CellRangeAddress(firstRow, lastRow, firstCol, lastCol));
|
||||
assertEquals(1, sheet.getNumMergedRegions());
|
||||
|
||||
workbook.close();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void givenCellRefString_whenAddMergeRegion_thenMergeRegionCreated() throws IOException {
|
||||
Workbook workbook = new XSSFWorkbook(fileLocation);
|
||||
Sheet sheet = workbook.getSheetAt(0);
|
||||
|
||||
assertEquals(0, sheet.getNumMergedRegions());
|
||||
sheet.addMergedRegion(CellRangeAddress.valueOf("A1:C1"));
|
||||
assertEquals(1, sheet.getNumMergedRegions());
|
||||
|
||||
workbook.close();
|
||||
}
|
||||
|
||||
}
|
|
@ -1,6 +1,8 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
<project
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
|
||||
xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>com.baeldung.pulsar</groupId>
|
||||
<artifactId>apache-pulsar</artifactId>
|
||||
|
|
|
@ -3,3 +3,5 @@
|
|||
This module contains articles about Apache RocketMQ
|
||||
|
||||
### Relevant Articles:
|
||||
|
||||
- [Apache RocketMQ with Spring Boot](https://www.baeldung.com/apache-rocketmq-spring-boot)
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<project
|
||||
xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>apache-rocketmq</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
|
@ -17,11 +18,12 @@
|
|||
<dependency>
|
||||
<groupId>org.apache.rocketmq</groupId>
|
||||
<artifactId>rocketmq-spring-boot-starter</artifactId>
|
||||
<version>2.0.4</version>
|
||||
<version>${rocketmq.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<properties>
|
||||
<geode.core>1.6.0</geode.core>
|
||||
<rocketmq.version>2.0.4</rocketmq.version>
|
||||
</properties>
|
||||
</project>
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<project
|
||||
xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>apache-shiro</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<project
|
||||
xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>apache-solrj</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
|
|
|
@ -7,4 +7,4 @@ This module contains articles about Apache Spark
|
|||
- [Introduction to Apache Spark](https://www.baeldung.com/apache-spark)
|
||||
- [Building a Data Pipeline with Kafka, Spark Streaming and Cassandra](https://www.baeldung.com/kafka-spark-data-pipeline)
|
||||
- [Machine Learning with Spark MLlib](https://www.baeldung.com/spark-mlib-machine-learning)
|
||||
|
||||
- [Introduction to Spark Graph Processing with GraphFrames](https://www.baeldung.com/spark-graph-graphframes)
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<project
|
||||
xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>apache-spark</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
### Relevant Articles
|
||||
|
||||
- [Intro to Apache Tapestry](https://www.baeldung.com/apache-tapestry)
|
|
@ -1,6 +1,8 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0">
|
||||
<project
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns="http://maven.apache.org/POM/4.0.0">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>com.baeldung</groupId>
|
||||
<artifactId>apache-tapestry</artifactId>
|
||||
|
@ -9,9 +11,8 @@
|
|||
<packaging>war</packaging>
|
||||
|
||||
<dependencies>
|
||||
<!-- To set up an application with a database, change the artifactId below to
|
||||
tapestry-hibernate, and add a dependency on your JDBC driver. You'll also
|
||||
need to add Hibernate configuration files, such as hibernate.cfg.xml. -->
|
||||
<!-- To set up an application with a database, change the artifactId below to tapestry-hibernate,
|
||||
and add a dependency on your JDBC driver. You'll also need to add Hibernate configuration files, such as hibernate.cfg.xml. -->
|
||||
<dependency>
|
||||
<groupId>org.apache.tapestry</groupId>
|
||||
<artifactId>tapestry-core</artifactId>
|
||||
|
@ -32,17 +33,10 @@
|
|||
</dependency>
|
||||
|
||||
<!-- Uncomment this to add support for file uploads: -->
|
||||
<!--
|
||||
<dependency>
|
||||
<groupId>org.apache.tapestry</groupId>
|
||||
<artifactId>tapestry-upload</artifactId>
|
||||
<version>${tapestry-release-version}</version>
|
||||
</dependency>
|
||||
-->
|
||||
<!-- <dependency> <groupId>org.apache.tapestry</groupId> <artifactId>tapestry-upload</artifactId> <version>${tapestry-release-version}</version> </dependency> -->
|
||||
|
||||
<!-- A dependency on either JUnit or TestNG is required, or the surefire plugin (which runs the tests)
|
||||
will fail, preventing Maven from packaging the WAR. Tapestry includes a large number
|
||||
of testing facilities designed for use with TestNG (http://testng.org/), so it's recommended. -->
|
||||
<!-- A dependency on either JUnit or TestNG is required, or the surefire plugin (which runs the tests) will fail, preventing Maven from packaging the WAR. Tapestry includes
|
||||
a large number of testing facilities designed for use with TestNG (http://testng.org/), so it's recommended. -->
|
||||
<dependency>
|
||||
<groupId>org.testng</groupId>
|
||||
<artifactId>testng</artifactId>
|
||||
|
@ -57,8 +51,7 @@ of testing facilities designed for use with TestNG (http://testng.org/), so it's
|
|||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- Provided by the servlet container, but sometimes referenced in the application
|
||||
code. -->
|
||||
<!-- Provided by the servlet container, but sometimes referenced in the application code. -->
|
||||
<dependency>
|
||||
<groupId>javax.servlet</groupId>
|
||||
<artifactId>servlet-api</artifactId>
|
||||
|
@ -81,10 +74,10 @@ of testing facilities designed for use with TestNG (http://testng.org/), so it's
|
|||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>2.3.2</version>
|
||||
<version>${compiler.plugin.version}</version>
|
||||
<configuration>
|
||||
<source>1.8</source>
|
||||
<target>1.8</target>
|
||||
<source>${source.version}</source>
|
||||
<target>${target.version}</target>
|
||||
<optimize>true</optimize>
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
@ -92,7 +85,7 @@ of testing facilities designed for use with TestNG (http://testng.org/), so it's
|
|||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<version>2.7.2</version>
|
||||
<version>${compiler.surefire.version}</version>
|
||||
<configuration>
|
||||
<systemPropertyVariables>
|
||||
<tapestry.execution-mode>Qa</tapestry.execution-mode>
|
||||
|
@ -104,12 +97,11 @@ of testing facilities designed for use with TestNG (http://testng.org/), so it's
|
|||
<plugin>
|
||||
<groupId>org.mortbay.jetty</groupId>
|
||||
<artifactId>maven-jetty-plugin</artifactId>
|
||||
<version>6.1.16</version>
|
||||
<version>${compiler.jetty.version}</version>
|
||||
<configuration>
|
||||
<!-- Log to the console. -->
|
||||
<requestLog implementation="org.mortbay.jetty.NCSARequestLog">
|
||||
<!-- This doesn't do anything for Jetty, but is a workaround for a Maven bug
|
||||
that prevents the requestLog from being set. -->
|
||||
<!-- This doesn't do anything for Jetty, but is a workaround for a Maven bug that prevents the requestLog from being set. -->
|
||||
<append>true</append>
|
||||
</requestLog>
|
||||
<systemProperties>
|
||||
|
@ -123,7 +115,7 @@ of testing facilities designed for use with TestNG (http://testng.org/), so it's
|
|||
</plugins>
|
||||
</build>
|
||||
|
||||
<reporting/>
|
||||
<reporting />
|
||||
|
||||
<repositories>
|
||||
<repository>
|
||||
|
@ -131,8 +123,7 @@ of testing facilities designed for use with TestNG (http://testng.org/), so it's
|
|||
<url>http://repository.jboss.org/nexus/content/groups/public/</url>
|
||||
</repository>
|
||||
|
||||
<!-- This repository is only needed when the Tapestry version is a preview release, rather
|
||||
than a final release. -->
|
||||
<!-- This repository is only needed when the Tapestry version is a preview release, rather than a final release. -->
|
||||
<repository>
|
||||
<id>apache-staging</id>
|
||||
<url>https://repository.apache.org/content/groups/staging/</url>
|
||||
|
@ -140,6 +131,11 @@ of testing facilities designed for use with TestNG (http://testng.org/), so it's
|
|||
</repositories>
|
||||
|
||||
<properties>
|
||||
<compiler.jetty.version>6.1.16</compiler.jetty.version>
|
||||
<compiler.surefire.version>2.7.2</compiler.surefire.version>
|
||||
<compiler.plugin.version>2.3.2</compiler.plugin.version>
|
||||
<source.version>1.8</source.version>
|
||||
<target.version>1.8</target.version>
|
||||
<tapestry-release-version>5.4.5</tapestry-release-version>
|
||||
<servlet-api-release-version>2.5</servlet-api-release-version>
|
||||
<testng-release-version>6.8.21</testng-release-version>
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<project
|
||||
xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>apache-thrift</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<project
|
||||
xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>apache-tika</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||
<project
|
||||
xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>apache-velocity</artifactId>
|
||||
<version>0.1-SNAPSHOT</version>
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<project
|
||||
xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>apache-zookeeper</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<project
|
||||
xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>asciidoctor</artifactId>
|
||||
<name>asciidoctor</name>
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<project
|
||||
xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>com.baeldung.examples</groupId>
|
||||
<artifactId>asm</artifactId>
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<project
|
||||
xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>com.atomix.io</groupId>
|
||||
<artifactId>atomix</artifactId>
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<project
|
||||
xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>aws-lambda</artifactId>
|
||||
<version>0.1.0-SNAPSHOT</version>
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
### Relevant Articles:
|
||||
|
||||
- [AWS S3 with Java – Reactive Support](https://www.baeldung.com/java-aws-s3-reactive)
|
|
@ -1,105 +1,107 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<project
|
||||
xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<parent>
|
||||
<groupId>com.baeldung</groupId>
|
||||
<artifactId>parent-modules</artifactId>
|
||||
<version>1.0.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>aws-reactive</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<name>aws-reactive</name>
|
||||
<description>AWS Reactive Sample</description>
|
||||
|
||||
<properties>
|
||||
<java.version>1.8</java.version>
|
||||
</properties>
|
||||
<artifactId>aws-reactive</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<name>aws-reactive</name>
|
||||
<description>AWS Reactive Sample</description>
|
||||
|
||||
<dependencyManagement>
|
||||
<dependencies>
|
||||
<dependencyManagement>
|
||||
<dependencies>
|
||||
|
||||
<dependency>
|
||||
<!-- Import dependency management from Spring Boot -->
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-dependencies</artifactId>
|
||||
<version>2.2.1.RELEASE</version>
|
||||
<type>pom</type>
|
||||
<scope>import</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<!-- Import dependency management from Spring Boot -->
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-dependencies</artifactId>
|
||||
<version>${spring.version}</version>
|
||||
<type>pom</type>
|
||||
<scope>import</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>software.amazon.awssdk</groupId>
|
||||
<artifactId>bom</artifactId>
|
||||
<version>2.10.27</version>
|
||||
<type>pom</type>
|
||||
<scope>import</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</dependencyManagement>
|
||||
<dependency>
|
||||
<groupId>software.amazon.awssdk</groupId>
|
||||
<artifactId>bom</artifactId>
|
||||
<version>${awssdk.version}</version>
|
||||
<type>pom</type>
|
||||
<scope>import</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</dependencyManagement>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-webflux</artifactId>
|
||||
</dependency>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-webflux</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>software.amazon.awssdk</groupId>
|
||||
<artifactId>s3</artifactId>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>software.amazon.awssdk</groupId>
|
||||
<artifactId>s3</artifactId>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<artifactId>netty-nio-client</artifactId>
|
||||
<groupId>software.amazon.awssdk</groupId>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<artifactId>netty-nio-client</artifactId>
|
||||
<groupId>software.amazon.awssdk</groupId>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-test</artifactId>
|
||||
<scope>test</scope>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>org.junit.vintage</groupId>
|
||||
<artifactId>junit-vintage-engine</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-test</artifactId>
|
||||
<scope>test</scope>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>org.junit.vintage</groupId>
|
||||
<artifactId>junit-vintage-engine</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
|
||||
|
||||
<dependency>
|
||||
<groupId>io.projectreactor</groupId>
|
||||
<artifactId>reactor-test</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-devtools</artifactId>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-configuration-processor</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<dependency>
|
||||
<groupId>io.projectreactor</groupId>
|
||||
<artifactId>reactor-test</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-devtools</artifactId>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-configuration-processor</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
<properties>
|
||||
<java.version>1.8</java.version>
|
||||
<spring.version>2.2.1.RELEASE</spring.version>
|
||||
<awssdk.version>2.10.27</awssdk.version>
|
||||
</properties>
|
||||
</project>
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<project
|
||||
xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>aws</artifactId>
|
||||
<version>0.1.0-SNAPSHOT</version>
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<project
|
||||
xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>axon</artifactId>
|
||||
<name>axon</name>
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<project
|
||||
xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>azure</artifactId>
|
||||
<version>0.1</version>
|
||||
|
|
|
@ -5,7 +5,7 @@ spring.jpa.hibernate.ddl-auto=create
|
|||
logging.file=azure.log
|
||||
logging.level.root=info
|
||||
|
||||
spring.datasource.url=jdbc:h2:file:~/test
|
||||
spring.datasource.url=jdbc:h2:mem:azure-test-db
|
||||
spring.datasource.username=sa
|
||||
spring.datasource.password=
|
||||
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<project
|
||||
xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>bazelapp</artifactId>
|
||||
<name>bazelapp</name>
|
||||
|
|
|
@ -1,3 +0,0 @@
|
|||
### Relevant Articles:
|
||||
|
||||
- [Building Java Applications with Bazel](https://www.baeldung.com/bazel-build-tool)
|
|
@ -1,7 +1,8 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<project
|
||||
xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>bazelgreeting</artifactId>
|
||||
<name>bazelgreeting</name>
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<project
|
||||
xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>bazel</artifactId>
|
||||
<name>bazel</name>
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||
<project
|
||||
xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>blade</artifactId>
|
||||
<name>blade</name>
|
||||
|
@ -106,7 +107,7 @@
|
|||
<arguments>
|
||||
<argument>java</argument>
|
||||
<argument>-jar</argument>
|
||||
<argument>sample-blade-app.jar</argument>
|
||||
<argument>blade.jar</argument>
|
||||
</arguments>
|
||||
</configuration>
|
||||
</execution>
|
||||
|
@ -124,7 +125,7 @@
|
|||
|
||||
<plugin>
|
||||
<artifactId>maven-assembly-plugin</artifactId>
|
||||
<version>3.1.0</version>
|
||||
<version>${assembly.plugin.version}</version>
|
||||
<configuration>
|
||||
<finalName>${project.build.finalName}</finalName>
|
||||
<appendAssemblyId>false</appendAssemblyId>
|
||||
|
@ -161,6 +162,7 @@
|
|||
<assertj-core.version>3.11.1</assertj-core.version>
|
||||
<maven-failsafe-plugin.version>3.0.0-M3</maven-failsafe-plugin.version>
|
||||
<process-exec-maven-plugin.version>0.7</process-exec-maven-plugin.version>
|
||||
<assembly.plugin.version>3.1.0</assembly.plugin.version>
|
||||
</properties>
|
||||
|
||||
</project>
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||
<project
|
||||
xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>com.baeldung.bootique</groupId>
|
||||
<artifactId>bootique</artifactId>
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<project
|
||||
xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>cas-secured-app</artifactId>
|
||||
<name>cas-secured-app</name>
|
||||
|
@ -9,11 +11,15 @@
|
|||
|
||||
<parent>
|
||||
<groupId>com.baeldung</groupId>
|
||||
<artifactId>parent-boot-1</artifactId>
|
||||
<artifactId>parent-boot-2</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<relativePath>../../parent-boot-1</relativePath>
|
||||
<relativePath>../../parent-boot-2</relativePath>
|
||||
</parent>
|
||||
|
||||
<properties>
|
||||
<spring-boot.version>2.2.6.RELEASE</spring-boot.version>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
|
|
|
@ -1,91 +0,0 @@
|
|||
package com.baeldung.cassecuredapp;
|
||||
|
||||
import org.jasig.cas.client.session.SingleSignOutFilter;
|
||||
import org.jasig.cas.client.session.SingleSignOutHttpSessionListener;
|
||||
import org.jasig.cas.client.validation.Cas30ServiceTicketValidator;
|
||||
import org.jasig.cas.client.validation.TicketValidator;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Primary;
|
||||
import org.springframework.context.event.EventListener;
|
||||
import org.springframework.security.cas.ServiceProperties;
|
||||
import org.springframework.security.cas.authentication.CasAuthenticationProvider;
|
||||
import org.springframework.security.cas.web.CasAuthenticationEntryPoint;
|
||||
import org.springframework.security.core.authority.AuthorityUtils;
|
||||
import org.springframework.security.core.context.SecurityContextHolder;
|
||||
import org.springframework.security.core.userdetails.User;
|
||||
import org.springframework.security.web.AuthenticationEntryPoint;
|
||||
import org.springframework.security.web.authentication.logout.LogoutFilter;
|
||||
import org.springframework.security.web.authentication.logout.SecurityContextLogoutHandler;
|
||||
|
||||
import javax.servlet.http.HttpSessionEvent;
|
||||
|
||||
@SpringBootApplication
|
||||
public class CasSecuredAppApplication {
|
||||
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(CasSecuredAppApplication.class, args);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public ServiceProperties serviceProperties() {
|
||||
ServiceProperties serviceProperties = new ServiceProperties();
|
||||
serviceProperties.setService("http://localhost:9000/login/cas");
|
||||
serviceProperties.setSendRenew(false);
|
||||
return serviceProperties;
|
||||
}
|
||||
|
||||
@Bean
|
||||
@Primary
|
||||
public AuthenticationEntryPoint authenticationEntryPoint(ServiceProperties sP) {
|
||||
CasAuthenticationEntryPoint entryPoint = new CasAuthenticationEntryPoint();
|
||||
entryPoint.setLoginUrl("https://localhost:6443/cas/login");
|
||||
entryPoint.setServiceProperties(sP);
|
||||
return entryPoint;
|
||||
}
|
||||
|
||||
@Bean
|
||||
public TicketValidator ticketValidator() {
|
||||
return new Cas30ServiceTicketValidator("https://localhost:6443/cas");
|
||||
}
|
||||
|
||||
@Bean
|
||||
public CasAuthenticationProvider casAuthenticationProvider() {
|
||||
CasAuthenticationProvider provider = new CasAuthenticationProvider();
|
||||
provider.setServiceProperties(serviceProperties());
|
||||
provider.setTicketValidator(ticketValidator());
|
||||
provider.setUserDetailsService((s) -> new User("test@test.com", "smatt",
|
||||
true, true, true, true,
|
||||
AuthorityUtils.createAuthorityList("ROLE_ADMIN")));
|
||||
provider.setKey("CAS_PROVIDER_LOCALHOST_9000");
|
||||
return provider;
|
||||
}
|
||||
|
||||
|
||||
@Bean
|
||||
public SecurityContextLogoutHandler securityContextLogoutHandler() {
|
||||
return new SecurityContextLogoutHandler();
|
||||
}
|
||||
|
||||
@Bean
|
||||
public LogoutFilter logoutFilter() {
|
||||
LogoutFilter logoutFilter = new LogoutFilter(
|
||||
"https://localhost:6443/cas/logout", securityContextLogoutHandler());
|
||||
logoutFilter.setFilterProcessesUrl("/logout/cas");
|
||||
return logoutFilter;
|
||||
}
|
||||
|
||||
@Bean
|
||||
public SingleSignOutFilter singleSignOutFilter() {
|
||||
SingleSignOutFilter singleSignOutFilter = new SingleSignOutFilter();
|
||||
singleSignOutFilter.setCasServerUrlPrefix("https://localhost:6443/cas");
|
||||
singleSignOutFilter.setIgnoreInitConfiguration(true);
|
||||
return singleSignOutFilter;
|
||||
}
|
||||
|
||||
@EventListener
|
||||
public SingleSignOutHttpSessionListener singleSignOutHttpSessionListener(HttpSessionEvent event) {
|
||||
return new SingleSignOutHttpSessionListener();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,97 @@
|
|||
package com.baeldung.cassecuredapp;
|
||||
|
||||
import org.jasig.cas.client.session.SingleSignOutFilter;
|
||||
import org.jasig.cas.client.session.SingleSignOutHttpSessionListener;
|
||||
import org.jasig.cas.client.validation.Cas30ServiceTicketValidator;
|
||||
import org.jasig.cas.client.validation.TicketValidator;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Primary;
|
||||
import org.springframework.context.event.EventListener;
|
||||
import org.springframework.security.authentication.AuthenticationManager;
|
||||
import org.springframework.security.cas.ServiceProperties;
|
||||
import org.springframework.security.cas.authentication.CasAuthenticationProvider;
|
||||
import org.springframework.security.cas.web.CasAuthenticationEntryPoint;
|
||||
import org.springframework.security.cas.web.CasAuthenticationFilter;
|
||||
import org.springframework.security.core.authority.AuthorityUtils;
|
||||
import org.springframework.security.core.userdetails.User;
|
||||
import org.springframework.security.web.AuthenticationEntryPoint;
|
||||
import org.springframework.security.web.authentication.SavedRequestAwareAuthenticationSuccessHandler;
|
||||
import org.springframework.security.web.authentication.logout.LogoutFilter;
|
||||
import org.springframework.security.web.authentication.logout.SecurityContextLogoutHandler;
|
||||
|
||||
import javax.servlet.http.HttpSessionEvent;
|
||||
|
||||
@SpringBootApplication
|
||||
public class CasSecuredApplication {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(CasSecuredApplication.class);
|
||||
|
||||
public static void main(String... args) {
|
||||
SpringApplication.run(CasSecuredApplication.class, args);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public CasAuthenticationFilter casAuthenticationFilter(
|
||||
AuthenticationManager authenticationManager,
|
||||
ServiceProperties serviceProperties) throws Exception {
|
||||
CasAuthenticationFilter filter = new CasAuthenticationFilter();
|
||||
filter.setAuthenticationManager(authenticationManager);
|
||||
filter.setServiceProperties(serviceProperties);
|
||||
return filter;
|
||||
}
|
||||
|
||||
@Bean
|
||||
public ServiceProperties serviceProperties() {
|
||||
logger.info("service properties");
|
||||
ServiceProperties serviceProperties = new ServiceProperties();
|
||||
serviceProperties.setService("http://cas-client:8900/login/cas");
|
||||
serviceProperties.setSendRenew(false);
|
||||
return serviceProperties;
|
||||
}
|
||||
|
||||
@Bean
|
||||
public TicketValidator ticketValidator() {
|
||||
return new Cas30ServiceTicketValidator("https://localhost:8443");
|
||||
}
|
||||
|
||||
@Bean
|
||||
public CasAuthenticationProvider casAuthenticationProvider(
|
||||
TicketValidator ticketValidator,
|
||||
ServiceProperties serviceProperties) {
|
||||
CasAuthenticationProvider provider = new CasAuthenticationProvider();
|
||||
provider.setServiceProperties(serviceProperties);
|
||||
provider.setTicketValidator(ticketValidator);
|
||||
provider.setUserDetailsService(
|
||||
s -> new User("test@test.com", "Mellon", true, true, true, true,
|
||||
AuthorityUtils.createAuthorityList("ROLE_ADMIN")));
|
||||
provider.setKey("CAS_PROVIDER_LOCALHOST_8900");
|
||||
return provider;
|
||||
}
|
||||
|
||||
|
||||
@Bean
|
||||
public SecurityContextLogoutHandler securityContextLogoutHandler() {
|
||||
return new SecurityContextLogoutHandler();
|
||||
}
|
||||
|
||||
@Bean
|
||||
public LogoutFilter logoutFilter() {
|
||||
LogoutFilter logoutFilter = new LogoutFilter("https://localhost:8443/logout", securityContextLogoutHandler());
|
||||
logoutFilter.setFilterProcessesUrl("/logout/cas");
|
||||
return logoutFilter;
|
||||
}
|
||||
|
||||
@Bean
|
||||
public SingleSignOutFilter singleSignOutFilter() {
|
||||
SingleSignOutFilter singleSignOutFilter = new SingleSignOutFilter();
|
||||
singleSignOutFilter.setCasServerUrlPrefix("https://localhost:8443");
|
||||
singleSignOutFilter.setLogoutCallbackPath("/exit/cas");
|
||||
singleSignOutFilter.setIgnoreInitConfiguration(true);
|
||||
return singleSignOutFilter;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,83 +0,0 @@
|
|||
package com.baeldung.cassecuredapp.config;
|
||||
|
||||
import org.jasig.cas.client.session.SingleSignOutFilter;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.security.authentication.AuthenticationManager;
|
||||
import org.springframework.security.authentication.AuthenticationProvider;
|
||||
import org.springframework.security.authentication.ProviderManager;
|
||||
import org.springframework.security.cas.ServiceProperties;
|
||||
import org.springframework.security.cas.authentication.CasAuthenticationProvider;
|
||||
import org.springframework.security.cas.web.CasAuthenticationFilter;
|
||||
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
|
||||
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
|
||||
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
|
||||
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
|
||||
import org.springframework.security.web.AuthenticationEntryPoint;
|
||||
import org.springframework.security.web.authentication.logout.LogoutFilter;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
@EnableWebSecurity
|
||||
@Configuration
|
||||
public class SecurityConfig extends WebSecurityConfigurerAdapter {
|
||||
|
||||
private AuthenticationProvider authenticationProvider;
|
||||
private AuthenticationEntryPoint authenticationEntryPoint;
|
||||
private SingleSignOutFilter singleSignOutFilter;
|
||||
private LogoutFilter logoutFilter;
|
||||
|
||||
@Autowired
|
||||
public SecurityConfig(CasAuthenticationProvider casAuthenticationProvider, AuthenticationEntryPoint eP,
|
||||
LogoutFilter lF
|
||||
, SingleSignOutFilter ssF
|
||||
) {
|
||||
this.authenticationProvider = casAuthenticationProvider;
|
||||
this.authenticationEntryPoint = eP;
|
||||
|
||||
this.logoutFilter = lF;
|
||||
this.singleSignOutFilter = ssF;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void configure(HttpSecurity http) throws Exception {
|
||||
http
|
||||
.authorizeRequests()
|
||||
.regexMatchers("/secured.*", "/login")
|
||||
.authenticated()
|
||||
.and()
|
||||
.authorizeRequests()
|
||||
.regexMatchers("/")
|
||||
.permitAll()
|
||||
.and()
|
||||
.httpBasic()
|
||||
.authenticationEntryPoint(authenticationEntryPoint)
|
||||
.and()
|
||||
.logout().logoutSuccessUrl("/logout")
|
||||
.and()
|
||||
.addFilterBefore(singleSignOutFilter, CasAuthenticationFilter.class)
|
||||
.addFilterBefore(logoutFilter, LogoutFilter.class);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void configure(AuthenticationManagerBuilder auth) throws Exception {
|
||||
auth.authenticationProvider(authenticationProvider);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected AuthenticationManager authenticationManager() throws Exception {
|
||||
return new ProviderManager(Arrays.asList(authenticationProvider));
|
||||
}
|
||||
|
||||
@Bean
|
||||
public CasAuthenticationFilter casAuthenticationFilter(ServiceProperties sP) throws Exception {
|
||||
CasAuthenticationFilter filter = new CasAuthenticationFilter();
|
||||
filter.setServiceProperties(sP);
|
||||
filter.setAuthenticationManager(authenticationManager());
|
||||
return filter;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,79 @@
|
|||
package com.baeldung.cassecuredapp.config;
|
||||
|
||||
import org.jasig.cas.client.session.SingleSignOutFilter;
|
||||
import org.jasig.cas.client.validation.Cas30ServiceTicketValidator;
|
||||
import org.jasig.cas.client.validation.TicketValidator;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Primary;
|
||||
import org.springframework.security.authentication.AuthenticationManager;
|
||||
import org.springframework.security.authentication.ProviderManager;
|
||||
import org.springframework.security.cas.ServiceProperties;
|
||||
import org.springframework.security.cas.authentication.CasAuthenticationProvider;
|
||||
import org.springframework.security.cas.web.CasAuthenticationEntryPoint;
|
||||
import org.springframework.security.cas.web.CasAuthenticationFilter;
|
||||
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
|
||||
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
|
||||
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
|
||||
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
|
||||
import org.springframework.security.core.authority.AuthorityUtils;
|
||||
import org.springframework.security.core.userdetails.User;
|
||||
import org.springframework.security.web.AuthenticationEntryPoint;
|
||||
import org.springframework.security.web.authentication.logout.LogoutFilter;
|
||||
|
||||
import java.util.Collections;
|
||||
|
||||
@EnableWebSecurity
|
||||
public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
|
||||
|
||||
private Logger logger = LoggerFactory.getLogger(WebSecurityConfig.class);
|
||||
private SingleSignOutFilter singleSignOutFilter;
|
||||
private LogoutFilter logoutFilter;
|
||||
private CasAuthenticationProvider casAuthenticationProvider;
|
||||
private ServiceProperties serviceProperties;
|
||||
|
||||
@Autowired
|
||||
public WebSecurityConfig(SingleSignOutFilter singleSignOutFilter, LogoutFilter logoutFilter,
|
||||
CasAuthenticationProvider casAuthenticationProvider,
|
||||
ServiceProperties serviceProperties) {
|
||||
this.logoutFilter = logoutFilter;
|
||||
this.singleSignOutFilter = singleSignOutFilter;
|
||||
this.serviceProperties = serviceProperties;
|
||||
this.casAuthenticationProvider = casAuthenticationProvider;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void configure(HttpSecurity http) throws Exception {
|
||||
http.authorizeRequests().antMatchers( "/secured", "/login").authenticated()
|
||||
.and()
|
||||
.exceptionHandling().authenticationEntryPoint(authenticationEntryPoint())
|
||||
.and()
|
||||
.addFilterBefore(singleSignOutFilter, CasAuthenticationFilter.class)
|
||||
.addFilterBefore(logoutFilter, LogoutFilter.class)
|
||||
.csrf().ignoringAntMatchers("/exit/cas");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void configure(AuthenticationManagerBuilder auth) throws Exception {
|
||||
auth.authenticationProvider(casAuthenticationProvider);
|
||||
}
|
||||
|
||||
@Bean
|
||||
@Override
|
||||
protected AuthenticationManager authenticationManager() throws Exception {
|
||||
return new ProviderManager(Collections.singletonList(casAuthenticationProvider));
|
||||
}
|
||||
|
||||
public AuthenticationEntryPoint authenticationEntryPoint() {
|
||||
CasAuthenticationEntryPoint entryPoint = new CasAuthenticationEntryPoint();
|
||||
entryPoint.setLoginUrl("https://localhost:8443/login");
|
||||
entryPoint.setServiceProperties(serviceProperties);
|
||||
return entryPoint;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue