Skip to content

Commit de492a0

Browse files
committed
Pushed initial version
0 parents  commit de492a0

File tree

112 files changed

+14061
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

112 files changed

+14061
-0
lines changed

.env.example

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Mastercard API test configuration
2+
# Copy this file to .env and fill in your actual values. See README.md for more details.
3+
4+
CLIENT_ID={your_client_id_here}
5+
KID={your_key_id_here}
6+
TOKEN_ENDPOINT={token_endpoint_here}
7+
ISSUER={authorization_server_issuer_identifier_here}
8+
API_BASE_URL={api_base_url_here}
9+
READ_SCOPES={comma_separated_scopes_here}
10+
WRITE_SCOPES={comma_separated_scopes_here}
11+
PRIVATE_KEY=-----BEGIN RSA PRIVATE KEY-----{your_private_key_without_new_line_here}-----END RSA PRIVATE KEY-----
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: Apache HttpClient
2+
3+
on:
4+
push:
5+
branches:
6+
- '**'
7+
pull_request:
8+
branches:
9+
- '**'
10+
11+
jobs:
12+
build:
13+
runs-on: ubuntu-latest
14+
strategy:
15+
matrix:
16+
java-version: [ '17' ]
17+
httpclient-version: [ '5.4', '5.5.2', '5.6' ]
18+
name: v${{ matrix.httpclient-version }}
19+
env:
20+
OKHTTP: 'com.squareup.okhttp3:okhttp,com.squareup.okhttp3:logging-interceptor'
21+
APACHE_CLIENT: 'org.apache.httpcomponents.client5:httpclient5'
22+
FEIGN: 'io.github.openfeign:feign-core'
23+
SPRING_WEB: 'org.springframework:spring-web'
24+
SPRING_WEBFLUX: 'org.springframework:spring-webflux'
25+
steps:
26+
- name: Checkout
27+
uses: actions/checkout@v5
28+
29+
- name: Set up JDK ${{ matrix.java-version }}
30+
uses: actions/setup-java@v5
31+
with:
32+
distribution: 'temurin'
33+
java-version: ${{ matrix.java-version }}
34+
35+
- name: Cache Maven local repository
36+
uses: actions/cache@v5
37+
with:
38+
path: ~/.m2/repository
39+
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}-java-${{ matrix.java-version }}-httpclient-${{ matrix.httpclient-version }}
40+
restore-keys: |
41+
${{ runner.os }}-maven-
42+
43+
- name: Build and run tests with Apache HttpClient ${{ matrix.httpclient-version }}
44+
run: mvn -B test "-Dtest=com.mastercard.developer.oauth2.http.apache.OAuth2HttpClientTest" "-Dsurefire.failIfNoSpecifiedTests=false" "-Dhttpclient.version=${{ matrix.httpclient-version }}" "-Dmaven.test.dependency.excludes=${{ env.OKHTTP }},${{ env.FEIGN }},${{ env.SPRING_WEB }},${{ env.SPRING_WEBFLUX }}"
45+
env:
46+
CLIENT_ID: ${{ secrets.CLIENT_ID }}
47+
KID: ${{ secrets.KID }}
48+
PRIVATE_KEY: ${{ secrets.PRIVATE_KEY }}
49+
TOKEN_ENDPOINT: ${{ secrets.TOKEN_ENDPOINT }}
50+
ISSUER: ${{ secrets.ISSUER }}
51+
API_BASE_URL: ${{ secrets.API_BASE_URL }}
52+
READ_SCOPES: ${{ secrets.READ_SCOPES }}
53+
WRITE_SCOPES: ${{ secrets.WRITE_SCOPES }}
54+

