Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions .github/workflows/java-11-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Java 11 CI

on:
push:
branches: [ "main" ]
paths:
- 'client-samples/java'
- '.github/workflows/java-11-ci.yml'
pull_request:
branches: [ "main" ]
paths:
- 'client-samples/java'
- '.github/workflows/java-11-ci.yml'

jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
project: [rest, websockets]
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Use Java 11 Gradle files
run: cp -r java-11-setup/** .
working-directory: client-samples/java/${{ matrix.project }}
- name: Set up JDK
uses: actions/setup-java@v5
with:
java-version: 11
distribution: 'zulu'
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v5
- name: Gradle Build
run: ./gradlew build
working-directory: client-samples/java/${{ matrix.project }}
- name: Gradle Test
run: ./gradlew test
working-directory: client-samples/java/${{ matrix.project }}
2 changes: 1 addition & 1 deletion .github/workflows/java-base-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
java-version: ['11', '17', '21']
java-version: ['17', '21', '25']
defaults:
run:
working-directory: ${{ inputs.working-directory }}
Expand Down
29 changes: 14 additions & 15 deletions client-samples/java/rest/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,6 @@ _If you are using the OkHttp template_
_If you are using the Retrofit template_
- [`ExampleApplication.java`](./src/main/java/com/ms/infra/example/application/ExampleApplication.java)

## Java Versions
This template works with the following Java LTS versions:
- 11
- 17
- 21

## Create DER Encoded File
For this template, the RSA Private key that was generated, `private_key.pem`, is not in a format that Java will understand and needs to be converted to a binary encoding.
The [PKCS8](https://en.wikipedia.org/wiki/PKCS_8) format is a standardized way to store a private key information.
Expand All @@ -56,14 +50,14 @@ Make these changes to the `META-INF/microprofile-config.properties` resource fil

| Property Name | Description | Required |
|-----------------------------------|-----------------------------------------------------------------------------------------|----------|
| `morgan-stanley-oauth2-token-uri` | Morgan Stanley OAuth2 token endpoint URL | True |
| `client-app-id` | The client id that will be sent to you from your Morgan Stanley contact | True |
| `client-app-scope` | The scope/s that will be sent to from your Morgan Stanley contact | True |
| `private-key-file` | The path to the private_key.der that has been created | True |
| `public-certificate-file` | The path to the public_key.cer that was created and sent to your Morgan Stanley contact | True |
| `ms-url-api-domain` | Morgan Stanley API Url Domain (Currently set to uat) | True |
| `proxy-host` | Optional proxy host | False |
| `proxy-port` | Optional proxy port | False |
| `morgan-stanley-oauth2-token-uri` | Morgan Stanley OAuth2 token endpoint URL | |
| `client-app-id` | The client id that will be sent to you from your Morgan Stanley contact | |
| `client-app-scope` | The scope/s that will be sent to from your Morgan Stanley contact | |
| `private-key-file` | The path to the private_key.der that has been created | |
| `public-certificate-file` | The path to the public_key.cer that was created and sent to your Morgan Stanley contact | |
| `ms-url-api-domain` | Morgan Stanley API Url Domain (Currently set to uat) | |
| `proxy-host` | Optional proxy host | |
| `proxy-port` | Optional proxy port | |

## Retrofit
This template uses plain Java, with no larger frameworks such as Spring Boot. It uses the retrofit library, which configures API calls as an interface. Please see the [HelloWorldRestService interface](./src/main/java/com/ms/infra/example/application/servies/HelloWorldRestService.java) for an example. You can find the Retrofit docs [here](https://square.github.io/retrofit/).
Expand All @@ -79,10 +73,15 @@ The `ExampleApplication.java` file shows how to use the MsRetrofitWrapper and ma

## Running the Java Client application
This template is designed and tested on the following Java LTS versions:
- 11
- 17
- 21
- 25

You can also use **Java 11**, but you will need to use the Java 11 gradle files. If you are using Java 17+, you can delete the `java-11-setup` directory.

```shell
cp -r java-11-setup/** .
```

It is important to ensure that the Java SDK is installed and the `JAVA_HOME` environment variable has been set.
This can be checked by performing the following:
Expand Down
6 changes: 3 additions & 3 deletions client-samples/java/rest/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
plugins {
id("java")
id("com.github.johnrengelman.shadow") version "8.1.1"
id("com.gradleup.shadow") version "8.3.9"
}

group = "example.application"
Expand All @@ -27,7 +27,7 @@ dependencies {

// testing
testImplementation(group="com.squareup.okhttp3", name="mockwebserver", version="5.3.2")
testImplementation(platform("org.junit:junit-bom:5.13.4"))
testImplementation(platform("org.junit:junit-bom:6.0.2"))
testImplementation(group="org.junit.jupiter", name="junit-jupiter")
testRuntimeOnly(group="org.junit.platform", name="junit-platform-launcher")
testImplementation(group="org.mockito", name="mockito-core", version="5.21.0")
Expand All @@ -45,7 +45,7 @@ tasks {
useJUnitPlatform()
}
wrapper {
gradleVersion = "8.10"
gradleVersion = "9.2.1"
distributionType = Wrapper.DistributionType.ALL
}
}
Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-9.2.1-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
12 changes: 4 additions & 8 deletions client-samples/java/rest/gradlew

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

187 changes: 93 additions & 94 deletions client-samples/java/rest/gradlew.bat

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading