From f8dd12bee0966dfd979aadd124cc966955ad758b Mon Sep 17 00:00:00 2001 From: Korna <17145209+Korna@users.noreply.github.com> Date: Wed, 2 Nov 2022 15:51:14 +0300 Subject: [PATCH] Add basic module --- push-message-provider-hpk/build.gradle.kts | 21 +++++++ .../hpk/EnablePushMessageProviderHpk.kt | 7 +++ .../provider/hpk/properties/HpkProperties.kt | 59 +++++++++++++++++++ settings.gradle.kts | 1 + 4 files changed, 88 insertions(+) create mode 100644 push-message-provider-hpk/build.gradle.kts create mode 100644 push-message-provider-hpk/src/main/kotlin/ru/touchin/push/message/provider/hpk/EnablePushMessageProviderHpk.kt create mode 100644 push-message-provider-hpk/src/main/kotlin/ru/touchin/push/message/provider/hpk/properties/HpkProperties.kt diff --git a/push-message-provider-hpk/build.gradle.kts b/push-message-provider-hpk/build.gradle.kts new file mode 100644 index 0000000..b2bcd23 --- /dev/null +++ b/push-message-provider-hpk/build.gradle.kts @@ -0,0 +1,21 @@ +plugins { + id("kotlin") + id("kotlin-spring") + id("maven-publish") +} + +dependencies { + implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8") + + implementation("org.springframework.boot:spring-boot-starter-webflux") + + implementation(project(":logger-spring")) + implementation(project(":common-spring-web")) + implementation(project(":push-message-provider")) + + testImplementation(project(":logger-spring-web")) + + testImplementation("com.nhaarman.mockitokotlin2:mockito-kotlin") + testImplementation("org.springframework.boot:spring-boot-starter-test") + testImplementation("org.testcontainers:junit-jupiter") +} diff --git a/push-message-provider-hpk/src/main/kotlin/ru/touchin/push/message/provider/hpk/EnablePushMessageProviderHpk.kt b/push-message-provider-hpk/src/main/kotlin/ru/touchin/push/message/provider/hpk/EnablePushMessageProviderHpk.kt new file mode 100644 index 0000000..a1cb474 --- /dev/null +++ b/push-message-provider-hpk/src/main/kotlin/ru/touchin/push/message/provider/hpk/EnablePushMessageProviderHpk.kt @@ -0,0 +1,7 @@ +package ru.touchin.push.message.provider.hpk + +import org.springframework.context.annotation.Import +import ru.touchin.push.message.provider.hpk.configurations.PushMessageProviderHpkConfiguration + +@Import(value = [PushMessageProviderHpkConfiguration::class]) +annotation class EnablePushMessageProviderHpk diff --git a/push-message-provider-hpk/src/main/kotlin/ru/touchin/push/message/provider/hpk/properties/HpkProperties.kt b/push-message-provider-hpk/src/main/kotlin/ru/touchin/push/message/provider/hpk/properties/HpkProperties.kt new file mode 100644 index 0000000..3dd6d33 --- /dev/null +++ b/push-message-provider-hpk/src/main/kotlin/ru/touchin/push/message/provider/hpk/properties/HpkProperties.kt @@ -0,0 +1,59 @@ +package ru.touchin.push.message.provider.hpk.properties + +import org.springframework.boot.context.properties.ConfigurationProperties +import org.springframework.boot.context.properties.ConstructorBinding +import java.net.URL +import java.time.Duration + +@ConstructorBinding +@ConfigurationProperties(prefix = "push-message-provider.hpk") +data class HpkProperties( + val webServices: WebServices, +) { + + class WebServices( + val clientId: String, + val oauth: Oauth, + val hpk: Hpk, + ) + + class Oauth( + val clientSecret: String, + url: URL, + http: Http, + ssl: Ssl?, + ) : WebService( + url = url, + http = http, + ssl = ssl, + ) + + class Hpk( + url: URL, + http: Http, + ssl: Ssl?, + ) : WebService( + url = url, + http = http, + ssl = ssl, + ) + + open class WebService( + val url: URL, + val http: Http, + val ssl: Ssl?, + ) + + class Http( + val readTimeout: Duration, + val writeTimeout: Duration, + val connectionTimeout: Duration, + ) + + class Ssl( + val handshakeTimeout: Duration, + val notifyFlushTimeout: Duration, + val notifyReadTimeout: Duration, + ) + +} diff --git a/settings.gradle.kts b/settings.gradle.kts index 6ddd481..e2d5daf 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -45,6 +45,7 @@ include("validation-spring") include("version-spring-web") include("push-message-provider") include("push-message-provider-fcm") +include("push-message-provider-hpk") include("response-wrapper-spring-web") include("settings-spring-jpa") include("security-authorization-server-core")