diff --git a/WebServices/.DS_Store b/WebServices/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..b88d9b4006e41c048d0b45c2c90453053ee92062 Binary files /dev/null and b/WebServices/.DS_Store differ diff --git a/WebServices/.gitignore b/WebServices/.gitignore index a3a85d8dd53bd6d72ce7fc6974af52ec318ad08e..ba5cb5cca8766c8b2403d25de25b1c880c5ef64a 100644 --- a/WebServices/.gitignore +++ b/WebServices/.gitignore @@ -1,8 +1,6 @@ HELP.md -!target/*.jar +/target/ !.mvn/wrapper/maven-wrapper.jar -!**/src/test/**/target/ -!**/src/main/**/target/ ### STS ### .apt_generated @@ -25,9 +23,4 @@ HELP.md /dist/ /nbdist/ /.nb-gradle/ -build/ -!**/src/main/**/build/ -!**/src/test/**/build/ - -### VS Code ### -.vscode/ +/build/ diff --git a/WebServices/balance/.DS_Store b/WebServices/balance/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..5008ddfcf53c02e82d7eee2e57c38e5672ef89f6 Binary files /dev/null and b/WebServices/balance/.DS_Store differ diff --git a/WebServices/balance/.gitignore b/WebServices/balance/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..ba5cb5cca8766c8b2403d25de25b1c880c5ef64a --- /dev/null +++ b/WebServices/balance/.gitignore @@ -0,0 +1,26 @@ +HELP.md +/target/ +!.mvn/wrapper/maven-wrapper.jar + +### STS ### +.apt_generated +.classpath +.factorypath +.project +.settings +.springBeans +.sts4-cache + +### IntelliJ IDEA ### +.idea +*.iws +*.iml +*.ipr + +### NetBeans ### +/nbproject/private/ +/nbbuild/ +/dist/ +/nbdist/ +/.nb-gradle/ +/build/ diff --git a/WebServices/balance/.mvn/wrapper/MavenWrapperDownloader.java b/WebServices/balance/.mvn/wrapper/MavenWrapperDownloader.java new file mode 100644 index 0000000000000000000000000000000000000000..47336fde724164b1329ed3595f5b6bff09f7c179 --- /dev/null +++ b/WebServices/balance/.mvn/wrapper/MavenWrapperDownloader.java @@ -0,0 +1,114 @@ +/* +Licensed to the Apache Software Foundation (ASF) under one +or more contributor license agreements. See the NOTICE file +distributed with this work for additional information +regarding copyright ownership. The ASF licenses this file +to you under the Apache License, Version 2.0 (the +"License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, +software distributed under the License is distributed on an +"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, either express or implied. See the License for the +specific language governing permissions and limitations +under the License. +*/ + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.net.URL; +import java.nio.channels.Channels; +import java.nio.channels.ReadableByteChannel; +import java.util.Properties; + +public class MavenWrapperDownloader { + + /** + * Default URL to download the maven-wrapper.jar from, if no 'downloadUrl' is provided. + */ + private static final String DEFAULT_DOWNLOAD_URL = + "https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.4.2/maven-wrapper-0.4.2.jar"; + + /** + * Path to the maven-wrapper.properties file, which might contain a downloadUrl property to + * use instead of the default one. + */ + private static final String MAVEN_WRAPPER_PROPERTIES_PATH = + ".mvn/wrapper/maven-wrapper.properties"; + + /** + * Path where the maven-wrapper.jar will be saved to. + */ + private static final String MAVEN_WRAPPER_JAR_PATH = + ".mvn/wrapper/maven-wrapper.jar"; + + /** + * Name of the property which should be used to override the default download url for the wrapper. + */ + private static final String PROPERTY_NAME_WRAPPER_URL = "wrapperUrl"; + + public static void main(String args[]) { + System.out.println("- Downloader started"); + File baseDirectory = new File(args[0]); + System.out.println("- Using base directory: " + baseDirectory.getAbsolutePath()); + + // If the maven-wrapper.properties exists, read it and check if it contains a custom + // wrapperUrl parameter. + File mavenWrapperPropertyFile = new File(baseDirectory, MAVEN_WRAPPER_PROPERTIES_PATH); + String url = DEFAULT_DOWNLOAD_URL; + if(mavenWrapperPropertyFile.exists()) { + FileInputStream mavenWrapperPropertyFileInputStream = null; + try { + mavenWrapperPropertyFileInputStream = new FileInputStream(mavenWrapperPropertyFile); + Properties mavenWrapperProperties = new Properties(); + mavenWrapperProperties.load(mavenWrapperPropertyFileInputStream); + url = mavenWrapperProperties.getProperty(PROPERTY_NAME_WRAPPER_URL, url); + } catch (IOException e) { + System.out.println("- ERROR loading '" + MAVEN_WRAPPER_PROPERTIES_PATH + "'"); + } finally { + try { + if(mavenWrapperPropertyFileInputStream != null) { + mavenWrapperPropertyFileInputStream.close(); + } + } catch (IOException e) { + // Ignore ... + } + } + } + System.out.println("- Downloading from: : " + url); + + File outputFile = new File(baseDirectory.getAbsolutePath(), MAVEN_WRAPPER_JAR_PATH); + if(!outputFile.getParentFile().exists()) { + if(!outputFile.getParentFile().mkdirs()) { + System.out.println( + "- ERROR creating output direcrory '" + outputFile.getParentFile().getAbsolutePath() + "'"); + } + } + System.out.println("- Downloading to: " + outputFile.getAbsolutePath()); + try { + downloadFileFromURL(url, outputFile); + System.out.println("Done"); + System.exit(0); + } catch (Throwable e) { + System.out.println("- Error downloading"); + e.printStackTrace(); + System.exit(1); + } + } + + private static void downloadFileFromURL(String urlString, File destination) throws Exception { + URL website = new URL(urlString); + ReadableByteChannel rbc; + rbc = Channels.newChannel(website.openStream()); + FileOutputStream fos = new FileOutputStream(destination); + fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE); + fos.close(); + rbc.close(); + } + +} diff --git a/WebServices/balance/.mvn/wrapper/maven-wrapper.jar b/WebServices/balance/.mvn/wrapper/maven-wrapper.jar index c1dd12f17644411d6e840bd5a10c6ecda0175f18..01e67997377a393fd672c7dcde9dccbedf0cb1e9 100644 Binary files a/WebServices/balance/.mvn/wrapper/maven-wrapper.jar and b/WebServices/balance/.mvn/wrapper/maven-wrapper.jar differ diff --git a/WebServices/balance/.mvn/wrapper/maven-wrapper.properties b/WebServices/balance/.mvn/wrapper/maven-wrapper.properties index b7cb93e7050f42ff587aefbc40cc038ad4fa3271..cd0d451ccd6fc835996c9fe4eebf8a571154f515 100644 --- a/WebServices/balance/.mvn/wrapper/maven-wrapper.properties +++ b/WebServices/balance/.mvn/wrapper/maven-wrapper.properties @@ -1,2 +1 @@ -distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.8.4/apache-maven-3.8.4-bin.zip -wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar +distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.0/apache-maven-3.6.0-bin.zip diff --git a/WebServices/balance/Dockerfile b/WebServices/balance/Dockerfile index 76d1a6efece81b458078d1283bbc58aeb9ed69c9..f92094f4998baba1708d0c49f214ed30d149c7dd 100644 --- a/WebServices/balance/Dockerfile +++ b/WebServices/balance/Dockerfile @@ -1,3 +1,3 @@ FROM openjdk:11 -COPY target/balance-0.0.1-SNAPSHOT.jar balance.jar +COPY target/balance.jar balance.jar ENTRYPOINT ["java","-jar","balance.jar"] \ No newline at end of file diff --git a/WebServices/balance/mvnw b/WebServices/balance/mvnw old mode 100644 new mode 100755 index 8a8fb2282df5b8f7263470a5a2dc0e196f35f35f..5551fde8e7dba1e37a1821e8b26374893e2a9e2e --- a/WebServices/balance/mvnw +++ b/WebServices/balance/mvnw @@ -8,7 +8,7 @@ # "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 +# http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, # software distributed under the License is distributed on an @@ -19,7 +19,7 @@ # ---------------------------------------------------------------------------- # ---------------------------------------------------------------------------- -# Maven Start Up Batch script +# Maven2 Start Up Batch script # # Required ENV vars: # ------------------ @@ -36,10 +36,6 @@ 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 @@ -118,6 +114,7 @@ if $mingw ; then M2_HOME="`(cd "$M2_HOME"; pwd)`" [ -n "$JAVA_HOME" ] && JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`" + # TODO classpath? fi if [ -z "$JAVA_HOME" ]; then @@ -149,7 +146,7 @@ if [ -z "$JAVACMD" ] ; then JAVACMD="$JAVA_HOME/bin/java" fi else - JAVACMD="`\\unset -f command; \\command -v java`" + JAVACMD="`which java`" fi fi @@ -215,11 +212,7 @@ 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 + jarUrl="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.4.2/maven-wrapper-0.4.2.jar" while IFS="=" read key value; do case "$key" in (wrapperUrl) jarUrl="$value"; break ;; esac @@ -228,38 +221,22 @@ else 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 + wget "$jarUrl" -O "$wrapperJarPath" 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 - + curl -o "$wrapperJarPath" "$jarUrl" else if [ "$MVNW_VERBOSE" = true ]; then echo "Falling back to using Java to download" fi javaClass="$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.java" - # 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 @@ -300,17 +277,10 @@ if $cygwin; then 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}" \ + "-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \ ${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@" diff --git a/WebServices/balance/mvnw.cmd b/WebServices/balance/mvnw.cmd index 1d8ab018eaf11d9b3a4a90e7818ace373dfbb380..e5cfb0ae9eab80c314b7d79c164d4a00772824b8 100644 --- a/WebServices/balance/mvnw.cmd +++ b/WebServices/balance/mvnw.cmd @@ -7,7 +7,7 @@ @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 http://www.apache.org/licenses/LICENSE-2.0 @REM @REM Unless required by applicable law or agreed to in writing, @REM software distributed under the License is distributed on an @@ -18,7 +18,7 @@ @REM ---------------------------------------------------------------------------- @REM ---------------------------------------------------------------------------- -@REM Maven Start Up Batch script +@REM Maven2 Start Up Batch script @REM @REM Required ENV vars: @REM JAVA_HOME - location of a JDK home dir @@ -26,7 +26,7 @@ @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_BATCH_PAUSE - set to 'on' to wait for a key stroke before ending @REM MAVEN_OPTS - parameters passed to the Java VM when running Maven @REM e.g. to debug Maven itself, use @REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 @@ -37,7 +37,7 @@ @echo off @REM set title of command window 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% @REM set %HOME% to equivalent of $HOME @@ -46,8 +46,8 @@ 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" %* +if exist "%HOME%\mavenrc_pre.bat" call "%HOME%\mavenrc_pre.bat" +if exist "%HOME%\mavenrc_pre.cmd" call "%HOME%\mavenrc_pre.cmd" :skipRcPre @setlocal @@ -120,51 +120,24 @@ 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 +set DOWNLOAD_URL="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.4.2/maven-wrapper-0.4.2.jar" +FOR /F "tokens=1,2 delims==" %%A IN (%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties) DO ( + IF "%%A"=="wrapperUrl" SET DOWNLOAD_URL=%%B ) @REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central @REM This allows using the maven wrapper in projects that prohibit checking in binary data. if exist %WRAPPER_JAR% ( - if "%MVNW_VERBOSE%" == "true" ( - echo Found %WRAPPER_JAR% - ) + 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% - ) + echo Couldn't find %WRAPPER_JAR%, downloading it ... + echo Downloading from: %DOWNLOAD_URL% + powershell -Command "(New-Object Net.WebClient).DownloadFile('%DOWNLOAD_URL%', '%WRAPPER_JAR%')" + echo Finished downloading %WRAPPER_JAR% ) @REM End of extension -@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% %* +%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 @@ -174,15 +147,15 @@ set ERROR_CODE=1 :end @endlocal & set ERROR_CODE=%ERROR_CODE% -if not "%MAVEN_SKIP_RC%"=="" goto skipRcPost +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" +if exist "%HOME%\mavenrc_post.bat" call "%HOME%\mavenrc_post.bat" +if exist "%HOME%\mavenrc_post.cmd" call "%HOME%\mavenrc_post.cmd" :skipRcPost @REM pause the script if MAVEN_BATCH_PAUSE is set to 'on' -if "%MAVEN_BATCH_PAUSE%"=="on" pause +if "%MAVEN_BATCH_PAUSE%" == "on" pause -if "%MAVEN_TERMINATE_CMD%"=="on" exit %ERROR_CODE% +if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE% -cmd /C exit /B %ERROR_CODE% +exit /B %ERROR_CODE% diff --git a/WebServices/balance/pom.xml b/WebServices/balance/pom.xml index 01fc843a6197988554a2cfea542cea0956a1c351..0c76aad734c7c68a4339f8a8a4a2b138d58483ce 100644 --- a/WebServices/balance/pom.xml +++ b/WebServices/balance/pom.xml @@ -1,63 +1,43 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> - <modelVersion>4.0.0</modelVersion> - <parent> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-starter-parent</artifactId> - <version>2.7.0</version> - <relativePath/> <!-- lookup parent from repository --> - </parent> - <groupId>br.ufrn.imd</groupId> - <artifactId>balance</artifactId> - <version>0.0.1-SNAPSHOT</version> - <name>balance</name> - <description>Projeto para disciplina de Programação DistribuÃda</description> - <properties> - <java.version>11</java.version> - </properties> - <dependencies> - <dependency> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-starter-data-jpa</artifactId> - </dependency> - <dependency> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-starter-web</artifactId> - </dependency> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>br.ufrn.imd</groupId> + <artifactId>dim0614</artifactId> + <version>1.0-SNAPSHOT</version> + <relativePath>../pom.xml</relativePath> <!-- lookup parent from repository --> + </parent> - <dependency> - <groupId>org.postgresql</groupId> - <artifactId>postgresql</artifactId> - <scope>runtime</scope> - </dependency> - <dependency> - <groupId>org.projectlombok</groupId> - <artifactId>lombok</artifactId> - <optional>true</optional> - </dependency> - <dependency> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-starter-test</artifactId> - <scope>test</scope> - </dependency> - </dependencies> + <artifactId>balance</artifactId> + <version>0.0.1-SNAPSHOT</version> + <name>balance</name> + <description>balance service</description> - <build> - <plugins> - <plugin> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-maven-plugin</artifactId> - <configuration> - <excludes> - <exclude> - <groupId>org.projectlombok</groupId> - <artifactId>lombok</artifactId> - </exclude> - </excludes> - </configuration> - </plugin> - </plugins> - </build> + <properties> + <java.version>11</java.version> + </properties> + + <build> + <finalName>balance</finalName> + <plugins> + <plugin> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-maven-plugin</artifactId> + <configuration> + <executable>true</executable> + </configuration> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-compiler-plugin</artifactId> + <version>3.8.0</version> + <configuration> + <source>11</source> + <target>11</target> + </configuration> + </plugin> + </plugins> + </build> </project> diff --git a/WebServices/balance/src/main/resources/application.yml b/WebServices/balance/src/main/resources/application.yml index db81ea2f2ef3d7fbe37b9d67b49c5b7d930ff4a4..596331cd4bf9b626e5339496582f5e1d30d4acf6 100644 --- a/WebServices/balance/src/main/resources/application.yml +++ b/WebServices/balance/src/main/resources/application.yml @@ -1,14 +1,26 @@ server: - port: 8080 - + port: 8084 +eureka: + instance: + prefer-ip-address: true + client: + service-url: + defaultZone: http://registry:8081/eureka/ + fetch-registry: true + register-with-eureka: true + spring: + application: + name: balance datasource: - url: jdbc:postgresql://postgres-service:5432/postgres + url: jdbc:postgresql://postgresServ:5432/postgres username: postgres password: postgres jpa: show-sql: false - properties: + properties: hibernate: dialect: org.hibernate.dialect.PostgreSQLDialect - ddl-auto: update \ No newline at end of file + ddl-auto: update + jmx: + enabled: false \ No newline at end of file diff --git a/WebServices/balance/src/test/java/br/ufrn/imd/balance/BalanceApplicationTests.java b/WebServices/balance/src/test/java/br/ufrn/imd/balance/BalanceApplicationTests.java deleted file mode 100644 index 9396a319ce1fb55faf668121e9cf8aaeced061a7..0000000000000000000000000000000000000000 --- a/WebServices/balance/src/test/java/br/ufrn/imd/balance/BalanceApplicationTests.java +++ /dev/null @@ -1,13 +0,0 @@ -package br.ufrn.imd.balance; - -import org.junit.jupiter.api.Test; -import org.springframework.boot.test.context.SpringBootTest; - -@SpringBootTest -class BalanceApplicationTests { - - @Test - void contextLoads() { - } - -} diff --git a/WebServices/balance/src/test/java/br/ufrn/imd/withdrawal/CourseApplicationTests.java b/WebServices/balance/src/test/java/br/ufrn/imd/withdrawal/CourseApplicationTests.java new file mode 100644 index 0000000000000000000000000000000000000000..b84743fe08d4bfdafd2ba2588a9a532fa80fa854 --- /dev/null +++ b/WebServices/balance/src/test/java/br/ufrn/imd/withdrawal/CourseApplicationTests.java @@ -0,0 +1,16 @@ +package br.ufrn.imd.withdrawal; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +@RunWith(SpringRunner.class) +@SpringBootTest +public class CourseApplicationTests { + + @Test + public void contextLoads() { + } + +} diff --git a/WebServices/balance/target/balance-0.0.1-SNAPSHOT.jar b/WebServices/balance/target/balance-0.0.1-SNAPSHOT.jar deleted file mode 100644 index ad4b3c3d6bb28595493a03e8dbc515aa5aa2d52d..0000000000000000000000000000000000000000 Binary files a/WebServices/balance/target/balance-0.0.1-SNAPSHOT.jar and /dev/null differ diff --git a/WebServices/balance/target/balance-0.0.1-SNAPSHOT.jar.original b/WebServices/balance/target/balance-0.0.1-SNAPSHOT.jar.original deleted file mode 100644 index 8e48095d1a53aaa48e2f128bd98726961f1f0cf9..0000000000000000000000000000000000000000 Binary files a/WebServices/balance/target/balance-0.0.1-SNAPSHOT.jar.original and /dev/null differ diff --git a/WebServices/balance/target/classes/application.yml b/WebServices/balance/target/classes/application.yml index db81ea2f2ef3d7fbe37b9d67b49c5b7d930ff4a4..596331cd4bf9b626e5339496582f5e1d30d4acf6 100644 --- a/WebServices/balance/target/classes/application.yml +++ b/WebServices/balance/target/classes/application.yml @@ -1,14 +1,26 @@ server: - port: 8080 - + port: 8084 +eureka: + instance: + prefer-ip-address: true + client: + service-url: + defaultZone: http://registry:8081/eureka/ + fetch-registry: true + register-with-eureka: true + spring: + application: + name: balance datasource: - url: jdbc:postgresql://postgres-service:5432/postgres + url: jdbc:postgresql://postgresServ:5432/postgres username: postgres password: postgres jpa: show-sql: false - properties: + properties: hibernate: dialect: org.hibernate.dialect.PostgreSQLDialect - ddl-auto: update \ No newline at end of file + ddl-auto: update + jmx: + enabled: false \ No newline at end of file diff --git a/WebServices/balance/target/maven-archiver/pom.properties b/WebServices/balance/target/maven-archiver/pom.properties index c9bd17764b90d7d94b4c2bc5aa5e91387b753b06..88dc348660793f2cf4e9a89eaa2b23f4f164ed77 100644 --- a/WebServices/balance/target/maven-archiver/pom.properties +++ b/WebServices/balance/target/maven-archiver/pom.properties @@ -1,3 +1,4 @@ -artifactId=balance +#Created by Apache Maven 3.6.3 groupId=br.ufrn.imd +artifactId=balance version=0.0.1-SNAPSHOT diff --git a/WebServices/balance/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst b/WebServices/balance/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst index 5ccb3ec6bd7258198befe119f57f885cb94bb7aa..0835eb49ffb9664025d8760ee65f4bfa049e38d1 100644 --- a/WebServices/balance/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst +++ b/WebServices/balance/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst @@ -1,6 +1,6 @@ -/home/ff/code/dim0614/WebServices/balance/src/main/java/br/ufrn/imd/balance/service/BalanceService.java -/home/ff/code/dim0614/WebServices/balance/src/main/java/br/ufrn/imd/balance/BalanceApplication.java -/home/ff/code/dim0614/WebServices/balance/src/main/java/br/ufrn/imd/balance/controller/BalanceController.java -/home/ff/code/dim0614/WebServices/balance/src/main/java/br/ufrn/imd/balance/domain/Account.java -/home/ff/code/dim0614/WebServices/balance/src/main/java/br/ufrn/imd/balance/domain/Client.java -/home/ff/code/dim0614/WebServices/balance/src/main/java/br/ufrn/imd/balance/repository/ClientRepository.java +/home/ff/code/dim/devdojo-microservices/balance/src/main/java/br/ufrn/imd/balance/service/BalanceService.java +/home/ff/code/dim/devdojo-microservices/balance/src/main/java/br/ufrn/imd/balance/domain/Account.java +/home/ff/code/dim/devdojo-microservices/balance/src/main/java/br/ufrn/imd/balance/repository/ClientRepository.java +/home/ff/code/dim/devdojo-microservices/balance/src/main/java/br/ufrn/imd/balance/controller/BalanceController.java +/home/ff/code/dim/devdojo-microservices/balance/src/main/java/br/ufrn/imd/balance/BalanceApplication.java +/home/ff/code/dim/devdojo-microservices/balance/src/main/java/br/ufrn/imd/balance/domain/Client.java diff --git a/WebServices/balance/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/createdFiles.lst b/WebServices/balance/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/createdFiles.lst index 7a448bb4b04711af29ce9dc7075bb2510814d0c1..acc938601d964f4ae34f8d7176eb35a1150158b3 100644 --- a/WebServices/balance/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/createdFiles.lst +++ b/WebServices/balance/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/createdFiles.lst @@ -1 +1 @@ -br/ufrn/imd/balance/BalanceApplicationTests.class +br/ufrn/imd/withdrawal/CourseApplicationTests.class diff --git a/WebServices/balance/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst b/WebServices/balance/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst index a0f58ac2324c1592af7a66015586f4e17596bc24..68bbe323a72bf7aba55c1677b45b32701058ee47 100644 --- a/WebServices/balance/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst +++ b/WebServices/balance/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst @@ -1 +1 @@ -/home/ff/code/dim0614/WebServices/balance/src/test/java/br/ufrn/imd/balance/BalanceApplicationTests.java +/home/ff/code/dim/devdojo-microservices/balance/src/test/java/br/ufrn/imd/withdrawal/CourseApplicationTests.java diff --git a/WebServices/balance/target/test-classes/br/ufrn/imd/balance/BalanceApplicationTests.class b/WebServices/balance/target/test-classes/br/ufrn/imd/balance/BalanceApplicationTests.class deleted file mode 100644 index 90112524da60c3dff89c7fa533264f07ac953aaa..0000000000000000000000000000000000000000 Binary files a/WebServices/balance/target/test-classes/br/ufrn/imd/balance/BalanceApplicationTests.class and /dev/null differ diff --git a/WebServices/deposit/.DS_Store b/WebServices/deposit/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..5008ddfcf53c02e82d7eee2e57c38e5672ef89f6 Binary files /dev/null and b/WebServices/deposit/.DS_Store differ diff --git a/WebServices/deposit/.gitignore b/WebServices/deposit/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..ba5cb5cca8766c8b2403d25de25b1c880c5ef64a --- /dev/null +++ b/WebServices/deposit/.gitignore @@ -0,0 +1,26 @@ +HELP.md +/target/ +!.mvn/wrapper/maven-wrapper.jar + +### STS ### +.apt_generated +.classpath +.factorypath +.project +.settings +.springBeans +.sts4-cache + +### IntelliJ IDEA ### +.idea +*.iws +*.iml +*.ipr + +### NetBeans ### +/nbproject/private/ +/nbbuild/ +/dist/ +/nbdist/ +/.nb-gradle/ +/build/ diff --git a/WebServices/deposit/.mvn/wrapper/MavenWrapperDownloader.java b/WebServices/deposit/.mvn/wrapper/MavenWrapperDownloader.java new file mode 100644 index 0000000000000000000000000000000000000000..47336fde724164b1329ed3595f5b6bff09f7c179 --- /dev/null +++ b/WebServices/deposit/.mvn/wrapper/MavenWrapperDownloader.java @@ -0,0 +1,114 @@ +/* +Licensed to the Apache Software Foundation (ASF) under one +or more contributor license agreements. See the NOTICE file +distributed with this work for additional information +regarding copyright ownership. The ASF licenses this file +to you under the Apache License, Version 2.0 (the +"License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, +software distributed under the License is distributed on an +"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, either express or implied. See the License for the +specific language governing permissions and limitations +under the License. +*/ + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.net.URL; +import java.nio.channels.Channels; +import java.nio.channels.ReadableByteChannel; +import java.util.Properties; + +public class MavenWrapperDownloader { + + /** + * Default URL to download the maven-wrapper.jar from, if no 'downloadUrl' is provided. + */ + private static final String DEFAULT_DOWNLOAD_URL = + "https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.4.2/maven-wrapper-0.4.2.jar"; + + /** + * Path to the maven-wrapper.properties file, which might contain a downloadUrl property to + * use instead of the default one. + */ + private static final String MAVEN_WRAPPER_PROPERTIES_PATH = + ".mvn/wrapper/maven-wrapper.properties"; + + /** + * Path where the maven-wrapper.jar will be saved to. + */ + private static final String MAVEN_WRAPPER_JAR_PATH = + ".mvn/wrapper/maven-wrapper.jar"; + + /** + * Name of the property which should be used to override the default download url for the wrapper. + */ + private static final String PROPERTY_NAME_WRAPPER_URL = "wrapperUrl"; + + public static void main(String args[]) { + System.out.println("- Downloader started"); + File baseDirectory = new File(args[0]); + System.out.println("- Using base directory: " + baseDirectory.getAbsolutePath()); + + // If the maven-wrapper.properties exists, read it and check if it contains a custom + // wrapperUrl parameter. + File mavenWrapperPropertyFile = new File(baseDirectory, MAVEN_WRAPPER_PROPERTIES_PATH); + String url = DEFAULT_DOWNLOAD_URL; + if(mavenWrapperPropertyFile.exists()) { + FileInputStream mavenWrapperPropertyFileInputStream = null; + try { + mavenWrapperPropertyFileInputStream = new FileInputStream(mavenWrapperPropertyFile); + Properties mavenWrapperProperties = new Properties(); + mavenWrapperProperties.load(mavenWrapperPropertyFileInputStream); + url = mavenWrapperProperties.getProperty(PROPERTY_NAME_WRAPPER_URL, url); + } catch (IOException e) { + System.out.println("- ERROR loading '" + MAVEN_WRAPPER_PROPERTIES_PATH + "'"); + } finally { + try { + if(mavenWrapperPropertyFileInputStream != null) { + mavenWrapperPropertyFileInputStream.close(); + } + } catch (IOException e) { + // Ignore ... + } + } + } + System.out.println("- Downloading from: : " + url); + + File outputFile = new File(baseDirectory.getAbsolutePath(), MAVEN_WRAPPER_JAR_PATH); + if(!outputFile.getParentFile().exists()) { + if(!outputFile.getParentFile().mkdirs()) { + System.out.println( + "- ERROR creating output direcrory '" + outputFile.getParentFile().getAbsolutePath() + "'"); + } + } + System.out.println("- Downloading to: " + outputFile.getAbsolutePath()); + try { + downloadFileFromURL(url, outputFile); + System.out.println("Done"); + System.exit(0); + } catch (Throwable e) { + System.out.println("- Error downloading"); + e.printStackTrace(); + System.exit(1); + } + } + + private static void downloadFileFromURL(String urlString, File destination) throws Exception { + URL website = new URL(urlString); + ReadableByteChannel rbc; + rbc = Channels.newChannel(website.openStream()); + FileOutputStream fos = new FileOutputStream(destination); + fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE); + fos.close(); + rbc.close(); + } + +} diff --git a/WebServices/deposit/.mvn/wrapper/maven-wrapper.jar b/WebServices/deposit/.mvn/wrapper/maven-wrapper.jar index c1dd12f17644411d6e840bd5a10c6ecda0175f18..01e67997377a393fd672c7dcde9dccbedf0cb1e9 100644 Binary files a/WebServices/deposit/.mvn/wrapper/maven-wrapper.jar and b/WebServices/deposit/.mvn/wrapper/maven-wrapper.jar differ diff --git a/WebServices/deposit/.mvn/wrapper/maven-wrapper.properties b/WebServices/deposit/.mvn/wrapper/maven-wrapper.properties index b7cb93e7050f42ff587aefbc40cc038ad4fa3271..cd0d451ccd6fc835996c9fe4eebf8a571154f515 100644 --- a/WebServices/deposit/.mvn/wrapper/maven-wrapper.properties +++ b/WebServices/deposit/.mvn/wrapper/maven-wrapper.properties @@ -1,2 +1 @@ -distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.8.4/apache-maven-3.8.4-bin.zip -wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar +distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.0/apache-maven-3.6.0-bin.zip diff --git a/WebServices/deposit/Dockerfile b/WebServices/deposit/Dockerfile index 6d8ac6606c8f20af6e6fb073e6ea5abac57b78e8..9885e7466359c0bd6426716ab718c12064632b70 100644 --- a/WebServices/deposit/Dockerfile +++ b/WebServices/deposit/Dockerfile @@ -1,3 +1,3 @@ FROM openjdk:11 -COPY target/deposit-0.0.1-SNAPSHOT.jar deposit.jar -ENTRYPOINT ["java","-jar","deposit.jar"] \ No newline at end of file +COPY target/withdrawal.jar withdrawal.jar +ENTRYPOINT ["java","-jar","withdrawal.jar"] \ No newline at end of file diff --git a/WebServices/deposit/mvnw b/WebServices/deposit/mvnw old mode 100644 new mode 100755 index 8a8fb2282df5b8f7263470a5a2dc0e196f35f35f..5551fde8e7dba1e37a1821e8b26374893e2a9e2e --- a/WebServices/deposit/mvnw +++ b/WebServices/deposit/mvnw @@ -8,7 +8,7 @@ # "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 +# http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, # software distributed under the License is distributed on an @@ -19,7 +19,7 @@ # ---------------------------------------------------------------------------- # ---------------------------------------------------------------------------- -# Maven Start Up Batch script +# Maven2 Start Up Batch script # # Required ENV vars: # ------------------ @@ -36,10 +36,6 @@ 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 @@ -118,6 +114,7 @@ if $mingw ; then M2_HOME="`(cd "$M2_HOME"; pwd)`" [ -n "$JAVA_HOME" ] && JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`" + # TODO classpath? fi if [ -z "$JAVA_HOME" ]; then @@ -149,7 +146,7 @@ if [ -z "$JAVACMD" ] ; then JAVACMD="$JAVA_HOME/bin/java" fi else - JAVACMD="`\\unset -f command; \\command -v java`" + JAVACMD="`which java`" fi fi @@ -215,11 +212,7 @@ 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 + jarUrl="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.4.2/maven-wrapper-0.4.2.jar" while IFS="=" read key value; do case "$key" in (wrapperUrl) jarUrl="$value"; break ;; esac @@ -228,38 +221,22 @@ else 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 + wget "$jarUrl" -O "$wrapperJarPath" 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 - + curl -o "$wrapperJarPath" "$jarUrl" else if [ "$MVNW_VERBOSE" = true ]; then echo "Falling back to using Java to download" fi javaClass="$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.java" - # 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 @@ -300,17 +277,10 @@ if $cygwin; then 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}" \ + "-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \ ${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@" diff --git a/WebServices/deposit/mvnw.cmd b/WebServices/deposit/mvnw.cmd index 1d8ab018eaf11d9b3a4a90e7818ace373dfbb380..e5cfb0ae9eab80c314b7d79c164d4a00772824b8 100644 --- a/WebServices/deposit/mvnw.cmd +++ b/WebServices/deposit/mvnw.cmd @@ -7,7 +7,7 @@ @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 http://www.apache.org/licenses/LICENSE-2.0 @REM @REM Unless required by applicable law or agreed to in writing, @REM software distributed under the License is distributed on an @@ -18,7 +18,7 @@ @REM ---------------------------------------------------------------------------- @REM ---------------------------------------------------------------------------- -@REM Maven Start Up Batch script +@REM Maven2 Start Up Batch script @REM @REM Required ENV vars: @REM JAVA_HOME - location of a JDK home dir @@ -26,7 +26,7 @@ @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_BATCH_PAUSE - set to 'on' to wait for a key stroke before ending @REM MAVEN_OPTS - parameters passed to the Java VM when running Maven @REM e.g. to debug Maven itself, use @REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 @@ -37,7 +37,7 @@ @echo off @REM set title of command window 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% @REM set %HOME% to equivalent of $HOME @@ -46,8 +46,8 @@ 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" %* +if exist "%HOME%\mavenrc_pre.bat" call "%HOME%\mavenrc_pre.bat" +if exist "%HOME%\mavenrc_pre.cmd" call "%HOME%\mavenrc_pre.cmd" :skipRcPre @setlocal @@ -120,51 +120,24 @@ 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 +set DOWNLOAD_URL="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.4.2/maven-wrapper-0.4.2.jar" +FOR /F "tokens=1,2 delims==" %%A IN (%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties) DO ( + IF "%%A"=="wrapperUrl" SET DOWNLOAD_URL=%%B ) @REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central @REM This allows using the maven wrapper in projects that prohibit checking in binary data. if exist %WRAPPER_JAR% ( - if "%MVNW_VERBOSE%" == "true" ( - echo Found %WRAPPER_JAR% - ) + 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% - ) + echo Couldn't find %WRAPPER_JAR%, downloading it ... + echo Downloading from: %DOWNLOAD_URL% + powershell -Command "(New-Object Net.WebClient).DownloadFile('%DOWNLOAD_URL%', '%WRAPPER_JAR%')" + echo Finished downloading %WRAPPER_JAR% ) @REM End of extension -@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% %* +%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 @@ -174,15 +147,15 @@ set ERROR_CODE=1 :end @endlocal & set ERROR_CODE=%ERROR_CODE% -if not "%MAVEN_SKIP_RC%"=="" goto skipRcPost +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" +if exist "%HOME%\mavenrc_post.bat" call "%HOME%\mavenrc_post.bat" +if exist "%HOME%\mavenrc_post.cmd" call "%HOME%\mavenrc_post.cmd" :skipRcPost @REM pause the script if MAVEN_BATCH_PAUSE is set to 'on' -if "%MAVEN_BATCH_PAUSE%"=="on" pause +if "%MAVEN_BATCH_PAUSE%" == "on" pause -if "%MAVEN_TERMINATE_CMD%"=="on" exit %ERROR_CODE% +if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE% -cmd /C exit /B %ERROR_CODE% +exit /B %ERROR_CODE% diff --git a/WebServices/deposit/pom.xml b/WebServices/deposit/pom.xml index 228f0a6df6d9a04c21f35ff3621d7ce2584692ac..55a797289c948be048f8de552cd718a9673b4d66 100644 --- a/WebServices/deposit/pom.xml +++ b/WebServices/deposit/pom.xml @@ -1,63 +1,43 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> - <modelVersion>4.0.0</modelVersion> - <parent> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-starter-parent</artifactId> - <version>2.7.0</version> - <relativePath/> <!-- lookup parent from repository --> - </parent> - <groupId>br.ufrn.imd</groupId> - <artifactId>deposit</artifactId> - <version>0.0.1-SNAPSHOT</version> - <name>deposit</name> - <description>Projeto para disciplina de Programação DistribuÃda</description> - <properties> - <java.version>11</java.version> - </properties> - <dependencies> - <dependency> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-starter-data-jpa</artifactId> - </dependency> - <dependency> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-starter-web</artifactId> - </dependency> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>br.ufrn.imd</groupId> + <artifactId>dim0614</artifactId> + <version>1.0-SNAPSHOT</version> + <relativePath>../</relativePath> <!-- lookup parent from repository --> + </parent> - <dependency> - <groupId>org.postgresql</groupId> - <artifactId>postgresql</artifactId> - <scope>runtime</scope> - </dependency> - <dependency> - <groupId>org.projectlombok</groupId> - <artifactId>lombok</artifactId> - <optional>true</optional> - </dependency> - <dependency> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-starter-test</artifactId> - <scope>test</scope> - </dependency> - </dependencies> + <artifactId>withdrawal</artifactId> + <version>0.0.1-SNAPSHOT</version> + <name>withdrawal</name> + <description>Spring Boot Micro-services By DevDojo</description> - <build> - <plugins> - <plugin> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-maven-plugin</artifactId> - <configuration> - <excludes> - <exclude> - <groupId>org.projectlombok</groupId> - <artifactId>lombok</artifactId> - </exclude> - </excludes> - </configuration> - </plugin> - </plugins> - </build> + <properties> + <java.version>11</java.version> + </properties> + + <build> + <finalName>withdrawal</finalName> + <plugins> + <plugin> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-maven-plugin</artifactId> + <configuration> + <executable>true</executable> + </configuration> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-compiler-plugin</artifactId> + <version>3.8.0</version> + <configuration> + <source>11</source> + <target>11</target> + </configuration> + </plugin> + </plugins> + </build> </project> diff --git a/WebServices/deposit/src/main/java/br/ufrn/imd/deposit/controller/DepositController.java b/WebServices/deposit/src/main/java/br/ufrn/imd/deposit/controller/DepositController.java deleted file mode 100644 index 1511647355bb22443405b6a6a8e32dcf1b04bc01..0000000000000000000000000000000000000000 --- a/WebServices/deposit/src/main/java/br/ufrn/imd/deposit/controller/DepositController.java +++ /dev/null @@ -1,22 +0,0 @@ -package br.ufrn.imd.deposit.controller; - -import br.ufrn.imd.deposit.domain.Client; -import br.ufrn.imd.deposit.service.DepositService; -import lombok.AllArgsConstructor; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.http.HttpStatus; -import org.springframework.web.bind.annotation.*; - -@AllArgsConstructor -@RestController -@RequestMapping("/banking/client/{id}") -public class DepositController { - @Autowired - private final DepositService service; - - @PatchMapping - @ResponseStatus(HttpStatus.OK) - public Client deposit(@PathVariable Integer id, @RequestParam(name = "value") Double value) { - return service.deposit(value, new Client(id)); - } -} diff --git a/WebServices/deposit/src/main/java/br/ufrn/imd/deposit/repository/ClientRepository.java b/WebServices/deposit/src/main/java/br/ufrn/imd/deposit/repository/ClientRepository.java deleted file mode 100644 index bd5c797d6e36e8f1e63880e7c471d9d1ac9bb467..0000000000000000000000000000000000000000 --- a/WebServices/deposit/src/main/java/br/ufrn/imd/deposit/repository/ClientRepository.java +++ /dev/null @@ -1,9 +0,0 @@ -package br.ufrn.imd.deposit.repository; - -import br.ufrn.imd.deposit.domain.Client; -import org.springframework.data.jpa.repository.JpaRepository; -import org.springframework.stereotype.Repository; - -@Repository -public interface ClientRepository extends JpaRepository<Client, Integer> { -} diff --git a/WebServices/deposit/src/main/java/br/ufrn/imd/deposit/service/DepositService.java b/WebServices/deposit/src/main/java/br/ufrn/imd/deposit/service/DepositService.java deleted file mode 100644 index bae0c460a045d979f0ddbe9557affb2f7a34bbcb..0000000000000000000000000000000000000000 --- a/WebServices/deposit/src/main/java/br/ufrn/imd/deposit/service/DepositService.java +++ /dev/null @@ -1,31 +0,0 @@ -package br.ufrn.imd.deposit.service; - -import br.ufrn.imd.deposit.domain.Account; -import br.ufrn.imd.deposit.domain.Client; -import br.ufrn.imd.deposit.repository.ClientRepository; -import lombok.AllArgsConstructor; -import lombok.extern.java.Log; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -@Log -@AllArgsConstructor -@Service -public class DepositService { - @Autowired - private final ClientRepository clientRepository; - - public Client deposit(Double value, Client client) { - client = clientRepository.findById(client.getId()) - .orElseThrow(() -> new RuntimeException("Invalid user!")); - - Account account = client.getAccount(); - account.setBalance(account.getBalance() + value); - client = clientRepository.save(client); - - log.info("Deposit concluded!"); - log.info(String.format("Total: %.2f", client.getAccount().getBalance())); - - return client; - } -} diff --git a/WebServices/deposit/src/main/java/br/ufrn/imd/deposit/DepositApplication.java b/WebServices/deposit/src/main/java/br/ufrn/imd/withdrawal/WithdrawalApplication.java similarity index 60% rename from WebServices/deposit/src/main/java/br/ufrn/imd/deposit/DepositApplication.java rename to WebServices/deposit/src/main/java/br/ufrn/imd/withdrawal/WithdrawalApplication.java index 23b7f5856812223d129e2f973f61a18cea69a364..ba5b3a9dc1033cf3f149ecf42290fd216a4b8c80 100644 --- a/WebServices/deposit/src/main/java/br/ufrn/imd/deposit/DepositApplication.java +++ b/WebServices/deposit/src/main/java/br/ufrn/imd/withdrawal/WithdrawalApplication.java @@ -1,13 +1,13 @@ -package br.ufrn.imd.deposit; +package br.ufrn.imd.withdrawal; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication -public class DepositApplication { +public class WithdrawalApplication { public static void main(String[] args) { - SpringApplication.run(DepositApplication.class, args); + SpringApplication.run(WithdrawalApplication.class, args); } } diff --git a/WebServices/deposit/src/main/java/br/ufrn/imd/withdrawal/controller/WithdrawalController.java b/WebServices/deposit/src/main/java/br/ufrn/imd/withdrawal/controller/WithdrawalController.java new file mode 100644 index 0000000000000000000000000000000000000000..f65f9915179df034c527191c4c92b4bfdadaa298 --- /dev/null +++ b/WebServices/deposit/src/main/java/br/ufrn/imd/withdrawal/controller/WithdrawalController.java @@ -0,0 +1,22 @@ +package br.ufrn.imd.withdrawal.controller; + +import br.ufrn.imd.withdrawal.domain.Client; +import br.ufrn.imd.withdrawal.service.WithdrawalService; +import lombok.AllArgsConstructor; +import lombok.RequiredArgsConstructor; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.HttpStatus; +import org.springframework.web.bind.annotation.*; + +@RequiredArgsConstructor +@RestController +@RequestMapping("/banking/client/{id}") +public class WithdrawalController { + + private final WithdrawalService service; + + @GetMapping + public Client withdrawal(@PathVariable Integer id, @RequestParam(name = "value") Double value) { + return service.withdraw(value, new Client(id)); + } +} diff --git a/WebServices/transfer/src/main/java/br/ufrn/imd/transfer/domain/Account.java b/WebServices/deposit/src/main/java/br/ufrn/imd/withdrawal/domain/Account.java similarity index 91% rename from WebServices/transfer/src/main/java/br/ufrn/imd/transfer/domain/Account.java rename to WebServices/deposit/src/main/java/br/ufrn/imd/withdrawal/domain/Account.java index aa147cb817f9cd5de9d8f57917ceb2956ea05563..e96c20756ddcc3639386f25b9525209deb1a97ce 100644 --- a/WebServices/transfer/src/main/java/br/ufrn/imd/transfer/domain/Account.java +++ b/WebServices/deposit/src/main/java/br/ufrn/imd/withdrawal/domain/Account.java @@ -1,4 +1,4 @@ -package br.ufrn.imd.transfer.domain; +package br.ufrn.imd.withdrawal.domain; import lombok.*; diff --git a/WebServices/transfer/src/main/java/br/ufrn/imd/transfer/domain/Client.java b/WebServices/deposit/src/main/java/br/ufrn/imd/withdrawal/domain/Client.java similarity index 92% rename from WebServices/transfer/src/main/java/br/ufrn/imd/transfer/domain/Client.java rename to WebServices/deposit/src/main/java/br/ufrn/imd/withdrawal/domain/Client.java index 79a7f251ad79fe5c74f3de5c6a657a7dada9584f..af2368f3a4d749cc8efab46ce91595865ebc180a 100644 --- a/WebServices/transfer/src/main/java/br/ufrn/imd/transfer/domain/Client.java +++ b/WebServices/deposit/src/main/java/br/ufrn/imd/withdrawal/domain/Client.java @@ -1,4 +1,4 @@ -package br.ufrn.imd.transfer.domain; +package br.ufrn.imd.withdrawal.domain; import lombok.*; diff --git a/WebServices/transfer/src/main/java/br/ufrn/imd/transfer/repository/ClientRepository.java b/WebServices/deposit/src/main/java/br/ufrn/imd/withdrawal/repository/ClientRepository.java similarity index 82% rename from WebServices/transfer/src/main/java/br/ufrn/imd/transfer/repository/ClientRepository.java rename to WebServices/deposit/src/main/java/br/ufrn/imd/withdrawal/repository/ClientRepository.java index 917cc223f1a496a0683df9c4e17f8387832a0936..f2ab6a92c937cacd72c6db0169082da9970beb2e 100644 --- a/WebServices/transfer/src/main/java/br/ufrn/imd/transfer/repository/ClientRepository.java +++ b/WebServices/deposit/src/main/java/br/ufrn/imd/withdrawal/repository/ClientRepository.java @@ -1,6 +1,6 @@ -package br.ufrn.imd.transfer.repository; +package br.ufrn.imd.withdrawal.repository; -import br.ufrn.imd.transfer.domain.Client; +import br.ufrn.imd.withdrawal.domain.Client; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.Query; import org.springframework.stereotype.Repository; diff --git a/WebServices/deposit/src/main/java/br/ufrn/imd/withdrawal/service/WithdrawalService.java b/WebServices/deposit/src/main/java/br/ufrn/imd/withdrawal/service/WithdrawalService.java new file mode 100644 index 0000000000000000000000000000000000000000..b3e0f26742668c933e0cf1ac985ecc3c37253940 --- /dev/null +++ b/WebServices/deposit/src/main/java/br/ufrn/imd/withdrawal/service/WithdrawalService.java @@ -0,0 +1,31 @@ +package br.ufrn.imd.withdrawal.service; + +import br.ufrn.imd.withdrawal.domain.Account; +import br.ufrn.imd.withdrawal.domain.Client; +import br.ufrn.imd.withdrawal.repository.ClientRepository; +import lombok.AllArgsConstructor; +import lombok.extern.java.Log; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +@Log +@AllArgsConstructor +@Service +public class WithdrawalService { + @Autowired + private final ClientRepository clientRepository; + + public Client withdraw(Double value, Client client) { + client = clientRepository.findById(client.getId()) + .orElseThrow(() -> new RuntimeException("Invalid user!")); + + Account account = client.getAccount(); + if(value > account.getBalance()) throw new RuntimeException("Insufficient balance"); + + account.setBalance(account.getBalance() - value); + client = clientRepository.save(client); + log.info("Withdrawal concluded!"); + log.info(String.format("Account balance: R$ %.2f", client.getAccount().getBalance())); + return client; + } +} diff --git a/WebServices/deposit/src/main/resources/application.yml b/WebServices/deposit/src/main/resources/application.yml index 5644493807c760e2a6b1d8f2e7c6942d714db812..02b446970433b39bdb382ea88dc059deb3bcd43f 100644 --- a/WebServices/deposit/src/main/resources/application.yml +++ b/WebServices/deposit/src/main/resources/application.yml @@ -1,14 +1,26 @@ server: - port: 8081 - + port: 8083 +eureka: + instance: + prefer-ip-address: true + client: + service-url: + defaultZone: http://registry:8081/eureka/ + fetch-registry: true + register-with-eureka: true + spring: + application: + name: withdrawal datasource: - url: jdbc:postgresql://postgres-service:5432/postgres + url: jdbc:postgresql://postgresServ:5432/postgres username: postgres password: postgres jpa: show-sql: false - properties: + properties: hibernate: dialect: org.hibernate.dialect.PostgreSQLDialect - ddl-auto: update \ No newline at end of file + ddl-auto: update + jmx: + enabled: false \ No newline at end of file diff --git a/WebServices/deposit/src/test/java/br/ufrn/imd/deposit/DepositApplicationTests.java b/WebServices/deposit/src/test/java/br/ufrn/imd/deposit/DepositApplicationTests.java deleted file mode 100644 index 9a6024ff4993ec437a1bac3dab77e497274b1c2c..0000000000000000000000000000000000000000 --- a/WebServices/deposit/src/test/java/br/ufrn/imd/deposit/DepositApplicationTests.java +++ /dev/null @@ -1,13 +0,0 @@ -package br.ufrn.imd.deposit; - -import org.junit.jupiter.api.Test; -import org.springframework.boot.test.context.SpringBootTest; - -@SpringBootTest -class DepositApplicationTests { - - @Test - void contextLoads() { - } - -} diff --git a/WebServices/deposit/src/test/java/br/ufrn/imd/withdrawal/CourseApplicationTests.java b/WebServices/deposit/src/test/java/br/ufrn/imd/withdrawal/CourseApplicationTests.java new file mode 100644 index 0000000000000000000000000000000000000000..b84743fe08d4bfdafd2ba2588a9a532fa80fa854 --- /dev/null +++ b/WebServices/deposit/src/test/java/br/ufrn/imd/withdrawal/CourseApplicationTests.java @@ -0,0 +1,16 @@ +package br.ufrn.imd.withdrawal; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +@RunWith(SpringRunner.class) +@SpringBootTest +public class CourseApplicationTests { + + @Test + public void contextLoads() { + } + +} diff --git a/WebServices/deposit/target/classes/application.yml b/WebServices/deposit/target/classes/application.yml index 5644493807c760e2a6b1d8f2e7c6942d714db812..02b446970433b39bdb382ea88dc059deb3bcd43f 100644 --- a/WebServices/deposit/target/classes/application.yml +++ b/WebServices/deposit/target/classes/application.yml @@ -1,14 +1,26 @@ server: - port: 8081 - + port: 8083 +eureka: + instance: + prefer-ip-address: true + client: + service-url: + defaultZone: http://registry:8081/eureka/ + fetch-registry: true + register-with-eureka: true + spring: + application: + name: withdrawal datasource: - url: jdbc:postgresql://postgres-service:5432/postgres + url: jdbc:postgresql://postgresServ:5432/postgres username: postgres password: postgres jpa: show-sql: false - properties: + properties: hibernate: dialect: org.hibernate.dialect.PostgreSQLDialect - ddl-auto: update \ No newline at end of file + ddl-auto: update + jmx: + enabled: false \ No newline at end of file diff --git a/WebServices/deposit/target/classes/br/ufrn/imd/deposit/DepositApplication.class b/WebServices/deposit/target/classes/br/ufrn/imd/deposit/DepositApplication.class deleted file mode 100644 index 646ba40c5d7e07163b57721f888e861f940528f3..0000000000000000000000000000000000000000 Binary files a/WebServices/deposit/target/classes/br/ufrn/imd/deposit/DepositApplication.class and /dev/null differ diff --git a/WebServices/deposit/target/classes/br/ufrn/imd/deposit/controller/DepositController.class b/WebServices/deposit/target/classes/br/ufrn/imd/deposit/controller/DepositController.class deleted file mode 100644 index b018fb3f007a32c6e4b83872c80a313d32203947..0000000000000000000000000000000000000000 Binary files a/WebServices/deposit/target/classes/br/ufrn/imd/deposit/controller/DepositController.class and /dev/null differ diff --git a/WebServices/deposit/target/classes/br/ufrn/imd/deposit/domain/Account.class b/WebServices/deposit/target/classes/br/ufrn/imd/deposit/domain/Account.class deleted file mode 100644 index 1925ef270b472cea8eca1935f37b6ed0c54caba0..0000000000000000000000000000000000000000 Binary files a/WebServices/deposit/target/classes/br/ufrn/imd/deposit/domain/Account.class and /dev/null differ diff --git a/WebServices/deposit/target/classes/br/ufrn/imd/deposit/domain/Client.class b/WebServices/deposit/target/classes/br/ufrn/imd/deposit/domain/Client.class deleted file mode 100644 index 5eeb0fc7b5b12147ca27930d2b1b464ccb1c92f8..0000000000000000000000000000000000000000 Binary files a/WebServices/deposit/target/classes/br/ufrn/imd/deposit/domain/Client.class and /dev/null differ diff --git a/WebServices/deposit/target/classes/br/ufrn/imd/deposit/repository/ClientRepository.class b/WebServices/deposit/target/classes/br/ufrn/imd/deposit/repository/ClientRepository.class deleted file mode 100644 index a0bfc458c38d3bbacc4e7294d0b5c411727bb74a..0000000000000000000000000000000000000000 Binary files a/WebServices/deposit/target/classes/br/ufrn/imd/deposit/repository/ClientRepository.class and /dev/null differ diff --git a/WebServices/deposit/target/classes/br/ufrn/imd/deposit/service/DepositService.class b/WebServices/deposit/target/classes/br/ufrn/imd/deposit/service/DepositService.class deleted file mode 100644 index f5a01325a386183f284834f7620ec81c9eeee0f5..0000000000000000000000000000000000000000 Binary files a/WebServices/deposit/target/classes/br/ufrn/imd/deposit/service/DepositService.class and /dev/null differ diff --git a/WebServices/deposit/target/deposit-0.0.1-SNAPSHOT.jar b/WebServices/deposit/target/deposit-0.0.1-SNAPSHOT.jar deleted file mode 100644 index eb06658f4014c1f589ca3395cc29d8861d07d61d..0000000000000000000000000000000000000000 Binary files a/WebServices/deposit/target/deposit-0.0.1-SNAPSHOT.jar and /dev/null differ diff --git a/WebServices/deposit/target/deposit-0.0.1-SNAPSHOT.jar.original b/WebServices/deposit/target/deposit-0.0.1-SNAPSHOT.jar.original deleted file mode 100644 index 80d6b8a53719e6c6a98df8a0daa8271d1d1731e1..0000000000000000000000000000000000000000 Binary files a/WebServices/deposit/target/deposit-0.0.1-SNAPSHOT.jar.original and /dev/null differ diff --git a/WebServices/deposit/target/maven-archiver/pom.properties b/WebServices/deposit/target/maven-archiver/pom.properties index 4c0857c2290ba1cc0954c06d6b878b391bd99ce9..6b1d262b91d00e937d7615c1678176063a59f878 100644 --- a/WebServices/deposit/target/maven-archiver/pom.properties +++ b/WebServices/deposit/target/maven-archiver/pom.properties @@ -1,3 +1,4 @@ -artifactId=deposit +#Created by Apache Maven 3.6.3 groupId=br.ufrn.imd +artifactId=withdrawal version=0.0.1-SNAPSHOT diff --git a/WebServices/deposit/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst b/WebServices/deposit/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst index d4f4dfd13da7c6030cc2c98a044e666f20d1d1b2..3d142b7ac0201d3fc412947f5e5860d4c02ab8a0 100644 --- a/WebServices/deposit/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst +++ b/WebServices/deposit/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst @@ -1,6 +1,6 @@ -br/ufrn/imd/deposit/controller/DepositController.class -br/ufrn/imd/deposit/domain/Account.class -br/ufrn/imd/deposit/DepositApplication.class -br/ufrn/imd/deposit/service/DepositService.class -br/ufrn/imd/deposit/repository/ClientRepository.class -br/ufrn/imd/deposit/domain/Client.class +br/ufrn/imd/withdrawal/domain/Account.class +br/ufrn/imd/withdrawal/domain/Client.class +br/ufrn/imd/withdrawal/controller/WithdrawalController.class +br/ufrn/imd/withdrawal/service/WithdrawalService.class +br/ufrn/imd/withdrawal/repository/ClientRepository.class +br/ufrn/imd/withdrawal/WithdrawalApplication.class diff --git a/WebServices/deposit/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst b/WebServices/deposit/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst index eec7d31e5fd2efc8a828c55c9dc881c4ce12254d..f1ec5109408cf15b9e5eefba94a1ce80a5369515 100644 --- a/WebServices/deposit/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst +++ b/WebServices/deposit/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst @@ -1,6 +1,6 @@ -/home/ff/code/dim0614/WebServices/deposit/src/main/java/br/ufrn/imd/deposit/DepositApplication.java -/home/ff/code/dim0614/WebServices/deposit/src/main/java/br/ufrn/imd/deposit/service/DepositService.java -/home/ff/code/dim0614/WebServices/deposit/src/main/java/br/ufrn/imd/deposit/domain/Client.java -/home/ff/code/dim0614/WebServices/deposit/src/main/java/br/ufrn/imd/deposit/controller/DepositController.java -/home/ff/code/dim0614/WebServices/deposit/src/main/java/br/ufrn/imd/deposit/domain/Account.java -/home/ff/code/dim0614/WebServices/deposit/src/main/java/br/ufrn/imd/deposit/repository/ClientRepository.java +/home/ff/code/dim/devdojo-microservices/withdrawal/src/main/java/br/ufrn/imd/withdrawal/service/WithdrawalService.java +/home/ff/code/dim/devdojo-microservices/withdrawal/src/main/java/br/ufrn/imd/withdrawal/domain/Client.java +/home/ff/code/dim/devdojo-microservices/withdrawal/src/main/java/br/ufrn/imd/withdrawal/domain/Account.java +/home/ff/code/dim/devdojo-microservices/withdrawal/src/main/java/br/ufrn/imd/withdrawal/repository/ClientRepository.java +/home/ff/code/dim/devdojo-microservices/withdrawal/src/main/java/br/ufrn/imd/withdrawal/WithdrawalApplication.java +/home/ff/code/dim/devdojo-microservices/withdrawal/src/main/java/br/ufrn/imd/withdrawal/controller/WithdrawalController.java diff --git a/WebServices/deposit/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/createdFiles.lst b/WebServices/deposit/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/createdFiles.lst index 7e6f9d17889fa5cf692138a0a2916a43a6a85a58..acc938601d964f4ae34f8d7176eb35a1150158b3 100644 --- a/WebServices/deposit/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/createdFiles.lst +++ b/WebServices/deposit/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/createdFiles.lst @@ -1 +1 @@ -br/ufrn/imd/deposit/DepositApplicationTests.class +br/ufrn/imd/withdrawal/CourseApplicationTests.class diff --git a/WebServices/deposit/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst b/WebServices/deposit/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst index 54d825f10cc92a15f42d7e0512767e4d11e0c621..756fc386269446fe15a83950841e02bec8148512 100644 --- a/WebServices/deposit/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst +++ b/WebServices/deposit/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst @@ -1 +1 @@ -/home/ff/code/dim0614/WebServices/deposit/src/test/java/br/ufrn/imd/deposit/DepositApplicationTests.java +/home/ff/code/dim/devdojo-microservices/withdrawal/src/test/java/br/ufrn/imd/withdrawal/CourseApplicationTests.java diff --git a/WebServices/deposit/target/test-classes/br/ufrn/imd/deposit/DepositApplicationTests.class b/WebServices/deposit/target/test-classes/br/ufrn/imd/deposit/DepositApplicationTests.class deleted file mode 100644 index 2b44280951e8f417ac3d3032efa8807646b12b3b..0000000000000000000000000000000000000000 Binary files a/WebServices/deposit/target/test-classes/br/ufrn/imd/deposit/DepositApplicationTests.class and /dev/null differ diff --git a/WebServices/discovery/.gitignore b/WebServices/discovery/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..ba5cb5cca8766c8b2403d25de25b1c880c5ef64a --- /dev/null +++ b/WebServices/discovery/.gitignore @@ -0,0 +1,26 @@ +HELP.md +/target/ +!.mvn/wrapper/maven-wrapper.jar + +### STS ### +.apt_generated +.classpath +.factorypath +.project +.settings +.springBeans +.sts4-cache + +### IntelliJ IDEA ### +.idea +*.iws +*.iml +*.ipr + +### NetBeans ### +/nbproject/private/ +/nbbuild/ +/dist/ +/nbdist/ +/.nb-gradle/ +/build/ diff --git a/WebServices/discovery/.mvn/wrapper/MavenWrapperDownloader.java b/WebServices/discovery/.mvn/wrapper/MavenWrapperDownloader.java new file mode 100644 index 0000000000000000000000000000000000000000..042d184cb5c15da221db5fb5330e2d6b2596eaa3 --- /dev/null +++ b/WebServices/discovery/.mvn/wrapper/MavenWrapperDownloader.java @@ -0,0 +1,114 @@ +/* +Licensed to the Apache Software Foundation (ASF) under one +or more contributor license agreements. See the NOTICE file +distributed with this work for additional information +regarding copyright ownership. The ASF licenses this file +to you under the Apache License, Version 2.0 (the +"License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, +software distributed under the License is distributed on an +"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, either express or implied. See the License for the +specific language governing permissions and limitations +under the License. +*/ + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.net.URL; +import java.nio.channels.Channels; +import java.nio.channels.ReadableByteChannel; +import java.util.Properties; + +public class MavenWrapperDownloader { + + /** + * Default URL to download the maven-wrapper.jar from, if no 'downloadUrl' is provided. + */ + private static final String DEFAULT_DOWNLOAD_URL = + "https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.4.2/maven-wrapper-0.4.2.jar"; + + /** + * Path to the maven-wrapper.properties file, which might contain a downloadUrl property to + * use instead of the default one. + */ + private static final String MAVEN_WRAPPER_PROPERTIES_PATH = + ".mvn/wrapper/maven-wrapper.properties"; + + /** + * Path where the maven-wrapper.jar will be saved to. + */ + private static final String MAVEN_WRAPPER_JAR_PATH = + ".mvn/wrapper/maven-wrapper.jar"; + + /** + * Name of the property which should be used to override the default download url for the wrapper. + */ + private static final String PROPERTY_NAME_WRAPPER_URL = "wrapperUrl"; + + public static void main(String args[]) { + System.out.println("- Downloader started"); + File baseDirectory = new File(args[0]); + System.out.println("- Using base directory: " + baseDirectory.getAbsolutePath()); + + // If the maven-wrapper.properties exists, read it and check if it contains a custom + // wrapperUrl parameter. + File mavenWrapperPropertyFile = new File(baseDirectory, MAVEN_WRAPPER_PROPERTIES_PATH); + String url = DEFAULT_DOWNLOAD_URL; + if (mavenWrapperPropertyFile.exists()) { + FileInputStream mavenWrapperPropertyFileInputStream = null; + try { + mavenWrapperPropertyFileInputStream = new FileInputStream(mavenWrapperPropertyFile); + Properties mavenWrapperProperties = new Properties(); + mavenWrapperProperties.load(mavenWrapperPropertyFileInputStream); + url = mavenWrapperProperties.getProperty(PROPERTY_NAME_WRAPPER_URL, url); + } catch (IOException e) { + System.out.println("- ERROR loading '" + MAVEN_WRAPPER_PROPERTIES_PATH + "'"); + } finally { + try { + if (mavenWrapperPropertyFileInputStream != null) { + mavenWrapperPropertyFileInputStream.close(); + } + } catch (IOException e) { + // Ignore ... + } + } + } + System.out.println("- Downloading from: : " + url); + + File outputFile = new File(baseDirectory.getAbsolutePath(), MAVEN_WRAPPER_JAR_PATH); + if (!outputFile.getParentFile().exists()) { + if (!outputFile.getParentFile().mkdirs()) { + System.out.println( + "- ERROR creating output direcrory '" + outputFile.getParentFile().getAbsolutePath() + "'"); + } + } + System.out.println("- Downloading to: " + outputFile.getAbsolutePath()); + try { + downloadFileFromURL(url, outputFile); + System.out.println("Done"); + System.exit(0); + } catch (Throwable e) { + System.out.println("- Error downloading"); + e.printStackTrace(); + System.exit(1); + } + } + + private static void downloadFileFromURL(String urlString, File destination) throws Exception { + URL website = new URL(urlString); + ReadableByteChannel rbc; + rbc = Channels.newChannel(website.openStream()); + FileOutputStream fos = new FileOutputStream(destination); + fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE); + fos.close(); + rbc.close(); + } + +} diff --git a/WebServices/discovery/.mvn/wrapper/maven-wrapper.jar b/WebServices/discovery/.mvn/wrapper/maven-wrapper.jar new file mode 100644 index 0000000000000000000000000000000000000000..01e67997377a393fd672c7dcde9dccbedf0cb1e9 Binary files /dev/null and b/WebServices/discovery/.mvn/wrapper/maven-wrapper.jar differ diff --git a/WebServices/discovery/.mvn/wrapper/maven-wrapper.properties b/WebServices/discovery/.mvn/wrapper/maven-wrapper.properties new file mode 100644 index 0000000000000000000000000000000000000000..cd0d451ccd6fc835996c9fe4eebf8a571154f515 --- /dev/null +++ b/WebServices/discovery/.mvn/wrapper/maven-wrapper.properties @@ -0,0 +1 @@ +distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.0/apache-maven-3.6.0-bin.zip diff --git a/WebServices/discovery/Dockerfile b/WebServices/discovery/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..1615d429ca447933503a5565552b139d7e8e17d1 --- /dev/null +++ b/WebServices/discovery/Dockerfile @@ -0,0 +1,3 @@ +FROM openjdk:11 +COPY target/discovery.jar discovery.jar +ENTRYPOINT ["java","-jar","discovery.jar"] \ No newline at end of file diff --git a/WebServices/discovery/mvnw b/WebServices/discovery/mvnw new file mode 100755 index 0000000000000000000000000000000000000000..5551fde8e7dba1e37a1821e8b26374893e2a9e2e --- /dev/null +++ b/WebServices/discovery/mvnw @@ -0,0 +1,286 @@ +#!/bin/sh +# ---------------------------------------------------------------------------- +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# ---------------------------------------------------------------------------- + +# ---------------------------------------------------------------------------- +# Maven2 Start Up Batch script +# +# Required ENV vars: +# ------------------ +# JAVA_HOME - location of a JDK home dir +# +# Optional ENV vars +# ----------------- +# M2_HOME - location of maven2's installed home dir +# MAVEN_OPTS - parameters passed to the Java VM when running Maven +# e.g. to debug Maven itself, use +# set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 +# MAVEN_SKIP_RC - flag to disable loading of mavenrc files +# ---------------------------------------------------------------------------- + +if [ -z "$MAVEN_SKIP_RC" ] ; then + + if [ -f /etc/mavenrc ] ; then + . /etc/mavenrc + fi + + if [ -f "$HOME/.mavenrc" ] ; then + . "$HOME/.mavenrc" + fi + +fi + +# OS specific support. $var _must_ be set to either true or false. +cygwin=false; +darwin=false; +mingw=false +case "`uname`" in + CYGWIN*) cygwin=true ;; + MINGW*) mingw=true;; + Darwin*) darwin=true + # Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home + # See https://developer.apple.com/library/mac/qa/qa1170/_index.html + if [ -z "$JAVA_HOME" ]; then + if [ -x "/usr/libexec/java_home" ]; then + export JAVA_HOME="`/usr/libexec/java_home`" + else + export JAVA_HOME="/Library/Java/Home" + fi + fi + ;; +esac + +if [ -z "$JAVA_HOME" ] ; then + if [ -r /etc/gentoo-release ] ; then + JAVA_HOME=`java-config --jre-home` + fi +fi + +if [ -z "$M2_HOME" ] ; then + ## resolve links - $0 may be a link to maven's home + PRG="$0" + + # need this for relative symlinks + while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG="`dirname "$PRG"`/$link" + fi + done + + saveddir=`pwd` + + M2_HOME=`dirname "$PRG"`/.. + + # make it fully qualified + M2_HOME=`cd "$M2_HOME" && pwd` + + cd "$saveddir" + # echo Using m2 at $M2_HOME +fi + +# For Cygwin, ensure paths are in UNIX format before anything is touched +if $cygwin ; then + [ -n "$M2_HOME" ] && + M2_HOME=`cygpath --unix "$M2_HOME"` + [ -n "$JAVA_HOME" ] && + JAVA_HOME=`cygpath --unix "$JAVA_HOME"` + [ -n "$CLASSPATH" ] && + CLASSPATH=`cygpath --path --unix "$CLASSPATH"` +fi + +# For Mingw, ensure paths are in UNIX format before anything is touched +if $mingw ; then + [ -n "$M2_HOME" ] && + M2_HOME="`(cd "$M2_HOME"; pwd)`" + [ -n "$JAVA_HOME" ] && + JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`" + # TODO classpath? +fi + +if [ -z "$JAVA_HOME" ]; then + javaExecutable="`which javac`" + if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then + # readlink(1) is not available as standard on Solaris 10. + readLink=`which readlink` + if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then + if $darwin ; then + javaHome="`dirname \"$javaExecutable\"`" + javaExecutable="`cd \"$javaHome\" && pwd -P`/javac" + else + javaExecutable="`readlink -f \"$javaExecutable\"`" + fi + javaHome="`dirname \"$javaExecutable\"`" + javaHome=`expr "$javaHome" : '\(.*\)/bin'` + JAVA_HOME="$javaHome" + export JAVA_HOME + fi + fi +fi + +if [ -z "$JAVACMD" ] ; then + if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + else + JAVACMD="`which java`" + fi +fi + +if [ ! -x "$JAVACMD" ] ; then + echo "Error: JAVA_HOME is not defined correctly." >&2 + echo " We cannot execute $JAVACMD" >&2 + exit 1 +fi + +if [ -z "$JAVA_HOME" ] ; then + echo "Warning: JAVA_HOME environment variable is not set." +fi + +CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher + +# traverses directory structure from process work directory to filesystem root +# first directory with .mvn subdirectory is considered project base directory +find_maven_basedir() { + + if [ -z "$1" ] + then + echo "Path not specified to find_maven_basedir" + return 1 + fi + + basedir="$1" + wdir="$1" + while [ "$wdir" != '/' ] ; do + if [ -d "$wdir"/.mvn ] ; then + basedir=$wdir + break + fi + # workaround for JBEAP-8937 (on Solaris 10/Sparc) + if [ -d "${wdir}" ]; then + wdir=`cd "$wdir/.."; pwd` + fi + # end of workaround + done + echo "${basedir}" +} + +# concatenates all lines of a file +concat_lines() { + if [ -f "$1" ]; then + echo "$(tr -s '\n' ' ' < "$1")" + fi +} + +BASE_DIR=`find_maven_basedir "$(pwd)"` +if [ -z "$BASE_DIR" ]; then + exit 1; +fi + +########################################################################################## +# Extension to allow automatically downloading the maven-wrapper.jar from Maven-central +# This allows using the maven wrapper in projects that prohibit checking in binary data. +########################################################################################## +if [ -r "$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" ]; then + if [ "$MVNW_VERBOSE" = true ]; then + echo "Found .mvn/wrapper/maven-wrapper.jar" + fi +else + if [ "$MVNW_VERBOSE" = true ]; then + echo "Couldn't find .mvn/wrapper/maven-wrapper.jar, downloading it ..." + fi + jarUrl="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.4.2/maven-wrapper-0.4.2.jar" + while IFS="=" read key value; do + case "$key" in (wrapperUrl) jarUrl="$value"; break ;; + esac + done < "$BASE_DIR/.mvn/wrapper/maven-wrapper.properties" + if [ "$MVNW_VERBOSE" = true ]; then + echo "Downloading from: $jarUrl" + fi + wrapperJarPath="$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" + + if command -v wget > /dev/null; then + if [ "$MVNW_VERBOSE" = true ]; then + echo "Found wget ... using wget" + fi + wget "$jarUrl" -O "$wrapperJarPath" + elif command -v curl > /dev/null; then + if [ "$MVNW_VERBOSE" = true ]; then + echo "Found curl ... using curl" + fi + curl -o "$wrapperJarPath" "$jarUrl" + else + if [ "$MVNW_VERBOSE" = true ]; then + echo "Falling back to using Java to download" + fi + javaClass="$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.java" + if [ -e "$javaClass" ]; then + if [ ! -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then + if [ "$MVNW_VERBOSE" = true ]; then + echo " - Compiling MavenWrapperDownloader.java ..." + fi + # Compiling the Java class + ("$JAVA_HOME/bin/javac" "$javaClass") + fi + if [ -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then + # Running the downloader + if [ "$MVNW_VERBOSE" = true ]; then + echo " - Running MavenWrapperDownloader.java ..." + fi + ("$JAVA_HOME/bin/java" -cp .mvn/wrapper MavenWrapperDownloader "$MAVEN_PROJECTBASEDIR") + fi + fi + fi +fi +########################################################################################## +# End of extension +########################################################################################## + +export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"} +if [ "$MVNW_VERBOSE" = true ]; then + echo $MAVEN_PROJECTBASEDIR +fi +MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS" + +# For Cygwin, switch paths to Windows format before running java +if $cygwin; then + [ -n "$M2_HOME" ] && + M2_HOME=`cygpath --path --windows "$M2_HOME"` + [ -n "$JAVA_HOME" ] && + JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"` + [ -n "$CLASSPATH" ] && + CLASSPATH=`cygpath --path --windows "$CLASSPATH"` + [ -n "$MAVEN_PROJECTBASEDIR" ] && + MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"` +fi + +WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain + +exec "$JAVACMD" \ + $MAVEN_OPTS \ + -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \ + "-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \ + ${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@" diff --git a/WebServices/discovery/mvnw.cmd b/WebServices/discovery/mvnw.cmd new file mode 100644 index 0000000000000000000000000000000000000000..e5cfb0ae9eab80c314b7d79c164d4a00772824b8 --- /dev/null +++ b/WebServices/discovery/mvnw.cmd @@ -0,0 +1,161 @@ +@REM ---------------------------------------------------------------------------- +@REM Licensed to the Apache Software Foundation (ASF) under one +@REM or more contributor license agreements. See the NOTICE file +@REM distributed with this work for additional information +@REM regarding copyright ownership. The ASF licenses this file +@REM to you under the Apache License, Version 2.0 (the +@REM "License"); you may not use this file except in compliance +@REM with the License. You may obtain a copy of the License at +@REM +@REM http://www.apache.org/licenses/LICENSE-2.0 +@REM +@REM Unless required by applicable law or agreed to in writing, +@REM software distributed under the License is distributed on an +@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +@REM KIND, either express or implied. See the License for the +@REM specific language governing permissions and limitations +@REM under the License. +@REM ---------------------------------------------------------------------------- + +@REM ---------------------------------------------------------------------------- +@REM Maven2 Start Up Batch script +@REM +@REM Required ENV vars: +@REM JAVA_HOME - location of a JDK home dir +@REM +@REM Optional ENV vars +@REM M2_HOME - location of maven2's installed home dir +@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands +@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a key stroke before ending +@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven +@REM e.g. to debug Maven itself, use +@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 +@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files +@REM ---------------------------------------------------------------------------- + +@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on' +@echo off +@REM set title of command window +title %0 +@REM enable echoing my setting MAVEN_BATCH_ECHO to 'on' +@if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO% + +@REM set %HOME% to equivalent of $HOME +if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%") + +@REM Execute a user defined script before this one +if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre +@REM check for pre script, once with legacy .bat ending and once with .cmd ending +if exist "%HOME%\mavenrc_pre.bat" call "%HOME%\mavenrc_pre.bat" +if exist "%HOME%\mavenrc_pre.cmd" call "%HOME%\mavenrc_pre.cmd" +:skipRcPre + +@setlocal + +set ERROR_CODE=0 + +@REM To isolate internal variables from possible post scripts, we use another setlocal +@setlocal + +@REM ==== START VALIDATION ==== +if not "%JAVA_HOME%" == "" goto OkJHome + +echo. +echo Error: JAVA_HOME not found in your environment. >&2 +echo Please set the JAVA_HOME variable in your environment to match the >&2 +echo location of your Java installation. >&2 +echo. +goto error + +:OkJHome +if exist "%JAVA_HOME%\bin\java.exe" goto init + +echo. +echo Error: JAVA_HOME is set to an invalid directory. >&2 +echo JAVA_HOME = "%JAVA_HOME%" >&2 +echo Please set the JAVA_HOME variable in your environment to match the >&2 +echo location of your Java installation. >&2 +echo. +goto error + +@REM ==== END VALIDATION ==== + +:init + +@REM Find the project base dir, i.e. the directory that contains the folder ".mvn". +@REM Fallback to current working directory if not found. + +set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR% +IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir + +set EXEC_DIR=%CD% +set WDIR=%EXEC_DIR% +:findBaseDir +IF EXIST "%WDIR%"\.mvn goto baseDirFound +cd .. +IF "%WDIR%"=="%CD%" goto baseDirNotFound +set WDIR=%CD% +goto findBaseDir + +:baseDirFound +set MAVEN_PROJECTBASEDIR=%WDIR% +cd "%EXEC_DIR%" +goto endDetectBaseDir + +:baseDirNotFound +set MAVEN_PROJECTBASEDIR=%EXEC_DIR% +cd "%EXEC_DIR%" + +:endDetectBaseDir + +IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig + +@setlocal EnableExtensions EnableDelayedExpansion +for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a +@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS% + +:endReadAdditionalConfig + +SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe" +set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar" +set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain + +set DOWNLOAD_URL="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.4.2/maven-wrapper-0.4.2.jar" +FOR /F "tokens=1,2 delims==" %%A IN (%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties) DO ( + IF "%%A"=="wrapperUrl" SET DOWNLOAD_URL=%%B +) + +@REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central +@REM This allows using the maven wrapper in projects that prohibit checking in binary data. +if exist %WRAPPER_JAR% ( + echo Found %WRAPPER_JAR% +) else ( + echo Couldn't find %WRAPPER_JAR%, downloading it ... + echo Downloading from: %DOWNLOAD_URL% + powershell -Command "(New-Object Net.WebClient).DownloadFile('%DOWNLOAD_URL%', '%WRAPPER_JAR%')" + echo Finished downloading %WRAPPER_JAR% +) +@REM End of extension + +%MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %* +if ERRORLEVEL 1 goto error +goto end + +:error +set ERROR_CODE=1 + +:end +@endlocal & set ERROR_CODE=%ERROR_CODE% + +if not "%MAVEN_SKIP_RC%" == "" goto skipRcPost +@REM check for post script, once with legacy .bat ending and once with .cmd ending +if exist "%HOME%\mavenrc_post.bat" call "%HOME%\mavenrc_post.bat" +if exist "%HOME%\mavenrc_post.cmd" call "%HOME%\mavenrc_post.cmd" +:skipRcPost + +@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on' +if "%MAVEN_BATCH_PAUSE%" == "on" pause + +if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE% + +exit /B %ERROR_CODE% diff --git a/WebServices/discovery/pom.xml b/WebServices/discovery/pom.xml new file mode 100644 index 0000000000000000000000000000000000000000..ef11b960269ee69bf7ca31a01f56cd17f33f5d70 --- /dev/null +++ b/WebServices/discovery/pom.xml @@ -0,0 +1,70 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>br.ufrn.imd</groupId> + <artifactId>dim0614</artifactId> + <version>1.0-SNAPSHOT</version> + <relativePath>../</relativePath> <!-- lookup parent from repository --> + </parent> + + <artifactId>discovery</artifactId> + <version>0.0.1-SNAPSHOT</version> + <name>discovery</name> + <description>DevDojo's Service Discovery</description> + + <properties> + <java.version>11</java.version> + <jaxb-api.version>2.3.1</jaxb-api.version> + <jaxb-runtime.version>2.3.2</jaxb-runtime.version> + <javax-activation.version>1.2.0</javax-activation.version> + </properties> + + <dependencies> + <dependency> + <groupId>org.springframework.cloud</groupId> + <artifactId>spring-cloud-starter-netflix-eureka-server</artifactId> + </dependency> + <dependency> + <groupId>javax.xml.bind</groupId> + <artifactId>jaxb-api</artifactId> + <version>${jaxb-api.version}</version> + </dependency> + <dependency> + <groupId>javax.activation</groupId> + <artifactId>javax.activation-api</artifactId> + <version>${javax-activation.version}</version> + </dependency> + + <dependency> + <groupId>org.glassfish.jaxb</groupId> + <artifactId>jaxb-runtime</artifactId> + <version>${jaxb-runtime.version}</version> + </dependency> + + </dependencies> + + <build> + <finalName>discovery</finalName> + <plugins> + <plugin> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-maven-plugin</artifactId> + <configuration> + <executable>true</executable> + </configuration> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-compiler-plugin</artifactId> + <version>3.8.0</version> + <configuration> + <source>11</source> + <target>11</target> + </configuration> + </plugin> + </plugins> + </build> + +</project> diff --git a/WebServices/discovery/src/main/java/br/ufrn/imd/DiscoveryApplication.java b/WebServices/discovery/src/main/java/br/ufrn/imd/DiscoveryApplication.java new file mode 100644 index 0000000000000000000000000000000000000000..fed87637edb1ec498a1e78cbdde45d68518adc6d --- /dev/null +++ b/WebServices/discovery/src/main/java/br/ufrn/imd/DiscoveryApplication.java @@ -0,0 +1,15 @@ +package br.ufrn.imd; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.cloud.netflix.eureka.server.EnableEurekaServer; + +@SpringBootApplication +@EnableEurekaServer +public class DiscoveryApplication { + + public static void main(String[] args) { + SpringApplication.run(DiscoveryApplication.class, args); + } + +} diff --git a/WebServices/discovery/src/main/resources/application.yml b/WebServices/discovery/src/main/resources/application.yml new file mode 100644 index 0000000000000000000000000000000000000000..51b3a1a44f1739dc143395a2a612073bebbc3ae0 --- /dev/null +++ b/WebServices/discovery/src/main/resources/application.yml @@ -0,0 +1,12 @@ +spring: + application: + name: registry +server: + port: 8081 + +eureka: + client: + register-with-eureka: false + fetch-registry: false + service-url: + defaultZone: http://registry:${server.port}/eureka/ diff --git a/WebServices/discovery/src/test/java/academy/devdojo/youtube/discovery/DiscoveryApplicationTests.java b/WebServices/discovery/src/test/java/academy/devdojo/youtube/discovery/DiscoveryApplicationTests.java new file mode 100644 index 0000000000000000000000000000000000000000..b6b9fe298bc276c6576ddfef537e4eac550caffd --- /dev/null +++ b/WebServices/discovery/src/test/java/academy/devdojo/youtube/discovery/DiscoveryApplicationTests.java @@ -0,0 +1,16 @@ +package academy.devdojo.youtube.discovery; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +@RunWith(SpringRunner.class) +@SpringBootTest +public class DiscoveryApplicationTests { + + @Test + public void contextLoads() { + } + +} diff --git a/WebServices/docker-compose.yml b/WebServices/docker-compose.yml index 4367e93269da8191bf4b950c6e9b57e4bd9a787a..be37dc7ef5eb4fd2a5ee940a55f923ca8325a2d2 100644 --- a/WebServices/docker-compose.yml +++ b/WebServices/docker-compose.yml @@ -3,68 +3,70 @@ version: "3.9" volumes: postgres-server-volume: services: - postgres-service: + + postgres: image: postgres:12.9 - container_name: postgres-service + container_name: postgresServ ports: - 5433:5432 volumes: - postgres-server-volume:/var/lib/postgresql/data networks: - - distribuida-network + - sigsmartcampus2-network environment: POSTGRES_DB: postgres POSTGRES_USER: postgres POSTGRES_PASSWORD: postgres - - balance-service: - container_name: balance-service + + registry: + container_name: registry-server build: - context: ./balance + context: ./discovery dockerfile: ./Dockerfile ports: - - 8080:8080 + - 8081:8081 networks: - - distribuida-network - depends_on: - - postgres-service + - sigsmartcampus2-network - deposit-service: - container_name: deposit-service + gateway: + container_name: gateway-server build: - context: ./deposit + context: ./gateway dockerfile: ./Dockerfile ports: - - 8081:8081 - networks: - - distribuida-network + - 8080:8080 depends_on: - - postgres-service - - transfer-service: - container_name: transfer-service + - registry + networks: + - sigsmartcampus2-network + + withdrawal: + container_name: withdrawal-server build: - context: ./deposit + context: withdrawal dockerfile: ./Dockerfile ports: - - 8082:8082 + - 8083:8083 networks: - - distribuida-network + - sigsmartcampus2-network depends_on: - - postgres-service + - postgres + - gateway - withdrawal-service: - container_name: withdrawal-service + balance: + container_name: balance-server build: - context: ./withdrawal + context: balance dockerfile: ./Dockerfile ports: - - 8083:8083 + - 8084:8084 networks: - - distribuida-network + - sigsmartcampus2-network depends_on: - - postgres-service - + - postgres + - gateway + networks: - distribuida-network: + sigsmartcampus2-network: driver: bridge + external: true diff --git a/WebServices/gateway/.gitignore b/WebServices/gateway/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..ba5cb5cca8766c8b2403d25de25b1c880c5ef64a --- /dev/null +++ b/WebServices/gateway/.gitignore @@ -0,0 +1,26 @@ +HELP.md +/target/ +!.mvn/wrapper/maven-wrapper.jar + +### STS ### +.apt_generated +.classpath +.factorypath +.project +.settings +.springBeans +.sts4-cache + +### IntelliJ IDEA ### +.idea +*.iws +*.iml +*.ipr + +### NetBeans ### +/nbproject/private/ +/nbbuild/ +/dist/ +/nbdist/ +/.nb-gradle/ +/build/ diff --git a/WebServices/gateway/.mvn/wrapper/MavenWrapperDownloader.java b/WebServices/gateway/.mvn/wrapper/MavenWrapperDownloader.java new file mode 100644 index 0000000000000000000000000000000000000000..042d184cb5c15da221db5fb5330e2d6b2596eaa3 --- /dev/null +++ b/WebServices/gateway/.mvn/wrapper/MavenWrapperDownloader.java @@ -0,0 +1,114 @@ +/* +Licensed to the Apache Software Foundation (ASF) under one +or more contributor license agreements. See the NOTICE file +distributed with this work for additional information +regarding copyright ownership. The ASF licenses this file +to you under the Apache License, Version 2.0 (the +"License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, +software distributed under the License is distributed on an +"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, either express or implied. See the License for the +specific language governing permissions and limitations +under the License. +*/ + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.net.URL; +import java.nio.channels.Channels; +import java.nio.channels.ReadableByteChannel; +import java.util.Properties; + +public class MavenWrapperDownloader { + + /** + * Default URL to download the maven-wrapper.jar from, if no 'downloadUrl' is provided. + */ + private static final String DEFAULT_DOWNLOAD_URL = + "https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.4.2/maven-wrapper-0.4.2.jar"; + + /** + * Path to the maven-wrapper.properties file, which might contain a downloadUrl property to + * use instead of the default one. + */ + private static final String MAVEN_WRAPPER_PROPERTIES_PATH = + ".mvn/wrapper/maven-wrapper.properties"; + + /** + * Path where the maven-wrapper.jar will be saved to. + */ + private static final String MAVEN_WRAPPER_JAR_PATH = + ".mvn/wrapper/maven-wrapper.jar"; + + /** + * Name of the property which should be used to override the default download url for the wrapper. + */ + private static final String PROPERTY_NAME_WRAPPER_URL = "wrapperUrl"; + + public static void main(String args[]) { + System.out.println("- Downloader started"); + File baseDirectory = new File(args[0]); + System.out.println("- Using base directory: " + baseDirectory.getAbsolutePath()); + + // If the maven-wrapper.properties exists, read it and check if it contains a custom + // wrapperUrl parameter. + File mavenWrapperPropertyFile = new File(baseDirectory, MAVEN_WRAPPER_PROPERTIES_PATH); + String url = DEFAULT_DOWNLOAD_URL; + if (mavenWrapperPropertyFile.exists()) { + FileInputStream mavenWrapperPropertyFileInputStream = null; + try { + mavenWrapperPropertyFileInputStream = new FileInputStream(mavenWrapperPropertyFile); + Properties mavenWrapperProperties = new Properties(); + mavenWrapperProperties.load(mavenWrapperPropertyFileInputStream); + url = mavenWrapperProperties.getProperty(PROPERTY_NAME_WRAPPER_URL, url); + } catch (IOException e) { + System.out.println("- ERROR loading '" + MAVEN_WRAPPER_PROPERTIES_PATH + "'"); + } finally { + try { + if (mavenWrapperPropertyFileInputStream != null) { + mavenWrapperPropertyFileInputStream.close(); + } + } catch (IOException e) { + // Ignore ... + } + } + } + System.out.println("- Downloading from: : " + url); + + File outputFile = new File(baseDirectory.getAbsolutePath(), MAVEN_WRAPPER_JAR_PATH); + if (!outputFile.getParentFile().exists()) { + if (!outputFile.getParentFile().mkdirs()) { + System.out.println( + "- ERROR creating output direcrory '" + outputFile.getParentFile().getAbsolutePath() + "'"); + } + } + System.out.println("- Downloading to: " + outputFile.getAbsolutePath()); + try { + downloadFileFromURL(url, outputFile); + System.out.println("Done"); + System.exit(0); + } catch (Throwable e) { + System.out.println("- Error downloading"); + e.printStackTrace(); + System.exit(1); + } + } + + private static void downloadFileFromURL(String urlString, File destination) throws Exception { + URL website = new URL(urlString); + ReadableByteChannel rbc; + rbc = Channels.newChannel(website.openStream()); + FileOutputStream fos = new FileOutputStream(destination); + fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE); + fos.close(); + rbc.close(); + } + +} diff --git a/WebServices/gateway/.mvn/wrapper/maven-wrapper.jar b/WebServices/gateway/.mvn/wrapper/maven-wrapper.jar new file mode 100644 index 0000000000000000000000000000000000000000..01e67997377a393fd672c7dcde9dccbedf0cb1e9 Binary files /dev/null and b/WebServices/gateway/.mvn/wrapper/maven-wrapper.jar differ diff --git a/WebServices/gateway/.mvn/wrapper/maven-wrapper.properties b/WebServices/gateway/.mvn/wrapper/maven-wrapper.properties new file mode 100644 index 0000000000000000000000000000000000000000..cd0d451ccd6fc835996c9fe4eebf8a571154f515 --- /dev/null +++ b/WebServices/gateway/.mvn/wrapper/maven-wrapper.properties @@ -0,0 +1 @@ +distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.0/apache-maven-3.6.0-bin.zip diff --git a/WebServices/gateway/Dockerfile b/WebServices/gateway/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..3cf13a1c53d91e6312940d52fc4be4e83db39a97 --- /dev/null +++ b/WebServices/gateway/Dockerfile @@ -0,0 +1,3 @@ +FROM openjdk:11 +COPY target/gateway.jar gateway.jar +ENTRYPOINT ["java","-jar","gateway.jar"] \ No newline at end of file diff --git a/WebServices/gateway/mvnw b/WebServices/gateway/mvnw new file mode 100755 index 0000000000000000000000000000000000000000..5551fde8e7dba1e37a1821e8b26374893e2a9e2e --- /dev/null +++ b/WebServices/gateway/mvnw @@ -0,0 +1,286 @@ +#!/bin/sh +# ---------------------------------------------------------------------------- +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# ---------------------------------------------------------------------------- + +# ---------------------------------------------------------------------------- +# Maven2 Start Up Batch script +# +# Required ENV vars: +# ------------------ +# JAVA_HOME - location of a JDK home dir +# +# Optional ENV vars +# ----------------- +# M2_HOME - location of maven2's installed home dir +# MAVEN_OPTS - parameters passed to the Java VM when running Maven +# e.g. to debug Maven itself, use +# set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 +# MAVEN_SKIP_RC - flag to disable loading of mavenrc files +# ---------------------------------------------------------------------------- + +if [ -z "$MAVEN_SKIP_RC" ] ; then + + if [ -f /etc/mavenrc ] ; then + . /etc/mavenrc + fi + + if [ -f "$HOME/.mavenrc" ] ; then + . "$HOME/.mavenrc" + fi + +fi + +# OS specific support. $var _must_ be set to either true or false. +cygwin=false; +darwin=false; +mingw=false +case "`uname`" in + CYGWIN*) cygwin=true ;; + MINGW*) mingw=true;; + Darwin*) darwin=true + # Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home + # See https://developer.apple.com/library/mac/qa/qa1170/_index.html + if [ -z "$JAVA_HOME" ]; then + if [ -x "/usr/libexec/java_home" ]; then + export JAVA_HOME="`/usr/libexec/java_home`" + else + export JAVA_HOME="/Library/Java/Home" + fi + fi + ;; +esac + +if [ -z "$JAVA_HOME" ] ; then + if [ -r /etc/gentoo-release ] ; then + JAVA_HOME=`java-config --jre-home` + fi +fi + +if [ -z "$M2_HOME" ] ; then + ## resolve links - $0 may be a link to maven's home + PRG="$0" + + # need this for relative symlinks + while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG="`dirname "$PRG"`/$link" + fi + done + + saveddir=`pwd` + + M2_HOME=`dirname "$PRG"`/.. + + # make it fully qualified + M2_HOME=`cd "$M2_HOME" && pwd` + + cd "$saveddir" + # echo Using m2 at $M2_HOME +fi + +# For Cygwin, ensure paths are in UNIX format before anything is touched +if $cygwin ; then + [ -n "$M2_HOME" ] && + M2_HOME=`cygpath --unix "$M2_HOME"` + [ -n "$JAVA_HOME" ] && + JAVA_HOME=`cygpath --unix "$JAVA_HOME"` + [ -n "$CLASSPATH" ] && + CLASSPATH=`cygpath --path --unix "$CLASSPATH"` +fi + +# For Mingw, ensure paths are in UNIX format before anything is touched +if $mingw ; then + [ -n "$M2_HOME" ] && + M2_HOME="`(cd "$M2_HOME"; pwd)`" + [ -n "$JAVA_HOME" ] && + JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`" + # TODO classpath? +fi + +if [ -z "$JAVA_HOME" ]; then + javaExecutable="`which javac`" + if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then + # readlink(1) is not available as standard on Solaris 10. + readLink=`which readlink` + if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then + if $darwin ; then + javaHome="`dirname \"$javaExecutable\"`" + javaExecutable="`cd \"$javaHome\" && pwd -P`/javac" + else + javaExecutable="`readlink -f \"$javaExecutable\"`" + fi + javaHome="`dirname \"$javaExecutable\"`" + javaHome=`expr "$javaHome" : '\(.*\)/bin'` + JAVA_HOME="$javaHome" + export JAVA_HOME + fi + fi +fi + +if [ -z "$JAVACMD" ] ; then + if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + else + JAVACMD="`which java`" + fi +fi + +if [ ! -x "$JAVACMD" ] ; then + echo "Error: JAVA_HOME is not defined correctly." >&2 + echo " We cannot execute $JAVACMD" >&2 + exit 1 +fi + +if [ -z "$JAVA_HOME" ] ; then + echo "Warning: JAVA_HOME environment variable is not set." +fi + +CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher + +# traverses directory structure from process work directory to filesystem root +# first directory with .mvn subdirectory is considered project base directory +find_maven_basedir() { + + if [ -z "$1" ] + then + echo "Path not specified to find_maven_basedir" + return 1 + fi + + basedir="$1" + wdir="$1" + while [ "$wdir" != '/' ] ; do + if [ -d "$wdir"/.mvn ] ; then + basedir=$wdir + break + fi + # workaround for JBEAP-8937 (on Solaris 10/Sparc) + if [ -d "${wdir}" ]; then + wdir=`cd "$wdir/.."; pwd` + fi + # end of workaround + done + echo "${basedir}" +} + +# concatenates all lines of a file +concat_lines() { + if [ -f "$1" ]; then + echo "$(tr -s '\n' ' ' < "$1")" + fi +} + +BASE_DIR=`find_maven_basedir "$(pwd)"` +if [ -z "$BASE_DIR" ]; then + exit 1; +fi + +########################################################################################## +# Extension to allow automatically downloading the maven-wrapper.jar from Maven-central +# This allows using the maven wrapper in projects that prohibit checking in binary data. +########################################################################################## +if [ -r "$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" ]; then + if [ "$MVNW_VERBOSE" = true ]; then + echo "Found .mvn/wrapper/maven-wrapper.jar" + fi +else + if [ "$MVNW_VERBOSE" = true ]; then + echo "Couldn't find .mvn/wrapper/maven-wrapper.jar, downloading it ..." + fi + jarUrl="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.4.2/maven-wrapper-0.4.2.jar" + while IFS="=" read key value; do + case "$key" in (wrapperUrl) jarUrl="$value"; break ;; + esac + done < "$BASE_DIR/.mvn/wrapper/maven-wrapper.properties" + if [ "$MVNW_VERBOSE" = true ]; then + echo "Downloading from: $jarUrl" + fi + wrapperJarPath="$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" + + if command -v wget > /dev/null; then + if [ "$MVNW_VERBOSE" = true ]; then + echo "Found wget ... using wget" + fi + wget "$jarUrl" -O "$wrapperJarPath" + elif command -v curl > /dev/null; then + if [ "$MVNW_VERBOSE" = true ]; then + echo "Found curl ... using curl" + fi + curl -o "$wrapperJarPath" "$jarUrl" + else + if [ "$MVNW_VERBOSE" = true ]; then + echo "Falling back to using Java to download" + fi + javaClass="$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.java" + if [ -e "$javaClass" ]; then + if [ ! -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then + if [ "$MVNW_VERBOSE" = true ]; then + echo " - Compiling MavenWrapperDownloader.java ..." + fi + # Compiling the Java class + ("$JAVA_HOME/bin/javac" "$javaClass") + fi + if [ -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then + # Running the downloader + if [ "$MVNW_VERBOSE" = true ]; then + echo " - Running MavenWrapperDownloader.java ..." + fi + ("$JAVA_HOME/bin/java" -cp .mvn/wrapper MavenWrapperDownloader "$MAVEN_PROJECTBASEDIR") + fi + fi + fi +fi +########################################################################################## +# End of extension +########################################################################################## + +export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"} +if [ "$MVNW_VERBOSE" = true ]; then + echo $MAVEN_PROJECTBASEDIR +fi +MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS" + +# For Cygwin, switch paths to Windows format before running java +if $cygwin; then + [ -n "$M2_HOME" ] && + M2_HOME=`cygpath --path --windows "$M2_HOME"` + [ -n "$JAVA_HOME" ] && + JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"` + [ -n "$CLASSPATH" ] && + CLASSPATH=`cygpath --path --windows "$CLASSPATH"` + [ -n "$MAVEN_PROJECTBASEDIR" ] && + MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"` +fi + +WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain + +exec "$JAVACMD" \ + $MAVEN_OPTS \ + -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \ + "-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \ + ${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@" diff --git a/WebServices/gateway/mvnw.cmd b/WebServices/gateway/mvnw.cmd new file mode 100644 index 0000000000000000000000000000000000000000..e5cfb0ae9eab80c314b7d79c164d4a00772824b8 --- /dev/null +++ b/WebServices/gateway/mvnw.cmd @@ -0,0 +1,161 @@ +@REM ---------------------------------------------------------------------------- +@REM Licensed to the Apache Software Foundation (ASF) under one +@REM or more contributor license agreements. See the NOTICE file +@REM distributed with this work for additional information +@REM regarding copyright ownership. The ASF licenses this file +@REM to you under the Apache License, Version 2.0 (the +@REM "License"); you may not use this file except in compliance +@REM with the License. You may obtain a copy of the License at +@REM +@REM http://www.apache.org/licenses/LICENSE-2.0 +@REM +@REM Unless required by applicable law or agreed to in writing, +@REM software distributed under the License is distributed on an +@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +@REM KIND, either express or implied. See the License for the +@REM specific language governing permissions and limitations +@REM under the License. +@REM ---------------------------------------------------------------------------- + +@REM ---------------------------------------------------------------------------- +@REM Maven2 Start Up Batch script +@REM +@REM Required ENV vars: +@REM JAVA_HOME - location of a JDK home dir +@REM +@REM Optional ENV vars +@REM M2_HOME - location of maven2's installed home dir +@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands +@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a key stroke before ending +@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven +@REM e.g. to debug Maven itself, use +@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 +@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files +@REM ---------------------------------------------------------------------------- + +@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on' +@echo off +@REM set title of command window +title %0 +@REM enable echoing my setting MAVEN_BATCH_ECHO to 'on' +@if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO% + +@REM set %HOME% to equivalent of $HOME +if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%") + +@REM Execute a user defined script before this one +if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre +@REM check for pre script, once with legacy .bat ending and once with .cmd ending +if exist "%HOME%\mavenrc_pre.bat" call "%HOME%\mavenrc_pre.bat" +if exist "%HOME%\mavenrc_pre.cmd" call "%HOME%\mavenrc_pre.cmd" +:skipRcPre + +@setlocal + +set ERROR_CODE=0 + +@REM To isolate internal variables from possible post scripts, we use another setlocal +@setlocal + +@REM ==== START VALIDATION ==== +if not "%JAVA_HOME%" == "" goto OkJHome + +echo. +echo Error: JAVA_HOME not found in your environment. >&2 +echo Please set the JAVA_HOME variable in your environment to match the >&2 +echo location of your Java installation. >&2 +echo. +goto error + +:OkJHome +if exist "%JAVA_HOME%\bin\java.exe" goto init + +echo. +echo Error: JAVA_HOME is set to an invalid directory. >&2 +echo JAVA_HOME = "%JAVA_HOME%" >&2 +echo Please set the JAVA_HOME variable in your environment to match the >&2 +echo location of your Java installation. >&2 +echo. +goto error + +@REM ==== END VALIDATION ==== + +:init + +@REM Find the project base dir, i.e. the directory that contains the folder ".mvn". +@REM Fallback to current working directory if not found. + +set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR% +IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir + +set EXEC_DIR=%CD% +set WDIR=%EXEC_DIR% +:findBaseDir +IF EXIST "%WDIR%"\.mvn goto baseDirFound +cd .. +IF "%WDIR%"=="%CD%" goto baseDirNotFound +set WDIR=%CD% +goto findBaseDir + +:baseDirFound +set MAVEN_PROJECTBASEDIR=%WDIR% +cd "%EXEC_DIR%" +goto endDetectBaseDir + +:baseDirNotFound +set MAVEN_PROJECTBASEDIR=%EXEC_DIR% +cd "%EXEC_DIR%" + +:endDetectBaseDir + +IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig + +@setlocal EnableExtensions EnableDelayedExpansion +for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a +@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS% + +:endReadAdditionalConfig + +SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe" +set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar" +set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain + +set DOWNLOAD_URL="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.4.2/maven-wrapper-0.4.2.jar" +FOR /F "tokens=1,2 delims==" %%A IN (%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties) DO ( + IF "%%A"=="wrapperUrl" SET DOWNLOAD_URL=%%B +) + +@REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central +@REM This allows using the maven wrapper in projects that prohibit checking in binary data. +if exist %WRAPPER_JAR% ( + echo Found %WRAPPER_JAR% +) else ( + echo Couldn't find %WRAPPER_JAR%, downloading it ... + echo Downloading from: %DOWNLOAD_URL% + powershell -Command "(New-Object Net.WebClient).DownloadFile('%DOWNLOAD_URL%', '%WRAPPER_JAR%')" + echo Finished downloading %WRAPPER_JAR% +) +@REM End of extension + +%MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %* +if ERRORLEVEL 1 goto error +goto end + +:error +set ERROR_CODE=1 + +:end +@endlocal & set ERROR_CODE=%ERROR_CODE% + +if not "%MAVEN_SKIP_RC%" == "" goto skipRcPost +@REM check for post script, once with legacy .bat ending and once with .cmd ending +if exist "%HOME%\mavenrc_post.bat" call "%HOME%\mavenrc_post.bat" +if exist "%HOME%\mavenrc_post.cmd" call "%HOME%\mavenrc_post.cmd" +:skipRcPost + +@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on' +if "%MAVEN_BATCH_PAUSE%" == "on" pause + +if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE% + +exit /B %ERROR_CODE% diff --git a/WebServices/gateway/pom.xml b/WebServices/gateway/pom.xml new file mode 100644 index 0000000000000000000000000000000000000000..fcee5284ea03ad1dc8314a0a21125b28db7e3e6f --- /dev/null +++ b/WebServices/gateway/pom.xml @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>br.ufrn.imd</groupId> + <artifactId>dim0614</artifactId> + <version>1.0-SNAPSHOT</version> + <relativePath>../</relativePath> <!-- lookup parent from repository --> + </parent> + + <artifactId>gateway</artifactId> + <version>0.0.1-SNAPSHOT</version> + <name>gateway</name> + <description>DevDojo's Gateway</description> + + <properties> + <java.version>11</java.version> + </properties> + <dependencies> + + <dependency> + <groupId>org.springframework.cloud</groupId> + <artifactId>spring-cloud-starter-netflix-zuul</artifactId> + </dependency> + + </dependencies> + <build> + <finalName>gateway</finalName> + <plugins> + <plugin> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-maven-plugin</artifactId> + <configuration> + <executable>true</executable> + </configuration> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-compiler-plugin</artifactId> + <version>3.8.0</version> + <configuration> + <source>11</source> + <target>11</target> + </configuration> + </plugin> + </plugins> + </build> + +</project> diff --git a/WebServices/gateway/src/main/java/br/ufrn/imd/gateway/GatewayApplication.java b/WebServices/gateway/src/main/java/br/ufrn/imd/gateway/GatewayApplication.java new file mode 100644 index 0000000000000000000000000000000000000000..b97ea31a8d4cc0abce3e0b76a76b5fc4bd3059b6 --- /dev/null +++ b/WebServices/gateway/src/main/java/br/ufrn/imd/gateway/GatewayApplication.java @@ -0,0 +1,17 @@ +package br.ufrn.imd.gateway; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.cloud.netflix.eureka.EnableEurekaClient; +import org.springframework.cloud.netflix.zuul.EnableZuulProxy; + +@SpringBootApplication +@EnableZuulProxy +@EnableEurekaClient +public class GatewayApplication { + + public static void main(String[] args) { + SpringApplication.run(GatewayApplication.class, args); + } + +} diff --git a/WebServices/gateway/src/main/resources/application.yml b/WebServices/gateway/src/main/resources/application.yml new file mode 100644 index 0000000000000000000000000000000000000000..c79f8ea6c29d79dce4e6a7323b996bf8e743292f --- /dev/null +++ b/WebServices/gateway/src/main/resources/application.yml @@ -0,0 +1,19 @@ +spring: + application: + name: gateway +server: + port: 8080 + servlet: + context-path: /gateway + +eureka: + instance: + prefer-ip-address: true + client: + service-url: + defaultZone: http://registry:8081/eureka/ + fetch-registry: true + register-with-eureka: true + +zuul: + sensitive-headers: Cookie diff --git a/WebServices/gateway/src/test/java/academy/devdojo/youtube/gateway/GatewayApplicationTests.java b/WebServices/gateway/src/test/java/academy/devdojo/youtube/gateway/GatewayApplicationTests.java new file mode 100644 index 0000000000000000000000000000000000000000..5b93859879a3387ff3f6b343f4ade6571d5c394f --- /dev/null +++ b/WebServices/gateway/src/test/java/academy/devdojo/youtube/gateway/GatewayApplicationTests.java @@ -0,0 +1,16 @@ +package academy.devdojo.youtube.gateway; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +@RunWith(SpringRunner.class) +@SpringBootTest +public class GatewayApplicationTests { + + @Test + public void contextLoads() { + } + +} diff --git a/WebServices/pom.xml b/WebServices/pom.xml new file mode 100644 index 0000000000000000000000000000000000000000..d96ad08eabf6606ec3c615df4833a98952a79532 --- /dev/null +++ b/WebServices/pom.xml @@ -0,0 +1,98 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-parent</artifactId> + <version>2.1.3.RELEASE</version> + <relativePath/> <!-- lookup parent from repository --> + </parent> + + <groupId>br.ufrn.imd</groupId> + <artifactId>dim0614</artifactId> + <version>1.0-SNAPSHOT</version> + <packaging>pom</packaging> + + <modules> + <module>withdrawal</module> + <module>gateway</module> + <module>discovery</module> + <module>balance</module> + </modules> + <properties> + <spring-cloud.version>Greenwich.RELEASE</spring-cloud.version> + </properties> + <dependencies> + <dependency> + <groupId>org.springframework.cloud</groupId> + <artifactId>spring-cloud-starter-netflix-eureka-client</artifactId> + </dependency> + + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-validation</artifactId> + </dependency> + + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-data-jpa</artifactId> + </dependency> + + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-web</artifactId> + </dependency> + + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-devtools</artifactId> + <scope>runtime</scope> + </dependency> + <dependency> + <groupId>com.h2database</groupId> + <artifactId>h2</artifactId> + <scope>runtime</scope> + </dependency> + <dependency> + <groupId>org.postgresql</groupId> + <artifactId>postgresql</artifactId> + <scope>runtime</scope> + </dependency> + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-configuration-processor</artifactId> + <optional>true</optional> + </dependency> + <dependency> + <groupId>org.projectlombok</groupId> + <artifactId>lombok</artifactId> + <optional>true</optional> + </dependency> + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-test</artifactId> + <scope>test</scope> + </dependency> + </dependencies> + <dependencyManagement> + <dependencies> + <dependency> + <groupId>org.springframework.cloud</groupId> + <artifactId>spring-cloud-dependencies</artifactId> + <version>${spring-cloud.version}</version> + <type>pom</type> + <scope>import</scope> + </dependency> + </dependencies> + </dependencyManagement> + + <repositories> + <repository> + <id>spring-milestones</id> + <name>Spring Milestones</name> + <url>https://repo.spring.io/milestone</url> + </repository> + </repositories> + +</project> diff --git a/WebServices/transfer/.DS_Store b/WebServices/transfer/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..5008ddfcf53c02e82d7eee2e57c38e5672ef89f6 Binary files /dev/null and b/WebServices/transfer/.DS_Store differ diff --git a/WebServices/transfer/.gitignore b/WebServices/transfer/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..ba5cb5cca8766c8b2403d25de25b1c880c5ef64a --- /dev/null +++ b/WebServices/transfer/.gitignore @@ -0,0 +1,26 @@ +HELP.md +/target/ +!.mvn/wrapper/maven-wrapper.jar + +### STS ### +.apt_generated +.classpath +.factorypath +.project +.settings +.springBeans +.sts4-cache + +### IntelliJ IDEA ### +.idea +*.iws +*.iml +*.ipr + +### NetBeans ### +/nbproject/private/ +/nbbuild/ +/dist/ +/nbdist/ +/.nb-gradle/ +/build/ diff --git a/WebServices/transfer/.mvn/wrapper/MavenWrapperDownloader.java b/WebServices/transfer/.mvn/wrapper/MavenWrapperDownloader.java new file mode 100644 index 0000000000000000000000000000000000000000..47336fde724164b1329ed3595f5b6bff09f7c179 --- /dev/null +++ b/WebServices/transfer/.mvn/wrapper/MavenWrapperDownloader.java @@ -0,0 +1,114 @@ +/* +Licensed to the Apache Software Foundation (ASF) under one +or more contributor license agreements. See the NOTICE file +distributed with this work for additional information +regarding copyright ownership. The ASF licenses this file +to you under the Apache License, Version 2.0 (the +"License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, +software distributed under the License is distributed on an +"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, either express or implied. See the License for the +specific language governing permissions and limitations +under the License. +*/ + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.net.URL; +import java.nio.channels.Channels; +import java.nio.channels.ReadableByteChannel; +import java.util.Properties; + +public class MavenWrapperDownloader { + + /** + * Default URL to download the maven-wrapper.jar from, if no 'downloadUrl' is provided. + */ + private static final String DEFAULT_DOWNLOAD_URL = + "https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.4.2/maven-wrapper-0.4.2.jar"; + + /** + * Path to the maven-wrapper.properties file, which might contain a downloadUrl property to + * use instead of the default one. + */ + private static final String MAVEN_WRAPPER_PROPERTIES_PATH = + ".mvn/wrapper/maven-wrapper.properties"; + + /** + * Path where the maven-wrapper.jar will be saved to. + */ + private static final String MAVEN_WRAPPER_JAR_PATH = + ".mvn/wrapper/maven-wrapper.jar"; + + /** + * Name of the property which should be used to override the default download url for the wrapper. + */ + private static final String PROPERTY_NAME_WRAPPER_URL = "wrapperUrl"; + + public static void main(String args[]) { + System.out.println("- Downloader started"); + File baseDirectory = new File(args[0]); + System.out.println("- Using base directory: " + baseDirectory.getAbsolutePath()); + + // If the maven-wrapper.properties exists, read it and check if it contains a custom + // wrapperUrl parameter. + File mavenWrapperPropertyFile = new File(baseDirectory, MAVEN_WRAPPER_PROPERTIES_PATH); + String url = DEFAULT_DOWNLOAD_URL; + if(mavenWrapperPropertyFile.exists()) { + FileInputStream mavenWrapperPropertyFileInputStream = null; + try { + mavenWrapperPropertyFileInputStream = new FileInputStream(mavenWrapperPropertyFile); + Properties mavenWrapperProperties = new Properties(); + mavenWrapperProperties.load(mavenWrapperPropertyFileInputStream); + url = mavenWrapperProperties.getProperty(PROPERTY_NAME_WRAPPER_URL, url); + } catch (IOException e) { + System.out.println("- ERROR loading '" + MAVEN_WRAPPER_PROPERTIES_PATH + "'"); + } finally { + try { + if(mavenWrapperPropertyFileInputStream != null) { + mavenWrapperPropertyFileInputStream.close(); + } + } catch (IOException e) { + // Ignore ... + } + } + } + System.out.println("- Downloading from: : " + url); + + File outputFile = new File(baseDirectory.getAbsolutePath(), MAVEN_WRAPPER_JAR_PATH); + if(!outputFile.getParentFile().exists()) { + if(!outputFile.getParentFile().mkdirs()) { + System.out.println( + "- ERROR creating output direcrory '" + outputFile.getParentFile().getAbsolutePath() + "'"); + } + } + System.out.println("- Downloading to: " + outputFile.getAbsolutePath()); + try { + downloadFileFromURL(url, outputFile); + System.out.println("Done"); + System.exit(0); + } catch (Throwable e) { + System.out.println("- Error downloading"); + e.printStackTrace(); + System.exit(1); + } + } + + private static void downloadFileFromURL(String urlString, File destination) throws Exception { + URL website = new URL(urlString); + ReadableByteChannel rbc; + rbc = Channels.newChannel(website.openStream()); + FileOutputStream fos = new FileOutputStream(destination); + fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE); + fos.close(); + rbc.close(); + } + +} diff --git a/WebServices/transfer/.mvn/wrapper/maven-wrapper.jar b/WebServices/transfer/.mvn/wrapper/maven-wrapper.jar index c1dd12f17644411d6e840bd5a10c6ecda0175f18..01e67997377a393fd672c7dcde9dccbedf0cb1e9 100644 Binary files a/WebServices/transfer/.mvn/wrapper/maven-wrapper.jar and b/WebServices/transfer/.mvn/wrapper/maven-wrapper.jar differ diff --git a/WebServices/transfer/.mvn/wrapper/maven-wrapper.properties b/WebServices/transfer/.mvn/wrapper/maven-wrapper.properties index b7cb93e7050f42ff587aefbc40cc038ad4fa3271..cd0d451ccd6fc835996c9fe4eebf8a571154f515 100644 --- a/WebServices/transfer/.mvn/wrapper/maven-wrapper.properties +++ b/WebServices/transfer/.mvn/wrapper/maven-wrapper.properties @@ -1,2 +1 @@ -distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.8.4/apache-maven-3.8.4-bin.zip -wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar +distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.0/apache-maven-3.6.0-bin.zip diff --git a/WebServices/transfer/Dockerfile b/WebServices/transfer/Dockerfile index 50d3474f3d20de2e97c1d6f7770656faf2f5b462..9885e7466359c0bd6426716ab718c12064632b70 100644 --- a/WebServices/transfer/Dockerfile +++ b/WebServices/transfer/Dockerfile @@ -1,3 +1,3 @@ FROM openjdk:11 -COPY target/transfer-0.0.1-SNAPSHOT.jar transfer.jar -ENTRYPOINT ["java","-jar","transfer.jar"] \ No newline at end of file +COPY target/withdrawal.jar withdrawal.jar +ENTRYPOINT ["java","-jar","withdrawal.jar"] \ No newline at end of file diff --git a/WebServices/transfer/mvnw b/WebServices/transfer/mvnw old mode 100644 new mode 100755 index 8a8fb2282df5b8f7263470a5a2dc0e196f35f35f..5551fde8e7dba1e37a1821e8b26374893e2a9e2e --- a/WebServices/transfer/mvnw +++ b/WebServices/transfer/mvnw @@ -8,7 +8,7 @@ # "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 +# http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, # software distributed under the License is distributed on an @@ -19,7 +19,7 @@ # ---------------------------------------------------------------------------- # ---------------------------------------------------------------------------- -# Maven Start Up Batch script +# Maven2 Start Up Batch script # # Required ENV vars: # ------------------ @@ -36,10 +36,6 @@ 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 @@ -118,6 +114,7 @@ if $mingw ; then M2_HOME="`(cd "$M2_HOME"; pwd)`" [ -n "$JAVA_HOME" ] && JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`" + # TODO classpath? fi if [ -z "$JAVA_HOME" ]; then @@ -149,7 +146,7 @@ if [ -z "$JAVACMD" ] ; then JAVACMD="$JAVA_HOME/bin/java" fi else - JAVACMD="`\\unset -f command; \\command -v java`" + JAVACMD="`which java`" fi fi @@ -215,11 +212,7 @@ 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 + jarUrl="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.4.2/maven-wrapper-0.4.2.jar" while IFS="=" read key value; do case "$key" in (wrapperUrl) jarUrl="$value"; break ;; esac @@ -228,38 +221,22 @@ else 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 + wget "$jarUrl" -O "$wrapperJarPath" 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 - + curl -o "$wrapperJarPath" "$jarUrl" else if [ "$MVNW_VERBOSE" = true ]; then echo "Falling back to using Java to download" fi javaClass="$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.java" - # 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 @@ -300,17 +277,10 @@ if $cygwin; then 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}" \ + "-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \ ${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@" diff --git a/WebServices/transfer/mvnw.cmd b/WebServices/transfer/mvnw.cmd index 1d8ab018eaf11d9b3a4a90e7818ace373dfbb380..e5cfb0ae9eab80c314b7d79c164d4a00772824b8 100644 --- a/WebServices/transfer/mvnw.cmd +++ b/WebServices/transfer/mvnw.cmd @@ -7,7 +7,7 @@ @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 http://www.apache.org/licenses/LICENSE-2.0 @REM @REM Unless required by applicable law or agreed to in writing, @REM software distributed under the License is distributed on an @@ -18,7 +18,7 @@ @REM ---------------------------------------------------------------------------- @REM ---------------------------------------------------------------------------- -@REM Maven Start Up Batch script +@REM Maven2 Start Up Batch script @REM @REM Required ENV vars: @REM JAVA_HOME - location of a JDK home dir @@ -26,7 +26,7 @@ @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_BATCH_PAUSE - set to 'on' to wait for a key stroke before ending @REM MAVEN_OPTS - parameters passed to the Java VM when running Maven @REM e.g. to debug Maven itself, use @REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 @@ -37,7 +37,7 @@ @echo off @REM set title of command window 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% @REM set %HOME% to equivalent of $HOME @@ -46,8 +46,8 @@ 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" %* +if exist "%HOME%\mavenrc_pre.bat" call "%HOME%\mavenrc_pre.bat" +if exist "%HOME%\mavenrc_pre.cmd" call "%HOME%\mavenrc_pre.cmd" :skipRcPre @setlocal @@ -120,51 +120,24 @@ 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 +set DOWNLOAD_URL="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.4.2/maven-wrapper-0.4.2.jar" +FOR /F "tokens=1,2 delims==" %%A IN (%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties) DO ( + IF "%%A"=="wrapperUrl" SET DOWNLOAD_URL=%%B ) @REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central @REM This allows using the maven wrapper in projects that prohibit checking in binary data. if exist %WRAPPER_JAR% ( - if "%MVNW_VERBOSE%" == "true" ( - echo Found %WRAPPER_JAR% - ) + 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% - ) + echo Couldn't find %WRAPPER_JAR%, downloading it ... + echo Downloading from: %DOWNLOAD_URL% + powershell -Command "(New-Object Net.WebClient).DownloadFile('%DOWNLOAD_URL%', '%WRAPPER_JAR%')" + echo Finished downloading %WRAPPER_JAR% ) @REM End of extension -@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% %* +%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 @@ -174,15 +147,15 @@ set ERROR_CODE=1 :end @endlocal & set ERROR_CODE=%ERROR_CODE% -if not "%MAVEN_SKIP_RC%"=="" goto skipRcPost +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" +if exist "%HOME%\mavenrc_post.bat" call "%HOME%\mavenrc_post.bat" +if exist "%HOME%\mavenrc_post.cmd" call "%HOME%\mavenrc_post.cmd" :skipRcPost @REM pause the script if MAVEN_BATCH_PAUSE is set to 'on' -if "%MAVEN_BATCH_PAUSE%"=="on" pause +if "%MAVEN_BATCH_PAUSE%" == "on" pause -if "%MAVEN_TERMINATE_CMD%"=="on" exit %ERROR_CODE% +if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE% -cmd /C exit /B %ERROR_CODE% +exit /B %ERROR_CODE% diff --git a/WebServices/transfer/pom.xml b/WebServices/transfer/pom.xml index c739ab13b967409475494288e4422fa80fcf1b4d..55a797289c948be048f8de552cd718a9673b4d66 100644 --- a/WebServices/transfer/pom.xml +++ b/WebServices/transfer/pom.xml @@ -1,63 +1,43 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> - <modelVersion>4.0.0</modelVersion> - <parent> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-starter-parent</artifactId> - <version>2.7.0</version> - <relativePath/> <!-- lookup parent from repository --> - </parent> - <groupId>br.ufrn.imd</groupId> - <artifactId>transfer</artifactId> - <version>0.0.1-SNAPSHOT</version> - <name>transfer</name> - <description>Projeto para disciplina de Programação DistribuÃda</description> - <properties> - <java.version>11</java.version> - </properties> - <dependencies> - <dependency> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-starter-data-jpa</artifactId> - </dependency> - <dependency> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-starter-web</artifactId> - </dependency> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>br.ufrn.imd</groupId> + <artifactId>dim0614</artifactId> + <version>1.0-SNAPSHOT</version> + <relativePath>../</relativePath> <!-- lookup parent from repository --> + </parent> - <dependency> - <groupId>org.postgresql</groupId> - <artifactId>postgresql</artifactId> - <scope>runtime</scope> - </dependency> - <dependency> - <groupId>org.projectlombok</groupId> - <artifactId>lombok</artifactId> - <optional>true</optional> - </dependency> - <dependency> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-starter-test</artifactId> - <scope>test</scope> - </dependency> - </dependencies> + <artifactId>withdrawal</artifactId> + <version>0.0.1-SNAPSHOT</version> + <name>withdrawal</name> + <description>Spring Boot Micro-services By DevDojo</description> - <build> - <plugins> - <plugin> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-maven-plugin</artifactId> - <configuration> - <excludes> - <exclude> - <groupId>org.projectlombok</groupId> - <artifactId>lombok</artifactId> - </exclude> - </excludes> - </configuration> - </plugin> - </plugins> - </build> + <properties> + <java.version>11</java.version> + </properties> + + <build> + <finalName>withdrawal</finalName> + <plugins> + <plugin> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-maven-plugin</artifactId> + <configuration> + <executable>true</executable> + </configuration> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-compiler-plugin</artifactId> + <version>3.8.0</version> + <configuration> + <source>11</source> + <target>11</target> + </configuration> + </plugin> + </plugins> + </build> </project> diff --git a/WebServices/transfer/src/main/java/br/ufrn/imd/transfer/controller/TransferController.java b/WebServices/transfer/src/main/java/br/ufrn/imd/transfer/controller/TransferController.java deleted file mode 100644 index 2d8606eb940c23ee8daaa3d64a5e7f838784806f..0000000000000000000000000000000000000000 --- a/WebServices/transfer/src/main/java/br/ufrn/imd/transfer/controller/TransferController.java +++ /dev/null @@ -1,24 +0,0 @@ -package br.ufrn.imd.transfer.controller; - -import br.ufrn.imd.transfer.domain.Account; -import br.ufrn.imd.transfer.domain.Client; -import br.ufrn.imd.transfer.service.TransferService; -import lombok.AllArgsConstructor; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.http.HttpStatus; -import org.springframework.web.bind.annotation.*; - -@AllArgsConstructor -@RestController -@RequestMapping("/banking/client/{id}") -public class TransferController { - @Autowired - private final TransferService service; - - @PatchMapping - @ResponseStatus(HttpStatus.OK) - public Client transfer(@PathVariable Integer id, @RequestParam(name = "value") Double value, - @RequestParam(name = "toAccount") String toAccountNumber) { - return service.transfer(value, new Client(id), new Account(null, toAccountNumber, null)); - } -} diff --git a/WebServices/transfer/src/main/java/br/ufrn/imd/transfer/service/TransferService.java b/WebServices/transfer/src/main/java/br/ufrn/imd/transfer/service/TransferService.java deleted file mode 100644 index 77f1ddb914cc3a55614f7ecb7a3dfb88802372e1..0000000000000000000000000000000000000000 --- a/WebServices/transfer/src/main/java/br/ufrn/imd/transfer/service/TransferService.java +++ /dev/null @@ -1,45 +0,0 @@ -package br.ufrn.imd.transfer.service; - -import br.ufrn.imd.transfer.domain.Account; -import br.ufrn.imd.transfer.domain.Client; -import br.ufrn.imd.transfer.repository.ClientRepository; -import lombok.AllArgsConstructor; -import lombok.extern.java.Log; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -@Log -@AllArgsConstructor -@Service -public class TransferService { - @Autowired - private final ClientRepository clientRepository; - - public Client transfer(Double value, Client fromClient, Account toAccount) { - fromClient = clientRepository.findById(fromClient.getId()) - .orElseThrow(() -> new RuntimeException("Invalid user!")); - - Account finalToAccount = toAccount; - Client toClient = clientRepository.findByAccountNumber(toAccount.getNumber()) - .orElseThrow(() -> new RuntimeException( - String.format("Customer not found with account number %s", finalToAccount.getNumber()))); - - if(fromClient.getId().equals(toClient.getId())) - throw new RuntimeException("Invalid account"); - - Account fromAccount = fromClient.getAccount(); - if(value > fromAccount.getBalance()) throw new RuntimeException("Insufficient balance"); - - fromAccount.setBalance(fromAccount.getBalance() - value); - toAccount = toClient.getAccount(); - toAccount.setBalance(toAccount.getBalance() + value); - - clientRepository.save(toClient); - fromClient = clientRepository.save(fromClient); - log.info("Transfer concluded!"); - log.info(String.format("Account balance: R$ %.2f", fromClient.getAccount().getBalance())); - - return fromClient; - } - -} diff --git a/WebServices/transfer/src/main/java/br/ufrn/imd/transfer/TransferApplication.java b/WebServices/transfer/src/main/java/br/ufrn/imd/withdrawal/WithdrawalApplication.java similarity index 60% rename from WebServices/transfer/src/main/java/br/ufrn/imd/transfer/TransferApplication.java rename to WebServices/transfer/src/main/java/br/ufrn/imd/withdrawal/WithdrawalApplication.java index 912127f66c81a0859e79d336706d4127e8c63615..ba5b3a9dc1033cf3f149ecf42290fd216a4b8c80 100644 --- a/WebServices/transfer/src/main/java/br/ufrn/imd/transfer/TransferApplication.java +++ b/WebServices/transfer/src/main/java/br/ufrn/imd/withdrawal/WithdrawalApplication.java @@ -1,13 +1,13 @@ -package br.ufrn.imd.transfer; +package br.ufrn.imd.withdrawal; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication -public class TransferApplication { +public class WithdrawalApplication { public static void main(String[] args) { - SpringApplication.run(TransferApplication.class, args); + SpringApplication.run(WithdrawalApplication.class, args); } } diff --git a/WebServices/transfer/src/main/java/br/ufrn/imd/withdrawal/controller/WithdrawalController.java b/WebServices/transfer/src/main/java/br/ufrn/imd/withdrawal/controller/WithdrawalController.java new file mode 100644 index 0000000000000000000000000000000000000000..f65f9915179df034c527191c4c92b4bfdadaa298 --- /dev/null +++ b/WebServices/transfer/src/main/java/br/ufrn/imd/withdrawal/controller/WithdrawalController.java @@ -0,0 +1,22 @@ +package br.ufrn.imd.withdrawal.controller; + +import br.ufrn.imd.withdrawal.domain.Client; +import br.ufrn.imd.withdrawal.service.WithdrawalService; +import lombok.AllArgsConstructor; +import lombok.RequiredArgsConstructor; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.HttpStatus; +import org.springframework.web.bind.annotation.*; + +@RequiredArgsConstructor +@RestController +@RequestMapping("/banking/client/{id}") +public class WithdrawalController { + + private final WithdrawalService service; + + @GetMapping + public Client withdrawal(@PathVariable Integer id, @RequestParam(name = "value") Double value) { + return service.withdraw(value, new Client(id)); + } +} diff --git a/WebServices/deposit/src/main/java/br/ufrn/imd/deposit/domain/Account.java b/WebServices/transfer/src/main/java/br/ufrn/imd/withdrawal/domain/Account.java similarity index 91% rename from WebServices/deposit/src/main/java/br/ufrn/imd/deposit/domain/Account.java rename to WebServices/transfer/src/main/java/br/ufrn/imd/withdrawal/domain/Account.java index becc0a60497626056feba58a6406bed644d83a25..e96c20756ddcc3639386f25b9525209deb1a97ce 100644 --- a/WebServices/deposit/src/main/java/br/ufrn/imd/deposit/domain/Account.java +++ b/WebServices/transfer/src/main/java/br/ufrn/imd/withdrawal/domain/Account.java @@ -1,4 +1,4 @@ -package br.ufrn.imd.deposit.domain; +package br.ufrn.imd.withdrawal.domain; import lombok.*; diff --git a/WebServices/deposit/src/main/java/br/ufrn/imd/deposit/domain/Client.java b/WebServices/transfer/src/main/java/br/ufrn/imd/withdrawal/domain/Client.java similarity index 92% rename from WebServices/deposit/src/main/java/br/ufrn/imd/deposit/domain/Client.java rename to WebServices/transfer/src/main/java/br/ufrn/imd/withdrawal/domain/Client.java index 52f7c6369dd784427b982b8bd92837c709336ea6..af2368f3a4d749cc8efab46ce91595865ebc180a 100644 --- a/WebServices/deposit/src/main/java/br/ufrn/imd/deposit/domain/Client.java +++ b/WebServices/transfer/src/main/java/br/ufrn/imd/withdrawal/domain/Client.java @@ -1,4 +1,4 @@ -package br.ufrn.imd.deposit.domain; +package br.ufrn.imd.withdrawal.domain; import lombok.*; diff --git a/WebServices/transfer/src/main/java/br/ufrn/imd/withdrawal/repository/ClientRepository.java b/WebServices/transfer/src/main/java/br/ufrn/imd/withdrawal/repository/ClientRepository.java new file mode 100644 index 0000000000000000000000000000000000000000..f2ab6a92c937cacd72c6db0169082da9970beb2e --- /dev/null +++ b/WebServices/transfer/src/main/java/br/ufrn/imd/withdrawal/repository/ClientRepository.java @@ -0,0 +1,16 @@ +package br.ufrn.imd.withdrawal.repository; + +import br.ufrn.imd.withdrawal.domain.Client; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.Query; +import org.springframework.stereotype.Repository; + +import java.util.Optional; + +@Repository +public interface ClientRepository extends JpaRepository<Client, Integer> { + + @Query(value = "SELECT c from Client c where c.account.number = ?1") + Optional<Client> findByAccountNumber(String number); + +} diff --git a/WebServices/transfer/src/main/java/br/ufrn/imd/withdrawal/service/WithdrawalService.java b/WebServices/transfer/src/main/java/br/ufrn/imd/withdrawal/service/WithdrawalService.java new file mode 100644 index 0000000000000000000000000000000000000000..b3e0f26742668c933e0cf1ac985ecc3c37253940 --- /dev/null +++ b/WebServices/transfer/src/main/java/br/ufrn/imd/withdrawal/service/WithdrawalService.java @@ -0,0 +1,31 @@ +package br.ufrn.imd.withdrawal.service; + +import br.ufrn.imd.withdrawal.domain.Account; +import br.ufrn.imd.withdrawal.domain.Client; +import br.ufrn.imd.withdrawal.repository.ClientRepository; +import lombok.AllArgsConstructor; +import lombok.extern.java.Log; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +@Log +@AllArgsConstructor +@Service +public class WithdrawalService { + @Autowired + private final ClientRepository clientRepository; + + public Client withdraw(Double value, Client client) { + client = clientRepository.findById(client.getId()) + .orElseThrow(() -> new RuntimeException("Invalid user!")); + + Account account = client.getAccount(); + if(value > account.getBalance()) throw new RuntimeException("Insufficient balance"); + + account.setBalance(account.getBalance() - value); + client = clientRepository.save(client); + log.info("Withdrawal concluded!"); + log.info(String.format("Account balance: R$ %.2f", client.getAccount().getBalance())); + return client; + } +} diff --git a/WebServices/transfer/src/main/resources/application.yml b/WebServices/transfer/src/main/resources/application.yml index 25998dd976b0087b3cae7b73cf91a8fe9265c637..02b446970433b39bdb382ea88dc059deb3bcd43f 100644 --- a/WebServices/transfer/src/main/resources/application.yml +++ b/WebServices/transfer/src/main/resources/application.yml @@ -1,14 +1,26 @@ server: - port: 8082 - + port: 8083 +eureka: + instance: + prefer-ip-address: true + client: + service-url: + defaultZone: http://registry:8081/eureka/ + fetch-registry: true + register-with-eureka: true + spring: + application: + name: withdrawal datasource: - url: jdbc:postgresql://postgres-service:5432/postgres + url: jdbc:postgresql://postgresServ:5432/postgres username: postgres password: postgres jpa: show-sql: false - properties: + properties: hibernate: dialect: org.hibernate.dialect.PostgreSQLDialect - ddl-auto: update \ No newline at end of file + ddl-auto: update + jmx: + enabled: false \ No newline at end of file diff --git a/WebServices/transfer/src/test/java/br/ufrn/imd/transfer/TransferApplicationTests.java b/WebServices/transfer/src/test/java/br/ufrn/imd/transfer/TransferApplicationTests.java deleted file mode 100644 index 14413f7922b5dbd7acaf44008b29ced4bef5b16b..0000000000000000000000000000000000000000 --- a/WebServices/transfer/src/test/java/br/ufrn/imd/transfer/TransferApplicationTests.java +++ /dev/null @@ -1,13 +0,0 @@ -package br.ufrn.imd.transfer; - -import org.junit.jupiter.api.Test; -import org.springframework.boot.test.context.SpringBootTest; - -@SpringBootTest -class TransferApplicationTests { - - @Test - void contextLoads() { - } - -} diff --git a/WebServices/transfer/src/test/java/br/ufrn/imd/withdrawal/CourseApplicationTests.java b/WebServices/transfer/src/test/java/br/ufrn/imd/withdrawal/CourseApplicationTests.java new file mode 100644 index 0000000000000000000000000000000000000000..b84743fe08d4bfdafd2ba2588a9a532fa80fa854 --- /dev/null +++ b/WebServices/transfer/src/test/java/br/ufrn/imd/withdrawal/CourseApplicationTests.java @@ -0,0 +1,16 @@ +package br.ufrn.imd.withdrawal; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +@RunWith(SpringRunner.class) +@SpringBootTest +public class CourseApplicationTests { + + @Test + public void contextLoads() { + } + +} diff --git a/WebServices/transfer/target/classes/application.yml b/WebServices/transfer/target/classes/application.yml index 25998dd976b0087b3cae7b73cf91a8fe9265c637..02b446970433b39bdb382ea88dc059deb3bcd43f 100644 --- a/WebServices/transfer/target/classes/application.yml +++ b/WebServices/transfer/target/classes/application.yml @@ -1,14 +1,26 @@ server: - port: 8082 - + port: 8083 +eureka: + instance: + prefer-ip-address: true + client: + service-url: + defaultZone: http://registry:8081/eureka/ + fetch-registry: true + register-with-eureka: true + spring: + application: + name: withdrawal datasource: - url: jdbc:postgresql://postgres-service:5432/postgres + url: jdbc:postgresql://postgresServ:5432/postgres username: postgres password: postgres jpa: show-sql: false - properties: + properties: hibernate: dialect: org.hibernate.dialect.PostgreSQLDialect - ddl-auto: update \ No newline at end of file + ddl-auto: update + jmx: + enabled: false \ No newline at end of file diff --git a/WebServices/transfer/target/classes/br/ufrn/imd/transfer/TransferApplication.class b/WebServices/transfer/target/classes/br/ufrn/imd/transfer/TransferApplication.class deleted file mode 100644 index e9707961ce07ca07aa30251904175200db953f68..0000000000000000000000000000000000000000 Binary files a/WebServices/transfer/target/classes/br/ufrn/imd/transfer/TransferApplication.class and /dev/null differ diff --git a/WebServices/transfer/target/classes/br/ufrn/imd/transfer/controller/TransferController.class b/WebServices/transfer/target/classes/br/ufrn/imd/transfer/controller/TransferController.class deleted file mode 100644 index ab8505d850ab6f855a77e4be1e8271a02c4cfe87..0000000000000000000000000000000000000000 Binary files a/WebServices/transfer/target/classes/br/ufrn/imd/transfer/controller/TransferController.class and /dev/null differ diff --git a/WebServices/transfer/target/classes/br/ufrn/imd/transfer/domain/Account.class b/WebServices/transfer/target/classes/br/ufrn/imd/transfer/domain/Account.class deleted file mode 100644 index d703eab094eeb63c56b707d44d3ddcbb980d2e0a..0000000000000000000000000000000000000000 Binary files a/WebServices/transfer/target/classes/br/ufrn/imd/transfer/domain/Account.class and /dev/null differ diff --git a/WebServices/transfer/target/classes/br/ufrn/imd/transfer/domain/Client.class b/WebServices/transfer/target/classes/br/ufrn/imd/transfer/domain/Client.class deleted file mode 100644 index 92aaa6d0d05eb07fc8ba4f97058858e82f309cb2..0000000000000000000000000000000000000000 Binary files a/WebServices/transfer/target/classes/br/ufrn/imd/transfer/domain/Client.class and /dev/null differ diff --git a/WebServices/transfer/target/classes/br/ufrn/imd/transfer/repository/ClientRepository.class b/WebServices/transfer/target/classes/br/ufrn/imd/transfer/repository/ClientRepository.class deleted file mode 100644 index 0af244b482584442a14df71ed5461abcf36358f2..0000000000000000000000000000000000000000 Binary files a/WebServices/transfer/target/classes/br/ufrn/imd/transfer/repository/ClientRepository.class and /dev/null differ diff --git a/WebServices/transfer/target/classes/br/ufrn/imd/transfer/service/TransferService.class b/WebServices/transfer/target/classes/br/ufrn/imd/transfer/service/TransferService.class deleted file mode 100644 index ff14e834852f5c7f7986568f5495ea677ded7b45..0000000000000000000000000000000000000000 Binary files a/WebServices/transfer/target/classes/br/ufrn/imd/transfer/service/TransferService.class and /dev/null differ diff --git a/WebServices/transfer/target/maven-archiver/pom.properties b/WebServices/transfer/target/maven-archiver/pom.properties index f016e489bb836ebd6e1f7627b5614f76e9079ff0..6b1d262b91d00e937d7615c1678176063a59f878 100644 --- a/WebServices/transfer/target/maven-archiver/pom.properties +++ b/WebServices/transfer/target/maven-archiver/pom.properties @@ -1,3 +1,4 @@ -artifactId=transfer +#Created by Apache Maven 3.6.3 groupId=br.ufrn.imd +artifactId=withdrawal version=0.0.1-SNAPSHOT diff --git a/WebServices/transfer/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst b/WebServices/transfer/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst index b4c8e86b5178a39ef7cecd4ad710df4ee60f2d70..3d142b7ac0201d3fc412947f5e5860d4c02ab8a0 100644 --- a/WebServices/transfer/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst +++ b/WebServices/transfer/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst @@ -1,6 +1,6 @@ -br/ufrn/imd/transfer/repository/ClientRepository.class -br/ufrn/imd/transfer/controller/TransferController.class -br/ufrn/imd/transfer/domain/Client.class -br/ufrn/imd/transfer/domain/Account.class -br/ufrn/imd/transfer/TransferApplication.class -br/ufrn/imd/transfer/service/TransferService.class +br/ufrn/imd/withdrawal/domain/Account.class +br/ufrn/imd/withdrawal/domain/Client.class +br/ufrn/imd/withdrawal/controller/WithdrawalController.class +br/ufrn/imd/withdrawal/service/WithdrawalService.class +br/ufrn/imd/withdrawal/repository/ClientRepository.class +br/ufrn/imd/withdrawal/WithdrawalApplication.class diff --git a/WebServices/transfer/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst b/WebServices/transfer/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst index 39ebfaa72d3125e2e4ecc8d076a195eef569d348..f1ec5109408cf15b9e5eefba94a1ce80a5369515 100644 --- a/WebServices/transfer/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst +++ b/WebServices/transfer/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst @@ -1,6 +1,6 @@ -/home/ff/code/dim0614/WebServices/transfer/src/main/java/br/ufrn/imd/transfer/domain/Account.java -/home/ff/code/dim0614/WebServices/transfer/src/main/java/br/ufrn/imd/transfer/TransferApplication.java -/home/ff/code/dim0614/WebServices/transfer/src/main/java/br/ufrn/imd/transfer/service/TransferService.java -/home/ff/code/dim0614/WebServices/transfer/src/main/java/br/ufrn/imd/transfer/domain/Client.java -/home/ff/code/dim0614/WebServices/transfer/src/main/java/br/ufrn/imd/transfer/controller/TransferController.java -/home/ff/code/dim0614/WebServices/transfer/src/main/java/br/ufrn/imd/transfer/repository/ClientRepository.java +/home/ff/code/dim/devdojo-microservices/withdrawal/src/main/java/br/ufrn/imd/withdrawal/service/WithdrawalService.java +/home/ff/code/dim/devdojo-microservices/withdrawal/src/main/java/br/ufrn/imd/withdrawal/domain/Client.java +/home/ff/code/dim/devdojo-microservices/withdrawal/src/main/java/br/ufrn/imd/withdrawal/domain/Account.java +/home/ff/code/dim/devdojo-microservices/withdrawal/src/main/java/br/ufrn/imd/withdrawal/repository/ClientRepository.java +/home/ff/code/dim/devdojo-microservices/withdrawal/src/main/java/br/ufrn/imd/withdrawal/WithdrawalApplication.java +/home/ff/code/dim/devdojo-microservices/withdrawal/src/main/java/br/ufrn/imd/withdrawal/controller/WithdrawalController.java diff --git a/WebServices/transfer/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/createdFiles.lst b/WebServices/transfer/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/createdFiles.lst index 05a55ec118f223be79b37955dfa15ce70a2d02bb..acc938601d964f4ae34f8d7176eb35a1150158b3 100644 --- a/WebServices/transfer/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/createdFiles.lst +++ b/WebServices/transfer/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/createdFiles.lst @@ -1 +1 @@ -br/ufrn/imd/transfer/TransferApplicationTests.class +br/ufrn/imd/withdrawal/CourseApplicationTests.class diff --git a/WebServices/transfer/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst b/WebServices/transfer/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst index 7692a273ae945d40bd6818b155a282d8d2908e57..756fc386269446fe15a83950841e02bec8148512 100644 --- a/WebServices/transfer/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst +++ b/WebServices/transfer/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst @@ -1 +1 @@ -/home/ff/code/dim0614/WebServices/transfer/src/test/java/br/ufrn/imd/transfer/TransferApplicationTests.java +/home/ff/code/dim/devdojo-microservices/withdrawal/src/test/java/br/ufrn/imd/withdrawal/CourseApplicationTests.java diff --git a/WebServices/transfer/target/test-classes/br/ufrn/imd/transfer/TransferApplicationTests.class b/WebServices/transfer/target/test-classes/br/ufrn/imd/transfer/TransferApplicationTests.class deleted file mode 100644 index 8866a8df863f4764f7f1ce1b666502b606f6f80d..0000000000000000000000000000000000000000 Binary files a/WebServices/transfer/target/test-classes/br/ufrn/imd/transfer/TransferApplicationTests.class and /dev/null differ diff --git a/WebServices/transfer/target/transfer-0.0.1-SNAPSHOT.jar b/WebServices/transfer/target/transfer-0.0.1-SNAPSHOT.jar deleted file mode 100644 index 9d45a3b908f2b6c29c3f8bc36f3081d7e564b820..0000000000000000000000000000000000000000 Binary files a/WebServices/transfer/target/transfer-0.0.1-SNAPSHOT.jar and /dev/null differ diff --git a/WebServices/transfer/target/transfer-0.0.1-SNAPSHOT.jar.original b/WebServices/transfer/target/transfer-0.0.1-SNAPSHOT.jar.original deleted file mode 100644 index bee6febe4f01ab8f72a5b827c14dfed38fc24e30..0000000000000000000000000000000000000000 Binary files a/WebServices/transfer/target/transfer-0.0.1-SNAPSHOT.jar.original and /dev/null differ diff --git a/WebServices/withdrawal/.DS_Store b/WebServices/withdrawal/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..5008ddfcf53c02e82d7eee2e57c38e5672ef89f6 Binary files /dev/null and b/WebServices/withdrawal/.DS_Store differ diff --git a/WebServices/withdrawal/.gitignore b/WebServices/withdrawal/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..ba5cb5cca8766c8b2403d25de25b1c880c5ef64a --- /dev/null +++ b/WebServices/withdrawal/.gitignore @@ -0,0 +1,26 @@ +HELP.md +/target/ +!.mvn/wrapper/maven-wrapper.jar + +### STS ### +.apt_generated +.classpath +.factorypath +.project +.settings +.springBeans +.sts4-cache + +### IntelliJ IDEA ### +.idea +*.iws +*.iml +*.ipr + +### NetBeans ### +/nbproject/private/ +/nbbuild/ +/dist/ +/nbdist/ +/.nb-gradle/ +/build/ diff --git a/WebServices/withdrawal/.mvn/wrapper/MavenWrapperDownloader.java b/WebServices/withdrawal/.mvn/wrapper/MavenWrapperDownloader.java new file mode 100644 index 0000000000000000000000000000000000000000..47336fde724164b1329ed3595f5b6bff09f7c179 --- /dev/null +++ b/WebServices/withdrawal/.mvn/wrapper/MavenWrapperDownloader.java @@ -0,0 +1,114 @@ +/* +Licensed to the Apache Software Foundation (ASF) under one +or more contributor license agreements. See the NOTICE file +distributed with this work for additional information +regarding copyright ownership. The ASF licenses this file +to you under the Apache License, Version 2.0 (the +"License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, +software distributed under the License is distributed on an +"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, either express or implied. See the License for the +specific language governing permissions and limitations +under the License. +*/ + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.net.URL; +import java.nio.channels.Channels; +import java.nio.channels.ReadableByteChannel; +import java.util.Properties; + +public class MavenWrapperDownloader { + + /** + * Default URL to download the maven-wrapper.jar from, if no 'downloadUrl' is provided. + */ + private static final String DEFAULT_DOWNLOAD_URL = + "https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.4.2/maven-wrapper-0.4.2.jar"; + + /** + * Path to the maven-wrapper.properties file, which might contain a downloadUrl property to + * use instead of the default one. + */ + private static final String MAVEN_WRAPPER_PROPERTIES_PATH = + ".mvn/wrapper/maven-wrapper.properties"; + + /** + * Path where the maven-wrapper.jar will be saved to. + */ + private static final String MAVEN_WRAPPER_JAR_PATH = + ".mvn/wrapper/maven-wrapper.jar"; + + /** + * Name of the property which should be used to override the default download url for the wrapper. + */ + private static final String PROPERTY_NAME_WRAPPER_URL = "wrapperUrl"; + + public static void main(String args[]) { + System.out.println("- Downloader started"); + File baseDirectory = new File(args[0]); + System.out.println("- Using base directory: " + baseDirectory.getAbsolutePath()); + + // If the maven-wrapper.properties exists, read it and check if it contains a custom + // wrapperUrl parameter. + File mavenWrapperPropertyFile = new File(baseDirectory, MAVEN_WRAPPER_PROPERTIES_PATH); + String url = DEFAULT_DOWNLOAD_URL; + if(mavenWrapperPropertyFile.exists()) { + FileInputStream mavenWrapperPropertyFileInputStream = null; + try { + mavenWrapperPropertyFileInputStream = new FileInputStream(mavenWrapperPropertyFile); + Properties mavenWrapperProperties = new Properties(); + mavenWrapperProperties.load(mavenWrapperPropertyFileInputStream); + url = mavenWrapperProperties.getProperty(PROPERTY_NAME_WRAPPER_URL, url); + } catch (IOException e) { + System.out.println("- ERROR loading '" + MAVEN_WRAPPER_PROPERTIES_PATH + "'"); + } finally { + try { + if(mavenWrapperPropertyFileInputStream != null) { + mavenWrapperPropertyFileInputStream.close(); + } + } catch (IOException e) { + // Ignore ... + } + } + } + System.out.println("- Downloading from: : " + url); + + File outputFile = new File(baseDirectory.getAbsolutePath(), MAVEN_WRAPPER_JAR_PATH); + if(!outputFile.getParentFile().exists()) { + if(!outputFile.getParentFile().mkdirs()) { + System.out.println( + "- ERROR creating output direcrory '" + outputFile.getParentFile().getAbsolutePath() + "'"); + } + } + System.out.println("- Downloading to: " + outputFile.getAbsolutePath()); + try { + downloadFileFromURL(url, outputFile); + System.out.println("Done"); + System.exit(0); + } catch (Throwable e) { + System.out.println("- Error downloading"); + e.printStackTrace(); + System.exit(1); + } + } + + private static void downloadFileFromURL(String urlString, File destination) throws Exception { + URL website = new URL(urlString); + ReadableByteChannel rbc; + rbc = Channels.newChannel(website.openStream()); + FileOutputStream fos = new FileOutputStream(destination); + fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE); + fos.close(); + rbc.close(); + } + +} diff --git a/WebServices/withdrawal/.mvn/wrapper/maven-wrapper.jar b/WebServices/withdrawal/.mvn/wrapper/maven-wrapper.jar index c1dd12f17644411d6e840bd5a10c6ecda0175f18..01e67997377a393fd672c7dcde9dccbedf0cb1e9 100644 Binary files a/WebServices/withdrawal/.mvn/wrapper/maven-wrapper.jar and b/WebServices/withdrawal/.mvn/wrapper/maven-wrapper.jar differ diff --git a/WebServices/withdrawal/.mvn/wrapper/maven-wrapper.properties b/WebServices/withdrawal/.mvn/wrapper/maven-wrapper.properties index b7cb93e7050f42ff587aefbc40cc038ad4fa3271..cd0d451ccd6fc835996c9fe4eebf8a571154f515 100644 --- a/WebServices/withdrawal/.mvn/wrapper/maven-wrapper.properties +++ b/WebServices/withdrawal/.mvn/wrapper/maven-wrapper.properties @@ -1,2 +1 @@ -distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.8.4/apache-maven-3.8.4-bin.zip -wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar +distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.0/apache-maven-3.6.0-bin.zip diff --git a/WebServices/withdrawal/Dockerfile b/WebServices/withdrawal/Dockerfile index 3ba4618312456f17f715ede7e1559483f39323f1..9885e7466359c0bd6426716ab718c12064632b70 100644 --- a/WebServices/withdrawal/Dockerfile +++ b/WebServices/withdrawal/Dockerfile @@ -1,3 +1,3 @@ FROM openjdk:11 -COPY target/withdrawal-0.0.1-SNAPSHOT.jar withdrawal.jar +COPY target/withdrawal.jar withdrawal.jar ENTRYPOINT ["java","-jar","withdrawal.jar"] \ No newline at end of file diff --git a/WebServices/withdrawal/mvnw b/WebServices/withdrawal/mvnw old mode 100644 new mode 100755 index 8a8fb2282df5b8f7263470a5a2dc0e196f35f35f..5551fde8e7dba1e37a1821e8b26374893e2a9e2e --- a/WebServices/withdrawal/mvnw +++ b/WebServices/withdrawal/mvnw @@ -8,7 +8,7 @@ # "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 +# http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, # software distributed under the License is distributed on an @@ -19,7 +19,7 @@ # ---------------------------------------------------------------------------- # ---------------------------------------------------------------------------- -# Maven Start Up Batch script +# Maven2 Start Up Batch script # # Required ENV vars: # ------------------ @@ -36,10 +36,6 @@ 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 @@ -118,6 +114,7 @@ if $mingw ; then M2_HOME="`(cd "$M2_HOME"; pwd)`" [ -n "$JAVA_HOME" ] && JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`" + # TODO classpath? fi if [ -z "$JAVA_HOME" ]; then @@ -149,7 +146,7 @@ if [ -z "$JAVACMD" ] ; then JAVACMD="$JAVA_HOME/bin/java" fi else - JAVACMD="`\\unset -f command; \\command -v java`" + JAVACMD="`which java`" fi fi @@ -215,11 +212,7 @@ 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 + jarUrl="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.4.2/maven-wrapper-0.4.2.jar" while IFS="=" read key value; do case "$key" in (wrapperUrl) jarUrl="$value"; break ;; esac @@ -228,38 +221,22 @@ else 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 + wget "$jarUrl" -O "$wrapperJarPath" 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 - + curl -o "$wrapperJarPath" "$jarUrl" else if [ "$MVNW_VERBOSE" = true ]; then echo "Falling back to using Java to download" fi javaClass="$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.java" - # 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 @@ -300,17 +277,10 @@ if $cygwin; then 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}" \ + "-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \ ${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@" diff --git a/WebServices/withdrawal/mvnw.cmd b/WebServices/withdrawal/mvnw.cmd index 1d8ab018eaf11d9b3a4a90e7818ace373dfbb380..e5cfb0ae9eab80c314b7d79c164d4a00772824b8 100644 --- a/WebServices/withdrawal/mvnw.cmd +++ b/WebServices/withdrawal/mvnw.cmd @@ -7,7 +7,7 @@ @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 http://www.apache.org/licenses/LICENSE-2.0 @REM @REM Unless required by applicable law or agreed to in writing, @REM software distributed under the License is distributed on an @@ -18,7 +18,7 @@ @REM ---------------------------------------------------------------------------- @REM ---------------------------------------------------------------------------- -@REM Maven Start Up Batch script +@REM Maven2 Start Up Batch script @REM @REM Required ENV vars: @REM JAVA_HOME - location of a JDK home dir @@ -26,7 +26,7 @@ @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_BATCH_PAUSE - set to 'on' to wait for a key stroke before ending @REM MAVEN_OPTS - parameters passed to the Java VM when running Maven @REM e.g. to debug Maven itself, use @REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 @@ -37,7 +37,7 @@ @echo off @REM set title of command window 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% @REM set %HOME% to equivalent of $HOME @@ -46,8 +46,8 @@ 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" %* +if exist "%HOME%\mavenrc_pre.bat" call "%HOME%\mavenrc_pre.bat" +if exist "%HOME%\mavenrc_pre.cmd" call "%HOME%\mavenrc_pre.cmd" :skipRcPre @setlocal @@ -120,51 +120,24 @@ 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 +set DOWNLOAD_URL="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.4.2/maven-wrapper-0.4.2.jar" +FOR /F "tokens=1,2 delims==" %%A IN (%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties) DO ( + IF "%%A"=="wrapperUrl" SET DOWNLOAD_URL=%%B ) @REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central @REM This allows using the maven wrapper in projects that prohibit checking in binary data. if exist %WRAPPER_JAR% ( - if "%MVNW_VERBOSE%" == "true" ( - echo Found %WRAPPER_JAR% - ) + 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% - ) + echo Couldn't find %WRAPPER_JAR%, downloading it ... + echo Downloading from: %DOWNLOAD_URL% + powershell -Command "(New-Object Net.WebClient).DownloadFile('%DOWNLOAD_URL%', '%WRAPPER_JAR%')" + echo Finished downloading %WRAPPER_JAR% ) @REM End of extension -@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% %* +%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 @@ -174,15 +147,15 @@ set ERROR_CODE=1 :end @endlocal & set ERROR_CODE=%ERROR_CODE% -if not "%MAVEN_SKIP_RC%"=="" goto skipRcPost +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" +if exist "%HOME%\mavenrc_post.bat" call "%HOME%\mavenrc_post.bat" +if exist "%HOME%\mavenrc_post.cmd" call "%HOME%\mavenrc_post.cmd" :skipRcPost @REM pause the script if MAVEN_BATCH_PAUSE is set to 'on' -if "%MAVEN_BATCH_PAUSE%"=="on" pause +if "%MAVEN_BATCH_PAUSE%" == "on" pause -if "%MAVEN_TERMINATE_CMD%"=="on" exit %ERROR_CODE% +if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE% -cmd /C exit /B %ERROR_CODE% +exit /B %ERROR_CODE% diff --git a/WebServices/withdrawal/pom.xml b/WebServices/withdrawal/pom.xml index 0be6443ad6c52451f293d7e16f557fd545a1040c..55a797289c948be048f8de552cd718a9673b4d66 100644 --- a/WebServices/withdrawal/pom.xml +++ b/WebServices/withdrawal/pom.xml @@ -1,63 +1,43 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> - <modelVersion>4.0.0</modelVersion> - <parent> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-starter-parent</artifactId> - <version>2.7.0</version> - <relativePath/> <!-- lookup parent from repository --> - </parent> - <groupId>br.ufrn.imd</groupId> - <artifactId>withdrawal</artifactId> - <version>0.0.1-SNAPSHOT</version> - <name>withdrawal</name> - <description>Projeto para disciplina de Programação DistribuÃda</description> - <properties> - <java.version>11</java.version> - </properties> - <dependencies> - <dependency> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-starter-data-jpa</artifactId> - </dependency> - <dependency> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-starter-web</artifactId> - </dependency> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>br.ufrn.imd</groupId> + <artifactId>dim0614</artifactId> + <version>1.0-SNAPSHOT</version> + <relativePath>../</relativePath> <!-- lookup parent from repository --> + </parent> - <dependency> - <groupId>org.postgresql</groupId> - <artifactId>postgresql</artifactId> - <scope>runtime</scope> - </dependency> - <dependency> - <groupId>org.projectlombok</groupId> - <artifactId>lombok</artifactId> - <optional>true</optional> - </dependency> - <dependency> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-starter-test</artifactId> - <scope>test</scope> - </dependency> - </dependencies> + <artifactId>withdrawal</artifactId> + <version>0.0.1-SNAPSHOT</version> + <name>withdrawal</name> + <description>Spring Boot Micro-services By DevDojo</description> - <build> - <plugins> - <plugin> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-maven-plugin</artifactId> - <configuration> - <excludes> - <exclude> - <groupId>org.projectlombok</groupId> - <artifactId>lombok</artifactId> - </exclude> - </excludes> - </configuration> - </plugin> - </plugins> - </build> + <properties> + <java.version>11</java.version> + </properties> + + <build> + <finalName>withdrawal</finalName> + <plugins> + <plugin> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-maven-plugin</artifactId> + <configuration> + <executable>true</executable> + </configuration> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-compiler-plugin</artifactId> + <version>3.8.0</version> + <configuration> + <source>11</source> + <target>11</target> + </configuration> + </plugin> + </plugins> + </build> </project> diff --git a/WebServices/withdrawal/src/main/java/br/ufrn/imd/withdrawal/controller/WithdrawalController.java b/WebServices/withdrawal/src/main/java/br/ufrn/imd/withdrawal/controller/WithdrawalController.java index 31e5aa62650821db8c3122b73f2e30a592f21465..f65f9915179df034c527191c4c92b4bfdadaa298 100644 --- a/WebServices/withdrawal/src/main/java/br/ufrn/imd/withdrawal/controller/WithdrawalController.java +++ b/WebServices/withdrawal/src/main/java/br/ufrn/imd/withdrawal/controller/WithdrawalController.java @@ -3,19 +3,19 @@ package br.ufrn.imd.withdrawal.controller; import br.ufrn.imd.withdrawal.domain.Client; import br.ufrn.imd.withdrawal.service.WithdrawalService; import lombok.AllArgsConstructor; +import lombok.RequiredArgsConstructor; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; import org.springframework.web.bind.annotation.*; -@AllArgsConstructor +@RequiredArgsConstructor @RestController @RequestMapping("/banking/client/{id}") public class WithdrawalController { - @Autowired + private final WithdrawalService service; - @PatchMapping - @ResponseStatus(HttpStatus.OK) + @GetMapping public Client withdrawal(@PathVariable Integer id, @RequestParam(name = "value") Double value) { return service.withdraw(value, new Client(id)); } diff --git a/WebServices/withdrawal/src/main/resources/application.yml b/WebServices/withdrawal/src/main/resources/application.yml index 47b18d21f259da2a9196655586a9941248207216..02b446970433b39bdb382ea88dc059deb3bcd43f 100644 --- a/WebServices/withdrawal/src/main/resources/application.yml +++ b/WebServices/withdrawal/src/main/resources/application.yml @@ -1,14 +1,26 @@ server: port: 8083 - +eureka: + instance: + prefer-ip-address: true + client: + service-url: + defaultZone: http://registry:8081/eureka/ + fetch-registry: true + register-with-eureka: true + spring: + application: + name: withdrawal datasource: - url: jdbc:postgresql://postgres-service:5432/postgres + url: jdbc:postgresql://postgresServ:5432/postgres username: postgres password: postgres jpa: show-sql: false - properties: + properties: hibernate: dialect: org.hibernate.dialect.PostgreSQLDialect - ddl-auto: create \ No newline at end of file + ddl-auto: update + jmx: + enabled: false \ No newline at end of file diff --git a/WebServices/withdrawal/src/test/java/br/ufrn/imd/withdrawal/CourseApplicationTests.java b/WebServices/withdrawal/src/test/java/br/ufrn/imd/withdrawal/CourseApplicationTests.java new file mode 100644 index 0000000000000000000000000000000000000000..b84743fe08d4bfdafd2ba2588a9a532fa80fa854 --- /dev/null +++ b/WebServices/withdrawal/src/test/java/br/ufrn/imd/withdrawal/CourseApplicationTests.java @@ -0,0 +1,16 @@ +package br.ufrn.imd.withdrawal; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +@RunWith(SpringRunner.class) +@SpringBootTest +public class CourseApplicationTests { + + @Test + public void contextLoads() { + } + +} diff --git a/WebServices/withdrawal/src/test/java/br/ufrn/imd/withdrawal/WithdrawalApplicationTests.java b/WebServices/withdrawal/src/test/java/br/ufrn/imd/withdrawal/WithdrawalApplicationTests.java deleted file mode 100644 index 45e45d40268f3acc004cbb511f81ee6d1ef3d4af..0000000000000000000000000000000000000000 --- a/WebServices/withdrawal/src/test/java/br/ufrn/imd/withdrawal/WithdrawalApplicationTests.java +++ /dev/null @@ -1,13 +0,0 @@ -package br.ufrn.imd.withdrawal; - -import org.junit.jupiter.api.Test; -import org.springframework.boot.test.context.SpringBootTest; - -@SpringBootTest -class WithdrawalApplicationTests { - - @Test - void contextLoads() { - } - -} diff --git a/WebServices/withdrawal/target/classes/application.yml b/WebServices/withdrawal/target/classes/application.yml index 47b18d21f259da2a9196655586a9941248207216..02b446970433b39bdb382ea88dc059deb3bcd43f 100644 --- a/WebServices/withdrawal/target/classes/application.yml +++ b/WebServices/withdrawal/target/classes/application.yml @@ -1,14 +1,26 @@ server: port: 8083 - +eureka: + instance: + prefer-ip-address: true + client: + service-url: + defaultZone: http://registry:8081/eureka/ + fetch-registry: true + register-with-eureka: true + spring: + application: + name: withdrawal datasource: - url: jdbc:postgresql://postgres-service:5432/postgres + url: jdbc:postgresql://postgresServ:5432/postgres username: postgres password: postgres jpa: show-sql: false - properties: + properties: hibernate: dialect: org.hibernate.dialect.PostgreSQLDialect - ddl-auto: create \ No newline at end of file + ddl-auto: update + jmx: + enabled: false \ No newline at end of file diff --git a/WebServices/withdrawal/target/classes/br/ufrn/imd/withdrawal/controller/WithdrawalController.class b/WebServices/withdrawal/target/classes/br/ufrn/imd/withdrawal/controller/WithdrawalController.class index 8eca2ad4b678f75cfb94651d7e575e9462e2a5c2..ea0b867d1bfb8e2a439a9605f0ad0b8962c6b618 100644 Binary files a/WebServices/withdrawal/target/classes/br/ufrn/imd/withdrawal/controller/WithdrawalController.class and b/WebServices/withdrawal/target/classes/br/ufrn/imd/withdrawal/controller/WithdrawalController.class differ diff --git a/WebServices/withdrawal/target/maven-archiver/pom.properties b/WebServices/withdrawal/target/maven-archiver/pom.properties index 820ed79320fac02a5ef5440803228db41c257c4c..6b1d262b91d00e937d7615c1678176063a59f878 100644 --- a/WebServices/withdrawal/target/maven-archiver/pom.properties +++ b/WebServices/withdrawal/target/maven-archiver/pom.properties @@ -1,3 +1,4 @@ -artifactId=withdrawal +#Created by Apache Maven 3.6.3 groupId=br.ufrn.imd +artifactId=withdrawal version=0.0.1-SNAPSHOT diff --git a/WebServices/withdrawal/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst b/WebServices/withdrawal/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst index 990955a8b5d35769d6de5d82db52144aa064d0a4..f1ec5109408cf15b9e5eefba94a1ce80a5369515 100644 --- a/WebServices/withdrawal/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst +++ b/WebServices/withdrawal/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst @@ -1,6 +1,6 @@ -/home/ff/code/dim0614/WebServices/withdrawal/src/main/java/br/ufrn/imd/withdrawal/service/WithdrawalService.java -/home/ff/code/dim0614/WebServices/withdrawal/src/main/java/br/ufrn/imd/withdrawal/repository/ClientRepository.java -/home/ff/code/dim0614/WebServices/withdrawal/src/main/java/br/ufrn/imd/withdrawal/domain/Client.java -/home/ff/code/dim0614/WebServices/withdrawal/src/main/java/br/ufrn/imd/withdrawal/domain/Account.java -/home/ff/code/dim0614/WebServices/withdrawal/src/main/java/br/ufrn/imd/withdrawal/WithdrawalApplication.java -/home/ff/code/dim0614/WebServices/withdrawal/src/main/java/br/ufrn/imd/withdrawal/controller/WithdrawalController.java +/home/ff/code/dim/devdojo-microservices/withdrawal/src/main/java/br/ufrn/imd/withdrawal/service/WithdrawalService.java +/home/ff/code/dim/devdojo-microservices/withdrawal/src/main/java/br/ufrn/imd/withdrawal/domain/Client.java +/home/ff/code/dim/devdojo-microservices/withdrawal/src/main/java/br/ufrn/imd/withdrawal/domain/Account.java +/home/ff/code/dim/devdojo-microservices/withdrawal/src/main/java/br/ufrn/imd/withdrawal/repository/ClientRepository.java +/home/ff/code/dim/devdojo-microservices/withdrawal/src/main/java/br/ufrn/imd/withdrawal/WithdrawalApplication.java +/home/ff/code/dim/devdojo-microservices/withdrawal/src/main/java/br/ufrn/imd/withdrawal/controller/WithdrawalController.java diff --git a/WebServices/withdrawal/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/createdFiles.lst b/WebServices/withdrawal/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/createdFiles.lst index 22757da8779bde355e04ed6adff2c2e066850ab8..acc938601d964f4ae34f8d7176eb35a1150158b3 100644 --- a/WebServices/withdrawal/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/createdFiles.lst +++ b/WebServices/withdrawal/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/createdFiles.lst @@ -1 +1 @@ -br/ufrn/imd/withdrawal/WithdrawalApplicationTests.class +br/ufrn/imd/withdrawal/CourseApplicationTests.class diff --git a/WebServices/withdrawal/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst b/WebServices/withdrawal/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst index a3595037e73308c6a0d35fdad2f0e2138a570a36..756fc386269446fe15a83950841e02bec8148512 100644 --- a/WebServices/withdrawal/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst +++ b/WebServices/withdrawal/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst @@ -1 +1 @@ -/home/ff/code/dim0614/WebServices/withdrawal/src/test/java/br/ufrn/imd/withdrawal/WithdrawalApplicationTests.java +/home/ff/code/dim/devdojo-microservices/withdrawal/src/test/java/br/ufrn/imd/withdrawal/CourseApplicationTests.java diff --git a/WebServices/withdrawal/target/test-classes/br/ufrn/imd/withdrawal/WithdrawalApplicationTests.class b/WebServices/withdrawal/target/test-classes/br/ufrn/imd/withdrawal/WithdrawalApplicationTests.class deleted file mode 100644 index c4a3e1f2d2cbb2b90167f9771f2c8d4a5496c154..0000000000000000000000000000000000000000 Binary files a/WebServices/withdrawal/target/test-classes/br/ufrn/imd/withdrawal/WithdrawalApplicationTests.class and /dev/null differ diff --git a/WebServices/withdrawal/target/withdrawal-0.0.1-SNAPSHOT.jar b/WebServices/withdrawal/target/withdrawal-0.0.1-SNAPSHOT.jar deleted file mode 100644 index c340cf9b03c1f5cbffc037eeb048aec09d4a9d13..0000000000000000000000000000000000000000 Binary files a/WebServices/withdrawal/target/withdrawal-0.0.1-SNAPSHOT.jar and /dev/null differ diff --git a/WebServices/withdrawal/target/withdrawal-0.0.1-SNAPSHOT.jar.original b/WebServices/withdrawal/target/withdrawal-0.0.1-SNAPSHOT.jar.original deleted file mode 100644 index d3fa8e5f38bd3f369789e4480f58e6b6c387e1fc..0000000000000000000000000000000000000000 Binary files a/WebServices/withdrawal/target/withdrawal-0.0.1-SNAPSHOT.jar.original and /dev/null differ diff --git a/rest b/rest deleted file mode 160000 index 2b0b4ead285a0396dc3def6ead30d9b73c1c9dce..0000000000000000000000000000000000000000 --- a/rest +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 2b0b4ead285a0396dc3def6ead30d9b73c1c9dce