diff options
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());
+
+ }
}
|