commit 826969814c95b690a5e71cdf0c6724ce79b50727 Author: Vyacheslav Boyko Date: Mon Apr 11 12:55:02 2022 +0300 spring boot template with liquibase diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..6433f70 --- /dev/null +++ b/.gitignore @@ -0,0 +1,329 @@ + +# Created by https://www.gitignore.io/api/git,node,java,linux,macos,gradle,windows,intellij+all +# Edit at https://www.gitignore.io/?templates=git,node,java,linux,macos,gradle,windows,intellij+all + +### Git ### +# Created by git for backups. To disable backups in Git: +# $ git config --global mergetool.keepBackup false +*.orig + +# Created by git when using merge tools for conflicts +*.BACKUP.* +*.BASE.* +*.LOCAL.* +*.REMOTE.* +*_BACKUP_*.txt +*_BASE_*.txt +*_LOCAL_*.txt +*_REMOTE_*.txt + +### Intellij+all ### +# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and WebStorm +# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 + +# User-specific stuff +.idea/**/workspace.xml +.idea/**/tasks.xml +.idea/**/usage.statistics.xml +.idea/**/dictionaries +.idea/**/shelf + +# Generated files +.idea/**/contentModel.xml + +# Sensitive or high-churn files +.idea/**/dataSources/ +.idea/**/dataSources.ids +.idea/**/dataSources.local.xml +.idea/**/sqlDataSources.xml +.idea/**/dynamic.xml +.idea/**/uiDesigner.xml +.idea/**/dbnavigator.xml + +# Gradle +.idea/**/gradle.xml +.idea/**/libraries + +# Gradle and Maven with auto-import +# When using Gradle or Maven with auto-import, you should exclude module files, +# since they will be recreated, and may cause churn. Uncomment if using +# auto-import. +# .idea/modules.xml +# .idea/*.iml +# .idea/modules +# *.iml +# *.ipr + +# CMake +cmake-build-*/ + +# Mongo Explorer plugin +.idea/**/mongoSettings.xml + +# File-based project format +*.iws + +# IntelliJ +out/ + +# mpeltonen/sbt-idea plugin +.idea_modules/ + +# JIRA plugin +atlassian-ide-plugin.xml + +# Cursive Clojure plugin +.idea/replstate.xml + +# Crashlytics plugin (for Android Studio and IntelliJ) +com_crashlytics_export_strings.xml +crashlytics.properties +crashlytics-build.properties +fabric.properties + +# Editor-based Rest Client +.idea/httpRequests + +# Android studio 3.1+ serialized cache file +.idea/caches/build_file_checksums.ser + +### Intellij+all Patch ### +# Ignores the whole .idea folder and all .iml files +# See https://github.com/joeblau/gitignore.io/issues/186 and https://github.com/joeblau/gitignore.io/issues/360 + +.idea/ + +# Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-249601023 + +*.iml +modules.xml +.idea/misc.xml +*.ipr + +# Sonarlint plugin +.idea/sonarlint + +### Java ### +# Compiled class file +*.class + +# Log file +*.log + +# BlueJ files +*.ctxt + +# Mobile Tools for Java (J2ME) +.mtj.tmp/ + +# Package Files # +*.jar +*.war +*.nar +*.ear +*.zip +*.tar.gz +*.rar + +# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml +hs_err_pid* + +### Linux ### +*~ + +# temporary files which can be created if a process still has a handle open of a deleted file +.fuse_hidden* + +# KDE directory preferences +.directory + +# Linux trash folder which might appear on any partition or disk +.Trash-* + +# .nfs files are created when an open file is removed but is still being accessed +.nfs* + +### macOS ### +# General +.DS_Store +.AppleDouble +.LSOverride + +# Icon must end with two \r +Icon + +# Thumbnails +._* + +# Files that might appear in the root of a volume +.DocumentRevisions-V100 +.fseventsd +.Spotlight-V100 +.TemporaryItems +.Trashes +.VolumeIcon.icns +.com.apple.timemachine.donotpresent + +# Directories potentially created on remote AFP share +.AppleDB +.AppleDesktop +Network Trash Folder +Temporary Items +.apdisk + +### Node ### +# Logs +logs +npm-debug.log* +yarn-debug.log* +yarn-error.log* +lerna-debug.log* + +# Diagnostic reports (https://nodejs.org/api/report.html) +report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json + +# Runtime data +pids +*.pid +*.seed +*.pid.lock + +# Directory for instrumented libs generated by jscoverage/JSCover +lib-cov + +# Coverage directory used by tools like istanbul +coverage +*.lcov + +# nyc test coverage +.nyc_output + +# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) +.grunt + +# Bower dependency directory (https://bower.io/) +bower_components + +# node-waf configuration +.lock-wscript + +# Compiled binary addons (https://nodejs.org/api/addons.html) +build/Release + +# Dependency directories +node_modules/ +jspm_packages/ + +# TypeScript v1 declaration files +typings/ + +# TypeScript cache +*.tsbuildinfo + +# Optional npm cache directory +.npm + +# Optional eslint cache +.eslintcache + +# Optional REPL history +.node_repl_history + +# Output of 'npm pack' +*.tgz + +# Yarn Integrity file +.yarn-integrity + +# dotenv environment variables file +.env +.env.test + +# parcel-bundler cache (https://parceljs.org/) +.cache + +# next.js build output +.next + +# nuxt.js build output +.nuxt + +# rollup.js default build output +dist/ + +# Uncomment the public line if your project uses Gatsby +# https://nextjs.org/blog/next-9-1#public-directory-support +# https://create-react-app.dev/docs/using-the-public-folder/#docsNav +# public + +# Storybook build outputs +.out +.storybook-out + +# vuepress build output +.vuepress/dist + +# Serverless directories +.serverless/ + +# FuseBox cache +.fusebox/ + +# DynamoDB Local files +.dynamodb/ + +# Temporary folders +tmp/ +temp/ + +### Windows ### +# Windows thumbnail cache files +Thumbs.db +Thumbs.db:encryptable +ehthumbs.db +ehthumbs_vista.db + +# Dump file +*.stackdump + +# Folder config file +[Dd]esktop.ini + +# Recycle Bin used on file shares +$RECYCLE.BIN/ + +# Windows Installer files +*.cab +*.msi +*.msix +*.msm +*.msp + +# Windows shortcuts +*.lnk + +### Gradle ### +.gradle +build/ +.gradle/buildOutputCleanup/** + +# Ignore Gradle GUI config +gradle-app.setting + +# Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored) +!gradle-wrapper.jar + +# Cache of project +.gradletasknamecache + +# # Work around https://youtrack.jetbrains.com/issue/IDEA-116898 +# gradle/wrapper/gradle-wrapper.properties + +### Gradle Patch ### +**/build/ + +# End of https://www.gitignore.io/api/git,node,java,linux,macos,gradle,windows,intellij+all + +pg/** +.vscode/** +db-patcher/bin/** \ No newline at end of file diff --git a/.gradle/7.1.1/dependencies-accessors/dependencies-accessors.lock b/.gradle/7.1.1/dependencies-accessors/dependencies-accessors.lock new file mode 100644 index 0000000..6b8de5a Binary files /dev/null and b/.gradle/7.1.1/dependencies-accessors/dependencies-accessors.lock differ diff --git a/.gradle/7.1.1/dependencies-accessors/gc.properties b/.gradle/7.1.1/dependencies-accessors/gc.properties new file mode 100644 index 0000000..e69de29 diff --git a/.gradle/7.1.1/executionHistory/executionHistory.bin b/.gradle/7.1.1/executionHistory/executionHistory.bin new file mode 100644 index 0000000..fe54837 Binary files /dev/null and b/.gradle/7.1.1/executionHistory/executionHistory.bin differ diff --git a/.gradle/7.1.1/executionHistory/executionHistory.lock b/.gradle/7.1.1/executionHistory/executionHistory.lock new file mode 100644 index 0000000..5fa5023 Binary files /dev/null and b/.gradle/7.1.1/executionHistory/executionHistory.lock differ diff --git a/.gradle/7.1.1/fileChanges/last-build.bin b/.gradle/7.1.1/fileChanges/last-build.bin new file mode 100644 index 0000000..f76dd23 Binary files /dev/null and b/.gradle/7.1.1/fileChanges/last-build.bin differ diff --git a/.gradle/7.1.1/fileHashes/fileHashes.bin b/.gradle/7.1.1/fileHashes/fileHashes.bin new file mode 100644 index 0000000..44004d9 Binary files /dev/null and b/.gradle/7.1.1/fileHashes/fileHashes.bin differ diff --git a/.gradle/7.1.1/fileHashes/fileHashes.lock b/.gradle/7.1.1/fileHashes/fileHashes.lock new file mode 100644 index 0000000..75738f1 Binary files /dev/null and b/.gradle/7.1.1/fileHashes/fileHashes.lock differ diff --git a/.gradle/7.1.1/gc.properties b/.gradle/7.1.1/gc.properties new file mode 100644 index 0000000..e69de29 diff --git a/.gradle/buildOutputCleanup/buildOutputCleanup.lock b/.gradle/buildOutputCleanup/buildOutputCleanup.lock new file mode 100644 index 0000000..5b52c7a Binary files /dev/null and b/.gradle/buildOutputCleanup/buildOutputCleanup.lock differ diff --git a/.gradle/buildOutputCleanup/cache.properties b/.gradle/buildOutputCleanup/cache.properties new file mode 100644 index 0000000..77bc69a --- /dev/null +++ b/.gradle/buildOutputCleanup/cache.properties @@ -0,0 +1,2 @@ +#Thu Dec 22 12:38:58 MSK 2022 +gradle.version=7.6 diff --git a/.gradle/checksums/checksums.lock b/.gradle/checksums/checksums.lock new file mode 100644 index 0000000..8f80e7c Binary files /dev/null and b/.gradle/checksums/checksums.lock differ diff --git a/.gradle/checksums/md5-checksums.bin b/.gradle/checksums/md5-checksums.bin new file mode 100644 index 0000000..53a0022 Binary files /dev/null and b/.gradle/checksums/md5-checksums.bin differ diff --git a/.gradle/checksums/sha1-checksums.bin b/.gradle/checksums/sha1-checksums.bin new file mode 100644 index 0000000..28bf5ed Binary files /dev/null and b/.gradle/checksums/sha1-checksums.bin differ diff --git a/.gradle/vcs-1/gc.properties b/.gradle/vcs-1/gc.properties new file mode 100644 index 0000000..e69de29 diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..13566b8 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,8 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Editor-based HTTP Client requests +/httpRequests/ +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml diff --git a/.idea/codeStyles/Project.xml b/.idea/codeStyles/Project.xml new file mode 100644 index 0000000..55dbdd7 --- /dev/null +++ b/.idea/codeStyles/Project.xml @@ -0,0 +1,12 @@ + + + + \ No newline at end of file diff --git a/.idea/codeStyles/codeStyleConfig.xml b/.idea/codeStyles/codeStyleConfig.xml new file mode 100644 index 0000000..a55e7a1 --- /dev/null +++ b/.idea/codeStyles/codeStyleConfig.xml @@ -0,0 +1,5 @@ + + + + \ No newline at end of file diff --git a/.idea/gradle.xml b/.idea/gradle.xml new file mode 100644 index 0000000..ccf0541 --- /dev/null +++ b/.idea/gradle.xml @@ -0,0 +1,21 @@ + + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..03e540b --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,11 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..35eb1dd --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..10ee740 --- /dev/null +++ b/README.md @@ -0,0 +1 @@ +# Template: Spring Boot + Liquibase diff --git a/build.gradle b/build.gradle new file mode 100644 index 0000000..d024090 --- /dev/null +++ b/build.gradle @@ -0,0 +1,133 @@ +gradle.startParameter.showStacktrace = ShowStacktrace.ALWAYS + +buildscript { + ext { + // ext.mavenRepo = 'http://localhost:18081/repository/maven-central/' + springBootVersion = '2.6.6' + springCloudVersion = '2021.0.1' + liquibaseCoreVersion = '3.8.9' + liquibasePluginVersion = '2.1.1' + logbackVersion = '1.2.9' + jacksonVersion = '2.11.0' + validationApiVersion = '2.0.1.Final' + hibernateValidator = '6.2.0.Final' + jakartaValidation = '2.0.2' + } + + repositories { + mavenCentral() + //maven { + // allowInsecureProtocol true + // url mavenRepo + //} + } + + dependencies { + classpath "org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}" + classpath "org.liquibase:liquibase-gradle-plugin:${liquibasePluginVersion}" + } +} + +subprojects { + apply plugin: 'java' + apply plugin: 'org.springframework.boot' + apply plugin: 'io.spring.dependency-management' + + group = 'me.bvn13.service' + version = '0.0.1' + + sourceCompatibility = 17 + targetCompatibility = 17 + + dependencyManagement { + imports { + mavenBom "org.springframework.cloud:spring-cloud-dependencies:${springCloudVersion}" + } + } + + tasks.withType(JavaCompile) { + options.encoding = 'UTF-8' + } + + configurations { + compileOnly { + extendsFrom annotationProcessor + } + } + + repositories { + mavenCentral() + //maven { + // allowInsecureProtocol true + // url mavenRepo + //} + } + +//------------------- Настройка интеграционных тестов (start) --------------------- + sourceSets { + integrationTest { + java { + compileClasspath += sourceSets.main.output + runtimeClasspath += sourceSets.main.output + compileClasspath += sourceSets.test.output + runtimeClasspath += sourceSets.test.output + srcDir file('src/integration-test/java') + } + resources.srcDir file('src/integration-test/resources') + } + } + + configurations { + integrationTestImplementation.extendsFrom testImplementation + integrationTestRuntimeOnly.extendsFrom testRuntimeOnly + } + + task integrationTest(type: Test) { + testClassesDirs = sourceSets.integrationTest.output.classesDirs + classpath = sourceSets.integrationTest.runtimeClasspath + outputs.upToDateWhen { false } + } + + check.dependsOn integrationTest + integrationTest.mustRunAfter test +//------------------- Настройка интеграционных тестов (end) --------------------- + + dependencies { + implementation 'org.springframework.boot:spring-boot-starter' + + compileOnly 'org.projectlombok:lombok' + annotationProcessor 'org.projectlombok:lombok' + + testImplementation('org.springframework.boot:spring-boot-starter-test') { + exclude group: 'org.junit.vintage', module: 'junit-vintage-engine' + } + + testCompileOnly "org.projectlombok:lombok" + testAnnotationProcessor("org.projectlombok:lombok") + + testImplementation 'org.assertj:assertj-core' + testImplementation 'org.mockito:mockito-core' + } + + test { + useJUnitPlatform() + systemProperties System.properties + // Нужно, иначе Jacoco не работает + systemProperties['user.dir'] = workingDir + } + integrationTest { + useJUnitPlatform() + systemProperties System.properties + } +} + +// Task to download all dependencies for all targets +task downloadDependencies { + doLast { + rootProject.allprojects { project -> + Set configurations = project.buildscript.configurations + project.configurations + configurations.findAll { c -> c.canBeResolved } + .forEach { c -> c.resolve() } + } + } +} diff --git a/db-patcher/build.gradle b/db-patcher/build.gradle new file mode 100644 index 0000000..acc20aa --- /dev/null +++ b/db-patcher/build.gradle @@ -0,0 +1,36 @@ +plugins { + id 'java' + id 'org.liquibase.gradle' +} + +bootJar { + enabled = false +} + +dependencies { + liquibaseRuntime "org.liquibase:liquibase-core:${liquibaseCoreVersion}" + liquibaseRuntime "org.liquibase:liquibase-gradle-plugin:${liquibasePluginVersion}" + liquibaseRuntime "ch.qos.logback:logback-classic:${logbackVersion}" + liquibaseRuntime "ch.qos.logback:logback-core:${logbackVersion}" + liquibaseRuntime sourceSets.main.output + + testImplementation "org.liquibase:liquibase-core:${liquibaseCoreVersion}" + testImplementation 'com.h2database:h2' + testImplementation 'org.springframework.boot:spring-boot-starter-data-jpa' + testImplementation 'org.springframework.boot:spring-boot-starter-test' +} + +liquibase { + activities { + main { + changeLogFile 'db/changelog/changelog.xml' +// url System.getProperty('liquibaseUrl') ?: +// "jdbc:oracle:thin:@(DESCRIPTION=\ +// (ADDRESS_LIST=\ +// (ADDRESS=(PROTOCOL=tcp)(HOST=nl-lsnr-stg00.local.profee.com)(PORT=1521)))\ +// (CONNECT_DATA=(SERVICE_NAME=PFTEST)(ur=a)))" +// username System.getProperty('liquibaseUsername') +// password System.getProperty('liquibasePassword') + } + } +} diff --git a/db-patcher/build/resources/main/db/changelog/merchant-program-participant-changelog.xml b/db-patcher/build/resources/main/db/changelog/merchant-program-participant-changelog.xml new file mode 100644 index 0000000..f3fca99 --- /dev/null +++ b/db-patcher/build/resources/main/db/changelog/merchant-program-participant-changelog.xml @@ -0,0 +1,32 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/db-patcher/build/resources/main/db/changelog/scripts/20210126-1-create_table_for_files.xml b/db-patcher/build/resources/main/db/changelog/scripts/20210126-1-create_table_for_files.xml new file mode 100644 index 0000000..1633ffd --- /dev/null +++ b/db-patcher/build/resources/main/db/changelog/scripts/20210126-1-create_table_for_files.xml @@ -0,0 +1,36 @@ + + + + + create table md_invitation_file(file_uid varchar2(40 char) + , file_data blob not null + , original_file_name varchar2(500 char) not null + , merchant_wal_id varchar2(40 char) not null + , load_time timestamp default systimestamp not null + , parse_status varchar2(20 char) not null + , constraint md_invitation_file_pk primary key(file_uid) + , constraint md_invitation_file_uk unique(merchant_wal_id, original_file_name, load_time) + ); + comment on table md_invitation_file is 'Файлы с приглашениями к регистрации в Profee'; + comment on column md_invitation_file.file_uid is 'Идентификатор файла'; + comment on column md_invitation_file.file_data is 'Содержимое файла'; + comment on column md_invitation_file.original_file_name is 'Имя файла'; + comment on column md_invitation_file.merchant_wal_id is 'Идентификатор мерчанта в Profee'; + comment on column md_invitation_file.load_time is 'Время загрузки файла'; + comment on column md_invitation_file.parse_status is 'Статус парсинга'; + + create index md_invitation_file_wal_id_i + on md_invitation_file(merchant_wal_id); + + + + + drop table md_invitation_file purge; + + + + \ No newline at end of file diff --git a/db-patcher/build/resources/main/db/changelog/scripts/20210204-1-grant-rights.xml b/db-patcher/build/resources/main/db/changelog/scripts/20210204-1-grant-rights.xml new file mode 100644 index 0000000..f78d62b --- /dev/null +++ b/db-patcher/build/resources/main/db/changelog/scripts/20210204-1-grant-rights.xml @@ -0,0 +1,17 @@ + + + + + grant select, insert, update on MD_INVITATION_FILE to mpp_app; + + + + revoke select, insert, update on MD_INVITATION_FILE from mpp_app; + + + + \ No newline at end of file diff --git a/db-patcher/build/resources/main/db/changelog/scripts/20210216-1-create_file_for_invitation_records.xml b/db-patcher/build/resources/main/db/changelog/scripts/20210216-1-create_file_for_invitation_records.xml new file mode 100644 index 0000000..8d4b485 --- /dev/null +++ b/db-patcher/build/resources/main/db/changelog/scripts/20210216-1-create_file_for_invitation_records.xml @@ -0,0 +1,37 @@ + + + + + create sequence md_invitation_record_seq; + + + create table md_invitation_record(record_id number(10, 0) + , email varchar2(500 char) not null + , name varchar2(500 char) not null + , invitation_file_uuid varchar2(40 char) + , merchant_wal_id varchar2(40 char) + , invitation_request_status varchar2(40 char) + , constraint md_invitation_record_pk primary key(record_id) + , constraint md_invitation_record_uk unique(invitation_file_uuid, email, merchant_wal_id) + ); + comment on table md_invitation_record is 'Запросы на приглашения к регистрации в Profee'; + comment on column md_invitation_record.record_id is 'Идентификатор записи'; + comment on column md_invitation_record.email is 'Почта для отправки приглашения'; + comment on column md_invitation_record.name is 'Имя участника программы'; + comment on column md_invitation_record.invitation_file_uuid is 'Идентификатор файла с приглашениями'; + comment on column md_invitation_record.merchant_wal_id is 'Идентификатор мерчанта в Profee'; + + + + drop table md_invitation_record purge; + + + drop sequence md_invitation_record_seq; + + + + \ No newline at end of file diff --git a/db-patcher/build/resources/main/db/changelog/scripts/20210216-2-grant-rights.xml b/db-patcher/build/resources/main/db/changelog/scripts/20210216-2-grant-rights.xml new file mode 100644 index 0000000..0c150eb --- /dev/null +++ b/db-patcher/build/resources/main/db/changelog/scripts/20210216-2-grant-rights.xml @@ -0,0 +1,17 @@ + + + + + grant select, insert, update on md_invitation_record to mpp_app; + + + + revoke select, insert, update on md_invitation_record from mpp_app; + + + + \ No newline at end of file diff --git a/db-patcher/build/resources/main/db/changelog/scripts/20210218-1-grant-rights.xml b/db-patcher/build/resources/main/db/changelog/scripts/20210218-1-grant-rights.xml new file mode 100644 index 0000000..34fbbaa --- /dev/null +++ b/db-patcher/build/resources/main/db/changelog/scripts/20210218-1-grant-rights.xml @@ -0,0 +1,17 @@ + + + + + grant select on md_invitation_record_seq to mpp_app; + + + + revoke select on md_invitation_record_seq from mpp_app; + + + + \ No newline at end of file diff --git a/db-patcher/build/resources/main/db/changelog/scripts/20210218-2-alter_table_for_invitation_records.xml b/db-patcher/build/resources/main/db/changelog/scripts/20210218-2-alter_table_for_invitation_records.xml new file mode 100644 index 0000000..1c144a7 --- /dev/null +++ b/db-patcher/build/resources/main/db/changelog/scripts/20210218-2-alter_table_for_invitation_records.xml @@ -0,0 +1,19 @@ + + + + + alter table md_invitation_record + rename column invitation_file_uuid to invitation_file_uid; + + + + alter table md_invitation_record + rename column invitation_file_uid to invitation_file_uuid; + + + + \ No newline at end of file diff --git a/db-patcher/build/resources/main/db/changelog/scripts/20210219-1-alter_table_for_invitation_records.xml b/db-patcher/build/resources/main/db/changelog/scripts/20210219-1-alter_table_for_invitation_records.xml new file mode 100644 index 0000000..16787b2 --- /dev/null +++ b/db-patcher/build/resources/main/db/changelog/scripts/20210219-1-alter_table_for_invitation_records.xml @@ -0,0 +1,19 @@ + + + + + alter table md_invitation_record + drop constraint md_invitation_record_uk; + + + + alter table md_invitation_record + add constraint md_invitation_record_uk unique(invitation_file_uid, email, merchant_wal_id); + + + + \ No newline at end of file diff --git a/db-patcher/build/resources/main/db/changelog/scripts/20210220-1-create_table_md_merchant.xml b/db-patcher/build/resources/main/db/changelog/scripts/20210220-1-create_table_md_merchant.xml new file mode 100644 index 0000000..7124b8f --- /dev/null +++ b/db-patcher/build/resources/main/db/changelog/scripts/20210220-1-create_table_md_merchant.xml @@ -0,0 +1,25 @@ + + + + + create table md_merchant(wal_id varchar(40 char) + , trading_name varchar2(500 char) not null + , constraint md_merchant_pk primary key(wal_id) + ); + + comment on table md_merchant is 'Информация о партнёрах'; + comment on column md_merchant.wal_id is 'Лицевой счёт мерчанта в Profee'; + comment on column md_merchant.trading_name is 'Коммерческое название мерчанта'; + + + + + drop table md_merchant purge; + + + + \ No newline at end of file diff --git a/db-patcher/build/resources/main/db/changelog/scripts/20210225-1-alter_table_for_invitation_records.xml b/db-patcher/build/resources/main/db/changelog/scripts/20210225-1-alter_table_for_invitation_records.xml new file mode 100644 index 0000000..7009e50 --- /dev/null +++ b/db-patcher/build/resources/main/db/changelog/scripts/20210225-1-alter_table_for_invitation_records.xml @@ -0,0 +1,19 @@ + + + + + alter table md_invitation_record + rename column merchant_wal_id to merchant_trading_name; + + + + alter table md_invitation_record + rename column merchant_trading_name to merchant_wal_id; + + + + \ No newline at end of file diff --git a/db-patcher/build/resources/main/db/changelog/scripts/20210324-1-grant_rights_for_merchant.xml b/db-patcher/build/resources/main/db/changelog/scripts/20210324-1-grant_rights_for_merchant.xml new file mode 100644 index 0000000..ebf8e9c --- /dev/null +++ b/db-patcher/build/resources/main/db/changelog/scripts/20210324-1-grant_rights_for_merchant.xml @@ -0,0 +1,17 @@ + + + + + grant select, insert, update on md_merchant to mpp_app; + + + + revoke select, insert, update on md_merchant from mpp_app; + + + + \ No newline at end of file diff --git a/db-patcher/build/resources/main/db/changelog/scripts/20210621-1-create_table_fd_bulk_payout_order.xml b/db-patcher/build/resources/main/db/changelog/scripts/20210621-1-create_table_fd_bulk_payout_order.xml new file mode 100644 index 0000000..bbc1652 --- /dev/null +++ b/db-patcher/build/resources/main/db/changelog/scripts/20210621-1-create_table_fd_bulk_payout_order.xml @@ -0,0 +1,41 @@ + + + + + create table fd_bulk_payout_order( + bulk_order_id varchar2(40 char) + , bulk_order_data blob not null + , original_file_name varchar2(500 char) not null + , partner_wal_id varchar2(40 char) not null + , load_time timestamp default systimestamp not null + , payout_number number(8) + , record_number number(8) + , user_login varchar2(40 char) + , parse_status varchar2(20 char) not null + , constraint fd_bulk_payout_order_pk primary key(bulk_order_id) + , constraint fd_bulk_payout_order_status_ck check(parse_status in ('REJECTED', 'CONFIRMED')) + ); + + comment on table fd_bulk_payout_order is 'Распоряжения на массовую выплату'; + comment on column fd_bulk_payout_order.bulk_order_id is 'UID распоряжения'; + comment on column fd_bulk_payout_order.bulk_order_data is 'Файл-распоряжение'; + comment on column fd_bulk_payout_order.original_file_name is 'Имя файла'; + comment on column fd_bulk_payout_order.partner_wal_id is 'Идентификатор договора партнёра'; + comment on column fd_bulk_payout_order.load_time is 'Дата и время загрузки файла-распоряжения'; + comment on column fd_bulk_payout_order.payout_number is 'Количесво инициализированных выплат'; + comment on column fd_bulk_payout_order.record_number is 'Количество записей в файле-распоряжении'; + comment on column fd_bulk_payout_order.user_login is 'Логин пользователя, загрузившего файл-распоряжение'; + comment on column fd_bulk_payout_order.parse_status is 'Статус парсинга'; + + + + + drop table fd_bulk_payout_order purge; + + + + \ No newline at end of file diff --git a/db-patcher/build/resources/main/db/changelog/scripts/20210622-1-grant_rights_for_mpp.xml b/db-patcher/build/resources/main/db/changelog/scripts/20210622-1-grant_rights_for_mpp.xml new file mode 100644 index 0000000..b57a940 --- /dev/null +++ b/db-patcher/build/resources/main/db/changelog/scripts/20210622-1-grant_rights_for_mpp.xml @@ -0,0 +1,19 @@ + + + + + grant select, insert, update on fd_bulk_payout_order to mpp_app; + grant select, insert, update on fd_bulk_payout_order to pf_api_app; + + + + revoke select, insert,update on fd_bulk_payout_order from mpp_app; + revoke select, insert,update on fd_bulk_payout_order from pf_api_app; + + + + \ No newline at end of file diff --git a/db-patcher/build/resources/main/db/changelog/scripts/20210713-1-create_table_md_employee.xml b/db-patcher/build/resources/main/db/changelog/scripts/20210713-1-create_table_md_employee.xml new file mode 100644 index 0000000..18180d7 --- /dev/null +++ b/db-patcher/build/resources/main/db/changelog/scripts/20210713-1-create_table_md_employee.xml @@ -0,0 +1,58 @@ + + + + + create sequence md_employee_seq; + + + create table md_employee_status_rd(status varchar2(15 char), status_description varchar2(500 char), + constraint md_employee_status_rd_pk primary key(status)); + comment on table md_employee_status_rd is 'Справочник статусов сотрудника'; + comment on column md_employee_status_rd.status is 'Статус сотрудника'; + comment on column md_employee_status_rd.status_description is 'Описание статуса сотрудника'; + + + insert into md_employee_status_rd(status, status_description) + values ('PENDING', 'Ожидание регистрации сотрудника'); + insert into md_employee_status_rd(status, status_description) + values ('REGISTERED', 'Сотрудник зарегистрирован'); + commit; + + + create table md_employee(employee_id number(10) + , wal_id varchar2(40 char) not null + , employee_name varchar2(500 char) not null + , cli_email varchar2(500 char) not null + , payment_link varchar2(40 char) + , registration_date timestamp default systimestamp + , status varchar2(15 char) not null + , update_date timestamp default systimestamp not null + , constraint md_employee_pk primary key(employee_id) + , constraint md_employee_status_fk foreign key(status) references md_employee_status_rd (status) + ); + comment on table md_employee is 'Информация о сотрудниках'; + comment on column md_employee.employee_id is 'Идентификатор сотрудника'; + comment on column md_employee.wal_id is 'Идентификатор мерчанта в Profee'; + comment on column md_employee.employee_name is 'Имя сотрудника'; + comment on column md_employee.cli_email is 'Почта для отправки приглашения'; + comment on column md_employee.payment_link is 'Ссылка для оплаты'; + comment on column md_employee.registration_date is 'Дата регистрации сотрудника'; + comment on column md_employee.status is 'Статус, в котором находится сотрудник'; + comment on column md_employee.update_date is 'Дата последнего изменения'; + + + + + drop table md_employee purge; + drop table md_employee_status_rd purge; + + + drop sequence md_employee_seq; + + + + \ No newline at end of file diff --git a/db-patcher/build/resources/main/db/changelog/scripts/20210726-1-grant_rights_for_md_employee.xml b/db-patcher/build/resources/main/db/changelog/scripts/20210726-1-grant_rights_for_md_employee.xml new file mode 100644 index 0000000..2bd3516 --- /dev/null +++ b/db-patcher/build/resources/main/db/changelog/scripts/20210726-1-grant_rights_for_md_employee.xml @@ -0,0 +1,19 @@ + + + + + grant select, insert, update on md_employee to mpp_app; + grant select, insert, update on md_employee_status_rd to mpp_app; + + + + revoke select, insert, update on md_employee from mpp_app; + revoke select, insert, update on md_employee_status_rd from mpp_app; + + + + \ No newline at end of file diff --git a/db-patcher/build/resources/main/db/changelog/scripts/20210727-1-grant_rights_for_employee_seq.xml b/db-patcher/build/resources/main/db/changelog/scripts/20210727-1-grant_rights_for_employee_seq.xml new file mode 100644 index 0000000..13512b3 --- /dev/null +++ b/db-patcher/build/resources/main/db/changelog/scripts/20210727-1-grant_rights_for_employee_seq.xml @@ -0,0 +1,17 @@ + + + + + grant select on md_employee_seq to mpp_app; + + + + revoke select on md_employee_seq from mpp_app; + + + + \ No newline at end of file diff --git a/db-patcher/build/resources/main/db/changelog/scripts/20210812-1-change_payment_link_size.xml b/db-patcher/build/resources/main/db/changelog/scripts/20210812-1-change_payment_link_size.xml new file mode 100644 index 0000000..90ccca6 --- /dev/null +++ b/db-patcher/build/resources/main/db/changelog/scripts/20210812-1-change_payment_link_size.xml @@ -0,0 +1,17 @@ + + + + + alter table md_employee modify payment_link varchar2(120 char); + + + + alter table md_employee modify payment_link varchar2(40 char) + + + + \ No newline at end of file diff --git a/db-patcher/build/resources/main/db/changelog/scripts/20220323-01-create_fd_payout_record.xml b/db-patcher/build/resources/main/db/changelog/scripts/20220323-01-create_fd_payout_record.xml new file mode 100644 index 0000000..a564d8f --- /dev/null +++ b/db-patcher/build/resources/main/db/changelog/scripts/20220323-01-create_fd_payout_record.xml @@ -0,0 +1,35 @@ + + + + + + create table fd_payout_record ( + record_id varchar2(40 char) + , bulk_order_id varchar2(40 char) not null + , record_number number(10) not null + , cli_email varchar2(500 char) not null + , payout_status varchar2(40 char) + , constraint fd_payout_record_pk primary key(record_id) + , constraint fd_payout_record_rec_num_uk unique(bulk_order_id, record_number) + , constraint fd_payout_record_email_uk unique(bulk_order_id, cli_email) + , constraint fd_payout_record_order_fk foreign key(bulk_order_id) references fd_bulk_payout_order (bulk_order_id) + ); + comment on table fd_payout_record is 'Платежи сотрудникам по зарплатному проекту Profee'; + comment on column fd_payout_record.record_id is 'Идентификатор записи'; + comment on column fd_payout_record.bulk_order_id is 'Идентификатор файла ведомости'; + comment on column fd_payout_record.record_number is 'Порядковый номер строки в файле ведомости'; + comment on column fd_payout_record.cli_email is 'Почта сотрудника зарплатного проекта'; + comment on column fd_payout_record.payout_status is 'Статус платежа (создан или нет)'; + + + + drop table fd_payout_record purge; + + + + + \ No newline at end of file diff --git a/db-patcher/build/resources/main/db/changelog/scripts/20220323-02-grant_rights_to_payout_file_content.xml b/db-patcher/build/resources/main/db/changelog/scripts/20220323-02-grant_rights_to_payout_file_content.xml new file mode 100644 index 0000000..537063c --- /dev/null +++ b/db-patcher/build/resources/main/db/changelog/scripts/20220323-02-grant_rights_to_payout_file_content.xml @@ -0,0 +1,19 @@ + + + + + + grant select, insert, update on fd_payout_record to mpp_app; + + + + revoke select, insert, update on fd_payout_record from mpp_app; + + + + + \ No newline at end of file diff --git a/db-patcher/build/resources/main/db/changelog/scripts/20220324-01-update_table_md_employee.xml b/db-patcher/build/resources/main/db/changelog/scripts/20220324-01-update_table_md_employee.xml new file mode 100644 index 0000000..4a54ae3 --- /dev/null +++ b/db-patcher/build/resources/main/db/changelog/scripts/20220324-01-update_table_md_employee.xml @@ -0,0 +1,19 @@ + + + + + alter table md_employee + rename column wal_id to merchant_wal_id; + + + + alter table md_employee + rename column merchant_wal_id to wal_id; + + + + \ No newline at end of file diff --git a/db-patcher/build/resources/main/db/changelog/scripts/20220324-02-update_table_md_employee.xml b/db-patcher/build/resources/main/db/changelog/scripts/20220324-02-update_table_md_employee.xml new file mode 100644 index 0000000..5ecdbe1 --- /dev/null +++ b/db-patcher/build/resources/main/db/changelog/scripts/20220324-02-update_table_md_employee.xml @@ -0,0 +1,19 @@ + + + + + alter table md_employee + add wal_id varchar(40 char); + + + + alter table md_employee + drop column wal_id; + + + + \ No newline at end of file diff --git a/db-patcher/build/resources/main/db/changelog/scripts/20220328-01-update_table_fd_bulk_payout_order.xml b/db-patcher/build/resources/main/db/changelog/scripts/20220328-01-update_table_fd_bulk_payout_order.xml new file mode 100644 index 0000000..dd91d09 --- /dev/null +++ b/db-patcher/build/resources/main/db/changelog/scripts/20220328-01-update_table_fd_bulk_payout_order.xml @@ -0,0 +1,19 @@ + + + + + alter table fd_bulk_payout_order + rename column partner_wal_id to merchant_wal_id; + + + + alter table fd_bulk_payout_order + rename column merchant_wal_id to partner_wal_id; + + + + \ No newline at end of file diff --git a/db-patcher/build/resources/main/db/changelog/scripts/20220328-02-update_table_fd_bulk_payout_order.xml b/db-patcher/build/resources/main/db/changelog/scripts/20220328-02-update_table_fd_bulk_payout_order.xml new file mode 100644 index 0000000..b4d8e98 --- /dev/null +++ b/db-patcher/build/resources/main/db/changelog/scripts/20220328-02-update_table_fd_bulk_payout_order.xml @@ -0,0 +1,23 @@ + + + + + alter table fd_bulk_payout_order + drop constraint fd_bulk_payout_order_status_ck; + alter table fd_bulk_payout_order + add constraint fd_bulk_payout_order_status_ck check(parse_status in ('INIT', 'REJECTED', 'CONFIRMED')); + + + + alter table fd_bulk_payout_order + drop constraint fd_bulk_payout_order_status_ck; + alter table fd_bulk_payout_order + add constraint fd_bulk_payout_order_status_ck check(parse_status in ('REJECTED', 'CONFIRMED')); + + + + \ No newline at end of file diff --git a/db-patcher/build/resources/main/db/changelog/scripts/20220404-01-update_fd_payout_record_drop_uniq_constraint_on_id_and_email.xml b/db-patcher/build/resources/main/db/changelog/scripts/20220404-01-update_fd_payout_record_drop_uniq_constraint_on_id_and_email.xml new file mode 100644 index 0000000..6160072 --- /dev/null +++ b/db-patcher/build/resources/main/db/changelog/scripts/20220404-01-update_fd_payout_record_drop_uniq_constraint_on_id_and_email.xml @@ -0,0 +1,21 @@ + + + + + + alter table fd_payout_record + drop constraint fd_payout_record_email_uk; + + + + alter table fd_payout_record + add constraint fd_payout_record_email_uk unique(bulk_order_id, cli_email); + + + + + \ No newline at end of file diff --git a/db-patcher/src/main/resources/db/changelog/changelog.xml b/db-patcher/src/main/resources/db/changelog/changelog.xml new file mode 100644 index 0000000..167bf43 --- /dev/null +++ b/db-patcher/src/main/resources/db/changelog/changelog.xml @@ -0,0 +1,11 @@ + + + + + + + \ No newline at end of file diff --git a/db-patcher/src/test/java/me/bvn13/service/db/patcher/DbPatcherTestConfig.java b/db-patcher/src/test/java/me/bvn13/service/db/patcher/DbPatcherTestConfig.java new file mode 100644 index 0000000..754f41f --- /dev/null +++ b/db-patcher/src/test/java/me/bvn13/service/db/patcher/DbPatcherTestConfig.java @@ -0,0 +1,9 @@ +package me.bvn13.service.db.patcher; + +import org.springframework.context.annotation.Import; + +@Import({ + me.bvn13.service.db.patcher.LiquibaseTestConfig.class +}) +public class DbPatcherTestConfig { +} diff --git a/db-patcher/src/test/java/me/bvn13/service/db/patcher/LiquibaseTestConfig.java b/db-patcher/src/test/java/me/bvn13/service/db/patcher/LiquibaseTestConfig.java new file mode 100644 index 0000000..0490758 --- /dev/null +++ b/db-patcher/src/test/java/me/bvn13/service/db/patcher/LiquibaseTestConfig.java @@ -0,0 +1,33 @@ +package me.bvn13.service.db.patcher; + +import liquibase.integration.spring.SpringLiquibase; +import org.springframework.boot.autoconfigure.liquibase.LiquibaseDataSource; +import org.springframework.context.annotation.Bean; +import org.springframework.jdbc.datasource.DriverManagerDataSource; +import org.springframework.transaction.annotation.EnableTransactionManagement; + +import javax.sql.DataSource; + +@EnableTransactionManagement +public class LiquibaseTestConfig { + private static final String PATH_TO_CHANGE_LOG = "classpath:db/changelog/changelog.xml"; + + @Bean + public SpringLiquibase liquibase(DataSource dataSource) { + SpringLiquibase liquibase = new SpringLiquibase(); + liquibase.setDataSource(dataSource); + liquibase.setChangeLog(PATH_TO_CHANGE_LOG); + return liquibase; + } + + @LiquibaseDataSource + @Bean + public DataSource dataSource() { + DriverManagerDataSource dataSource = new DriverManagerDataSource(); + dataSource.setDriverClassName(org.h2.Driver.class.getName()); + dataSource.setUrl("jdbc:h2:mem:testdb;DB_CLOSE_DELAY=-1;MODE=Oracle"); + dataSource.setUsername("sa"); + dataSource.setPassword(""); + return dataSource; + } +} diff --git a/db-patcher/src/test/java/me/bvn13/service/db/patcher/PatcherTest.java b/db-patcher/src/test/java/me/bvn13/service/db/patcher/PatcherTest.java new file mode 100644 index 0000000..b426971 --- /dev/null +++ b/db-patcher/src/test/java/me/bvn13/service/db/patcher/PatcherTest.java @@ -0,0 +1,17 @@ +package me.bvn13.service.db.patcher; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +import static org.springframework.boot.test.context.SpringBootTest.WebEnvironment.NONE; + +@RunWith(SpringRunner.class) +@SpringBootTest(webEnvironment = NONE, classes = me.bvn13.service.db.patcher.DbPatcherTestConfig.class) +public class PatcherTest { + @Test + public void testApplicationContext() { + System.out.println("Application context is started"); + } +} diff --git a/gradle.properties b/gradle.properties new file mode 100644 index 0000000..e474769 --- /dev/null +++ b/gradle.properties @@ -0,0 +1,3 @@ +org.gradle.console = plain +org.gradle.logging.level = info +org.gradle.jvmargs = -Xmx4G diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000..7454180 Binary files /dev/null and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000..070cb70 --- /dev/null +++ b/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,5 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew new file mode 100755 index 0000000..744e882 --- /dev/null +++ b/gradlew @@ -0,0 +1,185 @@ +#!/usr/bin/env sh + +# +# Copyright 2015 the original author or authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +############################################################################## +## +## Gradle start up script for UN*X +## +############################################################################## + +# Attempt to set APP_HOME +# Resolve links: $0 may be a link +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 +SAVED="`pwd`" +cd "`dirname \"$PRG\"`/" >/dev/null +APP_HOME="`pwd -P`" +cd "$SAVED" >/dev/null + +APP_NAME="Gradle" +APP_BASE_NAME=`basename "$0"` + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD="maximum" + +warn () { + echo "$*" +} + +die () { + echo + echo "$*" + echo + exit 1 +} + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "`uname`" in + CYGWIN* ) + cygwin=true + ;; + Darwin* ) + darwin=true + ;; + MSYS* | MINGW* ) + msys=true + ;; + NONSTOP* ) + nonstop=true + ;; +esac + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD="java" + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then + MAX_FD_LIMIT=`ulimit -H -n` + if [ $? -eq 0 ] ; then + if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then + MAX_FD="$MAX_FD_LIMIT" + fi + ulimit -n $MAX_FD + if [ $? -ne 0 ] ; then + warn "Could not set maximum file descriptor limit: $MAX_FD" + fi + else + warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" + fi +fi + +# For Darwin, add options to specify how the application appears in the dock +if $darwin; then + GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" +fi + +# For Cygwin or MSYS, switch paths to Windows format before running java +if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then + APP_HOME=`cygpath --path --mixed "$APP_HOME"` + CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + + JAVACMD=`cygpath --unix "$JAVACMD"` + + # We build the pattern for arguments to be converted via cygpath + ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` + SEP="" + for dir in $ROOTDIRSRAW ; do + ROOTDIRS="$ROOTDIRS$SEP$dir" + SEP="|" + done + OURCYGPATTERN="(^($ROOTDIRS))" + # Add a user-defined pattern to the cygpath arguments + if [ "$GRADLE_CYGPATTERN" != "" ] ; then + OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" + fi + # Now convert the arguments - kludge to limit ourselves to /bin/sh + i=0 + for arg in "$@" ; do + CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` + CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option + + if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition + eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` + else + eval `echo args$i`="\"$arg\"" + fi + i=`expr $i + 1` + done + case $i in + 0) set -- ;; + 1) set -- "$args0" ;; + 2) set -- "$args0" "$args1" ;; + 3) set -- "$args0" "$args1" "$args2" ;; + 4) set -- "$args0" "$args1" "$args2" "$args3" ;; + 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; + 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; + 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; + 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; + 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; + esac +fi + +# Escape application args +save () { + for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done + echo " " +} +APP_ARGS=`save "$@"` + +# Collect all arguments for the java command, following the shell quoting and substitution rules +eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" + +exec "$JAVACMD" "$@" diff --git a/gradlew.bat b/gradlew.bat new file mode 100644 index 0000000..107acd3 --- /dev/null +++ b/gradlew.bat @@ -0,0 +1,89 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto execute + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/service/.gitignore b/service/.gitignore new file mode 100644 index 0000000..c2065bc --- /dev/null +++ b/service/.gitignore @@ -0,0 +1,37 @@ +HELP.md +.gradle +build/ +!gradle/wrapper/gradle-wrapper.jar +!**/src/main/**/build/ +!**/src/test/**/build/ + +### STS ### +.apt_generated +.classpath +.factorypath +.project +.settings +.springBeans +.sts4-cache +bin/ +!**/src/main/**/bin/ +!**/src/test/**/bin/ + +### IntelliJ IDEA ### +.idea +*.iws +*.iml +*.ipr +out/ +!**/src/main/**/out/ +!**/src/test/**/out/ + +### NetBeans ### +/nbproject/private/ +/nbbuild/ +/dist/ +/nbdist/ +/.nb-gradle/ + +### VS Code ### +.vscode/ diff --git a/service/build.gradle b/service/build.gradle new file mode 100644 index 0000000..2ab67ff --- /dev/null +++ b/service/build.gradle @@ -0,0 +1,29 @@ +springBoot { + // для использования со Spring Actuator: отображает в actuator/info информацию о приложении + buildInfo() +} + +configurations { + compileOnly { + extendsFrom annotationProcessor + } +} + +repositories { + mavenCentral() +} + +dependencies { + implementation 'org.springframework.boot:spring-boot-starter-actuator' + implementation 'org.springframework.boot:spring-boot-starter-data-jpa' + implementation 'org.springframework.boot:spring-boot-starter-web' + implementation 'org.liquibase:liquibase-core' + compileOnly 'org.projectlombok:lombok' + runtimeOnly 'org.postgresql:postgresql' + annotationProcessor 'org.projectlombok:lombok' + testImplementation 'org.springframework.boot:spring-boot-starter-test' +} + +tasks.named('test') { + useJUnitPlatform() +} diff --git a/service/src/main/java/me/bvn13/service/ServiceApplication.java b/service/src/main/java/me/bvn13/service/ServiceApplication.java new file mode 100644 index 0000000..86a0f8f --- /dev/null +++ b/service/src/main/java/me/bvn13/service/ServiceApplication.java @@ -0,0 +1,13 @@ +package me.bvn13.service; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication +public class ServiceApplication { + + public static void main(String[] args) { + SpringApplication.run(ServiceApplication.class, args); + } + +} diff --git a/service/src/main/resources/application.yaml b/service/src/main/resources/application.yaml new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/service/src/main/resources/application.yaml @@ -0,0 +1 @@ + diff --git a/service/src/test/java/me/bvn13/service/ServiceApplicationTests.java b/service/src/test/java/me/bvn13/service/ServiceApplicationTests.java new file mode 100644 index 0000000..79f3602 --- /dev/null +++ b/service/src/test/java/me/bvn13/service/ServiceApplicationTests.java @@ -0,0 +1,13 @@ +package me.bvn13.service; + +import org.junit.jupiter.api.Test; +import org.springframework.boot.test.context.SpringBootTest; + +@SpringBootTest +class ServiceApplicationTests { + + @Test + void contextLoads() { + } + +} diff --git a/settings.gradle b/settings.gradle new file mode 100644 index 0000000..4dc0449 --- /dev/null +++ b/settings.gradle @@ -0,0 +1,10 @@ +pluginManagement { +// repositories { +// maven { url 'https://nexus.local.profee.com/repository/gradle-plugins/' } +// } +} + +rootProject.name = 'spring-boot-service' + +include 'service' +include 'db-patcher'