diff --git a/.github/workflows/core-release.yaml b/.github/workflows/core-release.yaml deleted file mode 100644 index 3ab40de8a..000000000 --- a/.github/workflows/core-release.yaml +++ /dev/null @@ -1,52 +0,0 @@ -name: Release Core -on: - workflow_dispatch: - inputs: - test: - description: 'Release snapshot?' - required: false -jobs: - test: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - name: "JDK set-up" - uses: actions/setup-java@v3 - with: - java-version: '11' - distribution: 'adopt' - - run: mvn verify - deploy: - needs: test - runs-on: ubuntu-latest - outputs: - version: ${{ steps.release_artifact.outputs.version }} - steps: - - uses: actions/checkout@v4 - - name: "JDK set-up" - uses: actions/setup-java@v3 - with: - java-version: '11' - distribution: 'adopt' - server-id: oss-sonatype # Value of the distributionManagement/repository/id field of the pom.xml - server-username: SONATYPE_USERNAME # env variable for username in deploy - server-password: SONATYPE_PASSWORD # env variable for token in deploy - # only signed artifacts will be released to maven central. this sets up things for the maven-gpg-plugin - gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }} # Value of the GPG private key to import - gpg-passphrase: GPG_PASSPHRASE # env variable for GPG private key passphrase - settings-path: ${{ github.workspace }} - - name: Release - id: release_artifact - env: - SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }} - SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }} - GPG_PASSPHRASE: ${{ secrets.GPG_PRIVATE_KEY_PASSPHRASE }} - run: | - if [ -z "${{ github.event.inputs.test }}" ]; then - mvn deploy --settings $GITHUB_WORKSPACE/settings.xml -B -U -P release -DskipTests=true - else - VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout) - SNAPSHOT_VERSION="${VERSION%-SNAPSHOT}-SNAPSHOT" - mvn deploy --settings $GITHUB_WORKSPACE/settings.xml -B -U -P release -DskipTests=true -Drevision=$SNAPSHOT_VERSION - fi - echo "{version}=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)" >> $GITHUB_OUTPUT diff --git a/.github/workflows/core-verify.yaml b/.github/workflows/core-verify.yaml index 575c19d7f..a320c74bc 100644 --- a/.github/workflows/core-verify.yaml +++ b/.github/workflows/core-verify.yaml @@ -16,8 +16,10 @@ jobs: uses: actions/setup-java@v3 with: java-version: '11' - distribution: 'adopt' - - run: mvn verify -P github-verify-action-profile + distribution: 'temurin' + - name: verify core + working-directory: core + run: mvn verify -P github-verify-action-profile - name: Upload coverage reports to Codecov uses: codecov/codecov-action@v3 with: diff --git a/.github/workflows/generator-generate.yaml b/.github/workflows/generator-generate.yaml index b358529e7..fb23daa5b 100644 --- a/.github/workflows/generator-generate.yaml +++ b/.github/workflows/generator-generate.yaml @@ -19,7 +19,7 @@ jobs: uses: actions/setup-java@v3 with: java-version: '11' - distribution: 'adopt' + distribution: 'temurin' - id: build working-directory: generator run: mvn clean install @@ -32,7 +32,9 @@ jobs: run: | mvn clean install mvn exec:java "-Dnamespace=${{ inputs.name }}" -DsdkVersion=${{ inputs.version }} "-Dspec=./specs.yaml" - cd target/sdk + - name: install sdk + working-directory: generator/openapi/target/sdk + run: | mvn clean install mvn dokka:dokka - uses: actions/upload-artifact@v3 diff --git a/.github/workflows/generator-publish-artifact.yaml b/.github/workflows/generator-publish-artifact.yaml index 4183126cb..9e857f2f5 100644 --- a/.github/workflows/generator-publish-artifact.yaml +++ b/.github/workflows/generator-publish-artifact.yaml @@ -12,15 +12,17 @@ jobs: outputs: version: ${{ steps.publish.outputs.version }} steps: - - uses: actions/download-artifact@v3 + - uses: actions/checkout@v4 + - name: Set up JDK 11 + uses: actions/setup-java@v3 with: - name: sdk - path: generator/sdk + java-version: '11' + distribution: 'temurin' - name: "JDK set-up" uses: actions/setup-java@v3 with: java-version: '11' - distribution: 'adopt' + distribution: 'temurin' server-id: oss-sonatype # Value of the distributionManagement/repository/id field of the pom.xml server-username: SONATYPE_USERNAME # env variable for username in deploy server-password: SONATYPE_PASSWORD # env variable for token in deploy @@ -28,13 +30,17 @@ jobs: gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }} # Value of the GPG private key to import gpg-passphrase: GPG_PASSPHRASE # env variable for GPG private key passphrase settings-path: ${{ github.workspace }} - - name: "Release artifacts" + - uses: actions/download-artifact@v3 + with: + name: sdk + path: generator/openapi/target/sdk + - name: Release artifacts + working-directory: generator/openapi/target/sdk env: SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }} SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }} GPG_PASSPHRASE: ${{ secrets.GPG_PRIVATE_KEY_PASSPHRASE }} run: | - cd generator/sdk if [[ "${{github.event.inputs.production_release}}" == "true" ]]; then mvn deploy --settings $GITHUB_WORKSPACE/settings.xml -B -U -P release -DskipTests=true else diff --git a/.github/workflows/generator-verify.yaml b/.github/workflows/generator-verify.yaml index 80a2277a5..09d9471bc 100644 --- a/.github/workflows/generator-verify.yaml +++ b/.github/workflows/generator-verify.yaml @@ -15,7 +15,7 @@ jobs: uses: actions/setup-java@v3 with: java-version: '11' - distribution: 'adopt' + distribution: 'temurin' - id: build-with-maven working-directory: generator run: mvn clean install -P github-generate-action-profile @@ -41,9 +41,7 @@ jobs: uses: actions/setup-java@v3 with: java-version: '11' - distribution: 'adopt' - - name: Set up core - run: mvn clean install + distribution: 'temurin' - name: verify generated sdk working-directory: generator/openapi/target/sdk run: mvn verify diff --git a/CHANGELOG.md b/CHANGELOG.md index b859fb35f..f1abb57f6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ -# Open World SDK Core Change Log +# Expedia Group SDK Core Change Log All notable changes to this project will be documented in this file. ### [0.0.1] 2022.08.xx -* Initial release \ No newline at end of file +* Initial release diff --git a/README.md b/README.md index d8b1c26cf..642932316 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ -# Open World TM SDK for Java +# Expedia GroupTM SDK for Java -The Open World SDK for Java allows Expedia Group partners to easily build Java applications that leverage the Open WorldTM platform. +The Expedia Group SDK for Java allows Expedia Group partners to easily build Java applications that leverage the Expedia GroupTM platform. ## Contributing diff --git a/core/LICENSE-HEADER.txt b/core/LICENSE-HEADER.txt new file mode 100644 index 000000000..732a2da66 --- /dev/null +++ b/core/LICENSE-HEADER.txt @@ -0,0 +1,13 @@ +Copyright (C) 2022 Expedia, Inc. + +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 + +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. \ No newline at end of file diff --git a/core/pom.xml b/core/pom.xml new file mode 100644 index 000000000..fd31bb283 --- /dev/null +++ b/core/pom.xml @@ -0,0 +1,309 @@ + + + 4.0.0 + + com.expediagroup + sdk-parent-pom + 1.0.0 + ../pom.xml + + + sdk-core + EG SDK :: Core + Core Modules of Expedia Group SDK + ${revision} + 2022 + https://github.com/ExpediaGroup/expediagroup-java-sdk-core + + + + Apache License, Version 2.0 + https://www.apache.org/licenses/LICENSE-2.0.txt + repo + A business-friendly OSS license + + + + + 1.0.0 + 19 + 19 + UTF-8 + + + + + + + + kotlin-maven-plugin + org.jetbrains.kotlin + ${kotlin.version} + + + compile-kotlin + + compile + + + + /src/main/kotlin + /src/main/java + + ${java.release} + + + + test-compile-kotlin + + test-compile + + + + src/test/kotlin + src/test/java + + ${java.release} + + + + + + kotlinx-serialization + + + + + org.jetbrains.kotlin + kotlin-maven-serialization + ${kotlin.version} + + + + + org.apache.maven.plugins + maven-antrun-plugin + ${maven.antrun.plugin.version} + + + + detekt + validate + + + + + + + + + + + + + + + + + + run + + + + + ktlint-format + compile + + + + + + + + + + run + + + + + ktlint + validate + + + + + + + + + + + run + + + + + + io.gitlab.arturbosch.detekt + detekt-cli + ${detekt.version} + + + com.pinterest + ktlint + ${ktlint.version} + + + + + + + + + + activate-kotlin + + + src/main/kotlin + + + + + + + org.jetbrains.kotlin + kotlin-stdlib + + + + + + + + org.codehaus.mojo + build-helper-maven-plugin + ${build-helper-maven-plugin.version} + + + add-kotlin-sources + generate-sources + + add-source + + + + ${project.basedir}/src/main/kotlin + + + + + add-kotlin-test-sources + generate-sources + + add-test-source + + + + ${project.basedir}/src/test/kotlin + + + + + + + + + com.github.gantsign.maven + ktlint-maven-plugin + + + + + org.apache.maven.plugins + maven-dependency-plugin + + + enforce-dependency-declarations + + + org.jetbrains:annotations + + + + org.jetbrains.kotlin:kotlin-stdlib + + org.apache.logging.log4j:log4j-api + + + + + + + + + + org.jetbrains.kotlin + kotlin-maven-plugin + + + + + + + + github-verify-action-profile + + + + + com.mycila + license-maven-plugin + ${maven.licence.plugin.version} + + + 2022 + Expedia, Inc. + + + +
LICENSE-HEADER.txt
+ + **/*.kt + +
+
+
+ + + add-license-header + validate + + format + + + true + + + + check-for-license-header + compile + + check + + + +
+
+
+
+
+
+ +
diff --git a/src/main/kotlin/com/expediagroup/openworld/sdk/core/client/BaseRapidClient.kt b/core/src/main/kotlin/com/expediagroup/sdk/core/client/BaseRapidClient.kt similarity index 75% rename from src/main/kotlin/com/expediagroup/openworld/sdk/core/client/BaseRapidClient.kt rename to core/src/main/kotlin/com/expediagroup/sdk/core/client/BaseRapidClient.kt index 5a9bf8999..7a657eeef 100644 --- a/src/main/kotlin/com/expediagroup/openworld/sdk/core/client/BaseRapidClient.kt +++ b/core/src/main/kotlin/com/expediagroup/sdk/core/client/BaseRapidClient.kt @@ -13,13 +13,13 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.expediagroup.openworld.sdk.core.client +package com.expediagroup.sdk.core.client -import com.expediagroup.openworld.sdk.core.configuration.RapidClientConfiguration -import com.expediagroup.openworld.sdk.core.configuration.collector.ConfigurationCollector -import com.expediagroup.openworld.sdk.core.configuration.provider.ConfigurationProvider -import com.expediagroup.openworld.sdk.core.configuration.provider.RapidConfigurationProvider -import com.expediagroup.openworld.sdk.core.plugin.authentication.strategy.AuthenticationStrategy +import com.expediagroup.sdk.core.configuration.RapidClientConfiguration +import com.expediagroup.sdk.core.configuration.collector.ConfigurationCollector +import com.expediagroup.sdk.core.configuration.provider.ConfigurationProvider +import com.expediagroup.sdk.core.configuration.provider.RapidConfigurationProvider +import com.expediagroup.sdk.core.plugin.authentication.strategy.AuthenticationStrategy import io.ktor.client.HttpClient import io.ktor.client.engine.HttpClientEngine @@ -54,5 +54,5 @@ abstract class BaseRapidClient( * @property endpoint The API endpoint to use for requests. */ @Suppress("unused", "UnnecessaryAbstractClass") // This is used by the generated SDK clients. - abstract class Builder> : Client.Builder() + abstract class Builder> : com.expediagroup.sdk.core.client.Client.Builder() } diff --git a/src/main/kotlin/com/expediagroup/openworld/sdk/core/client/Client.kt b/core/src/main/kotlin/com/expediagroup/sdk/core/client/Client.kt similarity index 69% rename from src/main/kotlin/com/expediagroup/openworld/sdk/core/client/Client.kt rename to core/src/main/kotlin/com/expediagroup/sdk/core/client/Client.kt index 2246430c3..3791dbaaf 100644 --- a/src/main/kotlin/com/expediagroup/openworld/sdk/core/client/Client.kt +++ b/core/src/main/kotlin/com/expediagroup/sdk/core/client/Client.kt @@ -13,36 +13,36 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.expediagroup.openworld.sdk.core.client - -import com.expediagroup.openworld.sdk.core.configuration.Credentials -import com.expediagroup.openworld.sdk.core.configuration.provider.ConfigurationProvider -import com.expediagroup.openworld.sdk.core.constant.ConfigurationName -import com.expediagroup.openworld.sdk.core.constant.Constant -import com.expediagroup.openworld.sdk.core.constant.provider.ExceptionMessageProvider.getMissingRequiredConfigurationMessage -import com.expediagroup.openworld.sdk.core.constant.provider.LoggingMessageProvider -import com.expediagroup.openworld.sdk.core.contract.Contract -import com.expediagroup.openworld.sdk.core.contract.adhereTo -import com.expediagroup.openworld.sdk.core.model.exception.client.OpenWorldConfigurationException -import com.expediagroup.openworld.sdk.core.model.exception.service.OpenWorldAuthException -import com.expediagroup.openworld.sdk.core.plugin.Hooks -import com.expediagroup.openworld.sdk.core.plugin.authentication.AuthenticationConfiguration -import com.expediagroup.openworld.sdk.core.plugin.authentication.AuthenticationHookFactory -import com.expediagroup.openworld.sdk.core.plugin.authentication.AuthenticationPlugin -import com.expediagroup.openworld.sdk.core.plugin.authentication.strategy.AuthenticationStrategy -import com.expediagroup.openworld.sdk.core.plugin.encoding.EncodingConfiguration -import com.expediagroup.openworld.sdk.core.plugin.encoding.EncodingPlugin -import com.expediagroup.openworld.sdk.core.plugin.hooks -import com.expediagroup.openworld.sdk.core.plugin.httptimeout.HttpTimeoutConfiguration -import com.expediagroup.openworld.sdk.core.plugin.httptimeout.HttpTimeoutPlugin -import com.expediagroup.openworld.sdk.core.plugin.logging.LoggingConfiguration -import com.expediagroup.openworld.sdk.core.plugin.logging.LoggingPlugin -import com.expediagroup.openworld.sdk.core.plugin.logging.OpenWorldLoggerFactory -import com.expediagroup.openworld.sdk.core.plugin.plugins -import com.expediagroup.openworld.sdk.core.plugin.request.DefaultRequestConfiguration -import com.expediagroup.openworld.sdk.core.plugin.request.DefaultRequestPlugin -import com.expediagroup.openworld.sdk.core.plugin.serialization.SerializationConfiguration -import com.expediagroup.openworld.sdk.core.plugin.serialization.SerializationPlugin +package com.expediagroup.sdk.core.client + +import com.expediagroup.sdk.core.configuration.Credentials +import com.expediagroup.sdk.core.configuration.provider.ConfigurationProvider +import com.expediagroup.sdk.core.constant.ConfigurationName +import com.expediagroup.sdk.core.constant.Constant +import com.expediagroup.sdk.core.constant.provider.ExceptionMessageProvider.getMissingRequiredConfigurationMessage +import com.expediagroup.sdk.core.constant.provider.LoggingMessageProvider +import com.expediagroup.sdk.core.contract.Contract +import com.expediagroup.sdk.core.contract.adhereTo +import com.expediagroup.sdk.core.model.exception.client.ExpediaGroupConfigurationException +import com.expediagroup.sdk.core.model.exception.service.ExpediaGroupAuthException +import com.expediagroup.sdk.core.plugin.Hooks +import com.expediagroup.sdk.core.plugin.authentication.AuthenticationConfiguration +import com.expediagroup.sdk.core.plugin.authentication.AuthenticationHookFactory +import com.expediagroup.sdk.core.plugin.authentication.AuthenticationPlugin +import com.expediagroup.sdk.core.plugin.authentication.strategy.AuthenticationStrategy +import com.expediagroup.sdk.core.plugin.encoding.EncodingConfiguration +import com.expediagroup.sdk.core.plugin.encoding.EncodingPlugin +import com.expediagroup.sdk.core.plugin.hooks +import com.expediagroup.sdk.core.plugin.httptimeout.HttpTimeoutConfiguration +import com.expediagroup.sdk.core.plugin.httptimeout.HttpTimeoutPlugin +import com.expediagroup.sdk.core.plugin.logging.ExpediaGroupLoggerFactory +import com.expediagroup.sdk.core.plugin.logging.LoggingConfiguration +import com.expediagroup.sdk.core.plugin.logging.LoggingPlugin +import com.expediagroup.sdk.core.plugin.plugins +import com.expediagroup.sdk.core.plugin.request.DefaultRequestConfiguration +import com.expediagroup.sdk.core.plugin.request.DefaultRequestPlugin +import com.expediagroup.sdk.core.plugin.serialization.SerializationConfiguration +import com.expediagroup.sdk.core.plugin.serialization.SerializationPlugin import io.ktor.client.HttpClient import io.ktor.client.engine.HttpClientEngine import io.ktor.client.engine.okhttp.OkHttp @@ -55,7 +55,7 @@ val DEFAULT_HTTP_CLIENT_ENGINE: HttpClientEngine = OkHttp.create() */ abstract class Client { companion object { - private val log = OpenWorldLoggerFactory.getLogger(this::class.java) + private val log = ExpediaGroupLoggerFactory.getLogger(this::class.java) } /** @@ -98,10 +98,10 @@ abstract class Client { } /** Throw an exception if the configuration is missing. */ - private fun fireMissingConfigurationIssue(configurationKey: String): Nothing = throw OpenWorldConfigurationException(getMissingRequiredConfigurationMessage(configurationKey)) + private fun fireMissingConfigurationIssue(configurationKey: String): Nothing = throw ExpediaGroupConfigurationException(getMissingRequiredConfigurationMessage(configurationKey)) /** Throw an exception if the authentication fails. */ - fun fireAuthIssue(message: String): Nothing = throw OpenWorldAuthException(message) + fun fireAuthIssue(message: String): Nothing = throw ExpediaGroupAuthException(message) private fun isNotSuccessfulResponse(response: HttpResponse) = response.status.value !in Constant.SUCCESSFUL_STATUS_CODES_RANGE diff --git a/src/main/kotlin/com/expediagroup/openworld/sdk/core/client/OpenWorldClient.kt b/core/src/main/kotlin/com/expediagroup/sdk/core/client/ExpediaGroupClient.kt similarity index 76% rename from src/main/kotlin/com/expediagroup/openworld/sdk/core/client/OpenWorldClient.kt rename to core/src/main/kotlin/com/expediagroup/sdk/core/client/ExpediaGroupClient.kt index 8014e2255..8cc93ff33 100644 --- a/src/main/kotlin/com/expediagroup/openworld/sdk/core/client/OpenWorldClient.kt +++ b/core/src/main/kotlin/com/expediagroup/sdk/core/client/ExpediaGroupClient.kt @@ -13,13 +13,13 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.expediagroup.openworld.sdk.core.client +package com.expediagroup.sdk.core.client -import com.expediagroup.openworld.sdk.core.configuration.OpenWorldClientConfiguration -import com.expediagroup.openworld.sdk.core.configuration.collector.ConfigurationCollector -import com.expediagroup.openworld.sdk.core.configuration.provider.ConfigurationProvider -import com.expediagroup.openworld.sdk.core.configuration.provider.OpenWorldConfigurationProvider -import com.expediagroup.openworld.sdk.core.plugin.authentication.strategy.AuthenticationStrategy +import com.expediagroup.sdk.core.configuration.ExpediaGroupClientConfiguration +import com.expediagroup.sdk.core.configuration.collector.ConfigurationCollector +import com.expediagroup.sdk.core.configuration.provider.ConfigurationProvider +import com.expediagroup.sdk.core.configuration.provider.ExpediaGroupConfigurationProvider +import com.expediagroup.sdk.core.plugin.authentication.strategy.AuthenticationStrategy import io.ktor.client.HttpClient import io.ktor.client.engine.HttpClientEngine @@ -29,13 +29,13 @@ import io.ktor.client.engine.HttpClientEngine * @param httpClientEngine The HTTP client engine to use. * @param clientConfiguration The configuration for the client. */ -abstract class OpenWorldClient( - clientConfiguration: OpenWorldClientConfiguration, +abstract class ExpediaGroupClient( + clientConfiguration: ExpediaGroupClientConfiguration, httpClientEngine: HttpClientEngine = DEFAULT_HTTP_CLIENT_ENGINE ) : Client() { private val configurationProvider: ConfigurationProvider = ConfigurationCollector.create( clientConfiguration.toProvider(), - OpenWorldConfigurationProvider + ExpediaGroupConfigurationProvider ) private val _httpClient: HttpClient = buildHttpClient(configurationProvider, AuthenticationStrategy.AuthenticationType.BEARER, httpClientEngine) @@ -47,7 +47,7 @@ abstract class OpenWorldClient( get() = _httpClient /** - * An [OpenWorldClient] builder. + * An [ExpediaGroupClient] builder. * * @property key The API key to use for requests. * @property secret The API secret to use for requests. diff --git a/src/main/kotlin/com/expediagroup/openworld/sdk/core/config/Config.kt b/core/src/main/kotlin/com/expediagroup/sdk/core/config/Config.kt similarity index 89% rename from src/main/kotlin/com/expediagroup/openworld/sdk/core/config/Config.kt rename to core/src/main/kotlin/com/expediagroup/sdk/core/config/Config.kt index 549a86f1f..08c371fd5 100644 --- a/src/main/kotlin/com/expediagroup/openworld/sdk/core/config/Config.kt +++ b/core/src/main/kotlin/com/expediagroup/sdk/core/config/Config.kt @@ -13,11 +13,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.expediagroup.openworld.sdk.core.config +package com.expediagroup.sdk.core.config -import com.expediagroup.openworld.sdk.core.config.provider.ConfigurationData -import com.expediagroup.openworld.sdk.core.constant.provider.ExceptionMessageProvider.getConfigurationUnknownMessage -import com.expediagroup.openworld.sdk.core.model.exception.OpenWorldException +import com.expediagroup.sdk.core.config.provider.ConfigurationData +import com.expediagroup.sdk.core.constant.provider.ExceptionMessageProvider.getConfigurationUnknownMessage +import com.expediagroup.sdk.core.model.exception.ExpediaGroupException /** * @property configurationData deserialized configuration data which needs to be parsed @@ -41,7 +41,7 @@ class Config( */ operator fun get(key: String): Any { if (!configurations.containsKey(key)) { - throw OpenWorldException(getConfigurationUnknownMessage(key)) + throw ExpediaGroupException(getConfigurationUnknownMessage(key)) } return configurations[key]!! diff --git a/src/main/kotlin/com/expediagroup/openworld/sdk/core/config/ConfigurationDefinition.kt b/core/src/main/kotlin/com/expediagroup/sdk/core/config/ConfigurationDefinition.kt similarity index 79% rename from src/main/kotlin/com/expediagroup/openworld/sdk/core/config/ConfigurationDefinition.kt rename to core/src/main/kotlin/com/expediagroup/sdk/core/config/ConfigurationDefinition.kt index 1c6a0a98b..8a8919b0c 100644 --- a/src/main/kotlin/com/expediagroup/openworld/sdk/core/config/ConfigurationDefinition.kt +++ b/core/src/main/kotlin/com/expediagroup/sdk/core/config/ConfigurationDefinition.kt @@ -13,14 +13,14 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.expediagroup.openworld.sdk.core.config - -import com.expediagroup.openworld.sdk.core.constant.provider.ExceptionMessageProvider.getConfigurationDefinedMultipleTimesMessage -import com.expediagroup.openworld.sdk.core.constant.provider.ExceptionMessageProvider.getConfigurationKeyNotDefinedMessage -import com.expediagroup.openworld.sdk.core.constant.provider.ExceptionMessageProvider.getExpectedActualNameValueMessage -import com.expediagroup.openworld.sdk.core.constant.provider.ExceptionMessageProvider.getExpectedNameValueMessage -import com.expediagroup.openworld.sdk.core.constant.provider.ExceptionMessageProvider.getRequiredConfigurationsNotDefinedMessage -import com.expediagroup.openworld.sdk.core.model.exception.OpenWorldException +package com.expediagroup.sdk.core.config + +import com.expediagroup.sdk.core.constant.provider.ExceptionMessageProvider.getConfigurationDefinedMultipleTimesMessage +import com.expediagroup.sdk.core.constant.provider.ExceptionMessageProvider.getConfigurationKeyNotDefinedMessage +import com.expediagroup.sdk.core.constant.provider.ExceptionMessageProvider.getExpectedActualNameValueMessage +import com.expediagroup.sdk.core.constant.provider.ExceptionMessageProvider.getExpectedNameValueMessage +import com.expediagroup.sdk.core.constant.provider.ExceptionMessageProvider.getRequiredConfigurationsNotDefinedMessage +import com.expediagroup.sdk.core.model.exception.ExpediaGroupException import java.util.* /** @@ -32,7 +32,7 @@ class ConfigurationDefinition { private fun define(key: ConfigurationKey): ConfigurationDefinition { if (configKeys.containsKey(key.name)) { - throw OpenWorldException(getConfigurationDefinedMultipleTimesMessage(key.name)) + throw ExpediaGroupException(getConfigurationDefinedMultipleTimesMessage(key.name)) } configKeys[key.name] = key return this @@ -79,7 +79,7 @@ class ConfigurationDefinition { */ fun get(name: String): ConfigurationKey = - configKeys[name] ?: throw OpenWorldException(getConfigurationKeyNotDefinedMessage(name)) + configKeys[name] ?: throw ExpediaGroupException(getConfigurationKeyNotDefinedMessage(name)) /** * Parses the configuration values based on the defined keys. @@ -91,7 +91,7 @@ class ConfigurationDefinition { // Check all configurations are defined val undefinedConfigKeys: List = undefinedConfigs(props) if (undefinedConfigKeys.isNotEmpty()) { - throw OpenWorldException(getRequiredConfigurationsNotDefinedMessage(undefinedConfigKeys.joinToString(","))) + throw ExpediaGroupException(getRequiredConfigurationsNotDefinedMessage(undefinedConfigKeys.joinToString(","))) } // parse all known keys val values: MutableMap = HashMap() @@ -128,37 +128,37 @@ class ConfigurationDefinition { private fun parseBoolean(value: Any, name: String): Boolean { toBooleanOrNull(value)?.let { return it } - throw OpenWorldException(getExpectedNameValueMessage("boolean", name, value)) + throw ExpediaGroupException(getExpectedNameValueMessage("boolean", name, value)) } private fun parsePassword(value: Any, name: String): ConfigurationKey.Password { toPasswordOrNull(value)?.let { return it } - throw OpenWorldException(getExpectedActualNameValueMessage("string", value.javaClass.name, name, value)) + throw ExpediaGroupException(getExpectedActualNameValueMessage("string", value.javaClass.name, name, value)) } private fun parseString(value: Any, name: String): String { toStringOrNull(value)?.let { return it } - throw OpenWorldException(getExpectedActualNameValueMessage("string", value.javaClass.name, name, value)) + throw ExpediaGroupException(getExpectedActualNameValueMessage("string", value.javaClass.name, name, value)) } private fun parseInt(value: Any, name: String): Int { toIntOrNull(value)?.let { return it } - throw OpenWorldException(getExpectedActualNameValueMessage("32-bit integer", value.javaClass.name, name, value)) + throw ExpediaGroupException(getExpectedActualNameValueMessage("32-bit integer", value.javaClass.name, name, value)) } private fun parseDouble(value: Any, name: String): Double { toDoubleOrNull(value)?.let { return it } - throw OpenWorldException(getExpectedActualNameValueMessage("double", value.javaClass.name, name, value)) + throw ExpediaGroupException(getExpectedActualNameValueMessage("double", value.javaClass.name, name, value)) } private fun parseList(value: Any, name: String): List<*> { toListOrNull(value)?.let { return it } - throw OpenWorldException(getExpectedNameValueMessage("comma-separated list", name, value)) + throw ExpediaGroupException(getExpectedNameValueMessage("comma-separated list", name, value)) } private fun toBooleanOrNull(value: Any): Boolean? = when (value) { diff --git a/src/main/kotlin/com/expediagroup/openworld/sdk/core/config/ConfigurationKey.kt b/core/src/main/kotlin/com/expediagroup/sdk/core/config/ConfigurationKey.kt similarity index 97% rename from src/main/kotlin/com/expediagroup/openworld/sdk/core/config/ConfigurationKey.kt rename to core/src/main/kotlin/com/expediagroup/sdk/core/config/ConfigurationKey.kt index 42fafd317..5ddcb6d5c 100644 --- a/src/main/kotlin/com/expediagroup/openworld/sdk/core/config/ConfigurationKey.kt +++ b/core/src/main/kotlin/com/expediagroup/sdk/core/config/ConfigurationKey.kt @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.expediagroup.openworld.sdk.core.config +package com.expediagroup.sdk.core.config /** * A key of a configuration property. diff --git a/src/main/kotlin/com/expediagroup/openworld/sdk/core/config/package-info.java b/core/src/main/kotlin/com/expediagroup/sdk/core/config/package-info.java similarity index 64% rename from src/main/kotlin/com/expediagroup/openworld/sdk/core/config/package-info.java rename to core/src/main/kotlin/com/expediagroup/sdk/core/config/package-info.java index 854f03ab0..f66d0e4fe 100644 --- a/src/main/kotlin/com/expediagroup/openworld/sdk/core/config/package-info.java +++ b/core/src/main/kotlin/com/expediagroup/sdk/core/config/package-info.java @@ -1,3 +1,3 @@ -package com.expediagroup.openworld.sdk.core.config; +package com.expediagroup.sdk.core.config; // TODO: WiP - this package will be moved and merged with the existing Configuration package. diff --git a/src/main/kotlin/com/expediagroup/openworld/sdk/core/config/provider/ConfigurationChangeCallback.kt b/core/src/main/kotlin/com/expediagroup/sdk/core/config/provider/ConfigurationChangeCallback.kt similarity index 94% rename from src/main/kotlin/com/expediagroup/openworld/sdk/core/config/provider/ConfigurationChangeCallback.kt rename to core/src/main/kotlin/com/expediagroup/sdk/core/config/provider/ConfigurationChangeCallback.kt index f4e54ddfe..4292d6840 100644 --- a/src/main/kotlin/com/expediagroup/openworld/sdk/core/config/provider/ConfigurationChangeCallback.kt +++ b/core/src/main/kotlin/com/expediagroup/sdk/core/config/provider/ConfigurationChangeCallback.kt @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.expediagroup.openworld.sdk.core.config.provider +package com.expediagroup.sdk.core.config.provider /** * A callback passed to [ConfigurationProvider] for subscribing to changes. diff --git a/src/main/kotlin/com/expediagroup/openworld/sdk/core/config/provider/ConfigurationData.kt b/core/src/main/kotlin/com/expediagroup/sdk/core/config/provider/ConfigurationData.kt similarity index 95% rename from src/main/kotlin/com/expediagroup/openworld/sdk/core/config/provider/ConfigurationData.kt rename to core/src/main/kotlin/com/expediagroup/sdk/core/config/provider/ConfigurationData.kt index d04dde222..52281288f 100644 --- a/src/main/kotlin/com/expediagroup/openworld/sdk/core/config/provider/ConfigurationData.kt +++ b/core/src/main/kotlin/com/expediagroup/sdk/core/config/provider/ConfigurationData.kt @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.expediagroup.openworld.sdk.core.config.provider +package com.expediagroup.sdk.core.config.provider /** * Creates a new ConfigData with the given data. diff --git a/src/main/kotlin/com/expediagroup/openworld/sdk/core/config/provider/ConfigurationProvider.kt b/core/src/main/kotlin/com/expediagroup/sdk/core/config/provider/ConfigurationProvider.kt similarity index 95% rename from src/main/kotlin/com/expediagroup/openworld/sdk/core/config/provider/ConfigurationProvider.kt rename to core/src/main/kotlin/com/expediagroup/sdk/core/config/provider/ConfigurationProvider.kt index 188bbb821..b1c53dfe8 100644 --- a/src/main/kotlin/com/expediagroup/openworld/sdk/core/config/provider/ConfigurationProvider.kt +++ b/core/src/main/kotlin/com/expediagroup/sdk/core/config/provider/ConfigurationProvider.kt @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.expediagroup.openworld.sdk.core.config.provider +package com.expediagroup.sdk.core.config.provider import java.net.URL diff --git a/src/main/kotlin/com/expediagroup/openworld/sdk/core/config/provider/FileConfigurationProvider.kt b/core/src/main/kotlin/com/expediagroup/sdk/core/config/provider/FileConfigurationProvider.kt similarity index 87% rename from src/main/kotlin/com/expediagroup/openworld/sdk/core/config/provider/FileConfigurationProvider.kt rename to core/src/main/kotlin/com/expediagroup/sdk/core/config/provider/FileConfigurationProvider.kt index c4e7318ab..659f08b03 100644 --- a/src/main/kotlin/com/expediagroup/openworld/sdk/core/config/provider/FileConfigurationProvider.kt +++ b/core/src/main/kotlin/com/expediagroup/sdk/core/config/provider/FileConfigurationProvider.kt @@ -13,10 +13,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.expediagroup.openworld.sdk.core.config.provider +package com.expediagroup.sdk.core.config.provider -import com.expediagroup.openworld.sdk.core.constant.provider.ExceptionMessageProvider.getPropertyNotFoundMessage -import com.expediagroup.openworld.sdk.core.model.exception.OpenWorldException +import com.expediagroup.sdk.core.constant.provider.ExceptionMessageProvider.getPropertyNotFoundMessage +import com.expediagroup.sdk.core.model.exception.ExpediaGroupException import java.io.BufferedReader import java.io.InputStreamReader import java.io.Reader @@ -48,7 +48,7 @@ class FileConfigurationProvider : ConfigurationProvider { return readPropsFileIntoConfigurationData(Files.newBufferedReader(Paths.get(path))) }.getOrElse { if (!optional) { - throw OpenWorldException(getPropertyNotFoundMessage(path)) + throw ExpediaGroupException(getPropertyNotFoundMessage(path)) } return emptyConfigurationData @@ -67,7 +67,7 @@ class FileConfigurationProvider : ConfigurationProvider { return runCatching { readPropsFileIntoConfigurationData(BufferedReader(InputStreamReader(url.openStream()))) }.getOrElse { - if (!optional) throw OpenWorldException(getPropertyNotFoundMessage(url)) + if (!optional) throw ExpediaGroupException(getPropertyNotFoundMessage(url)) return emptyConfigurationData } diff --git a/src/main/kotlin/com/expediagroup/openworld/sdk/core/configuration/ClientConfiguration.kt b/core/src/main/kotlin/com/expediagroup/sdk/core/configuration/ClientConfiguration.kt similarity index 86% rename from src/main/kotlin/com/expediagroup/openworld/sdk/core/configuration/ClientConfiguration.kt rename to core/src/main/kotlin/com/expediagroup/sdk/core/configuration/ClientConfiguration.kt index dff89764f..27c0d7e7b 100644 --- a/src/main/kotlin/com/expediagroup/openworld/sdk/core/configuration/ClientConfiguration.kt +++ b/core/src/main/kotlin/com/expediagroup/sdk/core/configuration/ClientConfiguration.kt @@ -13,9 +13,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.expediagroup.openworld.sdk.core.configuration +package com.expediagroup.sdk.core.configuration -import com.expediagroup.openworld.sdk.core.configuration.provider.RuntimeConfigurationProvider +import com.expediagroup.sdk.core.configuration.provider.RuntimeConfigurationProvider interface ClientConfiguration { val key: String? diff --git a/src/main/kotlin/com/expediagroup/openworld/sdk/core/configuration/Credentials.kt b/core/src/main/kotlin/com/expediagroup/sdk/core/configuration/Credentials.kt similarity index 95% rename from src/main/kotlin/com/expediagroup/openworld/sdk/core/configuration/Credentials.kt rename to core/src/main/kotlin/com/expediagroup/sdk/core/configuration/Credentials.kt index c40f5616a..fce54ca50 100644 --- a/src/main/kotlin/com/expediagroup/openworld/sdk/core/configuration/Credentials.kt +++ b/core/src/main/kotlin/com/expediagroup/sdk/core/configuration/Credentials.kt @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.expediagroup.openworld.sdk.core.configuration +package com.expediagroup.sdk.core.configuration /** * A pair of key-secret. diff --git a/src/main/kotlin/com/expediagroup/openworld/sdk/core/configuration/OpenWorldClientConfiguration.kt b/core/src/main/kotlin/com/expediagroup/sdk/core/configuration/ExpediaGroupClientConfiguration.kt similarity index 76% rename from src/main/kotlin/com/expediagroup/openworld/sdk/core/configuration/OpenWorldClientConfiguration.kt rename to core/src/main/kotlin/com/expediagroup/sdk/core/configuration/ExpediaGroupClientConfiguration.kt index f4d9cee7a..f8762b5c5 100644 --- a/src/main/kotlin/com/expediagroup/openworld/sdk/core/configuration/OpenWorldClientConfiguration.kt +++ b/core/src/main/kotlin/com/expediagroup/sdk/core/configuration/ExpediaGroupClientConfiguration.kt @@ -13,13 +13,13 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.expediagroup.openworld.sdk.core.configuration +package com.expediagroup.sdk.core.configuration -import com.expediagroup.openworld.sdk.core.client.OpenWorldClient -import com.expediagroup.openworld.sdk.core.configuration.provider.RuntimeConfigurationProvider +import com.expediagroup.sdk.core.client.ExpediaGroupClient +import com.expediagroup.sdk.core.configuration.provider.RuntimeConfigurationProvider /** - * Configuration for the [OpenWorldClient]. + * Configuration for the [ExpediaGroupClient]. * * @property key The API key to use for authentication. * @property secret The API secret to use for authentication. @@ -27,7 +27,7 @@ import com.expediagroup.openworld.sdk.core.configuration.provider.RuntimeConfigu * @param requestTimeout The request timeout to be used in milliseconds. * @property authEndpoint The API endpoint to use for authentication. */ -data class OpenWorldClientConfiguration( +data class ExpediaGroupClientConfiguration( override val key: String? = null, override val secret: String? = null, override val endpoint: String? = null, @@ -35,6 +35,6 @@ data class OpenWorldClientConfiguration( val authEndpoint: String? = null ) : ClientConfiguration { - /** Build a [RuntimeConfigurationProvider] from an [OpenWorldClientConfiguration]. */ + /** Build a [RuntimeConfigurationProvider] from an [ExpediaGroupClientConfiguration]. */ override fun toProvider(): RuntimeConfigurationProvider = super.toProvider().copy(authEndpoint = authEndpoint) } diff --git a/src/main/kotlin/com/expediagroup/openworld/sdk/core/configuration/NetworkConfiguration.kt b/core/src/main/kotlin/com/expediagroup/sdk/core/configuration/NetworkConfiguration.kt similarity index 92% rename from src/main/kotlin/com/expediagroup/openworld/sdk/core/configuration/NetworkConfiguration.kt rename to core/src/main/kotlin/com/expediagroup/sdk/core/configuration/NetworkConfiguration.kt index 0c9e9a42f..c79eea704 100644 --- a/src/main/kotlin/com/expediagroup/openworld/sdk/core/configuration/NetworkConfiguration.kt +++ b/core/src/main/kotlin/com/expediagroup/sdk/core/configuration/NetworkConfiguration.kt @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.expediagroup.openworld.sdk.core.configuration +package com.expediagroup.sdk.core.configuration internal data class NetworkConfiguration( val connectionTimeout: Long = 10_000, diff --git a/src/main/kotlin/com/expediagroup/openworld/sdk/core/configuration/RapidClientConfiguration.kt b/core/src/main/kotlin/com/expediagroup/sdk/core/configuration/RapidClientConfiguration.kt similarity index 90% rename from src/main/kotlin/com/expediagroup/openworld/sdk/core/configuration/RapidClientConfiguration.kt rename to core/src/main/kotlin/com/expediagroup/sdk/core/configuration/RapidClientConfiguration.kt index c2a6be6c7..79eb7fb14 100644 --- a/src/main/kotlin/com/expediagroup/openworld/sdk/core/configuration/RapidClientConfiguration.kt +++ b/core/src/main/kotlin/com/expediagroup/sdk/core/configuration/RapidClientConfiguration.kt @@ -13,9 +13,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.expediagroup.openworld.sdk.core.configuration +package com.expediagroup.sdk.core.configuration -import com.expediagroup.openworld.sdk.core.client.BaseRapidClient +import com.expediagroup.sdk.core.client.BaseRapidClient /** * Configuration for the [BaseRapidClient]. diff --git a/src/main/kotlin/com/expediagroup/openworld/sdk/core/configuration/collector/ConfigurationCollector.kt b/core/src/main/kotlin/com/expediagroup/sdk/core/configuration/collector/ConfigurationCollector.kt similarity index 73% rename from src/main/kotlin/com/expediagroup/openworld/sdk/core/configuration/collector/ConfigurationCollector.kt rename to core/src/main/kotlin/com/expediagroup/sdk/core/configuration/collector/ConfigurationCollector.kt index 4cd484705..3b42d2bd1 100644 --- a/src/main/kotlin/com/expediagroup/openworld/sdk/core/configuration/collector/ConfigurationCollector.kt +++ b/core/src/main/kotlin/com/expediagroup/sdk/core/configuration/collector/ConfigurationCollector.kt @@ -13,17 +13,17 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.expediagroup.openworld.sdk.core.configuration.collector +package com.expediagroup.sdk.core.configuration.collector -import com.expediagroup.openworld.sdk.core.configuration.provider.ConfigurationProvider -import com.expediagroup.openworld.sdk.core.constant.ConfigurationName.AUTH_ENDPOINT -import com.expediagroup.openworld.sdk.core.constant.ConfigurationName.CONFIGURATION_COLLECTOR -import com.expediagroup.openworld.sdk.core.constant.ConfigurationName.ENDPOINT -import com.expediagroup.openworld.sdk.core.constant.ConfigurationName.KEY -import com.expediagroup.openworld.sdk.core.constant.ConfigurationName.REQUEST_TIMEOUT_MILLIS -import com.expediagroup.openworld.sdk.core.constant.ConfigurationName.SECRET -import com.expediagroup.openworld.sdk.core.constant.provider.LoggingMessageProvider -import com.expediagroup.openworld.sdk.core.plugin.logging.OpenWorldLoggerFactory +import com.expediagroup.sdk.core.configuration.provider.ConfigurationProvider +import com.expediagroup.sdk.core.constant.ConfigurationName.AUTH_ENDPOINT +import com.expediagroup.sdk.core.constant.ConfigurationName.CONFIGURATION_COLLECTOR +import com.expediagroup.sdk.core.constant.ConfigurationName.ENDPOINT +import com.expediagroup.sdk.core.constant.ConfigurationName.KEY +import com.expediagroup.sdk.core.constant.ConfigurationName.REQUEST_TIMEOUT_MILLIS +import com.expediagroup.sdk.core.constant.ConfigurationName.SECRET +import com.expediagroup.sdk.core.constant.provider.LoggingMessageProvider +import com.expediagroup.sdk.core.plugin.logging.ExpediaGroupLoggerFactory /** * Configuration collector that collects configuration from all available providers. @@ -34,7 +34,7 @@ internal class ConfigurationCollector private constructor(providers: Configurati override val name: String = CONFIGURATION_COLLECTOR companion object Factory { - private val log = OpenWorldLoggerFactory.getLogger(ConfigurationCollector::class.java) + private val log = ExpediaGroupLoggerFactory.getLogger(ConfigurationCollector::class.java) /** * Creates a new [ConfigurationCollector] with the given [providerQueue]. diff --git a/src/main/kotlin/com/expediagroup/openworld/sdk/core/configuration/collector/ConfigurationProviderQueue.kt b/core/src/main/kotlin/com/expediagroup/sdk/core/configuration/collector/ConfigurationProviderQueue.kt similarity index 92% rename from src/main/kotlin/com/expediagroup/openworld/sdk/core/configuration/collector/ConfigurationProviderQueue.kt rename to core/src/main/kotlin/com/expediagroup/sdk/core/configuration/collector/ConfigurationProviderQueue.kt index de3e2428b..108671c82 100644 --- a/src/main/kotlin/com/expediagroup/openworld/sdk/core/configuration/collector/ConfigurationProviderQueue.kt +++ b/core/src/main/kotlin/com/expediagroup/sdk/core/configuration/collector/ConfigurationProviderQueue.kt @@ -13,9 +13,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.expediagroup.openworld.sdk.core.configuration.collector +package com.expediagroup.sdk.core.configuration.collector -import com.expediagroup.openworld.sdk.core.configuration.provider.ConfigurationProvider +import com.expediagroup.sdk.core.configuration.provider.ConfigurationProvider /** * A queue of all configuration providers. diff --git a/src/main/kotlin/com/expediagroup/openworld/sdk/core/configuration/provider/ConfigurationProvider.kt b/core/src/main/kotlin/com/expediagroup/sdk/core/configuration/provider/ConfigurationProvider.kt similarity index 91% rename from src/main/kotlin/com/expediagroup/openworld/sdk/core/configuration/provider/ConfigurationProvider.kt rename to core/src/main/kotlin/com/expediagroup/sdk/core/configuration/provider/ConfigurationProvider.kt index faa97cf2f..c2e0a9495 100644 --- a/src/main/kotlin/com/expediagroup/openworld/sdk/core/configuration/provider/ConfigurationProvider.kt +++ b/core/src/main/kotlin/com/expediagroup/sdk/core/configuration/provider/ConfigurationProvider.kt @@ -13,9 +13,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.expediagroup.openworld.sdk.core.configuration.provider +package com.expediagroup.sdk.core.configuration.provider -import com.expediagroup.openworld.sdk.core.constant.Constant +import com.expediagroup.sdk.core.constant.Constant /** * A configuration provider that can be used to provide configuration values. diff --git a/src/main/kotlin/com/expediagroup/openworld/sdk/core/configuration/provider/OpenWorldConfigurationProvider.kt b/core/src/main/kotlin/com/expediagroup/sdk/core/configuration/provider/ExpediaGroupConfigurationProvider.kt similarity index 59% rename from src/main/kotlin/com/expediagroup/openworld/sdk/core/configuration/provider/OpenWorldConfigurationProvider.kt rename to core/src/main/kotlin/com/expediagroup/sdk/core/configuration/provider/ExpediaGroupConfigurationProvider.kt index f6617d731..4219b1bd1 100644 --- a/src/main/kotlin/com/expediagroup/openworld/sdk/core/configuration/provider/OpenWorldConfigurationProvider.kt +++ b/core/src/main/kotlin/com/expediagroup/sdk/core/configuration/provider/ExpediaGroupConfigurationProvider.kt @@ -13,23 +13,23 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.expediagroup.openworld.sdk.core.configuration.provider +package com.expediagroup.sdk.core.configuration.provider -import com.expediagroup.openworld.sdk.core.configuration.provider.OpenWorldConfigurationProvider.authEndpoint -import com.expediagroup.openworld.sdk.core.configuration.provider.OpenWorldConfigurationProvider.endpoint -import com.expediagroup.openworld.sdk.core.configuration.provider.OpenWorldConfigurationProvider.name -import com.expediagroup.openworld.sdk.core.configuration.provider.OpenWorldConfigurationProvider.requestTimeout +import com.expediagroup.sdk.core.configuration.provider.ExpediaGroupConfigurationProvider.authEndpoint +import com.expediagroup.sdk.core.configuration.provider.ExpediaGroupConfigurationProvider.endpoint +import com.expediagroup.sdk.core.configuration.provider.ExpediaGroupConfigurationProvider.name +import com.expediagroup.sdk.core.configuration.provider.ExpediaGroupConfigurationProvider.requestTimeout /** - * Default configuration provider for OpenWorld. + * Default configuration provider for ExpediaGroup. * * @property name The name of the provider. * @property endpoint The API endpoint to use for requests. * @property authEndpoint The API endpoint to use for authentication. * @property requestTimeout The API response timeout to use for requests. */ -internal object OpenWorldConfigurationProvider : ConfigurationProvider { - override val name: String = "OpenWorld Configuration Provider" +internal object ExpediaGroupConfigurationProvider : ConfigurationProvider { + override val name: String = "ExpediaGroup Configuration Provider" override val endpoint: String = "https://api.expediagroup.com/" override val authEndpoint: String = "${endpoint}identity/oauth2/v2/token/" } diff --git a/src/main/kotlin/com/expediagroup/openworld/sdk/core/configuration/provider/RapidConfigurationProvider.kt b/core/src/main/kotlin/com/expediagroup/sdk/core/configuration/provider/RapidConfigurationProvider.kt similarity index 78% rename from src/main/kotlin/com/expediagroup/openworld/sdk/core/configuration/provider/RapidConfigurationProvider.kt rename to core/src/main/kotlin/com/expediagroup/sdk/core/configuration/provider/RapidConfigurationProvider.kt index 8f8a36df8..d0fe46c71 100644 --- a/src/main/kotlin/com/expediagroup/openworld/sdk/core/configuration/provider/RapidConfigurationProvider.kt +++ b/core/src/main/kotlin/com/expediagroup/sdk/core/configuration/provider/RapidConfigurationProvider.kt @@ -13,10 +13,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.expediagroup.openworld.sdk.core.configuration.provider +package com.expediagroup.sdk.core.configuration.provider -import com.expediagroup.openworld.sdk.core.configuration.provider.RapidConfigurationProvider.endpoint -import com.expediagroup.openworld.sdk.core.configuration.provider.RapidConfigurationProvider.name +import com.expediagroup.sdk.core.configuration.provider.RapidConfigurationProvider.endpoint +import com.expediagroup.sdk.core.configuration.provider.RapidConfigurationProvider.name /** * Default configuration provider for Rapid. diff --git a/src/main/kotlin/com/expediagroup/openworld/sdk/core/configuration/provider/RuntimeConfigurationProvider.kt b/core/src/main/kotlin/com/expediagroup/sdk/core/configuration/provider/RuntimeConfigurationProvider.kt similarity index 89% rename from src/main/kotlin/com/expediagroup/openworld/sdk/core/configuration/provider/RuntimeConfigurationProvider.kt rename to core/src/main/kotlin/com/expediagroup/sdk/core/configuration/provider/RuntimeConfigurationProvider.kt index b23b63aab..751fc0715 100644 --- a/src/main/kotlin/com/expediagroup/openworld/sdk/core/configuration/provider/RuntimeConfigurationProvider.kt +++ b/core/src/main/kotlin/com/expediagroup/sdk/core/configuration/provider/RuntimeConfigurationProvider.kt @@ -13,9 +13,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.expediagroup.openworld.sdk.core.configuration.provider +package com.expediagroup.sdk.core.configuration.provider -import com.expediagroup.openworld.sdk.core.constant.ConfigurationName.RUNTIME_CONFIGURATION_PROVIDER +import com.expediagroup.sdk.core.constant.ConfigurationName.RUNTIME_CONFIGURATION_PROVIDER /** * A runtime-built configuration provider. diff --git a/src/main/kotlin/com/expediagroup/openworld/sdk/core/constant/Authentication.kt b/core/src/main/kotlin/com/expediagroup/sdk/core/constant/Authentication.kt similarity index 94% rename from src/main/kotlin/com/expediagroup/openworld/sdk/core/constant/Authentication.kt rename to core/src/main/kotlin/com/expediagroup/sdk/core/constant/Authentication.kt index d0c2e1519..17fe5d090 100644 --- a/src/main/kotlin/com/expediagroup/openworld/sdk/core/constant/Authentication.kt +++ b/core/src/main/kotlin/com/expediagroup/sdk/core/constant/Authentication.kt @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.expediagroup.openworld.sdk.core.constant +package com.expediagroup.sdk.core.constant internal object Authentication { const val AUTHORIZATION_REQUEST_LOCK_DELAY = 20L diff --git a/src/main/kotlin/com/expediagroup/openworld/sdk/core/constant/ConfigurationName.kt b/core/src/main/kotlin/com/expediagroup/sdk/core/constant/ConfigurationName.kt similarity index 94% rename from src/main/kotlin/com/expediagroup/openworld/sdk/core/constant/ConfigurationName.kt rename to core/src/main/kotlin/com/expediagroup/sdk/core/constant/ConfigurationName.kt index 7e6a97697..e30ff2502 100644 --- a/src/main/kotlin/com/expediagroup/openworld/sdk/core/constant/ConfigurationName.kt +++ b/core/src/main/kotlin/com/expediagroup/sdk/core/constant/ConfigurationName.kt @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.expediagroup.openworld.sdk.core.constant +package com.expediagroup.sdk.core.constant internal object ConfigurationName { const val KEY = "key" diff --git a/src/main/kotlin/com/expediagroup/openworld/sdk/core/constant/Constant.kt b/core/src/main/kotlin/com/expediagroup/sdk/core/constant/Constant.kt similarity index 94% rename from src/main/kotlin/com/expediagroup/openworld/sdk/core/constant/Constant.kt rename to core/src/main/kotlin/com/expediagroup/sdk/core/constant/Constant.kt index 029d9e871..dc3195134 100644 --- a/src/main/kotlin/com/expediagroup/openworld/sdk/core/constant/Constant.kt +++ b/core/src/main/kotlin/com/expediagroup/sdk/core/constant/Constant.kt @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.expediagroup.openworld.sdk.core.constant +package com.expediagroup.sdk.core.constant internal object Constant { const val EMPTY_STRING = "" diff --git a/src/main/kotlin/com/expediagroup/openworld/sdk/core/constant/ExceptionMessage.kt b/core/src/main/kotlin/com/expediagroup/sdk/core/constant/ExceptionMessage.kt similarity index 93% rename from src/main/kotlin/com/expediagroup/openworld/sdk/core/constant/ExceptionMessage.kt rename to core/src/main/kotlin/com/expediagroup/sdk/core/constant/ExceptionMessage.kt index b84899b05..6f4f9c443 100644 --- a/src/main/kotlin/com/expediagroup/openworld/sdk/core/constant/ExceptionMessage.kt +++ b/core/src/main/kotlin/com/expediagroup/sdk/core/constant/ExceptionMessage.kt @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.expediagroup.openworld.sdk.core.constant +package com.expediagroup.sdk.core.constant internal object ExceptionMessage { const val AUTHENTICATION_FAILURE = "Unable to authenticate" diff --git a/src/main/kotlin/com/expediagroup/openworld/sdk/core/constant/HeaderKey.kt b/core/src/main/kotlin/com/expediagroup/sdk/core/constant/HeaderKey.kt similarity index 93% rename from src/main/kotlin/com/expediagroup/openworld/sdk/core/constant/HeaderKey.kt rename to core/src/main/kotlin/com/expediagroup/sdk/core/constant/HeaderKey.kt index cc947f6fd..48192bf85 100644 --- a/src/main/kotlin/com/expediagroup/openworld/sdk/core/constant/HeaderKey.kt +++ b/core/src/main/kotlin/com/expediagroup/sdk/core/constant/HeaderKey.kt @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.expediagroup.openworld.sdk.core.constant +package com.expediagroup.sdk.core.constant internal object HeaderKey { const val AUTHORIZATION = "Authorization" diff --git a/src/main/kotlin/com/expediagroup/openworld/sdk/core/constant/HeaderValue.kt b/core/src/main/kotlin/com/expediagroup/sdk/core/constant/HeaderValue.kt similarity index 92% rename from src/main/kotlin/com/expediagroup/openworld/sdk/core/constant/HeaderValue.kt rename to core/src/main/kotlin/com/expediagroup/sdk/core/constant/HeaderValue.kt index e3d373a08..b70011d5d 100644 --- a/src/main/kotlin/com/expediagroup/openworld/sdk/core/constant/HeaderValue.kt +++ b/core/src/main/kotlin/com/expediagroup/sdk/core/constant/HeaderValue.kt @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.expediagroup.openworld.sdk.core.constant +package com.expediagroup.sdk.core.constant internal object HeaderValue { const val CLIENT_CREDENTIALS = "client_credentials" diff --git a/src/main/kotlin/com/expediagroup/openworld/sdk/core/constant/Key.kt b/core/src/main/kotlin/com/expediagroup/sdk/core/constant/Key.kt similarity index 93% rename from src/main/kotlin/com/expediagroup/openworld/sdk/core/constant/Key.kt rename to core/src/main/kotlin/com/expediagroup/sdk/core/constant/Key.kt index 07679507a..a7a71ca1c 100644 --- a/src/main/kotlin/com/expediagroup/openworld/sdk/core/constant/Key.kt +++ b/core/src/main/kotlin/com/expediagroup/sdk/core/constant/Key.kt @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.expediagroup.openworld.sdk.core.constant +package com.expediagroup.sdk.core.constant internal object Key { const val CLIENT_KEY = "client_key" diff --git a/src/main/kotlin/com/expediagroup/openworld/sdk/core/constant/LogMaskingRegex.kt b/core/src/main/kotlin/com/expediagroup/sdk/core/constant/LogMaskingRegex.kt similarity index 67% rename from src/main/kotlin/com/expediagroup/openworld/sdk/core/constant/LogMaskingRegex.kt rename to core/src/main/kotlin/com/expediagroup/sdk/core/constant/LogMaskingRegex.kt index 23a5070a6..e34be9506 100644 --- a/src/main/kotlin/com/expediagroup/openworld/sdk/core/constant/LogMaskingRegex.kt +++ b/core/src/main/kotlin/com/expediagroup/sdk/core/constant/LogMaskingRegex.kt @@ -13,12 +13,12 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.expediagroup.openworld.sdk.core.constant +package com.expediagroup.sdk.core.constant -import com.expediagroup.openworld.sdk.core.constant.Authentication.BASIC -import com.expediagroup.openworld.sdk.core.constant.Authentication.BEARER -import com.expediagroup.openworld.sdk.core.constant.Authentication.EAN -import com.expediagroup.openworld.sdk.core.constant.HeaderKey.AUTHORIZATION +import com.expediagroup.sdk.core.constant.Authentication.BASIC +import com.expediagroup.sdk.core.constant.Authentication.BEARER +import com.expediagroup.sdk.core.constant.Authentication.EAN +import com.expediagroup.sdk.core.constant.HeaderKey.AUTHORIZATION internal object LogMaskingRegex { val AUTHORIZATION_REGEX: Regex = "(?<=$AUTHORIZATION: ($EAN|$BASIC|$BEARER|)\\s)\\S+".toRegex() diff --git a/src/main/kotlin/com/expediagroup/openworld/sdk/core/constant/LoggingMessage.kt b/core/src/main/kotlin/com/expediagroup/sdk/core/constant/LoggingMessage.kt similarity index 95% rename from src/main/kotlin/com/expediagroup/openworld/sdk/core/constant/LoggingMessage.kt rename to core/src/main/kotlin/com/expediagroup/sdk/core/constant/LoggingMessage.kt index 491af77fe..7a8d6320b 100644 --- a/src/main/kotlin/com/expediagroup/openworld/sdk/core/constant/LoggingMessage.kt +++ b/core/src/main/kotlin/com/expediagroup/sdk/core/constant/LoggingMessage.kt @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.expediagroup.openworld.sdk.core.constant +package com.expediagroup.sdk.core.constant internal object LoggingMessage { const val LOGGING_PREFIX = "ExpediaSDK:" diff --git a/src/main/kotlin/com/expediagroup/openworld/sdk/core/constant/SignatureValues.kt b/core/src/main/kotlin/com/expediagroup/sdk/core/constant/SignatureValues.kt similarity index 94% rename from src/main/kotlin/com/expediagroup/openworld/sdk/core/constant/SignatureValues.kt rename to core/src/main/kotlin/com/expediagroup/sdk/core/constant/SignatureValues.kt index e7aca55b9..cdf04e37d 100644 --- a/src/main/kotlin/com/expediagroup/openworld/sdk/core/constant/SignatureValues.kt +++ b/core/src/main/kotlin/com/expediagroup/sdk/core/constant/SignatureValues.kt @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.expediagroup.openworld.sdk.core.constant +package com.expediagroup.sdk.core.constant internal object SignatureValues { const val ONE_BYTE_MASK = 0xFF diff --git a/src/main/kotlin/com/expediagroup/openworld/sdk/core/constant/provider/ExceptionMessageProvider.kt b/core/src/main/kotlin/com/expediagroup/sdk/core/constant/provider/ExceptionMessageProvider.kt similarity index 96% rename from src/main/kotlin/com/expediagroup/openworld/sdk/core/constant/provider/ExceptionMessageProvider.kt rename to core/src/main/kotlin/com/expediagroup/sdk/core/constant/provider/ExceptionMessageProvider.kt index 3cce9a548..edfd6c3d4 100644 --- a/src/main/kotlin/com/expediagroup/openworld/sdk/core/constant/provider/ExceptionMessageProvider.kt +++ b/core/src/main/kotlin/com/expediagroup/sdk/core/constant/provider/ExceptionMessageProvider.kt @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.expediagroup.openworld.sdk.core.constant.provider +package com.expediagroup.sdk.core.constant.provider internal object ExceptionMessageProvider { fun getConfigurationDefinedMultipleTimesMessage(configurationName: String): String = diff --git a/src/main/kotlin/com/expediagroup/openworld/sdk/core/constant/provider/LoggingMessageProvider.kt b/core/src/main/kotlin/com/expediagroup/sdk/core/constant/provider/LoggingMessageProvider.kt similarity index 94% rename from src/main/kotlin/com/expediagroup/openworld/sdk/core/constant/provider/LoggingMessageProvider.kt rename to core/src/main/kotlin/com/expediagroup/sdk/core/constant/provider/LoggingMessageProvider.kt index 7dc50ea39..2cfe189ae 100644 --- a/src/main/kotlin/com/expediagroup/openworld/sdk/core/constant/provider/LoggingMessageProvider.kt +++ b/core/src/main/kotlin/com/expediagroup/sdk/core/constant/provider/LoggingMessageProvider.kt @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.expediagroup.openworld.sdk.core.constant.provider +package com.expediagroup.sdk.core.constant.provider import io.ktor.http.HttpStatusCode diff --git a/src/main/kotlin/com/expediagroup/openworld/sdk/core/contract/Contract.kt b/core/src/main/kotlin/com/expediagroup/sdk/core/contract/Contract.kt similarity index 95% rename from src/main/kotlin/com/expediagroup/openworld/sdk/core/contract/Contract.kt rename to core/src/main/kotlin/com/expediagroup/sdk/core/contract/Contract.kt index 298714388..6527759ca 100644 --- a/src/main/kotlin/com/expediagroup/openworld/sdk/core/contract/Contract.kt +++ b/core/src/main/kotlin/com/expediagroup/sdk/core/contract/Contract.kt @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.expediagroup.openworld.sdk.core.contract +package com.expediagroup.sdk.core.contract internal typealias Operation = (String) -> String diff --git a/src/main/kotlin/com/expediagroup/openworld/sdk/core/model/exception/OpenWorldException.kt b/core/src/main/kotlin/com/expediagroup/sdk/core/model/exception/ExpediaGroupException.kt similarity index 84% rename from src/main/kotlin/com/expediagroup/openworld/sdk/core/model/exception/OpenWorldException.kt rename to core/src/main/kotlin/com/expediagroup/sdk/core/model/exception/ExpediaGroupException.kt index 8ac213671..cf3d8b72c 100644 --- a/src/main/kotlin/com/expediagroup/openworld/sdk/core/model/exception/OpenWorldException.kt +++ b/core/src/main/kotlin/com/expediagroup/sdk/core/model/exception/ExpediaGroupException.kt @@ -13,15 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.expediagroup.openworld.sdk.core.model.exception +package com.expediagroup.sdk.core.model.exception /** - * A base exception for all Open World exceptions. + * A base exception for all ExpediaGroup exceptions. * * @param message An optional error message. * @param cause An optional cause of the error. */ -open class OpenWorldException( +open class ExpediaGroupException( message: String? = null, cause: Throwable? = null ) : RuntimeException(message, cause) diff --git a/src/main/kotlin/com/expediagroup/openworld/sdk/core/model/exception/client/OpenWorldClientException.kt b/core/src/main/kotlin/com/expediagroup/sdk/core/model/exception/client/ExpediaGroupClientException.kt similarity index 78% rename from src/main/kotlin/com/expediagroup/openworld/sdk/core/model/exception/client/OpenWorldClientException.kt rename to core/src/main/kotlin/com/expediagroup/sdk/core/model/exception/client/ExpediaGroupClientException.kt index cada5b4d7..4ea0b2ed2 100644 --- a/src/main/kotlin/com/expediagroup/openworld/sdk/core/model/exception/client/OpenWorldClientException.kt +++ b/core/src/main/kotlin/com/expediagroup/sdk/core/model/exception/client/ExpediaGroupClientException.kt @@ -13,9 +13,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.expediagroup.openworld.sdk.core.model.exception.client +package com.expediagroup.sdk.core.model.exception.client -import com.expediagroup.openworld.sdk.core.model.exception.OpenWorldException +import com.expediagroup.sdk.core.model.exception.ExpediaGroupException /** * An exception that is thrown when a client error occurs. @@ -23,7 +23,7 @@ import com.expediagroup.openworld.sdk.core.model.exception.OpenWorldException * @param message An optional message. * @param cause An optional cause. */ -open class OpenWorldClientException( +open class ExpediaGroupClientException( message: String? = null, cause: Throwable? = null -) : OpenWorldException(message, cause) +) : ExpediaGroupException(message, cause) diff --git a/src/main/kotlin/com/expediagroup/openworld/sdk/core/model/exception/client/OpenWorldConfigurationException.kt b/core/src/main/kotlin/com/expediagroup/sdk/core/model/exception/client/ExpediaGroupConfigurationException.kt similarity index 84% rename from src/main/kotlin/com/expediagroup/openworld/sdk/core/model/exception/client/OpenWorldConfigurationException.kt rename to core/src/main/kotlin/com/expediagroup/sdk/core/model/exception/client/ExpediaGroupConfigurationException.kt index 3c3207d05..63fd9ca96 100644 --- a/src/main/kotlin/com/expediagroup/openworld/sdk/core/model/exception/client/OpenWorldConfigurationException.kt +++ b/core/src/main/kotlin/com/expediagroup/sdk/core/model/exception/client/ExpediaGroupConfigurationException.kt @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.expediagroup.openworld.sdk.core.model.exception.client +package com.expediagroup.sdk.core.model.exception.client /** * An exception that is thrown when a configuration error occurs. @@ -21,7 +21,7 @@ package com.expediagroup.openworld.sdk.core.model.exception.client * @param message An optional error message. * @param cause An optional cause of the error. */ -class OpenWorldConfigurationException( +class ExpediaGroupConfigurationException( message: String? = null, cause: Throwable? = null -) : OpenWorldClientException(message, cause) +) : ExpediaGroupClientException(message, cause) diff --git a/src/main/kotlin/com/expediagroup/openworld/sdk/core/model/exception/service/OpenWorldApiException.kt b/core/src/main/kotlin/com/expediagroup/sdk/core/model/exception/service/ExpediaGroupApiException.kt similarity index 74% rename from src/main/kotlin/com/expediagroup/openworld/sdk/core/model/exception/service/OpenWorldApiException.kt rename to core/src/main/kotlin/com/expediagroup/sdk/core/model/exception/service/ExpediaGroupApiException.kt index fbcfcd3a4..db39f1f78 100644 --- a/src/main/kotlin/com/expediagroup/openworld/sdk/core/model/exception/service/OpenWorldApiException.kt +++ b/core/src/main/kotlin/com/expediagroup/sdk/core/model/exception/service/ExpediaGroupApiException.kt @@ -13,6 +13,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.expediagroup.openworld.sdk.core.model.exception.service +package com.expediagroup.sdk.core.model.exception.service -abstract class OpenWorldApiException(val statusCode: Int, open val errorObject: Any) : OpenWorldServiceException(errorObject.toString()) +abstract class ExpediaGroupApiException(val statusCode: Int, open val errorObject: Any) : ExpediaGroupServiceException(errorObject.toString()) diff --git a/src/main/kotlin/com/expediagroup/openworld/sdk/core/model/exception/service/OpenWorldAuthException.kt b/core/src/main/kotlin/com/expediagroup/sdk/core/model/exception/service/ExpediaGroupAuthException.kt similarity index 88% rename from src/main/kotlin/com/expediagroup/openworld/sdk/core/model/exception/service/OpenWorldAuthException.kt rename to core/src/main/kotlin/com/expediagroup/sdk/core/model/exception/service/ExpediaGroupAuthException.kt index 58d0da197..fa1937aeb 100644 --- a/src/main/kotlin/com/expediagroup/openworld/sdk/core/model/exception/service/OpenWorldAuthException.kt +++ b/core/src/main/kotlin/com/expediagroup/sdk/core/model/exception/service/ExpediaGroupAuthException.kt @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.expediagroup.openworld.sdk.core.model.exception.service +package com.expediagroup.sdk.core.model.exception.service import io.ktor.http.HttpStatusCode @@ -23,10 +23,10 @@ import io.ktor.http.HttpStatusCode * @param message The error message. * @param cause The cause of the error. */ -class OpenWorldAuthException( +class ExpediaGroupAuthException( message: String? = null, cause: Throwable? = null -) : OpenWorldServiceException(message, cause) { +) : ExpediaGroupServiceException(message, cause) { /** * An exception that is thrown when an authentication error occurs. diff --git a/src/main/kotlin/com/expediagroup/openworld/sdk/core/model/exception/service/OpenWorldServiceException.kt b/core/src/main/kotlin/com/expediagroup/sdk/core/model/exception/service/ExpediaGroupServiceException.kt similarity index 78% rename from src/main/kotlin/com/expediagroup/openworld/sdk/core/model/exception/service/OpenWorldServiceException.kt rename to core/src/main/kotlin/com/expediagroup/sdk/core/model/exception/service/ExpediaGroupServiceException.kt index ce052c652..576c38d70 100644 --- a/src/main/kotlin/com/expediagroup/openworld/sdk/core/model/exception/service/OpenWorldServiceException.kt +++ b/core/src/main/kotlin/com/expediagroup/sdk/core/model/exception/service/ExpediaGroupServiceException.kt @@ -13,9 +13,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.expediagroup.openworld.sdk.core.model.exception.service +package com.expediagroup.sdk.core.model.exception.service -import com.expediagroup.openworld.sdk.core.model.exception.OpenWorldException +import com.expediagroup.sdk.core.model.exception.ExpediaGroupException /** * An exception that is thrown when a service error occurs. @@ -23,7 +23,7 @@ import com.expediagroup.openworld.sdk.core.model.exception.OpenWorldException * @param message An optional error message. * @param cause An optional cause of the error. */ -open class OpenWorldServiceException( +open class ExpediaGroupServiceException( message: String? = null, cause: Throwable? = null -) : OpenWorldException(message, cause) +) : ExpediaGroupException(message, cause) diff --git a/src/main/kotlin/com/expediagroup/openworld/sdk/core/plugin/Hook.kt b/core/src/main/kotlin/com/expediagroup/sdk/core/plugin/Hook.kt similarity index 95% rename from src/main/kotlin/com/expediagroup/openworld/sdk/core/plugin/Hook.kt rename to core/src/main/kotlin/com/expediagroup/sdk/core/plugin/Hook.kt index 4879f952e..6436ae106 100644 --- a/src/main/kotlin/com/expediagroup/openworld/sdk/core/plugin/Hook.kt +++ b/core/src/main/kotlin/com/expediagroup/sdk/core/plugin/Hook.kt @@ -13,9 +13,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.expediagroup.openworld.sdk.core.plugin +package com.expediagroup.sdk.core.plugin -import com.expediagroup.openworld.sdk.core.client.Client +import com.expediagroup.sdk.core.client.Client /** * A helper to build a hook. diff --git a/src/main/kotlin/com/expediagroup/openworld/sdk/core/plugin/Plugin.kt b/core/src/main/kotlin/com/expediagroup/sdk/core/plugin/Plugin.kt similarity index 92% rename from src/main/kotlin/com/expediagroup/openworld/sdk/core/plugin/Plugin.kt rename to core/src/main/kotlin/com/expediagroup/sdk/core/plugin/Plugin.kt index b9b2edef5..8db946c3e 100644 --- a/src/main/kotlin/com/expediagroup/openworld/sdk/core/plugin/Plugin.kt +++ b/core/src/main/kotlin/com/expediagroup/sdk/core/plugin/Plugin.kt @@ -13,9 +13,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.expediagroup.openworld.sdk.core.plugin +package com.expediagroup.sdk.core.plugin -import com.expediagroup.openworld.sdk.core.client.Client +import com.expediagroup.sdk.core.client.Client internal interface Plugin { /** Install a plugin. */ diff --git a/src/main/kotlin/com/expediagroup/openworld/sdk/core/plugin/PluginConfiguration.kt b/core/src/main/kotlin/com/expediagroup/sdk/core/plugin/PluginConfiguration.kt similarity index 94% rename from src/main/kotlin/com/expediagroup/openworld/sdk/core/plugin/PluginConfiguration.kt rename to core/src/main/kotlin/com/expediagroup/sdk/core/plugin/PluginConfiguration.kt index 597e9d106..8eafdd383 100644 --- a/src/main/kotlin/com/expediagroup/openworld/sdk/core/plugin/PluginConfiguration.kt +++ b/core/src/main/kotlin/com/expediagroup/sdk/core/plugin/PluginConfiguration.kt @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.expediagroup.openworld.sdk.core.plugin +package com.expediagroup.sdk.core.plugin import io.ktor.client.HttpClientConfig import io.ktor.client.engine.HttpClientEngineConfig diff --git a/src/main/kotlin/com/expediagroup/openworld/sdk/core/plugin/authentication/AuthenticationConfiguration.kt b/core/src/main/kotlin/com/expediagroup/sdk/core/plugin/authentication/AuthenticationConfiguration.kt similarity index 80% rename from src/main/kotlin/com/expediagroup/openworld/sdk/core/plugin/authentication/AuthenticationConfiguration.kt rename to core/src/main/kotlin/com/expediagroup/sdk/core/plugin/authentication/AuthenticationConfiguration.kt index 652b5259e..4e0a69c26 100644 --- a/src/main/kotlin/com/expediagroup/openworld/sdk/core/plugin/authentication/AuthenticationConfiguration.kt +++ b/core/src/main/kotlin/com/expediagroup/sdk/core/plugin/authentication/AuthenticationConfiguration.kt @@ -13,11 +13,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.expediagroup.openworld.sdk.core.plugin.authentication +package com.expediagroup.sdk.core.plugin.authentication -import com.expediagroup.openworld.sdk.core.configuration.Credentials -import com.expediagroup.openworld.sdk.core.plugin.KtorPluginConfiguration -import com.expediagroup.openworld.sdk.core.plugin.authentication.strategy.AuthenticationStrategy.AuthenticationType +import com.expediagroup.sdk.core.configuration.Credentials +import com.expediagroup.sdk.core.plugin.KtorPluginConfiguration +import com.expediagroup.sdk.core.plugin.authentication.strategy.AuthenticationStrategy.AuthenticationType import io.ktor.client.HttpClientConfig import io.ktor.client.engine.HttpClientEngineConfig diff --git a/src/main/kotlin/com/expediagroup/openworld/sdk/core/plugin/authentication/AuthenticationHookFactory.kt b/core/src/main/kotlin/com/expediagroup/sdk/core/plugin/authentication/AuthenticationHookFactory.kt similarity index 77% rename from src/main/kotlin/com/expediagroup/openworld/sdk/core/plugin/authentication/AuthenticationHookFactory.kt rename to core/src/main/kotlin/com/expediagroup/sdk/core/plugin/authentication/AuthenticationHookFactory.kt index 984bf38ed..8c1831a74 100644 --- a/src/main/kotlin/com/expediagroup/openworld/sdk/core/plugin/authentication/AuthenticationHookFactory.kt +++ b/core/src/main/kotlin/com/expediagroup/sdk/core/plugin/authentication/AuthenticationHookFactory.kt @@ -13,16 +13,16 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.expediagroup.openworld.sdk.core.plugin.authentication +package com.expediagroup.sdk.core.plugin.authentication -import com.expediagroup.openworld.sdk.core.client.Client -import com.expediagroup.openworld.sdk.core.constant.Authentication.AUTHORIZATION_REQUEST_LOCK_DELAY -import com.expediagroup.openworld.sdk.core.constant.HeaderKey -import com.expediagroup.openworld.sdk.core.constant.LoggingMessage.TOKEN_EXPIRED -import com.expediagroup.openworld.sdk.core.plugin.Hook -import com.expediagroup.openworld.sdk.core.plugin.HookBuilder -import com.expediagroup.openworld.sdk.core.plugin.HookFactory -import com.expediagroup.openworld.sdk.core.plugin.logging.OpenWorldLoggerFactory +import com.expediagroup.sdk.core.client.Client +import com.expediagroup.sdk.core.constant.Authentication.AUTHORIZATION_REQUEST_LOCK_DELAY +import com.expediagroup.sdk.core.constant.HeaderKey +import com.expediagroup.sdk.core.constant.LoggingMessage.TOKEN_EXPIRED +import com.expediagroup.sdk.core.plugin.Hook +import com.expediagroup.sdk.core.plugin.HookBuilder +import com.expediagroup.sdk.core.plugin.HookFactory +import com.expediagroup.sdk.core.plugin.logging.ExpediaGroupLoggerFactory import io.ktor.client.plugins.HttpSend import io.ktor.client.plugins.plugin import io.ktor.client.request.HttpRequestBuilder @@ -36,7 +36,7 @@ internal object AuthenticationHookFactory : HookFactory { - private val log = OpenWorldLoggerFactory.getLogger(javaClass) + private val log = ExpediaGroupLoggerFactory.getLogger(javaClass) private val lock = atomic(false) private val authenticationStrategy = client.getAuthenticationStrategy() diff --git a/src/main/kotlin/com/expediagroup/openworld/sdk/core/plugin/authentication/AuthenticationPlugin.kt b/core/src/main/kotlin/com/expediagroup/sdk/core/plugin/authentication/AuthenticationPlugin.kt similarity index 78% rename from src/main/kotlin/com/expediagroup/openworld/sdk/core/plugin/authentication/AuthenticationPlugin.kt rename to core/src/main/kotlin/com/expediagroup/sdk/core/plugin/authentication/AuthenticationPlugin.kt index a31e72f04..f8561165f 100644 --- a/src/main/kotlin/com/expediagroup/openworld/sdk/core/plugin/authentication/AuthenticationPlugin.kt +++ b/core/src/main/kotlin/com/expediagroup/sdk/core/plugin/authentication/AuthenticationPlugin.kt @@ -13,12 +13,12 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.expediagroup.openworld.sdk.core.plugin.authentication +package com.expediagroup.sdk.core.plugin.authentication -import com.expediagroup.openworld.sdk.core.client.Client -import com.expediagroup.openworld.sdk.core.constant.ExceptionMessage.AUTHENTICATION_NOT_CONFIGURED_FOR_CLIENT -import com.expediagroup.openworld.sdk.core.plugin.Plugin -import com.expediagroup.openworld.sdk.core.plugin.authentication.strategy.AuthenticationStrategy +import com.expediagroup.sdk.core.client.Client +import com.expediagroup.sdk.core.constant.ExceptionMessage.AUTHENTICATION_NOT_CONFIGURED_FOR_CLIENT +import com.expediagroup.sdk.core.plugin.Plugin +import com.expediagroup.sdk.core.plugin.authentication.strategy.AuthenticationStrategy import io.ktor.client.plugins.auth.Auth import kotlin.collections.set diff --git a/src/main/kotlin/com/expediagroup/openworld/sdk/core/plugin/authentication/strategy/AuthenticationStrategy.kt b/core/src/main/kotlin/com/expediagroup/sdk/core/plugin/authentication/strategy/AuthenticationStrategy.kt similarity index 72% rename from src/main/kotlin/com/expediagroup/openworld/sdk/core/plugin/authentication/strategy/AuthenticationStrategy.kt rename to core/src/main/kotlin/com/expediagroup/sdk/core/plugin/authentication/strategy/AuthenticationStrategy.kt index bc99c4bd6..eeb6b6414 100644 --- a/src/main/kotlin/com/expediagroup/openworld/sdk/core/plugin/authentication/strategy/AuthenticationStrategy.kt +++ b/core/src/main/kotlin/com/expediagroup/sdk/core/plugin/authentication/strategy/AuthenticationStrategy.kt @@ -13,11 +13,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.expediagroup.openworld.sdk.core.plugin.authentication.strategy +package com.expediagroup.sdk.core.plugin.authentication.strategy -import com.expediagroup.openworld.sdk.core.plugin.authentication.AuthenticationConfiguration -import com.expediagroup.openworld.sdk.core.plugin.authentication.strategy.AuthenticationStrategy.AuthenticationType.BEARER -import com.expediagroup.openworld.sdk.core.plugin.authentication.strategy.AuthenticationStrategy.AuthenticationType.SIGNATURE +import com.expediagroup.sdk.core.plugin.authentication.AuthenticationConfiguration +import com.expediagroup.sdk.core.plugin.authentication.strategy.AuthenticationStrategy.AuthenticationType.BEARER +import com.expediagroup.sdk.core.plugin.authentication.strategy.AuthenticationStrategy.AuthenticationType.SIGNATURE import io.ktor.client.HttpClient import io.ktor.client.plugins.auth.Auth import io.ktor.client.request.HttpRequestBuilder @@ -35,7 +35,7 @@ internal interface AuthenticationStrategy { companion object { fun from(configs: AuthenticationConfiguration, httpClientProvider: () -> HttpClient): AuthenticationStrategy = when (configs.authType) { - BEARER -> OpenWorldAuthenticationStrategy(httpClientProvider, configs) + BEARER -> ExpediaGroupAuthenticationStrategy(httpClientProvider, configs) SIGNATURE -> RapidAuthenticationStrategy(configs) } } diff --git a/src/main/kotlin/com/expediagroup/openworld/sdk/core/plugin/authentication/strategy/OpenWorldAuthenticationStrategy.kt b/core/src/main/kotlin/com/expediagroup/sdk/core/plugin/authentication/strategy/ExpediaGroupAuthenticationStrategy.kt similarity index 80% rename from src/main/kotlin/com/expediagroup/openworld/sdk/core/plugin/authentication/strategy/OpenWorldAuthenticationStrategy.kt rename to core/src/main/kotlin/com/expediagroup/sdk/core/plugin/authentication/strategy/ExpediaGroupAuthenticationStrategy.kt index 3a1694c12..12fa0ce6a 100644 --- a/src/main/kotlin/com/expediagroup/openworld/sdk/core/plugin/authentication/strategy/OpenWorldAuthenticationStrategy.kt +++ b/core/src/main/kotlin/com/expediagroup/sdk/core/plugin/authentication/strategy/ExpediaGroupAuthenticationStrategy.kt @@ -13,19 +13,19 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.expediagroup.openworld.sdk.core.plugin.authentication.strategy - -import com.expediagroup.openworld.sdk.core.configuration.Credentials -import com.expediagroup.openworld.sdk.core.constant.Authentication -import com.expediagroup.openworld.sdk.core.constant.Constant -import com.expediagroup.openworld.sdk.core.constant.ExceptionMessage -import com.expediagroup.openworld.sdk.core.constant.HeaderKey -import com.expediagroup.openworld.sdk.core.constant.HeaderValue -import com.expediagroup.openworld.sdk.core.constant.LoggingMessage -import com.expediagroup.openworld.sdk.core.constant.provider.LoggingMessageProvider -import com.expediagroup.openworld.sdk.core.model.exception.service.OpenWorldAuthException -import com.expediagroup.openworld.sdk.core.plugin.authentication.AuthenticationConfiguration -import com.expediagroup.openworld.sdk.core.plugin.logging.OpenWorldLoggerFactory +package com.expediagroup.sdk.core.plugin.authentication.strategy + +import com.expediagroup.sdk.core.configuration.Credentials +import com.expediagroup.sdk.core.constant.Authentication +import com.expediagroup.sdk.core.constant.Constant +import com.expediagroup.sdk.core.constant.ExceptionMessage +import com.expediagroup.sdk.core.constant.HeaderKey +import com.expediagroup.sdk.core.constant.HeaderValue +import com.expediagroup.sdk.core.constant.LoggingMessage +import com.expediagroup.sdk.core.constant.provider.LoggingMessageProvider +import com.expediagroup.sdk.core.model.exception.service.ExpediaGroupAuthException +import com.expediagroup.sdk.core.plugin.authentication.AuthenticationConfiguration +import com.expediagroup.sdk.core.plugin.logging.ExpediaGroupLoggerFactory import io.ktor.client.HttpClient import io.ktor.client.call.body import io.ktor.client.plugins.auth.Auth @@ -42,11 +42,11 @@ import io.ktor.http.Parameters import kotlinx.coroutines.runBlocking import java.time.LocalDateTime -internal class OpenWorldAuthenticationStrategy( +internal class ExpediaGroupAuthenticationStrategy( private val httpClientProvider: () -> HttpClient, private val configs: AuthenticationConfiguration ) : AuthenticationStrategy { - private val log = OpenWorldLoggerFactory.getLogger(javaClass) + private val log = ExpediaGroupLoggerFactory.getLogger(javaClass) private var bearerTokenStorage = BearerTokensInfo.emptyBearerTokenInfo override fun loadAuth(auth: Auth) { @@ -72,7 +72,7 @@ internal class OpenWorldAuthenticationStrategy( } } if (renewTokenResponse.status.value !in Constant.SUCCESSFUL_STATUS_CODES_RANGE) { - throw OpenWorldAuthException(renewTokenResponse.status, ExceptionMessage.AUTHENTICATION_FAILURE) + throw ExpediaGroupAuthException(renewTokenResponse.status, ExceptionMessage.AUTHENTICATION_FAILURE) } val renewedTokenInfo: TokenResponse = runBlocking { renewTokenResponse.body() } log.info(LoggingMessage.TOKEN_RENEWAL_SUCCESSFUL) diff --git a/src/main/kotlin/com/expediagroup/openworld/sdk/core/plugin/authentication/strategy/RapidAuthenticationStrategy.kt b/core/src/main/kotlin/com/expediagroup/sdk/core/plugin/authentication/strategy/RapidAuthenticationStrategy.kt similarity index 86% rename from src/main/kotlin/com/expediagroup/openworld/sdk/core/plugin/authentication/strategy/RapidAuthenticationStrategy.kt rename to core/src/main/kotlin/com/expediagroup/sdk/core/plugin/authentication/strategy/RapidAuthenticationStrategy.kt index 83d1864ba..a4a85b230 100644 --- a/src/main/kotlin/com/expediagroup/openworld/sdk/core/plugin/authentication/strategy/RapidAuthenticationStrategy.kt +++ b/core/src/main/kotlin/com/expediagroup/sdk/core/plugin/authentication/strategy/RapidAuthenticationStrategy.kt @@ -13,12 +13,12 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.expediagroup.openworld.sdk.core.plugin.authentication.strategy +package com.expediagroup.sdk.core.plugin.authentication.strategy -import com.expediagroup.openworld.sdk.core.constant.Authentication -import com.expediagroup.openworld.sdk.core.constant.Constant -import com.expediagroup.openworld.sdk.core.constant.SignatureValues -import com.expediagroup.openworld.sdk.core.plugin.authentication.AuthenticationConfiguration +import com.expediagroup.sdk.core.constant.Authentication +import com.expediagroup.sdk.core.constant.Constant +import com.expediagroup.sdk.core.constant.SignatureValues +import com.expediagroup.sdk.core.plugin.authentication.AuthenticationConfiguration import io.ktor.client.request.HttpRequestBuilder import java.math.BigInteger import java.nio.charset.StandardCharsets diff --git a/src/main/kotlin/com/expediagroup/openworld/sdk/core/plugin/encoding/EncodingConfiguration.kt b/core/src/main/kotlin/com/expediagroup/sdk/core/plugin/encoding/EncodingConfiguration.kt similarity index 88% rename from src/main/kotlin/com/expediagroup/openworld/sdk/core/plugin/encoding/EncodingConfiguration.kt rename to core/src/main/kotlin/com/expediagroup/sdk/core/plugin/encoding/EncodingConfiguration.kt index 365eeee92..c789bc69f 100644 --- a/src/main/kotlin/com/expediagroup/openworld/sdk/core/plugin/encoding/EncodingConfiguration.kt +++ b/core/src/main/kotlin/com/expediagroup/sdk/core/plugin/encoding/EncodingConfiguration.kt @@ -13,9 +13,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.expediagroup.openworld.sdk.core.plugin.encoding +package com.expediagroup.sdk.core.plugin.encoding -import com.expediagroup.openworld.sdk.core.plugin.KtorPluginConfiguration +import com.expediagroup.sdk.core.plugin.KtorPluginConfiguration import io.ktor.client.HttpClientConfig import io.ktor.client.engine.HttpClientEngineConfig diff --git a/src/main/kotlin/com/expediagroup/openworld/sdk/core/plugin/encoding/EncodingPlugin.kt b/core/src/main/kotlin/com/expediagroup/sdk/core/plugin/encoding/EncodingPlugin.kt similarity index 84% rename from src/main/kotlin/com/expediagroup/openworld/sdk/core/plugin/encoding/EncodingPlugin.kt rename to core/src/main/kotlin/com/expediagroup/sdk/core/plugin/encoding/EncodingPlugin.kt index 35c6fe2c8..fd04b63c1 100644 --- a/src/main/kotlin/com/expediagroup/openworld/sdk/core/plugin/encoding/EncodingPlugin.kt +++ b/core/src/main/kotlin/com/expediagroup/sdk/core/plugin/encoding/EncodingPlugin.kt @@ -13,10 +13,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.expediagroup.openworld.sdk.core.plugin.encoding +package com.expediagroup.sdk.core.plugin.encoding -import com.expediagroup.openworld.sdk.core.client.Client -import com.expediagroup.openworld.sdk.core.plugin.Plugin +import com.expediagroup.sdk.core.client.Client +import com.expediagroup.sdk.core.plugin.Plugin import io.ktor.client.plugins.compression.ContentEncoding internal object EncodingPlugin : Plugin { diff --git a/src/main/kotlin/com/expediagroup/openworld/sdk/core/plugin/httptimeout/HttpTimeoutConfiguration.kt b/core/src/main/kotlin/com/expediagroup/sdk/core/plugin/httptimeout/HttpTimeoutConfiguration.kt similarity index 89% rename from src/main/kotlin/com/expediagroup/openworld/sdk/core/plugin/httptimeout/HttpTimeoutConfiguration.kt rename to core/src/main/kotlin/com/expediagroup/sdk/core/plugin/httptimeout/HttpTimeoutConfiguration.kt index 876566878..fea16b029 100644 --- a/src/main/kotlin/com/expediagroup/openworld/sdk/core/plugin/httptimeout/HttpTimeoutConfiguration.kt +++ b/core/src/main/kotlin/com/expediagroup/sdk/core/plugin/httptimeout/HttpTimeoutConfiguration.kt @@ -13,9 +13,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.expediagroup.openworld.sdk.core.plugin.httptimeout +package com.expediagroup.sdk.core.plugin.httptimeout -import com.expediagroup.openworld.sdk.core.plugin.KtorPluginConfiguration +import com.expediagroup.sdk.core.plugin.KtorPluginConfiguration import io.ktor.client.HttpClientConfig import io.ktor.client.engine.HttpClientEngineConfig diff --git a/src/main/kotlin/com/expediagroup/openworld/sdk/core/plugin/httptimeout/HttpTimeoutPlugin.kt b/core/src/main/kotlin/com/expediagroup/sdk/core/plugin/httptimeout/HttpTimeoutPlugin.kt similarity index 84% rename from src/main/kotlin/com/expediagroup/openworld/sdk/core/plugin/httptimeout/HttpTimeoutPlugin.kt rename to core/src/main/kotlin/com/expediagroup/sdk/core/plugin/httptimeout/HttpTimeoutPlugin.kt index 6a1e63f91..461d75608 100644 --- a/src/main/kotlin/com/expediagroup/openworld/sdk/core/plugin/httptimeout/HttpTimeoutPlugin.kt +++ b/core/src/main/kotlin/com/expediagroup/sdk/core/plugin/httptimeout/HttpTimeoutPlugin.kt @@ -13,10 +13,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.expediagroup.openworld.sdk.core.plugin.httptimeout +package com.expediagroup.sdk.core.plugin.httptimeout -import com.expediagroup.openworld.sdk.core.client.Client -import com.expediagroup.openworld.sdk.core.plugin.Plugin +import com.expediagroup.sdk.core.client.Client +import com.expediagroup.sdk.core.plugin.Plugin import io.ktor.client.plugins.HttpTimeout internal object HttpTimeoutPlugin : Plugin { diff --git a/src/main/kotlin/com/expediagroup/openworld/sdk/core/plugin/logging/OpenWorldLogger.kt b/core/src/main/kotlin/com/expediagroup/sdk/core/plugin/logging/ExpediaGroupLogger.kt similarity index 78% rename from src/main/kotlin/com/expediagroup/openworld/sdk/core/plugin/logging/OpenWorldLogger.kt rename to core/src/main/kotlin/com/expediagroup/sdk/core/plugin/logging/ExpediaGroupLogger.kt index 00002fed1..3b5a0d01a 100644 --- a/src/main/kotlin/com/expediagroup/openworld/sdk/core/plugin/logging/OpenWorldLogger.kt +++ b/core/src/main/kotlin/com/expediagroup/sdk/core/plugin/logging/ExpediaGroupLogger.kt @@ -13,12 +13,12 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.expediagroup.openworld.sdk.core.plugin.logging +package com.expediagroup.sdk.core.plugin.logging -import com.expediagroup.openworld.sdk.core.constant.LoggingMessage.LOGGING_PREFIX +import com.expediagroup.sdk.core.constant.LoggingMessage.LOGGING_PREFIX import org.slf4j.Logger -internal class OpenWorldLogger(private val logger: Logger) : Logger by logger { +internal class ExpediaGroupLogger(private val logger: Logger) : Logger by logger { override fun info(msg: String) = logger.info(decorate(msg)) override fun warn(msg: String) = logger.warn(decorate(msg)) diff --git a/src/main/kotlin/com/expediagroup/openworld/sdk/core/plugin/logging/OpenWorldLoggerFactory.kt b/core/src/main/kotlin/com/expediagroup/sdk/core/plugin/logging/ExpediaGroupLoggerFactory.kt similarity index 77% rename from src/main/kotlin/com/expediagroup/openworld/sdk/core/plugin/logging/OpenWorldLoggerFactory.kt rename to core/src/main/kotlin/com/expediagroup/sdk/core/plugin/logging/ExpediaGroupLoggerFactory.kt index 4f0d7b2ed..11977b533 100644 --- a/src/main/kotlin/com/expediagroup/openworld/sdk/core/plugin/logging/OpenWorldLoggerFactory.kt +++ b/core/src/main/kotlin/com/expediagroup/sdk/core/plugin/logging/ExpediaGroupLoggerFactory.kt @@ -13,10 +13,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.expediagroup.openworld.sdk.core.plugin.logging +package com.expediagroup.sdk.core.plugin.logging import org.slf4j.LoggerFactory -internal object OpenWorldLoggerFactory { - fun getLogger(clazz: Class<*>) = OpenWorldLogger(LoggerFactory.getLogger(clazz)) +internal object ExpediaGroupLoggerFactory { + fun getLogger(clazz: Class<*>) = ExpediaGroupLogger(LoggerFactory.getLogger(clazz)) } diff --git a/src/main/kotlin/com/expediagroup/openworld/sdk/core/plugin/logging/LogMasker.kt b/core/src/main/kotlin/com/expediagroup/sdk/core/plugin/logging/LogMasker.kt similarity index 83% rename from src/main/kotlin/com/expediagroup/openworld/sdk/core/plugin/logging/LogMasker.kt rename to core/src/main/kotlin/com/expediagroup/sdk/core/plugin/logging/LogMasker.kt index 3545bd5cc..de868befe 100644 --- a/src/main/kotlin/com/expediagroup/openworld/sdk/core/plugin/logging/LogMasker.kt +++ b/core/src/main/kotlin/com/expediagroup/sdk/core/plugin/logging/LogMasker.kt @@ -13,10 +13,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.expediagroup.openworld.sdk.core.plugin.logging +package com.expediagroup.sdk.core.plugin.logging -import com.expediagroup.openworld.sdk.core.constant.LogMaskingRegex.AUTHORIZATION_REGEX -import com.expediagroup.openworld.sdk.core.constant.LoggingMessage.OMITTED +import com.expediagroup.sdk.core.constant.LogMaskingRegex.AUTHORIZATION_REGEX +import com.expediagroup.sdk.core.constant.LoggingMessage.OMITTED internal fun mask(message: String): String = MaskProvider.masks.fold(message) { acc, mask -> mask.mask(acc) } diff --git a/src/main/kotlin/com/expediagroup/openworld/sdk/core/plugin/logging/LoggingConfiguration.kt b/core/src/main/kotlin/com/expediagroup/sdk/core/plugin/logging/LoggingConfiguration.kt similarity index 79% rename from src/main/kotlin/com/expediagroup/openworld/sdk/core/plugin/logging/LoggingConfiguration.kt rename to core/src/main/kotlin/com/expediagroup/sdk/core/plugin/logging/LoggingConfiguration.kt index 942ae9226..370cc74ce 100644 --- a/src/main/kotlin/com/expediagroup/openworld/sdk/core/plugin/logging/LoggingConfiguration.kt +++ b/core/src/main/kotlin/com/expediagroup/sdk/core/plugin/logging/LoggingConfiguration.kt @@ -13,10 +13,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.expediagroup.openworld.sdk.core.plugin.logging +package com.expediagroup.sdk.core.plugin.logging -import com.expediagroup.openworld.sdk.core.client.Client -import com.expediagroup.openworld.sdk.core.plugin.KtorPluginConfiguration +import com.expediagroup.sdk.core.client.Client +import com.expediagroup.sdk.core.plugin.KtorPluginConfiguration import io.ktor.client.HttpClientConfig import io.ktor.client.engine.HttpClientEngineConfig import io.ktor.client.plugins.logging.LogLevel @@ -34,6 +34,6 @@ internal data class LoggingConfiguration( internal val Logger.Companion.CUSTOM: Logger get() = object : Logger { - private val delegate = OpenWorldLoggerFactory.getLogger(Client::class.java) // TODO: OpenWorldClient or RapidClient should be passed in here + private val delegate = ExpediaGroupLoggerFactory.getLogger(Client::class.java) override fun log(message: String) = delegate.info(message) } diff --git a/src/main/kotlin/com/expediagroup/openworld/sdk/core/plugin/logging/LoggingPlugin.kt b/core/src/main/kotlin/com/expediagroup/sdk/core/plugin/logging/LoggingPlugin.kt similarity index 84% rename from src/main/kotlin/com/expediagroup/openworld/sdk/core/plugin/logging/LoggingPlugin.kt rename to core/src/main/kotlin/com/expediagroup/sdk/core/plugin/logging/LoggingPlugin.kt index a420de1a7..68aa91005 100644 --- a/src/main/kotlin/com/expediagroup/openworld/sdk/core/plugin/logging/LoggingPlugin.kt +++ b/core/src/main/kotlin/com/expediagroup/sdk/core/plugin/logging/LoggingPlugin.kt @@ -13,10 +13,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.expediagroup.openworld.sdk.core.plugin.logging +package com.expediagroup.sdk.core.plugin.logging -import com.expediagroup.openworld.sdk.core.client.Client -import com.expediagroup.openworld.sdk.core.plugin.Plugin +import com.expediagroup.sdk.core.client.Client +import com.expediagroup.sdk.core.plugin.Plugin import io.ktor.client.plugins.logging.Logging internal object LoggingPlugin : Plugin { diff --git a/src/main/kotlin/com/expediagroup/openworld/sdk/core/plugin/request/DefaultRequestConfiguration.kt b/core/src/main/kotlin/com/expediagroup/sdk/core/plugin/request/DefaultRequestConfiguration.kt similarity index 89% rename from src/main/kotlin/com/expediagroup/openworld/sdk/core/plugin/request/DefaultRequestConfiguration.kt rename to core/src/main/kotlin/com/expediagroup/sdk/core/plugin/request/DefaultRequestConfiguration.kt index 59e6b3182..c1114a221 100644 --- a/src/main/kotlin/com/expediagroup/openworld/sdk/core/plugin/request/DefaultRequestConfiguration.kt +++ b/core/src/main/kotlin/com/expediagroup/sdk/core/plugin/request/DefaultRequestConfiguration.kt @@ -13,9 +13,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.expediagroup.openworld.sdk.core.plugin.request +package com.expediagroup.sdk.core.plugin.request -import com.expediagroup.openworld.sdk.core.plugin.KtorPluginConfiguration +import com.expediagroup.sdk.core.plugin.KtorPluginConfiguration import io.ktor.client.HttpClientConfig import io.ktor.client.engine.HttpClientEngineConfig diff --git a/src/main/kotlin/com/expediagroup/openworld/sdk/core/plugin/request/DefaultRequestPlugin.kt b/core/src/main/kotlin/com/expediagroup/sdk/core/plugin/request/DefaultRequestPlugin.kt similarity index 84% rename from src/main/kotlin/com/expediagroup/openworld/sdk/core/plugin/request/DefaultRequestPlugin.kt rename to core/src/main/kotlin/com/expediagroup/sdk/core/plugin/request/DefaultRequestPlugin.kt index a299e8b00..ee422b1b0 100644 --- a/src/main/kotlin/com/expediagroup/openworld/sdk/core/plugin/request/DefaultRequestPlugin.kt +++ b/core/src/main/kotlin/com/expediagroup/sdk/core/plugin/request/DefaultRequestPlugin.kt @@ -13,10 +13,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.expediagroup.openworld.sdk.core.plugin.request +package com.expediagroup.sdk.core.plugin.request -import com.expediagroup.openworld.sdk.core.client.Client -import com.expediagroup.openworld.sdk.core.plugin.Plugin +import com.expediagroup.sdk.core.client.Client +import com.expediagroup.sdk.core.plugin.Plugin import io.ktor.client.plugins.DefaultRequest internal object DefaultRequestPlugin : Plugin { diff --git a/src/main/kotlin/com/expediagroup/openworld/sdk/core/plugin/serialization/SerializationConfiguration.kt b/core/src/main/kotlin/com/expediagroup/sdk/core/plugin/serialization/SerializationConfiguration.kt similarity index 89% rename from src/main/kotlin/com/expediagroup/openworld/sdk/core/plugin/serialization/SerializationConfiguration.kt rename to core/src/main/kotlin/com/expediagroup/sdk/core/plugin/serialization/SerializationConfiguration.kt index c8e218e07..dc1546df3 100644 --- a/src/main/kotlin/com/expediagroup/openworld/sdk/core/plugin/serialization/SerializationConfiguration.kt +++ b/core/src/main/kotlin/com/expediagroup/sdk/core/plugin/serialization/SerializationConfiguration.kt @@ -13,9 +13,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.expediagroup.openworld.sdk.core.plugin.serialization +package com.expediagroup.sdk.core.plugin.serialization -import com.expediagroup.openworld.sdk.core.plugin.KtorPluginConfiguration +import com.expediagroup.sdk.core.plugin.KtorPluginConfiguration import io.ktor.client.HttpClientConfig import io.ktor.client.engine.HttpClientEngineConfig import io.ktor.http.ContentType diff --git a/src/main/kotlin/com/expediagroup/openworld/sdk/core/plugin/serialization/SerializationPlugin.kt b/core/src/main/kotlin/com/expediagroup/sdk/core/plugin/serialization/SerializationPlugin.kt similarity index 89% rename from src/main/kotlin/com/expediagroup/openworld/sdk/core/plugin/serialization/SerializationPlugin.kt rename to core/src/main/kotlin/com/expediagroup/sdk/core/plugin/serialization/SerializationPlugin.kt index 4a5ac98d5..22a4da86e 100644 --- a/src/main/kotlin/com/expediagroup/openworld/sdk/core/plugin/serialization/SerializationPlugin.kt +++ b/core/src/main/kotlin/com/expediagroup/sdk/core/plugin/serialization/SerializationPlugin.kt @@ -13,10 +13,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.expediagroup.openworld.sdk.core.plugin.serialization +package com.expediagroup.sdk.core.plugin.serialization -import com.expediagroup.openworld.sdk.core.client.Client -import com.expediagroup.openworld.sdk.core.plugin.Plugin +import com.expediagroup.sdk.core.client.Client +import com.expediagroup.sdk.core.plugin.Plugin import com.fasterxml.jackson.databind.DeserializationFeature import com.fasterxml.jackson.databind.PropertyNamingStrategies import io.ktor.client.plugins.contentnegotiation.ContentNegotiation diff --git a/src/test/kotlin/com/expediagroup/openworld/sdk/core/authentication/strategy/OpenWorldAuthenticationStrategyTest.kt b/core/src/test/kotlin/com/expediagroup/sdk/core/authentication/strategy/ExpediaGroupAuthenticationStrategyTest.kt similarity index 71% rename from src/test/kotlin/com/expediagroup/openworld/sdk/core/authentication/strategy/OpenWorldAuthenticationStrategyTest.kt rename to core/src/test/kotlin/com/expediagroup/sdk/core/authentication/strategy/ExpediaGroupAuthenticationStrategyTest.kt index ada99ce6c..760afb876 100644 --- a/src/test/kotlin/com/expediagroup/openworld/sdk/core/authentication/strategy/OpenWorldAuthenticationStrategyTest.kt +++ b/core/src/test/kotlin/com/expediagroup/sdk/core/authentication/strategy/ExpediaGroupAuthenticationStrategyTest.kt @@ -13,30 +13,30 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.expediagroup.openworld.sdk.core.authentication.strategy - -import com.expediagroup.openworld.sdk.core.client.Client -import com.expediagroup.openworld.sdk.core.configuration.Credentials -import com.expediagroup.openworld.sdk.core.configuration.OpenWorldClientConfiguration -import com.expediagroup.openworld.sdk.core.configuration.provider.OpenWorldConfigurationProvider -import com.expediagroup.openworld.sdk.core.constant.Authentication.BEARER -import com.expediagroup.openworld.sdk.core.constant.Constant.SUCCESSFUL_STATUS_CODES_RANGE -import com.expediagroup.openworld.sdk.core.constant.ExceptionMessage -import com.expediagroup.openworld.sdk.core.constant.HeaderKey -import com.expediagroup.openworld.sdk.core.model.exception.service.OpenWorldAuthException -import com.expediagroup.openworld.sdk.core.plugin.authentication.AuthenticationConfiguration -import com.expediagroup.openworld.sdk.core.plugin.authentication.AuthenticationPluginTest -import com.expediagroup.openworld.sdk.core.plugin.authentication.getAuthenticationStrategy -import com.expediagroup.openworld.sdk.core.plugin.authentication.helper.SuccessfulStatusCodesArgumentProvider -import com.expediagroup.openworld.sdk.core.plugin.authentication.helper.UnsuccessfulStatusCodesArgumentProvider -import com.expediagroup.openworld.sdk.core.test.ClientFactory -import com.expediagroup.openworld.sdk.core.test.MockEngineFactory.createMockEngineExpiresInPerCall -import com.expediagroup.openworld.sdk.core.test.MockEngineFactory.createTokenMockEngineWithStatusCode -import com.expediagroup.openworld.sdk.core.test.MockEngineFactory.createUnauthorizedMockEngineWithStatusCode -import com.expediagroup.openworld.sdk.core.test.TestConstants.ACCESS_TOKEN -import com.expediagroup.openworld.sdk.core.test.TestConstants.ANY_URL -import com.expediagroup.openworld.sdk.core.test.TestConstants.CLIENT_KEY_TEST_CREDENTIAL -import com.expediagroup.openworld.sdk.core.test.TestConstants.CLIENT_SECRET_TEST_CREDENTIAL +package com.expediagroup.sdk.core.authentication.strategy + +import com.expediagroup.sdk.core.client.Client +import com.expediagroup.sdk.core.configuration.Credentials +import com.expediagroup.sdk.core.configuration.ExpediaGroupClientConfiguration +import com.expediagroup.sdk.core.configuration.provider.ExpediaGroupConfigurationProvider +import com.expediagroup.sdk.core.constant.Authentication.BEARER +import com.expediagroup.sdk.core.constant.Constant.SUCCESSFUL_STATUS_CODES_RANGE +import com.expediagroup.sdk.core.constant.ExceptionMessage +import com.expediagroup.sdk.core.constant.HeaderKey +import com.expediagroup.sdk.core.model.exception.service.ExpediaGroupAuthException +import com.expediagroup.sdk.core.plugin.authentication.AuthenticationConfiguration +import com.expediagroup.sdk.core.plugin.authentication.AuthenticationPluginTest +import com.expediagroup.sdk.core.plugin.authentication.getAuthenticationStrategy +import com.expediagroup.sdk.core.plugin.authentication.helper.SuccessfulStatusCodesArgumentProvider +import com.expediagroup.sdk.core.plugin.authentication.helper.UnsuccessfulStatusCodesArgumentProvider +import com.expediagroup.sdk.core.test.ClientFactory +import com.expediagroup.sdk.core.test.MockEngineFactory.createMockEngineExpiresInPerCall +import com.expediagroup.sdk.core.test.MockEngineFactory.createTokenMockEngineWithStatusCode +import com.expediagroup.sdk.core.test.MockEngineFactory.createUnauthorizedMockEngineWithStatusCode +import com.expediagroup.sdk.core.test.TestConstants.ACCESS_TOKEN +import com.expediagroup.sdk.core.test.TestConstants.ANY_URL +import com.expediagroup.sdk.core.test.TestConstants.CLIENT_KEY_TEST_CREDENTIAL +import com.expediagroup.sdk.core.test.TestConstants.CLIENT_SECRET_TEST_CREDENTIAL import io.ktor.client.HttpClientConfig import io.ktor.client.request.get import io.ktor.client.request.request @@ -64,12 +64,12 @@ import java.util.concurrent.ExecutorService import java.util.concurrent.Executors import java.util.concurrent.Future -internal class OpenWorldAuthenticationStrategyTest : AuthenticationPluginTest() { +internal class ExpediaGroupAuthenticationStrategyTest : AuthenticationPluginTest() { @Test fun `making any http call should invoke the authorized token`() { runBlocking { - val httpClient = ClientFactory.createOpenWorldClient().httpClient + val httpClient = ClientFactory.createExpediaGroupClient().httpClient val testRequest = httpClient.get(ANY_URL) assertThat(testRequest.request.headers[HeaderKey.AUTHORIZATION]).isEqualTo( @@ -82,20 +82,20 @@ internal class OpenWorldAuthenticationStrategyTest : AuthenticationPluginTest() @ArgumentsSource(UnsuccessfulStatusCodesArgumentProvider::class) fun `refresh auth token should throw client exception if the the credentials are invalid`(httpStatusCode: HttpStatusCode) { runBlocking { - val configuration = OpenWorldClientConfiguration( + val configuration = ExpediaGroupClientConfiguration( key = CLIENT_KEY_TEST_CREDENTIAL + "invalid", secret = CLIENT_SECRET_TEST_CREDENTIAL + "invalid", - endpoint = OpenWorldConfigurationProvider.endpoint, - authEndpoint = OpenWorldConfigurationProvider.authEndpoint, - requestTimeout = OpenWorldConfigurationProvider.requestTimeout + endpoint = ExpediaGroupConfigurationProvider.endpoint, + authEndpoint = ExpediaGroupConfigurationProvider.authEndpoint, + requestTimeout = ExpediaGroupConfigurationProvider.requestTimeout ) - val client = ClientFactory.createOpenWorldClient( + val client = ClientFactory.createExpediaGroupClient( createUnauthorizedMockEngineWithStatusCode(httpStatusCode), configuration ) val authentication = client.getAuthenticationStrategy() - val exception = assertThrows { + val exception = assertThrows { authentication.renewToken() } assertThat(exception.message).isEqualTo("[${httpStatusCode.value}] ${ExceptionMessage.AUTHENTICATION_FAILURE}") @@ -107,7 +107,7 @@ internal class OpenWorldAuthenticationStrategyTest : AuthenticationPluginTest() @ArgumentsSource(SuccessfulStatusCodesArgumentProvider::class) fun `refresh auth token should not throw client exception if the the credentials are valid`(httpStatusCode: HttpStatusCode) { runBlocking { - val client = ClientFactory.createOpenWorldClient(createTokenMockEngineWithStatusCode(httpStatusCode), ClientFactory.openWorldConfiguration) + val client = ClientFactory.createExpediaGroupClient(createTokenMockEngineWithStatusCode(httpStatusCode), ClientFactory.expediaGroupConfiguration) val authentication = client.getAuthenticationStrategy() assertDoesNotThrow { @@ -119,7 +119,7 @@ internal class OpenWorldAuthenticationStrategyTest : AuthenticationPluginTest() @Test fun `make parallel should run the single refresh token only`() { runBlocking { - val client = ClientFactory.createOpenWorldClient() + val client = ClientFactory.createExpediaGroupClient() val httpClient = client.httpClient val authentication = client.getAuthenticationStrategy() @@ -139,7 +139,7 @@ internal class OpenWorldAuthenticationStrategyTest : AuthenticationPluginTest() @Test fun `given requests constructed during token renewal then get assigned the new token`() { runBlocking { - val client = ClientFactory.createOpenWorldClient() + val client = ClientFactory.createExpediaGroupClient() val httpClient = client.httpClient val authentication = client.getAuthenticationStrategy() mockkObject(authentication) @@ -167,7 +167,7 @@ internal class OpenWorldAuthenticationStrategyTest : AuthenticationPluginTest() fun `given request when token almost or is expired then should renew token`(expiresIn: Int) { runBlocking { val mockEngine = createMockEngineExpiresInPerCall(expiresIn, 1000) - val client = ClientFactory.createOpenWorldClient(mockEngine) + val client = ClientFactory.createExpediaGroupClient(mockEngine) val httpClient = client.httpClient renewToken(client) @@ -186,7 +186,7 @@ internal class OpenWorldAuthenticationStrategyTest : AuthenticationPluginTest() fun `given request when token not almost and not expired then should not renew token`() { runBlocking { val mockEngine = createMockEngineExpiresInPerCall(1000) - val client = ClientFactory.createOpenWorldClient(mockEngine) + val client = ClientFactory.createExpediaGroupClient(mockEngine) val httpClient = client.httpClient renewToken(client) @@ -205,7 +205,7 @@ internal class OpenWorldAuthenticationStrategyTest : AuthenticationPluginTest() fun `given identity request when token almost expired then should not renew token`() { runBlocking { val mockEngine = createMockEngineExpiresInPerCall(6, 1000) - val client = ClientFactory.createOpenWorldClient(mockEngine) + val client = ClientFactory.createExpediaGroupClient(mockEngine) val httpClient = client.httpClient val authentication = client.getAuthenticationStrategy() @@ -226,7 +226,7 @@ internal class OpenWorldAuthenticationStrategyTest : AuthenticationPluginTest() @Test fun `given multiple requests when token expired then no requests should be unauthorized`() { runBlocking { - val client = ClientFactory.createOpenWorldClient() + val client = ClientFactory.createExpediaGroupClient() val httpClient = client.httpClient val authentication = client.getAuthenticationStrategy() @@ -260,6 +260,6 @@ internal class OpenWorldAuthenticationStrategyTest : AuthenticationPluginTest() CLIENT_KEY_TEST_CREDENTIAL, CLIENT_SECRET_TEST_CREDENTIAL ), - OpenWorldConfigurationProvider.authEndpoint + ExpediaGroupConfigurationProvider.authEndpoint ) } diff --git a/src/test/kotlin/com/expediagroup/openworld/sdk/core/config/ConfigKeyTest.kt b/core/src/test/kotlin/com/expediagroup/sdk/core/config/ConfigKeyTest.kt similarity index 97% rename from src/test/kotlin/com/expediagroup/openworld/sdk/core/config/ConfigKeyTest.kt rename to core/src/test/kotlin/com/expediagroup/sdk/core/config/ConfigKeyTest.kt index cfe750c0a..ec08bbbf6 100644 --- a/src/test/kotlin/com/expediagroup/openworld/sdk/core/config/ConfigKeyTest.kt +++ b/core/src/test/kotlin/com/expediagroup/sdk/core/config/ConfigKeyTest.kt @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.expediagroup.openworld.sdk.core.config +package com.expediagroup.sdk.core.config import org.junit.jupiter.api.Assertions.assertFalse import org.junit.jupiter.api.Assertions.assertTrue diff --git a/src/test/kotlin/com/expediagroup/openworld/sdk/core/config/ConfigurationDefinitionTest.kt b/core/src/test/kotlin/com/expediagroup/sdk/core/config/ConfigurationDefinitionTest.kt similarity index 99% rename from src/test/kotlin/com/expediagroup/openworld/sdk/core/config/ConfigurationDefinitionTest.kt rename to core/src/test/kotlin/com/expediagroup/sdk/core/config/ConfigurationDefinitionTest.kt index 7ad24fffa..e3b4f2803 100644 --- a/src/test/kotlin/com/expediagroup/openworld/sdk/core/config/ConfigurationDefinitionTest.kt +++ b/core/src/test/kotlin/com/expediagroup/sdk/core/config/ConfigurationDefinitionTest.kt @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.expediagroup.openworld.sdk.core.config +package com.expediagroup.sdk.core.config import org.junit.jupiter.api.Assertions.assertEquals import org.junit.jupiter.api.Assertions.assertNotNull diff --git a/src/test/kotlin/com/expediagroup/openworld/sdk/core/config/provider/FileConfigurationProviderTest.kt b/core/src/test/kotlin/com/expediagroup/sdk/core/config/provider/FileConfigurationProviderTest.kt similarity index 92% rename from src/test/kotlin/com/expediagroup/openworld/sdk/core/config/provider/FileConfigurationProviderTest.kt rename to core/src/test/kotlin/com/expediagroup/sdk/core/config/provider/FileConfigurationProviderTest.kt index ef1255580..293ac79d0 100644 --- a/src/test/kotlin/com/expediagroup/openworld/sdk/core/config/provider/FileConfigurationProviderTest.kt +++ b/core/src/test/kotlin/com/expediagroup/sdk/core/config/provider/FileConfigurationProviderTest.kt @@ -13,10 +13,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.expediagroup.openworld.sdk.core.config.provider +package com.expediagroup.sdk.core.config.provider -import com.expediagroup.openworld.sdk.core.constant.Constant.EMPTY_STRING -import com.expediagroup.openworld.sdk.core.model.exception.OpenWorldException +import com.expediagroup.sdk.core.constant.Constant.EMPTY_STRING +import com.expediagroup.sdk.core.model.exception.ExpediaGroupException import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Assertions.assertEquals import org.junit.jupiter.api.Assertions.assertNotNull @@ -68,7 +68,7 @@ class FileConfigurationProviderTest { @Test fun `file configuration provider should throw configuration exception if the file is not found`() { val provider: ConfigurationProvider = FileConfigurationProvider() - assertThrows { + assertThrows { provider[INVALID_RESOURCE_FILE_NAME] } } @@ -76,7 +76,7 @@ class FileConfigurationProviderTest { @Test fun `file configuration provider should throw configuration exception if the file url is not found`() { val provider: ConfigurationProvider = FileConfigurationProvider() - assertThrows { + assertThrows { provider[INVALID_URL] } } @@ -91,7 +91,7 @@ class FileConfigurationProviderTest { fun `file configuration provider should throw an exception when the optional flag is not set and file doesn't exists`() { val provider: ConfigurationProvider = FileConfigurationProvider() - assertThrows { + assertThrows { provider[INVALID_URL].data() } } diff --git a/src/test/kotlin/com/expediagroup/openworld/sdk/core/configuration/BaseRapidClientConfigurationTest.kt b/core/src/test/kotlin/com/expediagroup/sdk/core/configuration/BaseRapidClientConfigurationTest.kt similarity index 97% rename from src/test/kotlin/com/expediagroup/openworld/sdk/core/configuration/BaseRapidClientConfigurationTest.kt rename to core/src/test/kotlin/com/expediagroup/sdk/core/configuration/BaseRapidClientConfigurationTest.kt index b52638d93..4544cd982 100644 --- a/src/test/kotlin/com/expediagroup/openworld/sdk/core/configuration/BaseRapidClientConfigurationTest.kt +++ b/core/src/test/kotlin/com/expediagroup/sdk/core/configuration/BaseRapidClientConfigurationTest.kt @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.expediagroup.openworld.sdk.core.configuration +package com.expediagroup.sdk.core.configuration import org.junit.jupiter.api.Assertions.assertEquals import org.junit.jupiter.api.Assertions.assertNull diff --git a/src/test/kotlin/com/expediagroup/openworld/sdk/core/configuration/OpenWorldClientConfigurationTest.kt b/core/src/test/kotlin/com/expediagroup/sdk/core/configuration/ExpediaGroupClientConfigurationTest.kt similarity index 88% rename from src/test/kotlin/com/expediagroup/openworld/sdk/core/configuration/OpenWorldClientConfigurationTest.kt rename to core/src/test/kotlin/com/expediagroup/sdk/core/configuration/ExpediaGroupClientConfigurationTest.kt index ebd617b4e..d1936b5da 100644 --- a/src/test/kotlin/com/expediagroup/openworld/sdk/core/configuration/OpenWorldClientConfigurationTest.kt +++ b/core/src/test/kotlin/com/expediagroup/sdk/core/configuration/ExpediaGroupClientConfigurationTest.kt @@ -13,17 +13,17 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.expediagroup.openworld.sdk.core.configuration +package com.expediagroup.sdk.core.configuration import org.junit.jupiter.api.Assertions.assertEquals import org.junit.jupiter.api.Assertions.assertNull import org.junit.jupiter.api.Test -class OpenWorldClientConfigurationTest { +class ExpediaGroupClientConfigurationTest { @Test fun `verify default behaviour`() { - OpenWorldClientConfiguration().let { + ExpediaGroupClientConfiguration().let { assertNull(it.key) assertNull(it.secret) assertNull(it.endpoint) @@ -34,7 +34,7 @@ class OpenWorldClientConfigurationTest { @Test fun `verify typical use`() { - OpenWorldClientConfiguration( + ExpediaGroupClientConfiguration( key = "key", secret = "secret", endpoint = "endpoint", @@ -51,7 +51,7 @@ class OpenWorldClientConfigurationTest { @Test fun `verify toProvider with default behaviour`() { - OpenWorldClientConfiguration().toProvider().let { + ExpediaGroupClientConfiguration().toProvider().let { assertNull(it.key) assertNull(it.secret) assertNull(it.endpoint) @@ -62,7 +62,7 @@ class OpenWorldClientConfigurationTest { @Test fun `verify toProvider with values`() { - OpenWorldClientConfiguration( + ExpediaGroupClientConfiguration( key = "key", secret = "secret", endpoint = "endpoint", diff --git a/src/test/kotlin/com/expediagroup/openworld/sdk/core/configuration/collector/ConfigurationCollectorTest.kt b/core/src/test/kotlin/com/expediagroup/sdk/core/configuration/collector/ConfigurationCollectorTest.kt similarity index 60% rename from src/test/kotlin/com/expediagroup/openworld/sdk/core/configuration/collector/ConfigurationCollectorTest.kt rename to core/src/test/kotlin/com/expediagroup/sdk/core/configuration/collector/ConfigurationCollectorTest.kt index 676568e0e..fdeee08af 100644 --- a/src/test/kotlin/com/expediagroup/openworld/sdk/core/configuration/collector/ConfigurationCollectorTest.kt +++ b/core/src/test/kotlin/com/expediagroup/sdk/core/configuration/collector/ConfigurationCollectorTest.kt @@ -13,13 +13,13 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.expediagroup.openworld.sdk.core.configuration.collector +package com.expediagroup.sdk.core.configuration.collector -import com.expediagroup.openworld.sdk.core.configuration.provider.OpenWorldConfigurationProvider -import com.expediagroup.openworld.sdk.core.configuration.provider.RuntimeConfigurationProvider -import com.expediagroup.openworld.sdk.core.constant.Constant.EMPTY_STRING -import com.expediagroup.openworld.sdk.core.test.TestConstants.CLIENT_KEY_TEST_CREDENTIAL -import com.expediagroup.openworld.sdk.core.test.TestConstants.CLIENT_SECRET_TEST_CREDENTIAL +import com.expediagroup.sdk.core.configuration.provider.ExpediaGroupConfigurationProvider +import com.expediagroup.sdk.core.configuration.provider.RuntimeConfigurationProvider +import com.expediagroup.sdk.core.constant.Constant.EMPTY_STRING +import com.expediagroup.sdk.core.test.TestConstants.CLIENT_KEY_TEST_CREDENTIAL +import com.expediagroup.sdk.core.test.TestConstants.CLIENT_SECRET_TEST_CREDENTIAL import org.junit.jupiter.api.Assertions.assertEquals import org.junit.jupiter.api.Assertions.assertNull import org.junit.jupiter.api.Test @@ -39,13 +39,13 @@ internal class ConfigurationCollectorTest { @Test fun `verify configuration collector with default configuration only`() { - val collector = ConfigurationCollector.create(OpenWorldConfigurationProvider) + val collector = ConfigurationCollector.create(ExpediaGroupConfigurationProvider) assertEquals(EMPTY_STRING, collector.key) assertEquals(EMPTY_STRING, collector.secret) - assertEquals(OpenWorldConfigurationProvider.endpoint, collector.endpoint) - assertEquals(OpenWorldConfigurationProvider.authEndpoint, collector.authEndpoint) - assertEquals(OpenWorldConfigurationProvider.requestTimeout, collector.requestTimeout) + assertEquals(ExpediaGroupConfigurationProvider.endpoint, collector.endpoint) + assertEquals(ExpediaGroupConfigurationProvider.authEndpoint, collector.authEndpoint) + assertEquals(ExpediaGroupConfigurationProvider.requestTimeout, collector.requestTimeout) } @Test @@ -53,9 +53,9 @@ internal class ConfigurationCollectorTest { val runtimeConfigurationProvider = RuntimeConfigurationProvider( key = CLIENT_KEY_TEST_CREDENTIAL, secret = CLIENT_SECRET_TEST_CREDENTIAL, - endpoint = OpenWorldConfigurationProvider.endpoint, - authEndpoint = OpenWorldConfigurationProvider.authEndpoint, - requestTimeout = OpenWorldConfigurationProvider.requestTimeout + endpoint = ExpediaGroupConfigurationProvider.endpoint, + authEndpoint = ExpediaGroupConfigurationProvider.authEndpoint, + requestTimeout = ExpediaGroupConfigurationProvider.requestTimeout ) val collector = ConfigurationCollector.create( @@ -64,9 +64,9 @@ internal class ConfigurationCollectorTest { assertEquals(CLIENT_KEY_TEST_CREDENTIAL, collector.key) assertEquals(CLIENT_SECRET_TEST_CREDENTIAL, collector.secret) - assertEquals(OpenWorldConfigurationProvider.endpoint, collector.endpoint) - assertEquals(OpenWorldConfigurationProvider.authEndpoint, collector.authEndpoint) - assertEquals(OpenWorldConfigurationProvider.requestTimeout, collector.requestTimeout) + assertEquals(ExpediaGroupConfigurationProvider.endpoint, collector.endpoint) + assertEquals(ExpediaGroupConfigurationProvider.authEndpoint, collector.authEndpoint) + assertEquals(ExpediaGroupConfigurationProvider.requestTimeout, collector.requestTimeout) } @Test @@ -74,7 +74,7 @@ internal class ConfigurationCollectorTest { val runtimeConfigurationProvider = RuntimeConfigurationProvider( key = CLIENT_KEY_TEST_CREDENTIAL, secret = CLIENT_SECRET_TEST_CREDENTIAL, - endpoint = OpenWorldConfigurationProvider.endpoint + endpoint = ExpediaGroupConfigurationProvider.endpoint ) val collector = ConfigurationCollector.create( @@ -83,7 +83,7 @@ internal class ConfigurationCollectorTest { assertEquals(CLIENT_KEY_TEST_CREDENTIAL, collector.key) assertEquals(CLIENT_SECRET_TEST_CREDENTIAL, collector.secret) - assertEquals(OpenWorldConfigurationProvider.endpoint, collector.endpoint) + assertEquals(ExpediaGroupConfigurationProvider.endpoint, collector.endpoint) assertNull(collector.authEndpoint) assertNull(collector.requestTimeout) } @@ -92,18 +92,18 @@ internal class ConfigurationCollectorTest { fun `verify configuration collector with runtime and default providers`() { val runtimeConfigurationProvider = RuntimeConfigurationProvider( secret = CLIENT_SECRET_TEST_CREDENTIAL, - endpoint = OpenWorldConfigurationProvider.endpoint + endpoint = ExpediaGroupConfigurationProvider.endpoint ) val collector = ConfigurationCollector.create( runtimeConfigurationProvider, - OpenWorldConfigurationProvider + ExpediaGroupConfigurationProvider ) assertEquals(EMPTY_STRING, collector.key) // from default provider assertEquals(CLIENT_SECRET_TEST_CREDENTIAL, collector.secret) // from client configuration - assertEquals(OpenWorldConfigurationProvider.endpoint, collector.endpoint) // from client configuration - assertEquals(OpenWorldConfigurationProvider.authEndpoint, collector.authEndpoint) // from default provider - assertEquals(OpenWorldConfigurationProvider.requestTimeout, collector.requestTimeout) + assertEquals(ExpediaGroupConfigurationProvider.endpoint, collector.endpoint) // from client configuration + assertEquals(ExpediaGroupConfigurationProvider.authEndpoint, collector.authEndpoint) // from default provider + assertEquals(ExpediaGroupConfigurationProvider.requestTimeout, collector.requestTimeout) } } diff --git a/core/src/test/kotlin/com/expediagroup/sdk/core/configuration/collector/ConfigurationProviderQueueTest.kt b/core/src/test/kotlin/com/expediagroup/sdk/core/configuration/collector/ConfigurationProviderQueueTest.kt new file mode 100644 index 000000000..09b4b4a4b --- /dev/null +++ b/core/src/test/kotlin/com/expediagroup/sdk/core/configuration/collector/ConfigurationProviderQueueTest.kt @@ -0,0 +1,61 @@ +/* + * Copyright (C) 2022 Expedia, Inc. + * + * 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 + * + * 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. + */ +package com.expediagroup.sdk.core.configuration.collector + +import com.expediagroup.sdk.core.configuration.provider.ExpediaGroupConfigurationProvider +import com.expediagroup.sdk.core.configuration.provider.RuntimeConfigurationProvider +import com.expediagroup.sdk.core.constant.Constant.EMPTY_STRING +import com.expediagroup.sdk.core.test.TestConstants.CLIENT_KEY_TEST_CREDENTIAL +import com.expediagroup.sdk.core.test.TestConstants.CLIENT_SECRET_TEST_CREDENTIAL +import org.junit.jupiter.api.Assertions.assertEquals +import org.junit.jupiter.api.Test + +internal class ConfigurationProviderQueueTest { + + @Test + fun `test a provider queue with only a default provider`() { + val configurationProviderQueue = ConfigurationProviderQueue.from(listOf(ExpediaGroupConfigurationProvider)) + assertEquals(ProvidedConfiguration(EMPTY_STRING, ExpediaGroupConfigurationProvider.name), configurationProviderQueue.firstWith { it.key }) + assertEquals(ProvidedConfiguration(EMPTY_STRING, ExpediaGroupConfigurationProvider.name), configurationProviderQueue.firstWith { it.secret }) + assertEquals(ProvidedConfiguration(ExpediaGroupConfigurationProvider.endpoint, ExpediaGroupConfigurationProvider.name), configurationProviderQueue.firstWith { it.endpoint }) + assertEquals(ProvidedConfiguration(ExpediaGroupConfigurationProvider.authEndpoint, ExpediaGroupConfigurationProvider.name), configurationProviderQueue.firstWith { it.authEndpoint }) + assertEquals(ProvidedConfiguration(ExpediaGroupConfigurationProvider.requestTimeout, ExpediaGroupConfigurationProvider.name), configurationProviderQueue.firstWith { it.requestTimeout }) + } + + @Test + fun `test a provider queue with at least a non-empty provider`() { + val runtimeConfigurationProvider = RuntimeConfigurationProvider( + key = CLIENT_KEY_TEST_CREDENTIAL, + secret = CLIENT_SECRET_TEST_CREDENTIAL, + endpoint = ExpediaGroupConfigurationProvider.endpoint, + authEndpoint = ExpediaGroupConfigurationProvider.authEndpoint, + requestTimeout = ExpediaGroupConfigurationProvider.requestTimeout + ) + val configurationProviderQueue = ConfigurationProviderQueue.from( + listOf(runtimeConfigurationProvider) + ) + + assertEquals(runtimeConfigurationProvider, configurationProviderQueue.first()) + assertEquals(runtimeConfigurationProvider, configurationProviderQueue.first { it.key != null }) + assertEquals(runtimeConfigurationProvider, configurationProviderQueue.first { it.key != EMPTY_STRING }) + + assertEquals(ProvidedConfiguration(CLIENT_KEY_TEST_CREDENTIAL, runtimeConfigurationProvider.name), configurationProviderQueue.firstWith { it.key }) + assertEquals(ProvidedConfiguration(CLIENT_SECRET_TEST_CREDENTIAL, runtimeConfigurationProvider.name), configurationProviderQueue.firstWith { it.secret }) + assertEquals(ProvidedConfiguration(ExpediaGroupConfigurationProvider.endpoint, runtimeConfigurationProvider.name), configurationProviderQueue.firstWith { it.endpoint }) + assertEquals(ProvidedConfiguration(ExpediaGroupConfigurationProvider.authEndpoint, runtimeConfigurationProvider.name), configurationProviderQueue.firstWith { it.authEndpoint }) + assertEquals(ProvidedConfiguration(ExpediaGroupConfigurationProvider.requestTimeout, runtimeConfigurationProvider.name), configurationProviderQueue.firstWith { it.requestTimeout }) + } +} diff --git a/src/test/kotlin/com/expediagroup/openworld/sdk/core/configuration/provider/OpenWorldConfigurationProviderTest.kt b/core/src/test/kotlin/com/expediagroup/sdk/core/configuration/provider/ExpediaGroupConfigurationProviderTest.kt similarity index 54% rename from src/test/kotlin/com/expediagroup/openworld/sdk/core/configuration/provider/OpenWorldConfigurationProviderTest.kt rename to core/src/test/kotlin/com/expediagroup/sdk/core/configuration/provider/ExpediaGroupConfigurationProviderTest.kt index d5439de82..91e56067a 100644 --- a/src/test/kotlin/com/expediagroup/openworld/sdk/core/configuration/provider/OpenWorldConfigurationProviderTest.kt +++ b/core/src/test/kotlin/com/expediagroup/sdk/core/configuration/provider/ExpediaGroupConfigurationProviderTest.kt @@ -13,21 +13,21 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.expediagroup.openworld.sdk.core.configuration.provider +package com.expediagroup.sdk.core.configuration.provider -import com.expediagroup.openworld.sdk.core.constant.Constant.EMPTY_STRING -import com.expediagroup.openworld.sdk.core.constant.Constant.TEN_SECONDS_IN_MILLIS +import com.expediagroup.sdk.core.constant.Constant.EMPTY_STRING +import com.expediagroup.sdk.core.constant.Constant.TEN_SECONDS_IN_MILLIS import org.junit.jupiter.api.Assertions.assertEquals import org.junit.jupiter.api.Test -internal class OpenWorldConfigurationProviderTest { +internal class ExpediaGroupConfigurationProviderTest { @Test fun `verify default values`() { - assertEquals(EMPTY_STRING, OpenWorldConfigurationProvider.key) - assertEquals(EMPTY_STRING, OpenWorldConfigurationProvider.secret) - assertEquals("https://api.expediagroup.com/", OpenWorldConfigurationProvider.endpoint) - assertEquals("https://api.expediagroup.com/identity/oauth2/v2/token/", OpenWorldConfigurationProvider.authEndpoint) - assertEquals(TEN_SECONDS_IN_MILLIS, OpenWorldConfigurationProvider.requestTimeout) + assertEquals(EMPTY_STRING, ExpediaGroupConfigurationProvider.key) + assertEquals(EMPTY_STRING, ExpediaGroupConfigurationProvider.secret) + assertEquals("https://api.expediagroup.com/", ExpediaGroupConfigurationProvider.endpoint) + assertEquals("https://api.expediagroup.com/identity/oauth2/v2/token/", ExpediaGroupConfigurationProvider.authEndpoint) + assertEquals(TEN_SECONDS_IN_MILLIS, ExpediaGroupConfigurationProvider.requestTimeout) } } diff --git a/src/test/kotlin/com/expediagroup/openworld/sdk/core/configuration/provider/RapidConfigurationProviderTest.kt b/core/src/test/kotlin/com/expediagroup/sdk/core/configuration/provider/RapidConfigurationProviderTest.kt similarity index 83% rename from src/test/kotlin/com/expediagroup/openworld/sdk/core/configuration/provider/RapidConfigurationProviderTest.kt rename to core/src/test/kotlin/com/expediagroup/sdk/core/configuration/provider/RapidConfigurationProviderTest.kt index 473cc2a4e..b039a9491 100644 --- a/src/test/kotlin/com/expediagroup/openworld/sdk/core/configuration/provider/RapidConfigurationProviderTest.kt +++ b/core/src/test/kotlin/com/expediagroup/sdk/core/configuration/provider/RapidConfigurationProviderTest.kt @@ -13,10 +13,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.expediagroup.openworld.sdk.core.configuration.provider +package com.expediagroup.sdk.core.configuration.provider -import com.expediagroup.openworld.sdk.core.constant.Constant.EMPTY_STRING -import com.expediagroup.openworld.sdk.core.constant.Constant.TEN_SECONDS_IN_MILLIS +import com.expediagroup.sdk.core.constant.Constant.EMPTY_STRING +import com.expediagroup.sdk.core.constant.Constant.TEN_SECONDS_IN_MILLIS import org.junit.jupiter.api.Assertions.assertEquals import org.junit.jupiter.api.Test diff --git a/src/test/kotlin/com/expediagroup/openworld/sdk/core/configuration/provider/RuntimeConfigurationProviderTest.kt b/core/src/test/kotlin/com/expediagroup/sdk/core/configuration/provider/RuntimeConfigurationProviderTest.kt similarity index 95% rename from src/test/kotlin/com/expediagroup/openworld/sdk/core/configuration/provider/RuntimeConfigurationProviderTest.kt rename to core/src/test/kotlin/com/expediagroup/sdk/core/configuration/provider/RuntimeConfigurationProviderTest.kt index 83cfac480..032953886 100644 --- a/src/test/kotlin/com/expediagroup/openworld/sdk/core/configuration/provider/RuntimeConfigurationProviderTest.kt +++ b/core/src/test/kotlin/com/expediagroup/sdk/core/configuration/provider/RuntimeConfigurationProviderTest.kt @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.expediagroup.openworld.sdk.core.configuration.provider +package com.expediagroup.sdk.core.configuration.provider import org.junit.jupiter.api.Assertions.assertNotNull import org.junit.jupiter.api.Assertions.assertNull diff --git a/src/test/kotlin/com/expediagroup/openworld/sdk/core/contract/ContractTest.kt b/core/src/test/kotlin/com/expediagroup/sdk/core/contract/ContractTest.kt similarity index 95% rename from src/test/kotlin/com/expediagroup/openworld/sdk/core/contract/ContractTest.kt rename to core/src/test/kotlin/com/expediagroup/sdk/core/contract/ContractTest.kt index b4c3d4c20..9343f04e4 100644 --- a/src/test/kotlin/com/expediagroup/openworld/sdk/core/contract/ContractTest.kt +++ b/core/src/test/kotlin/com/expediagroup/sdk/core/contract/ContractTest.kt @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.expediagroup.openworld.sdk.core.contract +package com.expediagroup.sdk.core.contract import org.junit.jupiter.api.Assertions.assertEquals import org.junit.jupiter.api.Test diff --git a/src/test/kotlin/com/expediagroup/openworld/sdk/core/plugin/authentication/AuthenticationPluginTest.kt b/core/src/test/kotlin/com/expediagroup/sdk/core/plugin/authentication/AuthenticationPluginTest.kt similarity index 74% rename from src/test/kotlin/com/expediagroup/openworld/sdk/core/plugin/authentication/AuthenticationPluginTest.kt rename to core/src/test/kotlin/com/expediagroup/sdk/core/plugin/authentication/AuthenticationPluginTest.kt index e297a6e1a..a1ddc7db4 100644 --- a/src/test/kotlin/com/expediagroup/openworld/sdk/core/plugin/authentication/AuthenticationPluginTest.kt +++ b/core/src/test/kotlin/com/expediagroup/sdk/core/plugin/authentication/AuthenticationPluginTest.kt @@ -13,17 +13,17 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.expediagroup.openworld.sdk.core.plugin.authentication +package com.expediagroup.sdk.core.plugin.authentication -import com.expediagroup.openworld.sdk.core.constant.Authentication.BEARER -import com.expediagroup.openworld.sdk.core.constant.Authentication.EAN -import com.expediagroup.openworld.sdk.core.constant.HeaderKey -import com.expediagroup.openworld.sdk.core.model.exception.service.OpenWorldAuthException -import com.expediagroup.openworld.sdk.core.test.ClientFactory -import com.expediagroup.openworld.sdk.core.test.MockEngineFactory -import com.expediagroup.openworld.sdk.core.test.TestConstants.ACCESS_TOKEN -import com.expediagroup.openworld.sdk.core.test.TestConstants.ANY_URL -import com.expediagroup.openworld.sdk.core.test.TestConstants.CLIENT_KEY_TEST_CREDENTIAL +import com.expediagroup.sdk.core.constant.Authentication.BEARER +import com.expediagroup.sdk.core.constant.Authentication.EAN +import com.expediagroup.sdk.core.constant.HeaderKey +import com.expediagroup.sdk.core.model.exception.service.ExpediaGroupAuthException +import com.expediagroup.sdk.core.test.ClientFactory +import com.expediagroup.sdk.core.test.MockEngineFactory +import com.expediagroup.sdk.core.test.TestConstants.ACCESS_TOKEN +import com.expediagroup.sdk.core.test.TestConstants.ANY_URL +import com.expediagroup.sdk.core.test.TestConstants.CLIENT_KEY_TEST_CREDENTIAL import io.ktor.client.request.get import io.ktor.client.statement.request import io.ktor.http.HttpStatusCode @@ -56,7 +56,7 @@ internal open class AuthenticationPluginTest { fun `given two different-auth instances then each functions independently`() { runBlocking { val signatureHttpClient = ClientFactory.createRapidClient().httpClient - val bearerHttpClient = ClientFactory.createOpenWorldClient().httpClient + val bearerHttpClient = ClientFactory.createExpediaGroupClient().httpClient val signatureRequest = signatureHttpClient.get(ANY_URL) val bearerRequest = bearerHttpClient.get(ANY_URL) @@ -74,12 +74,12 @@ internal open class AuthenticationPluginTest { @Test fun `given two similar-auth instances then each functions independently`() { runBlocking { - val firstClient = ClientFactory.createOpenWorldClient() + val firstClient = ClientFactory.createExpediaGroupClient() val firstHttpClient = firstClient.httpClient val firstAuth = firstClient.getAuthenticationStrategy() mockkObject(firstAuth) - val secondClient = ClientFactory.createOpenWorldClient() + val secondClient = ClientFactory.createExpediaGroupClient() val secondHttpClient = secondClient.httpClient val secondAuth = secondClient.getAuthenticationStrategy() mockkObject(secondAuth) @@ -102,18 +102,18 @@ internal open class AuthenticationPluginTest { @Test fun `given two requests when authentication fails then renew token should be called for both of them`() { runBlocking { - val client = ClientFactory.createOpenWorldClient( + val client = ClientFactory.createExpediaGroupClient( MockEngineFactory.createUnauthorizedMockEngineWithStatusCode(HttpStatusCode.Unauthorized), - ClientFactory.openWorldConfiguration + ClientFactory.expediaGroupConfiguration ) val httpClient = client.httpClient val auth = client.getAuthenticationStrategy() mockkObject(auth) - assertThrows { + assertThrows { httpClient.get(ANY_URL) } - assertThrows { + assertThrows { httpClient.get(ANY_URL) } diff --git a/src/test/kotlin/com/expediagroup/openworld/sdk/core/plugin/authentication/helper/SuccessfulStatusCodesArgumentProvider.kt b/core/src/test/kotlin/com/expediagroup/sdk/core/plugin/authentication/helper/SuccessfulStatusCodesArgumentProvider.kt similarity index 94% rename from src/test/kotlin/com/expediagroup/openworld/sdk/core/plugin/authentication/helper/SuccessfulStatusCodesArgumentProvider.kt rename to core/src/test/kotlin/com/expediagroup/sdk/core/plugin/authentication/helper/SuccessfulStatusCodesArgumentProvider.kt index ca6910920..b05f6cb3b 100644 --- a/src/test/kotlin/com/expediagroup/openworld/sdk/core/plugin/authentication/helper/SuccessfulStatusCodesArgumentProvider.kt +++ b/core/src/test/kotlin/com/expediagroup/sdk/core/plugin/authentication/helper/SuccessfulStatusCodesArgumentProvider.kt @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.expediagroup.openworld.sdk.core.plugin.authentication.helper +package com.expediagroup.sdk.core.plugin.authentication.helper import io.ktor.http.HttpStatusCode import org.junit.jupiter.api.extension.ExtensionContext diff --git a/src/test/kotlin/com/expediagroup/openworld/sdk/core/plugin/authentication/helper/UnsuccessfulStatusCodesArgumentProvider.kt b/core/src/test/kotlin/com/expediagroup/sdk/core/plugin/authentication/helper/UnsuccessfulStatusCodesArgumentProvider.kt similarity index 94% rename from src/test/kotlin/com/expediagroup/openworld/sdk/core/plugin/authentication/helper/UnsuccessfulStatusCodesArgumentProvider.kt rename to core/src/test/kotlin/com/expediagroup/sdk/core/plugin/authentication/helper/UnsuccessfulStatusCodesArgumentProvider.kt index 714009707..4b55b6ecc 100644 --- a/src/test/kotlin/com/expediagroup/openworld/sdk/core/plugin/authentication/helper/UnsuccessfulStatusCodesArgumentProvider.kt +++ b/core/src/test/kotlin/com/expediagroup/sdk/core/plugin/authentication/helper/UnsuccessfulStatusCodesArgumentProvider.kt @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.expediagroup.openworld.sdk.core.plugin.authentication.helper +package com.expediagroup.sdk.core.plugin.authentication.helper import io.ktor.http.HttpStatusCode import org.junit.jupiter.api.extension.ExtensionContext diff --git a/src/test/kotlin/com/expediagroup/openworld/sdk/core/plugin/authentication/strategy/AuthenticationStrategyTest.kt b/core/src/test/kotlin/com/expediagroup/sdk/core/plugin/authentication/strategy/AuthenticationStrategyTest.kt similarity index 79% rename from src/test/kotlin/com/expediagroup/openworld/sdk/core/plugin/authentication/strategy/AuthenticationStrategyTest.kt rename to core/src/test/kotlin/com/expediagroup/sdk/core/plugin/authentication/strategy/AuthenticationStrategyTest.kt index 7ae570e9e..6f30c2b90 100644 --- a/src/test/kotlin/com/expediagroup/openworld/sdk/core/plugin/authentication/strategy/AuthenticationStrategyTest.kt +++ b/core/src/test/kotlin/com/expediagroup/sdk/core/plugin/authentication/strategy/AuthenticationStrategyTest.kt @@ -13,11 +13,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.expediagroup.openworld.sdk.core.plugin.authentication.strategy +package com.expediagroup.sdk.core.plugin.authentication.strategy -import com.expediagroup.openworld.sdk.core.configuration.Credentials -import com.expediagroup.openworld.sdk.core.plugin.authentication.AuthenticationConfiguration -import com.expediagroup.openworld.sdk.core.test.TestConstants +import com.expediagroup.sdk.core.configuration.Credentials +import com.expediagroup.sdk.core.plugin.authentication.AuthenticationConfiguration +import com.expediagroup.sdk.core.test.TestConstants import io.ktor.client.HttpClient import io.ktor.client.HttpClientConfig import io.ktor.client.engine.okhttp.OkHttp @@ -41,7 +41,7 @@ internal class AuthenticationStrategyTest { ) val strategy = AuthenticationStrategy.from(configuration) { HttpClient(OkHttp.create()) } - assertThat(strategy is OpenWorldAuthenticationStrategy) + assertThat(strategy is ExpediaGroupAuthenticationStrategy) } } } diff --git a/src/test/kotlin/com/expediagroup/openworld/sdk/core/plugin/authentication/strategy/RapidAuthenticationStrategyTest.kt b/core/src/test/kotlin/com/expediagroup/sdk/core/plugin/authentication/strategy/RapidAuthenticationStrategyTest.kt similarity index 82% rename from src/test/kotlin/com/expediagroup/openworld/sdk/core/plugin/authentication/strategy/RapidAuthenticationStrategyTest.kt rename to core/src/test/kotlin/com/expediagroup/sdk/core/plugin/authentication/strategy/RapidAuthenticationStrategyTest.kt index 876547143..a997d0f5e 100644 --- a/src/test/kotlin/com/expediagroup/openworld/sdk/core/plugin/authentication/strategy/RapidAuthenticationStrategyTest.kt +++ b/core/src/test/kotlin/com/expediagroup/sdk/core/plugin/authentication/strategy/RapidAuthenticationStrategyTest.kt @@ -13,15 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.expediagroup.openworld.sdk.core.plugin.authentication.strategy +package com.expediagroup.sdk.core.plugin.authentication.strategy -import com.expediagroup.openworld.sdk.core.constant.Authentication.EAN -import com.expediagroup.openworld.sdk.core.constant.HeaderKey -import com.expediagroup.openworld.sdk.core.plugin.authentication.AuthenticationPluginTest -import com.expediagroup.openworld.sdk.core.plugin.authentication.getAuthenticationStrategy -import com.expediagroup.openworld.sdk.core.test.ClientFactory -import com.expediagroup.openworld.sdk.core.test.TestConstants -import com.expediagroup.openworld.sdk.core.test.TestConstants.ANY_URL +import com.expediagroup.sdk.core.constant.Authentication.EAN +import com.expediagroup.sdk.core.constant.HeaderKey +import com.expediagroup.sdk.core.plugin.authentication.AuthenticationPluginTest +import com.expediagroup.sdk.core.plugin.authentication.getAuthenticationStrategy +import com.expediagroup.sdk.core.test.ClientFactory +import com.expediagroup.sdk.core.test.TestConstants +import com.expediagroup.sdk.core.test.TestConstants.ANY_URL import io.ktor.client.request.get import io.ktor.client.statement.request import io.mockk.mockkObject diff --git a/src/test/kotlin/com/expediagroup/openworld/sdk/core/plugin/encoding/EncodingPluginTest.kt b/core/src/test/kotlin/com/expediagroup/sdk/core/plugin/encoding/EncodingPluginTest.kt similarity index 83% rename from src/test/kotlin/com/expediagroup/openworld/sdk/core/plugin/encoding/EncodingPluginTest.kt rename to core/src/test/kotlin/com/expediagroup/sdk/core/plugin/encoding/EncodingPluginTest.kt index 13821707f..b2f988126 100644 --- a/src/test/kotlin/com/expediagroup/openworld/sdk/core/plugin/encoding/EncodingPluginTest.kt +++ b/core/src/test/kotlin/com/expediagroup/sdk/core/plugin/encoding/EncodingPluginTest.kt @@ -13,14 +13,14 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.expediagroup.openworld.sdk.core.plugin.encoding +package com.expediagroup.sdk.core.plugin.encoding -import com.expediagroup.openworld.sdk.core.constant.HeaderKey -import com.expediagroup.openworld.sdk.core.test.ClientFactory -import com.expediagroup.openworld.sdk.core.test.TestConstants.ANY_URL -import com.expediagroup.openworld.sdk.core.test.TestConstants.GZIP -import com.expediagroup.openworld.sdk.core.test.TestConstants.SUCCESSFUL_DUMMY_REQUEST -import com.expediagroup.openworld.sdk.core.test.TestConstants.TEXT_PLAIN +import com.expediagroup.sdk.core.constant.HeaderKey +import com.expediagroup.sdk.core.test.ClientFactory +import com.expediagroup.sdk.core.test.TestConstants.ANY_URL +import com.expediagroup.sdk.core.test.TestConstants.GZIP +import com.expediagroup.sdk.core.test.TestConstants.SUCCESSFUL_DUMMY_REQUEST +import com.expediagroup.sdk.core.test.TestConstants.TEXT_PLAIN import io.ktor.client.call.body import io.ktor.client.engine.mock.MockEngine import io.ktor.client.engine.mock.MockRequestHandleScope @@ -43,7 +43,7 @@ internal class EncodingPluginTest { @Test fun `adds accept-encoding=gzip to request headers`() { runBlocking { - val httpClient = ClientFactory.createOpenWorldClient().httpClient + val httpClient = ClientFactory.createExpediaGroupClient().httpClient val testRequest = httpClient.get(ANY_URL) Assertions.assertThat(testRequest.request.headers[HeaderKey.ACCEPT_ENCODING]).isEqualTo( diff --git a/src/test/kotlin/com/expediagroup/openworld/sdk/core/plugin/httptimeout/HttpTimeoutPluginTest.kt b/core/src/test/kotlin/com/expediagroup/sdk/core/plugin/httptimeout/HttpTimeoutPluginTest.kt similarity index 69% rename from src/test/kotlin/com/expediagroup/openworld/sdk/core/plugin/httptimeout/HttpTimeoutPluginTest.kt rename to core/src/test/kotlin/com/expediagroup/sdk/core/plugin/httptimeout/HttpTimeoutPluginTest.kt index d38c652fc..29a89fa84 100644 --- a/src/test/kotlin/com/expediagroup/openworld/sdk/core/plugin/httptimeout/HttpTimeoutPluginTest.kt +++ b/core/src/test/kotlin/com/expediagroup/sdk/core/plugin/httptimeout/HttpTimeoutPluginTest.kt @@ -13,13 +13,13 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.expediagroup.openworld.sdk.core.plugin.httptimeout +package com.expediagroup.sdk.core.plugin.httptimeout -import com.expediagroup.openworld.sdk.core.configuration.OpenWorldClientConfiguration -import com.expediagroup.openworld.sdk.core.configuration.provider.OpenWorldConfigurationProvider -import com.expediagroup.openworld.sdk.core.test.ClientFactory -import com.expediagroup.openworld.sdk.core.test.MockEngineFactory -import com.expediagroup.openworld.sdk.core.test.TestConstants +import com.expediagroup.sdk.core.configuration.ExpediaGroupClientConfiguration +import com.expediagroup.sdk.core.configuration.provider.ExpediaGroupConfigurationProvider +import com.expediagroup.sdk.core.test.ClientFactory +import com.expediagroup.sdk.core.test.MockEngineFactory +import com.expediagroup.sdk.core.test.TestConstants import io.ktor.client.plugins.HttpRequestTimeoutException import io.ktor.client.request.get import io.ktor.http.HttpStatusCode @@ -42,19 +42,19 @@ internal class HttpTimeoutPluginTest { clearAllMocks() } - private val openWorldConfiguration = OpenWorldClientConfiguration( + private val expediaGroupConfiguration = ExpediaGroupClientConfiguration( key = TestConstants.CLIENT_KEY_TEST_CREDENTIAL, secret = TestConstants.CLIENT_SECRET_TEST_CREDENTIAL, - endpoint = OpenWorldConfigurationProvider.endpoint, - authEndpoint = OpenWorldConfigurationProvider.authEndpoint, + endpoint = ExpediaGroupConfigurationProvider.endpoint, + authEndpoint = ExpediaGroupConfigurationProvider.authEndpoint, requestTimeout = 3_000 ) @Test fun `get a response with timeout`() { - val client = ClientFactory.createOpenWorldClient( + val client = ClientFactory.createExpediaGroupClient( mockEngine = MockEngineFactory.createMockEngineDelayedResponse(5_000), - configuration = openWorldConfiguration + configuration = expediaGroupConfiguration ) assertThrows { @@ -64,9 +64,9 @@ internal class HttpTimeoutPluginTest { @Test fun `get a response without timeout`() { - val client = ClientFactory.createOpenWorldClient( + val client = ClientFactory.createExpediaGroupClient( mockEngine = MockEngineFactory.createMockEngineDelayedResponse(250), - configuration = openWorldConfiguration + configuration = expediaGroupConfiguration ) runBlocking { diff --git a/src/test/kotlin/com/expediagroup/openworld/sdk/core/plugin/logging/OpenWorldLoggerTest.kt b/core/src/test/kotlin/com/expediagroup/sdk/core/plugin/logging/ExpediaGroupLoggerTest.kt similarity index 83% rename from src/test/kotlin/com/expediagroup/openworld/sdk/core/plugin/logging/OpenWorldLoggerTest.kt rename to core/src/test/kotlin/com/expediagroup/sdk/core/plugin/logging/ExpediaGroupLoggerTest.kt index 361e5adb0..db6f5bf13 100644 --- a/src/test/kotlin/com/expediagroup/openworld/sdk/core/plugin/logging/OpenWorldLoggerTest.kt +++ b/core/src/test/kotlin/com/expediagroup/sdk/core/plugin/logging/ExpediaGroupLoggerTest.kt @@ -13,24 +13,24 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.expediagroup.openworld.sdk.core.plugin.logging +package com.expediagroup.sdk.core.plugin.logging -import com.expediagroup.openworld.sdk.core.constant.LoggingMessage.LOGGING_PREFIX -import com.expediagroup.openworld.sdk.core.constant.LoggingMessage.OMITTED +import com.expediagroup.sdk.core.constant.LoggingMessage.LOGGING_PREFIX +import com.expediagroup.sdk.core.constant.LoggingMessage.OMITTED import io.mockk.every import io.mockk.mockkClass import io.mockk.verify import org.junit.jupiter.api.Test import org.slf4j.Logger -class OpenWorldLoggerTest { +class ExpediaGroupLoggerTest { @Test fun `should prepend info logging`() { val mockedLogger = createMockedLogger() - val openWorldLogger = OpenWorldLogger(mockedLogger) + val expediaGroupLogger = ExpediaGroupLogger(mockedLogger) val message = "message" - openWorldLogger.info(message) + expediaGroupLogger.info(message) verify(exactly = 1) { mockedLogger.info("$LOGGING_PREFIX $message") } } @@ -38,10 +38,10 @@ class OpenWorldLoggerTest { @Test fun `should prepend warn logging`() { val mockedLogger = createMockedLogger() - val openWorldLogger = OpenWorldLogger(mockedLogger) + val expediaGroupLogger = ExpediaGroupLogger(mockedLogger) val message = "message" - openWorldLogger.warn(message) + expediaGroupLogger.warn(message) verify(exactly = 1) { mockedLogger.warn("$LOGGING_PREFIX $message") } } @@ -49,7 +49,7 @@ class OpenWorldLoggerTest { @Test fun `should mask authorization fields`() { val mockedLogger = createMockedLogger() - val openWorldLogger = OpenWorldLogger(mockedLogger) + val expediaGroupLogger = ExpediaGroupLogger(mockedLogger) val message = """METHOD: HttpMethod(value=POST) COMMON HEADERS @@ -61,7 +61,7 @@ class OpenWorldLoggerTest { -> Content-Length: 0 BODY Content-Type: null BODY START""" - openWorldLogger.info(message) + expediaGroupLogger.info(message) val expectedLog = """$LOGGING_PREFIX METHOD: HttpMethod(value=POST) COMMON HEADERS diff --git a/src/test/kotlin/com/expediagroup/openworld/sdk/core/plugin/logging/LogMaskerTest.kt b/core/src/test/kotlin/com/expediagroup/sdk/core/plugin/logging/LogMaskerTest.kt similarity index 76% rename from src/test/kotlin/com/expediagroup/openworld/sdk/core/plugin/logging/LogMaskerTest.kt rename to core/src/test/kotlin/com/expediagroup/sdk/core/plugin/logging/LogMaskerTest.kt index ac4cecb60..b3b732556 100644 --- a/src/test/kotlin/com/expediagroup/openworld/sdk/core/plugin/logging/LogMaskerTest.kt +++ b/core/src/test/kotlin/com/expediagroup/sdk/core/plugin/logging/LogMaskerTest.kt @@ -13,14 +13,14 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.expediagroup.openworld.sdk.core.plugin.logging +package com.expediagroup.sdk.core.plugin.logging -import com.expediagroup.openworld.sdk.core.constant.Authentication.BASIC -import com.expediagroup.openworld.sdk.core.constant.Authentication.BEARER -import com.expediagroup.openworld.sdk.core.constant.Authentication.EAN -import com.expediagroup.openworld.sdk.core.constant.HeaderKey.AUTHORIZATION -import com.expediagroup.openworld.sdk.core.constant.LoggingMessage.OMITTED -import com.expediagroup.openworld.sdk.core.plugin.logging.MaskProvider.AuthMask +import com.expediagroup.sdk.core.constant.Authentication.BASIC +import com.expediagroup.sdk.core.constant.Authentication.BEARER +import com.expediagroup.sdk.core.constant.Authentication.EAN +import com.expediagroup.sdk.core.constant.HeaderKey.AUTHORIZATION +import com.expediagroup.sdk.core.constant.LoggingMessage.OMITTED +import com.expediagroup.sdk.core.plugin.logging.MaskProvider.AuthMask import io.mockk.mockkObject import io.mockk.verify import org.assertj.core.api.Assertions.assertThat diff --git a/src/test/kotlin/com/expediagroup/openworld/sdk/core/plugin/request/DefaultRequestPluginTest.kt b/core/src/test/kotlin/com/expediagroup/sdk/core/plugin/request/DefaultRequestPluginTest.kt similarity index 76% rename from src/test/kotlin/com/expediagroup/openworld/sdk/core/plugin/request/DefaultRequestPluginTest.kt rename to core/src/test/kotlin/com/expediagroup/sdk/core/plugin/request/DefaultRequestPluginTest.kt index a5cb25526..1dcb4f689 100644 --- a/src/test/kotlin/com/expediagroup/openworld/sdk/core/plugin/request/DefaultRequestPluginTest.kt +++ b/core/src/test/kotlin/com/expediagroup/sdk/core/plugin/request/DefaultRequestPluginTest.kt @@ -13,10 +13,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.expediagroup.openworld.sdk.core.plugin.request +package com.expediagroup.sdk.core.plugin.request -import com.expediagroup.openworld.sdk.core.configuration.provider.OpenWorldConfigurationProvider -import com.expediagroup.openworld.sdk.core.test.ClientFactory +import com.expediagroup.sdk.core.configuration.provider.ExpediaGroupConfigurationProvider +import com.expediagroup.sdk.core.test.ClientFactory import io.ktor.client.request.get import io.ktor.client.statement.request import kotlinx.coroutines.runBlocking @@ -28,11 +28,11 @@ internal class DefaultRequestPluginTest { @Test fun `making any http call with relative url should invoke the endpoint from the configuration`() { runBlocking { - val client = ClientFactory.createOpenWorldClient() + val client = ClientFactory.createExpediaGroupClient() val testRequest = client.httpClient.get("/any-url") Assertions.assertThat(testRequest.request.url.toString()).isEqualTo( - "${OpenWorldConfigurationProvider.endpoint}any-url" + "${ExpediaGroupConfigurationProvider.endpoint}any-url" ) } } diff --git a/core/src/test/kotlin/com/expediagroup/sdk/core/test/ClientFactory.kt b/core/src/test/kotlin/com/expediagroup/sdk/core/test/ClientFactory.kt new file mode 100644 index 000000000..bbcf0701a --- /dev/null +++ b/core/src/test/kotlin/com/expediagroup/sdk/core/test/ClientFactory.kt @@ -0,0 +1,62 @@ +/* + * Copyright (C) 2022 Expedia, Inc. + * + * 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 + * + * 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. + */ +package com.expediagroup.sdk.core.test + +import com.expediagroup.sdk.core.client.BaseRapidClient +import com.expediagroup.sdk.core.client.ExpediaGroupClient +import com.expediagroup.sdk.core.configuration.ExpediaGroupClientConfiguration +import com.expediagroup.sdk.core.configuration.RapidClientConfiguration +import com.expediagroup.sdk.core.configuration.provider.ExpediaGroupConfigurationProvider +import com.expediagroup.sdk.core.configuration.provider.RapidConfigurationProvider +import com.expediagroup.sdk.core.model.exception.service.ExpediaGroupServiceException +import com.expediagroup.sdk.core.test.TestConstants.CLIENT_KEY_TEST_CREDENTIAL +import com.expediagroup.sdk.core.test.TestConstants.CLIENT_SECRET_TEST_CREDENTIAL +import io.ktor.client.engine.HttpClientEngine +import io.ktor.client.engine.mock.MockEngine +import io.ktor.client.statement.HttpResponse + +internal object ClientFactory { + val expediaGroupConfiguration = ExpediaGroupClientConfiguration( + key = CLIENT_KEY_TEST_CREDENTIAL, + secret = CLIENT_SECRET_TEST_CREDENTIAL, + endpoint = ExpediaGroupConfigurationProvider.endpoint, + authEndpoint = ExpediaGroupConfigurationProvider.authEndpoint, + requestTimeout = ExpediaGroupConfigurationProvider.requestTimeout + ) + + private val rapidConfiguration = RapidClientConfiguration( + key = CLIENT_KEY_TEST_CREDENTIAL, + secret = CLIENT_SECRET_TEST_CREDENTIAL, + endpoint = RapidConfigurationProvider.endpoint + ) + + fun createExpediaGroupClient(): ExpediaGroupClient = createExpediaGroupClient(MockEngineFactory.createDefaultEngine(), expediaGroupConfiguration) + + fun createExpediaGroupClient(mockEngine: MockEngine): ExpediaGroupClient = createExpediaGroupClient(mockEngine, expediaGroupConfiguration) + fun createExpediaGroupClient(mockEngine: HttpClientEngine, configuration: ExpediaGroupClientConfiguration): ExpediaGroupClient = object : ExpediaGroupClient(configuration, mockEngine) { + override suspend fun throwServiceException(response: HttpResponse, operationId: String) { + throw ExpediaGroupServiceException("Dummy service exception") + } + } + + fun createRapidClient(mockEngine: HttpClientEngine): BaseRapidClient = object : BaseRapidClient(rapidConfiguration, mockEngine) { + override suspend fun throwServiceException(response: HttpResponse, operationId: String) { + throw ExpediaGroupServiceException("Dummy service exception") + } + } + + fun createRapidClient(): BaseRapidClient = createRapidClient(MockEngineFactory.createEmptyResponseEngine()) +} diff --git a/src/test/kotlin/com/expediagroup/openworld/sdk/core/test/MockEngineFactory.kt b/core/src/test/kotlin/com/expediagroup/sdk/core/test/MockEngineFactory.kt similarity index 84% rename from src/test/kotlin/com/expediagroup/openworld/sdk/core/test/MockEngineFactory.kt rename to core/src/test/kotlin/com/expediagroup/sdk/core/test/MockEngineFactory.kt index c28403035..256d3b238 100644 --- a/src/test/kotlin/com/expediagroup/openworld/sdk/core/test/MockEngineFactory.kt +++ b/core/src/test/kotlin/com/expediagroup/sdk/core/test/MockEngineFactory.kt @@ -13,21 +13,21 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.expediagroup.openworld.sdk.core.test - -import com.expediagroup.openworld.sdk.core.configuration.provider.OpenWorldConfigurationProvider -import com.expediagroup.openworld.sdk.core.constant.Authentication.BEARER -import com.expediagroup.openworld.sdk.core.constant.Constant.EMPTY_STRING -import com.expediagroup.openworld.sdk.core.constant.HeaderKey -import com.expediagroup.openworld.sdk.core.model.exception.service.OpenWorldAuthException -import com.expediagroup.openworld.sdk.core.test.TestConstants.ACCESS_TOKEN -import com.expediagroup.openworld.sdk.core.test.TestConstants.APPLICATION_JSON -import com.expediagroup.openworld.sdk.core.test.TestConstants.BAD_REQUEST_ATTRIBUTE -import com.expediagroup.openworld.sdk.core.test.TestConstants.BASIC -import com.expediagroup.openworld.sdk.core.test.TestConstants.CLIENT_KEY_TEST_CREDENTIAL -import com.expediagroup.openworld.sdk.core.test.TestConstants.CLIENT_SECRET_TEST_CREDENTIAL -import com.expediagroup.openworld.sdk.core.test.TestConstants.SUCCESSFUL_DUMMY_REQUEST -import com.expediagroup.openworld.sdk.core.test.TestConstants.TEST_URL +package com.expediagroup.sdk.core.test + +import com.expediagroup.sdk.core.configuration.provider.ExpediaGroupConfigurationProvider +import com.expediagroup.sdk.core.constant.Authentication.BEARER +import com.expediagroup.sdk.core.constant.Constant.EMPTY_STRING +import com.expediagroup.sdk.core.constant.HeaderKey +import com.expediagroup.sdk.core.model.exception.service.ExpediaGroupAuthException +import com.expediagroup.sdk.core.test.TestConstants.ACCESS_TOKEN +import com.expediagroup.sdk.core.test.TestConstants.APPLICATION_JSON +import com.expediagroup.sdk.core.test.TestConstants.BAD_REQUEST_ATTRIBUTE +import com.expediagroup.sdk.core.test.TestConstants.BASIC +import com.expediagroup.sdk.core.test.TestConstants.CLIENT_KEY_TEST_CREDENTIAL +import com.expediagroup.sdk.core.test.TestConstants.CLIENT_SECRET_TEST_CREDENTIAL +import com.expediagroup.sdk.core.test.TestConstants.SUCCESSFUL_DUMMY_REQUEST +import com.expediagroup.sdk.core.test.TestConstants.TEST_URL import io.ktor.client.engine.HttpClientEngine import io.ktor.client.engine.mock.MockEngine import io.ktor.client.engine.mock.MockRequestHandleScope @@ -56,7 +56,7 @@ object MockEngineFactory { } else if (isBadRequest(request)) { errorResponse() } else { - throw OpenWorldAuthException(HttpStatusCode.InternalServerError, "unsupported case in the mock engine") + throw ExpediaGroupAuthException(HttpStatusCode.InternalServerError, "unsupported case in the mock engine") } } @@ -125,7 +125,7 @@ object MockEngineFactory { ) } - private fun isIdentityRequest(request: HttpRequestData): Boolean = request.url.toString() == OpenWorldConfigurationProvider.authEndpoint + private fun isIdentityRequest(request: HttpRequestData): Boolean = request.url.toString() == ExpediaGroupConfigurationProvider.authEndpoint private fun isBadRequest(request: HttpRequestData): Boolean = request.attributes.getOrNull(AttributeKey(BAD_REQUEST_ATTRIBUTE)) != null diff --git a/src/test/kotlin/com/expediagroup/openworld/sdk/core/test/TestConstants.kt b/core/src/test/kotlin/com/expediagroup/sdk/core/test/TestConstants.kt similarity index 95% rename from src/test/kotlin/com/expediagroup/openworld/sdk/core/test/TestConstants.kt rename to core/src/test/kotlin/com/expediagroup/sdk/core/test/TestConstants.kt index 2998c5e78..4a48eccac 100644 --- a/src/test/kotlin/com/expediagroup/openworld/sdk/core/test/TestConstants.kt +++ b/core/src/test/kotlin/com/expediagroup/sdk/core/test/TestConstants.kt @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.expediagroup.openworld.sdk.core.test +package com.expediagroup.sdk.core.test object TestConstants { const val TEST_URL = "https://example.com" diff --git a/src/test/resources/configurations-empty.properties b/core/src/test/resources/configurations-empty.properties similarity index 100% rename from src/test/resources/configurations-empty.properties rename to core/src/test/resources/configurations-empty.properties diff --git a/src/test/resources/configurations-without-slash.properties b/core/src/test/resources/configurations-without-slash.properties similarity index 100% rename from src/test/resources/configurations-without-slash.properties rename to core/src/test/resources/configurations-without-slash.properties diff --git a/src/test/resources/configurations.properties b/core/src/test/resources/configurations.properties similarity index 100% rename from src/test/resources/configurations.properties rename to core/src/test/resources/configurations.properties diff --git a/src/test/resources/credentials-empty.properties b/core/src/test/resources/credentials-empty.properties similarity index 100% rename from src/test/resources/credentials-empty.properties rename to core/src/test/resources/credentials-empty.properties diff --git a/src/test/resources/credentials.properties b/core/src/test/resources/credentials.properties similarity index 100% rename from src/test/resources/credentials.properties rename to core/src/test/resources/credentials.properties diff --git a/src/test/resources/test_configuration.properties b/core/src/test/resources/test_configuration.properties similarity index 100% rename from src/test/resources/test_configuration.properties rename to core/src/test/resources/test_configuration.properties diff --git a/generator/CHANGELOG.md b/generator/CHANGELOG.md index 1599bde80..edde50120 100644 --- a/generator/CHANGELOG.md +++ b/generator/CHANGELOG.md @@ -1,6 +1,6 @@ -# Open World SDK Generator Change Log +# ExpediaGroup SDK Generator Change Log All notable changes to this project will be documented in this file. ### [0.0.1] 2022.08.xx -* Initial release \ No newline at end of file +* Initial release diff --git a/generator/README.md b/generator/README.md index 02c0b1a15..62abeea19 100644 --- a/generator/README.md +++ b/generator/README.md @@ -1,5 +1,5 @@ -# Open World TM SDK for Java - Generators -The generators component for the Open WorldTM SDK for Java. +# Expedia GroupTM SDK for Java - Generators +The generators component for the Expedia GroupTM SDK for Java. ## Generating SDKs diff --git a/generator/openapi/pom.xml b/generator/openapi/pom.xml index e2515333f..6828ed31e 100644 --- a/generator/openapi/pom.xml +++ b/generator/openapi/pom.xml @@ -3,12 +3,12 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 - com.expediagroup.openworld.sdk + com.expediagroup.sdk travel-sdk-generators-openapi 1.1.0 - EG Open World SDK Tooling :: Generators :: OpenAPI + EG SDK Tooling :: Generators :: OpenAPI SDK Generator for building SDKs based on OpenAPI specs - https://github.com/ExpediaGroup/openworld-sdk-java-generators/tree/main/openapi + https://github.com/ExpediaGroup/expediagroup-java-sdk-generators/tree/main/openapi 2022 @@ -29,9 +29,9 @@ - scm:git:git@github.com:ExpediaGroup/openworld-sdk-java.git/travel-sdk-generators-openapi - scm:git:git@github.com:ExpediaGroup/openworld-sdk-java.git/travel-sdk-generators-openapi - https://github.com/ExpediaGroup/openworld-sdk-java/travel-sdk-generators-openapi + scm:git:git@github.com:ExpediaGroup/expediagroup-java-sdk.git/travel-sdk-generators-openapi + scm:git:git@github.com:ExpediaGroup/expediagroup-java-sdk.git/travel-sdk-generators-openapi + https://github.com/ExpediaGroup/expediagroup-java-sdk/travel-sdk-generators-openapi @@ -57,7 +57,7 @@ UTF-8 - com.expediagroup.openworld.sdk.generators.openapi.OpenApiSdkGenerator + com.expediagroup.sdk.generators.openapi.OpenApiSdkGenerator ${project.basedir}/src/test/resources/specs.yaml @@ -306,6 +306,41 @@ @@ + + + include-core + generate-sources + + copy-resources + + + ${basedir}/target/sdk/src/main + + + ../../core/src/main + + + + + + include-license-header + generate-sources + + copy-resources + + + ${basedir}/target/sdk/ + + + . + + LICENSE-HEADER.txt + + + + + + diff --git a/generator/openapi/src/main/kotlin/com/expediagroup/openworld/sdk/generators/openapi/Discriminator.kt b/generator/openapi/src/main/kotlin/com/expediagroup/sdk/generators/openapi/Discriminator.kt similarity index 96% rename from generator/openapi/src/main/kotlin/com/expediagroup/openworld/sdk/generators/openapi/Discriminator.kt rename to generator/openapi/src/main/kotlin/com/expediagroup/sdk/generators/openapi/Discriminator.kt index 6a99b32cf..641ec5d33 100644 --- a/generator/openapi/src/main/kotlin/com/expediagroup/openworld/sdk/generators/openapi/Discriminator.kt +++ b/generator/openapi/src/main/kotlin/com/expediagroup/sdk/generators/openapi/Discriminator.kt @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.expediagroup.openworld.sdk.generators.openapi +package com.expediagroup.sdk.generators.openapi import org.openapitools.codegen.CodegenModel diff --git a/generator/openapi/src/main/kotlin/com/expediagroup/openworld/sdk/generators/openapi/MustacheHelpers.kt b/generator/openapi/src/main/kotlin/com/expediagroup/sdk/generators/openapi/MustacheHelpers.kt similarity index 91% rename from generator/openapi/src/main/kotlin/com/expediagroup/openworld/sdk/generators/openapi/MustacheHelpers.kt rename to generator/openapi/src/main/kotlin/com/expediagroup/sdk/generators/openapi/MustacheHelpers.kt index 2ddd348e5..40c3e991c 100644 --- a/generator/openapi/src/main/kotlin/com/expediagroup/openworld/sdk/generators/openapi/MustacheHelpers.kt +++ b/generator/openapi/src/main/kotlin/com/expediagroup/sdk/generators/openapi/MustacheHelpers.kt @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.expediagroup.openworld.sdk.generators.openapi +package com.expediagroup.sdk.generators.openapi import com.samskivert.mustache.Mustache import org.openapitools.codegen.CodegenModel @@ -51,7 +51,7 @@ val mustacheHelpers = mapOf( operationsMap.operations.operation.forEach { operation -> operation.responses.forEach { response -> response.takeIf { !it.is2xx && !dataTypes.contains(it.dataType) }?.dataType?.also { - writer.write("class OpenWorldApi${it}Exception(code: Int, override val errorObject: $it) : OpenWorldApiException(code, errorObject)\n") + writer.write("class ExpediaGroupApi${it}Exception(code: Int, override val errorObject: $it) : ExpediaGroupApiException(code, errorObject)\n") dataTypes.add(it) } } diff --git a/generator/openapi/src/main/kotlin/com/expediagroup/openworld/sdk/generators/openapi/OpenApiSdkGenerator.kt b/generator/openapi/src/main/kotlin/com/expediagroup/sdk/generators/openapi/OpenApiSdkGenerator.kt similarity index 92% rename from generator/openapi/src/main/kotlin/com/expediagroup/openworld/sdk/generators/openapi/OpenApiSdkGenerator.kt rename to generator/openapi/src/main/kotlin/com/expediagroup/sdk/generators/openapi/OpenApiSdkGenerator.kt index 5601b209a..168dcd2ae 100644 --- a/generator/openapi/src/main/kotlin/com/expediagroup/openworld/sdk/generators/openapi/OpenApiSdkGenerator.kt +++ b/generator/openapi/src/main/kotlin/com/expediagroup/sdk/generators/openapi/OpenApiSdkGenerator.kt @@ -13,12 +13,12 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.expediagroup.openworld.sdk.generators.openapi +package com.expediagroup.sdk.generators.openapi -import com.expediagroup.openworld.sdk.model.ClientGenerationException -import com.expediagroup.openworld.sdk.product.Product -import com.expediagroup.openworld.sdk.product.ProductFamily -import com.expediagroup.openworld.sdk.product.ProgrammingLanguage +import com.expediagroup.sdk.model.ClientGenerationException +import com.expediagroup.sdk.product.Product +import com.expediagroup.sdk.product.ProductFamily +import com.expediagroup.sdk.product.ProgrammingLanguage import com.github.rvesse.airline.SingleCommand import com.github.rvesse.airline.annotations.Command import com.github.rvesse.airline.annotations.Option @@ -75,7 +75,7 @@ class OpenApiSdkGenerator { val product = Product(namespace, programmingLanguage) val config = CodegenConfigurator().apply { setGeneratorName("kotlin") - setTemplateDir("templates/openworld-sdk") + setTemplateDir("templates/expediagroup-sdk") setInputSpec(inputFile) setOutputDir(outputDirectory) setArtifactId(product.artifactId) @@ -102,7 +102,7 @@ class OpenApiSdkGenerator { addAdditionalProperty("language", product.programmingLanguage.id) addAdditionalProperty("isKotlin", ProgrammingLanguage.isKotlin(product.programmingLanguage)) addAdditionalProperty("isRapid", ProductFamily.isRapid(product.namespace)) - addAdditionalProperty("isOpenWorld", ProductFamily.isOpenWorld(product.namespace)) + addAdditionalProperty("isExpediaGroup", ProductFamily.isExpediaGroup(product.namespace)) // Mustache Helpers mustacheHelpers.forEach { (name, function) -> addAdditionalProperty(name, function()) } diff --git a/generator/openapi/src/main/kotlin/com/expediagroup/openworld/sdk/model/Exception.kt b/generator/openapi/src/main/kotlin/com/expediagroup/sdk/model/Exception.kt similarity index 95% rename from generator/openapi/src/main/kotlin/com/expediagroup/openworld/sdk/model/Exception.kt rename to generator/openapi/src/main/kotlin/com/expediagroup/sdk/model/Exception.kt index 113ec9300..d4bdaf3e1 100644 --- a/generator/openapi/src/main/kotlin/com/expediagroup/openworld/sdk/model/Exception.kt +++ b/generator/openapi/src/main/kotlin/com/expediagroup/sdk/model/Exception.kt @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.expediagroup.openworld.sdk.model +package com.expediagroup.sdk.model open class GeneratorException(message: String, cause: Throwable? = null) : RuntimeException(message, cause) diff --git a/generator/openapi/src/main/kotlin/com/expediagroup/openworld/sdk/product/Product.kt b/generator/openapi/src/main/kotlin/com/expediagroup/sdk/product/Product.kt similarity index 74% rename from generator/openapi/src/main/kotlin/com/expediagroup/openworld/sdk/product/Product.kt rename to generator/openapi/src/main/kotlin/com/expediagroup/sdk/product/Product.kt index aff97477a..35116bb3d 100644 --- a/generator/openapi/src/main/kotlin/com/expediagroup/openworld/sdk/product/Product.kt +++ b/generator/openapi/src/main/kotlin/com/expediagroup/sdk/product/Product.kt @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.expediagroup.openworld.sdk.product +package com.expediagroup.sdk.product val NON_ALPHANUMERIC_REGEX = Regex("[^a-zA-Z0-9]") @@ -29,20 +29,20 @@ class Product( val namespace: String = inputNamespace.replace(NON_ALPHANUMERIC_REGEX, "").lowercase() val apiPackage: String - get() = "com.expediagroup.openworld.sdk.$namespace.client" + get() = "com.expediagroup.sdk.$namespace.client" val artifactId: String - get() = "openworld-${programmingLanguage.id}-sdk-$namespace" + get() = "$namespace-sdk" val packagePath: String - get() = "src/main/kotlin/com/expediagroup/openworld/sdk/$namespace" + get() = "src/main/kotlin/com/expediagroup/sdk/$namespace" val packageName: String - get() = "com.expediagroup.openworld.sdk.$namespace" + get() = "com.expediagroup.sdk.$namespace" val groupId: String - get() = "com.expediagroup.openworld.sdk" + get() = "com.expediagroup" val shadePrefix: String - get() = "com.expediagroup.openworld.sdk" + get() = "com.expediagroup.sdk" } diff --git a/generator/openapi/src/main/kotlin/com/expediagroup/openworld/sdk/product/ProductFamily.kt b/generator/openapi/src/main/kotlin/com/expediagroup/sdk/product/ProductFamily.kt similarity index 79% rename from generator/openapi/src/main/kotlin/com/expediagroup/openworld/sdk/product/ProductFamily.kt rename to generator/openapi/src/main/kotlin/com/expediagroup/sdk/product/ProductFamily.kt index 1edb7fc3b..2c2301abb 100644 --- a/generator/openapi/src/main/kotlin/com/expediagroup/openworld/sdk/product/ProductFamily.kt +++ b/generator/openapi/src/main/kotlin/com/expediagroup/sdk/product/ProductFamily.kt @@ -13,10 +13,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.expediagroup.openworld.sdk.product +package com.expediagroup.sdk.product enum class ProductFamily(val id: String) { - OPEN_WORLD("openworld"), + EXPEDIA_GROUP("expediagroup"), RAPID("rapid"); companion object { @@ -29,11 +29,11 @@ enum class ProductFamily(val id: String) { fun isRapid(productFamily: String): Boolean = productFamily == RAPID.id /** - * Returns true if the product family is OpenWorld. + * Returns true if the product family is ExpediaGroup. * * @param productFamily The product family to check. - * @return True if the product family is OpenWorld. + * @return True if the product family is ExpediaGroup. */ - fun isOpenWorld(productFamily: String): Boolean = productFamily != RAPID.id + fun isExpediaGroup(productFamily: String): Boolean = productFamily != RAPID.id } } diff --git a/generator/openapi/src/main/kotlin/com/expediagroup/openworld/sdk/product/ProgrammingLanguage.kt b/generator/openapi/src/main/kotlin/com/expediagroup/sdk/product/ProgrammingLanguage.kt similarity index 96% rename from generator/openapi/src/main/kotlin/com/expediagroup/openworld/sdk/product/ProgrammingLanguage.kt rename to generator/openapi/src/main/kotlin/com/expediagroup/sdk/product/ProgrammingLanguage.kt index adf632ee2..ff17fbe0d 100644 --- a/generator/openapi/src/main/kotlin/com/expediagroup/openworld/sdk/product/ProgrammingLanguage.kt +++ b/generator/openapi/src/main/kotlin/com/expediagroup/sdk/product/ProgrammingLanguage.kt @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.expediagroup.openworld.sdk.product +package com.expediagroup.sdk.product enum class ProgrammingLanguage(val id: String) { JAVA("java"), diff --git a/generator/openapi/src/main/resources/templates/openworld-sdk/README.mustache b/generator/openapi/src/main/resources/templates/expediagroup-sdk/README.mustache similarity index 100% rename from generator/openapi/src/main/resources/templates/openworld-sdk/README.mustache rename to generator/openapi/src/main/resources/templates/expediagroup-sdk/README.mustache diff --git a/generator/openapi/src/main/resources/templates/openworld-sdk/api.mustache b/generator/openapi/src/main/resources/templates/expediagroup-sdk/api.mustache similarity index 100% rename from generator/openapi/src/main/resources/templates/openworld-sdk/api.mustache rename to generator/openapi/src/main/resources/templates/expediagroup-sdk/api.mustache diff --git a/generator/openapi/src/main/resources/templates/openworld-sdk/client/apiParam.mustache b/generator/openapi/src/main/resources/templates/expediagroup-sdk/client/apiParam.mustache similarity index 100% rename from generator/openapi/src/main/resources/templates/openworld-sdk/client/apiParam.mustache rename to generator/openapi/src/main/resources/templates/expediagroup-sdk/client/apiParam.mustache diff --git a/generator/openapi/src/main/resources/templates/openworld-sdk/client/apiParamsDecleration.mustache b/generator/openapi/src/main/resources/templates/expediagroup-sdk/client/apiParamsDecleration.mustache similarity index 100% rename from generator/openapi/src/main/resources/templates/openworld-sdk/client/apiParamsDecleration.mustache rename to generator/openapi/src/main/resources/templates/expediagroup-sdk/client/apiParamsDecleration.mustache diff --git a/generator/openapi/src/main/resources/templates/openworld-sdk/client/apiParamsPassed.mustache b/generator/openapi/src/main/resources/templates/expediagroup-sdk/client/apiParamsPassed.mustache similarity index 100% rename from generator/openapi/src/main/resources/templates/openworld-sdk/client/apiParamsPassed.mustache rename to generator/openapi/src/main/resources/templates/expediagroup-sdk/client/apiParamsPassed.mustache diff --git a/generator/openapi/src/main/resources/templates/expediagroup-sdk/client/authEndpoint.mustache b/generator/openapi/src/main/resources/templates/expediagroup-sdk/client/authEndpoint.mustache new file mode 100644 index 000000000..551864c55 --- /dev/null +++ b/generator/openapi/src/main/resources/templates/expediagroup-sdk/client/authEndpoint.mustache @@ -0,0 +1 @@ +{{#isExpediaGroup}}, authEndpoint{{/isExpediaGroup}} \ No newline at end of file diff --git a/generator/openapi/src/main/resources/templates/openworld-sdk/client/client.mustache b/generator/openapi/src/main/resources/templates/expediagroup-sdk/client/client.mustache similarity index 86% rename from generator/openapi/src/main/resources/templates/openworld-sdk/client/client.mustache rename to generator/openapi/src/main/resources/templates/expediagroup-sdk/client/client.mustache index cc4a55226..166325a11 100644 --- a/generator/openapi/src/main/resources/templates/openworld-sdk/client/client.mustache +++ b/generator/openapi/src/main/resources/templates/expediagroup-sdk/client/client.mustache @@ -4,11 +4,11 @@ import {{import}} import {{packageName}}.validation.PropertyConstraintsValidator.validateConstraints import {{packageName}}.models.exception.* -import com.expediagroup.openworld.sdk.core.client.{{>client/clientBase}} -import com.expediagroup.openworld.sdk.core.config.provider.FileConfigurationProvider -import com.expediagroup.openworld.sdk.core.configuration.{{>client/clientConfiguration}} -import com.expediagroup.openworld.sdk.core.model.exception.OpenWorldException -import com.expediagroup.openworld.sdk.core.model.exception.service.OpenWorldServiceException +import com.expediagroup.sdk.core.client.{{>client/clientBase}} +import com.expediagroup.sdk.core.config.provider.FileConfigurationProvider +import com.expediagroup.sdk.core.configuration.{{>client/clientConfiguration}} +import com.expediagroup.sdk.core.model.exception.ExpediaGroupException +import com.expediagroup.sdk.core.model.exception.service.ExpediaGroupServiceException import io.ktor.client.call.body import io.ktor.client.request.HttpRequestBuilder @@ -34,7 +34,7 @@ import java.util.UUID private val javaVersion = System.getProperty("java.version") private val operatingSystemName = System.getProperty("os.name") private val operatingSystemVersion = System.getProperty("os.version") - private val userAgent = "open-world-sdk-{{#isKotlin}}kotlin{{/isKotlin}}{{^isKotlin}}java{{/isKotlin}}-{{namespace}}/${loader.data()["sdk-version"]!!} (Java $javaVersion; $operatingSystemName $operatingSystemVersion)" + private val userAgent = "expediagroup-sdk-{{#isKotlin}}kotlin{{/isKotlin}}{{^isKotlin}}java{{/isKotlin}}-{{namespace}}/${loader.data()["sdk-version"]!!} (Java $javaVersion; $operatingSystemName $operatingSystemVersion)" class Builder : {{>client/clientBase}}.Builder() { override fun build(): {{classname}} = {{classname}}( @@ -107,13 +107,13 @@ import java.util.UUID {{#queryParams}} * @param {{{paramName}}} {{description}}{{^required}} (optional{{#defaultValue}}, default to {{{.}}}{{/defaultValue}}){{/required}}{{#required}}{{#defaultValue}} (default to {{{.}}}){{/defaultValue}}{{/required}} {{/queryParams}}{{#bodyParams}} * @param {{{paramName}}} {{description}}{{^required}} (optional{{#defaultValue}}, default to {{{.}}}{{/defaultValue}}){{/required}}{{#required}}{{#defaultValue}} (default to {{{.}}}){{/defaultValue}}{{/required}} {{/bodyParams}} {{#formParams}} * @param {{{paramName}}} {{description}}{{^required}} (optional{{#defaultValue}}, default to {{{.}}}{{/defaultValue}}){{/required}}{{#required}}{{#defaultValue}} (default to {{{.}}}){{/defaultValue}}{{/required}} - {{/formParams}}{{#responses}}{{^is2xx}}* @throws OpenWorldApi{{{dataType}}}Exception{{/is2xx}} + {{/formParams}}{{#responses}}{{^is2xx}}* @throws ExpediaGroupApi{{{dataType}}}Exception{{/is2xx}} {{/responses}}* @return {{{returnType}}}{{^returnType}}void{{/returnType}} */ @Throws( {{#responses}} {{^is2xx}} - OpenWorldApi{{{dataType}}}Exception::class{{^-last}},{{/-last}} + ExpediaGroupApi{{{dataType}}}Exception::class{{^-last}},{{/-last}} {{/is2xx}} {{/responses}} ) @@ -128,11 +128,11 @@ import java.util.UUID k{{operationId}}WithResponse({{>client/apiParamsPassed}}) }.get() } catch (exception: Exception) { - if (exception is OpenWorldException) throw exception + if (exception is ExpediaGroupException) throw exception when (val cause = exception.cause) { - is OpenWorldException -> throw cause - else -> throw OpenWorldException("OpenWorld Error", exception) + is ExpediaGroupException -> throw cause + else -> throw ExpediaGroupException("ExpediaGroup Error", exception) } } } diff --git a/generator/openapi/src/main/resources/templates/expediagroup-sdk/client/clientBase.mustache b/generator/openapi/src/main/resources/templates/expediagroup-sdk/client/clientBase.mustache new file mode 100644 index 000000000..0d0088183 --- /dev/null +++ b/generator/openapi/src/main/resources/templates/expediagroup-sdk/client/clientBase.mustache @@ -0,0 +1 @@ +{{#isRapid}}BaseRapidClient{{/isRapid}}{{#isExpediaGroup}}ExpediaGroupClient{{/isExpediaGroup}} \ No newline at end of file diff --git a/generator/openapi/src/main/resources/templates/expediagroup-sdk/client/clientConfiguration.mustache b/generator/openapi/src/main/resources/templates/expediagroup-sdk/client/clientConfiguration.mustache new file mode 100644 index 000000000..4bbadd0f9 --- /dev/null +++ b/generator/openapi/src/main/resources/templates/expediagroup-sdk/client/clientConfiguration.mustache @@ -0,0 +1 @@ +{{#isRapid}}RapidClientConfiguration{{/isRapid}}{{#isExpediaGroup}}ExpediaGroupClientConfiguration{{/isExpediaGroup}} \ No newline at end of file diff --git a/generator/openapi/src/main/resources/templates/openworld-sdk/client/paginator.mustache b/generator/openapi/src/main/resources/templates/expediagroup-sdk/client/paginator.mustache similarity index 100% rename from generator/openapi/src/main/resources/templates/openworld-sdk/client/paginator.mustache rename to generator/openapi/src/main/resources/templates/expediagroup-sdk/client/paginator.mustache diff --git a/generator/openapi/src/main/resources/templates/openworld-sdk/client/paginatorMethods.mustache b/generator/openapi/src/main/resources/templates/expediagroup-sdk/client/paginatorMethods.mustache similarity index 100% rename from generator/openapi/src/main/resources/templates/openworld-sdk/client/paginatorMethods.mustache rename to generator/openapi/src/main/resources/templates/expediagroup-sdk/client/paginatorMethods.mustache diff --git a/generator/openapi/src/main/resources/templates/openworld-sdk/client/responseDeclaration.mustache b/generator/openapi/src/main/resources/templates/expediagroup-sdk/client/responseDeclaration.mustache similarity index 100% rename from generator/openapi/src/main/resources/templates/openworld-sdk/client/responseDeclaration.mustache rename to generator/openapi/src/main/resources/templates/expediagroup-sdk/client/responseDeclaration.mustache diff --git a/generator/openapi/src/main/resources/templates/openworld-sdk/data_class.mustache b/generator/openapi/src/main/resources/templates/expediagroup-sdk/data_class.mustache similarity index 100% rename from generator/openapi/src/main/resources/templates/openworld-sdk/data_class.mustache rename to generator/openapi/src/main/resources/templates/expediagroup-sdk/data_class.mustache diff --git a/generator/openapi/src/main/resources/templates/openworld-sdk/data_class_opt_var.mustache b/generator/openapi/src/main/resources/templates/expediagroup-sdk/data_class_opt_var.mustache similarity index 100% rename from generator/openapi/src/main/resources/templates/openworld-sdk/data_class_opt_var.mustache rename to generator/openapi/src/main/resources/templates/expediagroup-sdk/data_class_opt_var.mustache diff --git a/generator/openapi/src/main/resources/templates/openworld-sdk/data_class_req_var.mustache b/generator/openapi/src/main/resources/templates/expediagroup-sdk/data_class_req_var.mustache similarity index 100% rename from generator/openapi/src/main/resources/templates/openworld-sdk/data_class_req_var.mustache rename to generator/openapi/src/main/resources/templates/expediagroup-sdk/data_class_req_var.mustache diff --git a/generator/openapi/src/main/resources/templates/openworld-sdk/enum_class.mustache b/generator/openapi/src/main/resources/templates/expediagroup-sdk/enum_class.mustache similarity index 100% rename from generator/openapi/src/main/resources/templates/openworld-sdk/enum_class.mustache rename to generator/openapi/src/main/resources/templates/expediagroup-sdk/enum_class.mustache diff --git a/generator/openapi/src/main/resources/templates/openworld-sdk/interface_opt_var.mustache b/generator/openapi/src/main/resources/templates/expediagroup-sdk/interface_opt_var.mustache similarity index 100% rename from generator/openapi/src/main/resources/templates/openworld-sdk/interface_opt_var.mustache rename to generator/openapi/src/main/resources/templates/expediagroup-sdk/interface_opt_var.mustache diff --git a/generator/openapi/src/main/resources/templates/openworld-sdk/interface_req_var.mustache b/generator/openapi/src/main/resources/templates/expediagroup-sdk/interface_req_var.mustache similarity index 100% rename from generator/openapi/src/main/resources/templates/openworld-sdk/interface_req_var.mustache rename to generator/openapi/src/main/resources/templates/expediagroup-sdk/interface_req_var.mustache diff --git a/generator/openapi/src/main/resources/templates/openworld-sdk/licenseInfo.mustache b/generator/openapi/src/main/resources/templates/expediagroup-sdk/licenseInfo.mustache similarity index 100% rename from generator/openapi/src/main/resources/templates/openworld-sdk/licenseInfo.mustache rename to generator/openapi/src/main/resources/templates/expediagroup-sdk/licenseInfo.mustache diff --git a/generator/openapi/src/main/resources/templates/openworld-sdk/models/apiException.mustache b/generator/openapi/src/main/resources/templates/expediagroup-sdk/models/apiException.mustache similarity index 77% rename from generator/openapi/src/main/resources/templates/openworld-sdk/models/apiException.mustache rename to generator/openapi/src/main/resources/templates/expediagroup-sdk/models/apiException.mustache index 9026768d1..01d5ea979 100644 --- a/generator/openapi/src/main/resources/templates/openworld-sdk/models/apiException.mustache +++ b/generator/openapi/src/main/resources/templates/expediagroup-sdk/models/apiException.mustache @@ -1,7 +1,8 @@ +{{>licenseInfo}} package {{packageName}}.models.exception -import com.expediagroup.openworld.sdk.core.model.exception.service.OpenWorldApiException -import com.expediagroup.openworld.sdk.core.model.exception.service.OpenWorldServiceException +import com.expediagroup.sdk.core.model.exception.service.ExpediaGroupApiException +import com.expediagroup.sdk.core.model.exception.service.ExpediaGroupServiceException import {{packageName}}.models.* import io.ktor.client.call.* import io.ktor.client.statement.* @@ -9,7 +10,7 @@ import kotlinx.coroutines.runBlocking internal open class HttpStatusCodeRange( private val statusCode: String, - val getException: (HttpResponse) -> OpenWorldApiException + val getException: (HttpResponse) -> ExpediaGroupApiException ) : Comparable { open fun matches(statusCode: String): Boolean = if (isRangeDefinition()) this.statusCode.first() == statusCode.first() else this.statusCode == statusCode open fun isRangeDefinition(): Boolean = statusCode.matches(Regex("^[1-5]XX$")) @@ -18,7 +19,7 @@ internal open class HttpStatusCodeRange( internal object DefaultHttpStatusCodeRange : HttpStatusCodeRange( "DefaultHttpStatusCodeRange", - { OpenWorldServiceDefaultErrorException(it.status.value, runBlocking { it.bodyAsText() }) } + { ExpediaGroupServiceDefaultErrorException(it.status.value, runBlocking { it.bodyAsText() }) } ) { override fun matches(statusCode: String): Boolean = true override fun isRangeDefinition(): Boolean = true @@ -36,7 +37,7 @@ internal object ErrorObjectMapper { listOf( {{#responses}} {{^is2xx}} - HttpStatusCodeRange("{{code}}") { OpenWorldApi{{dataType}}Exception(it.status.value, fetchErrorObject(it) as {{dataType}}) }, + HttpStatusCodeRange("{{code}}") { ExpediaGroupApi{{dataType}}Exception(it.status.value, fetchErrorObject(it) as {{dataType}}) }, {{/is2xx}} {{/responses}} DefaultHttpStatusCodeRange @@ -48,11 +49,11 @@ internal object ErrorObjectMapper { {{/apiInfo}} ) - fun process(httpResponse: HttpResponse, operationId: String): OpenWorldApiException = + fun process(httpResponse: HttpResponse, operationId: String): ExpediaGroupApiException = httpStatusCodeRanges.getOrDefault(operationId, defaultHttpStatusCodeRanges).filter { it.matches(httpResponse.status.value.toString()) }.min().getException(httpResponse) private inline fun fetchErrorObject(httpResponse: HttpResponse): T = runBlocking { - runCatching { httpResponse.body() }.getOrElse { throw OpenWorldServiceException(httpResponse.bodyAsText()) } + runCatching { httpResponse.body() }.getOrElse { throw ExpediaGroupServiceException(httpResponse.bodyAsText()) } } } @@ -61,4 +62,4 @@ internal object ErrorObjectMapper { {{#defineApiExceptions}}{{/defineApiExceptions}} {{/apis}} {{/apiInfo}} -class OpenWorldServiceDefaultErrorException(code: Int, override val errorObject: String) : OpenWorldApiException(code, errorObject) +class ExpediaGroupServiceDefaultErrorException(code: Int, override val errorObject: String) : ExpediaGroupApiException(code, errorObject) diff --git a/generator/openapi/src/main/resources/templates/openworld-sdk/models/constraints.mustache b/generator/openapi/src/main/resources/templates/expediagroup-sdk/models/constraints.mustache similarity index 100% rename from generator/openapi/src/main/resources/templates/openworld-sdk/models/constraints.mustache rename to generator/openapi/src/main/resources/templates/expediagroup-sdk/models/constraints.mustache diff --git a/generator/openapi/src/main/resources/templates/openworld-sdk/pom.mustache b/generator/openapi/src/main/resources/templates/expediagroup-sdk/pom.mustache similarity index 67% rename from generator/openapi/src/main/resources/templates/openworld-sdk/pom.mustache rename to generator/openapi/src/main/resources/templates/expediagroup-sdk/pom.mustache index 4eb6c015c..5678f1c06 100644 --- a/generator/openapi/src/main/resources/templates/openworld-sdk/pom.mustache +++ b/generator/openapi/src/main/resources/templates/expediagroup-sdk/pom.mustache @@ -3,19 +3,27 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 + + com.expediagroup + sdk-parent-pom + 1.0.0 + ../../../../pom.xml + + + jar + {{#isRapid}} - EG Rapid SDK for Java - EG Rapid SDK v{{artifactVersion}} + EG Rapid SDK for Java + EG Rapid SDK v{{artifactVersion}} {{/isRapid}} - {{#isOpenWorld}} - EG Open World SDK :: {{artifactId}} - EG Open World SDK :: {{artifactId}} v{{artifactVersion}} - {{/isOpenWorld}} + {{#isExpediaGroup}} + EG SDK :: {{artifactId}} + EG SDK :: {{artifactId}} v{{artifactVersion}} + {{/isExpediaGroup}} - {{groupId}} {{artifactId}} ${revision} - https://github.com/ExpediaGroup/openworld-sdk-java-generators/tree/main/generated + https://github.com/ExpediaGroup/expediagroup-java-sdk-generators/tree/main/generated 2022 @@ -35,9 +43,9 @@ - scm:git:git@github.com:ExpediaGroup/openworld-sdk-java-generators.git - scm:git:git@github.com:ExpediaGroup/openworld-sdk-java-generators.git - https://github.com/ExpediaGroup/openworld-sdk-java-generators/ + scm:git:git@github.com:ExpediaGroup/expediagroup-java-sdk-generators.git + scm:git:git@github.com:ExpediaGroup/expediagroup-java-sdk-generators.git + https://github.com/ExpediaGroup/expediagroup-java-sdk-generators/ @@ -59,11 +67,10 @@ {{artifactVersion}} 1.8 - 1.8.0 - 1.8.10 {{shadePrefix}} + 3.11.0 3.3.0 3.3.0 3.4.1 @@ -76,75 +83,123 @@ 1.16.0 - - - com.expediagroup.openworld.sdk - openworld-java-sdk-core - 2.9.0 - - - - org.hibernate.validator - hibernate-validator - 7.0.5.Final - - - - org.jetbrains.kotlin - kotlin-stdlib - ${kotlin.version} - - - org.codehaus.mojo - properties-maven-plugin - 1.0.0 + flatten-maven-plugin + + all + true + true + bom + true + + + + + + + 1.5.0 - generate-resources + flatten + process-resources - write-project-properties + flatten - - ${project.build.outputDirectory}/sdk.properties - - org.jetbrains.dokka - dokka-maven-plugin - ${dokka-plugin.version} + org.apache.maven.plugins + maven-jar-plugin + ${maven-jar-plugin.version} - prepare-package + attach-test-jar - dokka + test-jar - - ${project.basedir}/src/main/kotlin - + true + + + true + true + + + + - - - org.jetbrains.dokka - kotlin-as-java-plugin - ${dokka-plugin.version} - - - org.jetbrains.dokka - gfm-plugin - ${dokka-plugin.version} - - + + org.codehaus.mojo + exec-maven-plugin + ${exec-maven-plugin.version} + + + + org.apache.maven.plugins + maven-resources-plugin + ${maven-resources-plugin.version} + + + + org.apache.maven.plugins + maven-compiler-plugin + ${maven-compiler-plugin.version} + + + -parameters + -XDcompilePolicy=simple + + + + + default-compile + none + + + + default-testCompile + none + + + kotlin-java-compile + compile + + compile + + + + kotlin-java-test-compile + test-compile + + testCompile + + + + + + + org.codehaus.mojo + properties-maven-plugin + 1.0.0 + + + generate-resources + + write-project-properties + + + ${project.build.outputDirectory}/sdk.properties + + + @@ -207,7 +262,8 @@ - ${project.basedir}/src/main/kotlin + ${project.basedir}/src/main/kotlin + @@ -220,7 +276,8 @@ - ${project.basedir}/src/test/kotlin + ${project.basedir}/src/test/kotlin + @@ -281,6 +338,37 @@ + + + org.jetbrains.dokka + dokka-maven-plugin + + + ${project.basedir}/src/main/kotlin/com/expediagroup/sdk/{{namespace}} + + + + org.jetbrains.dokka + kotlin-as-java-plugin + ${dokka-plugin.version} + + + org.jetbrains.dokka + gfm-plugin + ${dokka-plugin.version} + + + + + + prepare-package + + dokka + + + + + com.github.gantsign.maven @@ -293,8 +381,31 @@ format + + compile + check + + true + + + + + org.apache.maven.plugins + maven-antrun-plugin + + true + + + + + org.apache.maven.plugins + maven-dependency-plugin + + true + + @@ -305,7 +416,6 @@ true false true - true @@ -352,29 +462,36 @@ - - - maven-jar-plugin - ${maven-jar-plugin.version} - - - - javadoc - ${project.parent.basedir}/target/site/apidocs - **/* - ${project.build.finalName} - - pack-javadoc - package - - jar - - - - + + + org.hibernate.validator + hibernate-validator + 7.0.5.Final + + + jakarta.validation + jakarta.validation-api + + + com.fasterxml.jackson.core + jackson-annotations + + + org.jetbrains + annotations + + + org.jetbrains.kotlin + kotlin-stdlib + + + org.jetbrains.kotlin + kotlin-reflect + + diff --git a/generator/openapi/src/main/resources/templates/openworld-sdk/validation/propertyConstraintViolation.mustache b/generator/openapi/src/main/resources/templates/expediagroup-sdk/validation/propertyConstraintViolation.mustache similarity index 100% rename from generator/openapi/src/main/resources/templates/openworld-sdk/validation/propertyConstraintViolation.mustache rename to generator/openapi/src/main/resources/templates/expediagroup-sdk/validation/propertyConstraintViolation.mustache diff --git a/generator/openapi/src/main/resources/templates/openworld-sdk/validation/propertyConstraintViolationException.mustache b/generator/openapi/src/main/resources/templates/expediagroup-sdk/validation/propertyConstraintViolationException.mustache similarity index 64% rename from generator/openapi/src/main/resources/templates/openworld-sdk/validation/propertyConstraintViolationException.mustache rename to generator/openapi/src/main/resources/templates/expediagroup-sdk/validation/propertyConstraintViolationException.mustache index 4bb0fabb8..e162b50c0 100644 --- a/generator/openapi/src/main/resources/templates/openworld-sdk/validation/propertyConstraintViolationException.mustache +++ b/generator/openapi/src/main/resources/templates/expediagroup-sdk/validation/propertyConstraintViolationException.mustache @@ -2,7 +2,7 @@ package {{packageName}}.models.exception -import com.expediagroup.openworld.sdk.core.model.exception.client.OpenWorldClientException +import com.expediagroup.sdk.core.model.exception.client.ExpediaGroupClientException /** * An exception to be thrown when a constraint on some property has been violated. @@ -13,4 +13,4 @@ import com.expediagroup.openworld.sdk.core.model.exception.client.OpenWorldClien class PropertyConstraintViolationException( message: String, val constraintViolations: List -) : OpenWorldClientException("$message ${constraintViolations.joinToString(separator = ",\n\t- ", prefix = "[\n\t- ", postfix = "\n]")}") +) : ExpediaGroupClientException("$message ${constraintViolations.joinToString(separator = ",\n\t- ", prefix = "[\n\t- ", postfix = "\n]")}") diff --git a/generator/openapi/src/main/resources/templates/openworld-sdk/validation/propertyConstraintsValidator.mustache b/generator/openapi/src/main/resources/templates/expediagroup-sdk/validation/propertyConstraintsValidator.mustache similarity index 100% rename from generator/openapi/src/main/resources/templates/openworld-sdk/validation/propertyConstraintsValidator.mustache rename to generator/openapi/src/main/resources/templates/expediagroup-sdk/validation/propertyConstraintsValidator.mustache diff --git a/generator/openapi/src/main/resources/templates/openworld-sdk/client/authEndpoint.mustache b/generator/openapi/src/main/resources/templates/openworld-sdk/client/authEndpoint.mustache deleted file mode 100644 index dcbb22bd1..000000000 --- a/generator/openapi/src/main/resources/templates/openworld-sdk/client/authEndpoint.mustache +++ /dev/null @@ -1 +0,0 @@ -{{#isOpenWorld}}, authEndpoint{{/isOpenWorld}} \ No newline at end of file diff --git a/generator/openapi/src/main/resources/templates/openworld-sdk/client/clientBase.mustache b/generator/openapi/src/main/resources/templates/openworld-sdk/client/clientBase.mustache deleted file mode 100644 index a847ae642..000000000 --- a/generator/openapi/src/main/resources/templates/openworld-sdk/client/clientBase.mustache +++ /dev/null @@ -1 +0,0 @@ -{{#isRapid}}BaseRapidClient{{/isRapid}}{{#isOpenWorld}}OpenWorldClient{{/isOpenWorld}} \ No newline at end of file diff --git a/generator/openapi/src/main/resources/templates/openworld-sdk/client/clientConfiguration.mustache b/generator/openapi/src/main/resources/templates/openworld-sdk/client/clientConfiguration.mustache deleted file mode 100644 index 568ee5d08..000000000 --- a/generator/openapi/src/main/resources/templates/openworld-sdk/client/clientConfiguration.mustache +++ /dev/null @@ -1 +0,0 @@ -{{#isRapid}}RapidClientConfiguration{{/isRapid}}{{#isOpenWorld}}OpenWorldClientConfiguration{{/isOpenWorld}} \ No newline at end of file diff --git a/generator/pom.xml b/generator/pom.xml index 819ec6938..99b113936 100644 --- a/generator/pom.xml +++ b/generator/pom.xml @@ -3,13 +3,13 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 - com.expediagroup.openworld.sdk + com.expediagroup.sdk travel-sdk-generators pom 1.1.0 - EG Open World SDK Tooling :: Generators + EG SDK Tooling :: Generators Code generators for building an SDK - https://github.com/ExpediaGroup/openworld-sdk-java-generators + https://github.com/ExpediaGroup/expediagroup-java-sdk-generators 2022 @@ -30,9 +30,9 @@ - scm:git:git@github.com:ExpediaGroup/openworld-sdk-java-generators.git - scm:git:git@github.com:ExpediaGroup/openworld-sdk-java-generators.git - https://github.com/ExpediaGroup/openworld-sdk-java-generators + scm:git:git@github.com:ExpediaGroup/expediagroup-java-sdk-generators.git + scm:git:git@github.com:ExpediaGroup/expediagroup-java-sdk-generators.git + https://github.com/ExpediaGroup/expediagroup-java-sdk-generators diff --git a/pom.xml b/pom.xml index d5f102fd3..619652275 100644 --- a/pom.xml +++ b/pom.xml @@ -3,13 +3,13 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 - com.expediagroup.openworld.sdk - openworld-java-sdk-core - EG Open World SDK :: Core - Core Modules of EG Travel SDK - ${revision} + com.expediagroup + sdk-parent-pom + EG SDK :: Parent POM + Parent POM Module of Expedia Group SDK + 1.0.0 2022 - https://github.com/ExpediaGroup/openworld-sdk-java-core + https://github.com/ExpediaGroup/expediagroup-java-sdk-core @@ -20,6 +20,8 @@ + pom + Expedia Group Committers @@ -29,9 +31,9 @@ - scm:git:git@github.com:ExpediaGroup/openworld-sdk-java-core.git - scm:git:git@github.com:ExpediaGroup/openworld-sdk-java-core.git - https://github.com/ExpediaGroup/openworld-sdk-java-core + scm:git:git@github.com:ExpediaGroup/expediagroup-java-sdk-core.git + scm:git:git@github.com:ExpediaGroup/expediagroup-java-sdk-core.git + https://github.com/ExpediaGroup/expediagroup-java-sdk-core HEAD @@ -50,7 +52,6 @@ - 2.9.0 1.8 8 @@ -71,7 +72,6 @@ 3.6.0 3.4.0 3.3.0 - 3.6.0 3.3.1 3.4.1 3.3.0 @@ -89,15 +89,15 @@ 1.9.10 - 1.6.4 + 1.7.2 1.6.0 - 2.3.1 + 2.3.4 3.0.5 0.22.0 0.50.0 0.21.0 0.47.1 - 1.22.0 + 1.23.1 2.9.0 @@ -121,6 +121,11 @@ pom import + + org.jetbrains.kotlin + kotlin-reflect + ${kotlin.version} + org.jetbrains.kotlinx kotlinx-coroutines-bom @@ -268,7 +273,26 @@ error_prone_annotations 2.21.1 - + + com.squareup.okio + okio-jvm + 3.4.0 + + + org.jetbrains + annotations + 23.0.0 + + + jakarta.validation + jakarta.validation-api + 3.0.0 + + + com.fasterxml.jackson.core + jackson-annotations + 2.15.2 + @@ -309,52 +333,6 @@ - - - kotlin-maven-plugin - org.jetbrains.kotlin - ${kotlin.version} - - - compile-kotlin - - compile - - - - ${project.basedir}/src/main/kotlin - ${project.basedir}/src/main/java - - ${java.release} - - - - test-compile-kotlin - - test-compile - - - - ${project.basedir}/src/test/kotlin - ${project.basedir}/src/test/java - - ${java.release} - - - - - - kotlinx-serialization - - - - - org.jetbrains.kotlin - kotlin-maven-serialization - ${kotlin.version} - - - org.apache.maven.plugins maven-compiler-plugin @@ -503,29 +481,6 @@ org.jetbrains.dokka dokka-maven-plugin ${dokka-plugin.version} - - - prepare-package - - dokka - javadocJar - - - - - - ${project.basedir}/src/main/kotlin - ${project.basedir}/src/main/java - - - - - org.jetbrains.dokka - kotlin-as-java-plugin - ${dokka-plugin.version} - - - @@ -558,26 +513,6 @@ - - - org.apache.maven.plugins - maven-javadoc-plugin - ${maven-javadoc-plugin.version} - - - attach-javadocs - - jar - - - - - - -html5 - - - - org.apache.maven.plugins @@ -677,10 +612,6 @@ org.apache.maven.plugins maven-enforcer-plugin - - org.apache.maven.plugins - maven-javadoc-plugin - org.apache.maven.plugins maven-source-plugin @@ -693,87 +624,6 @@ com.mycila license-maven-plugin - - - org.apache.maven.plugins - maven-antrun-plugin - ${maven.antrun.plugin.version} - - - - detekt - validate - - - - - - - - - - - - - - - - - - run - - - - - ktlint-format - compile - - - - - - - - - - run - - - - - ktlint - validate - - - - - - - - - - - run - - - - - - io.gitlab.arturbosch.detekt - detekt-cli - ${detekt.version} - - - com.pinterest - ktlint - ${ktlint.version} - - - @@ -823,10 +673,6 @@ org.jetbrains.kotlinx kotlinx-coroutines-core-jvm - - io.ktor - ktor-io-jvm - io.ktor ktor-serialization-jvm @@ -892,245 +738,10 @@ kotlin-reflect test + + io.ktor + ktor-io-jvm + - - - - - activate-kotlin - - - ${basedir}/src/main/kotlin - - - - - - - org.jetbrains.kotlin - kotlin-stdlib - - - - - - - - org.codehaus.mojo - build-helper-maven-plugin - ${build-helper-maven-plugin.version} - - - add-kotlin-sources - generate-sources - - add-source - - - - ${project.basedir}/src/main/kotlin - - - - - add-kotlin-test-sources - generate-sources - - add-test-source - - - - ${project.basedir}/src/test/kotlin - - - - - - - - - com.github.gantsign.maven - ktlint-maven-plugin - - - - - org.jetbrains.dokka - dokka-maven-plugin - - - - - maven-javadoc-plugin - - - attach-javadocs - none - - - - - - - org.apache.maven.plugins - maven-dependency-plugin - - - enforce-dependency-declarations - - - org.jetbrains:annotations - - - - org.jetbrains.kotlin:kotlin-stdlib - - org.apache.logging.log4j:log4j-api - - - - - - - - - - org.jetbrains.kotlin - kotlin-maven-plugin - - - - - - - - release - - true - false - true - true - - - - - - org.apache.maven.plugins - maven-gpg-plugin - ${maven.gpg.plugin.version} - - - sign-artifacts - verify - - sign - - - - --pinentry-mode - loopback - - - - - - - - org.sonatype.plugins - nexus-staging-maven-plugin - ${maven.nexus-staging.plugin.version} - true - - oss-sonatype - https://oss.sonatype.org/ - true - - - - - - org.apache.maven.plugins - maven-surefire-plugin - - - **/PerformanceTest.java - @{argLine} - - - - - - - maven-jar-plugin - - - - javadoc - ${project.parent.basedir}/target/site/apidocs - **/* - ${project.build.finalName} - - pack-javadoc - package - - jar - - - - - - - - - - - github-verify-action-profile - - - - - com.mycila - license-maven-plugin - ${maven.licence.plugin.version} - - - 2022 - Expedia, Inc. - - - -
LICENSE-HEADER.txt
- - **/*.kt - -
-
-
- - - add-license-header - validate - - format - - - true - - - - check-for-license-header - compile - - check - - - -
-
-
-
-
-
- diff --git a/src/test/kotlin/com/expediagroup/openworld/sdk/core/configuration/collector/ConfigurationProviderQueueTest.kt b/src/test/kotlin/com/expediagroup/openworld/sdk/core/configuration/collector/ConfigurationProviderQueueTest.kt deleted file mode 100644 index e5f181f8a..000000000 --- a/src/test/kotlin/com/expediagroup/openworld/sdk/core/configuration/collector/ConfigurationProviderQueueTest.kt +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright (C) 2022 Expedia, Inc. - * - * 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 - * - * 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. - */ -package com.expediagroup.openworld.sdk.core.configuration.collector - -import com.expediagroup.openworld.sdk.core.configuration.provider.OpenWorldConfigurationProvider -import com.expediagroup.openworld.sdk.core.configuration.provider.RuntimeConfigurationProvider -import com.expediagroup.openworld.sdk.core.constant.Constant.EMPTY_STRING -import com.expediagroup.openworld.sdk.core.test.TestConstants.CLIENT_KEY_TEST_CREDENTIAL -import com.expediagroup.openworld.sdk.core.test.TestConstants.CLIENT_SECRET_TEST_CREDENTIAL -import org.junit.jupiter.api.Assertions.assertEquals -import org.junit.jupiter.api.Test - -internal class ConfigurationProviderQueueTest { - - @Test - fun `test a provider queue with only a default provider`() { - val configurationProviderQueue = ConfigurationProviderQueue.from(listOf(OpenWorldConfigurationProvider)) - assertEquals(ProvidedConfiguration(EMPTY_STRING, OpenWorldConfigurationProvider.name), configurationProviderQueue.firstWith { it.key }) - assertEquals(ProvidedConfiguration(EMPTY_STRING, OpenWorldConfigurationProvider.name), configurationProviderQueue.firstWith { it.secret }) - assertEquals(ProvidedConfiguration(OpenWorldConfigurationProvider.endpoint, OpenWorldConfigurationProvider.name), configurationProviderQueue.firstWith { it.endpoint }) - assertEquals(ProvidedConfiguration(OpenWorldConfigurationProvider.authEndpoint, OpenWorldConfigurationProvider.name), configurationProviderQueue.firstWith { it.authEndpoint }) - assertEquals(ProvidedConfiguration(OpenWorldConfigurationProvider.requestTimeout, OpenWorldConfigurationProvider.name), configurationProviderQueue.firstWith { it.requestTimeout }) - } - - @Test - fun `test a provider queue with at least a non-empty provider`() { - val runtimeConfigurationProvider = RuntimeConfigurationProvider( - key = CLIENT_KEY_TEST_CREDENTIAL, - secret = CLIENT_SECRET_TEST_CREDENTIAL, - endpoint = OpenWorldConfigurationProvider.endpoint, - authEndpoint = OpenWorldConfigurationProvider.authEndpoint, - requestTimeout = OpenWorldConfigurationProvider.requestTimeout - ) - val configurationProviderQueue = ConfigurationProviderQueue.from( - listOf(runtimeConfigurationProvider) - ) - - assertEquals(runtimeConfigurationProvider, configurationProviderQueue.first()) - assertEquals(runtimeConfigurationProvider, configurationProviderQueue.first { it.key != null }) - assertEquals(runtimeConfigurationProvider, configurationProviderQueue.first { it.key != EMPTY_STRING }) - - assertEquals(ProvidedConfiguration(CLIENT_KEY_TEST_CREDENTIAL, runtimeConfigurationProvider.name), configurationProviderQueue.firstWith { it.key }) - assertEquals(ProvidedConfiguration(CLIENT_SECRET_TEST_CREDENTIAL, runtimeConfigurationProvider.name), configurationProviderQueue.firstWith { it.secret }) - assertEquals(ProvidedConfiguration(OpenWorldConfigurationProvider.endpoint, runtimeConfigurationProvider.name), configurationProviderQueue.firstWith { it.endpoint }) - assertEquals(ProvidedConfiguration(OpenWorldConfigurationProvider.authEndpoint, runtimeConfigurationProvider.name), configurationProviderQueue.firstWith { it.authEndpoint }) - assertEquals(ProvidedConfiguration(OpenWorldConfigurationProvider.requestTimeout, runtimeConfigurationProvider.name), configurationProviderQueue.firstWith { it.requestTimeout }) - } -} diff --git a/src/test/kotlin/com/expediagroup/openworld/sdk/core/test/ClientFactory.kt b/src/test/kotlin/com/expediagroup/openworld/sdk/core/test/ClientFactory.kt deleted file mode 100644 index 8fc0e2e96..000000000 --- a/src/test/kotlin/com/expediagroup/openworld/sdk/core/test/ClientFactory.kt +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright (C) 2022 Expedia, Inc. - * - * 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 - * - * 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. - */ -package com.expediagroup.openworld.sdk.core.test - -import com.expediagroup.openworld.sdk.core.client.BaseRapidClient -import com.expediagroup.openworld.sdk.core.client.OpenWorldClient -import com.expediagroup.openworld.sdk.core.configuration.OpenWorldClientConfiguration -import com.expediagroup.openworld.sdk.core.configuration.RapidClientConfiguration -import com.expediagroup.openworld.sdk.core.configuration.provider.OpenWorldConfigurationProvider -import com.expediagroup.openworld.sdk.core.configuration.provider.RapidConfigurationProvider -import com.expediagroup.openworld.sdk.core.model.exception.service.OpenWorldServiceException -import com.expediagroup.openworld.sdk.core.test.TestConstants.CLIENT_KEY_TEST_CREDENTIAL -import com.expediagroup.openworld.sdk.core.test.TestConstants.CLIENT_SECRET_TEST_CREDENTIAL -import io.ktor.client.engine.HttpClientEngine -import io.ktor.client.engine.mock.MockEngine -import io.ktor.client.statement.HttpResponse - -internal object ClientFactory { - val openWorldConfiguration = OpenWorldClientConfiguration( - key = CLIENT_KEY_TEST_CREDENTIAL, - secret = CLIENT_SECRET_TEST_CREDENTIAL, - endpoint = OpenWorldConfigurationProvider.endpoint, - authEndpoint = OpenWorldConfigurationProvider.authEndpoint, - requestTimeout = OpenWorldConfigurationProvider.requestTimeout - ) - - private val rapidConfiguration = RapidClientConfiguration( - key = CLIENT_KEY_TEST_CREDENTIAL, - secret = CLIENT_SECRET_TEST_CREDENTIAL, - endpoint = RapidConfigurationProvider.endpoint - ) - - fun createOpenWorldClient(): OpenWorldClient = createOpenWorldClient(MockEngineFactory.createDefaultEngine(), openWorldConfiguration) - - fun createOpenWorldClient(mockEngine: MockEngine): OpenWorldClient = createOpenWorldClient(mockEngine, openWorldConfiguration) - fun createOpenWorldClient(mockEngine: HttpClientEngine, configuration: OpenWorldClientConfiguration): OpenWorldClient = object : OpenWorldClient(configuration, mockEngine) { - override suspend fun throwServiceException(response: HttpResponse, operationId: String) { - throw OpenWorldServiceException("Dummy service exception") - } - } - - fun createRapidClient(mockEngine: HttpClientEngine): BaseRapidClient = object : BaseRapidClient(rapidConfiguration, mockEngine) { - override suspend fun throwServiceException(response: HttpResponse, operationId: String) { - throw OpenWorldServiceException("Dummy service exception") - } - } - - fun createRapidClient(): BaseRapidClient = createRapidClient(MockEngineFactory.createEmptyResponseEngine()) -}