Merge branch 'eugenp:master' into master
This commit is contained in:
commit
2987378070
@ -8,6 +8,9 @@ import java.util.PriorityQueue;
|
|||||||
import java.util.Queue;
|
import java.util.Queue;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
public class RouteFinder<T extends GraphNode> {
|
public class RouteFinder<T extends GraphNode> {
|
||||||
private final Graph<T> graph;
|
private final Graph<T> graph;
|
||||||
private final Scorer<T> nextNodeScorer;
|
private final Scorer<T> nextNodeScorer;
|
||||||
@ -28,11 +31,11 @@ public class RouteFinder<T extends GraphNode> {
|
|||||||
openSet.add(start);
|
openSet.add(start);
|
||||||
|
|
||||||
while (!openSet.isEmpty()) {
|
while (!openSet.isEmpty()) {
|
||||||
System.out.println("Open Set contains: " + openSet.stream().map(RouteNode::getCurrent).collect(Collectors.toSet()));
|
log.debug("Open Set contains: " + openSet.stream().map(RouteNode::getCurrent).collect(Collectors.toSet()));
|
||||||
RouteNode<T> next = openSet.poll();
|
RouteNode<T> next = openSet.poll();
|
||||||
System.out.println("Looking at node: " + next);
|
log.debug("Looking at node: " + next);
|
||||||
if (next.getCurrent().equals(to)) {
|
if (next.getCurrent().equals(to)) {
|
||||||
System.out.println("Found our destination!");
|
log.debug("Found our destination!");
|
||||||
|
|
||||||
List<T> route = new ArrayList<>();
|
List<T> route = new ArrayList<>();
|
||||||
RouteNode<T> current = next;
|
RouteNode<T> current = next;
|
||||||
@ -41,7 +44,7 @@ public class RouteFinder<T extends GraphNode> {
|
|||||||
current = allNodes.get(current.getPrevious());
|
current = allNodes.get(current.getPrevious());
|
||||||
} while (current != null);
|
} while (current != null);
|
||||||
|
|
||||||
System.out.println("Route: " + route);
|
log.debug("Route: " + route);
|
||||||
return route;
|
return route;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -55,7 +58,7 @@ public class RouteFinder<T extends GraphNode> {
|
|||||||
nextNode.setRouteScore(newScore);
|
nextNode.setRouteScore(newScore);
|
||||||
nextNode.setEstimatedScore(newScore + targetScorer.computeCost(connection, to));
|
nextNode.setEstimatedScore(newScore + targetScorer.computeCost(connection, to));
|
||||||
openSet.add(nextNode);
|
openSet.add(nextNode);
|
||||||
System.out.println("Found a better route to node: " + nextNode);
|
log.debug("Found a better route to node: " + nextNode);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
package com.baeldung.algorithms.astar.underground;
|
package com.baeldung.algorithms.astar.underground;
|
||||||
|
|
||||||
|
import static org.assertj.core.api.Assertions.assertThat;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -10,9 +12,13 @@ import java.util.stream.Stream;
|
|||||||
|
|
||||||
import com.baeldung.algorithms.astar.Graph;
|
import com.baeldung.algorithms.astar.Graph;
|
||||||
import com.baeldung.algorithms.astar.RouteFinder;
|
import com.baeldung.algorithms.astar.RouteFinder;
|
||||||
|
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
public class RouteFinderIntegrationTest {
|
public class RouteFinderIntegrationTest {
|
||||||
|
|
||||||
private Graph<Station> underground;
|
private Graph<Station> underground;
|
||||||
@ -637,7 +643,8 @@ public class RouteFinderIntegrationTest {
|
|||||||
@Test
|
@Test
|
||||||
public void findRoute() {
|
public void findRoute() {
|
||||||
List<Station> route = routeFinder.findRoute(underground.getNode("74"), underground.getNode("7"));
|
List<Station> route = routeFinder.findRoute(underground.getNode("74"), underground.getNode("7"));
|
||||||
|
assertThat(route).size().isPositive();
|
||||||
|
|
||||||
System.out.println(route.stream().map(Station::getName).collect(Collectors.toList()));
|
route.stream().map(Station::getName).collect(Collectors.toList()).forEach(station -> log.debug(station));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -25,9 +25,9 @@ public class GrepWithUnix4JIntegrationTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void whenGrepWithSimpleString_thenCorrect() {
|
public void whenGrepWithSimpleString_thenCorrect() {
|
||||||
int expectedLineCount = 4;
|
int expectedLineCount = 5;
|
||||||
|
|
||||||
// grep "NINETEEN" dictionary.txt
|
// grep "NINETEEN" dictionary.in
|
||||||
List<Line> lines = Unix4j.grep("NINETEEN", fileToGrep).toLineList();
|
List<Line> lines = Unix4j.grep("NINETEEN", fileToGrep).toLineList();
|
||||||
|
|
||||||
assertEquals(expectedLineCount, lines.size());
|
assertEquals(expectedLineCount, lines.size());
|
||||||
@ -35,9 +35,9 @@ public class GrepWithUnix4JIntegrationTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void whenInverseGrepWithSimpleString_thenCorrect() {
|
public void whenInverseGrepWithSimpleString_thenCorrect() {
|
||||||
int expectedLineCount = 178687;
|
int expectedLineCount = 8;
|
||||||
|
|
||||||
// grep -v "NINETEEN" dictionary.txt
|
// grep -v "NINETEEN" dictionary.in
|
||||||
List<Line> lines = grep(Options.v, "NINETEEN", fileToGrep).toLineList();
|
List<Line> lines = grep(Options.v, "NINETEEN", fileToGrep).toLineList();
|
||||||
|
|
||||||
assertEquals(expectedLineCount, lines.size());
|
assertEquals(expectedLineCount, lines.size());
|
||||||
@ -45,9 +45,9 @@ public class GrepWithUnix4JIntegrationTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void whenGrepWithRegex_thenCorrect() {
|
public void whenGrepWithRegex_thenCorrect() {
|
||||||
int expectedLineCount = 151;
|
int expectedLineCount = 5;
|
||||||
|
|
||||||
// grep -c ".*?NINE.*?" dictionary.txt
|
// grep -c ".*?NINE.*?" dictionary.in
|
||||||
String patternCount = grep(Options.c, ".*?NINE.*?", fileToGrep).cut(fields, ":", 1).toStringResult();
|
String patternCount = grep(Options.c, ".*?NINE.*?", fileToGrep).cut(fields, ":", 1).toStringResult();
|
||||||
|
|
||||||
assertEquals(expectedLineCount, Integer.parseInt(patternCount));
|
assertEquals(expectedLineCount, Integer.parseInt(patternCount));
|
||||||
|
@ -0,0 +1,13 @@
|
|||||||
|
EIGHTTEEN
|
||||||
|
EIGHTTEENS
|
||||||
|
EIGHTTEENTH
|
||||||
|
EIGHTTEENTHS
|
||||||
|
NINETEEN
|
||||||
|
NINETEENS
|
||||||
|
NINETEENTH
|
||||||
|
NINETEENTHS
|
||||||
|
TWENTY
|
||||||
|
TWENTHIES
|
||||||
|
TWENTHIETH
|
||||||
|
TWENTHIETHS
|
||||||
|
TWENTYNINETEEN
|
@ -6,7 +6,8 @@
|
|||||||
</pattern>
|
</pattern>
|
||||||
</encoder>
|
</encoder>
|
||||||
</appender>
|
</appender>
|
||||||
|
<logger name="org.kie.api.internal.utils" level="WARN"/>
|
||||||
|
<logger name="org.drools.compiler" level="WARN"/>
|
||||||
<root level="INFO">
|
<root level="INFO">
|
||||||
<appender-ref ref="STDOUT" />
|
<appender-ref ref="STDOUT" />
|
||||||
</root>
|
</root>
|
||||||
|
@ -3,6 +3,11 @@ plugins {
|
|||||||
id 'org.springframework.boot' version '2.3.4.RELEASE'
|
id 'org.springframework.boot' version '2.3.4.RELEASE'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ext {
|
||||||
|
springBootVersion = '2.3.4.RELEASE'
|
||||||
|
lombokVersion = '1.18.14'
|
||||||
|
}
|
||||||
|
|
||||||
group = 'com.gradle'
|
group = 'com.gradle'
|
||||||
version = '1.0.0'
|
version = '1.0.0'
|
||||||
sourceCompatibility = '14'
|
sourceCompatibility = '14'
|
||||||
@ -12,19 +17,16 @@ repositories {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation 'org.springframework.boot:spring-boot-starter:2.3.4.RELEASE'
|
implementation "org.springframework.boot:spring-boot-starter:${springBootVersion}"
|
||||||
|
|
||||||
testImplementation 'org.springframework.boot:spring-boot-starter-test:2.3.4.RELEASE'
|
compileOnly "org.projectlombok:lombok:${lombokVersion}"
|
||||||
|
|
||||||
compileOnly 'org.projectlombok:lombok:1.18.14'
|
|
||||||
|
|
||||||
testCompileOnly 'org.projectlombok:lombok:1.18.14'
|
|
||||||
|
|
||||||
runtimeOnly files('libs/sampleOne.jar', 'libs/sampleTwo.jar')
|
runtimeOnly files('libs/sampleOne.jar', 'libs/sampleTwo.jar')
|
||||||
|
runtimeOnly fileTree("libs") { include "*.jar" }
|
||||||
|
|
||||||
runtimeOnly fileTree('libs') { include '*.jar' }
|
testImplementation "org.springframework.boot:spring-boot-starter-test:${springBootVersion}"
|
||||||
|
|
||||||
// implementation gradleApi()
|
testCompileOnly "org.projectlombok:lombok:${lombokVersion}"
|
||||||
}
|
}
|
||||||
|
|
||||||
test {
|
test {
|
||||||
|
BIN
gradle/gradle-dependency-management/gradle/wrapper/gradle-wrapper.jar
vendored
Normal file
BIN
gradle/gradle-dependency-management/gradle/wrapper/gradle-wrapper.jar
vendored
Normal file
Binary file not shown.
234
gradle/gradle-dependency-management/gradlew
vendored
Executable file
234
gradle/gradle-dependency-management/gradlew
vendored
Executable file
@ -0,0 +1,234 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
#
|
||||||
|
# Copyright © 2015-2021 the original authors.
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# https://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
#
|
||||||
|
|
||||||
|
##############################################################################
|
||||||
|
#
|
||||||
|
# Gradle start up script for POSIX generated by Gradle.
|
||||||
|
#
|
||||||
|
# Important for running:
|
||||||
|
#
|
||||||
|
# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
|
||||||
|
# noncompliant, but you have some other compliant shell such as ksh or
|
||||||
|
# bash, then to run this script, type that shell name before the whole
|
||||||
|
# command line, like:
|
||||||
|
#
|
||||||
|
# ksh Gradle
|
||||||
|
#
|
||||||
|
# Busybox and similar reduced shells will NOT work, because this script
|
||||||
|
# requires all of these POSIX shell features:
|
||||||
|
# * functions;
|
||||||
|
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
|
||||||
|
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
|
||||||
|
# * compound commands having a testable exit status, especially «case»;
|
||||||
|
# * various built-in commands including «command», «set», and «ulimit».
|
||||||
|
#
|
||||||
|
# Important for patching:
|
||||||
|
#
|
||||||
|
# (2) This script targets any POSIX shell, so it avoids extensions provided
|
||||||
|
# by Bash, Ksh, etc; in particular arrays are avoided.
|
||||||
|
#
|
||||||
|
# The "traditional" practice of packing multiple parameters into a
|
||||||
|
# space-separated string is a well documented source of bugs and security
|
||||||
|
# problems, so this is (mostly) avoided, by progressively accumulating
|
||||||
|
# options in "$@", and eventually passing that to Java.
|
||||||
|
#
|
||||||
|
# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
|
||||||
|
# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
|
||||||
|
# see the in-line comments for details.
|
||||||
|
#
|
||||||
|
# There are tweaks for specific operating systems such as AIX, CygWin,
|
||||||
|
# Darwin, MinGW, and NonStop.
|
||||||
|
#
|
||||||
|
# (3) This script is generated from the Groovy template
|
||||||
|
# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
||||||
|
# within the Gradle project.
|
||||||
|
#
|
||||||
|
# You can find Gradle at https://github.com/gradle/gradle/.
|
||||||
|
#
|
||||||
|
##############################################################################
|
||||||
|
|
||||||
|
# Attempt to set APP_HOME
|
||||||
|
|
||||||
|
# Resolve links: $0 may be a link
|
||||||
|
app_path=$0
|
||||||
|
|
||||||
|
# Need this for daisy-chained symlinks.
|
||||||
|
while
|
||||||
|
APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
|
||||||
|
[ -h "$app_path" ]
|
||||||
|
do
|
||||||
|
ls=$( ls -ld "$app_path" )
|
||||||
|
link=${ls#*' -> '}
|
||||||
|
case $link in #(
|
||||||
|
/*) app_path=$link ;; #(
|
||||||
|
*) app_path=$APP_HOME$link ;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
|
||||||
|
|
||||||
|
APP_NAME="Gradle"
|
||||||
|
APP_BASE_NAME=${0##*/}
|
||||||
|
|
||||||
|
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||||
|
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||||
|
|
||||||
|
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||||
|
MAX_FD=maximum
|
||||||
|
|
||||||
|
warn () {
|
||||||
|
echo "$*"
|
||||||
|
} >&2
|
||||||
|
|
||||||
|
die () {
|
||||||
|
echo
|
||||||
|
echo "$*"
|
||||||
|
echo
|
||||||
|
exit 1
|
||||||
|
} >&2
|
||||||
|
|
||||||
|
# OS specific support (must be 'true' or 'false').
|
||||||
|
cygwin=false
|
||||||
|
msys=false
|
||||||
|
darwin=false
|
||||||
|
nonstop=false
|
||||||
|
case "$( uname )" in #(
|
||||||
|
CYGWIN* ) cygwin=true ;; #(
|
||||||
|
Darwin* ) darwin=true ;; #(
|
||||||
|
MSYS* | MINGW* ) msys=true ;; #(
|
||||||
|
NONSTOP* ) nonstop=true ;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||||
|
|
||||||
|
|
||||||
|
# Determine the Java command to use to start the JVM.
|
||||||
|
if [ -n "$JAVA_HOME" ] ; then
|
||||||
|
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||||
|
# IBM's JDK on AIX uses strange locations for the executables
|
||||||
|
JAVACMD=$JAVA_HOME/jre/sh/java
|
||||||
|
else
|
||||||
|
JAVACMD=$JAVA_HOME/bin/java
|
||||||
|
fi
|
||||||
|
if [ ! -x "$JAVACMD" ] ; then
|
||||||
|
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
||||||
|
|
||||||
|
Please set the JAVA_HOME variable in your environment to match the
|
||||||
|
location of your Java installation."
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
JAVACMD=java
|
||||||
|
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||||
|
|
||||||
|
Please set the JAVA_HOME variable in your environment to match the
|
||||||
|
location of your Java installation."
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Increase the maximum file descriptors if we can.
|
||||||
|
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
|
||||||
|
case $MAX_FD in #(
|
||||||
|
max*)
|
||||||
|
MAX_FD=$( ulimit -H -n ) ||
|
||||||
|
warn "Could not query maximum file descriptor limit"
|
||||||
|
esac
|
||||||
|
case $MAX_FD in #(
|
||||||
|
'' | soft) :;; #(
|
||||||
|
*)
|
||||||
|
ulimit -n "$MAX_FD" ||
|
||||||
|
warn "Could not set maximum file descriptor limit to $MAX_FD"
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Collect all arguments for the java command, stacking in reverse order:
|
||||||
|
# * args from the command line
|
||||||
|
# * the main class name
|
||||||
|
# * -classpath
|
||||||
|
# * -D...appname settings
|
||||||
|
# * --module-path (only if needed)
|
||||||
|
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
|
||||||
|
|
||||||
|
# For Cygwin or MSYS, switch paths to Windows format before running java
|
||||||
|
if "$cygwin" || "$msys" ; then
|
||||||
|
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
|
||||||
|
CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
|
||||||
|
|
||||||
|
JAVACMD=$( cygpath --unix "$JAVACMD" )
|
||||||
|
|
||||||
|
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||||
|
for arg do
|
||||||
|
if
|
||||||
|
case $arg in #(
|
||||||
|
-*) false ;; # don't mess with options #(
|
||||||
|
/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
|
||||||
|
[ -e "$t" ] ;; #(
|
||||||
|
*) false ;;
|
||||||
|
esac
|
||||||
|
then
|
||||||
|
arg=$( cygpath --path --ignore --mixed "$arg" )
|
||||||
|
fi
|
||||||
|
# Roll the args list around exactly as many times as the number of
|
||||||
|
# args, so each arg winds up back in the position where it started, but
|
||||||
|
# possibly modified.
|
||||||
|
#
|
||||||
|
# NB: a `for` loop captures its iteration list before it begins, so
|
||||||
|
# changing the positional parameters here affects neither the number of
|
||||||
|
# iterations, nor the values presented in `arg`.
|
||||||
|
shift # remove old arg
|
||||||
|
set -- "$@" "$arg" # push replacement arg
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Collect all arguments for the java command;
|
||||||
|
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
|
||||||
|
# shell script including quotes and variable substitutions, so put them in
|
||||||
|
# double quotes to make sure that they get re-expanded; and
|
||||||
|
# * put everything else in single quotes, so that it's not re-expanded.
|
||||||
|
|
||||||
|
set -- \
|
||||||
|
"-Dorg.gradle.appname=$APP_BASE_NAME" \
|
||||||
|
-classpath "$CLASSPATH" \
|
||||||
|
org.gradle.wrapper.GradleWrapperMain \
|
||||||
|
"$@"
|
||||||
|
|
||||||
|
# Use "xargs" to parse quoted args.
|
||||||
|
#
|
||||||
|
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
|
||||||
|
#
|
||||||
|
# In Bash we could simply go:
|
||||||
|
#
|
||||||
|
# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
|
||||||
|
# set -- "${ARGS[@]}" "$@"
|
||||||
|
#
|
||||||
|
# but POSIX shell has neither arrays nor command substitution, so instead we
|
||||||
|
# post-process each arg (as a line of input to sed) to backslash-escape any
|
||||||
|
# character that might be a shell metacharacter, then use eval to reverse
|
||||||
|
# that process (while maintaining the separation between arguments), and wrap
|
||||||
|
# the whole thing up as a single "set" statement.
|
||||||
|
#
|
||||||
|
# This will of course break if any of these variables contains a newline or
|
||||||
|
# an unmatched quote.
|
||||||
|
#
|
||||||
|
|
||||||
|
eval "set -- $(
|
||||||
|
printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
|
||||||
|
xargs -n1 |
|
||||||
|
sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
|
||||||
|
tr '\n' ' '
|
||||||
|
)" '"$@"'
|
||||||
|
|
||||||
|
exec "$JAVACMD" "$@"
|
89
gradle/gradle-dependency-management/gradlew.bat
vendored
Normal file
89
gradle/gradle-dependency-management/gradlew.bat
vendored
Normal file
@ -0,0 +1,89 @@
|
|||||||
|
@rem
|
||||||
|
@rem Copyright 2015 the original author or authors.
|
||||||
|
@rem
|
||||||
|
@rem Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
@rem you may not use this file except in compliance with the License.
|
||||||
|
@rem You may obtain a copy of the License at
|
||||||
|
@rem
|
||||||
|
@rem https://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
@rem
|
||||||
|
@rem Unless required by applicable law or agreed to in writing, software
|
||||||
|
@rem distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
@rem See the License for the specific language governing permissions and
|
||||||
|
@rem limitations under the License.
|
||||||
|
@rem
|
||||||
|
|
||||||
|
@if "%DEBUG%" == "" @echo off
|
||||||
|
@rem ##########################################################################
|
||||||
|
@rem
|
||||||
|
@rem Gradle startup script for Windows
|
||||||
|
@rem
|
||||||
|
@rem ##########################################################################
|
||||||
|
|
||||||
|
@rem Set local scope for the variables with windows NT shell
|
||||||
|
if "%OS%"=="Windows_NT" setlocal
|
||||||
|
|
||||||
|
set DIRNAME=%~dp0
|
||||||
|
if "%DIRNAME%" == "" set DIRNAME=.
|
||||||
|
set APP_BASE_NAME=%~n0
|
||||||
|
set APP_HOME=%DIRNAME%
|
||||||
|
|
||||||
|
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
|
||||||
|
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
|
||||||
|
|
||||||
|
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||||
|
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
|
||||||
|
|
||||||
|
@rem Find java.exe
|
||||||
|
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||||
|
|
||||||
|
set JAVA_EXE=java.exe
|
||||||
|
%JAVA_EXE% -version >NUL 2>&1
|
||||||
|
if "%ERRORLEVEL%" == "0" goto execute
|
||||||
|
|
||||||
|
echo.
|
||||||
|
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||||
|
echo.
|
||||||
|
echo Please set the JAVA_HOME variable in your environment to match the
|
||||||
|
echo location of your Java installation.
|
||||||
|
|
||||||
|
goto fail
|
||||||
|
|
||||||
|
:findJavaFromJavaHome
|
||||||
|
set JAVA_HOME=%JAVA_HOME:"=%
|
||||||
|
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||||
|
|
||||||
|
if exist "%JAVA_EXE%" goto execute
|
||||||
|
|
||||||
|
echo.
|
||||||
|
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
||||||
|
echo.
|
||||||
|
echo Please set the JAVA_HOME variable in your environment to match the
|
||||||
|
echo location of your Java installation.
|
||||||
|
|
||||||
|
goto fail
|
||||||
|
|
||||||
|
:execute
|
||||||
|
@rem Setup the command line
|
||||||
|
|
||||||
|
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||||
|
|
||||||
|
|
||||||
|
@rem Execute Gradle
|
||||||
|
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
|
||||||
|
|
||||||
|
:end
|
||||||
|
@rem End local scope for the variables with windows NT shell
|
||||||
|
if "%ERRORLEVEL%"=="0" goto mainEnd
|
||||||
|
|
||||||
|
:fail
|
||||||
|
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||||
|
rem the _cmd.exe /c_ return code!
|
||||||
|
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
|
||||||
|
exit /b 1
|
||||||
|
|
||||||
|
:mainEnd
|
||||||
|
if "%OS%"=="Windows_NT" endlocal
|
||||||
|
|
||||||
|
:omega
|
BIN
gradle/gradle-dependency-management/libs/sampleOne.jar
Normal file
BIN
gradle/gradle-dependency-management/libs/sampleOne.jar
Normal file
Binary file not shown.
BIN
gradle/gradle-dependency-management/libs/sampleTwo.jar
Normal file
BIN
gradle/gradle-dependency-management/libs/sampleTwo.jar
Normal file
Binary file not shown.
@ -5,20 +5,14 @@ import javax.ws.rs.container.ResourceInfo;
|
|||||||
import javax.ws.rs.core.FeatureContext;
|
import javax.ws.rs.core.FeatureContext;
|
||||||
import javax.ws.rs.ext.Provider;
|
import javax.ws.rs.ext.Provider;
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
|
|
||||||
import com.baeldung.jersey.server.Greetings;
|
import com.baeldung.jersey.server.Greetings;
|
||||||
import com.baeldung.jersey.server.filter.ResponseServerFilter;
|
import com.baeldung.jersey.server.filter.ResponseServerFilter;
|
||||||
|
|
||||||
@Provider
|
@Provider
|
||||||
public class HelloDynamicBinding implements DynamicFeature {
|
public class HelloDynamicBinding implements DynamicFeature {
|
||||||
|
|
||||||
private static final Logger LOG = LoggerFactory.getLogger(HelloDynamicBinding.class);
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void configure(ResourceInfo resourceInfo, FeatureContext context) {
|
public void configure(ResourceInfo resourceInfo, FeatureContext context) {
|
||||||
LOG.info("Hello dynamic binding");
|
|
||||||
|
|
||||||
if (Greetings.class.equals(resourceInfo.getResourceClass()) && resourceInfo.getResourceMethod()
|
if (Greetings.class.equals(resourceInfo.getResourceClass()) && resourceInfo.getResourceMethod()
|
||||||
.getName()
|
.getName()
|
||||||
|
@ -22,8 +22,6 @@ public class JMapperRelationalIntegrationTest {
|
|||||||
UserDto1 result1 = relationalMapper.oneToMany(UserDto1.class, user);
|
UserDto1 result1 = relationalMapper.oneToMany(UserDto1.class, user);
|
||||||
UserDto2 result2= relationalMapper.oneToMany(UserDto2.class, user);
|
UserDto2 result2= relationalMapper.oneToMany(UserDto2.class, user);
|
||||||
|
|
||||||
System.out.println(result1);
|
|
||||||
System.out.println(result2);
|
|
||||||
assertEquals(user.getId(), result1.getId());
|
assertEquals(user.getId(), result1.getId());
|
||||||
assertEquals(user.getEmail(), result1.getUsername());
|
assertEquals(user.getEmail(), result1.getUsername());
|
||||||
assertEquals(user.getId(), result2.getId());
|
assertEquals(user.getId(), result2.getId());
|
||||||
@ -40,8 +38,6 @@ public class JMapperRelationalIntegrationTest {
|
|||||||
UserDto1 result1 = relationalMapper.oneToMany(UserDto1.class, user);
|
UserDto1 result1 = relationalMapper.oneToMany(UserDto1.class, user);
|
||||||
UserDto2 result2 = relationalMapper.oneToMany(UserDto2.class, user);
|
UserDto2 result2 = relationalMapper.oneToMany(UserDto2.class, user);
|
||||||
|
|
||||||
System.out.println(result1);
|
|
||||||
System.out.println(result2);
|
|
||||||
assertEquals(user.getId(), result1.getId());
|
assertEquals(user.getId(), result1.getId());
|
||||||
assertEquals(user.getEmail(), result1.getUsername());
|
assertEquals(user.getEmail(), result1.getUsername());
|
||||||
assertEquals(user.getId(), result2.getId());
|
assertEquals(user.getId(), result2.getId());
|
||||||
@ -64,8 +60,6 @@ public class JMapperRelationalIntegrationTest {
|
|||||||
UserDto1 result1 = relationalMapper.oneToMany(UserDto1.class, user);
|
UserDto1 result1 = relationalMapper.oneToMany(UserDto1.class, user);
|
||||||
UserDto2 result2 = relationalMapper.oneToMany(UserDto2.class, user);
|
UserDto2 result2 = relationalMapper.oneToMany(UserDto2.class, user);
|
||||||
|
|
||||||
System.out.println(result1);
|
|
||||||
System.out.println(result2);
|
|
||||||
assertEquals(user.getId(), result1.getId());
|
assertEquals(user.getId(), result1.getId());
|
||||||
assertEquals(user.getEmail(), result1.getUsername());
|
assertEquals(user.getEmail(), result1.getUsername());
|
||||||
assertEquals(user.getId(), result2.getId());
|
assertEquals(user.getId(), result2.getId());
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
package com.baeldung.hibernate.lazycollection;
|
package com.baeldung.hibernate.lazycollection;
|
||||||
|
|
||||||
import com.baeldung.hibernate.lazycollection.model.Branch;
|
|
||||||
import com.baeldung.hibernate.lazycollection.model.Employee;
|
|
||||||
import org.hibernate.Hibernate;
|
import org.hibernate.Hibernate;
|
||||||
import org.hibernate.Session;
|
import org.hibernate.Session;
|
||||||
import org.hibernate.SessionFactory;
|
import org.hibernate.SessionFactory;
|
||||||
@ -9,15 +7,14 @@ import org.hibernate.boot.registry.StandardServiceRegistryBuilder;
|
|||||||
import org.hibernate.cfg.Configuration;
|
import org.hibernate.cfg.Configuration;
|
||||||
import org.hibernate.dialect.H2Dialect;
|
import org.hibernate.dialect.H2Dialect;
|
||||||
import org.hibernate.service.ServiceRegistry;
|
import org.hibernate.service.ServiceRegistry;
|
||||||
|
|
||||||
import org.junit.After;
|
|
||||||
import org.junit.AfterClass;
|
import org.junit.AfterClass;
|
||||||
import org.junit.Assert;
|
import org.junit.Assert;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.BeforeClass;
|
import org.junit.BeforeClass;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
import javax.annotation.PostConstruct;
|
import com.baeldung.hibernate.lazycollection.model.Branch;
|
||||||
|
import com.baeldung.hibernate.lazycollection.model.Employee;
|
||||||
|
|
||||||
public class LazyCollectionIntegrationTest {
|
public class LazyCollectionIntegrationTest {
|
||||||
|
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<!DOCTYPE log4j:configuration PUBLIC "-//APACHE//DTD LOG4J 1.2//EN" "log4j.dtd">
|
<configuration xmlns:log4j='http://jakarta.apache.org/log4j/'>
|
||||||
<log4j:configuration xmlns:log4j='http://jakarta.apache.org/log4j/'>
|
|
||||||
<appender name="STDOUT" class="org.apache.log4j.ConsoleAppender">
|
<appender name="STDOUT" class="org.apache.log4j.ConsoleAppender">
|
||||||
<layout class="org.apache.log4j.PatternLayout">
|
<layout class="org.apache.log4j.PatternLayout">
|
||||||
<param name="ConversionPattern" value="%d %-5p [%t] %C{2} (%F:%L) - %m%n"/>
|
<param name="ConversionPattern" value="%d %-5p [%t] %C{2} (%F:%L) - %m%n"/>
|
||||||
@ -10,16 +9,16 @@
|
|||||||
<level value="info" />
|
<level value="info" />
|
||||||
</logger>
|
</logger>
|
||||||
<logger name="org.hibernate.SQL">
|
<logger name="org.hibernate.SQL">
|
||||||
<level value="debug" />
|
<level value="info" />
|
||||||
</logger>
|
</logger>
|
||||||
<logger name="org.hibernate.type.descriptor.sql">
|
<logger name="org.hibernate.type.descriptor.sql">
|
||||||
<level value="trace" />
|
<level value="info" />
|
||||||
</logger>
|
</logger>
|
||||||
<logger name="org.hibernate.stat">
|
<logger name="org.hibernate.stat">
|
||||||
<level value="debug" />
|
<level value="info" />
|
||||||
</logger>
|
</logger>
|
||||||
<root>
|
<root>
|
||||||
<priority value ="info" />
|
<priority value ="info" />
|
||||||
<appender-ref ref="STDOUT" />
|
<appender-ref ref="STDOUT" />
|
||||||
</root>
|
</root>
|
||||||
</log4j:configuration>
|
</configuration>
|
@ -8,9 +8,9 @@
|
|||||||
</Appenders>
|
</Appenders>
|
||||||
<Loggers>
|
<Loggers>
|
||||||
<Logger name="org.hibernate" level="info"/>
|
<Logger name="org.hibernate" level="info"/>
|
||||||
<Logger name="org.hibernate.SQL" level="debug"/>
|
<Logger name="org.hibernate.SQL" level="info"/>
|
||||||
<Logger name="org.hibernate.type.descriptor.sql" level="trace"/>
|
<Logger name="org.hibernate.type.descriptor.sql" level="info"/>
|
||||||
<Logger name="org.hibernate.stat" level="debug" />
|
<Logger name="org.hibernate.stat" level="info" />
|
||||||
<Root level="info" additivity="false">
|
<Root level="info" additivity="false">
|
||||||
<AppenderRef ref="console" />
|
<AppenderRef ref="console" />
|
||||||
</Root>
|
</Root>
|
||||||
|
@ -8,9 +8,9 @@
|
|||||||
</appender>
|
</appender>
|
||||||
|
|
||||||
<logger name="org.hibernate" level="INFO" />
|
<logger name="org.hibernate" level="INFO" />
|
||||||
<logger name="org.hibernate.SQL" level="DEBUG" />
|
<logger name="org.hibernate.SQL" level="INFO" />
|
||||||
<logger name="org.hibernate.type.descriptor.sql" level="TRACE" />
|
<logger name="org.hibernate.type.descriptor.sql" level="INFO" />
|
||||||
<logger name="org.hibernate.stat" level="DEBUG" />
|
<logger name="org.hibernate.stat" level="INFO" />
|
||||||
|
|
||||||
<root level="INFO">
|
<root level="INFO">
|
||||||
<appender-ref ref="STDOUT" />
|
<appender-ref ref="STDOUT" />
|
||||||
|
@ -0,0 +1,212 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<persistence xmlns="http://xmlns.jcp.org/xml/ns/persistence"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence
|
||||||
|
http://xmlns.jcp.org/xml/ns/persistence/persistence_2_2.xsd"
|
||||||
|
version="2.2">
|
||||||
|
|
||||||
|
<persistence-unit name="jpa-h2-queryparams"
|
||||||
|
transaction-type="RESOURCE_LOCAL">
|
||||||
|
<provider>org.hibernate.jpa.HibernatePersistenceProvider</provider>
|
||||||
|
<class>com.baeldung.jpa.queryparams.Employee</class>
|
||||||
|
<exclude-unlisted-classes>true</exclude-unlisted-classes>
|
||||||
|
<properties>
|
||||||
|
<property name="javax.persistence.jdbc.driver"
|
||||||
|
value="org.h2.Driver" />
|
||||||
|
<property name="javax.persistence.jdbc.url"
|
||||||
|
value="jdbc:h2:mem:test" />
|
||||||
|
<property name="javax.persistence.jdbc.user" value="sa" />
|
||||||
|
<property name="javax.persistence.jdbc.password" value="" />
|
||||||
|
<property name="hibernate.dialect"
|
||||||
|
value="org.hibernate.dialect.H2Dialect" />
|
||||||
|
<property name="hibernate.hbm2ddl.auto" value="create-drop" />
|
||||||
|
<property name="show_sql" value="false" />
|
||||||
|
<property name="hibernate.temp.use_jdbc_metadata_defaults"
|
||||||
|
value="false" />
|
||||||
|
<property name="javax.persistence.sql-load-script-source"
|
||||||
|
value="queryparams.sql" />
|
||||||
|
</properties>
|
||||||
|
</persistence-unit>
|
||||||
|
|
||||||
|
|
||||||
|
<persistence-unit name="jpa-h2-text">
|
||||||
|
<provider>org.hibernate.jpa.HibernatePersistenceProvider</provider>
|
||||||
|
<class>com.baeldung.jpa.text.Exam</class>
|
||||||
|
<exclude-unlisted-classes>true</exclude-unlisted-classes>
|
||||||
|
<properties>
|
||||||
|
<property name="javax.persistence.jdbc.driver"
|
||||||
|
value="org.h2.Driver" />
|
||||||
|
<property name="javax.persistence.jdbc.url"
|
||||||
|
value="jdbc:h2:mem:test" />
|
||||||
|
<property name="javax.persistence.jdbc.user" value="sa" />
|
||||||
|
<property name="javax.persistence.jdbc.password" value="" />
|
||||||
|
<property name="hibernate.dialect"
|
||||||
|
value="org.hibernate.dialect.H2Dialect" />
|
||||||
|
<property name="hibernate.hbm2ddl.auto" value="create-drop" />
|
||||||
|
<property name="show_sql" value="false" />
|
||||||
|
<property name="hibernate.temp.use_jdbc_metadata_defaults"
|
||||||
|
value="false" />
|
||||||
|
</properties>
|
||||||
|
</persistence-unit>
|
||||||
|
|
||||||
|
<persistence-unit name="entity-default-values">
|
||||||
|
<provider>org.hibernate.jpa.HibernatePersistenceProvider</provider>
|
||||||
|
<class>com.baeldung.jpa.defaultvalues.User</class>
|
||||||
|
<exclude-unlisted-classes>true</exclude-unlisted-classes>
|
||||||
|
<properties>
|
||||||
|
<property name="javax.persistence.jdbc.driver"
|
||||||
|
value="org.h2.Driver" />
|
||||||
|
<property name="javax.persistence.jdbc.url"
|
||||||
|
value="jdbc:h2:mem:test" />
|
||||||
|
<property name="javax.persistence.jdbc.user" value="sa" />
|
||||||
|
<property name="javax.persistence.jdbc.password" value="" />
|
||||||
|
<property name="hibernate.dialect"
|
||||||
|
value="org.hibernate.dialect.H2Dialect" />
|
||||||
|
<property name="hibernate.hbm2ddl.auto" value="create-drop" />
|
||||||
|
<property name="show_sql" value="false" />
|
||||||
|
<property name="hibernate.temp.use_jdbc_metadata_defaults"
|
||||||
|
value="false" />
|
||||||
|
</properties>
|
||||||
|
</persistence-unit>
|
||||||
|
|
||||||
|
<persistence-unit name="jpa-query-types">
|
||||||
|
<provider>org.hibernate.jpa.HibernatePersistenceProvider</provider>
|
||||||
|
<class>com.baeldung.jpa.querytypes.UserEntity</class>
|
||||||
|
<exclude-unlisted-classes>true</exclude-unlisted-classes>
|
||||||
|
<properties>
|
||||||
|
<property name="javax.persistence.jdbc.driver"
|
||||||
|
value="org.h2.Driver" />
|
||||||
|
<property name="javax.persistence.jdbc.url"
|
||||||
|
value="jdbc:h2:mem:test" />
|
||||||
|
<property name="javax.persistence.jdbc.user" value="sa" />
|
||||||
|
<property name="javax.persistence.jdbc.password" value="" />
|
||||||
|
<property name="hibernate.dialect"
|
||||||
|
value="org.hibernate.dialect.H2Dialect" />
|
||||||
|
<property name="hibernate.hbm2ddl.auto" value="create-drop" />
|
||||||
|
<property name="show_sql" value="false" />
|
||||||
|
<property name="hibernate.temp.use_jdbc_metadata_defaults"
|
||||||
|
value="false" />
|
||||||
|
<property name="javax.persistence.sql-load-script-source"
|
||||||
|
value="users.sql" />
|
||||||
|
</properties>
|
||||||
|
</persistence-unit>
|
||||||
|
|
||||||
|
<persistence-unit name="jpa-projections">
|
||||||
|
<provider>org.hibernate.jpa.HibernatePersistenceProvider</provider>
|
||||||
|
<class>com.baeldung.jpa.projections.Product</class>
|
||||||
|
<exclude-unlisted-classes>true</exclude-unlisted-classes>
|
||||||
|
<properties>
|
||||||
|
<property name="javax.persistence.jdbc.driver"
|
||||||
|
value="org.h2.Driver" />
|
||||||
|
<property name="javax.persistence.jdbc.url"
|
||||||
|
value="jdbc:h2:mem:test" />
|
||||||
|
<property name="javax.persistence.jdbc.user" value="sa" />
|
||||||
|
<property name="javax.persistence.jdbc.password" value="" />
|
||||||
|
<property name="hibernate.dialect"
|
||||||
|
value="org.hibernate.dialect.H2Dialect" />
|
||||||
|
<property name="hibernate.hbm2ddl.auto" value="create-drop" />
|
||||||
|
<property name="show_sql" value="false" />
|
||||||
|
<property name="hibernate.temp.use_jdbc_metadata_defaults"
|
||||||
|
value="false" />
|
||||||
|
<property name="javax.persistence.sql-load-script-source"
|
||||||
|
value="products_jpa.sql" />
|
||||||
|
</properties>
|
||||||
|
</persistence-unit>
|
||||||
|
|
||||||
|
<persistence-unit name="jpa-h2-criteria">
|
||||||
|
<provider>org.hibernate.jpa.HibernatePersistenceProvider</provider>
|
||||||
|
<class>com.baeldung.jpa.criteria.Item</class>
|
||||||
|
<exclude-unlisted-classes>true</exclude-unlisted-classes>
|
||||||
|
<properties>
|
||||||
|
<property name="javax.persistence.jdbc.driver"
|
||||||
|
value="org.h2.Driver" />
|
||||||
|
<property name="javax.persistence.jdbc.url"
|
||||||
|
value="jdbc:h2:mem:test" />
|
||||||
|
<property name="javax.persistence.jdbc.user" value="sa" />
|
||||||
|
<property name="javax.persistence.jdbc.password" value="" />
|
||||||
|
<property name="hibernate.dialect"
|
||||||
|
value="org.hibernate.dialect.H2Dialect" />
|
||||||
|
<property name="hibernate.hbm2ddl.auto" value="create-drop" />
|
||||||
|
<property name="show_sql" value="false" />
|
||||||
|
<property name="hibernate.temp.use_jdbc_metadata_defaults"
|
||||||
|
value="false" />
|
||||||
|
<property name="javax.persistence.sql-load-script-source"
|
||||||
|
value="item.sql" />
|
||||||
|
</properties>
|
||||||
|
</persistence-unit>
|
||||||
|
|
||||||
|
<persistence-unit name="jpa-h2-multipltables">
|
||||||
|
<provider>org.hibernate.jpa.HibernatePersistenceProvider</provider>
|
||||||
|
<class>com.baeldung.jpa.multipletables.multipleentities.MealWithMultipleEntities</class>
|
||||||
|
<class>com.baeldung.jpa.multipletables.multipleentities.AllergensAsEntity</class>
|
||||||
|
|
||||||
|
<class>com.baeldung.jpa.multipletables.secondarytable.MealAsSingleEntity</class>
|
||||||
|
|
||||||
|
<class>com.baeldung.jpa.multipletables.secondarytable.embeddable.MealWithEmbeddedAllergens</class>
|
||||||
|
<class>com.baeldung.jpa.multipletables.secondarytable.embeddable.AllergensAsEmbeddable</class>
|
||||||
|
|
||||||
|
<exclude-unlisted-classes>true</exclude-unlisted-classes>
|
||||||
|
<properties>
|
||||||
|
<property name="javax.persistence.jdbc.driver"
|
||||||
|
value="org.h2.Driver" />
|
||||||
|
<property name="javax.persistence.jdbc.url"
|
||||||
|
value="jdbc:h2:mem:test" />
|
||||||
|
<property name="javax.persistence.jdbc.user" value="sa" />
|
||||||
|
<property name="javax.persistence.jdbc.password" value="" />
|
||||||
|
<property name="hibernate.dialect"
|
||||||
|
value="org.hibernate.dialect.H2Dialect" />
|
||||||
|
<property name="hibernate.hbm2ddl.auto" value="create" />
|
||||||
|
<property name="hibernate.hbm2ddl.import_files" value="multipletables.sql" />
|
||||||
|
<property name="show_sql" value="false" />
|
||||||
|
<property name="hibernate.temp.use_jdbc_metadata_defaults"
|
||||||
|
value="false" />
|
||||||
|
</properties>
|
||||||
|
</persistence-unit>
|
||||||
|
|
||||||
|
<persistence-unit name="jpa-h2-unrelated-entities">
|
||||||
|
<provider>org.hibernate.jpa.HibernatePersistenceProvider</provider>
|
||||||
|
<class>com.baeldung.jpa.unrelated.entities.Cocktail</class>
|
||||||
|
<class>com.baeldung.jpa.unrelated.entities.Recipe</class>
|
||||||
|
<class>com.baeldung.jpa.unrelated.entities.MultipleRecipe</class>
|
||||||
|
<exclude-unlisted-classes>true</exclude-unlisted-classes>
|
||||||
|
<properties>
|
||||||
|
<property name="javax.persistence.jdbc.driver"
|
||||||
|
value="org.h2.Driver" />
|
||||||
|
<property name="javax.persistence.jdbc.url"
|
||||||
|
value="jdbc:h2:mem:test" />
|
||||||
|
<property name="javax.persistence.jdbc.user" value="sa" />
|
||||||
|
<property name="javax.persistence.jdbc.password" value="" />
|
||||||
|
<property name="hibernate.dialect"
|
||||||
|
value="org.hibernate.dialect.H2Dialect" />
|
||||||
|
<property name="hibernate.hbm2ddl.auto" value="create" />
|
||||||
|
<property name="show_sql" value="false" />
|
||||||
|
<property name="hibernate.temp.use_jdbc_metadata_defaults"
|
||||||
|
value="false" />
|
||||||
|
</properties>
|
||||||
|
</persistence-unit>
|
||||||
|
|
||||||
|
<persistence-unit name="jpa-h2-primarykey">
|
||||||
|
<provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
|
||||||
|
<class>com.baeldung.jpa.generateidvalue.Admin</class>
|
||||||
|
<class>com.baeldung.jpa.generateidvalue.Article</class>
|
||||||
|
<class>com.baeldung.jpa.generateidvalue.IdGenerator</class>
|
||||||
|
<class>com.baeldung.jpa.generateidvalue.Task</class>
|
||||||
|
<class>com.baeldung.jpa.generateidvalue.User</class>
|
||||||
|
<exclude-unlisted-classes>true</exclude-unlisted-classes>
|
||||||
|
<properties>
|
||||||
|
<property name="javax.persistence.jdbc.driver"
|
||||||
|
value="org.h2.Driver" />
|
||||||
|
<property name="javax.persistence.jdbc.url"
|
||||||
|
value="jdbc:h2:mem:test" />
|
||||||
|
<property name="javax.persistence.jdbc.user" value="sa" />
|
||||||
|
<property name="javax.persistence.jdbc.password" value="" />
|
||||||
|
<property name="javax.persistence.sql-load-script-source"
|
||||||
|
value="primary_key_generator.sql" />
|
||||||
|
<property name="eclipselink.ddl-generation" value="create-or-extend-tables" />
|
||||||
|
<property name="eclipselink.ddl-generation.output-mode" value="database" />
|
||||||
|
<property name="eclipselink.weaving" value="static" />
|
||||||
|
<property name="eclipselink.logging.level" value="FINE" />
|
||||||
|
<property name="eclipselink.jdbc.allow-native-sql-queries" value="true" />
|
||||||
|
</properties>
|
||||||
|
</persistence-unit>
|
||||||
|
</persistence>
|
@ -0,0 +1,152 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<persistence xmlns="http://xmlns.jcp.org/xml/ns/persistence"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence
|
||||||
|
http://xmlns.jcp.org/xml/ns/persistence/persistence_2_2.xsd"
|
||||||
|
version="2.2">
|
||||||
|
<persistence-unit name="jpa-h2-equality">
|
||||||
|
<provider>org.hibernate.jpa.HibernatePersistenceProvider</provider>
|
||||||
|
<class>com.baeldung.jpa.equality.EqualByJavaDefault</class>
|
||||||
|
<class>com.baeldung.jpa.equality.EqualById</class>
|
||||||
|
<class>com.baeldung.jpa.equality.EqualByBusinessKey</class>
|
||||||
|
<exclude-unlisted-classes>true</exclude-unlisted-classes>
|
||||||
|
<properties>
|
||||||
|
<property name="javax.persistence.jdbc.driver" value="org.h2.Driver"/>
|
||||||
|
<property name="javax.persistence.jdbc.url" value="jdbc:h2:mem:test"/>
|
||||||
|
<property name="javax.persistence.jdbc.user" value="sa"/>
|
||||||
|
<property name="javax.persistence.jdbc.password" value=""/>
|
||||||
|
<property name="javax.persistence.jdbc.driver" value="org.h2.Driver"/>
|
||||||
|
<property name="hibernate.dialect" value="org.hibernate.dialect.H2Dialect"/>
|
||||||
|
<property name="hibernate.hbm2ddl.auto" value="create-drop"/>
|
||||||
|
<property name="show_sql" value="false"/>
|
||||||
|
<property name="hibernate.temp.use_jdbc_metadata_defaults" value="false"/>
|
||||||
|
</properties>
|
||||||
|
</persistence-unit>
|
||||||
|
<persistence-unit name="jpa-h2-removal">
|
||||||
|
<provider>org.hibernate.jpa.HibernatePersistenceProvider</provider>
|
||||||
|
<class>com.baeldung.jpa.removal.ShipmentInfo</class>
|
||||||
|
<class>com.baeldung.jpa.removal.LineItem</class>
|
||||||
|
<class>com.baeldung.jpa.removal.OrderRequest</class>
|
||||||
|
<exclude-unlisted-classes>true</exclude-unlisted-classes>
|
||||||
|
<properties>
|
||||||
|
<property name="javax.persistence.jdbc.driver" value="org.h2.Driver"/>
|
||||||
|
<property name="javax.persistence.jdbc.url" value="jdbc:h2:mem:test"/>
|
||||||
|
<property name="javax.persistence.jdbc.user" value="sa"/>
|
||||||
|
<property name="javax.persistence.jdbc.password" value=""/>
|
||||||
|
<property name="javax.persistence.jdbc.driver" value="org.h2.Driver"/>
|
||||||
|
<property name="hibernate.dialect" value="org.hibernate.dialect.H2Dialect"/>
|
||||||
|
<property name="hibernate.hbm2ddl.auto" value="create-drop"/>
|
||||||
|
<property name="show_sql" value="false"/>
|
||||||
|
<property name="hibernate.temp.use_jdbc_metadata_defaults" value="false"/>
|
||||||
|
</properties>
|
||||||
|
</persistence-unit>
|
||||||
|
<persistence-unit name="jpa-index">
|
||||||
|
<provider>org.hibernate.jpa.HibernatePersistenceProvider</provider>
|
||||||
|
<class>com.baeldung.jpa.index.Student</class>
|
||||||
|
<exclude-unlisted-classes>true</exclude-unlisted-classes>
|
||||||
|
<properties>
|
||||||
|
<property name="javax.persistence.jdbc.driver" value="org.h2.Driver" />
|
||||||
|
<property name="javax.persistence.jdbc.url" value="jdbc:h2:mem:test" />
|
||||||
|
<property name="javax.persistence.jdbc.user" value="sa" />
|
||||||
|
<property name="javax.persistence.jdbc.password" value="" />
|
||||||
|
<property name="hibernate.dialect" value="org.hibernate.dialect.H2Dialect" />
|
||||||
|
<property name="hibernate.hbm2ddl.auto" value="create-drop" />
|
||||||
|
<property name="show_sql" value="false" />
|
||||||
|
<property name="hibernate.temp.use_jdbc_metadata_defaults" value="false" />
|
||||||
|
</properties>
|
||||||
|
</persistence-unit>
|
||||||
|
<persistence-unit name="jpa-h2-multiple-bag-fetch-exception">
|
||||||
|
<provider>org.hibernate.jpa.HibernatePersistenceProvider</provider>
|
||||||
|
<class>com.baeldung.jpa.multiplebagfetchexception.Album</class>
|
||||||
|
<class>com.baeldung.jpa.multiplebagfetchexception.Song</class>
|
||||||
|
<class>com.baeldung.jpa.multiplebagfetchexception.User</class>
|
||||||
|
<class>com.baeldung.jpa.multiplebagfetchexception.Artist</class>
|
||||||
|
<class>com.baeldung.jpa.multiplebagfetchexception.Offer</class>
|
||||||
|
<class>com.baeldung.jpa.multiplebagfetchexception.Playlist</class>
|
||||||
|
<class>com.baeldung.jpa.multiplebagfetchexception.FavoriteSong</class>
|
||||||
|
<exclude-unlisted-classes>true</exclude-unlisted-classes>
|
||||||
|
<properties>
|
||||||
|
<property name="javax.persistence.jdbc.driver" value="org.h2.Driver"/>
|
||||||
|
<property name="javax.persistence.jdbc.url" value="jdbc:h2:mem:test"/>
|
||||||
|
<property name="javax.persistence.jdbc.user" value="sa"/>
|
||||||
|
<property name="javax.persistence.jdbc.password" value=""/>
|
||||||
|
<property name="javax.persistence.jdbc.driver" value="org.h2.Driver"/>
|
||||||
|
<property name="hibernate.dialect" value="org.hibernate.dialect.H2Dialect"/>
|
||||||
|
<property name="hibernate.hbm2ddl.auto" value="create-drop"/>
|
||||||
|
<property name="show_sql" value="false"/>
|
||||||
|
<property name="hibernate.temp.use_jdbc_metadata_defaults" value="false"/>
|
||||||
|
</properties>
|
||||||
|
</persistence-unit>
|
||||||
|
<persistence-unit name="jpa-h2-hibernate-unproxy">
|
||||||
|
<provider>org.hibernate.jpa.HibernatePersistenceProvider</provider>
|
||||||
|
<class>com.baeldung.jpa.hibernateunproxy.Payment</class>
|
||||||
|
<class>com.baeldung.jpa.hibernateunproxy.CreditCardPayment</class>
|
||||||
|
<class>com.baeldung.jpa.hibernateunproxy.PaymentReceipt</class>
|
||||||
|
<class>com.baeldung.jpa.hibernateunproxy.WebUser</class>
|
||||||
|
<exclude-unlisted-classes>true</exclude-unlisted-classes>
|
||||||
|
<properties>
|
||||||
|
<property name="javax.persistence.jdbc.driver" value="org.h2.Driver"/>
|
||||||
|
<property name="javax.persistence.jdbc.url" value="jdbc:h2:mem:test"/>
|
||||||
|
<property name="javax.persistence.jdbc.user" value="sa"/>
|
||||||
|
<property name="javax.persistence.jdbc.password" value=""/>
|
||||||
|
<property name="javax.persistence.jdbc.driver" value="org.h2.Driver"/>
|
||||||
|
<property name="hibernate.dialect" value="org.hibernate.dialect.H2Dialect"/>
|
||||||
|
<property name="hibernate.hbm2ddl.auto" value="create-drop"/>
|
||||||
|
<property name="hibernate.show_sql" value="false"/>
|
||||||
|
<property name="hibernate.format_sql" value="true"/>
|
||||||
|
<property name="hibernate.temp.use_jdbc_metadata_defaults" value="false"/>
|
||||||
|
</properties>
|
||||||
|
</persistence-unit>
|
||||||
|
|
||||||
|
<persistence-unit name="jpa-h2-id-generation">
|
||||||
|
<provider>org.hibernate.jpa.HibernatePersistenceProvider</provider>
|
||||||
|
<class>com.baeldung.jpa.IdGeneration.User</class>
|
||||||
|
<exclude-unlisted-classes>true</exclude-unlisted-classes>
|
||||||
|
<properties>
|
||||||
|
<property name="javax.persistence.jdbc.driver" value="org.h2.Driver"/>
|
||||||
|
<property name="javax.persistence.jdbc.url" value="jdbc:h2:mem:idGen"/>
|
||||||
|
<property name="javax.persistence.jdbc.user" value="sa"/>
|
||||||
|
<property name="javax.persistence.jdbc.password" value=""/>
|
||||||
|
<property name="hibernate.dialect" value="org.hibernate.dialect.H2Dialect"/>
|
||||||
|
<property name="hibernate.hbm2ddl.auto" value="create-drop"/>
|
||||||
|
<property name="hibernate.format_sql" value="true"/>
|
||||||
|
<property name="hibernate.temp.use_jdbc_metadata_defaults" value="false"/>
|
||||||
|
</properties>
|
||||||
|
</persistence-unit>
|
||||||
|
<persistence-unit name="jpa-unique-constraints">
|
||||||
|
<provider>org.hibernate.jpa.HibernatePersistenceProvider</provider>
|
||||||
|
<class>com.baeldung.jpa.uniqueconstraints.Person</class>
|
||||||
|
<class>com.baeldung.jpa.uniqueconstraints.Address</class>
|
||||||
|
<exclude-unlisted-classes>true</exclude-unlisted-classes>
|
||||||
|
<properties>
|
||||||
|
<property name="javax.persistence.jdbc.driver" value="org.h2.Driver" />
|
||||||
|
<property name="javax.persistence.jdbc.url" value="jdbc:h2:mem:test" />
|
||||||
|
<property name="javax.persistence.jdbc.user" value="sa" />
|
||||||
|
<property name="javax.persistence.jdbc.password" value="" />
|
||||||
|
<property name="hibernate.dialect" value="org.hibernate.dialect.H2Dialect" />
|
||||||
|
<property name="hibernate.hbm2ddl.auto" value="create-drop" />
|
||||||
|
<property name="show_sql" value="false" />
|
||||||
|
<property name="hibernate.temp.use_jdbc_metadata_defaults" value="false" />
|
||||||
|
</properties>
|
||||||
|
</persistence-unit>
|
||||||
|
<persistence-unit name="jpa-h2-return-multiple-entities">
|
||||||
|
<provider>org.hibernate.jpa.HibernatePersistenceProvider</provider>
|
||||||
|
<class>com.baeldung.jpa.returnmultipleentities.Channel</class>
|
||||||
|
<class>com.baeldung.jpa.returnmultipleentities.Subscription</class>
|
||||||
|
<class>com.baeldung.jpa.returnmultipleentities.User</class>
|
||||||
|
<class>com.baeldung.jpa.returnmultipleentities.ReportRepository</class>
|
||||||
|
<exclude-unlisted-classes>true</exclude-unlisted-classes>
|
||||||
|
<properties>
|
||||||
|
<property name="javax.persistence.jdbc.driver" value="org.h2.Driver"/>
|
||||||
|
<property name="javax.persistence.jdbc.url" value="jdbc:h2:mem:test"/>
|
||||||
|
<property name="javax.persistence.jdbc.user" value="sa"/>
|
||||||
|
<property name="javax.persistence.jdbc.password" value=""/>
|
||||||
|
<property name="javax.persistence.jdbc.driver" value="org.h2.Driver"/>
|
||||||
|
<property name="hibernate.dialect" value="org.hibernate.dialect.H2Dialect"/>
|
||||||
|
<property name="hibernate.hbm2ddl.auto" value="create-drop"/>
|
||||||
|
<property name="hibernate.show_sql" value="false"/>
|
||||||
|
<property name="hibernate.format_sql" value="true"/>
|
||||||
|
<property name="hibernate.temp.use_jdbc_metadata_defaults" value="false"/>
|
||||||
|
</properties>
|
||||||
|
</persistence-unit>
|
||||||
|
</persistence>
|
@ -0,0 +1,15 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<configuration>
|
||||||
|
<appender name="STDOUT"
|
||||||
|
class="ch.qos.logback.core.ConsoleAppender">
|
||||||
|
<encoder>
|
||||||
|
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} -
|
||||||
|
%msg%n
|
||||||
|
</pattern>
|
||||||
|
</encoder>
|
||||||
|
</appender>
|
||||||
|
<logger name="org.hibernate.SQL" level="INFO" />
|
||||||
|
<root level="INFO">
|
||||||
|
<appender-ref ref="STDOUT" />
|
||||||
|
</root>
|
||||||
|
</configuration>
|
@ -14,4 +14,4 @@ This module contains articles about the Java Persistence API (JPA) in Java.
|
|||||||
- [Defining JPA Entities](https://www.baeldung.com/jpa-entities)
|
- [Defining JPA Entities](https://www.baeldung.com/jpa-entities)
|
||||||
- [JPA @Basic Annotation](https://www.baeldung.com/jpa-basic-annotation)
|
- [JPA @Basic Annotation](https://www.baeldung.com/jpa-basic-annotation)
|
||||||
- [Persisting Enums in JPA](https://www.baeldung.com/jpa-persisting-enums-in-jpa)
|
- [Persisting Enums in JPA](https://www.baeldung.com/jpa-persisting-enums-in-jpa)
|
||||||
- More articles: [[next -->]](/java-jpa-2)
|
- More articles: [[next -->]](/persistence-modules/java-jpa-2)
|
||||||
|
@ -50,7 +50,7 @@ public class QueryXmlResourceWithConcurrentAxisIntegrationTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void createDatabaseAndXMarkResourceAndCheckQuery() throws IOException {
|
public void createDatabaseAndXMarkResourceAndCheckQuery() throws IOException {
|
||||||
final var pathToXmlFile = XML_DIRECTORY.resolve("10mb.xml");
|
final var pathToXmlFile = XML_DIRECTORY.resolve("regions.xml");
|
||||||
|
|
||||||
// Create an empty XML database.
|
// Create an empty XML database.
|
||||||
Databases.createXmlDatabase(new DatabaseConfiguration(DATABASE_PATH));
|
Databases.createXmlDatabase(new DatabaseConfiguration(DATABASE_PATH));
|
||||||
|
8819
persistence-modules/sirix/src/test/resources/xml/regions.xml
Normal file
8819
persistence-modules/sirix/src/test/resources/xml/regions.xml
Normal file
File diff suppressed because it is too large
Load Diff
@ -8,7 +8,7 @@ spring.h2.console.path=/h2-console
|
|||||||
spring.datasource.data=data-trans.sql
|
spring.datasource.data=data-trans.sql
|
||||||
|
|
||||||
logging.level.org.hibernate.SQL=INFO
|
logging.level.org.hibernate.SQL=INFO
|
||||||
logging.level.org.hibernate.type=TRACE
|
logging.level.org.hibernate.type=INFO
|
||||||
spring.jpa.properties.hibernate.validator.apply_to_ddl=false
|
spring.jpa.properties.hibernate.validator.apply_to_ddl=false
|
||||||
spring.jpa.properties.hibernate.enable_lazy_load_no_trans=false
|
spring.jpa.properties.hibernate.enable_lazy_load_no_trans=false
|
||||||
spring.jpa.open-in-view=false
|
spring.jpa.open-in-view=false
|
@ -8,7 +8,7 @@ spring.h2.console.path=/h2-console
|
|||||||
spring.datasource.data=data-trans.sql
|
spring.datasource.data=data-trans.sql
|
||||||
|
|
||||||
logging.level.org.hibernate.SQL=INFO
|
logging.level.org.hibernate.SQL=INFO
|
||||||
logging.level.org.hibernate.type=TRACE
|
logging.level.org.hibernate.type=INFO
|
||||||
spring.jpa.properties.hibernate.validator.apply_to_ddl=false
|
spring.jpa.properties.hibernate.validator.apply_to_ddl=false
|
||||||
spring.jpa.properties.hibernate.enable_lazy_load_no_trans=true
|
spring.jpa.properties.hibernate.enable_lazy_load_no_trans=true
|
||||||
spring.jpa.open-in-view=false
|
spring.jpa.open-in-view=false
|
@ -13,6 +13,7 @@ public class User {
|
|||||||
@Id
|
@Id
|
||||||
@GeneratedValue(strategy = GenerationType.AUTO)
|
@GeneratedValue(strategy = GenerationType.AUTO)
|
||||||
private long id;
|
private long id;
|
||||||
|
private long status;
|
||||||
private String name;
|
private String name;
|
||||||
private String email;
|
private String email;
|
||||||
|
|
||||||
@ -39,6 +40,14 @@ public class User {
|
|||||||
this.email = email;
|
this.email = email;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setStatus(long status) {
|
||||||
|
this.status = status;
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getStatus() {
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "User{" + "id=" + id + ", name=" + name + ", email=" + email + '}';
|
return "User{" + "id=" + id + ", name=" + name + ", email=" + email + '}';
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
drop table if exists USERS;
|
drop table if exists USERS;
|
||||||
drop table if exists country;
|
drop table if exists country;
|
||||||
|
drop table if exists BOOK;
|
||||||
|
|
||||||
create table USERS(
|
create table USERS(
|
||||||
ID int not null AUTO_INCREMENT,
|
ID int not null AUTO_INCREMENT,
|
||||||
@ -13,3 +14,9 @@ CREATE TABLE country (
|
|||||||
name VARCHAR(128) NOT NULL,
|
name VARCHAR(128) NOT NULL,
|
||||||
PRIMARY KEY (id)
|
PRIMARY KEY (id)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
create table BOOK(
|
||||||
|
ID int not null AUTO_INCREMENT,
|
||||||
|
NAME varchar(128) not null,
|
||||||
|
PRIMARY KEY ( ID )
|
||||||
|
);
|
||||||
|
@ -12,5 +12,5 @@ hibernate.cache.use_second_level_cache=true
|
|||||||
hibernate.cache.use_query_cache=true
|
hibernate.cache.use_query_cache=true
|
||||||
hibernate.cache.region.factory_class=org.hibernate.cache.ehcache.EhCacheRegionFactory
|
hibernate.cache.region.factory_class=org.hibernate.cache.ehcache.EhCacheRegionFactory
|
||||||
|
|
||||||
spring.jpa.properties.hibernate.hbm2ddl.import_files=migrated_users.sql, import_books.sql
|
spring.jpa.properties.hibernate.hbm2ddl.import_files=import_books.sql
|
||||||
spring.datasource.data=import_*_users.sql
|
spring.datasource.data=import_*_users.sql
|
@ -16,8 +16,11 @@ import static org.junit.jupiter.api.Assertions.assertFalse;
|
|||||||
import static org.junit.jupiter.api.Assertions.assertNotNull;
|
import static org.junit.jupiter.api.Assertions.assertNotNull;
|
||||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ArangoDB server should be up and running for this test case to run successfully
|
||||||
|
*/
|
||||||
@SpringBootTest
|
@SpringBootTest
|
||||||
public class ArticleRepositoryIntegrationTest {
|
public class ArticleRepositoryLiveTest {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
ArticleRepository articleRepository;
|
ArticleRepository articleRepository;
|
@ -124,7 +124,7 @@ public class ZipsAggregationLiveTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void whenStateWithLowestAvgCityPopIsND_theSuccess() {
|
public void whenStateWithLowestAvgCityPopIsME_theSuccess() {
|
||||||
|
|
||||||
GroupOperation sumTotalCityPop = group("state", "city").sum("pop").as("cityPop");
|
GroupOperation sumTotalCityPop = group("state", "city").sum("pop").as("cityPop");
|
||||||
GroupOperation averageStatePop = group("_id.state").avg("cityPop").as("avgCityPop");
|
GroupOperation averageStatePop = group("_id.state").avg("cityPop").as("avgCityPop");
|
||||||
@ -138,13 +138,12 @@ public class ZipsAggregationLiveTest {
|
|||||||
AggregationResults<StatePopulation> result = mongoTemplate.aggregate(aggregation, "zips", StatePopulation.class);
|
AggregationResults<StatePopulation> result = mongoTemplate.aggregate(aggregation, "zips", StatePopulation.class);
|
||||||
StatePopulation smallestState = result.getUniqueMappedResult();
|
StatePopulation smallestState = result.getUniqueMappedResult();
|
||||||
|
|
||||||
assertEquals("ND", smallestState.getState());
|
assertEquals("ME", smallestState.getState());
|
||||||
assertTrue(smallestState.getStatePop()
|
assertEquals(3676, smallestState.getStatePop().longValue());
|
||||||
.equals(1645));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void whenMaxTXAndMinDC_theSuccess() {
|
public void whenMaxMAAndMinRI_theSuccess() {
|
||||||
|
|
||||||
GroupOperation sumZips = group("state").count().as("zipCount");
|
GroupOperation sumZips = group("state").count().as("zipCount");
|
||||||
SortOperation sortByCount = sort(Direction.ASC, "zipCount");
|
SortOperation sortByCount = sort(Direction.ASC, "zipCount");
|
||||||
@ -157,10 +156,10 @@ public class ZipsAggregationLiveTest {
|
|||||||
AggregationResults<Document> result = mongoTemplate.aggregate(aggregation, "zips", Document.class);
|
AggregationResults<Document> result = mongoTemplate.aggregate(aggregation, "zips", Document.class);
|
||||||
Document document = result.getUniqueMappedResult();
|
Document document = result.getUniqueMappedResult();
|
||||||
|
|
||||||
assertEquals("DC", document.get("minZipState"));
|
assertEquals("RI", document.get("minZipState"));
|
||||||
assertEquals(24, document.get("minZipCount"));
|
assertEquals(69, document.get("minZipCount"));
|
||||||
assertEquals("TX", document.get("maxZipState"));
|
assertEquals("MA", document.get("maxZipState"));
|
||||||
assertEquals(1671, document.get("maxZipCount"));
|
assertEquals(474, document.get("maxZipCount"));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
1000
persistence-modules/spring-data-mongodb/src/test/resources/zips.json
Normal file
1000
persistence-modules/spring-data-mongodb/src/test/resources/zips.json
Normal file
File diff suppressed because it is too large
Load Diff
@ -24,10 +24,6 @@
|
|||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-starter-data-couchbase-reactive</artifactId>
|
<artifactId>spring-boot-starter-data-couchbase-reactive</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
|
||||||
<groupId>org.springframework.boot</groupId>
|
|
||||||
<artifactId>spring-boot-starter-data-mongodb-reactive</artifactId>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-starter-web</artifactId>
|
<artifactId>spring-boot-starter-web</artifactId>
|
||||||
@ -54,11 +50,6 @@
|
|||||||
<artifactId>spring-boot-starter-test</artifactId>
|
<artifactId>spring-boot-starter-test</artifactId>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
|
||||||
<groupId>de.flapdoodle.embed</groupId>
|
|
||||||
<artifactId>de.flapdoodle.embed.mongo</artifactId>
|
|
||||||
<scope>test</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-starter-webflux</artifactId>
|
<artifactId>spring-boot-starter-webflux</artifactId>
|
||||||
|
@ -1,25 +0,0 @@
|
|||||||
package com.baeldung.reactive;
|
|
||||||
|
|
||||||
import com.mongodb.reactivestreams.client.MongoClient;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.boot.SpringApplication;
|
|
||||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
|
||||||
import org.springframework.context.annotation.Bean;
|
|
||||||
import org.springframework.data.mongodb.core.ReactiveMongoTemplate;
|
|
||||||
|
|
||||||
@SpringBootApplication
|
|
||||||
public class Spring5ReactiveApplication{
|
|
||||||
|
|
||||||
public static void main(String[] args) {
|
|
||||||
SpringApplication.run(Spring5ReactiveApplication.class, args);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
MongoClient mongoClient;
|
|
||||||
|
|
||||||
@Bean
|
|
||||||
public ReactiveMongoTemplate reactiveMongoTemplate() {
|
|
||||||
return new ReactiveMongoTemplate(mongoClient, "test");
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,21 +0,0 @@
|
|||||||
package com.baeldung.reactive.model;
|
|
||||||
|
|
||||||
import lombok.AllArgsConstructor;
|
|
||||||
import lombok.Data;
|
|
||||||
import lombok.NoArgsConstructor;
|
|
||||||
import lombok.ToString;
|
|
||||||
import org.springframework.data.annotation.Id;
|
|
||||||
import org.springframework.data.mongodb.core.mapping.Document;
|
|
||||||
|
|
||||||
@Document
|
|
||||||
@Data
|
|
||||||
@ToString
|
|
||||||
@AllArgsConstructor
|
|
||||||
@NoArgsConstructor
|
|
||||||
public class Account {
|
|
||||||
|
|
||||||
@Id
|
|
||||||
private String id;
|
|
||||||
private String owner;
|
|
||||||
private Double value;
|
|
||||||
}
|
|
@ -1,15 +0,0 @@
|
|||||||
package com.baeldung.reactive.repository;
|
|
||||||
|
|
||||||
import com.baeldung.reactive.model.Account;
|
|
||||||
import org.springframework.data.repository.reactive.ReactiveCrudRepository;
|
|
||||||
import org.springframework.stereotype.Repository;
|
|
||||||
import reactor.core.publisher.Flux;
|
|
||||||
import reactor.core.publisher.Mono;
|
|
||||||
|
|
||||||
@Repository
|
|
||||||
public interface AccountCrudRepository extends ReactiveCrudRepository<Account, String> {
|
|
||||||
|
|
||||||
public Flux<Account> findAllByValue(Double value);
|
|
||||||
|
|
||||||
public Mono<Account> findFirstByOwner(Mono<String> owner);
|
|
||||||
}
|
|
@ -1,7 +0,0 @@
|
|||||||
package com.baeldung.reactive.repository;
|
|
||||||
|
|
||||||
import com.baeldung.reactive.model.Account;
|
|
||||||
import org.springframework.data.mongodb.repository.ReactiveMongoRepository;
|
|
||||||
|
|
||||||
public interface AccountMongoRepository extends ReactiveMongoRepository<Account, String> {
|
|
||||||
}
|
|
@ -1,15 +0,0 @@
|
|||||||
package com.baeldung.reactive.repository;
|
|
||||||
|
|
||||||
import com.baeldung.reactive.model.Account;
|
|
||||||
import io.reactivex.Observable;
|
|
||||||
import io.reactivex.Single;
|
|
||||||
import org.springframework.data.repository.reactive.RxJava2CrudRepository;
|
|
||||||
import org.springframework.stereotype.Repository;
|
|
||||||
|
|
||||||
@Repository
|
|
||||||
public interface AccountRxJavaRepository extends RxJava2CrudRepository<Account, String>{
|
|
||||||
|
|
||||||
public Observable<Account> findAllByValue(Double value);
|
|
||||||
|
|
||||||
public Single<Account> findFirstByOwner(Single<String> owner);
|
|
||||||
}
|
|
@ -1,33 +0,0 @@
|
|||||||
package com.baeldung.reactive.template;
|
|
||||||
|
|
||||||
import com.baeldung.reactive.model.Account;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.data.mongodb.core.ReactiveMongoTemplate;
|
|
||||||
import org.springframework.data.mongodb.core.ReactiveRemoveOperation;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
import reactor.core.publisher.Flux;
|
|
||||||
import reactor.core.publisher.Mono;
|
|
||||||
|
|
||||||
@Service
|
|
||||||
public class AccountTemplateOperations {
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
ReactiveMongoTemplate template;
|
|
||||||
|
|
||||||
public Mono<Account> findById(String id) {
|
|
||||||
return template.findById(id, Account.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
public Flux<Account> findAll() {
|
|
||||||
return template.findAll(Account.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
public Mono<Account> save(Mono<Account> account) {
|
|
||||||
return template.save(account);
|
|
||||||
}
|
|
||||||
|
|
||||||
public ReactiveRemoveOperation.ReactiveRemove<Account> deleteAll() {
|
|
||||||
return template.remove(Account.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,11 +0,0 @@
|
|||||||
package com.baeldung.tailablecursor;
|
|
||||||
|
|
||||||
import org.springframework.boot.SpringApplication;
|
|
||||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
|
||||||
|
|
||||||
@SpringBootApplication
|
|
||||||
public class LogsCounterApplication {
|
|
||||||
public static void main(String[] args) {
|
|
||||||
SpringApplication.run(LogsCounterApplication.class, args);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,21 +0,0 @@
|
|||||||
package com.baeldung.tailablecursor.domain;
|
|
||||||
|
|
||||||
import lombok.AllArgsConstructor;
|
|
||||||
import lombok.Builder;
|
|
||||||
import lombok.Data;
|
|
||||||
import lombok.NoArgsConstructor;
|
|
||||||
import org.springframework.data.annotation.Id;
|
|
||||||
import org.springframework.data.mongodb.core.mapping.Document;
|
|
||||||
|
|
||||||
@Data
|
|
||||||
@Document
|
|
||||||
@Builder
|
|
||||||
@NoArgsConstructor
|
|
||||||
@AllArgsConstructor
|
|
||||||
public class Log {
|
|
||||||
@Id
|
|
||||||
private String id;
|
|
||||||
private String service;
|
|
||||||
private LogLevel level;
|
|
||||||
private String message;
|
|
||||||
}
|
|
@ -1,5 +0,0 @@
|
|||||||
package com.baeldung.tailablecursor.domain;
|
|
||||||
|
|
||||||
public enum LogLevel {
|
|
||||||
ERROR, WARN, INFO
|
|
||||||
}
|
|
@ -1,12 +0,0 @@
|
|||||||
package com.baeldung.tailablecursor.repository;
|
|
||||||
|
|
||||||
import com.baeldung.tailablecursor.domain.Log;
|
|
||||||
import com.baeldung.tailablecursor.domain.LogLevel;
|
|
||||||
import org.springframework.data.mongodb.repository.Tailable;
|
|
||||||
import org.springframework.data.repository.reactive.ReactiveCrudRepository;
|
|
||||||
import reactor.core.publisher.Flux;
|
|
||||||
|
|
||||||
public interface LogsRepository extends ReactiveCrudRepository<Log, String> {
|
|
||||||
@Tailable
|
|
||||||
Flux<Log> findByLevel(LogLevel level);
|
|
||||||
}
|
|
@ -1,62 +0,0 @@
|
|||||||
package com.baeldung.tailablecursor.service;
|
|
||||||
|
|
||||||
import com.baeldung.tailablecursor.domain.Log;
|
|
||||||
import com.baeldung.tailablecursor.domain.LogLevel;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
import org.springframework.data.mongodb.core.MongoTemplate;
|
|
||||||
import org.springframework.data.mongodb.core.mapping.Document;
|
|
||||||
import org.springframework.data.mongodb.core.messaging.DefaultMessageListenerContainer;
|
|
||||||
import org.springframework.data.mongodb.core.messaging.MessageListener;
|
|
||||||
import org.springframework.data.mongodb.core.messaging.MessageListenerContainer;
|
|
||||||
import org.springframework.data.mongodb.core.messaging.TailableCursorRequest;
|
|
||||||
|
|
||||||
import javax.annotation.PreDestroy;
|
|
||||||
import java.util.concurrent.atomic.AtomicInteger;
|
|
||||||
|
|
||||||
import static org.springframework.data.mongodb.core.query.Criteria.where;
|
|
||||||
import static org.springframework.data.mongodb.core.query.Query.query;
|
|
||||||
|
|
||||||
@Slf4j
|
|
||||||
public class ErrorLogsCounter implements LogsCounter {
|
|
||||||
|
|
||||||
private static final String LEVEL_FIELD_NAME = "level";
|
|
||||||
|
|
||||||
private final String collectionName;
|
|
||||||
private final MessageListenerContainer container;
|
|
||||||
|
|
||||||
private final AtomicInteger counter = new AtomicInteger();
|
|
||||||
|
|
||||||
public ErrorLogsCounter(MongoTemplate mongoTemplate,
|
|
||||||
String collectionName) {
|
|
||||||
this.collectionName = collectionName;
|
|
||||||
this.container = new DefaultMessageListenerContainer(mongoTemplate);
|
|
||||||
|
|
||||||
container.start();
|
|
||||||
TailableCursorRequest<Log> request = getTailableCursorRequest();
|
|
||||||
container.register(request, Log.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
private TailableCursorRequest<Log> getTailableCursorRequest() {
|
|
||||||
MessageListener<Document, Log> listener = message -> {
|
|
||||||
log.info("ERROR log received: {}", message.getBody());
|
|
||||||
counter.incrementAndGet();
|
|
||||||
};
|
|
||||||
|
|
||||||
return TailableCursorRequest.builder()
|
|
||||||
.collection(collectionName)
|
|
||||||
.filter(query(where(LEVEL_FIELD_NAME).is(LogLevel.ERROR)))
|
|
||||||
.publishTo(listener)
|
|
||||||
.build();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int count() {
|
|
||||||
return counter.get();
|
|
||||||
}
|
|
||||||
|
|
||||||
@PreDestroy
|
|
||||||
public void close() {
|
|
||||||
container.stop();
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,36 +0,0 @@
|
|||||||
package com.baeldung.tailablecursor.service;
|
|
||||||
|
|
||||||
import com.baeldung.tailablecursor.domain.Log;
|
|
||||||
import com.baeldung.tailablecursor.domain.LogLevel;
|
|
||||||
import com.baeldung.tailablecursor.repository.LogsRepository;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
import reactor.core.Disposable;
|
|
||||||
import reactor.core.publisher.Flux;
|
|
||||||
|
|
||||||
import javax.annotation.PreDestroy;
|
|
||||||
import java.util.concurrent.atomic.AtomicInteger;
|
|
||||||
|
|
||||||
@Slf4j
|
|
||||||
public class InfoLogsCounter implements LogsCounter {
|
|
||||||
|
|
||||||
private final AtomicInteger counter = new AtomicInteger();
|
|
||||||
private final Disposable subscription;
|
|
||||||
|
|
||||||
public InfoLogsCounter(LogsRepository repository) {
|
|
||||||
Flux<Log> stream = repository.findByLevel(LogLevel.INFO);
|
|
||||||
this.subscription = stream.subscribe(logEntity -> {
|
|
||||||
log.info("INFO log received: " + logEntity);
|
|
||||||
counter.incrementAndGet();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int count() {
|
|
||||||
return this.counter.get();
|
|
||||||
}
|
|
||||||
|
|
||||||
@PreDestroy
|
|
||||||
public void close() {
|
|
||||||
this.subscription.dispose();
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,5 +0,0 @@
|
|||||||
package com.baeldung.tailablecursor.service;
|
|
||||||
|
|
||||||
public interface LogsCounter {
|
|
||||||
int count();
|
|
||||||
}
|
|
@ -1,41 +0,0 @@
|
|||||||
package com.baeldung.tailablecursor.service;
|
|
||||||
|
|
||||||
import com.baeldung.tailablecursor.domain.Log;
|
|
||||||
import com.baeldung.tailablecursor.domain.LogLevel;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
import org.springframework.data.mongodb.core.ReactiveMongoOperations;
|
|
||||||
import reactor.core.Disposable;
|
|
||||||
import reactor.core.publisher.Flux;
|
|
||||||
|
|
||||||
import javax.annotation.PreDestroy;
|
|
||||||
import java.util.concurrent.atomic.AtomicInteger;
|
|
||||||
|
|
||||||
import static org.springframework.data.mongodb.core.query.Criteria.where;
|
|
||||||
import static org.springframework.data.mongodb.core.query.Query.query;
|
|
||||||
|
|
||||||
@Slf4j
|
|
||||||
public class WarnLogsCounter implements LogsCounter {
|
|
||||||
|
|
||||||
private static final String LEVEL_FIELD_NAME = "level";
|
|
||||||
|
|
||||||
private final AtomicInteger counter = new AtomicInteger();
|
|
||||||
private final Disposable subscription;
|
|
||||||
|
|
||||||
public WarnLogsCounter(ReactiveMongoOperations template) {
|
|
||||||
Flux<Log> stream = template.tail(query(where(LEVEL_FIELD_NAME).is(LogLevel.WARN)), Log.class);
|
|
||||||
subscription = stream.subscribe(logEntity -> {
|
|
||||||
log.warn("WARN log received: " + logEntity);
|
|
||||||
counter.incrementAndGet();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int count() {
|
|
||||||
return counter.get();
|
|
||||||
}
|
|
||||||
|
|
||||||
@PreDestroy
|
|
||||||
public void close() {
|
|
||||||
subscription.dispose();
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,17 +0,0 @@
|
|||||||
package com.baeldung;
|
|
||||||
|
|
||||||
import org.junit.Test;
|
|
||||||
import org.junit.runner.RunWith;
|
|
||||||
import org.springframework.boot.test.context.SpringBootTest;
|
|
||||||
import org.springframework.test.context.junit4.SpringRunner;
|
|
||||||
|
|
||||||
import com.baeldung.reactive.Spring5ReactiveApplication;
|
|
||||||
|
|
||||||
@RunWith(SpringRunner.class)
|
|
||||||
@SpringBootTest(classes = Spring5ReactiveApplication.class)
|
|
||||||
public class SpringContextTest {
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void whenSpringContextIsBootstrapped_thenNoExceptions() {
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,70 +0,0 @@
|
|||||||
package com.baeldung.reactive.repository;
|
|
||||||
|
|
||||||
|
|
||||||
import com.baeldung.reactive.Spring5ReactiveApplication;
|
|
||||||
import com.baeldung.reactive.model.Account;
|
|
||||||
import org.junit.Test;
|
|
||||||
import org.junit.runner.RunWith;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.boot.test.context.SpringBootTest;
|
|
||||||
import org.springframework.test.context.junit4.SpringRunner;
|
|
||||||
import reactor.core.publisher.Flux;
|
|
||||||
import reactor.core.publisher.Mono;
|
|
||||||
import reactor.test.StepVerifier;
|
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
|
||||||
import static org.junit.Assert.assertNotNull;
|
|
||||||
|
|
||||||
@RunWith(SpringRunner.class)
|
|
||||||
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = Spring5ReactiveApplication.class)
|
|
||||||
public class AccountCrudRepositoryManualTest {
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
AccountCrudRepository repository;
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void givenValue_whenFindAllByValue_thenFindAccount() {
|
|
||||||
repository.save(new Account(null, "Bill", 12.3)).block();
|
|
||||||
Flux<Account> accountFlux = repository.findAllByValue(12.3);
|
|
||||||
|
|
||||||
StepVerifier.create(accountFlux)
|
|
||||||
.assertNext(account -> {
|
|
||||||
assertEquals("Bill", account.getOwner());
|
|
||||||
assertEquals(Double.valueOf(12.3) , account.getValue());
|
|
||||||
assertNotNull(account.getId());
|
|
||||||
})
|
|
||||||
.expectComplete()
|
|
||||||
.verify();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void givenOwner_whenFindFirstByOwner_thenFindAccount() {
|
|
||||||
repository.save(new Account(null, "Bill", 12.3)).block();
|
|
||||||
Mono<Account> accountMono = repository.findFirstByOwner(Mono.just("Bill"));
|
|
||||||
|
|
||||||
StepVerifier.create(accountMono)
|
|
||||||
.assertNext(account -> {
|
|
||||||
assertEquals("Bill", account.getOwner());
|
|
||||||
assertEquals(Double.valueOf(12.3) , account.getValue());
|
|
||||||
assertNotNull(account.getId());
|
|
||||||
})
|
|
||||||
.expectComplete()
|
|
||||||
.verify();
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void givenAccount_whenSave_thenSaveAccount() {
|
|
||||||
Mono<Account> accountMono = repository.save(new Account(null, "Bill", 12.3));
|
|
||||||
|
|
||||||
StepVerifier
|
|
||||||
.create(accountMono)
|
|
||||||
.assertNext(account -> assertNotNull(account.getId()))
|
|
||||||
.expectComplete()
|
|
||||||
.verify();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
@ -1,67 +0,0 @@
|
|||||||
package com.baeldung.reactive.repository;
|
|
||||||
|
|
||||||
import com.baeldung.reactive.Spring5ReactiveApplication;
|
|
||||||
import com.baeldung.reactive.model.Account;
|
|
||||||
import org.junit.Test;
|
|
||||||
import org.junit.runner.RunWith;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.boot.test.context.SpringBootTest;
|
|
||||||
import org.springframework.data.domain.Example;
|
|
||||||
import org.springframework.data.domain.ExampleMatcher;
|
|
||||||
import org.springframework.test.context.junit4.SpringRunner;
|
|
||||||
import reactor.core.publisher.Flux;
|
|
||||||
import reactor.core.publisher.Mono;
|
|
||||||
import reactor.test.StepVerifier;
|
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
|
||||||
import static org.junit.Assert.assertNotNull;
|
|
||||||
import static org.springframework.data.domain.ExampleMatcher.GenericPropertyMatchers.startsWith;
|
|
||||||
|
|
||||||
@RunWith(SpringRunner.class)
|
|
||||||
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = Spring5ReactiveApplication.class)
|
|
||||||
public class AccountMongoRepositoryManualTest {
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
AccountMongoRepository repository;
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void givenExample_whenFindAllWithExample_thenFindAllMacthings() {
|
|
||||||
repository.save(new Account(null, "john", 12.3)).block();
|
|
||||||
ExampleMatcher matcher = ExampleMatcher.matching().withMatcher("owner", startsWith());
|
|
||||||
Example<Account> example = Example.of(new Account(null, "jo", null), matcher);
|
|
||||||
Flux<Account> accountFlux = repository.findAll(example);
|
|
||||||
|
|
||||||
StepVerifier
|
|
||||||
.create(accountFlux)
|
|
||||||
.assertNext(account -> assertEquals("john", account.getOwner()))
|
|
||||||
.expectComplete()
|
|
||||||
.verify();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void givenAccount_whenSave_thenSave() {
|
|
||||||
Mono<Account> accountMono = repository.save(new Account(null, "john", 12.3));
|
|
||||||
|
|
||||||
StepVerifier
|
|
||||||
.create(accountMono)
|
|
||||||
.assertNext(account -> assertNotNull(account.getId()))
|
|
||||||
.expectComplete()
|
|
||||||
.verify();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void givenId_whenFindById_thenFindAccount() {
|
|
||||||
Account inserted = repository.save(new Account(null, "john", 12.3)).block();
|
|
||||||
Mono<Account> accountMono = repository.findById(inserted.getId());
|
|
||||||
|
|
||||||
StepVerifier
|
|
||||||
.create(accountMono)
|
|
||||||
.assertNext(account -> {
|
|
||||||
assertEquals("john", account.getOwner());
|
|
||||||
assertEquals(Double.valueOf(12.3), account.getValue());
|
|
||||||
assertNotNull(account.getId());
|
|
||||||
})
|
|
||||||
.expectComplete()
|
|
||||||
.verify();
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,58 +0,0 @@
|
|||||||
package com.baeldung.reactive.repository;
|
|
||||||
|
|
||||||
import com.baeldung.reactive.Spring5ReactiveApplication;
|
|
||||||
import com.baeldung.reactive.model.Account;
|
|
||||||
import io.reactivex.Observable;
|
|
||||||
import io.reactivex.Single;
|
|
||||||
import org.junit.Test;
|
|
||||||
import org.junit.runner.RunWith;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.boot.test.context.SpringBootTest;
|
|
||||||
import org.springframework.test.context.junit4.SpringRunner;
|
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
|
||||||
import static org.junit.Assert.assertNotNull;
|
|
||||||
|
|
||||||
@RunWith(SpringRunner.class)
|
|
||||||
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = Spring5ReactiveApplication.class)
|
|
||||||
public class AccountRxJavaRepositoryManualTest {
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
AccountRxJavaRepository repository;
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void givenValue_whenFindAllByValue_thenFindAccounts() throws InterruptedException {
|
|
||||||
repository.save(new Account(null, "bruno", 12.3)).blockingGet();
|
|
||||||
Observable<Account> accountObservable = repository.findAllByValue(12.3);
|
|
||||||
|
|
||||||
accountObservable
|
|
||||||
.test()
|
|
||||||
.await()
|
|
||||||
.assertComplete()
|
|
||||||
.assertValueAt(0, account -> {
|
|
||||||
assertEquals("bruno", account.getOwner());
|
|
||||||
assertEquals(Double.valueOf(12.3), account.getValue());
|
|
||||||
return true;
|
|
||||||
});
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void givenOwner_whenFindFirstByOwner_thenFindAccount() throws InterruptedException {
|
|
||||||
repository.save(new Account(null, "bruno", 12.3)).blockingGet();
|
|
||||||
Single<Account> accountSingle = repository.findFirstByOwner(Single.just("bruno"));
|
|
||||||
|
|
||||||
accountSingle
|
|
||||||
.test()
|
|
||||||
.await()
|
|
||||||
.assertComplete()
|
|
||||||
.assertValueAt(0, account -> {
|
|
||||||
assertEquals("bruno", account.getOwner());
|
|
||||||
assertEquals(Double.valueOf(12.3), account.getValue());
|
|
||||||
assertNotNull(account.getId());
|
|
||||||
return true;
|
|
||||||
});
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,48 +0,0 @@
|
|||||||
package com.baeldung.reactive.template;
|
|
||||||
|
|
||||||
import com.baeldung.reactive.Spring5ReactiveApplication;
|
|
||||||
import com.baeldung.reactive.model.Account;
|
|
||||||
import org.junit.Test;
|
|
||||||
import org.junit.runner.RunWith;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.boot.test.context.SpringBootTest;
|
|
||||||
import org.springframework.test.context.junit4.SpringRunner;
|
|
||||||
import reactor.core.publisher.Flux;
|
|
||||||
import reactor.core.publisher.Mono;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import static org.junit.jupiter.api.Assertions.*;
|
|
||||||
|
|
||||||
@RunWith(SpringRunner.class)
|
|
||||||
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = Spring5ReactiveApplication.class)
|
|
||||||
public class AccountTemplateOperationsManualTest {
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
AccountTemplateOperations accountTemplate;
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void givenAccount_whenSave_thenSave() {
|
|
||||||
Account account = accountTemplate.save(Mono.just(new Account(null, "Raul", 12.3))).block();
|
|
||||||
assertNotNull( account.getId() );
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void givenId_whenFindById_thenFindAccount() {
|
|
||||||
Mono<Account> accountMono = accountTemplate.save(Mono.just(new Account(null, "Raul", 12.3)));
|
|
||||||
Mono<Account> accountMonoResult = accountTemplate.findById(accountMono.block().getId());
|
|
||||||
assertNotNull(accountMonoResult.block().getId());
|
|
||||||
assertEquals(accountMonoResult.block().getOwner(), "Raul");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void whenFindAll_thenFindAllAccounts() {
|
|
||||||
Account account1 = accountTemplate.save(Mono.just(new Account(null, "Raul", 12.3))).block();
|
|
||||||
Account account2 = accountTemplate.save(Mono.just(new Account(null, "Raul Torres", 13.3))).block();
|
|
||||||
Flux<Account> accountFlux = accountTemplate.findAll();
|
|
||||||
List<Account> accounts = accountFlux.collectList().block();
|
|
||||||
assertTrue(accounts.stream().anyMatch(x -> account1.getId().equals(x.getId()) ));
|
|
||||||
assertTrue(accounts.stream().anyMatch(x -> account2.getId().equals(x.getId()) ));
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,112 +0,0 @@
|
|||||||
package com.baeldung.tailablecursor.service;
|
|
||||||
|
|
||||||
import com.baeldung.tailablecursor.domain.Log;
|
|
||||||
import com.baeldung.tailablecursor.domain.LogLevel;
|
|
||||||
import com.mongodb.MongoClient;
|
|
||||||
import com.mongodb.client.MongoCollection;
|
|
||||||
import com.mongodb.client.MongoDatabase;
|
|
||||||
import com.mongodb.client.model.CreateCollectionOptions;
|
|
||||||
import de.flapdoodle.embed.mongo.MongodExecutable;
|
|
||||||
import de.flapdoodle.embed.mongo.MongodProcess;
|
|
||||||
import de.flapdoodle.embed.mongo.MongodStarter;
|
|
||||||
import de.flapdoodle.embed.mongo.config.MongodConfigBuilder;
|
|
||||||
import de.flapdoodle.embed.mongo.config.Net;
|
|
||||||
import de.flapdoodle.embed.mongo.distribution.Version;
|
|
||||||
import de.flapdoodle.embed.process.runtime.Network;
|
|
||||||
import org.bson.Document;
|
|
||||||
import org.junit.After;
|
|
||||||
import org.junit.Before;
|
|
||||||
import org.junit.Test;
|
|
||||||
import org.springframework.data.mongodb.core.MongoTemplate;
|
|
||||||
import org.springframework.util.SocketUtils;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.stream.IntStream;
|
|
||||||
|
|
||||||
import static org.hamcrest.Matchers.is;
|
|
||||||
import static org.junit.Assert.assertThat;
|
|
||||||
|
|
||||||
public class ErrorLogsCounterManualTest {
|
|
||||||
|
|
||||||
private static final String SERVER = "localhost";
|
|
||||||
private static final int PORT = SocketUtils.findAvailableTcpPort(10000);
|
|
||||||
private static final String DB_NAME = "test";
|
|
||||||
private static final String COLLECTION_NAME = Log.class.getName().toLowerCase();
|
|
||||||
|
|
||||||
private static final MongodStarter starter = MongodStarter.getDefaultInstance();
|
|
||||||
private static final int MAX_DOCUMENTS_IN_COLLECTION = 3;
|
|
||||||
|
|
||||||
private ErrorLogsCounter errorLogsCounter;
|
|
||||||
private MongodExecutable mongodExecutable;
|
|
||||||
private MongodProcess mongoDaemon;
|
|
||||||
private MongoDatabase db;
|
|
||||||
|
|
||||||
@Before
|
|
||||||
public void setup() throws Exception {
|
|
||||||
MongoTemplate mongoTemplate = initMongoTemplate();
|
|
||||||
|
|
||||||
MongoCollection<Document> collection = createCappedCollection();
|
|
||||||
|
|
||||||
persistDocument(collection, -1, LogLevel.ERROR, "my-service", "Initial log");
|
|
||||||
|
|
||||||
errorLogsCounter = new ErrorLogsCounter(mongoTemplate, COLLECTION_NAME);
|
|
||||||
Thread.sleep(1000L); // wait for initialization
|
|
||||||
}
|
|
||||||
|
|
||||||
private MongoTemplate initMongoTemplate() throws IOException {
|
|
||||||
mongodExecutable = starter.prepare(new MongodConfigBuilder()
|
|
||||||
.version(Version.Main.PRODUCTION)
|
|
||||||
.net(new Net(SERVER, PORT, Network.localhostIsIPv6()))
|
|
||||||
.build());
|
|
||||||
mongoDaemon = mongodExecutable.start();
|
|
||||||
|
|
||||||
MongoClient mongoClient = new MongoClient(SERVER, PORT);
|
|
||||||
db = mongoClient.getDatabase(DB_NAME);
|
|
||||||
|
|
||||||
return new MongoTemplate(mongoClient, DB_NAME);
|
|
||||||
}
|
|
||||||
|
|
||||||
private MongoCollection<Document> createCappedCollection() {
|
|
||||||
db.createCollection(COLLECTION_NAME, new CreateCollectionOptions()
|
|
||||||
.capped(true)
|
|
||||||
.sizeInBytes(100000)
|
|
||||||
.maxDocuments(MAX_DOCUMENTS_IN_COLLECTION));
|
|
||||||
return db.getCollection(COLLECTION_NAME);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void persistDocument(MongoCollection<Document> collection,
|
|
||||||
int i, LogLevel level, String service, String message) {
|
|
||||||
Document logMessage = new Document();
|
|
||||||
logMessage.append("_id", i);
|
|
||||||
logMessage.append("level", level.toString());
|
|
||||||
logMessage.append("service", service);
|
|
||||||
logMessage.append("message", message);
|
|
||||||
collection.insertOne(logMessage);
|
|
||||||
}
|
|
||||||
|
|
||||||
@After
|
|
||||||
public void tearDown() {
|
|
||||||
errorLogsCounter.close();
|
|
||||||
mongoDaemon.stop();
|
|
||||||
mongodExecutable.stop();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void whenErrorLogsArePersisted_thenTheyAreReceivedByLogsCounter() throws Exception {
|
|
||||||
MongoCollection<Document> collection = db.getCollection(COLLECTION_NAME);
|
|
||||||
|
|
||||||
IntStream.range(1, 10)
|
|
||||||
.forEach(i -> persistDocument(collection,
|
|
||||||
i,
|
|
||||||
i > 5 ? LogLevel.ERROR : LogLevel.INFO,
|
|
||||||
"service" + i,
|
|
||||||
"Message from service " + i)
|
|
||||||
);
|
|
||||||
|
|
||||||
Thread.sleep(1000L); // wait to receive all messages from the reactive mongodb driver
|
|
||||||
|
|
||||||
assertThat(collection.countDocuments(), is((long) MAX_DOCUMENTS_IN_COLLECTION));
|
|
||||||
assertThat(errorLogsCounter.count(), is(5));
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,75 +0,0 @@
|
|||||||
package com.baeldung.tailablecursor.service;
|
|
||||||
|
|
||||||
import com.baeldung.tailablecursor.LogsCounterApplication;
|
|
||||||
import com.baeldung.tailablecursor.domain.Log;
|
|
||||||
import com.baeldung.tailablecursor.domain.LogLevel;
|
|
||||||
import com.baeldung.tailablecursor.repository.LogsRepository;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
import org.junit.Before;
|
|
||||||
import org.junit.Test;
|
|
||||||
import org.junit.runner.RunWith;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.boot.test.context.SpringBootTest;
|
|
||||||
import org.springframework.data.mongodb.core.CollectionOptions;
|
|
||||||
import org.springframework.data.mongodb.core.ReactiveMongoTemplate;
|
|
||||||
import org.springframework.test.context.junit4.SpringRunner;
|
|
||||||
import reactor.core.publisher.Flux;
|
|
||||||
|
|
||||||
import static org.hamcrest.Matchers.is;
|
|
||||||
import static org.junit.Assert.assertThat;
|
|
||||||
|
|
||||||
|
|
||||||
@RunWith(SpringRunner.class)
|
|
||||||
@SpringBootTest(classes = LogsCounterApplication.class)
|
|
||||||
@Slf4j
|
|
||||||
public class InfoLogsCounterManualTest {
|
|
||||||
@Autowired
|
|
||||||
private LogsRepository repository;
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private ReactiveMongoTemplate template;
|
|
||||||
|
|
||||||
@Before
|
|
||||||
public void setUp() {
|
|
||||||
createCappedCollectionUsingReactiveMongoTemplate(template);
|
|
||||||
|
|
||||||
persistDocument(Log.builder()
|
|
||||||
.level(LogLevel.INFO)
|
|
||||||
.service("Service 2")
|
|
||||||
.message("Initial INFO message")
|
|
||||||
.build());
|
|
||||||
}
|
|
||||||
|
|
||||||
private void createCappedCollectionUsingReactiveMongoTemplate(ReactiveMongoTemplate reactiveMongoTemplate) {
|
|
||||||
reactiveMongoTemplate.dropCollection(Log.class).block();
|
|
||||||
reactiveMongoTemplate.createCollection(Log.class, CollectionOptions.empty()
|
|
||||||
.maxDocuments(5)
|
|
||||||
.size(1024 * 1024L)
|
|
||||||
.capped()).block();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void persistDocument(Log log) {
|
|
||||||
repository.save(log).block();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void wheInfoLogsArePersisted_thenTheyAreReceivedByLogsCounter() throws Exception {
|
|
||||||
InfoLogsCounter infoLogsCounter = new InfoLogsCounter(repository);
|
|
||||||
|
|
||||||
Thread.sleep(1000L); // wait for initialization
|
|
||||||
|
|
||||||
Flux.range(0,10)
|
|
||||||
.map(i -> Log.builder()
|
|
||||||
.level(i > 5 ? LogLevel.WARN : LogLevel.INFO)
|
|
||||||
.service("some-service")
|
|
||||||
.message("some log message")
|
|
||||||
.build())
|
|
||||||
.map(entity -> repository.save(entity).subscribe())
|
|
||||||
.blockLast();
|
|
||||||
|
|
||||||
Thread.sleep(1000L); // wait to receive all messages from the reactive mongodb driver
|
|
||||||
|
|
||||||
assertThat(infoLogsCounter.count(), is(7));
|
|
||||||
infoLogsCounter.close();
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,75 +0,0 @@
|
|||||||
package com.baeldung.tailablecursor.service;
|
|
||||||
|
|
||||||
import com.baeldung.tailablecursor.LogsCounterApplication;
|
|
||||||
import com.baeldung.tailablecursor.domain.Log;
|
|
||||||
import com.baeldung.tailablecursor.domain.LogLevel;
|
|
||||||
import com.baeldung.tailablecursor.repository.LogsRepository;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
import org.junit.Before;
|
|
||||||
import org.junit.Test;
|
|
||||||
import org.junit.runner.RunWith;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.boot.test.context.SpringBootTest;
|
|
||||||
import org.springframework.data.mongodb.core.CollectionOptions;
|
|
||||||
import org.springframework.data.mongodb.core.ReactiveMongoTemplate;
|
|
||||||
import org.springframework.test.context.junit4.SpringRunner;
|
|
||||||
import reactor.core.publisher.Flux;
|
|
||||||
|
|
||||||
import static org.hamcrest.Matchers.is;
|
|
||||||
import static org.junit.Assert.assertThat;
|
|
||||||
|
|
||||||
|
|
||||||
@RunWith(SpringRunner.class)
|
|
||||||
@SpringBootTest(classes = LogsCounterApplication.class)
|
|
||||||
@Slf4j
|
|
||||||
public class WarnLogsCounterManualTest {
|
|
||||||
@Autowired
|
|
||||||
private LogsRepository repository;
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private ReactiveMongoTemplate template;
|
|
||||||
|
|
||||||
@Before
|
|
||||||
public void setUp() {
|
|
||||||
createCappedCollectionUsingReactiveMongoTemplate(template);
|
|
||||||
|
|
||||||
persistDocument(Log.builder()
|
|
||||||
.level(LogLevel.WARN)
|
|
||||||
.service("Service 1")
|
|
||||||
.message("Initial Warn message")
|
|
||||||
.build());
|
|
||||||
}
|
|
||||||
|
|
||||||
private void createCappedCollectionUsingReactiveMongoTemplate(ReactiveMongoTemplate reactiveMongoTemplate) {
|
|
||||||
reactiveMongoTemplate.dropCollection(Log.class).block();
|
|
||||||
reactiveMongoTemplate.createCollection(Log.class, CollectionOptions.empty()
|
|
||||||
.maxDocuments(5)
|
|
||||||
.size(1024 * 1024L)
|
|
||||||
.capped()).block();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void persistDocument(Log log) {
|
|
||||||
repository.save(log).block();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void whenWarnLogsArePersisted_thenTheyAreReceivedByLogsCounter() throws Exception {
|
|
||||||
WarnLogsCounter warnLogsCounter = new WarnLogsCounter(template);
|
|
||||||
|
|
||||||
Thread.sleep(1000L); // wait for initialization
|
|
||||||
|
|
||||||
Flux.range(0,10)
|
|
||||||
.map(i -> Log.builder()
|
|
||||||
.level(i > 5 ? LogLevel.WARN : LogLevel.INFO)
|
|
||||||
.service("some-service")
|
|
||||||
.message("some log message")
|
|
||||||
.build())
|
|
||||||
.map(entity -> repository.save(entity).subscribe())
|
|
||||||
.blockLast();
|
|
||||||
|
|
||||||
Thread.sleep(1000L); // wait to receive all messages from the reactive mongodb driver
|
|
||||||
|
|
||||||
assertThat(warnLogsCounter.count(), is(5));
|
|
||||||
warnLogsCounter.close();
|
|
||||||
}
|
|
||||||
}
|
|
@ -108,13 +108,15 @@
|
|||||||
</warSourceExcludes>
|
</warSourceExcludes>
|
||||||
</configuration>
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
<plugin>
|
<!-- NPM build is disabled from profile specific configurations because in a multi-threaded run environment like Jenkins this build was not succeeding due to issues totally unrelated to this module
|
||||||
|
This can be enabled manually while running this module on local, or directly npm can be run inside the webapp folder
|
||||||
|
-->
|
||||||
|
<!-- <plugin>
|
||||||
<groupId>com.github.eirslett</groupId>
|
<groupId>com.github.eirslett</groupId>
|
||||||
<artifactId>frontend-maven-plugin</artifactId>
|
<artifactId>frontend-maven-plugin</artifactId>
|
||||||
<version>${frontend-maven-plugin.version}</version>
|
<version>${frontend-maven-plugin.version}</version>
|
||||||
<configuration>
|
<configuration>
|
||||||
<nodeVersion>${node.version}</nodeVersion>
|
<nodeVersion>${node.version}</nodeVersion>
|
||||||
<npmVersion>${npm.version}</npmVersion>
|
|
||||||
<workingDirectory>src/main/webapp/WEB-INF/view/react</workingDirectory>
|
<workingDirectory>src/main/webapp/WEB-INF/view/react</workingDirectory>
|
||||||
</configuration>
|
</configuration>
|
||||||
<executions>
|
<executions>
|
||||||
@ -140,7 +142,7 @@
|
|||||||
</configuration>
|
</configuration>
|
||||||
</execution>
|
</execution>
|
||||||
</executions>
|
</executions>
|
||||||
</plugin>
|
</plugin> -->
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.eclipse.jetty</groupId>
|
<groupId>org.eclipse.jetty</groupId>
|
||||||
<artifactId>jetty-maven-plugin</artifactId>
|
<artifactId>jetty-maven-plugin</artifactId>
|
||||||
@ -149,7 +151,11 @@
|
|||||||
</plugins>
|
</plugins>
|
||||||
</build>
|
</build>
|
||||||
|
|
||||||
<profiles>
|
|
||||||
|
<!-- NPM build is disabled from profile specific configurations because in a multi-threaded run environment like Jenkins this build was not succeeding due to issues totally unrelated to this module
|
||||||
|
This can be enabled manually while running this module on local, or directly npm can be run inside the webapp folder
|
||||||
|
-->
|
||||||
|
<!-- <profiles>
|
||||||
<profile>
|
<profile>
|
||||||
<id>default-first</id>
|
<id>default-first</id>
|
||||||
<build>
|
<build>
|
||||||
@ -200,14 +206,14 @@
|
|||||||
</plugins>
|
</plugins>
|
||||||
</build>
|
</build>
|
||||||
</profile>
|
</profile>
|
||||||
</profiles>
|
</profiles> -->
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<!-- util -->
|
<!-- util -->
|
||||||
<guava.version>19.0</guava.version>
|
<guava.version>19.0</guava.version>
|
||||||
<!-- Maven plugins -->
|
<!-- Maven plugins -->
|
||||||
<maven-resources-plugin.version>2.7</maven-resources-plugin.version>
|
<maven-resources-plugin.version>2.7</maven-resources-plugin.version>
|
||||||
<frontend-maven-plugin.version>1.6</frontend-maven-plugin.version>
|
<frontend-maven-plugin.version>1.12.0</frontend-maven-plugin.version>
|
||||||
<jetty.version>9.4.11.v20180605</jetty.version>
|
<jetty.version>9.4.11.v20180605</jetty.version>
|
||||||
<!-- frontend -->
|
<!-- frontend -->
|
||||||
<node.version>v8.11.3</node.version>
|
<node.version>v8.11.3</node.version>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user