mirror of
https://gitlab.com/restcountries/restcountries.git
synced 2026-03-31 15:07:46 +01:00
Main
This commit is contained in:
@@ -4,6 +4,7 @@ Thumbs.db
|
|||||||
build/
|
build/
|
||||||
target/
|
target/
|
||||||
out/
|
out/
|
||||||
|
.micronaut/
|
||||||
.idea
|
.idea
|
||||||
*.iml
|
*.iml
|
||||||
*.ipr
|
*.ipr
|
||||||
@@ -11,3 +12,4 @@ out/
|
|||||||
.project
|
.project
|
||||||
.settings
|
.settings
|
||||||
.classpath
|
.classpath
|
||||||
|
.factorypath
|
||||||
|
|||||||
Vendored
BIN
Binary file not shown.
+18
-1
@@ -1 +1,18 @@
|
|||||||
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.5.3/apache-maven-3.5.3-bin.zip
|
# Licensed to the Apache Software Foundation (ASF) under one
|
||||||
|
# or more contributor license agreements. See the NOTICE file
|
||||||
|
# distributed with this work for additional information
|
||||||
|
# regarding copyright ownership. The ASF licenses this file
|
||||||
|
# to you under the Apache License, Version 2.0 (the
|
||||||
|
# "License"); you may not use this file except in compliance
|
||||||
|
# with the License. You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# 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.
|
||||||
|
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.9/apache-maven-3.9.9-bin.zip
|
||||||
|
wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.1/maven-wrapper-3.1.1.jar
|
||||||
|
|||||||
+2
-2
@@ -4,6 +4,6 @@ COPY . .
|
|||||||
RUN mvn --batch-mode package
|
RUN mvn --batch-mode package
|
||||||
|
|
||||||
FROM openjdk:17-alpine
|
FROM openjdk:17-alpine
|
||||||
COPY --from=build target/dev.amatos.restcountries-*.jar dev.amatos.restcountries.jar
|
COPY --from=build target/com.restcountries-*.jar com.restcountries.jar
|
||||||
EXPOSE 8080
|
EXPOSE 8080
|
||||||
CMD ["java", "-Dcom.sun.management.jmxremote", "-Xmx128m", "-jar", "dev.amatos.restcountries.jar"]
|
CMD ["java", "-Dcom.sun.management.jmxremote", "-Xmx128m", "-jar", "com.restcountries.jar"]
|
||||||
@@ -0,0 +1,37 @@
|
|||||||
|
# AOT configuration properties for jar packaging
|
||||||
|
# Please review carefully the optimizations enabled below
|
||||||
|
# Check https://micronaut-projects.github.io/micronaut-aot/latest/guide/ for more details
|
||||||
|
|
||||||
|
# Caches environment property values: environment properties will be deemed immutable after application startup.
|
||||||
|
cached.environment.enabled=true
|
||||||
|
|
||||||
|
# Precomputes Micronaut configuration property keys from the current environment variables
|
||||||
|
precompute.environment.properties.enabled=true
|
||||||
|
|
||||||
|
# Replaces logback.xml with a pure Java configuration
|
||||||
|
logback.xml.to.java.enabled=true
|
||||||
|
|
||||||
|
# Converts YAML configuration files to Java configuration
|
||||||
|
yaml.to.java.config.enabled=true
|
||||||
|
|
||||||
|
# Scans for service types ahead-of-time, avoiding classpath scanning at startup
|
||||||
|
serviceloading.jit.enabled=true
|
||||||
|
|
||||||
|
# Scans reactive types at build time instead of runtime
|
||||||
|
scan.reactive.types.enabled=true
|
||||||
|
|
||||||
|
# Deduces the environment at build time instead of runtime
|
||||||
|
deduce.environment.enabled=true
|
||||||
|
|
||||||
|
# Checks for the existence of some types at build time instead of runtime
|
||||||
|
known.missing.types.enabled=true
|
||||||
|
|
||||||
|
# Precomputes property sources at build time
|
||||||
|
sealed.property.source.enabled=true
|
||||||
|
|
||||||
|
# The list of service types to be scanned (comma separated)
|
||||||
|
service.types=io.micronaut.context.env.PropertySourceLoader,io.micronaut.inject.BeanConfiguration,io.micronaut.inject.BeanDefinitionReference,io.micronaut.http.HttpRequestFactory,io.micronaut.http.HttpResponseFactory,io.micronaut.core.beans.BeanIntrospectionReference,io.micronaut.core.convert.TypeConverterRegistrar,io.micronaut.context.env.PropertyExpressionResolver
|
||||||
|
|
||||||
|
# A list of types that the AOT analyzer needs to check for existence (comma separated)
|
||||||
|
known.missing.types.list=io.reactivex.Observable,reactor.core.publisher.Flux,kotlinx.coroutines.flow.Flow,io.reactivex.rxjava3.core.Flowable,io.reactivex.rxjava3.core.Observable,io.reactivex.Single,reactor.core.publisher.Mono,io.reactivex.Maybe,io.reactivex.rxjava3.core.Single,io.reactivex.rxjava3.core.Maybe,io.reactivex.Completable,io.reactivex.rxjava3.core.Completable,io.methvin.watchservice.MacOSXListeningWatchService,io.micronaut.core.async.publisher.CompletableFuturePublisher,io.micronaut.core.async.publisher.Publishers.JustPublisher,io.micronaut.core.async.subscriber.Completable
|
||||||
|
|
||||||
+2
-2
@@ -1,6 +1,6 @@
|
|||||||
applicationType: default
|
applicationType: default
|
||||||
defaultPackage: dev.amatos.restcountries
|
defaultPackage: com.restcountries
|
||||||
testFramework: junit
|
testFramework: junit
|
||||||
sourceLanguage: java
|
sourceLanguage: java
|
||||||
buildTool: maven
|
buildTool: maven
|
||||||
features: [app-name, docker, file-watch, http-client, java, java-application, junit, logback, maven, netty-server, readme, shade, yaml]
|
features: [app-name, http-client, java, java-application, junit, logback, maven, maven-enforcer-plugin, micronaut-aot, micronaut-http-validation, netty-server, properties, readme, serialization-jackson, shade, static-resources, validation]
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
# "License"); you may not use this file except in compliance
|
# "License"); you may not use this file except in compliance
|
||||||
# with the License. You may obtain a copy of the License at
|
# with the License. You may obtain a copy of the License at
|
||||||
#
|
#
|
||||||
# http://www.apache.org/licenses/LICENSE-2.0
|
# https://www.apache.org/licenses/LICENSE-2.0
|
||||||
#
|
#
|
||||||
# Unless required by applicable law or agreed to in writing,
|
# Unless required by applicable law or agreed to in writing,
|
||||||
# software distributed under the License is distributed on an
|
# software distributed under the License is distributed on an
|
||||||
@@ -19,7 +19,7 @@
|
|||||||
# ----------------------------------------------------------------------------
|
# ----------------------------------------------------------------------------
|
||||||
|
|
||||||
# ----------------------------------------------------------------------------
|
# ----------------------------------------------------------------------------
|
||||||
# Maven2 Start Up Batch script
|
# Apache Maven Wrapper startup batch script, version 3.1.1
|
||||||
#
|
#
|
||||||
# Required ENV vars:
|
# Required ENV vars:
|
||||||
# ------------------
|
# ------------------
|
||||||
@@ -27,7 +27,6 @@
|
|||||||
#
|
#
|
||||||
# Optional ENV vars
|
# Optional ENV vars
|
||||||
# -----------------
|
# -----------------
|
||||||
# M2_HOME - location of maven2's installed home dir
|
|
||||||
# MAVEN_OPTS - parameters passed to the Java VM when running Maven
|
# MAVEN_OPTS - parameters passed to the Java VM when running Maven
|
||||||
# e.g. to debug Maven itself, use
|
# e.g. to debug Maven itself, use
|
||||||
# set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
|
# set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
|
||||||
@@ -36,6 +35,10 @@
|
|||||||
|
|
||||||
if [ -z "$MAVEN_SKIP_RC" ] ; then
|
if [ -z "$MAVEN_SKIP_RC" ] ; then
|
||||||
|
|
||||||
|
if [ -f /usr/local/etc/mavenrc ] ; then
|
||||||
|
. /usr/local/etc/mavenrc
|
||||||
|
fi
|
||||||
|
|
||||||
if [ -f /etc/mavenrc ] ; then
|
if [ -f /etc/mavenrc ] ; then
|
||||||
. /etc/mavenrc
|
. /etc/mavenrc
|
||||||
fi
|
fi
|
||||||
@@ -58,9 +61,9 @@ case "`uname`" in
|
|||||||
# See https://developer.apple.com/library/mac/qa/qa1170/_index.html
|
# See https://developer.apple.com/library/mac/qa/qa1170/_index.html
|
||||||
if [ -z "$JAVA_HOME" ]; then
|
if [ -z "$JAVA_HOME" ]; then
|
||||||
if [ -x "/usr/libexec/java_home" ]; then
|
if [ -x "/usr/libexec/java_home" ]; then
|
||||||
export JAVA_HOME="`/usr/libexec/java_home`"
|
JAVA_HOME="`/usr/libexec/java_home`"; export JAVA_HOME
|
||||||
else
|
else
|
||||||
export JAVA_HOME="/Library/Java/Home"
|
JAVA_HOME="/Library/Java/Home"; export JAVA_HOME
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
@@ -72,36 +75,8 @@ if [ -z "$JAVA_HOME" ] ; then
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -z "$M2_HOME" ] ; then
|
|
||||||
## resolve links - $0 may be a link to maven's home
|
|
||||||
PRG="$0"
|
|
||||||
|
|
||||||
# need this for relative symlinks
|
|
||||||
while [ -h "$PRG" ] ; do
|
|
||||||
ls=`ls -ld "$PRG"`
|
|
||||||
link=`expr "$ls" : '.*-> \(.*\)$'`
|
|
||||||
if expr "$link" : '/.*' > /dev/null; then
|
|
||||||
PRG="$link"
|
|
||||||
else
|
|
||||||
PRG="`dirname "$PRG"`/$link"
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
saveddir=`pwd`
|
|
||||||
|
|
||||||
M2_HOME=`dirname "$PRG"`/..
|
|
||||||
|
|
||||||
# make it fully qualified
|
|
||||||
M2_HOME=`cd "$M2_HOME" && pwd`
|
|
||||||
|
|
||||||
cd "$saveddir"
|
|
||||||
# echo Using m2 at $M2_HOME
|
|
||||||
fi
|
|
||||||
|
|
||||||
# For Cygwin, ensure paths are in UNIX format before anything is touched
|
# For Cygwin, ensure paths are in UNIX format before anything is touched
|
||||||
if $cygwin ; then
|
if $cygwin ; then
|
||||||
[ -n "$M2_HOME" ] &&
|
|
||||||
M2_HOME=`cygpath --unix "$M2_HOME"`
|
|
||||||
[ -n "$JAVA_HOME" ] &&
|
[ -n "$JAVA_HOME" ] &&
|
||||||
JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
|
JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
|
||||||
[ -n "$CLASSPATH" ] &&
|
[ -n "$CLASSPATH" ] &&
|
||||||
@@ -110,11 +85,8 @@ fi
|
|||||||
|
|
||||||
# For Mingw, ensure paths are in UNIX format before anything is touched
|
# For Mingw, ensure paths are in UNIX format before anything is touched
|
||||||
if $mingw ; then
|
if $mingw ; then
|
||||||
[ -n "$M2_HOME" ] &&
|
|
||||||
M2_HOME="`(cd "$M2_HOME"; pwd)`"
|
|
||||||
[ -n "$JAVA_HOME" ] &&
|
[ -n "$JAVA_HOME" ] &&
|
||||||
JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`"
|
JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`"
|
||||||
# TODO classpath?
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -z "$JAVA_HOME" ]; then
|
if [ -z "$JAVA_HOME" ]; then
|
||||||
@@ -146,7 +118,7 @@ if [ -z "$JAVACMD" ] ; then
|
|||||||
JAVACMD="$JAVA_HOME/bin/java"
|
JAVACMD="$JAVA_HOME/bin/java"
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
JAVACMD="`which java`"
|
JAVACMD="`\\unset -f command; \\command -v java`"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -160,12 +132,9 @@ if [ -z "$JAVA_HOME" ] ; then
|
|||||||
echo "Warning: JAVA_HOME environment variable is not set."
|
echo "Warning: JAVA_HOME environment variable is not set."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher
|
|
||||||
|
|
||||||
# traverses directory structure from process work directory to filesystem root
|
# traverses directory structure from process work directory to filesystem root
|
||||||
# first directory with .mvn subdirectory is considered project base directory
|
# first directory with .mvn subdirectory is considered project base directory
|
||||||
find_maven_basedir() {
|
find_maven_basedir() {
|
||||||
|
|
||||||
if [ -z "$1" ]
|
if [ -z "$1" ]
|
||||||
then
|
then
|
||||||
echo "Path not specified to find_maven_basedir"
|
echo "Path not specified to find_maven_basedir"
|
||||||
@@ -185,7 +154,7 @@ find_maven_basedir() {
|
|||||||
fi
|
fi
|
||||||
# end of workaround
|
# end of workaround
|
||||||
done
|
done
|
||||||
echo "${basedir}"
|
printf '%s' "$(cd "$basedir"; pwd)"
|
||||||
}
|
}
|
||||||
|
|
||||||
# concatenates all lines of a file
|
# concatenates all lines of a file
|
||||||
@@ -195,11 +164,16 @@ concat_lines() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
BASE_DIR=`find_maven_basedir "$(pwd)"`
|
BASE_DIR=$(find_maven_basedir "$(dirname $0)")
|
||||||
if [ -z "$BASE_DIR" ]; then
|
if [ -z "$BASE_DIR" ]; then
|
||||||
exit 1;
|
exit 1;
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"}; export MAVEN_PROJECTBASEDIR
|
||||||
|
if [ "$MVNW_VERBOSE" = true ]; then
|
||||||
|
echo $MAVEN_PROJECTBASEDIR
|
||||||
|
fi
|
||||||
|
|
||||||
##########################################################################################
|
##########################################################################################
|
||||||
# Extension to allow automatically downloading the maven-wrapper.jar from Maven-central
|
# Extension to allow automatically downloading the maven-wrapper.jar from Maven-central
|
||||||
# This allows using the maven wrapper in projects that prohibit checking in binary data.
|
# This allows using the maven wrapper in projects that prohibit checking in binary data.
|
||||||
@@ -212,40 +186,67 @@ else
|
|||||||
if [ "$MVNW_VERBOSE" = true ]; then
|
if [ "$MVNW_VERBOSE" = true ]; then
|
||||||
echo "Couldn't find .mvn/wrapper/maven-wrapper.jar, downloading it ..."
|
echo "Couldn't find .mvn/wrapper/maven-wrapper.jar, downloading it ..."
|
||||||
fi
|
fi
|
||||||
jarUrl="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.4.0/maven-wrapper-0.4.0.jar"
|
if [ -n "$MVNW_REPOURL" ]; then
|
||||||
|
wrapperUrl="$MVNW_REPOURL/org/apache/maven/wrapper/maven-wrapper/3.1.1/maven-wrapper-3.1.1.jar"
|
||||||
|
else
|
||||||
|
wrapperUrl="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.1/maven-wrapper-3.1.1.jar"
|
||||||
|
fi
|
||||||
while IFS="=" read key value; do
|
while IFS="=" read key value; do
|
||||||
case "$key" in (wrapperUrl) jarUrl="$value"; break ;;
|
case "$key" in (wrapperUrl) wrapperUrl="$value"; break ;;
|
||||||
esac
|
esac
|
||||||
done < "$BASE_DIR/.mvn/wrapper/maven-wrapper.properties"
|
done < "$BASE_DIR/.mvn/wrapper/maven-wrapper.properties"
|
||||||
if [ "$MVNW_VERBOSE" = true ]; then
|
if [ "$MVNW_VERBOSE" = true ]; then
|
||||||
echo "Downloading from: $jarUrl"
|
echo "Downloading from: $wrapperUrl"
|
||||||
fi
|
fi
|
||||||
wrapperJarPath="$BASE_DIR/.mvn/wrapper/maven-wrapper.jar"
|
wrapperJarPath="$BASE_DIR/.mvn/wrapper/maven-wrapper.jar"
|
||||||
|
if $cygwin; then
|
||||||
|
wrapperJarPath=`cygpath --path --windows "$wrapperJarPath"`
|
||||||
|
fi
|
||||||
|
|
||||||
if command -v wget > /dev/null; then
|
if command -v wget > /dev/null; then
|
||||||
|
QUIET="--quiet"
|
||||||
if [ "$MVNW_VERBOSE" = true ]; then
|
if [ "$MVNW_VERBOSE" = true ]; then
|
||||||
echo "Found wget ... using wget"
|
echo "Found wget ... using wget"
|
||||||
|
QUIET=""
|
||||||
fi
|
fi
|
||||||
wget "$jarUrl" -O "$wrapperJarPath"
|
if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then
|
||||||
|
wget $QUIET "$wrapperUrl" -O "$wrapperJarPath"
|
||||||
|
else
|
||||||
|
wget $QUIET --http-user="$MVNW_USERNAME" --http-password="$MVNW_PASSWORD" "$wrapperUrl" -O "$wrapperJarPath"
|
||||||
|
fi
|
||||||
|
[ $? -eq 0 ] || rm -f "$wrapperJarPath"
|
||||||
elif command -v curl > /dev/null; then
|
elif command -v curl > /dev/null; then
|
||||||
|
QUIET="--silent"
|
||||||
if [ "$MVNW_VERBOSE" = true ]; then
|
if [ "$MVNW_VERBOSE" = true ]; then
|
||||||
echo "Found curl ... using curl"
|
echo "Found curl ... using curl"
|
||||||
|
QUIET=""
|
||||||
fi
|
fi
|
||||||
curl -o "$wrapperJarPath" "$jarUrl"
|
if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then
|
||||||
|
curl $QUIET -o "$wrapperJarPath" "$wrapperUrl" -f -L
|
||||||
|
else
|
||||||
|
curl $QUIET --user "$MVNW_USERNAME:$MVNW_PASSWORD" -o "$wrapperJarPath" "$wrapperUrl" -f -L
|
||||||
|
fi
|
||||||
|
[ $? -eq 0 ] || rm -f "$wrapperJarPath"
|
||||||
else
|
else
|
||||||
if [ "$MVNW_VERBOSE" = true ]; then
|
if [ "$MVNW_VERBOSE" = true ]; then
|
||||||
echo "Falling back to using Java to download"
|
echo "Falling back to using Java to download"
|
||||||
fi
|
fi
|
||||||
javaClass="$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.java"
|
javaSource="$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.java"
|
||||||
if [ -e "$javaClass" ]; then
|
javaClass="$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class"
|
||||||
if [ ! -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then
|
# For Cygwin, switch paths to Windows format before running javac
|
||||||
|
if $cygwin; then
|
||||||
|
javaSource=`cygpath --path --windows "$javaSource"`
|
||||||
|
javaClass=`cygpath --path --windows "$javaClass"`
|
||||||
|
fi
|
||||||
|
if [ -e "$javaSource" ]; then
|
||||||
|
if [ ! -e "$javaClass" ]; then
|
||||||
if [ "$MVNW_VERBOSE" = true ]; then
|
if [ "$MVNW_VERBOSE" = true ]; then
|
||||||
echo " - Compiling MavenWrapperDownloader.java ..."
|
echo " - Compiling MavenWrapperDownloader.java ..."
|
||||||
fi
|
fi
|
||||||
# Compiling the Java class
|
# Compiling the Java class
|
||||||
("$JAVA_HOME/bin/javac" "$javaClass")
|
("$JAVA_HOME/bin/javac" "$javaSource")
|
||||||
fi
|
fi
|
||||||
if [ -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then
|
if [ -e "$javaClass" ]; then
|
||||||
# Running the downloader
|
# Running the downloader
|
||||||
if [ "$MVNW_VERBOSE" = true ]; then
|
if [ "$MVNW_VERBOSE" = true ]; then
|
||||||
echo " - Running MavenWrapperDownloader.java ..."
|
echo " - Running MavenWrapperDownloader.java ..."
|
||||||
@@ -259,16 +260,10 @@ fi
|
|||||||
# End of extension
|
# End of extension
|
||||||
##########################################################################################
|
##########################################################################################
|
||||||
|
|
||||||
export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"}
|
|
||||||
if [ "$MVNW_VERBOSE" = true ]; then
|
|
||||||
echo $MAVEN_PROJECTBASEDIR
|
|
||||||
fi
|
|
||||||
MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS"
|
MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS"
|
||||||
|
|
||||||
# For Cygwin, switch paths to Windows format before running java
|
# For Cygwin, switch paths to Windows format before running java
|
||||||
if $cygwin; then
|
if $cygwin; then
|
||||||
[ -n "$M2_HOME" ] &&
|
|
||||||
M2_HOME=`cygpath --path --windows "$M2_HOME"`
|
|
||||||
[ -n "$JAVA_HOME" ] &&
|
[ -n "$JAVA_HOME" ] &&
|
||||||
JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"`
|
JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"`
|
||||||
[ -n "$CLASSPATH" ] &&
|
[ -n "$CLASSPATH" ] &&
|
||||||
@@ -277,10 +272,16 @@ if $cygwin; then
|
|||||||
MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"`
|
MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"`
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Provide a "standardized" way to retrieve the CLI args that will
|
||||||
|
# work with both Windows and non-Windows executions.
|
||||||
|
MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $@"
|
||||||
|
export MAVEN_CMD_LINE_ARGS
|
||||||
|
|
||||||
WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
|
WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
|
||||||
|
|
||||||
exec "$JAVACMD" \
|
exec "$JAVACMD" \
|
||||||
$MAVEN_OPTS \
|
$MAVEN_OPTS \
|
||||||
|
$MAVEN_DEBUG_OPTS \
|
||||||
-classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \
|
-classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \
|
||||||
"-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \
|
"-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \
|
||||||
${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@"
|
${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@"
|
||||||
|
|||||||
@@ -1,161 +1,187 @@
|
|||||||
@REM ----------------------------------------------------------------------------
|
@REM ----------------------------------------------------------------------------
|
||||||
@REM Licensed to the Apache Software Foundation (ASF) under one
|
@REM Licensed to the Apache Software Foundation (ASF) under one
|
||||||
@REM or more contributor license agreements. See the NOTICE file
|
@REM or more contributor license agreements. See the NOTICE file
|
||||||
@REM distributed with this work for additional information
|
@REM distributed with this work for additional information
|
||||||
@REM regarding copyright ownership. The ASF licenses this file
|
@REM regarding copyright ownership. The ASF licenses this file
|
||||||
@REM to you under the Apache License, Version 2.0 (the
|
@REM to you under the Apache License, Version 2.0 (the
|
||||||
@REM "License"); you may not use this file except in compliance
|
@REM "License"); you may not use this file except in compliance
|
||||||
@REM with the License. You may obtain a copy of the License at
|
@REM with the License. You may obtain a copy of the License at
|
||||||
@REM
|
@REM
|
||||||
@REM http://www.apache.org/licenses/LICENSE-2.0
|
@REM https://www.apache.org/licenses/LICENSE-2.0
|
||||||
@REM
|
@REM
|
||||||
@REM Unless required by applicable law or agreed to in writing,
|
@REM Unless required by applicable law or agreed to in writing,
|
||||||
@REM software distributed under the License is distributed on an
|
@REM software distributed under the License is distributed on an
|
||||||
@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
@REM KIND, either express or implied. See the License for the
|
@REM KIND, either express or implied. See the License for the
|
||||||
@REM specific language governing permissions and limitations
|
@REM specific language governing permissions and limitations
|
||||||
@REM under the License.
|
@REM under the License.
|
||||||
@REM ----------------------------------------------------------------------------
|
@REM ----------------------------------------------------------------------------
|
||||||
|
|
||||||
@REM ----------------------------------------------------------------------------
|
@REM ----------------------------------------------------------------------------
|
||||||
@REM Maven2 Start Up Batch script
|
@REM Apache Maven Wrapper startup batch script, version 3.1.1
|
||||||
@REM
|
@REM
|
||||||
@REM Required ENV vars:
|
@REM Required ENV vars:
|
||||||
@REM JAVA_HOME - location of a JDK home dir
|
@REM JAVA_HOME - location of a JDK home dir
|
||||||
@REM
|
@REM
|
||||||
@REM Optional ENV vars
|
@REM Optional ENV vars
|
||||||
@REM M2_HOME - location of maven2's installed home dir
|
@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands
|
||||||
@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands
|
@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a keystroke before ending
|
||||||
@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a key stroke before ending
|
@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven
|
||||||
@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven
|
@REM e.g. to debug Maven itself, use
|
||||||
@REM e.g. to debug Maven itself, use
|
@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
|
||||||
@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
|
@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files
|
||||||
@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files
|
@REM ----------------------------------------------------------------------------
|
||||||
@REM ----------------------------------------------------------------------------
|
|
||||||
|
@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on'
|
||||||
@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on'
|
@echo off
|
||||||
@echo off
|
@REM set title of command window
|
||||||
@REM set title of command window
|
title %0
|
||||||
title %0
|
@REM enable echoing by setting MAVEN_BATCH_ECHO to 'on'
|
||||||
@REM enable echoing my setting MAVEN_BATCH_ECHO to 'on'
|
@if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO%
|
||||||
@if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO%
|
|
||||||
|
@REM set %HOME% to equivalent of $HOME
|
||||||
@REM set %HOME% to equivalent of $HOME
|
if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%")
|
||||||
if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%")
|
|
||||||
|
@REM Execute a user defined script before this one
|
||||||
@REM Execute a user defined script before this one
|
if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre
|
||||||
if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre
|
@REM check for pre script, once with legacy .bat ending and once with .cmd ending
|
||||||
@REM check for pre script, once with legacy .bat ending and once with .cmd ending
|
if exist "%USERPROFILE%\mavenrc_pre.bat" call "%USERPROFILE%\mavenrc_pre.bat" %*
|
||||||
if exist "%HOME%\mavenrc_pre.bat" call "%HOME%\mavenrc_pre.bat"
|
if exist "%USERPROFILE%\mavenrc_pre.cmd" call "%USERPROFILE%\mavenrc_pre.cmd" %*
|
||||||
if exist "%HOME%\mavenrc_pre.cmd" call "%HOME%\mavenrc_pre.cmd"
|
:skipRcPre
|
||||||
:skipRcPre
|
|
||||||
|
@setlocal
|
||||||
@setlocal
|
|
||||||
|
set ERROR_CODE=0
|
||||||
set ERROR_CODE=0
|
|
||||||
|
@REM To isolate internal variables from possible post scripts, we use another setlocal
|
||||||
@REM To isolate internal variables from possible post scripts, we use another setlocal
|
@setlocal
|
||||||
@setlocal
|
|
||||||
|
@REM ==== START VALIDATION ====
|
||||||
@REM ==== START VALIDATION ====
|
if not "%JAVA_HOME%" == "" goto OkJHome
|
||||||
if not "%JAVA_HOME%" == "" goto OkJHome
|
|
||||||
|
echo.
|
||||||
echo.
|
echo Error: JAVA_HOME not found in your environment. >&2
|
||||||
echo Error: JAVA_HOME not found in your environment. >&2
|
echo Please set the JAVA_HOME variable in your environment to match the >&2
|
||||||
echo Please set the JAVA_HOME variable in your environment to match the >&2
|
echo location of your Java installation. >&2
|
||||||
echo location of your Java installation. >&2
|
echo.
|
||||||
echo.
|
goto error
|
||||||
goto error
|
|
||||||
|
:OkJHome
|
||||||
:OkJHome
|
if exist "%JAVA_HOME%\bin\java.exe" goto init
|
||||||
if exist "%JAVA_HOME%\bin\java.exe" goto init
|
|
||||||
|
echo.
|
||||||
echo.
|
echo Error: JAVA_HOME is set to an invalid directory. >&2
|
||||||
echo Error: JAVA_HOME is set to an invalid directory. >&2
|
echo JAVA_HOME = "%JAVA_HOME%" >&2
|
||||||
echo JAVA_HOME = "%JAVA_HOME%" >&2
|
echo Please set the JAVA_HOME variable in your environment to match the >&2
|
||||||
echo Please set the JAVA_HOME variable in your environment to match the >&2
|
echo location of your Java installation. >&2
|
||||||
echo location of your Java installation. >&2
|
echo.
|
||||||
echo.
|
goto error
|
||||||
goto error
|
|
||||||
|
@REM ==== END VALIDATION ====
|
||||||
@REM ==== END VALIDATION ====
|
|
||||||
|
:init
|
||||||
:init
|
|
||||||
|
@REM Find the project base dir, i.e. the directory that contains the folder ".mvn".
|
||||||
@REM Find the project base dir, i.e. the directory that contains the folder ".mvn".
|
@REM Fallback to current working directory if not found.
|
||||||
@REM Fallback to current working directory if not found.
|
|
||||||
|
set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR%
|
||||||
set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR%
|
IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir
|
||||||
IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir
|
|
||||||
|
set EXEC_DIR=%CD%
|
||||||
set EXEC_DIR=%CD%
|
set WDIR=%EXEC_DIR%
|
||||||
set WDIR=%EXEC_DIR%
|
:findBaseDir
|
||||||
:findBaseDir
|
IF EXIST "%WDIR%"\.mvn goto baseDirFound
|
||||||
IF EXIST "%WDIR%"\.mvn goto baseDirFound
|
cd ..
|
||||||
cd ..
|
IF "%WDIR%"=="%CD%" goto baseDirNotFound
|
||||||
IF "%WDIR%"=="%CD%" goto baseDirNotFound
|
set WDIR=%CD%
|
||||||
set WDIR=%CD%
|
goto findBaseDir
|
||||||
goto findBaseDir
|
|
||||||
|
:baseDirFound
|
||||||
:baseDirFound
|
set MAVEN_PROJECTBASEDIR=%WDIR%
|
||||||
set MAVEN_PROJECTBASEDIR=%WDIR%
|
cd "%EXEC_DIR%"
|
||||||
cd "%EXEC_DIR%"
|
goto endDetectBaseDir
|
||||||
goto endDetectBaseDir
|
|
||||||
|
:baseDirNotFound
|
||||||
:baseDirNotFound
|
set MAVEN_PROJECTBASEDIR=%EXEC_DIR%
|
||||||
set MAVEN_PROJECTBASEDIR=%EXEC_DIR%
|
cd "%EXEC_DIR%"
|
||||||
cd "%EXEC_DIR%"
|
|
||||||
|
:endDetectBaseDir
|
||||||
:endDetectBaseDir
|
|
||||||
|
IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig
|
||||||
IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig
|
|
||||||
|
@setlocal EnableExtensions EnableDelayedExpansion
|
||||||
@setlocal EnableExtensions EnableDelayedExpansion
|
for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a
|
||||||
for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a
|
@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS%
|
||||||
@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS%
|
|
||||||
|
:endReadAdditionalConfig
|
||||||
:endReadAdditionalConfig
|
|
||||||
|
SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe"
|
||||||
SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe"
|
set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar"
|
||||||
set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar"
|
set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
|
||||||
set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
|
|
||||||
|
set WRAPPER_URL="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.1/maven-wrapper-3.1.1.jar"
|
||||||
set DOWNLOAD_URL="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.4.0/maven-wrapper-0.4.0.jar"
|
|
||||||
FOR /F "tokens=1,2 delims==" %%A IN (%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties) DO (
|
FOR /F "usebackq tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO (
|
||||||
IF "%%A"=="wrapperUrl" SET DOWNLOAD_URL=%%B
|
IF "%%A"=="wrapperUrl" SET WRAPPER_URL=%%B
|
||||||
)
|
)
|
||||||
|
|
||||||
@REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central
|
@REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central
|
||||||
@REM This allows using the maven wrapper in projects that prohibit checking in binary data.
|
@REM This allows using the maven wrapper in projects that prohibit checking in binary data.
|
||||||
if exist %WRAPPER_JAR% (
|
if exist %WRAPPER_JAR% (
|
||||||
echo Found %WRAPPER_JAR%
|
if "%MVNW_VERBOSE%" == "true" (
|
||||||
) else (
|
echo Found %WRAPPER_JAR%
|
||||||
echo Couldn't find %WRAPPER_JAR%, downloading it ...
|
)
|
||||||
echo Downloading from: %DOWNLOAD_URL%
|
) else (
|
||||||
powershell -Command "(New-Object Net.WebClient).DownloadFile('%DOWNLOAD_URL%', '%WRAPPER_JAR%')"
|
if not "%MVNW_REPOURL%" == "" (
|
||||||
echo Finished downloading %WRAPPER_JAR%
|
SET WRAPPER_URL="%MVNW_REPOURL%/org/apache/maven/wrapper/maven-wrapper/3.1.1/maven-wrapper-3.1.1.jar"
|
||||||
)
|
)
|
||||||
@REM End of extension
|
if "%MVNW_VERBOSE%" == "true" (
|
||||||
|
echo Couldn't find %WRAPPER_JAR%, downloading it ...
|
||||||
%MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %*
|
echo Downloading from: %WRAPPER_URL%
|
||||||
if ERRORLEVEL 1 goto error
|
)
|
||||||
goto end
|
|
||||||
|
powershell -Command "&{"^
|
||||||
:error
|
"$webclient = new-object System.Net.WebClient;"^
|
||||||
set ERROR_CODE=1
|
"if (-not ([string]::IsNullOrEmpty('%MVNW_USERNAME%') -and [string]::IsNullOrEmpty('%MVNW_PASSWORD%'))) {"^
|
||||||
|
"$webclient.Credentials = new-object System.Net.NetworkCredential('%MVNW_USERNAME%', '%MVNW_PASSWORD%');"^
|
||||||
:end
|
"}"^
|
||||||
@endlocal & set ERROR_CODE=%ERROR_CODE%
|
"[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $webclient.DownloadFile('%WRAPPER_URL%', '%WRAPPER_JAR%')"^
|
||||||
|
"}"
|
||||||
if not "%MAVEN_SKIP_RC%" == "" goto skipRcPost
|
if "%MVNW_VERBOSE%" == "true" (
|
||||||
@REM check for post script, once with legacy .bat ending and once with .cmd ending
|
echo Finished downloading %WRAPPER_JAR%
|
||||||
if exist "%HOME%\mavenrc_post.bat" call "%HOME%\mavenrc_post.bat"
|
)
|
||||||
if exist "%HOME%\mavenrc_post.cmd" call "%HOME%\mavenrc_post.cmd"
|
)
|
||||||
:skipRcPost
|
@REM End of extension
|
||||||
|
|
||||||
@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on'
|
@REM Provide a "standardized" way to retrieve the CLI args that will
|
||||||
if "%MAVEN_BATCH_PAUSE%" == "on" pause
|
@REM work with both Windows and non-Windows executions.
|
||||||
|
set MAVEN_CMD_LINE_ARGS=%*
|
||||||
if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE%
|
|
||||||
|
%MAVEN_JAVA_EXE% ^
|
||||||
exit /B %ERROR_CODE%
|
%JVM_CONFIG_MAVEN_PROPS% ^
|
||||||
|
%MAVEN_OPTS% ^
|
||||||
|
%MAVEN_DEBUG_OPTS% ^
|
||||||
|
-classpath %WRAPPER_JAR% ^
|
||||||
|
"-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" ^
|
||||||
|
%WRAPPER_LAUNCHER% %MAVEN_CONFIG% %*
|
||||||
|
if ERRORLEVEL 1 goto error
|
||||||
|
goto end
|
||||||
|
|
||||||
|
:error
|
||||||
|
set ERROR_CODE=1
|
||||||
|
|
||||||
|
:end
|
||||||
|
@endlocal & set ERROR_CODE=%ERROR_CODE%
|
||||||
|
|
||||||
|
if not "%MAVEN_SKIP_RC%"=="" goto skipRcPost
|
||||||
|
@REM check for post script, once with legacy .bat ending and once with .cmd ending
|
||||||
|
if exist "%USERPROFILE%\mavenrc_post.bat" call "%USERPROFILE%\mavenrc_post.bat"
|
||||||
|
if exist "%USERPROFILE%\mavenrc_post.cmd" call "%USERPROFILE%\mavenrc_post.cmd"
|
||||||
|
:skipRcPost
|
||||||
|
|
||||||
|
@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on'
|
||||||
|
if "%MAVEN_BATCH_PAUSE%"=="on" pause
|
||||||
|
|
||||||
|
if "%MAVEN_TERMINATE_CMD%"=="on" exit %ERROR_CODE%
|
||||||
|
|
||||||
|
cmd /C exit /B %ERROR_CODE%
|
||||||
|
|||||||
@@ -1,45 +1,39 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<groupId>dev.amatos.restcountries</groupId>
|
<groupId>com.restcountries</groupId>
|
||||||
<artifactId>dev.amatos.restcountries</artifactId>
|
<artifactId>restcountries</artifactId>
|
||||||
<version>1</version>
|
<version>2025.04.20</version>
|
||||||
|
<packaging>${packaging}</packaging>
|
||||||
|
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>io.micronaut</groupId>
|
<groupId>io.micronaut.platform</groupId>
|
||||||
<artifactId>micronaut-parent</artifactId>
|
<artifactId>micronaut-parent</artifactId>
|
||||||
<version>2.0.1</version>
|
<version>4.7.6</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
|
<packaging>jar</packaging>
|
||||||
<jdk.version>17</jdk.version>
|
<jdk.version>17</jdk.version>
|
||||||
<!-- If you are building with JDK 9 or higher, you can uncomment the lines below to set the release version -->
|
|
||||||
<release.version>17</release.version>
|
<release.version>17</release.version>
|
||||||
<micronaut.version>2.0.1</micronaut.version>
|
<micronaut.version>4.7.6</micronaut.version>
|
||||||
<micronautopenapi.version>2.0.0</micronautopenapi.version>
|
<micronaut.runtime>netty</micronaut.runtime>
|
||||||
<exec.mainClass>dev.amatos.restcountries.Application</exec.mainClass>
|
<micronaut.aot.enabled>false</micronaut.aot.enabled>
|
||||||
<java.version>17</java.version>
|
<micronaut.aot.packageName>com.restcountries.aot.generated</micronaut.aot.packageName>
|
||||||
|
<exec.mainClass>com.restcountries.Application</exec.mainClass>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
<repositories>
|
<repositories>
|
||||||
<repository>
|
<repository>
|
||||||
<id>jcenter.bintray.com</id>
|
<id>central</id>
|
||||||
<url>https://jcenter.bintray.com</url>
|
<url>https://repo.maven.apache.org/maven2</url>
|
||||||
</repository>
|
</repository>
|
||||||
</repositories>
|
</repositories>
|
||||||
|
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>io.micronaut</groupId>
|
<groupId>io.micronaut</groupId>
|
||||||
<artifactId>micronaut-inject</artifactId>
|
<artifactId>micronaut-http-client</artifactId>
|
||||||
<scope>compile</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>io.micronaut</groupId>
|
|
||||||
<artifactId>micronaut-validation</artifactId>
|
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
@@ -48,13 +42,18 @@
|
|||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>io.micronaut</groupId>
|
<groupId>io.micronaut.serde</groupId>
|
||||||
<artifactId>micronaut-http-client</artifactId>
|
<artifactId>micronaut-serde-jackson</artifactId>
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>io.micronaut</groupId>
|
<groupId>io.micronaut.validation</groupId>
|
||||||
<artifactId>micronaut-runtime</artifactId>
|
<artifactId>micronaut-validation</artifactId>
|
||||||
|
<scope>compile</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>jakarta.validation</groupId>
|
||||||
|
<artifactId>jakarta.validation-api</artifactId>
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
@@ -62,6 +61,11 @@
|
|||||||
<artifactId>logback-classic</artifactId>
|
<artifactId>logback-classic</artifactId>
|
||||||
<scope>runtime</scope>
|
<scope>runtime</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>io.micronaut.test</groupId>
|
||||||
|
<artifactId>micronaut-test-junit5</artifactId>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.junit.jupiter</groupId>
|
<groupId>org.junit.jupiter</groupId>
|
||||||
<artifactId>junit-jupiter-api</artifactId>
|
<artifactId>junit-jupiter-api</artifactId>
|
||||||
@@ -72,24 +76,14 @@
|
|||||||
<artifactId>junit-jupiter-engine</artifactId>
|
<artifactId>junit-jupiter-engine</artifactId>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
|
||||||
<groupId>io.micronaut.test</groupId>
|
|
||||||
<artifactId>micronaut-test-junit5</artifactId>
|
|
||||||
<scope>test</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>io.micronaut</groupId>
|
|
||||||
<artifactId>micronaut-management</artifactId>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.google.code.gson</groupId>
|
<groupId>com.google.code.gson</groupId>
|
||||||
<artifactId>gson</artifactId>
|
<artifactId>gson</artifactId>
|
||||||
<version>2.9.0</version>
|
<version>2.10.1</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.logging.log4j</groupId>
|
<groupId>io.swagger.core.v3</groupId>
|
||||||
<artifactId>log4j-core</artifactId>
|
<artifactId>swagger-annotations</artifactId>
|
||||||
<version>2.17.2</version>
|
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.jboss.spec.javax.ws.rs</groupId>
|
<groupId>org.jboss.spec.javax.ws.rs</groupId>
|
||||||
@@ -97,87 +91,77 @@
|
|||||||
<version>1.0.1.Final</version>
|
<version>1.0.1.Final</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.glassfish.jersey.core</groupId>
|
<groupId>jakarta.ws.rs</groupId>
|
||||||
<artifactId>jersey-common</artifactId>
|
<artifactId>jakarta.ws.rs-api</artifactId>
|
||||||
<version>3.0.4</version>
|
<version>4.0.0</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.jboss.resteasy</groupId>
|
<groupId>org.apache.logging.log4j</groupId>
|
||||||
<artifactId>resteasy-client</artifactId>
|
<artifactId>log4j-core</artifactId>
|
||||||
<version>6.0.1.Final</version>
|
<version>2.17.2</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>io.swagger.core.v3</groupId>
|
<groupId>org.yaml</groupId>
|
||||||
<artifactId>swagger-annotations</artifactId>
|
<artifactId>snakeyaml</artifactId>
|
||||||
|
<scope>runtime</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
<plugins>
|
<plugins>
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>io.micronaut.build</groupId>
|
<groupId>io.micronaut.maven</groupId>
|
||||||
<artifactId>micronaut-maven-plugin</artifactId>
|
<artifactId>micronaut-maven-plugin</artifactId>
|
||||||
|
<configuration>
|
||||||
|
<configFile>aot-${packaging}.properties</configFile>
|
||||||
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-shade-plugin</artifactId>
|
<artifactId>maven-enforcer-plugin</artifactId>
|
||||||
</plugin>
|
|
||||||
<plugin>
|
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
|
||||||
<artifactId>maven-failsafe-plugin</artifactId>
|
|
||||||
</plugin>
|
</plugin>
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-compiler-plugin</artifactId>
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
<version>3.8.1</version>
|
|
||||||
<configuration>
|
<configuration>
|
||||||
<annotationProcessorPaths>
|
<!-- Uncomment to enable incremental compilation -->
|
||||||
|
<!-- <useIncrementalCompilation>false</useIncrementalCompilation> -->
|
||||||
|
|
||||||
|
<annotationProcessorPaths combine.children="append">
|
||||||
<path>
|
<path>
|
||||||
<groupId>io.micronaut</groupId>
|
<groupId>io.micronaut</groupId>
|
||||||
<artifactId>micronaut-inject-java</artifactId>
|
<artifactId>micronaut-http-validation</artifactId>
|
||||||
<version>${micronaut.version}</version>
|
<version>${micronaut.core.version}</version>
|
||||||
</path>
|
</path>
|
||||||
<path>
|
<path>
|
||||||
<groupId>io.micronaut</groupId>
|
<groupId>io.micronaut.serde</groupId>
|
||||||
<artifactId>micronaut-validation</artifactId>
|
<artifactId>micronaut-serde-processor</artifactId>
|
||||||
<version>${micronaut.version}</version>
|
<version>${micronaut.serialization.version}</version>
|
||||||
|
<exclusions>
|
||||||
|
<exclusion>
|
||||||
|
<groupId>io.micronaut</groupId>
|
||||||
|
<artifactId>micronaut-inject</artifactId>
|
||||||
|
</exclusion>
|
||||||
|
</exclusions>
|
||||||
</path>
|
</path>
|
||||||
<path>
|
<path>
|
||||||
<groupId>io.micronaut.openapi</groupId>
|
<groupId>io.micronaut.validation</groupId>
|
||||||
<artifactId>micronaut-openapi</artifactId>
|
<artifactId>micronaut-validation-processor</artifactId>
|
||||||
<version>${micronautopenapi.version}</version>
|
<version>${micronaut.validation.version}</version>
|
||||||
|
<exclusions>
|
||||||
|
<exclusion>
|
||||||
|
<groupId>io.micronaut</groupId>
|
||||||
|
<artifactId>micronaut-inject</artifactId>
|
||||||
|
</exclusion>
|
||||||
|
</exclusions>
|
||||||
</path>
|
</path>
|
||||||
</annotationProcessorPaths>
|
</annotationProcessorPaths>
|
||||||
<compilerArgs>
|
<compilerArgs>
|
||||||
<arg>-Amicronaut.processing.group=dev.amatos.restcountries</arg>
|
<arg>-Amicronaut.processing.group=com.restcountries</arg>
|
||||||
<arg>-Amicronaut.processing.module=dev.amatos.restcountries</arg>
|
<arg>-Amicronaut.processing.module=restcountries</arg>
|
||||||
</compilerArgs>
|
</compilerArgs>
|
||||||
</configuration>
|
</configuration>
|
||||||
<executions>
|
|
||||||
<execution>
|
|
||||||
<id>test-compile</id>
|
|
||||||
<goals>
|
|
||||||
<goal>testCompile</goal>
|
|
||||||
</goals>
|
|
||||||
<configuration>
|
|
||||||
<annotationProcessorPaths>
|
|
||||||
<path>
|
|
||||||
<groupId>io.micronaut</groupId>
|
|
||||||
<artifactId>micronaut-inject-java</artifactId>
|
|
||||||
<version>${micronaut.version}</version>
|
|
||||||
</path>
|
|
||||||
<path>
|
|
||||||
<groupId>io.micronaut</groupId>
|
|
||||||
<artifactId>micronaut-validation</artifactId>
|
|
||||||
<version>${micronaut.version}</version>
|
|
||||||
</path>
|
|
||||||
</annotationProcessorPaths>
|
|
||||||
</configuration>
|
|
||||||
</execution>
|
|
||||||
</executions>
|
|
||||||
</plugin>
|
</plugin>
|
||||||
</plugins>
|
</plugins>
|
||||||
</build>
|
</build>
|
||||||
|
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
|
|||||||
@@ -0,0 +1,10 @@
|
|||||||
|
package com.restcountries;
|
||||||
|
|
||||||
|
import io.micronaut.runtime.Micronaut;
|
||||||
|
|
||||||
|
public class Application {
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
Micronaut.run(Application.class, args);
|
||||||
|
}
|
||||||
|
}
|
||||||
+5
-5
@@ -1,12 +1,12 @@
|
|||||||
package dev.amatos.restcountries.controller;
|
package com.restcountries.controller;
|
||||||
|
|
||||||
import static dev.amatos.restcountries.utils.Constants.CACHE_CONTROL_VALUE;
|
import com.restcountries.domain.ResponseEntity;
|
||||||
import static io.micronaut.http.HttpHeaders.CACHE_CONTROL;
|
|
||||||
|
|
||||||
import dev.amatos.restcountries.domain.ResponseEntity;
|
|
||||||
import io.micronaut.http.HttpResponse;
|
import io.micronaut.http.HttpResponse;
|
||||||
import jakarta.ws.rs.core.Response;
|
import jakarta.ws.rs.core.Response;
|
||||||
|
|
||||||
|
import static com.restcountries.utils.Constants.CACHE_CONTROL_VALUE;
|
||||||
|
import static io.micronaut.http.HttpHeaders.CACHE_CONTROL;
|
||||||
|
|
||||||
public class ControllerHelper {
|
public class ControllerHelper {
|
||||||
|
|
||||||
protected static final String[] COUNTRY_FIELDS_V2 = new String[]{
|
protected static final String[] COUNTRY_FIELDS_V2 = new String[]{
|
||||||
+9
-12
@@ -1,21 +1,18 @@
|
|||||||
package dev.amatos.restcountries.controller;
|
package com.restcountries.controller;
|
||||||
|
|
||||||
import com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
import com.google.gson.JsonArray;
|
import com.google.gson.JsonArray;
|
||||||
import com.google.gson.JsonObject;
|
import com.google.gson.JsonObject;
|
||||||
import com.google.gson.JsonParser;
|
import com.google.gson.JsonParser;
|
||||||
import dev.amatos.restcountries.domain.ICountryRestSymbols;
|
import com.restcountries.domain.ICountryRestSymbols;
|
||||||
import dev.amatos.restcountries.domain.base.BaseCountry;
|
import com.restcountries.domain.base.BaseCountry;
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Arrays;
|
import java.util.*;
|
||||||
import java.util.List;
|
|
||||||
import java.util.Optional;
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
public class ControllerV3Helper {
|
public class ControllerV3Helper {
|
||||||
|
|
||||||
protected Object checkFieldsAndParseCountries(Optional<String> fields,
|
protected Object checkFieldsAndParseCountries(Optional<String> fields,
|
||||||
Set<? extends dev.amatos.restcountries.domain.base.BaseCountry> countries) {
|
Set<? extends com.restcountries.domain.base.BaseCountry> countries) {
|
||||||
if (fields.isPresent()) {
|
if (fields.isPresent()) {
|
||||||
return parsedCountries(countries, fields.get());
|
return parsedCountries(countries, fields.get());
|
||||||
} else {
|
} else {
|
||||||
@@ -23,7 +20,7 @@ public class ControllerV3Helper {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected Object checkFieldsAndParseCountry(Set<? extends dev.amatos.restcountries.domain.base.BaseCountry> countries, Optional<String> fields) {
|
protected Object checkFieldsAndParseCountry(Set<? extends com.restcountries.domain.base.BaseCountry> countries, Optional<String> fields) {
|
||||||
if (fields.isPresent()) {
|
if (fields.isPresent()) {
|
||||||
return parsedCountry(countries, fields.get());
|
return parsedCountry(countries, fields.get());
|
||||||
} else {
|
} else {
|
||||||
@@ -31,7 +28,7 @@ public class ControllerV3Helper {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected Object parsedCountries(Set<? extends dev.amatos.restcountries.domain.base.BaseCountry> countries, String excludedFields) {
|
protected Object parsedCountries(Set<? extends com.restcountries.domain.base.BaseCountry> countries, String excludedFields) {
|
||||||
if (excludedFields == null || excludedFields.isEmpty()) {
|
if (excludedFields == null || excludedFields.isEmpty()) {
|
||||||
return countries;
|
return countries;
|
||||||
} else {
|
} else {
|
||||||
@@ -60,7 +57,7 @@ public class ControllerV3Helper {
|
|||||||
return jsonObject.toString();
|
return jsonObject.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getCountriesJson(Set<? extends dev.amatos.restcountries.domain.base.BaseCountry> countries, List<String> fields) {
|
private String getCountriesJson(Set<? extends com.restcountries.domain.base.BaseCountry> countries, List<String> fields) {
|
||||||
var gson = new Gson();
|
var gson = new Gson();
|
||||||
var jsonArray = JsonParser.parseString(gson.toJson(countries)).getAsJsonArray();
|
var jsonArray = JsonParser.parseString(gson.toJson(countries)).getAsJsonArray();
|
||||||
var resultArray = new JsonArray();
|
var resultArray = new JsonArray();
|
||||||
+6
-5
@@ -1,12 +1,12 @@
|
|||||||
package dev.amatos.restcountries.controller;
|
package com.restcountries.controller;
|
||||||
|
|
||||||
import com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
import com.google.gson.JsonArray;
|
import com.google.gson.JsonArray;
|
||||||
import com.google.gson.JsonObject;
|
import com.google.gson.JsonObject;
|
||||||
import com.google.gson.JsonParser;
|
import com.google.gson.JsonParser;
|
||||||
import dev.amatos.restcountries.domain.ICountryRestSymbols;
|
import com.restcountries.domain.ICountryRestSymbols;
|
||||||
import dev.amatos.restcountries.domain.v2.Country;
|
import com.restcountries.domain.v2.Country;
|
||||||
import dev.amatos.restcountries.service.v2.CountryServiceV2;
|
import com.restcountries.service.v2.CountryServiceV2;
|
||||||
import io.micronaut.http.HttpResponse;
|
import io.micronaut.http.HttpResponse;
|
||||||
import io.micronaut.http.MediaType;
|
import io.micronaut.http.MediaType;
|
||||||
import io.micronaut.http.annotation.Controller;
|
import io.micronaut.http.annotation.Controller;
|
||||||
@@ -14,11 +14,12 @@ import io.micronaut.http.annotation.Get;
|
|||||||
import io.micronaut.http.annotation.PathVariable;
|
import io.micronaut.http.annotation.PathVariable;
|
||||||
import io.micronaut.http.annotation.QueryValue;
|
import io.micronaut.http.annotation.QueryValue;
|
||||||
import io.swagger.v3.oas.annotations.Hidden;
|
import io.swagger.v3.oas.annotations.Hidden;
|
||||||
|
|
||||||
|
import javax.ws.rs.QueryParam;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import javax.ws.rs.QueryParam;
|
|
||||||
|
|
||||||
@Hidden
|
@Hidden
|
||||||
@Controller("/v2/")
|
@Controller("/v2/")
|
||||||
+4
-3
@@ -1,6 +1,6 @@
|
|||||||
package dev.amatos.restcountries.controller;
|
package com.restcountries.controller;
|
||||||
|
|
||||||
import dev.amatos.restcountries.service.v3.CountryServiceV3;
|
import com.restcountries.service.v3.CountryServiceV3;
|
||||||
import io.micronaut.http.HttpResponse;
|
import io.micronaut.http.HttpResponse;
|
||||||
import io.micronaut.http.MediaType;
|
import io.micronaut.http.MediaType;
|
||||||
import io.micronaut.http.annotation.Controller;
|
import io.micronaut.http.annotation.Controller;
|
||||||
@@ -8,8 +8,9 @@ import io.micronaut.http.annotation.Get;
|
|||||||
import io.micronaut.http.annotation.PathVariable;
|
import io.micronaut.http.annotation.PathVariable;
|
||||||
import io.micronaut.http.annotation.QueryValue;
|
import io.micronaut.http.annotation.QueryValue;
|
||||||
import io.swagger.v3.oas.annotations.Hidden;
|
import io.swagger.v3.oas.annotations.Hidden;
|
||||||
import java.util.Optional;
|
|
||||||
import javax.ws.rs.QueryParam;
|
import javax.ws.rs.QueryParam;
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
@Hidden
|
@Hidden
|
||||||
@Controller("/v3/")
|
@Controller("/v3/")
|
||||||
+4
-3
@@ -1,6 +1,6 @@
|
|||||||
package dev.amatos.restcountries.controller;
|
package com.restcountries.controller;
|
||||||
|
|
||||||
import dev.amatos.restcountries.service.v3.v31.CountryServiceV31;
|
import com.restcountries.service.v3.v31.CountryServiceV31;
|
||||||
import io.micronaut.http.HttpResponse;
|
import io.micronaut.http.HttpResponse;
|
||||||
import io.micronaut.http.MediaType;
|
import io.micronaut.http.MediaType;
|
||||||
import io.micronaut.http.annotation.Controller;
|
import io.micronaut.http.annotation.Controller;
|
||||||
@@ -8,9 +8,10 @@ import io.micronaut.http.annotation.Get;
|
|||||||
import io.micronaut.http.annotation.PathVariable;
|
import io.micronaut.http.annotation.PathVariable;
|
||||||
import io.micronaut.http.annotation.QueryValue;
|
import io.micronaut.http.annotation.QueryValue;
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import java.util.Optional;
|
|
||||||
import javax.ws.rs.QueryParam;
|
import javax.ws.rs.QueryParam;
|
||||||
import javax.ws.rs.core.Response;
|
import javax.ws.rs.core.Response;
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
@Controller("/v3.1/")
|
@Controller("/v3.1/")
|
||||||
public class CountryControllerV31 extends ControllerV3Helper {
|
public class CountryControllerV31 extends ControllerV3Helper {
|
||||||
+4
-1
@@ -1,8 +1,11 @@
|
|||||||
package dev.amatos.restcountries.domain;
|
package com.restcountries.domain;
|
||||||
|
|
||||||
|
import io.micronaut.serde.annotation.Serdeable;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
@Serdeable.Serializable
|
||||||
public class BaseCountry {
|
public class BaseCountry {
|
||||||
|
|
||||||
protected String name;
|
protected String name;
|
||||||
+1
-1
@@ -2,7 +2,7 @@
|
|||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
package dev.amatos.restcountries.domain;
|
package com.restcountries.domain;
|
||||||
|
|
||||||
public interface ICountryRestSymbols {
|
public interface ICountryRestSymbols {
|
||||||
String COLON = ",";
|
String COLON = ",";
|
||||||
+1
-1
@@ -1,7 +1,7 @@
|
|||||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
package dev.amatos.restcountries.domain;
|
package com.restcountries.domain;
|
||||||
|
|
||||||
public class ResponseEntity {
|
public class ResponseEntity {
|
||||||
|
|
||||||
+4
-1
@@ -1,8 +1,11 @@
|
|||||||
package dev.amatos.restcountries.domain.base;
|
package com.restcountries.domain.base;
|
||||||
|
|
||||||
|
import io.micronaut.serde.annotation.Serdeable;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
@Serdeable.Serializable
|
||||||
public class BaseCountry {
|
public class BaseCountry {
|
||||||
|
|
||||||
private Name name;
|
private Name name;
|
||||||
+4
-1
@@ -1,7 +1,10 @@
|
|||||||
package dev.amatos.restcountries.domain.base;
|
package com.restcountries.domain.base;
|
||||||
|
|
||||||
|
import io.micronaut.serde.annotation.Serdeable;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@Serdeable.Serializable
|
||||||
public class Car {
|
public class Car {
|
||||||
private List<String> signs;
|
private List<String> signs;
|
||||||
private String side;
|
private String side;
|
||||||
+4
-1
@@ -1,5 +1,8 @@
|
|||||||
package dev.amatos.restcountries.domain.base;
|
package com.restcountries.domain.base;
|
||||||
|
|
||||||
|
import io.micronaut.serde.annotation.Serdeable;
|
||||||
|
|
||||||
|
@Serdeable.Serializable
|
||||||
public class Currency {
|
public class Currency {
|
||||||
private String name;
|
private String name;
|
||||||
private String symbol;
|
private String symbol;
|
||||||
+4
-1
@@ -1,7 +1,10 @@
|
|||||||
package dev.amatos.restcountries.domain.base;
|
package com.restcountries.domain.base;
|
||||||
|
|
||||||
|
import io.micronaut.serde.annotation.Serdeable;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@Serdeable.Serializable
|
||||||
public class Idd {
|
public class Idd {
|
||||||
private String root;
|
private String root;
|
||||||
private List<String> suffixes;
|
private List<String> suffixes;
|
||||||
+4
-1
@@ -1,8 +1,11 @@
|
|||||||
package dev.amatos.restcountries.domain.base;
|
package com.restcountries.domain.base;
|
||||||
|
|
||||||
|
import io.micronaut.serde.annotation.Serdeable;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
@Serdeable.Serializable
|
||||||
public class Name {
|
public class Name {
|
||||||
private String common;
|
private String common;
|
||||||
private String official;
|
private String official;
|
||||||
+4
-1
@@ -1,5 +1,8 @@
|
|||||||
package dev.amatos.restcountries.domain.base;
|
package com.restcountries.domain.base;
|
||||||
|
|
||||||
|
import io.micronaut.serde.annotation.Serdeable;
|
||||||
|
|
||||||
|
@Serdeable.Serializable
|
||||||
public class NativeName {
|
public class NativeName {
|
||||||
private String official;
|
private String official;
|
||||||
private String common;
|
private String common;
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
package dev.amatos.restcountries.domain.v2;
|
package com.restcountries.domain.v2;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by fayder on 24/02/2017.
|
* Created by fayder on 24/02/2017.
|
||||||
+4
-2
@@ -1,12 +1,14 @@
|
|||||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
package dev.amatos.restcountries.domain.v2;
|
package com.restcountries.domain.v2;
|
||||||
|
|
||||||
import dev.amatos.restcountries.domain.BaseCountry;
|
import com.restcountries.domain.BaseCountry;
|
||||||
|
import io.micronaut.serde.annotation.Serdeable;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@Serdeable.Serializable
|
||||||
public class Country extends BaseCountry {
|
public class Country extends BaseCountry {
|
||||||
|
|
||||||
private List<Currency> currencies;
|
private List<Currency> currencies;
|
||||||
+4
-1
@@ -1,8 +1,11 @@
|
|||||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
package dev.amatos.restcountries.domain.v2;
|
package com.restcountries.domain.v2;
|
||||||
|
|
||||||
|
import io.micronaut.serde.annotation.Serdeable;
|
||||||
|
|
||||||
|
@Serdeable.Serializable
|
||||||
public class Currency {
|
public class Currency {
|
||||||
|
|
||||||
private String code;
|
private String code;
|
||||||
+4
-1
@@ -1,5 +1,8 @@
|
|||||||
package dev.amatos.restcountries.domain.v2;
|
package com.restcountries.domain.v2;
|
||||||
|
|
||||||
|
import io.micronaut.serde.annotation.Serdeable;
|
||||||
|
|
||||||
|
@Serdeable.Serializable
|
||||||
public class Flag {
|
public class Flag {
|
||||||
private String svg;
|
private String svg;
|
||||||
private String png;
|
private String png;
|
||||||
+4
-1
@@ -1,8 +1,11 @@
|
|||||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
package dev.amatos.restcountries.domain.v2;
|
package com.restcountries.domain.v2;
|
||||||
|
|
||||||
|
import io.micronaut.serde.annotation.Serdeable;
|
||||||
|
|
||||||
|
@Serdeable.Serializable
|
||||||
public class Language {
|
public class Language {
|
||||||
|
|
||||||
private String iso639_1;
|
private String iso639_1;
|
||||||
+4
-1
@@ -1,5 +1,8 @@
|
|||||||
package dev.amatos.restcountries.domain.v2;
|
package com.restcountries.domain.v2;
|
||||||
|
|
||||||
|
import io.micronaut.serde.annotation.Serdeable;
|
||||||
|
|
||||||
|
@Serdeable.Serializable
|
||||||
public class Maps {
|
public class Maps {
|
||||||
private String gmaps;
|
private String gmaps;
|
||||||
private String openstreetmap;
|
private String openstreetmap;
|
||||||
+4
-1
@@ -1,4 +1,6 @@
|
|||||||
package dev.amatos.restcountries.domain.v2;
|
package com.restcountries.domain.v2;
|
||||||
|
|
||||||
|
import io.micronaut.serde.annotation.Serdeable;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -6,6 +8,7 @@ import java.util.List;
|
|||||||
/**
|
/**
|
||||||
* Created by fayder on 30/04/2017.
|
* Created by fayder on 30/04/2017.
|
||||||
*/
|
*/
|
||||||
|
@Serdeable.Serializable
|
||||||
public class RegionalBloc {
|
public class RegionalBloc {
|
||||||
|
|
||||||
private String acronym;
|
private String acronym;
|
||||||
+4
-1
@@ -1,9 +1,12 @@
|
|||||||
package dev.amatos.restcountries.domain.v2;
|
package com.restcountries.domain.v2;
|
||||||
|
|
||||||
|
|
||||||
|
import io.micronaut.serde.annotation.Serdeable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by fayder on 05/03/2017.
|
* Created by fayder on 05/03/2017.
|
||||||
*/
|
*/
|
||||||
|
@Serdeable.Serializable
|
||||||
public class Translations {
|
public class Translations {
|
||||||
|
|
||||||
private String br;
|
private String br;
|
||||||
+5
-2
@@ -1,8 +1,11 @@
|
|||||||
package dev.amatos.restcountries.domain.v3;
|
package com.restcountries.domain.v3;
|
||||||
|
|
||||||
|
import com.restcountries.domain.base.BaseCountry;
|
||||||
|
import io.micronaut.serde.annotation.Serdeable;
|
||||||
|
|
||||||
import dev.amatos.restcountries.domain.base.BaseCountry;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@Serdeable.Serializable
|
||||||
public class Country extends BaseCountry {
|
public class Country extends BaseCountry {
|
||||||
private List<String> flags;
|
private List<String> flags;
|
||||||
|
|
||||||
+4
-1
@@ -1,7 +1,10 @@
|
|||||||
package dev.amatos.restcountries.domain.v3.v31;
|
package com.restcountries.domain.v3.v31;
|
||||||
|
|
||||||
|
import io.micronaut.serde.annotation.Serdeable;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@Serdeable.Serializable
|
||||||
public class CapitalInformation {
|
public class CapitalInformation {
|
||||||
|
|
||||||
private List<Double> latlng;
|
private List<Double> latlng;
|
||||||
+5
-2
@@ -1,8 +1,11 @@
|
|||||||
package dev.amatos.restcountries.domain.v3.v31;
|
package com.restcountries.domain.v3.v31;
|
||||||
|
|
||||||
|
import com.restcountries.domain.base.BaseCountry;
|
||||||
|
import io.micronaut.serde.annotation.Serdeable;
|
||||||
|
|
||||||
import dev.amatos.restcountries.domain.base.BaseCountry;
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
@Serdeable.Serializable
|
||||||
public class Country extends BaseCountry {
|
public class Country extends BaseCountry {
|
||||||
private Flag flags;
|
private Flag flags;
|
||||||
private Flag coatOfArms;
|
private Flag coatOfArms;
|
||||||
+4
-1
@@ -1,5 +1,8 @@
|
|||||||
package dev.amatos.restcountries.domain.v3.v31;
|
package com.restcountries.domain.v3.v31;
|
||||||
|
|
||||||
|
import io.micronaut.serde.annotation.Serdeable;
|
||||||
|
|
||||||
|
@Serdeable.Serializable
|
||||||
public class Flag {
|
public class Flag {
|
||||||
private String png;
|
private String png;
|
||||||
private String svg;
|
private String svg;
|
||||||
+5
-8
@@ -1,12 +1,14 @@
|
|||||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
package dev.amatos.restcountries.service.v2;
|
package com.restcountries.service.v2;
|
||||||
|
|
||||||
import com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
import com.google.gson.stream.JsonReader;
|
import com.google.gson.stream.JsonReader;
|
||||||
import dev.amatos.restcountries.domain.BaseCountry;
|
import com.restcountries.domain.BaseCountry;
|
||||||
import dev.amatos.restcountries.domain.ICountryRestSymbols;
|
import com.restcountries.domain.ICountryRestSymbols;
|
||||||
|
import org.apache.logging.log4j.LogManager;
|
||||||
|
import org.apache.logging.log4j.Logger;
|
||||||
|
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.io.InputStreamReader;
|
import java.io.InputStreamReader;
|
||||||
@@ -14,12 +16,9 @@ import java.nio.charset.StandardCharsets;
|
|||||||
import java.text.Normalizer;
|
import java.text.Normalizer;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import org.apache.logging.log4j.LogManager;
|
|
||||||
import org.apache.logging.log4j.Logger;
|
|
||||||
|
|
||||||
public class CountryServiceBaseV2 {
|
public class CountryServiceBaseV2 {
|
||||||
|
|
||||||
private static final Logger logger = LogManager.getLogger(CountryServiceBaseV2.class);
|
|
||||||
|
|
||||||
protected <T extends BaseCountry> T getByAlpha(String alpha, List<T> countries) {
|
protected <T extends BaseCountry> T getByAlpha(String alpha, List<T> countries) {
|
||||||
int alphaLength = alpha.length();
|
int alphaLength = alpha.length();
|
||||||
@@ -155,7 +154,6 @@ public class CountryServiceBaseV2 {
|
|||||||
|
|
||||||
protected List<? extends BaseCountry> loadJson(String filename,
|
protected List<? extends BaseCountry> loadJson(String filename,
|
||||||
Class<? extends BaseCountry> clazz) {
|
Class<? extends BaseCountry> clazz) {
|
||||||
logger.info("Loading JSON {}", filename);
|
|
||||||
List<BaseCountry> countries = new ArrayList<>();
|
List<BaseCountry> countries = new ArrayList<>();
|
||||||
InputStream is = CountryServiceBaseV2.class.getClassLoader().getResourceAsStream(filename);
|
InputStream is = CountryServiceBaseV2.class.getClassLoader().getResourceAsStream(filename);
|
||||||
var gson = new Gson();
|
var gson = new Gson();
|
||||||
@@ -170,7 +168,6 @@ public class CountryServiceBaseV2 {
|
|||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
logger.error("Could not load JSON {}", filename);
|
|
||||||
}
|
}
|
||||||
return countries;
|
return countries;
|
||||||
}
|
}
|
||||||
+4
-4
@@ -1,11 +1,11 @@
|
|||||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
package dev.amatos.restcountries.service.v2;
|
package com.restcountries.service.v2;
|
||||||
|
|
||||||
import dev.amatos.restcountries.domain.v2.Country;
|
import com.restcountries.domain.v2.Country;
|
||||||
import dev.amatos.restcountries.domain.v2.Currency;
|
import com.restcountries.domain.v2.Currency;
|
||||||
import dev.amatos.restcountries.domain.v2.RegionalBloc;
|
import com.restcountries.domain.v2.RegionalBloc;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
+4
-3
@@ -1,12 +1,13 @@
|
|||||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
package dev.amatos.restcountries.service.v3;
|
package com.restcountries.service.v3;
|
||||||
|
|
||||||
import com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
import com.google.gson.stream.JsonReader;
|
import com.google.gson.stream.JsonReader;
|
||||||
import dev.amatos.restcountries.domain.ICountryRestSymbols;
|
import com.restcountries.domain.ICountryRestSymbols;
|
||||||
import dev.amatos.restcountries.domain.base.BaseCountry;
|
import com.restcountries.domain.base.BaseCountry;
|
||||||
|
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.io.InputStreamReader;
|
import java.io.InputStreamReader;
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
+6
-4
@@ -1,9 +1,10 @@
|
|||||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
package dev.amatos.restcountries.service.v3;
|
package com.restcountries.service.v3;
|
||||||
|
|
||||||
|
import com.restcountries.domain.v3.Country;
|
||||||
|
|
||||||
import dev.amatos.restcountries.domain.v3.Country;
|
|
||||||
import java.text.Normalizer;
|
import java.text.Normalizer;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
@@ -22,7 +23,7 @@ public class CountryServiceV3 extends CountryServiceBaseV3 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static CountryServiceV3 getInstance() {
|
public static CountryServiceV3 getInstance() {
|
||||||
return CountryServiceV3.InstanceHolder.INSTANCE;
|
return InstanceHolder.INSTANCE;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Set<Country> getAll() {
|
public Set<Country> getAll() {
|
||||||
@@ -84,6 +85,7 @@ public class CountryServiceV3 extends CountryServiceBaseV3 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void initialize() {
|
private void initialize() {
|
||||||
countries = (Set<Country>) super.loadJson("countriesV3.json", Country.class);
|
var c = (Set<Country>) super.loadJson("countriesV3.json", Country.class);
|
||||||
|
countries = c;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+5
-5
@@ -1,13 +1,13 @@
|
|||||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
package dev.amatos.restcountries.service.v3.v31;
|
package com.restcountries.service.v3.v31;
|
||||||
|
|
||||||
|
import com.restcountries.domain.v3.v31.Country;
|
||||||
|
import com.restcountries.service.v3.CountryServiceBaseV3;
|
||||||
|
|
||||||
import dev.amatos.restcountries.domain.v3.v31.Country;
|
|
||||||
import dev.amatos.restcountries.service.v3.CountryServiceBaseV3;
|
|
||||||
import java.text.Normalizer;
|
import java.text.Normalizer;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Optional;
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@@ -25,7 +25,7 @@ public class CountryServiceV31 extends CountryServiceBaseV3 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static CountryServiceV31 getInstance() {
|
public static CountryServiceV31 getInstance() {
|
||||||
return CountryServiceV31.InstanceHolder.INSTANCE;
|
return InstanceHolder.INSTANCE;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Set<Country> getAll() {
|
public Set<Country> getAll() {
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
package dev.amatos.restcountries.utils;
|
package com.restcountries.utils;
|
||||||
|
|
||||||
public class Constants {
|
public class Constants {
|
||||||
public static final String CACHE_CONTROL_VALUE="public, immutable, max-age=31556926";
|
public static final String CACHE_CONTROL_VALUE="public, immutable, max-age=31556926";
|
||||||
@@ -1,25 +0,0 @@
|
|||||||
package dev.amatos.restcountries;
|
|
||||||
|
|
||||||
import io.micronaut.runtime.Micronaut;
|
|
||||||
|
|
||||||
import io.swagger.v3.oas.annotations.OpenAPIDefinition;
|
|
||||||
import io.swagger.v3.oas.annotations.info.Contact;
|
|
||||||
import io.swagger.v3.oas.annotations.info.Info;
|
|
||||||
import io.swagger.v3.oas.annotations.info.License;
|
|
||||||
import io.swagger.v3.oas.annotations.servers.Server;
|
|
||||||
|
|
||||||
|
|
||||||
@OpenAPIDefinition(
|
|
||||||
info = @Info(
|
|
||||||
title = "rest-countries",
|
|
||||||
version = "3.1",
|
|
||||||
description = "Get information about countries via a RESTful API",
|
|
||||||
license = @License(name = "Mozilla Public License MPL 2.0", url = "https://www.mozilla.org/en-US/MPL/2.0/"),
|
|
||||||
contact = @Contact(url = "https://restcountries.com", name = "Alejandro Matos")
|
|
||||||
)
|
|
||||||
)
|
|
||||||
public class Application {
|
|
||||||
public static void main(String[] args) {
|
|
||||||
Micronaut.run(Application.class, args);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,22 +1,18 @@
|
|||||||
|
#Wed Mar 12 15:11:47 UTC 2025
|
||||||
micronaut:
|
micronaut:
|
||||||
application:
|
application:
|
||||||
name: dev.amatos.restcountries
|
name=restcountries
|
||||||
router.static-resources.default:
|
router.static-resources.default:
|
||||||
enabled: true
|
enabled: true
|
||||||
paths: classpath:static
|
paths: classpath:static
|
||||||
mapping: "/**"
|
mapping: "/**"
|
||||||
router:
|
|
||||||
static-resources:
|
|
||||||
swagger:
|
|
||||||
paths: classpath:META-INF/swagger
|
|
||||||
mapping: /openapi/**
|
|
||||||
server:
|
server:
|
||||||
cors:
|
cors:
|
||||||
enabled: true
|
enabled: true
|
||||||
configurations:
|
configurations:
|
||||||
web:
|
web:
|
||||||
allowedMethods:
|
allowedMethods:
|
||||||
- GET
|
- GET
|
||||||
caches:
|
caches:
|
||||||
rate-limiter:
|
rate-limiter:
|
||||||
expire-after-access: 10m
|
expire-after-access: 10m
|
||||||
@@ -1,7 +1,6 @@
|
|||||||
<configuration>
|
<configuration>
|
||||||
|
|
||||||
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
|
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
|
||||||
<withJansi>false</withJansi>
|
|
||||||
<!-- encoders are assigned the type
|
<!-- encoders are assigned the type
|
||||||
ch.qos.logback.classic.encoder.PatternLayoutEncoder by default -->
|
ch.qos.logback.classic.encoder.PatternLayoutEncoder by default -->
|
||||||
<encoder>
|
<encoder>
|
||||||
|
|||||||
+6
-9
@@ -1,16 +1,13 @@
|
|||||||
package dev.amatos.restcountries;
|
package com.restcountries;
|
||||||
|
|
||||||
import dev.amatos.restcountries.domain.v2.Country;
|
import com.restcountries.domain.v2.*;
|
||||||
import dev.amatos.restcountries.domain.v2.Currency;
|
import com.restcountries.service.v2.CountryServiceV2;
|
||||||
import dev.amatos.restcountries.domain.v2.Language;
|
import io.micronaut.test.extensions.junit5.annotation.MicronautTest;
|
||||||
import dev.amatos.restcountries.domain.v2.RegionalBloc;
|
|
||||||
import dev.amatos.restcountries.domain.v2.Translations;
|
|
||||||
import dev.amatos.restcountries.service.v2.CountryServiceV2;
|
|
||||||
import io.micronaut.test.annotation.MicronautTest;
|
|
||||||
import java.util.List;
|
|
||||||
import org.junit.jupiter.api.Assertions;
|
import org.junit.jupiter.api.Assertions;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
@MicronautTest
|
@MicronautTest
|
||||||
class RestCountriesV2Test {
|
class RestCountriesV2Test {
|
||||||
|
|
||||||
+6
-19
@@ -1,29 +1,16 @@
|
|||||||
package dev.amatos.restcountries;
|
package com.restcountries;
|
||||||
|
|
||||||
|
import com.restcountries.service.v3.v31.CountryServiceV31;
|
||||||
import static org.junit.jupiter.api.Assertions.assertFalse;
|
import io.micronaut.test.extensions.junit5.annotation.MicronautTest;
|
||||||
import static org.junit.jupiter.api.Assertions.assertNotNull;
|
|
||||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
|
||||||
|
|
||||||
import dev.amatos.restcountries.domain.v3.v31.Country;
|
|
||||||
import dev.amatos.restcountries.service.v3.v31.CountryServiceV31;
|
|
||||||
import io.micronaut.http.client.RxHttpClient;
|
|
||||||
import io.micronaut.http.client.annotation.Client;
|
|
||||||
import io.micronaut.test.annotation.MicronautTest;
|
|
||||||
import java.security.spec.ECField;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.stream.Collectors;
|
|
||||||
import javax.inject.Inject;
|
|
||||||
import org.junit.jupiter.api.Assertions;
|
import org.junit.jupiter.api.Assertions;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertFalse;
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||||
|
|
||||||
@MicronautTest
|
@MicronautTest
|
||||||
class RestCountriesV31Test {
|
class RestCountriesV31Test {
|
||||||
|
|
||||||
@Inject
|
|
||||||
@Client("/")
|
|
||||||
RxHttpClient rxHttpClient;
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void getAll() {
|
void getAll() {
|
||||||
var countries = CountryServiceV31.getInstance().getAll();
|
var countries = CountryServiceV31.getInstance().getAll();
|
||||||
+3
-3
@@ -1,7 +1,7 @@
|
|||||||
package dev.amatos.restcountries;
|
package com.restcountries;
|
||||||
|
|
||||||
import dev.amatos.restcountries.service.v3.CountryServiceV3;
|
import com.restcountries.service.v3.CountryServiceV3;
|
||||||
import io.micronaut.test.annotation.MicronautTest;
|
import io.micronaut.test.extensions.junit5.annotation.MicronautTest;
|
||||||
import org.junit.jupiter.api.Assertions;
|
import org.junit.jupiter.api.Assertions;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
package com.restcountries;
|
||||||
|
|
||||||
|
import io.micronaut.runtime.EmbeddedApplication;
|
||||||
|
import io.micronaut.test.extensions.junit5.annotation.MicronautTest;
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
import org.junit.jupiter.api.Assertions;
|
||||||
|
|
||||||
|
import jakarta.inject.Inject;
|
||||||
|
|
||||||
|
@MicronautTest
|
||||||
|
class RestcountriesTest {
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
EmbeddedApplication<?> application;
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void testItWorks() {
|
||||||
|
Assertions.assertTrue(application.isRunning());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user