.github/workflows/ci-feign.yml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: OpenFeign
2+
3+
on:
4+
push:
5+
branches:
6+
- '**'
7+
pull_request:
8+
branches:
9+
- '**'
10+
11+
jobs:
12+
build:
13+
runs-on: ubuntu-latest
14+
strategy:
15+
matrix:
16+
java-version: [ '17' ]
17+
feign-version: [ '11.10', '12.5', '13.6' ]
18+
name: v${{ matrix.feign-version }}
19+
env:
20+
OKHTTP: 'com.squareup.okhttp3:okhttp,com.squareup.okhttp3:logging-interceptor'
21+
APACHE_CLIENT: 'org.apache.httpcomponents.client5:httpclient5'
22+
FEIGN: 'io.github.openfeign:feign-core'
23+
SPRING_WEB: 'org.springframework:spring-web'
24+
SPRING_WEBFLUX: 'org.springframework:spring-webflux'
25+
steps:
26+
- name: Checkout
27+
uses: actions/checkout@v5
28+
29+
- name: Set up JDK ${{ matrix.java-version }}
30+
uses: actions/setup-java@v5
31+
with:
32+
distribution: 'temurin'
33+
java-version: ${{ matrix.java-version }}
34+
35+
- name: Cache Maven local repository
36+
uses: actions/cache@v5
37+
with:
38+
path: ~/.m2/repository
39+
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}-java-${{ matrix.java-version }}-feign-${{ matrix.feign-version }}
40+
restore-keys: |
41+
${{ runner.os }}-maven-
42+
43+
- name: Build and run tests with Feign ${{ matrix.feign-version }}
44+
run: mvn -B test "-Dtest=com.mastercard.developer.oauth2.http.feign.OAuth2ClientTest" "-Dsurefire.failIfNoSpecifiedTests=false" "-Dfeign.version=${{ matrix.feign-version }}" "-Dmaven.test.dependency.excludes=${{ env.OKHTTP }},${{ env.SPRING_WEB }},${{ env.SPRING_WEBFLUX }}"
45+
env:
46+
CLIENT_ID: ${{ secrets.CLIENT_ID }}
47+
KID: ${{ secrets.KID }}
48+
PRIVATE_KEY: ${{ secrets.PRIVATE_KEY }}
49+
TOKEN_ENDPOINT: ${{ secrets.TOKEN_ENDPOINT }}
50+
ISSUER: ${{ secrets.ISSUER }}
51+
API_BASE_URL: ${{ secrets.API_BASE_URL }}
52+
READ_SCOPES: ${{ secrets.READ_SCOPES }}
53+
WRITE_SCOPES: ${{ secrets.WRITE_SCOPES }}
54+
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: Java HTTP Client
2+
3+
on:
4+
push:
5+
branches:
6+
- '**'
7+
pull_request:
8+
branches:
9+
- '**'
10+
11+
jobs:
12+
build:
13+
runs-on: ubuntu-latest
14+
strategy:
15+
matrix:
16+
java-version: [ '17', '21', '25' ]
17+
name: Java ${{ matrix.java-version }}
18+
env:
19+
OKHTTP: 'com.squareup.okhttp3:okhttp,com.squareup.okhttp3:logging-interceptor'
20+
APACHE_CLIENT: 'org.apache.httpcomponents.client5:httpclient5'
21+
FEIGN: 'io.github.openfeign:feign-core'
22+
SPRING_WEB: 'org.springframework:spring-web'
23+
SPRING_WEBFLUX: 'org.springframework:spring-webflux'
24+
steps:
25+
- name: Checkout
26+
uses: actions/checkout@v5
27+
28+
- name: Set up JDK ${{ matrix.java-version }}
29+
uses: actions/setup-java@v5
30+
with:
31+
distribution: 'temurin'
32+
java-version: ${{ matrix.java-version }}
33+
34+
- name: Cache Maven local repository
35+
uses: actions/cache@v5
36+
with:
37+
path: ~/.m2/repository
38+
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}-java-${{ matrix.java-version }}
39+
restore-keys: |
40+
${{ runner.os }}-maven-
41+
42+
- name: Build and run tests with Java ${{ matrix.java-version }}
43+
run: mvn -B test "-Dtest=com.mastercard.developer.oauth2.http.java.OAuth2HttpClientTest" "-Dsurefire.failIfNoSpecifiedTests=false" "-Dmaven.test.dependency.excludes=${{ env.OKHTTP }},${{ env.FEIGN }},${{ env.SPRING_WEB }},${{ env.SPRING_WEBFLUX }}"
44+
env:
45+
CLIENT_ID: ${{ secrets.CLIENT_ID }}
46+
KID: ${{ secrets.KID }}
47+
PRIVATE_KEY: ${{ secrets.PRIVATE_KEY }}
48+
TOKEN_ENDPOINT: ${{ secrets.TOKEN_ENDPOINT }}
49+
ISSUER: ${{ secrets.ISSUER }}
50+
API_BASE_URL: ${{ secrets.API_BASE_URL }}
51+
READ_SCOPES: ${{ secrets.READ_SCOPES }}
52+
WRITE_SCOPES: ${{ secrets.WRITE_SCOPES }}
53+

