From 6ac9d2a8fb62c4975004e825c25ff3b83aee6d86 Mon Sep 17 00:00:00 2001 From: Daniel Avila Cardenas Date: Fri, 4 Aug 2023 17:06:27 -0500 Subject: [PATCH] cron validador resoluciones activas --- .gitignore | 33 +++++++++++++++++++++++++++++++++ .mvn/wrapper/maven-wrapper.jar | Bin 0 -> 59925 bytes .mvn/wrapper/maven-wrapper.properties | 18 ++++++++++++++++++ config/application.yml | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ log/app.log | 27 +++++++++++++++++++++++++++ mvnw | 316 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ mvnw.cmd | 188 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ pom.xml | 77 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/main/java/com/colsubsidio/monitor/failuresfe/MonitoringServerFailuresFeApplication.java | 37 +++++++++++++++++++++++++++++++++++++ src/main/java/com/colsubsidio/monitor/failuresfe/api/ApiController.java | 33 +++++++++++++++++++++++++++++++++ src/main/java/com/colsubsidio/monitor/failuresfe/business/FailuresBusinessImpl.java | 158 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/main/java/com/colsubsidio/monitor/failuresfe/business/failuresFe/FailuresBusiness.java | 11 +++++++++++ src/main/java/com/colsubsidio/monitor/failuresfe/business/services/ApigeeService.java | 75 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/main/java/com/colsubsidio/monitor/failuresfe/business/services/EmailService.java | 150 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/main/java/com/colsubsidio/monitor/failuresfe/config/RestTemplateConf.java | 16 ++++++++++++++++ src/main/java/com/colsubsidio/monitor/failuresfe/dto/ApigeeTokenReqDTO.java | 14 ++++++++++++++ src/main/java/com/colsubsidio/monitor/failuresfe/dto/ApigeeTokenResDTO.java | 30 ++++++++++++++++++++++++++++++ src/main/java/com/colsubsidio/monitor/failuresfe/dto/EmailRequestDTO.java | 84 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/main/java/com/colsubsidio/monitor/failuresfe/dto/EmailResponseDTO.java | 43 +++++++++++++++++++++++++++++++++++++++++++ src/main/java/com/colsubsidio/monitor/failuresfe/dto/FileSystemDTO.java | 21 +++++++++++++++++++++ src/main/java/com/colsubsidio/monitor/failuresfe/dto/InfoCommanDTO.java | 21 +++++++++++++++++++++ src/main/java/com/colsubsidio/monitor/failuresfe/dto/InfoDisk.java | 19 +++++++++++++++++++ src/main/java/com/colsubsidio/monitor/failuresfe/dto/ResponseDTO.java | 18 ++++++++++++++++++ src/main/java/com/colsubsidio/monitor/failuresfe/util/ApiConstants.java | 8 ++++++++ src/main/java/com/colsubsidio/monitor/failuresfe/util/HandleDate.java | 92 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/main/java/com/colsubsidio/monitor/failuresfe/util/RestTemplateUtil.java | 77 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/main/resources/application.properties | 12 ++++++++++++ src/test/java/com/colsubsidio/monitor/failuresfe/MonitoringServerFailuresFeApplicationTests.java | 13 +++++++++++++ 28 files changed, 1646 insertions(+) create mode 100644 .gitignore create mode 100644 .mvn/wrapper/maven-wrapper.jar create mode 100644 .mvn/wrapper/maven-wrapper.properties create mode 100644 config/application.yml create mode 100644 log/app.log create mode 100755 mvnw create mode 100644 mvnw.cmd create mode 100644 pom.xml create mode 100644 src/main/java/com/colsubsidio/monitor/failuresfe/MonitoringServerFailuresFeApplication.java create mode 100644 src/main/java/com/colsubsidio/monitor/failuresfe/api/ApiController.java create mode 100644 src/main/java/com/colsubsidio/monitor/failuresfe/business/FailuresBusinessImpl.java create mode 100644 src/main/java/com/colsubsidio/monitor/failuresfe/business/failuresFe/FailuresBusiness.java create mode 100644 src/main/java/com/colsubsidio/monitor/failuresfe/business/services/ApigeeService.java create mode 100644 src/main/java/com/colsubsidio/monitor/failuresfe/business/services/EmailService.java create mode 100644 src/main/java/com/colsubsidio/monitor/failuresfe/config/RestTemplateConf.java create mode 100644 src/main/java/com/colsubsidio/monitor/failuresfe/dto/ApigeeTokenReqDTO.java create mode 100644 src/main/java/com/colsubsidio/monitor/failuresfe/dto/ApigeeTokenResDTO.java create mode 100644 src/main/java/com/colsubsidio/monitor/failuresfe/dto/EmailRequestDTO.java create mode 100644 src/main/java/com/colsubsidio/monitor/failuresfe/dto/EmailResponseDTO.java create mode 100644 src/main/java/com/colsubsidio/monitor/failuresfe/dto/FileSystemDTO.java create mode 100644 src/main/java/com/colsubsidio/monitor/failuresfe/dto/InfoCommanDTO.java create mode 100644 src/main/java/com/colsubsidio/monitor/failuresfe/dto/InfoDisk.java create mode 100644 src/main/java/com/colsubsidio/monitor/failuresfe/dto/ResponseDTO.java create mode 100644 src/main/java/com/colsubsidio/monitor/failuresfe/util/ApiConstants.java create mode 100644 src/main/java/com/colsubsidio/monitor/failuresfe/util/HandleDate.java create mode 100644 src/main/java/com/colsubsidio/monitor/failuresfe/util/RestTemplateUtil.java create mode 100644 src/main/resources/application.properties create mode 100644 src/test/java/com/colsubsidio/monitor/failuresfe/MonitoringServerFailuresFeApplicationTests.java diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..549e00a --- /dev/null +++ b/.gitignore @@ -0,0 +1,33 @@ +HELP.md +target/ +!.mvn/wrapper/maven-wrapper.jar +!**/src/main/**/target/ +!**/src/test/**/target/ + +### STS ### +.apt_generated +.classpath +.factorypath +.project +.settings +.springBeans +.sts4-cache + +### IntelliJ IDEA ### +.idea +*.iws +*.iml +*.ipr + +### NetBeans ### +/nbproject/private/ +/nbbuild/ +/dist/ +/nbdist/ +/.nb-gradle/ +build/ +!**/src/main/**/build/ +!**/src/test/**/build/ + +### VS Code ### +.vscode/ diff --git a/.mvn/wrapper/maven-wrapper.jar b/.mvn/wrapper/maven-wrapper.jar new file mode 100644 index 0000000..bf82ff0 Binary files /dev/null and b/.mvn/wrapper/maven-wrapper.jar differ diff --git a/.mvn/wrapper/maven-wrapper.properties b/.mvn/wrapper/maven-wrapper.properties new file mode 100644 index 0000000..ca5ab4b --- /dev/null +++ b/.mvn/wrapper/maven-wrapper.properties @@ -0,0 +1,18 @@ +# 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.8.7/apache-maven-3.8.7-bin.zip +wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.1/maven-wrapper-3.1.1.jar diff --git a/config/application.yml b/config/application.yml new file mode 100644 index 0000000..96df44f --- /dev/null +++ b/config/application.yml @@ -0,0 +1,55 @@ +server: + port: 7000 + servlet: + context-path: /failuresfe/v1.0/ +spring: + datasource: + url : "jdbc:oracle:thin:@192.168.100.108:1521/TLC" + username: "TLC" + password : "TLC" + driver: + class-name: Oracle.jdbc.OracleDriver + application: + name: cron-monitoring-server-failures + version: develop +apigee: + url: https://colsubsidio-prod.apigee.net + path: + auth: /oauth/client_credential/accesstoken + logger: /api/v1/tecnologia/logger + token: + url: /oauth/client_credential/accesstoken + clienteId: 6LaRJinvCnyv5CRmyyu4CU4wR5L2g6wH + clienteSecreto: V2qPQ0xB2gqWXtRX + maxTimeInMillis: 300000 + invoice-manager: + url: /api/v1/tecnologia/local/clientes/facturas + email: + send: + path: /api/v2/tecnologia/notificaciones/correos + remitente: + correo: infofacturaelectronica@colsubsidio.com + responder: infofacturaelectronica@colsubsidio.com + copia: jjonatan.rojas@colsubsidio.com + copia2: pedro.jimenezca@colsubsidio.com + copia3: nestor.martinez@colsubsidio.com + subject: Notificacion Usabilidad disco duro FE +api: + constant: + disk: 90 + command-disk: "df -h" + command-disk-home: "df -h /home" + command-server-ip: "hostname -I" + cron: + freq: + scheduled: "0 0 0 * * ?" #0 0 */3 ? * * +logging: + file: + name: log/app.log + max-history: 2 + max-size: 100MB + clean-history-on-start: true + level: + org.springframework: INFO + root: INFO + org.hibernate: INFO \ No newline at end of file diff --git a/log/app.log b/log/app.log new file mode 100644 index 0000000..5423bf9 --- /dev/null +++ b/log/app.log @@ -0,0 +1,27 @@ +2023-06-07 13:22:16.039 [INFO ] [] c.c.m.f.MonitoringServerFailuresFeApplicationTests:55 - Starting MonitoringServerFailuresFeApplicationTests using Java 1.8.0_352 on ubuntu-vivobook with PID 122668 (started by daniel in /home/daniel/Documentos/desarrollo/develop_works/projects/failuresfe) +2023-06-07 13:22:16.041 [INFO ] [] c.c.m.f.MonitoringServerFailuresFeApplicationTests:631 - No active profile set, falling back to 1 default profile: "default" +2023-06-07 13:22:16.549 [INFO ] [] o.s.d.r.c.RepositoryConfigurationDelegate:132 - Bootstrapping Spring Data JDBC repositories in DEFAULT mode. +2023-06-07 13:22:16.560 [INFO ] [] o.s.d.r.c.RepositoryConfigurationDelegate:201 - Finished Spring Data repository scanning in 6 ms. Found 0 JDBC repository interfaces. +2023-06-07 13:22:17.664 [INFO ] [] c.z.h.HikariDataSource:110 - HikariPool-1 - Starting... +2023-06-07 13:22:18.422 [INFO ] [] c.z.h.HikariDataSource:123 - HikariPool-1 - Start completed. +2023-06-07 13:22:18.630 [INFO ] [] c.c.m.f.MonitoringServerFailuresFeApplicationTests:61 - Started MonitoringServerFailuresFeApplicationTests in 12.919 seconds (JVM running for 13.656) +2023-06-07 13:22:18.859 [INFO ] [] c.z.h.HikariDataSource:350 - HikariPool-1 - Shutdown initiated... +2023-06-07 13:22:19.098 [INFO ] [] c.z.h.HikariDataSource:352 - HikariPool-1 - Shutdown completed. +2023-06-07 13:49:54.084 [INFO ] [] c.c.m.f.MonitoringServerFailuresFeApplicationTests:55 - Starting MonitoringServerFailuresFeApplicationTests using Java 1.8.0_352 on ubuntu-vivobook with PID 138265 (started by daniel in /home/daniel/Documentos/desarrollo/develop_works/projects/failuresfe) +2023-06-07 13:49:54.086 [INFO ] [] c.c.m.f.MonitoringServerFailuresFeApplicationTests:631 - No active profile set, falling back to 1 default profile: "default" +2023-06-07 13:49:54.489 [INFO ] [] o.s.d.r.c.RepositoryConfigurationDelegate:132 - Bootstrapping Spring Data JDBC repositories in DEFAULT mode. +2023-06-07 13:49:54.497 [INFO ] [] o.s.d.r.c.RepositoryConfigurationDelegate:201 - Finished Spring Data repository scanning in 4 ms. Found 0 JDBC repository interfaces. +2023-06-07 13:49:55.497 [INFO ] [] c.z.h.HikariDataSource:110 - HikariPool-1 - Starting... +2023-06-07 13:49:56.323 [INFO ] [] c.z.h.HikariDataSource:123 - HikariPool-1 - Start completed. +2023-06-07 13:49:56.483 [INFO ] [] c.c.m.f.MonitoringServerFailuresFeApplicationTests:61 - Started MonitoringServerFailuresFeApplicationTests in 2.785 seconds (JVM running for 3.458) +2023-06-07 13:49:56.683 [INFO ] [] c.z.h.HikariDataSource:350 - HikariPool-1 - Shutdown initiated... +2023-06-07 13:49:56.878 [INFO ] [] c.z.h.HikariDataSource:352 - HikariPool-1 - Shutdown completed. +2023-06-07 14:06:49.047 [INFO ] [] c.c.m.f.MonitoringServerFailuresFeApplicationTests:55 - Starting MonitoringServerFailuresFeApplicationTests using Java 1.8.0_352 on ubuntu-vivobook with PID 148048 (started by daniel in /home/daniel/Documentos/desarrollo/develop_works/projects/failuresfe) +2023-06-07 14:06:49.048 [INFO ] [] c.c.m.f.MonitoringServerFailuresFeApplicationTests:631 - No active profile set, falling back to 1 default profile: "default" +2023-06-07 14:06:49.531 [INFO ] [] o.s.d.r.c.RepositoryConfigurationDelegate:132 - Bootstrapping Spring Data JDBC repositories in DEFAULT mode. +2023-06-07 14:06:49.542 [INFO ] [] o.s.d.r.c.RepositoryConfigurationDelegate:201 - Finished Spring Data repository scanning in 6 ms. Found 0 JDBC repository interfaces. +2023-06-07 14:06:50.738 [INFO ] [] c.z.h.HikariDataSource:110 - HikariPool-1 - Starting... +2023-06-07 14:06:51.828 [INFO ] [] c.z.h.HikariDataSource:123 - HikariPool-1 - Start completed. +2023-06-07 14:06:52.076 [INFO ] [] c.c.m.f.MonitoringServerFailuresFeApplicationTests:61 - Started MonitoringServerFailuresFeApplicationTests in 3.363 seconds (JVM running for 3.968) +2023-06-07 14:06:52.318 [INFO ] [] c.z.h.HikariDataSource:350 - HikariPool-1 - Shutdown initiated... +2023-06-07 14:06:52.617 [INFO ] [] c.z.h.HikariDataSource:352 - HikariPool-1 - Shutdown completed. diff --git a/mvnw b/mvnw new file mode 100755 index 0000000..8a8fb22 --- /dev/null +++ b/mvnw @@ -0,0 +1,316 @@ +#!/bin/sh +# ---------------------------------------------------------------------------- +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# 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. +# ---------------------------------------------------------------------------- + +# ---------------------------------------------------------------------------- +# Maven Start Up Batch script +# +# Required ENV vars: +# ------------------ +# JAVA_HOME - location of a JDK home dir +# +# Optional ENV vars +# ----------------- +# M2_HOME - location of maven2's installed home dir +# MAVEN_OPTS - parameters passed to the Java VM when running Maven +# e.g. to debug Maven itself, use +# set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 +# MAVEN_SKIP_RC - flag to disable loading of mavenrc files +# ---------------------------------------------------------------------------- + +if [ -z "$MAVEN_SKIP_RC" ] ; then + + if [ -f /usr/local/etc/mavenrc ] ; then + . /usr/local/etc/mavenrc + fi + + if [ -f /etc/mavenrc ] ; then + . /etc/mavenrc + fi + + if [ -f "$HOME/.mavenrc" ] ; then + . "$HOME/.mavenrc" + fi + +fi + +# OS specific support. $var _must_ be set to either true or false. +cygwin=false; +darwin=false; +mingw=false +case "`uname`" in + CYGWIN*) cygwin=true ;; + MINGW*) mingw=true;; + Darwin*) darwin=true + # Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home + # See https://developer.apple.com/library/mac/qa/qa1170/_index.html + if [ -z "$JAVA_HOME" ]; then + if [ -x "/usr/libexec/java_home" ]; then + export JAVA_HOME="`/usr/libexec/java_home`" + else + export JAVA_HOME="/Library/Java/Home" + fi + fi + ;; +esac + +if [ -z "$JAVA_HOME" ] ; then + if [ -r /etc/gentoo-release ] ; then + JAVA_HOME=`java-config --jre-home` + fi +fi + +if [ -z "$M2_HOME" ] ; then + ## resolve links - $0 may be a link to maven's home + PRG="$0" + + # need this for relative symlinks + while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG="`dirname "$PRG"`/$link" + fi + done + + saveddir=`pwd` + + M2_HOME=`dirname "$PRG"`/.. + + # make it fully qualified + M2_HOME=`cd "$M2_HOME" && pwd` + + cd "$saveddir" + # echo Using m2 at $M2_HOME +fi + +# For Cygwin, ensure paths are in UNIX format before anything is touched +if $cygwin ; then + [ -n "$M2_HOME" ] && + M2_HOME=`cygpath --unix "$M2_HOME"` + [ -n "$JAVA_HOME" ] && + JAVA_HOME=`cygpath --unix "$JAVA_HOME"` + [ -n "$CLASSPATH" ] && + CLASSPATH=`cygpath --path --unix "$CLASSPATH"` +fi + +# For Mingw, ensure paths are in UNIX format before anything is touched +if $mingw ; then + [ -n "$M2_HOME" ] && + M2_HOME="`(cd "$M2_HOME"; pwd)`" + [ -n "$JAVA_HOME" ] && + JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`" +fi + +if [ -z "$JAVA_HOME" ]; then + javaExecutable="`which javac`" + if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then + # readlink(1) is not available as standard on Solaris 10. + readLink=`which readlink` + if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then + if $darwin ; then + javaHome="`dirname \"$javaExecutable\"`" + javaExecutable="`cd \"$javaHome\" && pwd -P`/javac" + else + javaExecutable="`readlink -f \"$javaExecutable\"`" + fi + javaHome="`dirname \"$javaExecutable\"`" + javaHome=`expr "$javaHome" : '\(.*\)/bin'` + JAVA_HOME="$javaHome" + export JAVA_HOME + fi + fi +fi + +if [ -z "$JAVACMD" ] ; then + if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + else + JAVACMD="`\\unset -f command; \\command -v java`" + fi +fi + +if [ ! -x "$JAVACMD" ] ; then + echo "Error: JAVA_HOME is not defined correctly." >&2 + echo " We cannot execute $JAVACMD" >&2 + exit 1 +fi + +if [ -z "$JAVA_HOME" ] ; then + echo "Warning: JAVA_HOME environment variable is not set." +fi + +CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher + +# traverses directory structure from process work directory to filesystem root +# first directory with .mvn subdirectory is considered project base directory +find_maven_basedir() { + + if [ -z "$1" ] + then + echo "Path not specified to find_maven_basedir" + return 1 + fi + + basedir="$1" + wdir="$1" + while [ "$wdir" != '/' ] ; do + if [ -d "$wdir"/.mvn ] ; then + basedir=$wdir + break + fi + # workaround for JBEAP-8937 (on Solaris 10/Sparc) + if [ -d "${wdir}" ]; then + wdir=`cd "$wdir/.."; pwd` + fi + # end of workaround + done + echo "${basedir}" +} + +# concatenates all lines of a file +concat_lines() { + if [ -f "$1" ]; then + echo "$(tr -s '\n' ' ' < "$1")" + fi +} + +BASE_DIR=`find_maven_basedir "$(pwd)"` +if [ -z "$BASE_DIR" ]; then + exit 1; +fi + +########################################################################################## +# Extension to allow automatically downloading the maven-wrapper.jar from Maven-central +# This allows using the maven wrapper in projects that prohibit checking in binary data. +########################################################################################## +if [ -r "$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" ]; then + if [ "$MVNW_VERBOSE" = true ]; then + echo "Found .mvn/wrapper/maven-wrapper.jar" + fi +else + if [ "$MVNW_VERBOSE" = true ]; then + echo "Couldn't find .mvn/wrapper/maven-wrapper.jar, downloading it ..." + fi + if [ -n "$MVNW_REPOURL" ]; then + jarUrl="$MVNW_REPOURL/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar" + else + jarUrl="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar" + fi + while IFS="=" read key value; do + case "$key" in (wrapperUrl) jarUrl="$value"; break ;; + esac + done < "$BASE_DIR/.mvn/wrapper/maven-wrapper.properties" + if [ "$MVNW_VERBOSE" = true ]; then + echo "Downloading from: $jarUrl" + fi + wrapperJarPath="$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" + if $cygwin; then + wrapperJarPath=`cygpath --path --windows "$wrapperJarPath"` + fi + + if command -v wget > /dev/null; then + if [ "$MVNW_VERBOSE" = true ]; then + echo "Found wget ... using wget" + fi + if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then + wget "$jarUrl" -O "$wrapperJarPath" || rm -f "$wrapperJarPath" + else + wget --http-user=$MVNW_USERNAME --http-password=$MVNW_PASSWORD "$jarUrl" -O "$wrapperJarPath" || rm -f "$wrapperJarPath" + fi + elif command -v curl > /dev/null; then + if [ "$MVNW_VERBOSE" = true ]; then + echo "Found curl ... using curl" + fi + if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then + curl -o "$wrapperJarPath" "$jarUrl" -f + else + curl --user $MVNW_USERNAME:$MVNW_PASSWORD -o "$wrapperJarPath" "$jarUrl" -f + fi + + else + if [ "$MVNW_VERBOSE" = true ]; then + echo "Falling back to using Java to download" + fi + javaClass="$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.java" + # For Cygwin, switch paths to Windows format before running javac + if $cygwin; then + javaClass=`cygpath --path --windows "$javaClass"` + fi + if [ -e "$javaClass" ]; then + if [ ! -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then + if [ "$MVNW_VERBOSE" = true ]; then + echo " - Compiling MavenWrapperDownloader.java ..." + fi + # Compiling the Java class + ("$JAVA_HOME/bin/javac" "$javaClass") + fi + if [ -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then + # Running the downloader + if [ "$MVNW_VERBOSE" = true ]; then + echo " - Running MavenWrapperDownloader.java ..." + fi + ("$JAVA_HOME/bin/java" -cp .mvn/wrapper MavenWrapperDownloader "$MAVEN_PROJECTBASEDIR") + fi + fi + fi +fi +########################################################################################## +# End of extension +########################################################################################## + +export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"} +if [ "$MVNW_VERBOSE" = true ]; then + echo $MAVEN_PROJECTBASEDIR +fi +MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS" + +# For Cygwin, switch paths to Windows format before running java +if $cygwin; then + [ -n "$M2_HOME" ] && + M2_HOME=`cygpath --path --windows "$M2_HOME"` + [ -n "$JAVA_HOME" ] && + JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"` + [ -n "$CLASSPATH" ] && + CLASSPATH=`cygpath --path --windows "$CLASSPATH"` + [ -n "$MAVEN_PROJECTBASEDIR" ] && + MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"` +fi + +# 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 + +exec "$JAVACMD" \ + $MAVEN_OPTS \ + $MAVEN_DEBUG_OPTS \ + -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \ + "-Dmaven.home=${M2_HOME}" \ + "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \ + ${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@" diff --git a/mvnw.cmd b/mvnw.cmd new file mode 100644 index 0000000..1d8ab01 --- /dev/null +++ b/mvnw.cmd @@ -0,0 +1,188 @@ +@REM ---------------------------------------------------------------------------- +@REM Licensed to the Apache Software Foundation (ASF) under one +@REM or more contributor license agreements. See the NOTICE file +@REM distributed with this work for additional information +@REM regarding copyright ownership. The ASF licenses this file +@REM to you under the Apache License, Version 2.0 (the +@REM "License"); you may not use this file except in compliance +@REM with the License. You may obtain a copy of the License at +@REM +@REM https://www.apache.org/licenses/LICENSE-2.0 +@REM +@REM Unless required by applicable law or agreed to in writing, +@REM software distributed under the License is distributed on an +@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +@REM KIND, either express or implied. See the License for the +@REM specific language governing permissions and limitations +@REM under the License. +@REM ---------------------------------------------------------------------------- + +@REM ---------------------------------------------------------------------------- +@REM Maven Start Up Batch script +@REM +@REM Required ENV vars: +@REM JAVA_HOME - location of a JDK home dir +@REM +@REM Optional ENV vars +@REM M2_HOME - location of maven2's installed home dir +@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands +@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a keystroke before ending +@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven +@REM e.g. to debug Maven itself, use +@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 +@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files +@REM ---------------------------------------------------------------------------- + +@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on' +@echo off +@REM set title of command window +title %0 +@REM enable echoing by setting MAVEN_BATCH_ECHO to 'on' +@if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO% + +@REM set %HOME% to equivalent of $HOME +if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%") + +@REM Execute a user defined script before this one +if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre +@REM check for pre script, once with legacy .bat ending and once with .cmd ending +if exist "%USERPROFILE%\mavenrc_pre.bat" call "%USERPROFILE%\mavenrc_pre.bat" %* +if exist "%USERPROFILE%\mavenrc_pre.cmd" call "%USERPROFILE%\mavenrc_pre.cmd" %* +:skipRcPre + +@setlocal + +set ERROR_CODE=0 + +@REM To isolate internal variables from possible post scripts, we use another setlocal +@setlocal + +@REM ==== START VALIDATION ==== +if not "%JAVA_HOME%" == "" goto OkJHome + +echo. +echo Error: JAVA_HOME not found in your environment. >&2 +echo Please set the JAVA_HOME variable in your environment to match the >&2 +echo location of your Java installation. >&2 +echo. +goto error + +:OkJHome +if exist "%JAVA_HOME%\bin\java.exe" goto init + +echo. +echo Error: JAVA_HOME is set to an invalid directory. >&2 +echo JAVA_HOME = "%JAVA_HOME%" >&2 +echo Please set the JAVA_HOME variable in your environment to match the >&2 +echo location of your Java installation. >&2 +echo. +goto error + +@REM ==== END VALIDATION ==== + +:init + +@REM Find the project base dir, i.e. the directory that contains the folder ".mvn". +@REM Fallback to current working directory if not found. + +set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR% +IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir + +set EXEC_DIR=%CD% +set WDIR=%EXEC_DIR% +:findBaseDir +IF EXIST "%WDIR%"\.mvn goto baseDirFound +cd .. +IF "%WDIR%"=="%CD%" goto baseDirNotFound +set WDIR=%CD% +goto findBaseDir + +:baseDirFound +set MAVEN_PROJECTBASEDIR=%WDIR% +cd "%EXEC_DIR%" +goto endDetectBaseDir + +:baseDirNotFound +set MAVEN_PROJECTBASEDIR=%EXEC_DIR% +cd "%EXEC_DIR%" + +:endDetectBaseDir + +IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig + +@setlocal EnableExtensions EnableDelayedExpansion +for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a +@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS% + +:endReadAdditionalConfig + +SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe" +set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar" +set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain + +set DOWNLOAD_URL="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar" + +FOR /F "usebackq tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO ( + IF "%%A"=="wrapperUrl" SET DOWNLOAD_URL=%%B +) + +@REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central +@REM This allows using the maven wrapper in projects that prohibit checking in binary data. +if exist %WRAPPER_JAR% ( + if "%MVNW_VERBOSE%" == "true" ( + echo Found %WRAPPER_JAR% + ) +) else ( + if not "%MVNW_REPOURL%" == "" ( + SET DOWNLOAD_URL="%MVNW_REPOURL%/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar" + ) + if "%MVNW_VERBOSE%" == "true" ( + echo Couldn't find %WRAPPER_JAR%, downloading it ... + echo Downloading from: %DOWNLOAD_URL% + ) + + powershell -Command "&{"^ + "$webclient = new-object System.Net.WebClient;"^ + "if (-not ([string]::IsNullOrEmpty('%MVNW_USERNAME%') -and [string]::IsNullOrEmpty('%MVNW_PASSWORD%'))) {"^ + "$webclient.Credentials = new-object System.Net.NetworkCredential('%MVNW_USERNAME%', '%MVNW_PASSWORD%');"^ + "}"^ + "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $webclient.DownloadFile('%DOWNLOAD_URL%', '%WRAPPER_JAR%')"^ + "}" + if "%MVNW_VERBOSE%" == "true" ( + echo Finished downloading %WRAPPER_JAR% + ) +) +@REM End of extension + +@REM Provide a "standardized" way to retrieve the CLI args that will +@REM work with both Windows and non-Windows executions. +set MAVEN_CMD_LINE_ARGS=%* + +%MAVEN_JAVA_EXE% ^ + %JVM_CONFIG_MAVEN_PROPS% ^ + %MAVEN_OPTS% ^ + %MAVEN_DEBUG_OPTS% ^ + -classpath %WRAPPER_JAR% ^ + "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" ^ + %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %* +if ERRORLEVEL 1 goto error +goto end + +:error +set ERROR_CODE=1 + +:end +@endlocal & set ERROR_CODE=%ERROR_CODE% + +if not "%MAVEN_SKIP_RC%"=="" goto skipRcPost +@REM check for post script, once with legacy .bat ending and once with .cmd ending +if exist "%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% diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..7b6c78a --- /dev/null +++ b/pom.xml @@ -0,0 +1,77 @@ + + + 4.0.0 + + org.springframework.boot + spring-boot-starter-parent + 2.7.12 + + + com.colsubsidio.monitor + monitorFeServerCapacidad + 0.0.1 + monitorFeServerCapacidad + Demo project for Spring Boot + + 1.8 + + + + org.springframework.boot + spring-boot-starter-data-jdbc + + + com.oracle.database.jdbc + ojdbc8 + + + org.springframework.boot + spring-boot-starter-mail + + + org.springframework.boot + spring-boot-starter-web + + + com.google.code.gson + gson + jar + + + + org.springframework.boot + spring-boot-devtools + runtime + true + + + org.projectlombok + lombok + true + + + org.springframework.boot + spring-boot-starter-test + test + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + + org.projectlombok + lombok + + + + + + + + diff --git a/src/main/java/com/colsubsidio/monitor/failuresfe/MonitoringServerFailuresFeApplication.java b/src/main/java/com/colsubsidio/monitor/failuresfe/MonitoringServerFailuresFeApplication.java new file mode 100644 index 0000000..14c5ce9 --- /dev/null +++ b/src/main/java/com/colsubsidio/monitor/failuresfe/MonitoringServerFailuresFeApplication.java @@ -0,0 +1,37 @@ +package com.colsubsidio.monitor.failuresfe; + +import com.colsubsidio.monitor.failuresfe.business.failuresFe.FailuresBusiness; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.EnableAutoConfiguration; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.scheduling.annotation.EnableScheduling; +import org.springframework.scheduling.annotation.Scheduled; + +import java.io.IOException; + +@EnableAutoConfiguration +@EnableScheduling +@Slf4j +@SpringBootApplication +public class MonitoringServerFailuresFeApplication { + + + private FailuresBusiness failuresBusiness; + + public MonitoringServerFailuresFeApplication(FailuresBusiness failuresBusiness){ + this.failuresBusiness = failuresBusiness; + } + + public static void main(String[] args) { + SpringApplication.run(MonitoringServerFailuresFeApplication.class, args); + } + + @Scheduled(cron = "${api.cron.freq.scheduled}") + public void run() throws IOException { + log.info("Iniciando proceso [MonitoringServerFailuresFeApplication] [run] --> cronFallosFacturacionElectronica()"); + this.failuresBusiness.cronExecuteFailuresFe(); + } + +} diff --git a/src/main/java/com/colsubsidio/monitor/failuresfe/api/ApiController.java b/src/main/java/com/colsubsidio/monitor/failuresfe/api/ApiController.java new file mode 100644 index 0000000..3385155 --- /dev/null +++ b/src/main/java/com/colsubsidio/monitor/failuresfe/api/ApiController.java @@ -0,0 +1,33 @@ +package com.colsubsidio.monitor.failuresfe.api; + +import com.colsubsidio.monitor.failuresfe.business.failuresFe.FailuresBusiness; +import com.colsubsidio.monitor.failuresfe.dto.ResponseDTO; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RestController; + +import java.io.IOException; + +@RestController +public class ApiController { + + @Value("${server.servlet.context-path}") + private String version; + + @Autowired + private FailuresBusiness failuresBusiness; + + + @GetMapping + public ResponseEntity index() { + return ResponseEntity.ok("api version failuresFE! " + this.version); + } + + @GetMapping("/disk") + public ResponseEntity getResultValidactionDiskMemory() throws IOException { + return ResponseEntity.ok(this.failuresBusiness.cronExecuteFailuresFe()); + } +} diff --git a/src/main/java/com/colsubsidio/monitor/failuresfe/business/FailuresBusinessImpl.java b/src/main/java/com/colsubsidio/monitor/failuresfe/business/FailuresBusinessImpl.java new file mode 100644 index 0000000..82c85c2 --- /dev/null +++ b/src/main/java/com/colsubsidio/monitor/failuresfe/business/FailuresBusinessImpl.java @@ -0,0 +1,158 @@ +package com.colsubsidio.monitor.failuresfe.business; + +import com.colsubsidio.monitor.failuresfe.business.failuresFe.FailuresBusiness; +import com.colsubsidio.monitor.failuresfe.business.services.EmailService; +import com.colsubsidio.monitor.failuresfe.dto.InfoCommanDTO; +import com.colsubsidio.monitor.failuresfe.dto.InfoDisk; +import com.colsubsidio.monitor.failuresfe.dto.ResponseDTO; +import com.colsubsidio.monitor.failuresfe.util.ApiConstants; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Component; + +import javax.sound.sampled.Line; +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStreamReader; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.stream.Collectors; +import java.util.stream.Stream; + +@Slf4j +@Component +public class FailuresBusinessImpl implements FailuresBusiness { + + @Autowired + private EmailService emailService; + + @Value("${api.constant.disk}") + private String useDisk; + + @Value("${api.constant.command-disk}") + private String command_disk; + + @Value("${api.constant.command-server-ip}") + private String command_ip; + + @Value("${api.constant.command-disk-home}") + private String command_home; + + public String templatePorcentajes = ""; + + @Override + public ResponseDTO cronExecuteFailuresFe() throws IOException { + return this.sendEmailInformation(this.getDiskInfo()); + } + + @Override + public ResponseDTO sendEmailInformation(InfoDisk infoDisk) throws IOException { + ResponseDTO responseDTO = new ResponseDTO(); + log.info("Validando espacio en disco [FailuresBusinessImpl] [sendEmailInformation]" + infoDisk.getPercentageUse()); + if(!this.templatePorcentajes.equals("") && this.templatePorcentajes != null){ + + log.info("Espacio en disco critico -> Invocando.. [emailService]"); + + responseDTO = this.emailService.send(this.emailService.setTemplateEmailMessageContent(infoDisk)); + + } else { + responseDTO.setStatusCode("200"); + responseDTO.setMessage("Espacio en Disco satisfactorio"); + responseDTO.setResponse(infoDisk.toString()); + } + return responseDTO; + } + + public InfoDisk getDiskInfo() throws IOException { + StringBuilder output = new StringBuilder(); + List infoDisckDetalle = new ArrayList<>(); + String templateDetalle = ""; + ArrayList detalle = new ArrayList<>(); + String line = null; + List tokens = null; + + + Process process = Runtime.getRuntime().exec(command_disk); + Process processHome = Runtime.getRuntime().exec(command_home); + Process host = Runtime.getRuntime().exec(command_ip); + + BufferedReader reader = new BufferedReader(new InputStreamReader(process.getInputStream())); + BufferedReader reader2 = new BufferedReader(new InputStreamReader(processHome.getInputStream())); + BufferedReader reader3 = new BufferedReader(new InputStreamReader(host.getInputStream())); + String ip = reader3.readLine().toString(); + templateDetalle += "

