diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..fb08ff7 --- /dev/null +++ b/.gitignore @@ -0,0 +1,78 @@ +# Created by .ignore support plugin (hsz.mobi) +.eunit +deps +*.o +*.beam +*.plt +erl_crash.dump +ebin/*.beam +rel/example_project +.concrete/DEV_MODE +.rebar +target/ +pom.xml.tag +pom.xml.releaseBackup +pom.xml.versionsBackup +pom.xml.next +release.properties +dependency-reduced-pom.xml +buildNumber.properties +.mvn/timing.properties +# 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/ +.idea/workspace.xml +.idea/tasks.xml +.idea/dictionaries +.idea/vcs.xml +.idea/jsLibraryMappings.xml + +# Sensitive or high-churn files: +.idea/dataSources.ids +.idea/dataSources.xml +.idea/dataSources.local.xml +.idea/sqlDataSources.xml +.idea/dynamic.xml +.idea/uiDesigner.xml + +# Gradle: +.idea/gradle.xml +.idea/libraries + +# Mongo Explorer plugin: +.idea/mongoSettings.xml + +*.iws +*.ipr +*.iml + + +# IntelliJ +/out/ + +# mpeltonen/sbt-idea plugin +.idea_modules/ + +# JIRA plugin +atlassian-ide-plugin.xml + +# Crashlytics plugin (for Android Studio and IntelliJ) +com_crashlytics_export_strings.xml +crashlytics.properties +crashlytics-build.properties +fabric.properties +*.class + +# Mobile Tools for Java (J2ME) +.mtj.tmp/ + +# Package Files # +*.jar +*.war +*.ear + +# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml +hs_err_pid* +env.list diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 0000000..8a64d8f --- /dev/null +++ b/Jenkinsfile @@ -0,0 +1,13 @@ +#!groovy +build('adapter-bank-spring-boot-starter', 'docker-host') { + checkoutRepo() + loadBuildUtils() + + def javaLibPipeline + runStage('load JavaLib pipeline') { + javaLibPipeline = load("build_utils/jenkins_lib/pipeJavaLib.groovy") + } + + def buildImageTag = "269686d735abef363f9f40a1bf4e1b7c751f3722" + javaLibPipeline(buildImageTag) +} \ No newline at end of file diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..4cbd77c --- /dev/null +++ b/pom.xml @@ -0,0 +1,153 @@ + + + + 4.0.0 + com.rbkmoney + adapter-bank-spring-boot-starter + 0.0.1-SNAPSHOT + jar + + + + + UTF-8 + 11 + 2.1.1.RELEASE + + + + + + javax.servlet + javax.servlet-api + 4.0.1 + provided + + + org.slf4j + slf4j-api + 1.7.25 + provided + + + org.projectlombok + lombok + 1.18.4 + provided + + + + + org.springframework.boot + spring-boot + ${spring-boot.version} + provided + + + org.springframework.boot + spring-boot-autoconfigure + ${spring-boot.version} + + + org.springframework.boot + spring-boot-configuration-processor + ${spring-boot.version} + true + + + org.springframework.boot + spring-boot-starter-web + ${spring-boot.version} + provided + + + + + com.rbkmoney + error-mapping-java + 1.0.0 + + + com.rbkmoney.woody + woody-thrift + 1.1.15 + + + com.rbkmoney + damsel + 1.256-2afe121 + + + com.rbkmoney + damsel-utils + 2.1.8 + + + + http://java-nexus.msk1.rbkmoney.net:8081/nexus/content/groups/public + + false + releases + RBKmoney releases repository + http://java-nexus.msk1.rbkmoney.net:8081/nexus/content/repositories/releases + default + + + true + snapshots + RBKmoney snapshots repository + http://java-nexus.msk1.rbkmoney.net:8081/nexus/content/repositories/snapshots + default + + + + + + + org.apache.maven.plugins + maven-source-plugin + 3.0.0 + + + attach-sources + + jar + + + + + + org.jacoco + jacoco-maven-plugin + 0.8.2 + + ${sonar.jacoco.reportPath} + true + + + + agent + + prepare-agent + + + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.8.0 + + ${java.version} + ${java.version} + + + + + + diff --git a/src/main/java/com/rbkmoney/adapter/bank/spring/boot/starter/config/ErrorMappingConfiguration.java b/src/main/java/com/rbkmoney/adapter/bank/spring/boot/starter/config/ErrorMappingConfiguration.java new file mode 100644 index 0000000..754839f --- /dev/null +++ b/src/main/java/com/rbkmoney/adapter/bank/spring/boot/starter/config/ErrorMappingConfiguration.java @@ -0,0 +1,32 @@ +package com.rbkmoney.adapter.bank.spring.boot.starter.config; + +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.rbkmoney.error.mapping.ErrorMapping; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.core.io.Resource; + +import java.io.IOException; + +@Configuration +public class ErrorMappingConfiguration { + + @Value("${error-mapping.file}") + private Resource filePath; + + @Value("${error-mapping.patternReason:\"'%s' - '%s'\"}") + private String patternReason; + + @Bean + ErrorMapping errorMapping() throws IOException { + ObjectMapper mapper = new ObjectMapper(); + mapper.configure(JsonParser.Feature.ALLOW_SINGLE_QUOTES, true); + + ErrorMapping errorMapping = new ErrorMapping(filePath.getInputStream(), patternReason, mapper); + errorMapping.validateMappingFormat(); + return errorMapping; + } + +} diff --git a/src/main/java/com/rbkmoney/adapter/bank/spring/boot/starter/config/properties/TimerProperties.java b/src/main/java/com/rbkmoney/adapter/bank/spring/boot/starter/config/properties/TimerProperties.java new file mode 100644 index 0000000..bc5f475 --- /dev/null +++ b/src/main/java/com/rbkmoney/adapter/bank/spring/boot/starter/config/properties/TimerProperties.java @@ -0,0 +1,27 @@ +package com.rbkmoney.adapter.bank.spring.boot.starter.config.properties; + +import lombok.Getter; +import lombok.Setter; +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.context.annotation.Configuration; +import org.springframework.validation.annotation.Validated; + +import javax.validation.constraints.NotNull; + +@Configuration +@ConfigurationProperties("time.config") +@Validated +@Getter +@Setter +public class TimerProperties { + + @NotNull + private int redirectTimeout; + + @NotNull + private int maxTimePolling; + + @NotNull + private int pollingDelay; + +}