diff --git a/client-samples/java/rest/src/main/java/com/ms/infra/example/application/ExampleApplication.java b/client-samples/java/rest/src/main/java/com/ms/infra/example/application/ExampleApplication.java index a44aff2..0ec9078 100644 --- a/client-samples/java/rest/src/main/java/com/ms/infra/example/application/ExampleApplication.java +++ b/client-samples/java/rest/src/main/java/com/ms/infra/example/application/ExampleApplication.java @@ -2,7 +2,7 @@ import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; -import com.ms.infra.example.application.morganStanleyServices.MsApiRequest; +import com.ms.infra.example.application.morganStanleyServices.MsApiService; import com.ms.infra.example.application.morganStanleyServices.MsRetrofitWrapper; import com.ms.infra.example.application.responseTypes.HelloWorldGetServicesResponse; import com.ms.infra.example.application.services.HelloWorldRestService; @@ -31,8 +31,8 @@ public static void run() throws Exception { } public static void callHelloWorldApi() throws Exception { - MsApiRequest msApiRequest = new MsApiRequest(HttpLoggingInterceptor.Level.BODY); - msApiRequest.callEndpoint(apiEndpoint); + MsApiService msApiService = new MsApiService(HttpLoggingInterceptor.Level.BODY); + msApiService.callEndpoint(apiEndpoint); } public static void callHelloWorldApiWithRetrofit() throws Exception { diff --git a/client-samples/java/rest/src/main/java/com/ms/infra/example/application/morganStanleyServices/MsApiRequest.java b/client-samples/java/rest/src/main/java/com/ms/infra/example/application/morganStanleyServices/MsApiService.java similarity index 86% rename from client-samples/java/rest/src/main/java/com/ms/infra/example/application/morganStanleyServices/MsApiRequest.java rename to client-samples/java/rest/src/main/java/com/ms/infra/example/application/morganStanleyServices/MsApiService.java index d039a4f..a9d83c5 100644 --- a/client-samples/java/rest/src/main/java/com/ms/infra/example/application/morganStanleyServices/MsApiRequest.java +++ b/client-samples/java/rest/src/main/java/com/ms/infra/example/application/morganStanleyServices/MsApiService.java @@ -12,7 +12,12 @@ import java.io.IOException; -public class MsApiRequest { +/** + * This class is an alternative to the MsRetrofitWrapper for calling Morgan Stanley APIs. + * Ensure that the correct properties are set in the microprofile-config.properties file. + * To call a Morgan Stanley API, run the callEndpoint method, with the required endpoint. + */ +public class MsApiService { /** * Logging */ @@ -33,7 +38,7 @@ public class MsApiRequest { * @param logLevel Log interceptor level * @throws Exception throws exception if error when creating msClientAuthTokenService */ - public MsApiRequest(HttpLoggingInterceptor.Level logLevel) throws Exception { + public MsApiService(HttpLoggingInterceptor.Level logLevel) throws Exception { MicroprofileConfigService microprofileConfigService = new MicroprofileConfigService(); MsClientAuthTokenService msClientAuthTokenService = new MsClientAuthTokenService(microprofileConfigService); this.urlDomain = microprofileConfigService.getMsUrlDomain(); @@ -45,7 +50,7 @@ public MsApiRequest(HttpLoggingInterceptor.Level logLevel) throws Exception { * @param okHttpClient * @param urlDomain */ - public MsApiRequest(OkHttpClient okHttpClient, String urlDomain) { + public MsApiService(OkHttpClient okHttpClient, String urlDomain) { this.okHttpClient = okHttpClient; this.urlDomain = urlDomain; } diff --git a/client-samples/java/rest/src/test/java/com/ms/infra/example/application/TestMsApiRequestShould.java b/client-samples/java/rest/src/test/java/com/ms/infra/example/application/TestMsApiServiceShould.java similarity index 93% rename from client-samples/java/rest/src/test/java/com/ms/infra/example/application/TestMsApiRequestShould.java rename to client-samples/java/rest/src/test/java/com/ms/infra/example/application/TestMsApiServiceShould.java index 598854e..04d0564 100644 --- a/client-samples/java/rest/src/test/java/com/ms/infra/example/application/TestMsApiRequestShould.java +++ b/client-samples/java/rest/src/test/java/com/ms/infra/example/application/TestMsApiServiceShould.java @@ -1,7 +1,7 @@ package com.ms.infra.example.application; import com.ms.infra.example.application.interceptors.AuthHeaderInterceptor; -import com.ms.infra.example.application.morganStanleyServices.MsApiRequest; +import com.ms.infra.example.application.morganStanleyServices.MsApiService; import com.ms.infra.example.application.morganStanleyServices.MsClientAuthTokenService; import okhttp3.OkHttpClient; import okhttp3.mockwebserver.MockResponse; @@ -18,7 +18,7 @@ import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.core.Is.is; -public class TestMsApiRequestShould { +public class TestMsApiServiceShould { private OkHttpClient okHttpClient; private MockWebServer mockWebServer; @@ -54,9 +54,9 @@ public void call_api() throws InterruptedException, IOException { mockWebServer.enqueue(mockResponse); System.out.println(mockWebServer.url("/")); - MsApiRequest msApiRequest = new MsApiRequest(okHttpClient, mockWebServer.url("").toString()); + MsApiService msApiService = new MsApiService(okHttpClient, mockWebServer.url("").toString()); - msApiRequest.callEndpoint(TEST_ENDPOINT); + msApiService.callEndpoint(TEST_ENDPOINT); // Check the request RecordedRequest recordedRequest = mockWebServer.takeRequest();