.github/workflows/ci-java-lts.yml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: Java LTS
2+
3+
on:
4+
push:
5+
branches:
6+
- '**'
7+
pull_request:
8+
branches:
9+
- '**'
10+
11+
jobs:
12+
build:
13+
runs-on: ubuntu-latest
14+
strategy:
15+
matrix:
16+
java-version: [ '17', '21', '25' ]
17+
name: All tests
18+
steps:
19+
- name: Checkout
20+
uses: actions/checkout@v5
21+
22+
- name: Set up JDK ${{ matrix.java-version }}
23+
uses: actions/setup-java@v5
24+
with:
25+
distribution: 'temurin'
26+
java-version: ${{ matrix.java-version }}
27+
28+
- name: Cache Maven local repository
29+
uses: actions/cache@v5
30+
with:
31+
path: ~/.m2/repository
32+
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}-java-${{ matrix.java-version }}
33+
restore-keys: |
34+
${{ runner.os }}-maven-
35+
36+
- name: Build and run tests
37+
run: mvn -B test
38+
env:
39+
CLIENT_ID: ${{ secrets.CLIENT_ID }}
40+
KID: ${{ secrets.KID }}
41+
PRIVATE_KEY: ${{ secrets.PRIVATE_KEY }}
42+
TOKEN_ENDPOINT: ${{ secrets.TOKEN_ENDPOINT }}
43+
ISSUER: ${{ secrets.ISSUER }}
44+
API_BASE_URL: ${{ secrets.API_BASE_URL }}
45+
READ_SCOPES: ${{ secrets.READ_SCOPES }}
46+
WRITE_SCOPES: ${{ secrets.WRITE_SCOPES }}

.github/workflows/ci-okhttp.yml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: OkHttp
2+
3+
on:
4+
push:
5+
branches:
6+
- '**'
7+
pull_request:
8+
branches:
9+
- '**'
10+
11+
jobs:
12+
build:
13+
runs-on: ubuntu-latest
14+
strategy:
15+
matrix:
16+
java-version: [ '17' ]
17+
okhttp-version: [ '4.0.0', '4.12.0', '5.1.0', '5.2.3', '5.3.2' ]
18+
name: v${{ matrix.okhttp-version }}
19+
env:
20+
OKHTTP: 'com.squareup.okhttp3:okhttp,com.squareup.okhttp3:logging-interceptor'
21+
APACHE_CLIENT: 'org.apache.httpcomponents.client5:httpclient5'
22+
FEIGN: 'io.github.openfeign:feign-core'
23+
SPRING_WEB: 'org.springframework:spring-web'
24+
SPRING_WEBFLUX: 'org.springframework:spring-webflux'
25+
steps:
26+
- name: Checkout
27+
uses: actions/checkout@v5
28+
29+
- name: Set up JDK ${{ matrix.java-version }}
30+
uses: actions/setup-java@v5
31+
with:
32+
distribution: 'temurin'
33+
java-version: ${{ matrix.java-version }}
34+
35+
- name: Cache Maven local repository
36+
uses: actions/cache@v5
37+
with:
38+
path: ~/.m2/repository
39+
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}-java-${{ matrix.java-version }}-okhttp-${{ matrix.okhttp-version }}
40+
restore-keys: |
41+
${{ runner.os }}-maven-
42+
43+
- name: Build and run tests with OkHttp ${{ matrix.okhttp-version }}
44+
run: mvn -B test "-Dtest=com.mastercard.developer.oauth2.http.okhttp3.OAuth2InterceptorTest" "-Dsurefire.failIfNoSpecifiedTests=false" "-Dokhttp.version=${{ matrix.okhttp-version }}" "-Dmaven.test.dependency.excludes=${{ env.FEIGN }},${{ env.SPRING_WEB }},${{ env.SPRING_WEBFLUX }}"
45+
env:
46+
CLIENT_ID: ${{ secrets.CLIENT_ID }}
47+
KID: ${{ secrets.KID }}
48+
PRIVATE_KEY: ${{ secrets.PRIVATE_KEY }}
49+
TOKEN_ENDPOINT: ${{ secrets.TOKEN_ENDPOINT }}
50+
ISSUER: ${{ secrets.ISSUER }}
51+
API_BASE_URL: ${{ secrets.API_BASE_URL }}
52+
READ_SCOPES: ${{ secrets.READ_SCOPES }}
53+
WRITE_SCOPES: ${{ secrets.WRITE_SCOPES }}
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: RestClient
2+
3+
on:
4+
push:
5+
branches:
6+
- '**'
7+
pull_request:
8+
branches:
9+
- '**'
10+
11+
jobs:
12+
build:
13+
runs-on: ubuntu-latest
14+
strategy:
15+
matrix:
16+
java-version: [ '17' ]
17+
spring-web-version: [ '6.2.0', '6.2.15', '7.0.2' ]
18+
name: spring-web v${{ matrix.spring-web-version }}
19+
env:
20+
OKHTTP: 'com.squareup.okhttp3:okhttp,com.squareup.okhttp3:logging-interceptor'
21+
APACHE_CLIENT: 'org.apache.httpcomponents.client5:httpclient5'
22+
FEIGN: 'io.github.openfeign:feign-core'
23+
SPRING_WEB: 'org.springframework:spring-web'
24+
SPRING_WEBFLUX: 'org.springframework:spring-webflux'
25+
steps:
26+
- name: Checkout
27+
uses: actions/checkout@v5
28+
29+
- name: Set up JDK ${{ matrix.java-version }}
30+
uses: actions/setup-java@v5
31+
with:
32+
distribution: 'temurin'
33+
java-version: ${{ matrix.java-version }}
34+
35+
- name: Cache Maven local repository
36+
uses: actions/cache@v5
37+
with:
38+
path: ~/.m2/repository
39+
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}-java-${{ matrix.java-version }}-restclient-${{ matrix.spring-web-version }}
40+
restore-keys: |
41+
${{ runner.os }}-maven-
42+
43+
- name: Build and run tests with spring-web ${{ matrix.spring-web-version }}
44+
run: mvn -B test "-Dtest=com.mastercard.developer.oauth2.http.spring.restclient.OAuth2ClientHttpRequestInterceptorTest" "-Dsurefire.failIfNoSpecifiedTests=false" "-Dspring-web.version=${{ matrix.spring-web-version }}" "-Dmaven.test.dependency.excludes=${{ env.OKHTTP }},${{ env.FEIGN }},${{ env.SPRING_WEBFLUX }}"
45+
env:
46+
CLIENT_ID: ${{ secrets.CLIENT_ID }}
47+
KID: ${{ secrets.KID }}
48+
PRIVATE_KEY: ${{ secrets.PRIVATE_KEY }}
49+
TOKEN_ENDPOINT: ${{ secrets.TOKEN_ENDPOINT }}
50+
ISSUER: ${{ secrets.ISSUER }}
51+
API_BASE_URL: ${{ secrets.API_BASE_URL }}
52+
READ_SCOPES: ${{ secrets.READ_SCOPES }}
53+
WRITE_SCOPES: ${{ secrets.WRITE_SCOPES }}
54+
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
name: WebClient
2+
3+
on:
4+
push:
5+
branches:
6+
- '**'
7+
pull_request:
8+
branches:
9+
- '**'
10+
11+
jobs:
12+
build:
13+
runs-on: ubuntu-latest
14+
strategy:
15+
matrix:
16+
java-version: [ '17' ]
17+
spring-webflux-version: [ '6.1.0', '6.1.21', '6.2.0', '6.2.15', '7.0.2' ]
18+
name: spring-webflux v${{ matrix.spring-webflux-version }}
19+
env:
20+
OKHTTP: 'com.squareup.okhttp3:okhttp,com.squareup.okhttp3:logging-interceptor'
21+
APACHE_CLIENT: 'org.apache.httpcomponents.client5:httpclient5'
22+
FEIGN: 'io.github.openfeign:feign-core'
23+
SPRING_WEB: 'org.springframework:spring-web'
24+
SPRING_WEBFLUX: 'org.springframework:spring-webflux'
25+
steps:
26+
- name: Checkout
27+
uses: actions/checkout@v5
28+
29+
- name: Set up JDK ${{ matrix.java-version }}
30+
uses: actions/setup-java@v5
31+
with:
32+
distribution: 'temurin'
33+
java-version: ${{ matrix.java-version }}
34+
35+
- name: Cache Maven local repository
36+
uses: actions/cache@v5
37+
with:
38+
path: ~/.m2/repository
39+
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}-java-${{ matrix.java-version }}-webclient-${{ matrix.spring-webflux-version }}
40+
restore-keys: |
41+
${{ runner.os }}-maven-
42+
43+
- name: Set Jakarta EE flag
44+
id: set-jakarta
45+
run: |
46+
if dpkg --compare-versions "${{ matrix.spring-webflux-version }}" ge "7.0.0"; then
47+
# See https://github.com/OpenAPITools/openapi-generator/pull/22030
48+
echo "use-jakarta-ee=true" >> $GITHUB_OUTPUT
49+
else
50+
echo "use-jakarta-ee=false" >> $GITHUB_OUTPUT
51+
fi
52+
53+
- name: Build and run tests with spring-webflux ${{ matrix.spring-webflux-version }}
54+
run: mvn -B test "-Dtest=com.mastercard.developer.oauth2.http.spring.webclient.OAuth2FilterTest" "-Dsurefire.failIfNoSpecifiedTests=false" "-Dspring-webflux.version=${{ matrix.spring-webflux-version }}" "-Dspring-web.version=${{ matrix.spring-webflux-version }}" "-Duse-jakarta-ee=${{ steps.set-jakarta.outputs.use-jakarta-ee }}" "-Dmaven.test.dependency.excludes=${{ env.OKHTTP }},${{ env.FEIGN }}"
55+
env:
56+
CLIENT_ID: ${{ secrets.CLIENT_ID }}
57+
KID: ${{ secrets.KID }}
58+
PRIVATE_KEY: ${{ secrets.PRIVATE_KEY }}
59+
TOKEN_ENDPOINT: ${{ secrets.TOKEN_ENDPOINT }}
60+
ISSUER: ${{ secrets.ISSUER }}
61+
API_BASE_URL: ${{ secrets.API_BASE_URL }}
62+
READ_SCOPES: ${{ secrets.READ_SCOPES }}
63+
WRITE_SCOPES: ${{ secrets.WRITE_SCOPES }}

0 commit comments

Comments
 (0)