aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/main/java/com/att/nsa/mr/client/impl/DmaapClientUtil.java6
-rw-r--r--src/main/java/com/att/nsa/mr/client/impl/MRBaseClient.java4
-rw-r--r--src/test/java/com/att/nsa/mr/client/impl/MRBaseClientTest.java8
3 files changed, 12 insertions, 6 deletions
diff --git a/src/main/java/com/att/nsa/mr/client/impl/DmaapClientUtil.java b/src/main/java/com/att/nsa/mr/client/impl/DmaapClientUtil.java
index 17a37d9..a3a2ce1 100644
--- a/src/main/java/com/att/nsa/mr/client/impl/DmaapClientUtil.java
+++ b/src/main/java/com/att/nsa/mr/client/impl/DmaapClientUtil.java
@@ -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) {
diff --git a/src/main/java/com/att/nsa/mr/client/impl/MRBaseClient.java b/src/main/java/com/att/nsa/mr/client/impl/MRBaseClient.java
index c3d1c26..a0c514c 100644
--- a/src/main/java/com/att/nsa/mr/client/impl/MRBaseClient.java
+++ b/src/main/java/com/att/nsa/mr/client/impl/MRBaseClient.java
@@ -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;
diff --git a/src/test/java/com/att/nsa/mr/client/impl/MRBaseClientTest.java b/src/test/java/com/att/nsa/mr/client/impl/MRBaseClientTest.java
index b05cc7f..56cf954 100644
--- a/src/test/java/com/att/nsa/mr/client/impl/MRBaseClientTest.java
+++ b/src/test/java/com/att/nsa/mr/client/impl/MRBaseClientTest.java
@@ -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");