diff options
author | sunil.unnava <sunil.unnava@att.com> | 2019-05-10 11:23:28 -0400 |
---|---|---|
committer | sunil.unnava <sunil.unnava@att.com> | 2019-05-10 11:23:39 -0400 |
commit | ff89c8072fc72e672ff9eb149ca8b2e8fe69bd7a (patch) | |
tree | 23a2f5efc9e0dd23d5313e96a039b689e724d951 /src/test/java/org | |
parent | ab3015141a2cb42308f1d09dc3a7edc8c10cf5c7 (diff) |
clean MR codebase
Issue-ID: DMAAP-1192
Change-Id: Ic7cfa0af7ef6578be488025fe0e058d7e84dd403
Signed-off-by: sunil.unnava <sunil.unnava@att.com>
Diffstat (limited to 'src/test/java/org')
10 files changed, 10 insertions, 282 deletions
diff --git a/src/test/java/org/onap/dmaap/mr/cambria/beans/ApiKeyBeanTest.java b/src/test/java/org/onap/dmaap/mr/cambria/beans/ApiKeyBeanTest.java index beec641..6fbff02 100644 --- a/src/test/java/org/onap/dmaap/mr/cambria/beans/ApiKeyBeanTest.java +++ b/src/test/java/org/onap/dmaap/mr/cambria/beans/ApiKeyBeanTest.java @@ -44,7 +44,7 @@ public class ApiKeyBeanTest { @Test public void testGetEmail() { - ApiKeyBean bean = new ApiKeyBean("hs647a@att.com", "testing bean"); + ApiKeyBean bean = new ApiKeyBean("user@onap.com", "testing bean"); bean.getEmail(); diff --git a/src/test/java/org/onap/dmaap/mr/cambria/beans/ApiKeyBeanTest2.java b/src/test/java/org/onap/dmaap/mr/cambria/beans/ApiKeyBeanTest2.java index 8f77807..46ebad0 100644 --- a/src/test/java/org/onap/dmaap/mr/cambria/beans/ApiKeyBeanTest2.java +++ b/src/test/java/org/onap/dmaap/mr/cambria/beans/ApiKeyBeanTest2.java @@ -44,9 +44,9 @@ public class ApiKeyBeanTest2 { @Test public void testSetEmail() { - ApiKeyBean bean = new ApiKeyBean("hs647a@att.com", "testing bean"); + ApiKeyBean bean = new ApiKeyBean("user@onap.com", "testing bean"); - bean.setEmail("rs857c@att.com"); + bean.setEmail("user@onap.com"); String trueValue = "True"; assertTrue(trueValue.equalsIgnoreCase("True")); diff --git a/src/test/java/org/onap/dmaap/mr/cambria/beans/ApiKeyBeanTest3.java b/src/test/java/org/onap/dmaap/mr/cambria/beans/ApiKeyBeanTest3.java index 108b5fb..0d62ee4 100644 --- a/src/test/java/org/onap/dmaap/mr/cambria/beans/ApiKeyBeanTest3.java +++ b/src/test/java/org/onap/dmaap/mr/cambria/beans/ApiKeyBeanTest3.java @@ -44,7 +44,7 @@ public class ApiKeyBeanTest3 { @Test public void testGetDescription() { - ApiKeyBean bean = new ApiKeyBean("hs647a@att.com", "testing bean"); + ApiKeyBean bean = new ApiKeyBean("user@onap.com", "testing bean"); bean.getDescription(); diff --git a/src/test/java/org/onap/dmaap/mr/cambria/beans/ApiKeyBeanTest4.java b/src/test/java/org/onap/dmaap/mr/cambria/beans/ApiKeyBeanTest4.java index cae2c94..2ea35bd 100644 --- a/src/test/java/org/onap/dmaap/mr/cambria/beans/ApiKeyBeanTest4.java +++ b/src/test/java/org/onap/dmaap/mr/cambria/beans/ApiKeyBeanTest4.java @@ -44,7 +44,7 @@ public class ApiKeyBeanTest4 { @Test public void testSetDescription() { - ApiKeyBean bean = new ApiKeyBean("hs647a@att.com", "testing bean"); + ApiKeyBean bean = new ApiKeyBean("user@onap.com", "testing bean"); bean.setDescription("new testing description"); diff --git a/src/test/java/org/onap/dmaap/mr/cambria/beans/ApiKeyBeanTest5.java b/src/test/java/org/onap/dmaap/mr/cambria/beans/ApiKeyBeanTest5.java index 3e095c0..d13a703 100644 --- a/src/test/java/org/onap/dmaap/mr/cambria/beans/ApiKeyBeanTest5.java +++ b/src/test/java/org/onap/dmaap/mr/cambria/beans/ApiKeyBeanTest5.java @@ -44,7 +44,7 @@ public class ApiKeyBeanTest5 { @Test public void testGetSharedSecret() { - ApiKeyBean bean = new ApiKeyBean("hs647a@att.com", "testing bean"); + ApiKeyBean bean = new ApiKeyBean("user@onap.com", "testing bean"); bean.getSharedSecret(); diff --git a/src/test/java/org/onap/dmaap/mr/cambria/beans/ApiKeyBeanTest6.java b/src/test/java/org/onap/dmaap/mr/cambria/beans/ApiKeyBeanTest6.java index 871e2e7..21cfc43 100644 --- a/src/test/java/org/onap/dmaap/mr/cambria/beans/ApiKeyBeanTest6.java +++ b/src/test/java/org/onap/dmaap/mr/cambria/beans/ApiKeyBeanTest6.java @@ -44,7 +44,7 @@ public class ApiKeyBeanTest6 { @Test public void testGetKey() { - ApiKeyBean bean = new ApiKeyBean("hs647a@att.com", "testing bean"); + ApiKeyBean bean = new ApiKeyBean("user@onap.com", "testing bean"); bean.getKey(); diff --git a/src/test/java/org/onap/dmaap/mr/test/dmaap/DMaapTopicTest.java b/src/test/java/org/onap/dmaap/mr/test/dmaap/DMaapTopicTest.java index ec1a63a..98c5ab3 100644 --- a/src/test/java/org/onap/dmaap/mr/test/dmaap/DMaapTopicTest.java +++ b/src/test/java/org/onap/dmaap/mr/test/dmaap/DMaapTopicTest.java @@ -51,26 +51,6 @@ public class DMaapTopicTest { DmaapApiKeyTest keyInstance = new DmaapApiKeyTest(); - public void createTopic(String name) { - if (!topicExist(name)) { - TopicBean topicbean = new TopicBean(); - topicbean.setDescription("creating topic"); - topicbean.setPartitionCount(1); - topicbean.setReplicationCount(1); - topicbean.setTopicName(name); - topicbean.setTransactionEnabled(true); - target = client.target(url); - target = target.path("/topics/create"); - JSONObject jsonObj = keyInstance.returnKey(new ApiKeyBean("nm254w@att.com", "topic creation")); - topicapikey = (String) jsonObj.get("key"); - topicsecretKey = (String) jsonObj.get("secret"); - serverCalculatedSignature = sha1HmacSigner.sign(date, topicsecretKey); - Response response = target.request().header("X-CambriaAuth", topicapikey + ":" + serverCalculatedSignature) - .header("X-CambriaDate", date).post(Entity.json(topicbean)); - keyInstance.assertStatus(response); - } - - } public boolean topicExist(String topicName) { target = target.path("/topics/" + topicName); @@ -165,47 +145,6 @@ public class DMaapTopicTest { LOGGER.info("Successfully returned after getting all the publishers" + topicName); } - public void testPermitPublisherForTopic() { - LOGGER.info("test case permit user for topic " + topicName); - JSONObject jsonObj = keyInstance.returnKey(new ApiKeyBean("ai039a@att.com", "adding user to ")); - String userapikey = (String) jsonObj.get("key"); - createTopic(topicName); - // adding user to a topic// - target = client.target(url); - target = target.path("/topics/"); - target = target.path(topicName); - target = target.path("/producers/"); - target = target.path(userapikey); - Response response = target.request().header("X-CambriaAuth", topicapikey + ":" + serverCalculatedSignature) - .header("X-CambriaDate", date).put(Entity.json("")); - keyInstance.assertStatus(response); - LOGGER.info("successfully returned after permiting the user for topic " + topicName); - } - - public void testDenyPublisherForTopic() { - LOGGER.info("test case denying user for topic " + topicName); - JSONObject jsonObj = keyInstance.returnKey(new ApiKeyBean("ai039a@att.com", "adding user to ")); - String userapikey = (String) jsonObj.get("key"); - createTopic(topicName); - // adding user to a topic// - target = client.target(url); - target = target.path("/topics/"); - target = target.path(topicName); - target = target.path("/producers/"); - target = target.path(userapikey); - target.request().header("X-CambriaAuth", topicapikey + ":" + serverCalculatedSignature) - .header("X-CambriaDate", date).put(Entity.json("")); - // deleting user who is just added// - target = client.target(url); - target = target.path("/topics/"); - target = target.path(topicName); - target = target.path("/producers/"); - target = target.path(userapikey); - Response response2 = target.request().header("X-CambriaAuth", topicapikey + ":" + serverCalculatedSignature) - .header("X-CambriaDate", date).delete(); - keyInstance.assertStatus(response2); - LOGGER.info("successfully returned after denying the user for topic " + topicName); - } public void testConsumerForTopic() { LOGGER.info("test case get all consumers for topic: " + topicName); @@ -221,47 +160,6 @@ public class DMaapTopicTest { LOGGER.info("Successfully returned after getting all the consumers" + topicName); } - public void testPermitConsumerForTopic() { - LOGGER.info("test case get all consumer for topic: " + topicName); - // creating user for adding to topic// - JSONObject jsonObj = keyInstance.returnKey(new ApiKeyBean("ai039a@att.com", "adding user to ")); - String userapikey = (String) jsonObj.get("key"); - createTopic(topicName); - // adding user to a topic// - target = client.target(url); - target = target.path("/topics/"); - target = target.path(topicName); - target = target.path("/consumers/"); - target = target.path(userapikey); - Response response = target.request().header("X-CambriaAuth", topicapikey + ":" + serverCalculatedSignature) - .header("X-CambriaDate", date).put(Entity.json("")); - keyInstance.assertStatus(response); - LOGGER.info("Successfully returned after getting all the consumers" + topicName); - } - public void testDenyConsumerForTopic() { - LOGGER.info("test case denying consumer for topic " + topicName); - // creating user for adding and deleting from topic// - JSONObject jsonObj = keyInstance.returnKey(new ApiKeyBean("ai039a@att.com", "adding user to ")); - String userapikey = (String) jsonObj.get("key"); - createTopic(topicName); - // adding user to a topic// - target = client.target(url); - target = target.path("/topics/"); - target = target.path(topicName); - target = target.path("/consumers/"); - target = target.path(userapikey); - target.request().header("X-CambriaAuth", topicapikey + ":" + serverCalculatedSignature) - .header("X-CambriaDate", date).put(Entity.json("")); - // deleting user who is just added// - target = client.target(url); - target = target.path("/topics/"); - target = target.path(topicName); - target = target.path("/consumers/"); - target = target.path(userapikey); - Response response2 = target.request().header("X-CambriaAuth", topicapikey + ":" + serverCalculatedSignature) - .header("X-CambriaDate", date).delete(); - keyInstance.assertStatus(response2); - LOGGER.info("successfully returned after denying the consumer for topic " + topicName); - }*/ +*/ } diff --git a/src/test/java/org/onap/dmaap/mr/test/dmaap/DmaapApiKeyTest.java b/src/test/java/org/onap/dmaap/mr/test/dmaap/DmaapApiKeyTest.java index f40025a..2c97a0b 100644 --- a/src/test/java/org/onap/dmaap/mr/test/dmaap/DmaapApiKeyTest.java +++ b/src/test/java/org/onap/dmaap/mr/test/dmaap/DmaapApiKeyTest.java @@ -65,13 +65,6 @@ public class DmaapApiKeyTest { return dataObj; } - // 1. create key - public void testCreateKey() { - LOGGER.info("test case create key"); - ApiKeyBean apiKeyBean = new ApiKeyBean("nm254w@att.com", "Creating Api Key."); - returnKey(apiKeyBean); - LOGGER.info("Successfully returned after creating key"); - } public void assertStatus(Response response) { assertTrue(response.getStatus() == HttpStatus.SC_OK); @@ -92,71 +85,7 @@ public class DmaapApiKeyTest { } - // 3. get specific key - public void testSpecificKey() { - LOGGER.info("test case get specific key"); - String apiKey = ""; - ApiKeyBean apiKeyBean = new ApiKeyBean("ai039@att.com", "Creating Api Key."); - - apiKey = (String) returnKey(apiKeyBean).get("key"); - target = client.target(url); - target = target.path("/apiKeys/"); - target = target.path(apiKey); - Response response = target.request().get(); - assertStatus(response); - LOGGER.info("successfully returned after fetching specific key"); - } - - // 4. update key - public void testUpdateKey() { - LOGGER.info("test case update key"); - String apiKey = ""; - String secretKey = ""; - final String serverCalculatedSignature; - final String X_CambriaAuth; - final String X_CambriaDate; - JSONObject jsonObj; - ApiKeyBean apiKeyBean = new ApiKeyBean("ai039@att.com", "Creating Api Key for update"); - ApiKeyBean apiKeyBean1 = new ApiKeyBean("ai03911@att.com", "updating Api Key."); - jsonObj = returnKey(apiKeyBean); - apiKey = (String) jsonObj.get("key"); - secretKey = (String) jsonObj.get("secret"); - - serverCalculatedSignature = sha1HmacSigner.sign(date, secretKey); - X_CambriaAuth = apiKey + ":" + serverCalculatedSignature; - X_CambriaDate = date; - target = client.target(url); - target = target.path("/apiKeys/" + apiKey); - Response response1 = target.request().header("X-CambriaAuth", X_CambriaAuth) - .header("X-CambriaDate", X_CambriaDate).put(Entity.json(apiKeyBean1)); - assertStatus(response1); - LOGGER.info("successfully returned after updating key"); - } - - // 5. delete key - public void testDeleteKey() { - LOGGER.info("test case delete key"); - String apiKey = ""; - String secretKey = ""; - final String serverCalculatedSignature; - final String X_CambriaAuth; - final String X_CambriaDate; - JSONObject jsonObj; - ApiKeyBean apiKeyBean = new ApiKeyBean("ai039@att.com", "Creating Api Key."); - jsonObj = returnKey(apiKeyBean); - apiKey = (String) jsonObj.get("key"); - secretKey = (String) jsonObj.get("secret"); - serverCalculatedSignature = sha1HmacSigner.sign(date, secretKey); - X_CambriaAuth = apiKey + ":" + serverCalculatedSignature; - X_CambriaDate = date; - target = client.target(url); - target = target.path("/apiKeys/" + apiKey); - Response response2 = target.request().header("X-CambriaAuth", X_CambriaAuth) - .header("X-CambriaDate", X_CambriaDate).delete(); - assertStatus(response2); - LOGGER.info("successfully returned after deleting key"); - } */ }
\ No newline at end of file diff --git a/src/test/java/org/onap/dmaap/mr/test/dme2/DME2AdminTest.java b/src/test/java/org/onap/dmaap/mr/test/dme2/DME2AdminTest.java index 3222046..da786ad 100644 --- a/src/test/java/org/onap/dmaap/mr/test/dme2/DME2AdminTest.java +++ b/src/test/java/org/onap/dmaap/mr/test/dme2/DME2AdminTest.java @@ -62,7 +62,7 @@ public class DME2AdminTest extends TestCase { String longitude = props.getProperty("Longitude"); String version = props.getProperty("Version"); String serviceName = props.getProperty("ServiceName"); - serviceName = "dmaap-v1.dev.dmaap.dt.saat.acsi.att.com/admin"; + serviceName = "mr/admin"; String env = props.getProperty("Environment"); String partner = props.getProperty("Partner"); String protocol = props.getProperty("Protocol"); diff --git a/src/test/java/org/onap/dmaap/mr/test/dme2/DME2ApiKeyTest.java b/src/test/java/org/onap/dmaap/mr/test/dme2/DME2ApiKeyTest.java index 54148b2..ad45706 100644 --- a/src/test/java/org/onap/dmaap/mr/test/dme2/DME2ApiKeyTest.java +++ b/src/test/java/org/onap/dmaap/mr/test/dme2/DME2ApiKeyTest.java @@ -63,7 +63,7 @@ public class DME2ApiKeyTest extends TestCase { public void testCreateKey() { LOGGER.info("Create Key test case initiated"); - ApiKeyBean apiKeyBean = new ApiKeyBean("user1@us.att.com", "Creating Api Key.m"); + ApiKeyBean apiKeyBean = new ApiKeyBean("user1@onap.com", "Creating Api Key.m"); System.out.println(url); @@ -125,105 +125,6 @@ public class DME2ApiKeyTest extends TestCase { } } - public void testGetOneKey() {/* - LOGGER.info("Test case get one key initiated"); - ApiKeyBean apiKeyBean = new ApiKeyBean("user1@att.com", "Creating Api Key.m"); - JSONObject jsonObj = new JSONObject(returnKey(apiKeyBean, url, props)); - String apiKey = (String) jsonObj.get("key"); - try { - DME2Client sender = new DME2Client(new URI(url), 5000L); - sender.setAllowAllHttpReturnCodes(true); - sender.setMethod(props.getProperty("MethodTypeGet")); - sender.setSubContext(props.getProperty("SubContextPathGetOneKey") + apiKey); - sender.setPayload(""); - sender.addHeader("content-type", props.getProperty("contenttype")); - sender.setCredentials(props.getProperty("user"), props.getProperty("password")); - - LOGGER.info("Fetching details of api key: " + apiKey); - String reply = sender.sendAndWait(5000L); - System.out.println(reply); - assertTrue(LoadPropertyFile.isValidJsonString(reply)); - LOGGER.info("response =" + reply); - - } catch (DME2Exception e) { - e.printStackTrace(); - } catch (URISyntaxException e) { - e.printStackTrace(); - } catch (Exception e) { - e.printStackTrace(); - } - */} - - // ............. test case update key is not applicable in - // DME2.................// - public void testUpdateKey() {/* - ApiKeyBean apiKeyBean = new ApiKeyBean("user1@att.com", "Creating Api Key.m"); - - JSONObject jsonObj = new JSONObject(returnKey(apiKeyBean, url, props)); - String apiKey = (String) jsonObj.get("key"); - try { - DME2Client sender = new DME2Client(new URI(url), 5000L); - sender.setAllowAllHttpReturnCodes(true); - String p = props.getProperty("MethodTypePut"); - sender.setMethod(p); - String s = props.getProperty("SubContextPathUpdateKeys") + apiKey; - sender.setSubContext(s); - - String jsonStringApiBean = new ObjectMapper() - .writeValueAsString(new ApiKeyBean("user1@att.com", "updating key")); - sender.setPayload(jsonStringApiBean); - System.out.println(jsonStringApiBean); - String c = props.getProperty("contenttype"); - sender.addHeader("content-type", c); - sender.setCredentials(props.getProperty("keyUser"), props.getProperty("keyPass")); - System.out.println("creating ApiKey"); - String reply = sender.sendAndWait(5000L); - assertNotNull(reply); - System.out.println("response =" + reply); - - } catch (DME2Exception e) { - e.printStackTrace(); - } catch (URISyntaxException e) { - e.printStackTrace(); - } catch (Exception e) { - e.printStackTrace(); - } - */} - - // ............. test case delete key is not applicable in - // DME2.................// - - public void testDeleteKey() {/* - ApiKeyBean apiKeyBean = new ApiKeyBean("user1@att.com", "Creating Api Key.m"); - - JSONObject jsonObj = new JSONObject(returnKey(apiKeyBean, url, props)); - String apiKey = (String) jsonObj.get("key"); - try { - DME2Client sender = new DME2Client(new URI(url), 5000L); - sender.setAllowAllHttpReturnCodes(true); - String p = props.getProperty("MethodTypeDelete"); - sender.setMethod(p); - String s = props.getProperty("SubContextPathDeleteteKeys") + apiKey; - sender.setSubContext(s); - - sender.setPayload(""); // System.out.println(jsonStringApiBean); - String c = props.getProperty("contenttype"); - sender.addHeader("content-type", c); - sender.setCredentials(props.getProperty("keyUser"), props.getProperty("keyPass")); - - System.out.println("creating ApiKey"); - String reply = sender.sendAndWait(5000L); - assertNotNull(reply); - System.out.println("response =" + reply); - - } catch (DME2Exception e) { - e.printStackTrace(); - } catch (URISyntaxException e) { - e.printStackTrace(); - } catch (Exception e) { - e.printStackTrace(); - } - */} } |