Skip to content

Commit c8e1338

Browse files
committed
CWMS-2055 - Updates TokenUrlDiscoveryService getUrl() signature to throw IOException
1 parent 6800475 commit c8e1338

File tree

5 files changed

+9
-7
lines changed

5 files changed

+9
-7
lines changed

cwbi-auth-http-client/src/main/java/hec/army/usace/hec/cwbi/auth/http/client/CwbiAuthTokenProviderBase.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ protected CwbiAuthTokenProviderBase(String clientId) {
3737
this.clientId = Objects.requireNonNull(clientId, "Missing required clientId");
3838
}
3939

40-
abstract ApiConnectionInfo getUrl();
40+
abstract ApiConnectionInfo getUrl() throws IOException;
4141

4242
@Override
4343
public synchronized void clear() {

cwbi-auth-http-client/src/main/java/hec/army/usace/hec/cwbi/auth/http/client/DiscoveredCwbiAuthTokenProvider.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
*/
2424
package hec.army.usace.hec.cwbi.auth.http.client;
2525

26+
import java.io.IOException;
2627
import java.util.Objects;
2728
import mil.army.usace.hec.cwms.http.client.ApiConnectionInfo;
2829

@@ -38,8 +39,7 @@ public DiscoveredCwbiAuthTokenProvider(String clientId, TokenUrlDiscoveryService
3839
}
3940

4041
@Override
41-
synchronized ApiConnectionInfo getUrl()
42-
{
42+
synchronized ApiConnectionInfo getUrl() throws IOException {
4343
if(url == null)
4444
{
4545
url = tokenUrlDiscoveryService.discoverTokenUrl();

cwbi-auth-http-client/src/main/java/hec/army/usace/hec/cwbi/auth/http/client/TokenUrlDiscoveryService.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,9 @@
2323
*/
2424
package hec.army.usace.hec.cwbi.auth.http.client;
2525

26+
import java.io.IOException;
2627
import mil.army.usace.hec.cwms.http.client.ApiConnectionInfo;
2728

2829
public interface TokenUrlDiscoveryService {
29-
ApiConnectionInfo discoverTokenUrl();
30+
ApiConnectionInfo discoverTokenUrl() throws IOException;
3031
}

cwbi-auth-http-client/src/test/java/hec/army/usace/hec/cwbi/auth/http/client/MockDiscoveredCwbiAuthTokenProvider.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
*/
2424
package hec.army.usace.hec.cwbi.auth.http.client;
2525

26+
import java.io.IOException;
2627
import java.util.Objects;
2728
import mil.army.usace.hec.cwms.http.client.ApiConnectionInfo;
2829
import mil.army.usace.hec.cwms.http.client.auth.OAuth2Token;
@@ -50,7 +51,7 @@ void setOAuth2Token(OAuth2Token token) {
5051

5152
//package scoped for testing
5253
@Override
53-
synchronized ApiConnectionInfo getUrl() {
54+
synchronized ApiConnectionInfo getUrl() throws IOException {
5455
if(url == null)
5556
{
5657
url = tokenUrlDiscoveryService.discoverTokenUrl();

cwbi-auth-http-client/src/test/java/hec/army/usace/hec/cwbi/auth/http/client/TestDiscoveredCwbiTokenProvider.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ protected void launchMockServerWithResource(String resource) throws IOException
9090
}
9191

9292
@Test
93-
void testBuildTokenProvider() {
93+
void testBuildTokenProvider() throws IOException {
9494
ApiConnectionInfo tokenUrl = buildConnectionInfo();
9595
MockTokenUrlDiscoveryService tokenUrlDiscoveryService = new MockTokenUrlDiscoveryService(tokenUrl);
9696
DiscoveredCwbiAuthTokenProvider tokenProvider = new DiscoveredCwbiAuthTokenProvider("cumulus", tokenUrlDiscoveryService);
@@ -162,7 +162,7 @@ void testRefreshToken() throws IOException {
162162
}
163163

164164
@Test
165-
void testConstructor() {
165+
void testConstructor() throws IOException {
166166
SSLSocketFactory sslSocketFactory = getTestSslSocketFactory();
167167
ApiConnectionInfo tokenUrl = new ApiConnectionInfoBuilder("test.com")
168168
.withSslSocketData(new SslSocketData(sslSocketFactory, CwbiAuthTrustManager.getTrustManager()))

0 commit comments

Comments
 (0)