support for post requests with auth 65/42365/1 2.0.0-ONAP beijing 2.0.0-ONAP
authorsu622b <sunil.unnava@att.com>
Wed, 11 Apr 2018 23:56:37 +0000 (19:56 -0400)
committersu622b <sunil.unnava@att.com>
Wed, 11 Apr 2018 23:56:55 +0000 (19:56 -0400)
Issue-ID: DMAAP-404
Change-Id: Iaa85ab5410472fca4dd6118d2a53efc1737609d5
Signed-off-by: su622b <sunil.unnava@att.com>
pom.xml
src/main/java/com/att/nsa/mr/client/impl/DmaapClientUtil.java
src/main/java/com/att/nsa/mr/client/impl/MRBaseClient.java
src/test/java/com/att/nsa/mr/client/impl/MRBaseClientTest.java
version.properties

diff --git a/pom.xml b/pom.xml
index 9d7e3d2..c903d66 100644 (file)
--- a/pom.xml
+++ b/pom.xml
@@ -15,7 +15,7 @@
        <groupId>org.onap.dmaap.messagerouter.dmaapclient</groupId>
        <artifactId>dmaapClient</artifactId>
        <packaging>jar</packaging>
-       <version>1.1.5-SNAPSHOT</version>
+       <version>1.1.6-SNAPSHOT</version>
        <name>dmaap-messagerouter-dmaapclient</name>
        <description>Client library for MR event routing API</description>
        <url>https://github.com/att/dmaap-framework</url>
index 17a37d9..a3a2ce1 100644 (file)
@@ -64,6 +64,12 @@ public class DmaapClientUtil {
                return target.request().header("Authorization", "Basic " + authHeader).get();
 
        }
+       
+       public static Response postResponsewtBasicAuth(WebTarget target, String authHeader,byte[] data,String contentType) {
+
+               return target.request().header("Authorization", "Basic " + authHeader).post(Entity.entity(data, contentType));
+
+       }
 
        public static Response getResponsewtNoAuth(WebTarget target) {
 
index c3d1c26..a0c514c 100644 (file)
@@ -101,7 +101,7 @@ public class MRBaseClient extends HttpClient implements MRClient {
                        target = DmaapClientUtil.getTarget(path, username, password);
                        String encoding = Base64.encodeAsString(username + ":" + password);
 
-                       response = DmaapClientUtil.getResponsewtBasicAuth(target, encoding);
+                       response = DmaapClientUtil.postResponsewtBasicAuth(target, encoding,data, contentType);
 
                        return getResponseDataInJson(response);
                } else {
@@ -134,7 +134,7 @@ public class MRBaseClient extends HttpClient implements MRClient {
                        target = DmaapClientUtil.getTarget(path, username, password);
                        String encoding = Base64.encodeAsString(username + ":" + password);
 
-                       response = DmaapClientUtil.getResponsewtBasicAuth(target, encoding);
+                       response = DmaapClientUtil.postResponsewtBasicAuth(target, encoding,data, contentType);
 
                        responseData = (String)response.readEntity(String.class);
                        return responseData;
index b05cc7f..56cf954 100644 (file)
@@ -305,8 +305,8 @@ public class MRBaseClientTest {
                PowerMockito.when(response.readEntity(String.class)).thenReturn("{\"test\":\"test\"}");
                PowerMockito.when(response.getHeaders()).thenReturn(map);
 
-               PowerMockito.when(DmaapClientUtil.getResponsewtBasicAuth(DmaapClientUtil.getTarget("/path"),
-                               Base64.encodeAsString("username:password"))).thenReturn(response);
+               PowerMockito.when(DmaapClientUtil.postResponsewtBasicAuth(DmaapClientUtil.getTarget("/path"),
+                               Base64.encodeAsString("username:password"), new String("{\"test\":\"test\"}").getBytes(), "application/json")).thenReturn(response);
 
                mrBaseClient.post("/path", new String("{\"test\":\"test\"}").getBytes(), "application/json", "username",
                                "password", "HTTPAUTH");
@@ -378,8 +378,8 @@ public class MRBaseClientTest {
                PowerMockito.when(response.readEntity(String.class)).thenReturn("{\"test\":\"test\"}");
                PowerMockito.when(response.getHeaders()).thenReturn(map);
 
-               PowerMockito.when(DmaapClientUtil.getResponsewtBasicAuth(DmaapClientUtil.getTarget("/path"),
-                               Base64.encodeAsString("username:password"))).thenReturn(response);
+               PowerMockito.when(DmaapClientUtil.postResponsewtBasicAuth(DmaapClientUtil.getTarget("/path"),
+                               Base64.encodeAsString("username:password"), new String("{\"test\":\"test\"}").getBytes(), "application/json")).thenReturn(response);
 
                mrBaseClient.postWithResponse("/path", new String("{\"test\":\"test\"}").getBytes(), "application/json",
                                "username", "password", "HTTPAUTH");
index 7809677..ccd6e4a 100644 (file)
@@ -27,7 +27,7 @@
 
 major=1
 minor=1
-patch=5
+patch=6
 
 base_version=${major}.${minor}.${patch}