From cbfd04ce64f217f37466a261d422a562178c9cea Mon Sep 17 00:00:00 2001 From: Nasser Anssari Date: Tue, 17 Dec 2024 16:46:46 +0300 Subject: [PATCH 1/5] chore: add PR check to verify examples --- .github/workflows/verify-examples.yaml | 33 ++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 .github/workflows/verify-examples.yaml diff --git a/.github/workflows/verify-examples.yaml b/.github/workflows/verify-examples.yaml new file mode 100644 index 00000000..04ac549e --- /dev/null +++ b/.github/workflows/verify-examples.yaml @@ -0,0 +1,33 @@ +name: Verify Examples +on: + pull_request: + branches: + - 'main' +jobs: + detect-changes: + runs-on: ubuntu-latest + permissions: + pull-requests: read + outputs: + examples: ${{ steps.filter.outputs.examples }} + steps: + - uses: dorny/paths-filter@v3 + id: filter + with: + filters: | + examples: + - 'examples/**' + + verify-examples: + needs: detect-changes + if: ${{ needs.detect-changes.outputs.examples == 'true' }} + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-java@v4 + with: + java-version: '11' + distribution: 'temurin' + - name: verify examples + working-directory: examples + run: mvn clean install From 4a39147f24418d99d29951ac9667f19db2e355ea Mon Sep 17 00:00:00 2001 From: Nasser Anssari Date: Sun, 19 Jan 2025 15:40:51 +0300 Subject: [PATCH 2/5] chore: verify integration tests --- .github/workflows/verify-examples.yaml | 28 ++++++++++++++++++- README.md | 4 +-- {integrations => tests/integration}/README.md | 2 +- {integrations => tests/integration}/pom.xml | 0 .../sdk/xap/integrations/common/Constant.java | 0 .../common/XapIntegrationTests.java | 2 +- ...AvailabilityCalendarsIntegrationTests.java | 2 +- .../lodging/ListingsIntegrationTests.java | 2 +- .../lodging/QuotesIntegrationTests.java | 2 +- .../lodging/VrboIntegrationTests.java | 2 +- 10 files changed, 35 insertions(+), 9 deletions(-) rename {integrations => tests/integration}/README.md (98%) rename {integrations => tests/integration}/pom.xml (100%) rename {integrations => tests/integration}/src/test/java/com/expediagroup/sdk/xap/integrations/common/Constant.java (100%) rename integrations/src/test/java/com/expediagroup/sdk/xap/integrations/common/XapIT.java => tests/integration/src/test/java/com/expediagroup/sdk/xap/integrations/common/XapIntegrationTests.java (97%) rename integrations/src/test/java/com/expediagroup/sdk/xap/integrations/lodging/AvailabilityCalendarsIT.java => tests/integration/src/test/java/com/expediagroup/sdk/xap/integrations/lodging/AvailabilityCalendarsIntegrationTests.java (98%) rename integrations/src/test/java/com/expediagroup/sdk/xap/integrations/lodging/ListingsIT.java => tests/integration/src/test/java/com/expediagroup/sdk/xap/integrations/lodging/ListingsIntegrationTests.java (99%) rename integrations/src/test/java/com/expediagroup/sdk/xap/integrations/lodging/QuotesIT.java => tests/integration/src/test/java/com/expediagroup/sdk/xap/integrations/lodging/QuotesIntegrationTests.java (99%) rename integrations/src/test/java/com/expediagroup/sdk/xap/integrations/lodging/VrboIT.java => tests/integration/src/test/java/com/expediagroup/sdk/xap/integrations/lodging/VrboIntegrationTests.java (92%) diff --git a/.github/workflows/verify-examples.yaml b/.github/workflows/verify-examples.yaml index 04ac549e..14120490 100644 --- a/.github/workflows/verify-examples.yaml +++ b/.github/workflows/verify-examples.yaml @@ -17,6 +17,8 @@ jobs: filters: | examples: - 'examples/**' + integration-tests: + - 'tests/integration/**' verify-examples: needs: detect-changes @@ -30,4 +32,28 @@ jobs: distribution: 'temurin' - name: verify examples working-directory: examples - run: mvn clean install + run: | + mvn verify \ + -Dcom.expediagroup.xapjavasdk.apikey="${{ secrets.API_KEY }}" \ + -Dcom.expediagroup.xapjavasdk.apisecret="${{ secrets.API_SECRET }}" \ + -Dcom.expediagroup.xapjavasdk.vrbokey="${{ secrets.VRBO_KEY }}" \ + -Dcom.expediagroup.xapjavasdk.vrbosecret="${{ secrets.VRBO_SECRET }}" \ + + verify-integration-tests: + needs: detect-changes + if: ${{ needs.detect-changes.outputs.integration-tests == 'true' }} + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-java@v4 + with: + java-version: '11' + distribution: 'temurin' + - name: verify integration tests + working-directory: tests/integration + run: | + mvn verify \ + -Dcom.expediagroup.xapjavasdk.apikey="${{ secrets.API_KEY }}" \ + -Dcom.expediagroup.xapjavasdk.apisecret="${{ secrets.API_SECRET }}" \ + -Dcom.expediagroup.xapjavasdk.vrbokey="${{ secrets.VRBO_KEY }}" \ + -Dcom.expediagroup.xapjavasdk.vrbosecret="${{ secrets.VRBO_SECRET }}" diff --git a/README.md b/README.md index 539b4d28..92f6ab3b 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ and less on the technical details of the API. You can find code examples for multiple use cases in the [examples](examples) directory. ### Integration Tests -Integration tests are placed in the [integrations](integrations) directory. +Integration tests are placed in the [integrations](tests/integration) directory. --- @@ -27,4 +27,4 @@ If you have any questions or need help with XAP, please refer to the [XAP Support](https://developers.expediagroup.com/xap/support) page. If you experience any issues with the SDK, please raise an issue on the -[GitHub repository](https://github.com/ExpediaGroup/xap-java-sdk/issues). \ No newline at end of file +[GitHub repository](https://github.com/ExpediaGroup/xap-java-sdk/issues). diff --git a/integrations/README.md b/tests/integration/README.md similarity index 98% rename from integrations/README.md rename to tests/integration/README.md index 0d9f73c7..87117d93 100644 --- a/integrations/README.md +++ b/tests/integration/README.md @@ -84,4 +84,4 @@ account manager. ## License -This project is licensed under the Apache License v2.0 - see the [LICENSE](../LICENSE) for details. \ No newline at end of file +This project is licensed under the Apache License v2.0 - see the [LICENSE](../../LICENSE) for details. diff --git a/integrations/pom.xml b/tests/integration/pom.xml similarity index 100% rename from integrations/pom.xml rename to tests/integration/pom.xml diff --git a/integrations/src/test/java/com/expediagroup/sdk/xap/integrations/common/Constant.java b/tests/integration/src/test/java/com/expediagroup/sdk/xap/integrations/common/Constant.java similarity index 100% rename from integrations/src/test/java/com/expediagroup/sdk/xap/integrations/common/Constant.java rename to tests/integration/src/test/java/com/expediagroup/sdk/xap/integrations/common/Constant.java diff --git a/integrations/src/test/java/com/expediagroup/sdk/xap/integrations/common/XapIT.java b/tests/integration/src/test/java/com/expediagroup/sdk/xap/integrations/common/XapIntegrationTests.java similarity index 97% rename from integrations/src/test/java/com/expediagroup/sdk/xap/integrations/common/XapIT.java rename to tests/integration/src/test/java/com/expediagroup/sdk/xap/integrations/common/XapIntegrationTests.java index 8d5b10c8..6b8288cb 100644 --- a/integrations/src/test/java/com/expediagroup/sdk/xap/integrations/common/XapIT.java +++ b/tests/integration/src/test/java/com/expediagroup/sdk/xap/integrations/common/XapIntegrationTests.java @@ -15,7 +15,7 @@ * Extension for setting up the required components for testing. */ @TestInstance(TestInstance.Lifecycle.PER_CLASS) -public abstract class XapIT { +public abstract class XapIntegrationTests { protected static XapClient xapClient; protected static XapClient mockClient; diff --git a/integrations/src/test/java/com/expediagroup/sdk/xap/integrations/lodging/AvailabilityCalendarsIT.java b/tests/integration/src/test/java/com/expediagroup/sdk/xap/integrations/lodging/AvailabilityCalendarsIntegrationTests.java similarity index 98% rename from integrations/src/test/java/com/expediagroup/sdk/xap/integrations/lodging/AvailabilityCalendarsIT.java rename to tests/integration/src/test/java/com/expediagroup/sdk/xap/integrations/lodging/AvailabilityCalendarsIntegrationTests.java index 6809772b..d6f77328 100644 --- a/integrations/src/test/java/com/expediagroup/sdk/xap/integrations/lodging/AvailabilityCalendarsIT.java +++ b/tests/integration/src/test/java/com/expediagroup/sdk/xap/integrations/lodging/AvailabilityCalendarsIntegrationTests.java @@ -28,7 +28,7 @@ /** * This class is used to test the integration of the Lodging Availability Calendars API. */ -public class AvailabilityCalendarsIT extends VrboIT { +public class AvailabilityCalendarsIntegrationTests extends VrboIntegrationTests { @Test public void testRequest() { diff --git a/integrations/src/test/java/com/expediagroup/sdk/xap/integrations/lodging/ListingsIT.java b/tests/integration/src/test/java/com/expediagroup/sdk/xap/integrations/lodging/ListingsIntegrationTests.java similarity index 99% rename from integrations/src/test/java/com/expediagroup/sdk/xap/integrations/lodging/ListingsIT.java rename to tests/integration/src/test/java/com/expediagroup/sdk/xap/integrations/lodging/ListingsIntegrationTests.java index 94b8e823..9a002785 100644 --- a/integrations/src/test/java/com/expediagroup/sdk/xap/integrations/lodging/ListingsIT.java +++ b/tests/integration/src/test/java/com/expediagroup/sdk/xap/integrations/lodging/ListingsIntegrationTests.java @@ -62,7 +62,7 @@ /** * This class is used to test the integration of the Lodging Listings API. */ -public class ListingsIT extends XapIT { +public class ListingsIntegrationTests extends XapIntegrationTests { @Test public void testRequest() { diff --git a/integrations/src/test/java/com/expediagroup/sdk/xap/integrations/lodging/QuotesIT.java b/tests/integration/src/test/java/com/expediagroup/sdk/xap/integrations/lodging/QuotesIntegrationTests.java similarity index 99% rename from integrations/src/test/java/com/expediagroup/sdk/xap/integrations/lodging/QuotesIT.java rename to tests/integration/src/test/java/com/expediagroup/sdk/xap/integrations/lodging/QuotesIntegrationTests.java index 9177d94a..8ba71318 100644 --- a/integrations/src/test/java/com/expediagroup/sdk/xap/integrations/lodging/QuotesIT.java +++ b/tests/integration/src/test/java/com/expediagroup/sdk/xap/integrations/lodging/QuotesIntegrationTests.java @@ -35,7 +35,7 @@ /** * This class is used to test the integration of the Lodging Quotes API. */ -public class QuotesIT extends VrboIT { +public class QuotesIntegrationTests extends VrboIntegrationTests { @Test public void testRequest() { diff --git a/integrations/src/test/java/com/expediagroup/sdk/xap/integrations/lodging/VrboIT.java b/tests/integration/src/test/java/com/expediagroup/sdk/xap/integrations/lodging/VrboIntegrationTests.java similarity index 92% rename from integrations/src/test/java/com/expediagroup/sdk/xap/integrations/lodging/VrboIT.java rename to tests/integration/src/test/java/com/expediagroup/sdk/xap/integrations/lodging/VrboIntegrationTests.java index be4dd7ab..87948bcf 100644 --- a/integrations/src/test/java/com/expediagroup/sdk/xap/integrations/lodging/VrboIT.java +++ b/tests/integration/src/test/java/com/expediagroup/sdk/xap/integrations/lodging/VrboIntegrationTests.java @@ -8,7 +8,7 @@ /** * Extension for setting up the required components for testing, specifically for Vrbo. */ -public abstract class VrboIT extends XapIT { +public abstract class VrboIntegrationTests extends XapIntegrationTests { @BeforeAll static void vrboSetup() { From bafcc5da377d05006a8948c0c15fdd84939e67d6 Mon Sep 17 00:00:00 2001 From: Nasser Anssari Date: Sun, 19 Jan 2025 15:43:19 +0300 Subject: [PATCH 3/5] fix --- .github/workflows/verify-examples.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/verify-examples.yaml b/.github/workflows/verify-examples.yaml index 14120490..63b5d4c4 100644 --- a/.github/workflows/verify-examples.yaml +++ b/.github/workflows/verify-examples.yaml @@ -10,6 +10,7 @@ jobs: pull-requests: read outputs: examples: ${{ steps.filter.outputs.examples }} + integration-tests: ${{ steps.filter.outputs.integration-tests }} steps: - uses: dorny/paths-filter@v3 id: filter From 0a66b8e86ebab440719c9d2ae33a2cdcc53cf575 Mon Sep 17 00:00:00 2001 From: Nasser Anssari Date: Sun, 19 Jan 2025 15:45:24 +0300 Subject: [PATCH 4/5] fix --- .../{verify-examples.yaml => verify-examples-and-tests.yaml} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename .github/workflows/{verify-examples.yaml => verify-examples-and-tests.yaml} (97%) diff --git a/.github/workflows/verify-examples.yaml b/.github/workflows/verify-examples-and-tests.yaml similarity index 97% rename from .github/workflows/verify-examples.yaml rename to .github/workflows/verify-examples-and-tests.yaml index 63b5d4c4..038117f3 100644 --- a/.github/workflows/verify-examples.yaml +++ b/.github/workflows/verify-examples-and-tests.yaml @@ -1,4 +1,4 @@ -name: Verify Examples +name: Verify Examples and Integration Tests on: pull_request: branches: From 8b92217ec898d1db64fdfb894df50a0f17ef4a11 Mon Sep 17 00:00:00 2001 From: Nasser Anssari Date: Sun, 19 Jan 2025 15:46:57 +0300 Subject: [PATCH 5/5] Fix --- .../sdk/xap/integrations/lodging/ListingsIntegrationTests.java | 2 +- .../sdk/xap/integrations/lodging/VrboIntegrationTests.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/integration/src/test/java/com/expediagroup/sdk/xap/integrations/lodging/ListingsIntegrationTests.java b/tests/integration/src/test/java/com/expediagroup/sdk/xap/integrations/lodging/ListingsIntegrationTests.java index 9a002785..7b61b733 100644 --- a/tests/integration/src/test/java/com/expediagroup/sdk/xap/integrations/lodging/ListingsIntegrationTests.java +++ b/tests/integration/src/test/java/com/expediagroup/sdk/xap/integrations/lodging/ListingsIntegrationTests.java @@ -6,7 +6,7 @@ import com.expediagroup.sdk.core.model.Response; import com.expediagroup.sdk.xap.integrations.common.Constant; -import com.expediagroup.sdk.xap.integrations.common.XapIT; +import com.expediagroup.sdk.xap.integrations.common.XapIntegrationTests; import com.expediagroup.sdk.xap.models.AgeClassRestriction; import com.expediagroup.sdk.xap.models.BedType; import com.expediagroup.sdk.xap.models.CancellationPolicy; diff --git a/tests/integration/src/test/java/com/expediagroup/sdk/xap/integrations/lodging/VrboIntegrationTests.java b/tests/integration/src/test/java/com/expediagroup/sdk/xap/integrations/lodging/VrboIntegrationTests.java index 87948bcf..fb76f6fa 100644 --- a/tests/integration/src/test/java/com/expediagroup/sdk/xap/integrations/lodging/VrboIntegrationTests.java +++ b/tests/integration/src/test/java/com/expediagroup/sdk/xap/integrations/lodging/VrboIntegrationTests.java @@ -1,7 +1,7 @@ package com.expediagroup.sdk.xap.integrations.lodging; import com.expediagroup.sdk.xap.client.XapClient; -import com.expediagroup.sdk.xap.integrations.common.XapIT; +import com.expediagroup.sdk.xap.integrations.common.XapIntegrationTests; import org.apache.commons.lang3.StringUtils; import org.junit.jupiter.api.BeforeAll;