From f25de1912f09ed6d5e3172332913daee1851e704 Mon Sep 17 00:00:00 2001 From: sunil unnava Date: Fri, 31 Aug 2018 11:05:31 -0400 Subject: Remove the username/password check Issue-ID: DMAAP-689 Change-Id: I1b6528bd3aaa2d9d117d0970444123a3c93ac597 Signed-off-by: sunil unnava --- pom.xml | 2 +- .../java/com/att/nsa/mr/client/impl/MRBaseClient.java | 19 +++++++------------ .../com/att/nsa/mr/client/impl/MRConsumerImpl.java | 2 +- .../com/att/nsa/mr/client/impl/MRBaseClientTest.java | 12 +----------- version.properties | 2 +- 5 files changed, 11 insertions(+), 26 deletions(-) diff --git a/pom.xml b/pom.xml index 6ea7f1c..0db71e8 100644 --- a/pom.xml +++ b/pom.xml @@ -15,7 +15,7 @@ org.onap.dmaap.messagerouter.dmaapclient dmaapClient jar - 1.1.7-SNAPSHOT + 1.1.8-SNAPSHOT dmaap-messagerouter-dmaapclient Client library for MR event routing API https://github.com/att/dmaap-framework 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 fb49096..76bf5ce 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 @@ -261,19 +261,14 @@ public class MRBaseClient extends HttpClient implements MRClient { } } - public JSONObject getNoAuth(final String path, final String username, final String password, - final String protocolFlag) throws HttpException, JSONException { - if (null != username && null != password) { - WebTarget target=null; - Response response=null; - target = DmaapClientUtil.getTarget(path, username, password); - response = DmaapClientUtil.getResponsewtNoAuth(target); + public JSONObject getNoAuth(final String path) throws HttpException, JSONException { - return getResponseDataInJson(response); - } else { - throw new HttpException( - "Authentication Failed: Username/password/AuthKey/Authdate parameter(s) cannot be null or empty."); - } + WebTarget target = null; + Response response = null; + target = DmaapClientUtil.getTarget(path); + response = DmaapClientUtil.getResponsewtNoAuth(target); + + return getResponseDataInJson(response); } public String getAuthResponse(final String path, final String authKey, final String authDate, final String username, diff --git a/src/main/java/com/att/nsa/mr/client/impl/MRConsumerImpl.java b/src/main/java/com/att/nsa/mr/client/impl/MRConsumerImpl.java index 72d97c9..bc156ea 100644 --- a/src/main/java/com/att/nsa/mr/client/impl/MRConsumerImpl.java +++ b/src/main/java/com/att/nsa/mr/client/impl/MRConsumerImpl.java @@ -200,7 +200,7 @@ public class MRConsumerImpl extends MRBaseClient implements MRConsumer { fGroup, fId, props.getProperty("Protocol")), timeoutMs, limit); try { - final JSONObject o = getNoAuth(urlPath, username, password, protocolFlag); + final JSONObject o = getNoAuth(urlPath); if (o != null) { final JSONArray a = o.getJSONArray("result"); if (a != null) { 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 56cf954..055c94f 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 @@ -448,21 +448,11 @@ public class MRBaseClientTest { PowerMockito.when(response.getHeaders()).thenReturn(map); PowerMockito.when(DmaapClientUtil.getResponsewtNoAuth(DmaapClientUtil.getTarget("/path"))).thenReturn(response); - mrBaseClient.getNoAuth("/path", "username", "password", "HTTPAUTH"); + mrBaseClient.getNoAuth("/path"); assertTrue(true); } - @Test(expected = HttpException.class) - public void testGetNoAuth_error() throws JSONException, HttpException { - - ResponseBuilder responseBuilder = Response.ok(); - PowerMockito.when(DmaapClientUtil.getResponsewtNoAuth(DmaapClientUtil.getTarget("/path"))).thenReturn( - responseBuilder.header("transactionid", "transactionid").entity("{\"test\":\"test\"}").build()); - mrBaseClient.getNoAuth("/path", null, null, "HTTPAUTH"); - assertTrue(true); - - } @Test public void testGetHTTPErrorResponseMessage() { diff --git a/version.properties b/version.properties index 61001b0..c31717c 100644 --- a/version.properties +++ b/version.properties @@ -27,7 +27,7 @@ major=1 minor=1 -patch=7 +patch=8 base_version=${major}.${minor}.${patch} -- cgit 1.2.3-korg