diff options
author | dave.adams (da490c) <dave.adams@amdocs.com> | 2017-09-12 12:14:02 -0400 |
---|---|---|
committer | dave.adams (da490c) <dave.adams@amdocs.com> | 2017-09-21 08:58:11 -0400 |
commit | fa337c7571edf97800fc47cdb404160f7da97c8b (patch) | |
tree | 3ad059a317c0b72ecf0203999a4929299831ddff /src/test/java/org | |
parent | 9b97b575d3ebbd3df83fa6a6770e418bbcb546d0 (diff) |
Expose ssl protocol config
Issue-ID: AAI-127
Change-Id: I657144887df8ec36b73d0506902ca4d324dd794a
Signed-off-by: dave.adams (da490c) <dave.adams@amdocs.com>
Diffstat (limited to 'src/test/java/org')
-rw-r--r-- | src/test/java/org/onap/aai/restclient/client/RestfulClientTest.java | 26 | ||||
-rw-r--r-- | src/test/java/org/onap/aai/restclient/rest/RestClientBuilderTest.java | 10 |
2 files changed, 36 insertions, 0 deletions
diff --git a/src/test/java/org/onap/aai/restclient/client/RestfulClientTest.java b/src/test/java/org/onap/aai/restclient/client/RestfulClientTest.java index 0e5c84e..1f528ae 100644 --- a/src/test/java/org/onap/aai/restclient/client/RestfulClientTest.java +++ b/src/test/java/org/onap/aai/restclient/client/RestfulClientTest.java @@ -28,6 +28,7 @@ import javax.ws.rs.core.Response.Status; import org.junit.Before; import org.junit.Test; +import org.mockito.ArgumentCaptor; import org.mockito.Mockito; import org.onap.aai.restclient.client.OperationResult; import org.onap.aai.restclient.client.RestClient; @@ -167,6 +168,31 @@ public class RestfulClientTest { assertNull(result.getResult()); assertNull(result.getFailureCause()); } + + @Test + public void validateSuccessfulPost_withMultivaluedHeader() throws Exception { + RestClient restClient = buildClient(); + + MultivaluedMapImpl headerMap = new MultivaluedMapImpl(); + + headerMap.add("txnId", "123"); + headerMap.add("txnId", "456"); + headerMap.add("txnId", "789"); + + OperationResult result = restClient.post(TEST_URL, "", headerMap, MediaType.APPLICATION_JSON_TYPE, + MediaType.APPLICATION_JSON_TYPE); + + // capture the txnId header from the outgoing request + ArgumentCaptor<String> txnIdHeaderName = ArgumentCaptor.forClass(String.class); + ArgumentCaptor<String> txnIdHeaderValue = ArgumentCaptor.forClass(String.class); + + Mockito.verify(mockedBuilder, Mockito.atLeast(1)).header(txnIdHeaderName.capture(), txnIdHeaderValue.capture()); + assertEquals("123;456;789", txnIdHeaderValue.getValue()); + + assertEquals(Response.Status.OK.getStatusCode(), result.getResultCode()); + assertNotNull(result.getResult()); + assertNull(result.getFailureCause()); + } @Test public void validateSuccessfulGet() throws Exception { diff --git a/src/test/java/org/onap/aai/restclient/rest/RestClientBuilderTest.java b/src/test/java/org/onap/aai/restclient/rest/RestClientBuilderTest.java index 013f817..5e7d8c1 100644 --- a/src/test/java/org/onap/aai/restclient/rest/RestClientBuilderTest.java +++ b/src/test/java/org/onap/aai/restclient/rest/RestClientBuilderTest.java @@ -269,5 +269,15 @@ public class RestClientBuilderTest { }
+ @Test
+ public void validateSslProtocolConfiguration() throws Exception {
+
+ RestClientBuilder restClientBuilder = new RestClientBuilder();
+ assertEquals(RestClientBuilder.DEFAULT_SSL_PROTOCOL, restClientBuilder.getSslProtocol());
+
+ restClientBuilder.setSslProtocol("TLSv1.2");
+ assertEquals("TLSv1.2", restClientBuilder.getSslProtocol());
+
+ }
}
|