MENSAJE IMPORTANTE (Facturación electronica)

" + + "

Porcentaje Usabilidad Disco Servidor: " + ip + "

"+ + "
"+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""; + int j = 0; + String valor = null; + log.info("Comenzando building template --> para envio getDiskInfo"); + while((line = reader.readLine()) != null){ + detalle.add(line); + output.append(line).append("\n"); + if(j > 0){ + try { + String[] parts = line.split("\\s+"); + log.info("Longitud tuberia command info df -h -->" + parts.length); + if(parts.length == 1){ + valor = parts[0]; + } else if (parts.length == 6){ + List partition = Arrays.stream(parts).collect(Collectors.toList()); + if(parts[0] == null || parts[0].equals("")){ + partition.set(0, valor); + } + + if(Integer.parseInt(partition.get(4).replace("%","")) > Integer.parseInt(useDisk)){ + this.templatePorcentajes += "

Alerta: Se ha usado el " + partition.get(4) + " en la ubicación

"+ partition.get(5)+"
"; + } + + log.info("valor FileSystem template --> " + partition.get(0)); + log.info("Longitud para crear template --> " + partition.size()); + templateDetalle += "
"; + templateDetalle += ""; + templateDetalle += ""; + templateDetalle += ""; + templateDetalle += ""; + templateDetalle += ""; + + infoDisckDetalle.add(InfoCommanDTO.builder().fileSystem(partition.get(0)) + .size(partition.get(1)).avail(partition.get(2)).used(partition.get(3)).usePercent(partition.get(4)) + .mounted(partition.get(5)).build()); + log.info("Creo objeto infoDisckDetalle --> " + partition.get(0)); + } + } catch (Exception e){ + log.info("Error creando template detalle" + e.getMessage()); + } + } + j++; + } + log.info("--------------------------------------------------------------------"); + log.info("IndoDisk -->" + infoDisckDetalle.toString()); + log.info("Paso la creacion del detalle de disk server"); + int i = 0; + String percentUse = ""; + while((line = reader2.readLine()) != null){ + if( i > 0 ){ + String[] parts = line.split("\\s+"); + if(parts.length > 1){ + List info = Arrays.stream(parts).collect(Collectors.toList()); + tokens = info; + percentUse = info.get(4); + } + } + i++; + } + + templateDetalle += "
Archivo SistemaTamañoUsadosDisponiblesUso%Ubicacion
"+ partition.get(0) +""+ partition.get(1)+""+ partition.get(2)+""+ partition.get(3)+""+ partition.get(4)+""+ partition.get(5)+"
"+this.templatePorcentajes+"
"; + log.info("Termino la creacion del template"); + return InfoDisk.builder().serverInfo(output.toString()).ip(ip).percentageUse(percentUse) + .infoDiskHome(tokens.toString()).infoDetalle(infoDisckDetalle).template(templateDetalle).build(); + } +} diff --git a/src/main/java/com/colsubsidio/monitor/failuresfe/business/failuresFe/FailuresBusiness.java b/src/main/java/com/colsubsidio/monitor/failuresfe/business/failuresFe/FailuresBusiness.java new file mode 100644 index 0000000..9886295 --- /dev/null +++ b/src/main/java/com/colsubsidio/monitor/failuresfe/business/failuresFe/FailuresBusiness.java @@ -0,0 +1,11 @@ +package com.colsubsidio.monitor.failuresfe.business.failuresFe; + +import com.colsubsidio.monitor.failuresfe.dto.InfoDisk; +import com.colsubsidio.monitor.failuresfe.dto.ResponseDTO; + +import java.io.IOException; + +public interface FailuresBusiness { + ResponseDTO cronExecuteFailuresFe() throws IOException; + ResponseDTO sendEmailInformation(InfoDisk infoDisk) throws IOException; +} diff --git a/src/main/java/com/colsubsidio/monitor/failuresfe/business/services/ApigeeService.java b/src/main/java/com/colsubsidio/monitor/failuresfe/business/services/ApigeeService.java new file mode 100644 index 0000000..42765bb --- /dev/null +++ b/src/main/java/com/colsubsidio/monitor/failuresfe/business/services/ApigeeService.java @@ -0,0 +1,75 @@ +package com.colsubsidio.monitor.failuresfe.business.services; + +import com.colsubsidio.monitor.failuresfe.dto.ApigeeTokenReqDTO; +import com.colsubsidio.monitor.failuresfe.dto.ApigeeTokenResDTO; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.http.*; +import org.springframework.http.client.HttpComponentsClientHttpRequestFactory; +import org.springframework.stereotype.Component; +import org.springframework.web.client.RestTemplate; +import org.springframework.web.util.UriComponentsBuilder; + +import java.time.LocalDateTime; +import java.time.ZoneId; +@Component +public class ApigeeService { + + @Value("${apigee.url}") + private String urlApi; + + @Value("${apigee.token.clienteId}") + private String clienteId; + + @Value("${apigee.token.clienteSecreto}") + private String clienteSecreto; + + @Value("${apigee.token.maxTimeInMillis}") + private Long maxTimeInMillis; + + @Value("${apigee.token.url}") + private String auth; + + @Value("${apigee.path.logger}") + private String logger; + + private String token; + private LocalDateTime tokenDate; + + public String getToken() { + if (token == null) { + generateToken(); + } else { + long tokenMillis = tokenDate.atZone(ZoneId.systemDefault()).toInstant().toEpochMilli(); + long currMillis = LocalDateTime.now().atZone(ZoneId.systemDefault()).toInstant().toEpochMilli(); + Long timeLive = currMillis - tokenMillis; + if (timeLive > maxTimeInMillis) { + generateToken(); + } + } + return token; + } + + private void generateToken() { + ApigeeTokenReqDTO request = new ApigeeTokenReqDTO(); + request.setClienteId(clienteId); + request.setClienteSecreto(clienteSecreto); + token = postAccessToken(request).getAccess_token(); + tokenDate = LocalDateTime.now(); + } + + public ApigeeTokenResDTO postAccessToken(ApigeeTokenReqDTO request) { + RestTemplate restTemplate = new RestTemplate(); + UriComponentsBuilder uri = UriComponentsBuilder.fromHttpUrl(urlApi + auth); + + HttpHeaders headers = new HttpHeaders(); + headers.setContentType(MediaType.APPLICATION_JSON); + + HttpEntity entity = new HttpEntity<>(request, headers); + + ResponseEntity result + = restTemplate.exchange(uri.toUriString(), HttpMethod.POST, entity, ApigeeTokenResDTO.class); + + return result.getBody(); + } + +} \ No newline at end of file diff --git a/src/main/java/com/colsubsidio/monitor/failuresfe/business/services/EmailService.java b/src/main/java/com/colsubsidio/monitor/failuresfe/business/services/EmailService.java new file mode 100644 index 0000000..cb8f3eb --- /dev/null +++ b/src/main/java/com/colsubsidio/monitor/failuresfe/business/services/EmailService.java @@ -0,0 +1,150 @@ +package com.colsubsidio.monitor.failuresfe.business.services; + + +import com.colsubsidio.monitor.failuresfe.dto.EmailRequestDTO; +import com.colsubsidio.monitor.failuresfe.dto.EmailResponseDTO; +import com.colsubsidio.monitor.failuresfe.dto.InfoDisk; +import com.colsubsidio.monitor.failuresfe.dto.ResponseDTO; +import com.colsubsidio.monitor.failuresfe.util.ApiConstants; +import com.colsubsidio.monitor.failuresfe.util.HandleDate; +import com.colsubsidio.monitor.failuresfe.util.RestTemplateUtil; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.http.HttpMethod; +import org.springframework.stereotype.Component; +import org.springframework.web.util.UriComponentsBuilder; + +import org.springframework.http.ResponseEntity; + +import javax.security.auth.login.Configuration; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; + +@Component +@Slf4j +public class EmailService { + + @Value("${apigee.url}") + private String urlApigee; + + @Value("${apigee.email.send.path}") + private String mailEndpoint; + + @Value("${apigee.email.send.subject}") + private String emailSubject; + + @Value("${apigee.email.send.copia}") + private String copia; + + @Value("${apigee.email.send.copia2}") + private String copia2; + + + @Value("${apigee.email.send.copia3}") + private String copia3; + + @Value("${apigee.email.send.copia4}") + private String copia4; + + @Value("${apigee.email.send.remitente.correo}") + private String correo; + + @Value("${apigee.email.send.remitente.responder}") + private String responder; + + @Autowired + private RestTemplateUtil restTemplateUtil; + + @Autowired + private HandleDate handleDate; + + /** + * clase encargada de crear el cuerpo y datos del email + * @throws IOException + */ + public EmailRequestDTO setTemplateEmailMessageContent(InfoDisk info) throws IOException { + + try{ + log.info("Modelando datos [setTemplateEmailMessageContent] [EmailService] -> " + info.getIp()); + + EmailRequestDTO emailRequestDTO = new EmailRequestDTO(); + List listaParametros = new ArrayList<>(); + //To this value do for to build td -> row's of data + //listaParametros.add(new EmailRequestDTO.Parametro("server", "text", info.getIp())); + //listaParametros.add(new EmailRequestDTO.Parametro("percent", "text", info.getPercentageUse())); + //listaParametros.add(new EmailRequestDTO.Parametro("detalle", "text", info.getTemplate())); + + EmailRequestDTO.Remitente remitente = new EmailRequestDTO.Remitente(correo, responder, ""); + emailRequestDTO.setRemitente(remitente); + emailRequestDTO.setPlantilla(new EmailRequestDTO.Plantilla("text/html", info.getTemplate())); + + emailRequestDTO.setAsunto(emailSubject); + emailRequestDTO.setDestinatario(new ArrayList<>()); + //emailRequestDTO.setFechaEnvio(handleDate.retornDateNowSimpleDateFormat()); + EmailRequestDTO.Destinatario destinatario = new EmailRequestDTO.Destinatario(); + destinatario.setAsunto(emailSubject); + destinatario.setPara(ApiConstants.EMAIL_CONSTANT_TEST); + destinatario.setParametro(listaParametros); + emailRequestDTO.getDestinatario().add(destinatario); + emailRequestDTO.setParametro(listaParametros); + + /* + destinatario = new EmailRequestDTO.Destinatario(); + destinatario.setAsunto(emailSubject); + destinatario.setPara(copia); + destinatario.setParametro(listaParametros); + emailRequestDTO.getDestinatario().add(destinatario); + + destinatario = new EmailRequestDTO.Destinatario(); + destinatario.setAsunto(emailSubject); + destinatario.setPara(copia2); + destinatario.setParametro(listaParametros); + emailRequestDTO.getDestinatario().add(destinatario); + + destinatario = new EmailRequestDTO.Destinatario(); + destinatario.setAsunto(emailSubject); + destinatario.setPara(copia3); + destinatario.setParametro(listaParametros); + emailRequestDTO.getDestinatario().add(destinatario); + */ + return emailRequestDTO; + }catch (Exception e){ + log.error("Error modelando el DTO para envio del email:" + e); + } + + return null; + } + + + /** + * metodo encargado de enviar un email + * + * @param emailRequestDTO + */ + public ResponseDTO send(EmailRequestDTO emailRequestDTO) { + ResponseDTO responseDTO = new ResponseDTO(); + UriComponentsBuilder uriMail = UriComponentsBuilder.fromHttpUrl(urlApigee + mailEndpoint); + ResponseEntity res = restTemplateUtil.sendRequest(uriMail, HttpMethod.POST, emailRequestDTO, EmailResponseDTO.class, null, true, ApiConstants.TAG_SEND_MAIL); + + if (res.getStatusCode().is2xxSuccessful()) { + log.info("email enviado de forma exitosa emailRequestDTO:" + emailRequestDTO); + log.info("email enviado de forma exitose"); + responseDTO.setMessage("email enviado de forma exitosa emailRequestDTO:" + emailRequestDTO); + responseDTO.setResponse(Objects.requireNonNull(res.getBody()).toString()); + responseDTO.setStatusCode(res.getStatusCode().toString()); + } else { + log.error("Error enviando el email emailRequestDTO: "+ emailRequestDTO); + log.error("Error enviando el email response:" + res ); + + responseDTO.setMessage("Error enviando el email emailRequestDTO:" + emailRequestDTO); + responseDTO.setResponse(Objects.requireNonNull(res.getBody()).toString()); + responseDTO.setStatusCode(res.getStatusCode().toString()); + } + return responseDTO; + } + + +} \ No newline at end of file diff --git a/src/main/java/com/colsubsidio/monitor/failuresfe/config/RestTemplateConf.java b/src/main/java/com/colsubsidio/monitor/failuresfe/config/RestTemplateConf.java new file mode 100644 index 0000000..3bd36bb --- /dev/null +++ b/src/main/java/com/colsubsidio/monitor/failuresfe/config/RestTemplateConf.java @@ -0,0 +1,16 @@ +package com.colsubsidio.monitor.failuresfe.config; + +import org.springframework.boot.web.client.RestTemplateBuilder; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.http.client.HttpComponentsClientHttpRequestFactory; +import org.springframework.web.client.RestTemplate; + +@Configuration +public class RestTemplateConf { + + @Bean + public RestTemplate restTemplate(RestTemplateBuilder builder) { + return builder.build(); + } +} diff --git a/src/main/java/com/colsubsidio/monitor/failuresfe/dto/ApigeeTokenReqDTO.java b/src/main/java/com/colsubsidio/monitor/failuresfe/dto/ApigeeTokenReqDTO.java new file mode 100644 index 0000000..7920f48 --- /dev/null +++ b/src/main/java/com/colsubsidio/monitor/failuresfe/dto/ApigeeTokenReqDTO.java @@ -0,0 +1,14 @@ +package com.colsubsidio.monitor.failuresfe.dto; +import lombok.*; + +@AllArgsConstructor +@NoArgsConstructor +@ToString +@Builder +@Data +public class ApigeeTokenReqDTO { + + private String clienteId; + private String clienteSecreto; + +} diff --git a/src/main/java/com/colsubsidio/monitor/failuresfe/dto/ApigeeTokenResDTO.java b/src/main/java/com/colsubsidio/monitor/failuresfe/dto/ApigeeTokenResDTO.java new file mode 100644 index 0000000..70144fd --- /dev/null +++ b/src/main/java/com/colsubsidio/monitor/failuresfe/dto/ApigeeTokenResDTO.java @@ -0,0 +1,30 @@ +package com.colsubsidio.monitor.failuresfe.dto; + +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.*; + +import java.util.List; + +@AllArgsConstructor +@NoArgsConstructor +@ToString +@Builder +@Data +public class ApigeeTokenResDTO { + + private String refresh_token_expires_in; + private String api_product_list; + private List api_product_list_json; + private String organization_name; + @JsonProperty("developer.email") + private String developer_email; + private String token_type; + private String issued_at; + private String client_id; + private String access_token; + private String application_name; + private String scope; + private String expires_in; + private String refresh_count; + private String status; +} \ No newline at end of file diff --git a/src/main/java/com/colsubsidio/monitor/failuresfe/dto/EmailRequestDTO.java b/src/main/java/com/colsubsidio/monitor/failuresfe/dto/EmailRequestDTO.java new file mode 100644 index 0000000..a4b0bc4 --- /dev/null +++ b/src/main/java/com/colsubsidio/monitor/failuresfe/dto/EmailRequestDTO.java @@ -0,0 +1,84 @@ +package com.colsubsidio.monitor.failuresfe.dto; + +import lombok.*; + +import java.util.List; + +@Data +@Builder +@AllArgsConstructor +@NoArgsConstructor +@ToString +public class EmailRequestDTO { + + public Remitente remitente; + public String asunto; + public String fechaEnvio; + public Plantilla plantilla; + public List parametro; + public List archivoAdjunto; + public List destinatario; + + @Data + @Builder + @AllArgsConstructor + @NoArgsConstructor + public static class ArchivoAdjunto { + private String ruta; + private String contrasenia; + private String nombre; + private String accion; + + } + + + @Data + @Builder + @AllArgsConstructor + @NoArgsConstructor + @ToString + public static class Remitente { + public String correo; + public String responder; + public String enviado; + } + + @Data + @Builder + @AllArgsConstructor + @NoArgsConstructor + @ToString + public static class Plantilla { + public String tipo; + public String contenido; + } + + + @Data + @Builder + @AllArgsConstructor + @NoArgsConstructor + @ToString + public static class Parametro { + public String server; + public String percent; + public String detalle; + } + + + @Data + @Builder + @AllArgsConstructor + @NoArgsConstructor + @ToString + public static class Destinatario { + + public String para; + public Remitente remitente; + public String asunto; + public String fechaEnvio; + public List parametro; + public List archivoAdjunto; + } + +} \ No newline at end of file diff --git a/src/main/java/com/colsubsidio/monitor/failuresfe/dto/EmailResponseDTO.java b/src/main/java/com/colsubsidio/monitor/failuresfe/dto/EmailResponseDTO.java new file mode 100644 index 0000000..a57aea6 --- /dev/null +++ b/src/main/java/com/colsubsidio/monitor/failuresfe/dto/EmailResponseDTO.java @@ -0,0 +1,43 @@ +package com.colsubsidio.monitor.failuresfe.dto; + +import lombok.*; + +import java.util.List; + +@Data +@Builder +@AllArgsConstructor +@NoArgsConstructor +@ToString +public class EmailResponseDTO { + + + + private List resultado; + private List envioCorreo; + + @Data + @Builder + @AllArgsConstructor + @NoArgsConstructor + @ToString + public static class Resultado { + private String codigo; + private String descripcion; + + } + + @Data + @Builder + @AllArgsConstructor + @NoArgsConstructor + @ToString + public static class EnvioCorreo { + private String codigo; + + + } + + + +} \ No newline at end of file diff --git a/src/main/java/com/colsubsidio/monitor/failuresfe/dto/FileSystemDTO.java b/src/main/java/com/colsubsidio/monitor/failuresfe/dto/FileSystemDTO.java new file mode 100644 index 0000000..aa35fd5 --- /dev/null +++ b/src/main/java/com/colsubsidio/monitor/failuresfe/dto/FileSystemDTO.java @@ -0,0 +1,21 @@ +package com.colsubsidio.monitor.failuresfe.dto; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +@Data +@Builder +@AllArgsConstructor +@NoArgsConstructor +public class FileSystemDTO { + + private String fileSystem; + private String size; + private String used; + private String avail; + private String use; + private String mounted; + +} diff --git a/src/main/java/com/colsubsidio/monitor/failuresfe/dto/InfoCommanDTO.java b/src/main/java/com/colsubsidio/monitor/failuresfe/dto/InfoCommanDTO.java new file mode 100644 index 0000000..6ddaadb --- /dev/null +++ b/src/main/java/com/colsubsidio/monitor/failuresfe/dto/InfoCommanDTO.java @@ -0,0 +1,21 @@ +package com.colsubsidio.monitor.failuresfe.dto; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +@Data +@NoArgsConstructor +@AllArgsConstructor +@Builder +public class InfoCommanDTO { + + + public String fileSystem; + public String size; + public String used; + public String avail; + public String usePercent; + public String mounted; +} diff --git a/src/main/java/com/colsubsidio/monitor/failuresfe/dto/InfoDisk.java b/src/main/java/com/colsubsidio/monitor/failuresfe/dto/InfoDisk.java new file mode 100644 index 0000000..f7d0499 --- /dev/null +++ b/src/main/java/com/colsubsidio/monitor/failuresfe/dto/InfoDisk.java @@ -0,0 +1,19 @@ +package com.colsubsidio.monitor.failuresfe.dto; + +import lombok.*; + +import java.util.List; + +@Data +@Builder +@AllArgsConstructor +@NoArgsConstructor +public class InfoDisk { + private String ip; + private String percentageUse; + private String serverInfo; + private String infoDiskHome; + private String template; + private List infoDetalle; + +} diff --git a/src/main/java/com/colsubsidio/monitor/failuresfe/dto/ResponseDTO.java b/src/main/java/com/colsubsidio/monitor/failuresfe/dto/ResponseDTO.java new file mode 100644 index 0000000..69c88bf --- /dev/null +++ b/src/main/java/com/colsubsidio/monitor/failuresfe/dto/ResponseDTO.java @@ -0,0 +1,18 @@ +package com.colsubsidio.monitor.failuresfe.dto; + + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +@Data +@Builder +@AllArgsConstructor +@NoArgsConstructor +public class ResponseDTO { + + private String statusCode; + private String message; + private String response; +} diff --git a/src/main/java/com/colsubsidio/monitor/failuresfe/util/ApiConstants.java b/src/main/java/com/colsubsidio/monitor/failuresfe/util/ApiConstants.java new file mode 100644 index 0000000..ad1c64e --- /dev/null +++ b/src/main/java/com/colsubsidio/monitor/failuresfe/util/ApiConstants.java @@ -0,0 +1,8 @@ +package com.colsubsidio.monitor.failuresfe.util; + +public class ApiConstants { + + public static final String TAG_SEND_MAIL="envio email"; + public static final String EMAIL_CONSTANT_TEST = "daniel.avila@Bitsamericas.com"; + +} diff --git a/src/main/java/com/colsubsidio/monitor/failuresfe/util/HandleDate.java b/src/main/java/com/colsubsidio/monitor/failuresfe/util/HandleDate.java new file mode 100644 index 0000000..84284a8 --- /dev/null +++ b/src/main/java/com/colsubsidio/monitor/failuresfe/util/HandleDate.java @@ -0,0 +1,92 @@ +package com.colsubsidio.monitor.failuresfe.util; + + +import java.text.SimpleDateFormat; +import java.time.DateTimeException; +import java.time.LocalDateTime; +import java.time.ZoneId; +import java.time.temporal.ChronoUnit; +import java.util.*; + +import org.springframework.stereotype.Component; + +@Component +public class HandleDate { + + + private static TimeZone timeZone = TimeZone.getTimeZone("America/Bogota"); + + public Date retornDateNow() { + Date date = null; + try { + Calendar calendar = Calendar.getInstance(); + calendar.setTimeZone(timeZone); + date = Calendar.getInstance().getTime(); + } catch (Exception e) {} + return date; + } + + public String retornDateNowSimpleDateFormat() { + String date = null; + try { + Calendar calendar = Calendar.getInstance(); + calendar.setTimeZone(timeZone); + SimpleDateFormat formatter = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss"); + date = formatter.format(calendar.getTime()); + } catch (Exception e) {} + return date; + } + + public static Date retornDateByDay(int day) { + Date date = null; + try { + Calendar calendar = Calendar.getInstance(); + calendar.setTimeZone(timeZone); + calendar.add(Calendar.DAY_OF_YEAR, -day); + date = calendar.getTime(); + } catch (Exception e) {} + return date; + } + + public static String retornDateTimeFormat(String date){ + String str = null; + try { + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + Date d = sdf.parse(date); + SimpleDateFormat sdf2 = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'"); + str= sdf2.format(d); + } catch (Exception e) {} + return str; + } + + public Date retornDateToString(String d) { + Date date = null; + try { + Calendar calendar = Calendar.getInstance(); + SimpleDateFormat sdf = new SimpleDateFormat("dd-MM-yyyy HH:mm:ss"); + calendar.setTime(sdf.parse(d)); + calendar.setTimeZone(timeZone); + date = calendar.getTime(); + } catch (Exception e) {} + return date; + } + + public Long getMillisecondsFromStartDate(Date startdate) { + LocalDateTime startDateCast = startdate.toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime(); + return startDateCast.until(LocalDateTime.now(), ChronoUnit.MILLIS); + } + + + public String getMonthInPhraseFromInt(int month ){ + String month_string = null; + String result = null; + try { + Locale locale = new Locale("es","ES"); + Calendar calendarInicio = Calendar.getInstance(); + calendarInicio.set(Calendar.MONTH, month-1); + month_string = calendarInicio.getDisplayName(Calendar.MONTH, Calendar.LONG, locale); + result = month_string.toUpperCase().charAt(0) + month_string.substring(1, month_string.length()).toLowerCase(); + }catch (DateTimeException e){} + return result; + } +} diff --git a/src/main/java/com/colsubsidio/monitor/failuresfe/util/RestTemplateUtil.java b/src/main/java/com/colsubsidio/monitor/failuresfe/util/RestTemplateUtil.java new file mode 100644 index 0000000..50c7217 --- /dev/null +++ b/src/main/java/com/colsubsidio/monitor/failuresfe/util/RestTemplateUtil.java @@ -0,0 +1,77 @@ +package com.colsubsidio.monitor.failuresfe.util; + +import com.colsubsidio.monitor.failuresfe.business.services.ApigeeService; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.*; +import org.springframework.stereotype.Component; +import org.springframework.web.client.RestTemplate; +import org.springframework.web.util.UriComponentsBuilder; +import com.google.gson.Gson; + +@Component +@Slf4j +public class RestTemplateUtil { + + private static final String BEARER = "Bearer "; + + @Autowired + private ApigeeService tokenService; + + @Autowired + private RestTemplate restTemplate; + + + public ResponseEntity sendRequest(UriComponentsBuilder uri, HttpMethod method , Object body, Class classOfT, HttpHeaders headersAdd, boolean apigeeToken, String tag){ + long startTimeTry = System.currentTimeMillis(); + ResponseEntity resp = null; + ResponseEntity result = null; + HttpHeaders headers = headersAdd!= null ? headersAdd : new HttpHeaders(); + headers.setContentType(MediaType.APPLICATION_JSON); + if(apigeeToken) + headers.add(HttpHeaders.AUTHORIZATION, BEARER + tokenService.getToken()); + try { + HttpEntity entity = null; + entity = (body != null)?new HttpEntity<>(body,headers):new HttpEntity<>(headers); + resp = restTemplate.exchange(uri.toUriString(), method, entity, String.class); + + log.info("info: [RestTemplateUtil][sendRequest] el servicio responde: " + resp); + + T respClassOfT = new Gson().fromJson(resp.getBody(), classOfT); + result = new ResponseEntity<>(respClassOfT,resp.getHeaders(),resp.getStatusCode()); + log.error("apigee api ws response: " + result.getBody().toString()); + }catch (Exception e) { + log.error("Error: [RestTemplateUtil][sendRequest] excepcion: " + e.getMessage()); + } + return result; + } + + + public ResponseEntitysendRequest(UriComponentsBuilder uri,HttpMethod method ,Object body,Class classOfT,HttpHeaders headersAdd,boolean apigeeToken,boolean isBodyJson){ + long startTimeTry = System.currentTimeMillis(); + ResponseEntity resp = null; + ResponseEntity result = null; + HttpHeaders headers = headersAdd!= null ? headersAdd : new HttpHeaders(); + headers.setContentType(MediaType.APPLICATION_JSON); + if(apigeeToken) + headers.add(HttpHeaders.AUTHORIZATION, BEARER + tokenService.getToken()); + + try { + HttpEntity entity = null; + entity = (body != null)?new HttpEntity<>(body,headers):new HttpEntity<>(headers); + resp = restTemplate.exchange(uri.toUriString(), method, entity, String.class); + if (classOfT != String.class) { + T respClassOfT = new Gson().fromJson(resp.getBody(), classOfT); + result = new ResponseEntity<>(respClassOfT,resp.getHeaders(),resp.getStatusCode()); + }else { + T respClassOfT = (T) resp; + result = new ResponseEntity<>(respClassOfT,resp.getHeaders(),resp.getStatusCode()); + } + log.info("apigee api ws response: " + result.getBody().toString()); + }catch (Exception e) { + log.error("Error [RestTemplate][sendRequest]" + e.getMessage()); + } + return result; + } + +} diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties new file mode 100644 index 0000000..8dd44fa --- /dev/null +++ b/src/main/resources/application.properties @@ -0,0 +1,12 @@ +spring.config.import=file:./config/application.yml + +spring.mvc.pathmatch.matching-strategy=ant-path-matcher + +#logging +logging.level.org.springframework=INFO +logging.level.com.colsubsidio.monitor.failuresfe=INFO +logging.file.name=log/app.log +logging.logback.rollingpolicy.max-file-size=100MB +logging.pattern.file=%d{yyyy-MM-dd HH:mm:ss.SSS} [%-5level] [%X{message}] %c{1}:%line - %msg%n +logging.level.com.netflix.config.sources.URLConfigurationSource=ERROR + diff --git a/src/test/java/com/colsubsidio/monitor/failuresfe/MonitoringServerFailuresFeApplicationTests.java b/src/test/java/com/colsubsidio/monitor/failuresfe/MonitoringServerFailuresFeApplicationTests.java new file mode 100644 index 0000000..5336ad4 --- /dev/null +++ b/src/test/java/com/colsubsidio/monitor/failuresfe/MonitoringServerFailuresFeApplicationTests.java @@ -0,0 +1,13 @@ +package com.colsubsidio.monitor.failuresfe; + +import org.junit.jupiter.api.Test; +import org.springframework.boot.test.context.SpringBootTest; + +@SpringBootTest +class MonitoringServerFailuresFeApplicationTests { + + @Test + void contextLoads() { + } + +} -- libgit2 0.26.0