diff options
Diffstat (limited to 'src/test')
11 files changed, 36 insertions, 295 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(); - } - */} } diff --git a/src/test/resources/MsgRtrApi.properties b/src/test/resources/MsgRtrApi.properties index 0bfb1ec..3aef922 100644 --- a/src/test/resources/MsgRtrApi.properties +++ b/src/test/resources/MsgRtrApi.properties @@ -54,12 +54,16 @@ kafka.metadata.broker.list=<kafka_host>:<kafka_port> #kafka.client.zookeeper=${config.zk.servers} consumer.timeout.ms=100 zookeeper.connection.timeout.ms=6000 -zookeeper.session.timeout.ms=6000 +zookeeper.session.timeout.ms=20000 zookeeper.sync.time.ms=2000 auto.commit.interval.ms=1000 fetch.message.max.bytes =1000000 auto.commit.enable=false +#(backoff*retries > zksessiontimeout) +kafka.rebalance.backoff.ms=10000 +kafka.rebalance.max.retries=6 + ############################################################################### ## @@ -106,8 +110,8 @@ authentication.adminSecret=fe3cCompound ## consumers every sweepFreqSeconds and will clean up any connections that are ## dormant for touchFreqMs. #cambria.consumer.cache.sweepFreqSeconds=15 -#cambria.consumer.cache.touchFreqMs=120000 - +cambria.consumer.cache.touchFreqMs=120000 +##stickforallconsumerrequests=false ## The cache is managed through ZK. The default value for the ZK connection ## string is the same as config.zk.servers. #cambria.consumer.cache.zkConnect=${config.zk.servers} @@ -120,6 +124,9 @@ authentication.adminSecret=fe3cCompound ## #cambria.api.node.identifier=<use-something-unique-to-this-instance> +#cambria.rateLimit.maxEmptyPollsPerMinute=30 +#cambria.rateLimitActual.delay.ms=10 + ############################################################################### ## ## Metrics Reporting @@ -128,9 +135,10 @@ authentication.adminSecret=fe3cCompound ## #metrics.send.cambria.enabled=true #metrics.send.cambria.topic=cambria.apinode.metrics #msgrtr.apinode.metrics.dmaap -metrics.send.cambria.sendEverySeconds=60 +#metrics.send.cambria.sendEverySeconds=60 cambria.consumer.cache.zkBasePath=/fe3c/cambria/consumerCache +consumer.timeout=17 ############################################################################## #100mb @@ -139,18 +147,23 @@ maxcontentlength=10000 ############################################################################## #AAF Properties -msgRtr.namespace.aaf=com.att.dmaap.mr.topic -msgRtr.topicfactory.aaf=org.openecomp.dmaapBC.topicFactory|:org.openecomp.dmaapBC.topic: -enforced.topic.name.AAF=com.att +msgRtr.namespace.aaf=org.onap.dmaap.mr.topic +msgRtr.topicfactory.aaf=org.onap.dmaap.mr.topicFactory|:org.onap.dmaap.mr.topic: +enforced.topic.name.AAF=org.onap.dmaap.mr forceAAF=false transidUEBtopicreqd=false -defaultNSforUEB=com.att.dmaap.mr.ueb +defaultNSforUEB=org.onap.dmaap.mr ############################################################################## #Mirror Maker Agent -msgRtr.mirrormakeradmin.aaf=com.att.dmaap.mr.dev.mirrormaker|*|admin -msgRtr.mirrormakeruser.aaf=com.att.dmaap.mr.dev.mirrormaker|*|user -msgRtr.mirrormakeruser.aaf.create=com.att.dmaap.mr.dev.topicFactory|:com.att.dmaap.mr.dev.topic: +msgRtr.mirrormakeradmin.aaf=org.onap.dmaap.mr.mirrormaker|*|admin +msgRtr.mirrormakeruser.aaf=org.onap.dmaap.mr.mirrormaker|*|user +msgRtr.mirrormakeruser.aaf.create=org.onap.dmaap.mr.topicFactory|:org.onap.dmaap.mr.topic: msgRtr.mirrormaker.timeout=15000 -msgRtr.mirrormaker.topic=com.att.dmaap.mr.prod.mm.agent +msgRtr.mirrormaker.topic=org.onap.dmaap.mr.mmagent msgRtr.mirrormaker.consumergroup=mmagentserver -msgRtr.mirrormaker.consumerid=1
\ No newline at end of file +msgRtr.mirrormaker.consumerid=1 + +kafka.max.poll.interval.ms=300000 +kafka.heartbeat.interval.ms=60000 +kafka.session.timeout.ms=240000 +kafka.max.poll.records=1000
\ No newline at end of file |