summaryrefslogtreecommitdiffstats
path: root/src/test/java/org/onap
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/java/org/onap')
-rw-r--r--src/test/java/org/onap/dmaap/messagerouter/msgrtr/mr/test/dmaap/ApiKeyBean.java72
-rw-r--r--src/test/java/org/onap/dmaap/messagerouter/msgrtr/mr/test/dmaap/DMaapPubSubTest.java138
-rw-r--r--src/test/java/org/onap/dmaap/messagerouter/msgrtr/mr/test/dmaap/DMaapTopicTest.java267
-rw-r--r--src/test/java/org/onap/dmaap/messagerouter/msgrtr/mr/test/dmaap/DmaapAdminTest.java60
-rw-r--r--src/test/java/org/onap/dmaap/messagerouter/msgrtr/mr/test/dmaap/DmaapApiKeyTest.java162
-rw-r--r--src/test/java/org/onap/dmaap/messagerouter/msgrtr/mr/test/dmaap/DmaapMetricsTest.java77
-rw-r--r--src/test/java/org/onap/dmaap/messagerouter/msgrtr/mr/test/dmaap/JUnitTestSuite.java44
-rw-r--r--src/test/java/org/onap/dmaap/messagerouter/msgrtr/mr/test/dmaap/LoadPropertyFile.java48
-rw-r--r--src/test/java/org/onap/dmaap/messagerouter/msgrtr/mr/test/dmaap/TestRunner.java42
-rw-r--r--src/test/java/org/onap/dmaap/messagerouter/msgrtr/mr/test/dmaap/TopicBean.java72
-rw-r--r--src/test/java/org/onap/dmaap/messagerouter/msgrtr/mr/test/dme2/ApiKeyBean.java72
-rw-r--r--src/test/java/org/onap/dmaap/messagerouter/msgrtr/mr/test/dme2/DME2AdminTest.java148
-rw-r--r--src/test/java/org/onap/dmaap/messagerouter/msgrtr/mr/test/dme2/DME2ApiKeyTest.java229
-rw-r--r--src/test/java/org/onap/dmaap/messagerouter/msgrtr/mr/test/dme2/DME2ConsumerFilterTest.java97
-rw-r--r--src/test/java/org/onap/dmaap/messagerouter/msgrtr/mr/test/dme2/DME2ConsumerTest.java95
-rw-r--r--src/test/java/org/onap/dmaap/messagerouter/msgrtr/mr/test/dme2/DME2MetricsTest.java133
-rw-r--r--src/test/java/org/onap/dmaap/messagerouter/msgrtr/mr/test/dme2/DME2ProducerTest.java101
-rw-r--r--src/test/java/org/onap/dmaap/messagerouter/msgrtr/mr/test/dme2/DME2TopicTest.java546
-rw-r--r--src/test/java/org/onap/dmaap/messagerouter/msgrtr/mr/test/dme2/JUnitTestSuite.java44
-rw-r--r--src/test/java/org/onap/dmaap/messagerouter/msgrtr/mr/test/dme2/LoadPropertyFile.java69
-rw-r--r--src/test/java/org/onap/dmaap/messagerouter/msgrtr/mr/test/dme2/TestRunner.java42
-rw-r--r--src/test/java/org/onap/dmaap/messagerouter/msgrtr/mr/test/dme2/TopicBeanDME2.java94
-rw-r--r--src/test/java/org/onap/dmaap/messagerouter/msgrtr/nsa/cambria/CambriaApiTestCase.java52
-rw-r--r--src/test/java/org/onap/dmaap/messagerouter/msgrtr/nsa/cambria/CambriaRateLimiterTest.java78
-rw-r--r--src/test/java/org/onap/dmaap/messagerouter/msgrtr/nsa/cambria/utils/UtilsTest.java58
25 files changed, 0 insertions, 2840 deletions
diff --git a/src/test/java/org/onap/dmaap/messagerouter/msgrtr/mr/test/dmaap/ApiKeyBean.java b/src/test/java/org/onap/dmaap/messagerouter/msgrtr/mr/test/dmaap/ApiKeyBean.java
deleted file mode 100644
index dd458eb..0000000
--- a/src/test/java/org/onap/dmaap/messagerouter/msgrtr/mr/test/dmaap/ApiKeyBean.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*******************************************************************************
- * ============LICENSE_START=======================================================
- * org.onap.dmaap
- * ================================================================================
- * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- *
- * ECOMP is a trademark and service mark of AT&T Intellectual Property.
- *
- *******************************************************************************/
-package org.onap.dmaap.messagerouter.msgrtr.mr.test.dmaap;
-
-import java.io.Serializable;
-
-public class ApiKeyBean implements Serializable {
-
- /*private static final long serialVersionUID = -8219849086890567740L;
-
- // private static final String KEY_CHARS =
- // "ABCDEFGHJIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
-
-
- private String email;
- private String description;
-
- public ApiKeyBean() {
- super();
- }
-
- public ApiKeyBean(String email, String description) {
- super();
- this.email = email;
- this.description = description;
- }
-
- public String getEmail() {
- return email;
- }
-
- public void setEmail(String email) {
- this.email = email;
- }
-
- public String getDescription() {
- return description;
- }
-
- public void setDescription(String description) {
- this.description = description;
- }
-
- /*
- * public String getKey() { return generateKey(16); }
- *
- * public String getSharedSecret() { return generateKey(24); }
- *
- * private static String generateKey ( int length ) { return
- * uniqueStringGenerator.createKeyUsingAlphabet ( KEY_CHARS, length ); }
- */
-
-}
diff --git a/src/test/java/org/onap/dmaap/messagerouter/msgrtr/mr/test/dmaap/DMaapPubSubTest.java b/src/test/java/org/onap/dmaap/messagerouter/msgrtr/mr/test/dmaap/DMaapPubSubTest.java
deleted file mode 100644
index 066bf50..0000000
--- a/src/test/java/org/onap/dmaap/messagerouter/msgrtr/mr/test/dmaap/DMaapPubSubTest.java
+++ /dev/null
@@ -1,138 +0,0 @@
-/*******************************************************************************
- * ============LICENSE_START=======================================================
- * org.onap.dmaap
- * ================================================================================
- * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- *
- * ECOMP is a trademark and service mark of AT&T Intellectual Property.
- *
- *******************************************************************************/
-package org.onap.dmaap.messagerouter.msgrtr.mr.test.dmaap;
-
-import java.io.InputStream;
-import java.util.Scanner;
-
-import javax.ws.rs.client.Client;
-import javax.ws.rs.client.ClientBuilder;
-import javax.ws.rs.client.Entity;
-import javax.ws.rs.client.WebTarget;
-import javax.ws.rs.core.Response;
-
-import junit.framework.TestCase;
-
-import org.json.JSONObject;
-import org.apache.http.HttpStatus;
-import org.apache.log4j.Logger;
-
-import com.att.nsa.drumlin.till.data.sha1HmacSigner;
-
-public class DMaapPubSubTest {
-/* private static final Logger LOGGER = Logger.getLogger(DMaapTopicTest.class);
- Client client = ClientBuilder.newClient();
- String url = LoadPropertyFile.getPropertyFileData().getProperty("url");
- WebTarget target = client.target(url);
- String topicapikey;
- String topicsecretKey;
- String serverCalculatedSignature;
- String date = LoadPropertyFile.getPropertyFileData().getProperty("date");
- // changes by islam
- String topic_name = LoadPropertyFile.getPropertyFileData().getProperty("topicName");
- DmaapApiKeyTest keyInstance = new DmaapApiKeyTest();
-
-
- public void testProduceMessage() {
- LOGGER.info("test case publish message");
- // DMaapTopicTest topicCreation = new DMaapTopicTest();
- DmaapApiKeyTest keyInstance = new DmaapApiKeyTest();
- // creating topic
- createTopic(topic_name);
-
- target = client.target(url);
- target = target.path("/events/");
- target = target.path(topic_name);
- Response response2 = target.request().header("X-CambriaAuth", topicapikey + ":" + serverCalculatedSignature)
- .header("X-CambriaDate", date).post(Entity.json("{message:producing first message}"));
- keyInstance.assertStatus(response2);
- LOGGER.info("successfully published message");
- }
-
- public void testConsumeMessage() {
- LOGGER.info("test case subscribing message");
- createTopic(topic_name);
- target = client.target(url);
- target = target.path("/events/");
- target = target.path(topic_name);
- target = target.path("consumGrp");
- target = target.path(topicapikey);
- Response response = target.request().get();
- keyInstance.assertStatus(response);
- LOGGER.info("successfully consumed messages");
- InputStream is = (InputStream) response.getEntity();
- Scanner s = new Scanner(is);
- s.useDelimiter("\\A");
- String data = s.next();
- s.close();
- LOGGER.info("Consumed Message data: " + data);
- }
-
- 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("ai039a@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);
- InputStream is, issecret;
- Response response = target.request().get();
- if (response.getStatus() == HttpStatus.SC_OK) {
- is = (InputStream) response.getEntity();
- Scanner s = new Scanner(is);
- s.useDelimiter("\\A");
- JSONObject dataObj = new JSONObject(s.next());
- s.close();
- // get owner of a topic
- topicapikey = (String) dataObj.get("owner");
- target = client.target(url);
- target = target.path("/apiKeys/");
- target = target.path(topicapikey);
- Response response2 = target.request().get();
- issecret = (InputStream) response2.getEntity();
- Scanner st = new Scanner(issecret);
- st.useDelimiter("\\A");
- JSONObject dataObj1 = new JSONObject(st.next());
- st.close();
- // get secret key of this topic//
- topicsecretKey = (String) dataObj1.get("secret");
- serverCalculatedSignature = sha1HmacSigner.sign(date, topicsecretKey);
- return true;
- } else
- return false;
- }*/
-}
diff --git a/src/test/java/org/onap/dmaap/messagerouter/msgrtr/mr/test/dmaap/DMaapTopicTest.java b/src/test/java/org/onap/dmaap/messagerouter/msgrtr/mr/test/dmaap/DMaapTopicTest.java
deleted file mode 100644
index 780ce1a..0000000
--- a/src/test/java/org/onap/dmaap/messagerouter/msgrtr/mr/test/dmaap/DMaapTopicTest.java
+++ /dev/null
@@ -1,267 +0,0 @@
-/*******************************************************************************
- * ============LICENSE_START=======================================================
- * org.onap.dmaap
- * ================================================================================
- * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- *
- * ECOMP is a trademark and service mark of AT&T Intellectual Property.
- *
- *******************************************************************************/
-package org.onap.dmaap.messagerouter.msgrtr.mr.test.dmaap;
-
-import java.io.InputStream;
-import java.util.Properties;
-import java.util.Scanner;
-
-import javax.ws.rs.client.Client;
-import javax.ws.rs.client.ClientBuilder;
-import javax.ws.rs.client.Entity;
-import javax.ws.rs.client.WebTarget;
-import javax.ws.rs.core.Response;
-
-import junit.framework.TestCase;
-
-import org.apache.http.HttpStatus;
-import org.json.JSONObject;
-import org.apache.log4j.Logger;
-
-import com.att.nsa.drumlin.till.data.sha1HmacSigner;
-
-public class DMaapTopicTest {
- /*private static final Logger LOGGER = Logger.getLogger(DMaapTopicTest.class);
- Client client = ClientBuilder.newClient();
- String topicapikey, topicsecretKey, serverCalculatedSignature;
- Properties prop = LoadPropertyFile.getPropertyFileData();
- String topicName = prop.getProperty("topicName");
- String url = prop.getProperty("url");
- String date = prop.getProperty("date");
- WebTarget target = client.target(url);
- 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);
- InputStream is, issecret;
- Response response = target.request().get();
- if (response.getStatus() == HttpStatus.SC_OK) {
- is = (InputStream) response.getEntity();
- Scanner s = new Scanner(is);
- s.useDelimiter("\\A");
- JSONObject dataObj = new JSONObject(s.next());
- s.close();
- // get owner of a topic
- topicapikey = (String) dataObj.get("owner");
- target = client.target(url);
- target = target.path("/apiKeys/");
- target = target.path(topicapikey);
- Response response2 = target.request().get();
- issecret = (InputStream) response2.getEntity();
- Scanner st = new Scanner(issecret);
- st.useDelimiter("\\A");
- JSONObject dataObj1 = new JSONObject(st.next());
- st.close();
- // get secret key of this topic//
- topicsecretKey = (String) dataObj1.get("secret");
- serverCalculatedSignature = sha1HmacSigner.sign(date, topicsecretKey);
- return true;
- } else
- return false;
- }
-
- public void testCreateTopic() {
- LOGGER.info("test case create topic");
- createTopic(topicName);
- LOGGER.info("Returning after create topic");
- }
-
- public void testOneTopic() {
- LOGGER.info("test case get specific topic name " + topicName);
- createTopic(topicName);
- target = client.target(url);
- target = target.path("/topics/");
- target = target.path(topicName);
- Response response = target.request().get();
- LOGGER.info("Successfully returned after fetching topic" + topicName);
- keyInstance.assertStatus(response);
- InputStream is = (InputStream) response.getEntity();
- Scanner s = new Scanner(is);
- s.useDelimiter("\\A");
- JSONObject dataObj = new JSONObject(s.next());
- LOGGER.info("Details of " + topicName + " : " + dataObj.toString());
- s.close();
- }
-
- public void testdeleteTopic() {
- LOGGER.info("test case delete topic name " + topicName);
- createTopic(topicName);
- target = client.target(url);
- target = target.path("/topics/");
- target = target.path(topicName);
- Response response = target.request().header("X-CambriaAuth", topicapikey + ":" + serverCalculatedSignature)
- .header("X-CambriaDate", date).delete();
- keyInstance.assertStatus(response);
- LOGGER.info("Successfully returned after deleting topic" + topicName);
- }
-
- public void testAllTopic() {
- LOGGER.info("test case fetch all topic");
- target = client.target(url);
- target = target.path("/topics");
- Response response = target.request().get();
- keyInstance.assertStatus(response);
- LOGGER.info("successfully returned after fetching all the topic");
- InputStream is = (InputStream) response.getEntity();
- Scanner s = new Scanner(is);
- s.useDelimiter("\\A");
- JSONObject dataObj = new JSONObject(s.next());
- s.close();
- LOGGER.info("List of all topics " + dataObj.toString());
- }
-
- public void testPublisherForTopic() {
- LOGGER.info("test case get all publishers for topic: " + topicName);
- // creating topic to check
- createTopic(topicName);
- target = client.target(url);
- target = target.path("/topics/");
- target = target.path(topicName);
- target = target.path("/producers");
- // checking all producer for a particular topic
- Response response = target.request().get();
- keyInstance.assertStatus(response);
- 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);
- // creating topic to check
- createTopic(topicName);
- target = client.target(url);
- target = target.path("/topics/");
- target = target.path(topicName);
- target = target.path("/consumers");
- // checking all consumer for a particular topic
- Response response = target.request().get();
- keyInstance.assertStatus(response);
- 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/messagerouter/msgrtr/mr/test/dmaap/DmaapAdminTest.java b/src/test/java/org/onap/dmaap/messagerouter/msgrtr/mr/test/dmaap/DmaapAdminTest.java
deleted file mode 100644
index 19e78a9..0000000
--- a/src/test/java/org/onap/dmaap/messagerouter/msgrtr/mr/test/dmaap/DmaapAdminTest.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*******************************************************************************
- * ============LICENSE_START=======================================================
- * org.onap.dmaap
- * ================================================================================
- * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- *
- * ECOMP is a trademark and service mark of AT&T Intellectual Property.
- *
- *******************************************************************************/
-package org.onap.dmaap.messagerouter.msgrtr.mr.test.dmaap;
-
-
-
-public class DmaapAdminTest {
- /*private static final Logger LOGGER = Logger.getLogger(DmaapAdminTest.class);
- Client client = ClientBuilder.newClient();
- WebTarget target = client.target(LoadPropertyFile.getPropertyFileData().getProperty("url"));
-
-
- public void assertStatus(Response response) {
- assertTrue(response.getStatus() == HttpStatus.SC_OK);
- }
-
- // 1.get consumer cache
- public void testConsumerCache() {
- LOGGER.info("test case consumer cache");
- target = target.path("/admin/consumerCache");
- Response response = target.request().get();
- assertStatus(response);
- LOGGER.info("Successfully returned after fetching consumer cache");
- InputStream is = (InputStream) response.getEntity();
- Scanner s = new Scanner(is);
- s.useDelimiter("\\A");
- String data = s.next();
- s.close();
- LOGGER.info("Details of consumer cache :" + data);
- }
-
- // 2.drop consumer cache
- public void testDropConsumerCache() {
- LOGGER.info("test case drop consumer cache");
- target = target.path("/admin/dropConsumerCache");
- Response response = target.request().post(Entity.json(null));
- assertStatus(response);
- LOGGER.info("Successfully returned after dropping consumer cache");
- }
-*/
-}
diff --git a/src/test/java/org/onap/dmaap/messagerouter/msgrtr/mr/test/dmaap/DmaapApiKeyTest.java b/src/test/java/org/onap/dmaap/messagerouter/msgrtr/mr/test/dmaap/DmaapApiKeyTest.java
deleted file mode 100644
index e2ed0d4..0000000
--- a/src/test/java/org/onap/dmaap/messagerouter/msgrtr/mr/test/dmaap/DmaapApiKeyTest.java
+++ /dev/null
@@ -1,162 +0,0 @@
-/*******************************************************************************
- * ============LICENSE_START=======================================================
- * org.onap.dmaap
- * ================================================================================
- * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- *
- * ECOMP is a trademark and service mark of AT&T Intellectual Property.
- *
- *******************************************************************************/
-package org.onap.dmaap.messagerouter.msgrtr.mr.test.dmaap;
-
-import java.io.InputStream;
-import java.util.Properties;
-import java.util.Scanner;
-
-import javax.ws.rs.client.Client;
-import javax.ws.rs.client.ClientBuilder;
-import javax.ws.rs.client.Entity;
-import javax.ws.rs.client.WebTarget;
-import javax.ws.rs.core.Response;
-
-import junit.framework.TestCase;
-
-import org.apache.log4j.Logger;
-import org.apache.http.HttpStatus;
-import org.json.JSONObject;
-
-import com.att.nsa.drumlin.till.data.sha1HmacSigner;
-
-public class DmaapApiKeyTest {
- /*
- private static final Logger LOGGER = Logger.getLogger(DmaapApiKeyTest.class);
- Client client = ClientBuilder.newClient();
- Properties prop = LoadPropertyFile.getPropertyFileData();
- String url = prop.getProperty("url");
- WebTarget target = client.target(url);
- String date = prop.getProperty("date");
-
-
- public JSONObject returnKey(ApiKeyBean apikeybean) {
- LOGGER.info("Call to return newly created key");
- target = client.target(url);
- target = target.path("/apiKeys/create");
- Response response = target.request().post(Entity.json(apikeybean));
- assertStatus(response);
- LOGGER.info("successfully created keys");
- InputStream is = (InputStream) response.getEntity();
- Scanner s = new Scanner(is);
- s.useDelimiter("\\A");
- JSONObject dataObj = new JSONObject(s.next());
- s.close();
- LOGGER.info("key details :" + dataObj.toString());
- 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);
- }
-
- // 2. get Allkey details
- public void testAllKey() {
- LOGGER.info("test case get all key");
- target = target.path("/apiKeys");
- Response response = target.request().get();
- assertStatus(response);
- LOGGER.info("successfully returned after get all key");
- InputStream is = (InputStream) response.getEntity();
- Scanner s = new Scanner(is);
- s.useDelimiter("\\A");
- LOGGER.info("Details of key: " + s.next());
- s.close();
-
- }
-
- // 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/messagerouter/msgrtr/mr/test/dmaap/DmaapMetricsTest.java b/src/test/java/org/onap/dmaap/messagerouter/msgrtr/mr/test/dmaap/DmaapMetricsTest.java
deleted file mode 100644
index 658e274..0000000
--- a/src/test/java/org/onap/dmaap/messagerouter/msgrtr/mr/test/dmaap/DmaapMetricsTest.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/*******************************************************************************
- * ============LICENSE_START=======================================================
- * org.onap.dmaap
- * ================================================================================
- * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- *
- * ECOMP is a trademark and service mark of AT&T Intellectual Property.
- *
- *******************************************************************************/
-package org.onap.dmaap.messagerouter.msgrtr.mr.test.dmaap;
-
-import java.io.InputStream;
-import java.util.Scanner;
-
-import javax.ws.rs.client.Client;
-import javax.ws.rs.client.ClientBuilder;
-import javax.ws.rs.client.WebTarget;
-import javax.ws.rs.core.Response;
-
-import junit.framework.TestCase;
-
-import org.apache.log4j.Logger;
-import org.apache.http.HttpStatus;
-
-public class DmaapMetricsTest {
- /*private static final Logger LOGGER = Logger.getLogger(DmaapMetricsTest.class);
- Client client = ClientBuilder.newClient();
- WebTarget target = client.target(LoadPropertyFile.getPropertyFileData().getProperty("url"));
-
- public void assertStatus(Response response) {
- assertTrue(response.getStatus() == HttpStatus.SC_OK);
- }
-
-
- // 1.get metrics
- public void testMetrics() {
- LOGGER.info("test case get all metrics");
- target = target.path("/metrics");
- Response response = target.request().get();
- assertStatus(response);
- LOGGER.info("successfully returned after fetching all metrics");
- InputStream is = (InputStream) response.getEntity();
- Scanner s = new Scanner(is);
- s.useDelimiter("\\A");
- String data = s.next();
- s.close();
- LOGGER.info("DmaapMetricTest Test all metrics" + data);
- }
-
- // 2.get metrics by name
- public void testMetricsByName() {
- LOGGER.info("test case get metrics by name");
- target = target.path("/metrics/startTime");
- Response response = target.request().get();
- assertStatus(response);
- LOGGER.info("successfully returned after fetching specific metrics");
- InputStream is = (InputStream) response.getEntity();
- Scanner s = new Scanner(is);
- s.useDelimiter("\\A");
- String data = s.next();
- s.close();
- LOGGER.info("DmaapMetricTest metrics by name" + data);
- }
-*/
-}
diff --git a/src/test/java/org/onap/dmaap/messagerouter/msgrtr/mr/test/dmaap/JUnitTestSuite.java b/src/test/java/org/onap/dmaap/messagerouter/msgrtr/mr/test/dmaap/JUnitTestSuite.java
deleted file mode 100644
index 4b2d52a..0000000
--- a/src/test/java/org/onap/dmaap/messagerouter/msgrtr/mr/test/dmaap/JUnitTestSuite.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*******************************************************************************
- * ============LICENSE_START=======================================================
- * org.onap.dmaap
- * ================================================================================
- * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- *
- * ECOMP is a trademark and service mark of AT&T Intellectual Property.
- *
- *******************************************************************************/
-package org.onap.dmaap.messagerouter.msgrtr.mr.test.dmaap;
-
-import junit.framework.TestSuite;
-
-import org.junit.runner.RunWith;
-import org.junit.runners.Suite;
-import org.junit.runners.Suite.SuiteClasses;
-import org.apache.log4j.Logger;
-
-@RunWith(Suite.class)
-@SuiteClasses({ DMaapPubSubTest.class, DmaapApiKeyTest.class, DMaapTopicTest.class, DmaapMetricsTest.class,
- DmaapAdminTest.class })
-public class JUnitTestSuite {
- /*private static final Logger LOGGER = Logger.getLogger(DMaapTopicTest.class);
-
-
- public static void main(String[] args) {
- LOGGER.info("Running the test suite");
- TestSuite tstSuite = new TestSuite();
- LOGGER.info("Total Test Counts " + tstSuite.countTestCases());
- }*/
-
-}
diff --git a/src/test/java/org/onap/dmaap/messagerouter/msgrtr/mr/test/dmaap/LoadPropertyFile.java b/src/test/java/org/onap/dmaap/messagerouter/msgrtr/mr/test/dmaap/LoadPropertyFile.java
deleted file mode 100644
index 8c4afa2..0000000
--- a/src/test/java/org/onap/dmaap/messagerouter/msgrtr/mr/test/dmaap/LoadPropertyFile.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*******************************************************************************
- * ============LICENSE_START=======================================================
- * org.onap.dmaap
- * ================================================================================
- * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- *
- * ECOMP is a trademark and service mark of AT&T Intellectual Property.
- *
- *******************************************************************************/
-package org.onap.dmaap.messagerouter.msgrtr.mr.test.dmaap;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.Properties;
-
-import org.apache.log4j.Logger;
-
-public class LoadPropertyFile {
- /*private static final Logger LOGGER = Logger
- .getLogger(LoadPropertyFile.class);
-
- static public Properties getPropertyFileData() {
- Properties prop = new Properties();
- LOGGER.info("loading the property file");
-
- try {
- InputStream inputStream = LoadPropertyFile.class.getClassLoader()
- .getResourceAsStream("DMaaPUrl.properties");
- prop.load(inputStream);
- LOGGER.info("successfully loaded the property file");
- } catch (IOException e) {
- LOGGER.error("Error while retrieving API keys: " + e);
- }
- return prop;
- }*/
-}
diff --git a/src/test/java/org/onap/dmaap/messagerouter/msgrtr/mr/test/dmaap/TestRunner.java b/src/test/java/org/onap/dmaap/messagerouter/msgrtr/mr/test/dmaap/TestRunner.java
deleted file mode 100644
index bffb32e..0000000
--- a/src/test/java/org/onap/dmaap/messagerouter/msgrtr/mr/test/dmaap/TestRunner.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*******************************************************************************
- * ============LICENSE_START=======================================================
- * org.onap.dmaap
- * ================================================================================
- * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- *
- * ECOMP is a trademark and service mark of AT&T Intellectual Property.
- *
- *******************************************************************************/
-package org.onap.dmaap.messagerouter.msgrtr.mr.test.dmaap;
-
-import org.junit.runner.JUnitCore;
-import org.junit.runner.Result;
-import org.junit.runner.notification.Failure;
-import org.apache.log4j.Logger;
-
-public class TestRunner {
- /*private static final Logger LOGGER = Logger.getLogger(TestRunner.class);
-
-
- public static void main(String[] args) {
- // TODO Auto-generated method stub
- Result result = JUnitCore.runClasses(JUnitTestSuite.class);
- for (Failure failure : result.getFailures()) {
- LOGGER.info(failure.toString());
- }
- LOGGER.info(result.wasSuccessful());
- }
-*/
-}
diff --git a/src/test/java/org/onap/dmaap/messagerouter/msgrtr/mr/test/dmaap/TopicBean.java b/src/test/java/org/onap/dmaap/messagerouter/msgrtr/mr/test/dmaap/TopicBean.java
deleted file mode 100644
index 9c0ddbb..0000000
--- a/src/test/java/org/onap/dmaap/messagerouter/msgrtr/mr/test/dmaap/TopicBean.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*******************************************************************************
- * ============LICENSE_START=======================================================
- * org.onap.dmaap
- * ================================================================================
- * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- *
- * ECOMP is a trademark and service mark of AT&T Intellectual Property.
- *
- *******************************************************************************/
-/**
- *
- */
-package org.onap.dmaap.messagerouter.msgrtr.mr.test.dmaap;
-
-import java.io.Serializable;
-
-public class TopicBean implements Serializable {
-
- /*
- * private static final long serialVersionUID = -8620390377775457949L;
- * private String topicName; private String description;
- *
- *
- * private int partitionCount; private int replicationCount; private boolean
- * transactionEnabled = false;
- *
- * public boolean isTransactionEnabled() { return transactionEnabled; }
- *
- * public void setTransactionEnabled(boolean transactionEnabled) {
- * this.transactionEnabled = transactionEnabled; }
- *
- * public TopicBean() { super(); }
- *
- * public TopicBean(String topicName, String description, int
- * partitionCount, int replicationCount, boolean transactionEnabled) {
- * super(); this.topicName = topicName; this.description = description;
- * this.partitionCount = partitionCount; this.replicationCount =
- * replicationCount; this.transactionEnabled = transactionEnabled; }
- *
- * public String getTopicName() { return topicName; }
- *
- * public void setTopicName(String topicName) { this.topicName = topicName;
- * }
- *
- * public String getDescription() { return description; }
- *
- * public void setDescription(String description) { this.description =
- * description; }
- *
- * public int getPartitionCount() { return partitionCount; }
- *
- * public void setPartitionCount(int partitionCount) { this.partitionCount =
- * partitionCount; }
- *
- * public int getReplicationCount() { return replicationCount; }
- *
- * public void setReplicationCount(int replicationCount) {
- * this.replicationCount = replicationCount; }
- */
-}
diff --git a/src/test/java/org/onap/dmaap/messagerouter/msgrtr/mr/test/dme2/ApiKeyBean.java b/src/test/java/org/onap/dmaap/messagerouter/msgrtr/mr/test/dme2/ApiKeyBean.java
deleted file mode 100644
index 03e34ad..0000000
--- a/src/test/java/org/onap/dmaap/messagerouter/msgrtr/mr/test/dme2/ApiKeyBean.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*******************************************************************************
- * ============LICENSE_START=======================================================
- * org.onap.dmaap
- * ================================================================================
- * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- *
- * ECOMP is a trademark and service mark of AT&T Intellectual Property.
- *
- *******************************************************************************/
-package org.onap.dmaap.messagerouter.msgrtr.mr.test.dme2;
-
-import java.io.Serializable;
-
-public class ApiKeyBean implements Serializable {
-
- private static final long serialVersionUID = -8219849086890567740L;
-
- // private static final String KEY_CHARS =
- // "ABCDEFGHJIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
-
-
- private String email;
- private String description;
-
- public ApiKeyBean() {
- super();
- }
-
- public ApiKeyBean(String email, String description) {
- super();
- this.email = email;
- this.description = description;
- }
-
- public String getEmail() {
- return email;
- }
-
- public void setEmail(String email) {
- this.email = email;
- }
-
- public String getDescription() {
- return description;
- }
-
- public void setDescription(String description) {
- this.description = description;
- }
-
- /*
- * public String getKey() { return generateKey(16); }
- *
- * public String getSharedSecret() { return generateKey(24); }
- *
- * private static String generateKey ( int length ) { return
- * uniqueStringGenerator.createKeyUsingAlphabet ( KEY_CHARS, length ); }
- */
-
-}
diff --git a/src/test/java/org/onap/dmaap/messagerouter/msgrtr/mr/test/dme2/DME2AdminTest.java b/src/test/java/org/onap/dmaap/messagerouter/msgrtr/mr/test/dme2/DME2AdminTest.java
deleted file mode 100644
index ce7f80b..0000000
--- a/src/test/java/org/onap/dmaap/messagerouter/msgrtr/mr/test/dme2/DME2AdminTest.java
+++ /dev/null
@@ -1,148 +0,0 @@
-/*******************************************************************************
- * ============LICENSE_START=======================================================
- * org.onap.dmaap
- * ================================================================================
- * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- *
- * ECOMP is a trademark and service mark of AT&T Intellectual Property.
- *
- *******************************************************************************/
-package org.onap.dmaap.messagerouter.msgrtr.mr.test.dme2;
-
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.util.HashMap;
-import java.util.Properties;
-
-import org.apache.log4j.Logger;
-import org.onap.dmaap.messagerouter.msgrtr.mr.test.dmaap.DmaapAdminTest;
-
-import junit.framework.TestCase;
-
-import com.att.aft.dme2.api.DME2Client;
-import com.att.aft.dme2.api.DME2Exception;
-
-public class DME2AdminTest extends TestCase {
- private static final Logger LOGGER = Logger.getLogger(DME2AdminTest.class);
-
- protected String url;
-
- protected Properties props;
-
- protected HashMap<String, String> hm;
-
- protected String methodType;
-
- protected String contentType;
-
- protected String user;
-
- protected String password;
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- System.setProperty("AFT_DME2_CLIENT_SSL_INCLUDE_PROTOCOLS", "SSLv3,TLSv1,TLSv1.1");
- System.setProperty("AFT_DME2_CLIENT_IGNORE_SSL_CONFIG", "false");
- System.setProperty("AFT_DME2_CLIENT_KEYSTORE_PASSWORD", "changeit");
- this.props = LoadPropertyFile.getPropertyFileDataProducer();
- String latitude = props.getProperty("Latitude");
- 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";
- String env = props.getProperty("Environment");
- String partner = props.getProperty("Partner");
- String protocol = props.getProperty("Protocol");
-
- methodType = props.getProperty("MethodTypeGet");
- contentType = props.getProperty("contenttype");
- user = props.getProperty("user");
- password = props.getProperty("password");
-
-
- this.url = protocol + "://" + serviceName + "?" + "version=" + version + "&" + "envContext=" + env + "&"
- + "routeOffer=" + partner + "&partner=BOT_R";
- LoadPropertyFile.loadAFTProperties(latitude, longitude);
- hm = new HashMap<String, String>();
- hm.put("AFT_DME2_EP_READ_TIMEOUT_MS", "50000");
- hm.put("AFT_DME2_ROUNDTRIP_TIMEOUT_MS", "240000");
- hm.put("AFT_DME2_EP_CONN_TIMEOUT", "5000");
- }
-
- public void testGetConsumerCache() {
- LOGGER.info("test case consumer cache started");
-
- String subContextPath = props.getProperty("SubContextPathGetAdminConsumerCache");
- try {
- DME2Client sender = new DME2Client(new URI(url), 5000L);
- sender.setAllowAllHttpReturnCodes(true);
- sender.setMethod(methodType);
- sender.setSubContext(subContextPath);
- sender.setPayload("");
- sender.addHeader("Content-Type", contentType);
-
- sender.addHeader("X-CambriaAuth", "user1:7J49YriFlyRgebyOsSJhZvY/C60=");
- sender.addHeader("X-X-CambriaDate", "2016-10-18T09:56:04-05:00");
-
- //sender.setCredentials(user, password);
- sender.setHeaders(hm);
- LOGGER.info("Getting consumer Cache");
- String reply = sender.sendAndWait(5000L);
- System.out.println(reply);
- assertTrue(LoadPropertyFile.isValidJsonString(reply));
- assertNotNull(reply);
- LOGGER.info("response from consumer cache=" + reply);
-
- } catch (DME2Exception e) {
- e.printStackTrace();
- } catch (URISyntaxException e) {
- e.printStackTrace();
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-
- public void ttestDropConsumerCache() {
- LOGGER.info("Drom consumer cache initiated");
-
- String subContextPath = props.getProperty("SubContextPathDropAdminConsumerCache");
-
- try {
- DME2Client sender = new DME2Client(new URI(url), 5000L);
- sender.setAllowAllHttpReturnCodes(true);
- sender.setMethod(methodType);
- sender.setSubContext(subContextPath);
- sender.setPayload("");
- sender.addHeader("Content-Type", contentType);
- sender.setCredentials(user, password);
- sender.setHeaders(hm);
-
- LOGGER.info("Dropping consumer cache...........");
- String reply = sender.sendAndWait(5000L);
-
- // assertTrue(LoadPropertyFile.isValidJsonString(reply));
- assertNotNull(reply);
- LOGGER.info("response =" + reply);
- } catch (DME2Exception e) {
- e.printStackTrace();
- } catch (URISyntaxException e) {
- e.printStackTrace();
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-
-}
diff --git a/src/test/java/org/onap/dmaap/messagerouter/msgrtr/mr/test/dme2/DME2ApiKeyTest.java b/src/test/java/org/onap/dmaap/messagerouter/msgrtr/mr/test/dme2/DME2ApiKeyTest.java
deleted file mode 100644
index 9088eb9..0000000
--- a/src/test/java/org/onap/dmaap/messagerouter/msgrtr/mr/test/dme2/DME2ApiKeyTest.java
+++ /dev/null
@@ -1,229 +0,0 @@
-/*******************************************************************************
- * ============LICENSE_START=======================================================
- * org.onap.dmaap
- * ================================================================================
- * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- *
- * ECOMP is a trademark and service mark of AT&T Intellectual Property.
- *
- *******************************************************************************/
-package org.onap.dmaap.messagerouter.msgrtr.mr.test.dme2;
-
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.util.Properties;
-
-import org.apache.log4j.Logger;
-import org.json.JSONObject;
-
-import com.att.aft.dme2.api.DME2Client;
-import com.att.aft.dme2.api.DME2Exception;
-import com.att.aft.dme2.internal.jackson.map.ObjectMapper;
-
-import junit.framework.TestCase;
-
-public class DME2ApiKeyTest extends TestCase {
- private static final Logger LOGGER = Logger.getLogger(DME2ApiKeyTest.class);
-
- protected String url;
-
- protected Properties props;
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- System.setProperty("AFT_DME2_CLIENT_SSL_INCLUDE_PROTOCOLS", "SSLv3,TLSv1,TLSv1.1");
- System.setProperty("AFT_DME2_CLIENT_IGNORE_SSL_CONFIG", "false");
- System.setProperty("AFT_DME2_CLIENT_KEYSTORE_PASSWORD", "changeit");
- this.props = LoadPropertyFile.getPropertyFileDataProducer();
- String latitude = props.getProperty("Latitude");
- String longitude = props.getProperty("Longitude");
- String version = props.getProperty("Version");
- String serviceName = props.getProperty("ServiceName");
- String env = props.getProperty("Environment");
- String partner = props.getProperty("Partner");
- String protocol = props.getProperty("Protocol");
- this.url = protocol + "://" + serviceName + "?" + "version=" + version + "&" + "envContext=" + env + "&"
- + "routeOffer=" + partner + "&partner=BOT_R";
- LoadPropertyFile.loadAFTProperties(latitude, longitude);
- }
-
- public void testCreateKey() {
- LOGGER.info("Create Key test case initiated");
-
- ApiKeyBean apiKeyBean = new ApiKeyBean("user1@us.att.com", "Creating Api Key.m");
-
- System.out.println(url);
-
- returnKey(apiKeyBean, url, props);
-
- }
-
- public String returnKey(ApiKeyBean apibean, String url, Properties props) {
-
- String reply = null;
- try {
- LOGGER.info("Call to return key ");
- DME2Client sender = new DME2Client(new URI(url), 5000L);
- sender.setAllowAllHttpReturnCodes(true);
- sender.setMethod(props.getProperty("MethodTypePost"));
- sender.setSubContext(props.getProperty("SubContextPathGetCreateKeys"));
- String jsonStringApiBean = new ObjectMapper().writeValueAsString(apibean);
- sender.setPayload(jsonStringApiBean);
- sender.addHeader("content-type", props.getProperty("contenttype"));
- sender.setCredentials(props.getProperty("user"), props.getProperty("password"));
- LOGGER.info("creating ApiKey");
- reply = sender.sendAndWait(5000L);
- System.out.println("reply: " + reply);
- assertTrue(LoadPropertyFile.isValidJsonString(reply));
- LOGGER.info("response =" + reply);
-
- } catch (DME2Exception e) {
- e.printStackTrace();
- } catch (URISyntaxException e) {
- e.printStackTrace();
- } catch (Exception e) {
- e.printStackTrace();
- }
- return reply;
- }
-
- public void testGetAllKey() {
- LOGGER.info("Test case Get All key initiated....");
- try {
- DME2Client sender = new DME2Client(new URI(this.url), 5000L);
- sender.setAllowAllHttpReturnCodes(true);
- sender.setMethod(this.props.getProperty("MethodTypeGet"));
- String subcontextPath = this.props.getProperty("SubContextPathGetApiKeys");
- // sender.setSubContext(subcontextPath);
- sender.setPayload("");
- sender.addHeader("content-type", props.getProperty("contenttype"));
- sender.setCredentials(props.getProperty("user"), props.getProperty("password"));
- LOGGER.info("Fetching all keys");
- 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();
- }
- }
-
- 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/java/org/onap/dmaap/messagerouter/msgrtr/mr/test/dme2/DME2ConsumerFilterTest.java b/src/test/java/org/onap/dmaap/messagerouter/msgrtr/mr/test/dme2/DME2ConsumerFilterTest.java
deleted file mode 100644
index 3a4bc75..0000000
--- a/src/test/java/org/onap/dmaap/messagerouter/msgrtr/mr/test/dme2/DME2ConsumerFilterTest.java
+++ /dev/null
@@ -1,97 +0,0 @@
-/*******************************************************************************
- * ============LICENSE_START=======================================================
- * org.onap.dmaap
- * ================================================================================
- * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- *
- * ECOMP is a trademark and service mark of AT&T Intellectual Property.
- *
- *******************************************************************************/
-package org.onap.dmaap.messagerouter.msgrtr.mr.test.dme2;
-
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.net.URLEncoder;
-import java.util.HashMap;
-import java.util.Properties;
-
-import org.apache.log4j.Logger;
-import org.onap.dmaap.messagerouter.msgrtr.mr.test.dmaap.DmaapAdminTest;
-
-import junit.framework.TestCase;
-
-import com.att.aft.dme2.api.DME2Client;
-import com.att.aft.dme2.api.DME2Exception;
-
-public class DME2ConsumerFilterTest extends TestCase {
- private static final Logger LOGGER = Logger.getLogger(DME2ConsumerFilterTest.class);
-
- public void testConsumerFilter() {
- LOGGER.info("Test case consumer filter initiated");
-
- Properties props = LoadPropertyFile.getPropertyFileDataProducer();
- String latitude = props.getProperty("Latitude");
- String longitude = props.getProperty("Longitude");
- String version = props.getProperty("Version");
- String serviceName = props.getProperty("ServiceName");
- String env = props.getProperty("Environment");
- String partner = props.getProperty("Partner");
- String protocol = props.getProperty("Protocol");
- String methodType = props.getProperty("MethodTypeGet");
- String user = props.getProperty("user");
- String password = props.getProperty("password");
- String contenttype = props.getProperty("contenttype");
-
- String url = protocol + "://DME2SEARCH/" + "service=" + serviceName + "/" + "version=" + version + "/"
- + "envContext=" + env + "/" + "partner=" + partner;
- LoadPropertyFile.loadAFTProperties(latitude, longitude);
- HashMap<String, String> hm = new HashMap<String, String>();
- hm.put("AFT_DME2_EP_READ_TIMEOUT_MS", "50000");
- hm.put("AFT_DME2_ROUNDTRIP_TIMEOUT_MS", "240000");
- hm.put("AFT_DME2_EP_CONN_TIMEOUT", "5000");
-
- try {
- // ..checking for topic exist is commented
- // if (!topicTestObj.topicExist(url, props, hm)) {
- // throw new Exception("Topic does not exist");
- // } else {
- DME2Client sender = new DME2Client(new URI(url), 5000L);
- sender.setAllowAllHttpReturnCodes(true);
- sender.setMethod(methodType);
- String subContextPathConsumer = props.getProperty("SubContextPathConsumer") + props.getProperty("newTopic")
- + "/" + props.getProperty("group") + "/" + props.getProperty("id") + "?"
- + props.getProperty("filterType");
-
- sender.setSubContext(URLEncoder.encode(subContextPathConsumer, "UTF-8"));
- sender.setPayload("");
-
- sender.addHeader("Content-Type", contenttype);
- sender.setCredentials(user, password);
- sender.setHeaders(hm);
-
- LOGGER.info("Consuming Message for Filter");
- String reply = sender.sendAndWait(5000L);
- assertNotNull(reply);
- LOGGER.info("Message received = " + reply);
- // }
- } catch (DME2Exception e) {
- e.printStackTrace();
- } catch (URISyntaxException e) {
- e.printStackTrace();
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-}
diff --git a/src/test/java/org/onap/dmaap/messagerouter/msgrtr/mr/test/dme2/DME2ConsumerTest.java b/src/test/java/org/onap/dmaap/messagerouter/msgrtr/mr/test/dme2/DME2ConsumerTest.java
deleted file mode 100644
index 5406c6a..0000000
--- a/src/test/java/org/onap/dmaap/messagerouter/msgrtr/mr/test/dme2/DME2ConsumerTest.java
+++ /dev/null
@@ -1,95 +0,0 @@
-/*******************************************************************************
- * ============LICENSE_START=======================================================
- * org.onap.dmaap
- * ================================================================================
- * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- *
- * ECOMP is a trademark and service mark of AT&T Intellectual Property.
- *
- *******************************************************************************/
-package org.onap.dmaap.messagerouter.msgrtr.mr.test.dme2;
-
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.util.HashMap;
-import java.util.Properties;
-
-import org.apache.log4j.Logger;
-import org.onap.dmaap.messagerouter.msgrtr.mr.test.dmaap.DmaapAdminTest;
-
-import junit.framework.TestCase;
-
-import com.att.aft.dme2.api.DME2Client;
-import com.att.aft.dme2.api.DME2Exception;
-
-public class DME2ConsumerTest extends TestCase {
- private static final Logger LOGGER = Logger.getLogger(DME2ConsumerTest.class);
-
- public void testConsumer() {
- LOGGER.info("Test case subcribing initiated");
-
- Properties props = LoadPropertyFile.getPropertyFileDataProducer();
- String latitude = props.getProperty("Latitude");
- String longitude = props.getProperty("Longitude");
- String version = props.getProperty("Version");
- String serviceName = props.getProperty("ServiceName");
- String env = props.getProperty("Environment");
- String partner = props.getProperty("Partner");
- String protocol = props.getProperty("Protocol");
- String methodType = props.getProperty("MethodTypeGet");
- String user = props.getProperty("user");
- String password = props.getProperty("password");
- String contenttype = props.getProperty("contenttype");
- String url = protocol + "://DME2SEARCH/" + "service=" + serviceName + "/" + "version=" + version + "/"
- + "envContext=" + env + "/" + "partner=" + partner;
- LoadPropertyFile.loadAFTProperties(latitude, longitude);
- HashMap<String, String> hm = new HashMap<String, String>();
- hm.put("AFT_DME2_EP_READ_TIMEOUT_MS", "50000");
- hm.put("AFT_DME2_ROUNDTRIP_TIMEOUT_MS", "240000");
- hm.put("AFT_DME2_EP_CONN_TIMEOUT", "5000");
- try {
-
- // topic exist logic is commented
- // if (!topicTestObj.topicExist(url, props, hm)) {
- // throw new Exception("Topic does not exist");
- // } else {
- DME2Client sender = new DME2Client(new URI(url), 5000L);
- sender.setAllowAllHttpReturnCodes(true);
- sender.setMethod(methodType);
- String subContextPathConsumer = props.getProperty("SubContextPathConsumer") + props.getProperty("newTopic")
- + "/" + props.getProperty("group") + "/" + props.getProperty("id");
- sender.setSubContext(subContextPathConsumer);
- sender.setPayload("");
-
- sender.addHeader("Content-Type", contenttype);
- sender.setCredentials(user, password);
- sender.setHeaders(hm);
-
- LOGGER.info("Consuming Message");
- String reply = sender.sendAndWait(5000L);
-
- assertNotNull(reply);
- LOGGER.info("Message received = " + reply);
- // }
- } catch (DME2Exception e) {
- e.printStackTrace();
- } catch (URISyntaxException e) {
- e.printStackTrace();
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-
-}
diff --git a/src/test/java/org/onap/dmaap/messagerouter/msgrtr/mr/test/dme2/DME2MetricsTest.java b/src/test/java/org/onap/dmaap/messagerouter/msgrtr/mr/test/dme2/DME2MetricsTest.java
deleted file mode 100644
index 6f674f4..0000000
--- a/src/test/java/org/onap/dmaap/messagerouter/msgrtr/mr/test/dme2/DME2MetricsTest.java
+++ /dev/null
@@ -1,133 +0,0 @@
-/*******************************************************************************
- * ============LICENSE_START=======================================================
- * org.onap.dmaap
- * ================================================================================
- * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- *
- * ECOMP is a trademark and service mark of AT&T Intellectual Property.
- *
- *******************************************************************************/
-package org.onap.dmaap.messagerouter.msgrtr.mr.test.dme2;
-
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.util.HashMap;
-import java.util.Properties;
-
-import org.apache.log4j.Logger;
-import org.onap.dmaap.messagerouter.msgrtr.mr.test.dmaap.DmaapAdminTest;
-
-import junit.framework.TestCase;
-
-import com.att.aft.dme2.api.DME2Client;
-import com.att.aft.dme2.api.DME2Exception;
-
-public class DME2MetricsTest extends TestCase {
- private static final Logger LOGGER = Logger.getLogger(DME2MetricsTest.class);
-
- public void testGetMetrics() {
- LOGGER.info("Test case get metrics initiated...");
-
- Properties props = LoadPropertyFile.getPropertyFileDataProducer();
- String latitude = props.getProperty("Latitude");
- String longitude = props.getProperty("Longitude");
- String version = props.getProperty("Version");
- String serviceName = props.getProperty("ServiceName");
- String env = props.getProperty("Environment");
- String partner = props.getProperty("Partner");
- String subContextPath = props.getProperty("SubContextPathGetMetrics");
- String protocol = props.getProperty("Protocol");
- String methodType = props.getProperty("MethodTypeGet");
- String user = props.getProperty("user");
- String password = props.getProperty("password");
- String contenttype = props.getProperty("contenttype");
- String url = protocol + "://DME2SEARCH/" + "service=" + serviceName + "/" + "version=" + version + "/"
- + "envContext=" + env + "/" + "partner=" + partner;
- LoadPropertyFile.loadAFTProperties(latitude, longitude);
- HashMap<String, String> hm = new HashMap<String, String>();
- hm.put("AFT_DME2_EP_READ_TIMEOUT_MS", "50000");
- hm.put("AFT_DME2_ROUNDTRIP_TIMEOUT_MS", "240000");
- hm.put("AFT_DME2_EP_CONN_TIMEOUT", "5000");
-
- try {
- DME2Client sender = new DME2Client(new URI(url), 5000L);
- sender.setAllowAllHttpReturnCodes(true);
- sender.setMethod(methodType);
- sender.setSubContext(subContextPath);
- sender.setPayload("");
- sender.addHeader("Content-Type", contenttype);
- sender.setCredentials(user, password);
- sender.setHeaders(hm);
-
- LOGGER.info("Getting Metrics Details");
- String reply = sender.sendAndWait(5000L);
- assertTrue(LoadPropertyFile.isValidJsonString(reply));
- LOGGER.info("response =" + reply);
-
- } catch (DME2Exception e) {
- e.printStackTrace();
- } catch (URISyntaxException e) {
- e.printStackTrace();
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-
- public void testGetMetricsByName() {
- LOGGER.info("Test case get metrics by name initiated");
- Properties props = LoadPropertyFile.getPropertyFileDataProducer();
- String latitude = props.getProperty("Latitude");
- String longitude = props.getProperty("Longitude");
- String version = props.getProperty("Version");
- String serviceName = props.getProperty("ServiceName");
- String env = props.getProperty("Environment");
- String partner = props.getProperty("Partner");
- String subContextPath = props.getProperty("SubContextPathGetMetricsByName");
- String protocol = props.getProperty("Protocol");
- String methodType = props.getProperty("MethodTypeGet");
- String user = props.getProperty("user");
- String password = props.getProperty("password");
- String contenttype = props.getProperty("contenttype");
- String url = protocol + "://DME2SEARCH/" + "service=" + serviceName + "/" + "version=" + version + "/"
- + "envContext=" + env + "/" + "partner=" + partner;
- LoadPropertyFile.loadAFTProperties(latitude, longitude);
- HashMap<String, String> hm = new HashMap<String, String>();
- hm.put("AFT_DME2_EP_READ_TIMEOUT_MS", "50000");
- hm.put("AFT_DME2_ROUNDTRIP_TIMEOUT_MS", "240000");
- hm.put("AFT_DME2_EP_CONN_TIMEOUT", "5000");
- try {
- DME2Client sender = new DME2Client(new URI(url), 5000L);
- sender.setAllowAllHttpReturnCodes(true);
- sender.setMethod(methodType);
- sender.setSubContext(subContextPath);
- sender.setPayload("");
- sender.addHeader("Content-Type", contenttype);
- sender.setCredentials(user, password);
- sender.setHeaders(hm);
-
- LOGGER.info("Getting Metrics By name");
- String reply = sender.sendAndWait(5000L);
- assertTrue(LoadPropertyFile.isValidJsonString(reply));
- LOGGER.info("response =" + reply);
-
- } catch (DME2Exception e) {
- e.printStackTrace();
- } catch (URISyntaxException e) {
- e.printStackTrace();
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-}
diff --git a/src/test/java/org/onap/dmaap/messagerouter/msgrtr/mr/test/dme2/DME2ProducerTest.java b/src/test/java/org/onap/dmaap/messagerouter/msgrtr/mr/test/dme2/DME2ProducerTest.java
deleted file mode 100644
index 2941b69..0000000
--- a/src/test/java/org/onap/dmaap/messagerouter/msgrtr/mr/test/dme2/DME2ProducerTest.java
+++ /dev/null
@@ -1,101 +0,0 @@
-/*******************************************************************************
- * ============LICENSE_START=======================================================
- * org.onap.dmaap
- * ================================================================================
- * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- *
- * ECOMP is a trademark and service mark of AT&T Intellectual Property.
- *
- *******************************************************************************/
-package org.onap.dmaap.messagerouter.msgrtr.mr.test.dme2;
-
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.util.HashMap;
-import java.util.Properties;
-
-import org.apache.log4j.Logger;
-import org.onap.dmaap.messagerouter.msgrtr.mr.test.dmaap.DmaapAdminTest;
-
-import junit.framework.TestCase;
-
-import com.att.aft.dme2.api.DME2Client;
-import com.att.aft.dme2.api.DME2Exception;
-import com.att.aft.dme2.internal.jackson.map.ObjectMapper;
-
-public class DME2ProducerTest extends TestCase {
- private static final Logger LOGGER = Logger.getLogger(DmaapAdminTest.class);
-
- public void testProducer() {
- DME2TopicTest topicTestObj = new DME2TopicTest();
-
- Properties props = LoadPropertyFile.getPropertyFileDataProducer();
- String latitude = props.getProperty("Latitude");
- String longitude = props.getProperty("Longitude");
- String version = props.getProperty("Version");
- String serviceName = props.getProperty("ServiceName");
- String env = props.getProperty("Environment");
- String partner = props.getProperty("Partner");
- String protocol = props.getProperty("Protocol");
- String url = protocol + "://DME2SEARCH/" + "service=" + serviceName + "/" + "version=" + version + "/"
- + "envContext=" + env + "/" + "partner=" + partner;
- LoadPropertyFile.loadAFTProperties(latitude, longitude);
- HashMap<String, String> hm = new HashMap<String, String>();
- hm.put("AFT_DME2_EP_READ_TIMEOUT_MS", "50000");
- hm.put("AFT_DME2_ROUNDTRIP_TIMEOUT_MS", "240000");
- hm.put("AFT_DME2_EP_CONN_TIMEOUT", "5000");
- // checking whether topic exist or not
- if (!topicTestObj.topicExist(url, props, hm)) {
- // if topic doesn't exist then create the topic
- topicTestObj.createTopic(url, props, hm);
- // after creating the topic publish on that topic
- publishMessage(url, props, hm);
- } else {
- // if topic already exist start publishing on the topic
- publishMessage(url, props, hm);
- }
-
- }
-
- public void publishMessage(String url, Properties props, HashMap<String, String> mapData) {
- try {
- LOGGER.info("Call to publish message ");
- DME2Client sender = new DME2Client(new URI(url), 5000L);
- sender.setAllowAllHttpReturnCodes(true);
- sender.setMethod(props.getProperty("MethodTypePost"));
- String subcontextpathPublish = props.getProperty("SubContextPathproducer") + props.getProperty("newTopic");
- sender.setSubContext(subcontextpathPublish);
- String jsonStringApiBean = new ObjectMapper().writeValueAsString(new ApiKeyBean("example@att.com",
- "description"));
- sender.setPayload(jsonStringApiBean);
-
- sender.setCredentials(props.getProperty("user"), props.getProperty("password"));
- sender.addHeader("content-type", props.getProperty("contenttype"));
- LOGGER.info("Publishing message");
- String reply = sender.sendAndWait(5000L);
- // assertTrue(LoadPropertyFile.isValidJsonString(reply));
- assertNotNull(reply);
- LOGGER.info("response =" + reply);
-
- } catch (DME2Exception e) {
- e.printStackTrace();
- } catch (URISyntaxException e) {
- e.printStackTrace();
- } catch (Exception e) {
- e.printStackTrace();
- }
-
- }
-}
diff --git a/src/test/java/org/onap/dmaap/messagerouter/msgrtr/mr/test/dme2/DME2TopicTest.java b/src/test/java/org/onap/dmaap/messagerouter/msgrtr/mr/test/dme2/DME2TopicTest.java
deleted file mode 100644
index bfa25f1..0000000
--- a/src/test/java/org/onap/dmaap/messagerouter/msgrtr/mr/test/dme2/DME2TopicTest.java
+++ /dev/null
@@ -1,546 +0,0 @@
-/*******************************************************************************
- * ============LICENSE_START=======================================================
- * org.onap.dmaap
- * ================================================================================
- * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- *
- * ECOMP is a trademark and service mark of AT&T Intellectual Property.
- *
- *******************************************************************************/
-package org.onap.dmaap.messagerouter.msgrtr.mr.test.dme2;
-
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.util.HashMap;
-import java.util.Properties;
-
-import javax.ws.rs.client.Entity;
-
-import org.apache.log4j.Logger;
-import org.onap.dmaap.messagerouter.msgrtr.mr.test.dmaap.DmaapAdminTest;
-
-import junit.framework.TestCase;
-
-import com.att.aft.dme2.api.DME2Client;
-import com.att.aft.dme2.api.DME2Exception;
-import com.att.aft.dme2.internal.jackson.map.ObjectMapper;
-
-public class DME2TopicTest extends TestCase {
- private String latitude;
- private String longitude;
- private String version;
- private String serviceName;
- private String env;
- private String partner;
- private String protocol;
- private String methodTypeGet;
- private String methodTypePost;
- private String methodTypeDelete;
- private String methodTypePut;
-
- private String user;
- private String password;
- private String contenttype;
- private String subContextPathGetAllTopic;
- private String subContextPathGetOneTopic;
- private String SubContextPathCreateTopic;
- private String SubContextPathGetPublisherl;
- private String SubContextPathGetPublisher;
- private String SubContextPathGetPermitPublisher;
- private String SubContextPathGetConsumer;
- private String SubContextPathGetPermitConsumer;
- private static final Logger LOGGER = Logger.getLogger(DME2TopicTest.class);
-
- public void createTopic(String url, Properties props, HashMap<String, String> mapData) {
- LOGGER.info("create topic method starts");
- if (!topicExist(url, props, mapData)) {
- LOGGER.info("creating a new topic");
- try {
- DME2Client sender = new DME2Client(new URI(url), 5000L);
- sender.setAllowAllHttpReturnCodes(true);
- sender.setMethod(props.getProperty("MethodTypePost"));
- sender.setSubContext(props.getProperty("SubContextPathCreateTopic"));
- TopicBeanDME2 topicBean = new TopicBeanDME2(props.getProperty("newTopic"),
- props.getProperty("topicDescription"), Integer.parseInt(props.getProperty("partition")),
- Integer.parseInt(props.getProperty("replication")), Boolean.valueOf(props
- .getProperty("txenabled")));
- String jsonStringApiBean = new ObjectMapper().writeValueAsString(topicBean);
- sender.setPayload(jsonStringApiBean);
- sender.addHeader("content-type", props.getProperty("contenttype"));
- sender.setCredentials(props.getProperty("user"), props.getProperty("password"));
-
- LOGGER.info("creating Topic");
- String reply = sender.sendAndWait(5000L);
- assertTrue(LoadPropertyFile.isValidJsonString(reply));
- LOGGER.info("response =" + reply);
-
- } catch (DME2Exception e) {
- e.printStackTrace();
- } catch (URISyntaxException e) {
- e.printStackTrace();
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
- }
-
- public boolean topicExist(String url, Properties props, HashMap<String, String> mapData) {
- boolean topicExist = false;
- try {
- LOGGER.info("Checking topic exists or not");
- DME2Client sender = new DME2Client(new URI(url), 5000L);
- sender.setAllowAllHttpReturnCodes(true);
- sender.setMethod(props.getProperty("MethodTypeGet"));
- String subcontextPath = props.getProperty("subContextPathGetOneTopic") + props.getProperty("newTopic");
- sender.setSubContext(subcontextPath);
- sender.setPayload("");
- sender.addHeader("content-type", props.getProperty("contenttype"));
- sender.setCredentials(props.getProperty("user"), props.getProperty("password"));
- String reply = sender.sendAndWait(5000L);
- topicExist = LoadPropertyFile.isValidJsonString(reply);
- LOGGER.info("Topic exist =" + topicExist);
- } catch (DME2Exception e) {
- e.printStackTrace();
- } catch (URISyntaxException e) {
- e.printStackTrace();
- } catch (Exception e) {
- e.printStackTrace();
- }
- return topicExist;
- }
-
- public void testAllTopics() {
- LOGGER.info("Test case get all topics initiated");
- Properties props = LoadPropertyFile.getPropertyFileDataProducer();
- latitude = props.getProperty("Latitude");
- longitude = props.getProperty("Longitude");
- version = props.getProperty("Version");
- serviceName = props.getProperty("ServiceName");
- env = props.getProperty("Environment");
- partner = props.getProperty("Partner");
- subContextPathGetAllTopic = props.getProperty("subContextPathGetAllTopic");
- protocol = props.getProperty("Protocol");
- methodTypeGet = props.getProperty("MethodTypeGet");
- user = props.getProperty("user");
- password = props.getProperty("password");
- contenttype = props.getProperty("contenttype");
-
- String url = protocol + "://DME2SEARCH/" + "service=" + serviceName + "/" + "version=" + version + "/"
- + "envContext=" + env + "/" + "partner=" + partner;
- LoadPropertyFile.loadAFTProperties(latitude, longitude); // } else {
- HashMap<String, String> hm = new HashMap<String, String>();
- hm.put("AFT_DME2_EP_READ_TIMEOUT_MS", "50000");
- hm.put("AFT_DME2_ROUNDTRIP_TIMEOUT_MS", "240000");
- hm.put("AFT_DME2_EP_CONN_TIMEOUT", "5000");
-
- try {
- DME2Client sender = new DME2Client(new URI(url), 5000L);
- sender.setAllowAllHttpReturnCodes(true);
- sender.setMethod(methodTypeGet);
- sender.setSubContext(subContextPathGetAllTopic);
- sender.setPayload("");
-
- sender.addHeader("Content-Type", contenttype);
- sender.setCredentials(user, password);
- sender.setHeaders(hm);
-
- LOGGER.info("Retrieving all topics");
- String reply = sender.sendAndWait(5000L);
- assertTrue(LoadPropertyFile.isValidJsonString(reply));
- LOGGER.info("All Topics details = " + reply);
-
- } catch (DME2Exception e) {
- e.printStackTrace();
- } catch (URISyntaxException e) {
- e.printStackTrace();
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-
- public void testOneTopic() {
- LOGGER.info("Test case get one topic initiated");
- Properties props = LoadPropertyFile.getPropertyFileDataProducer();
- latitude = props.getProperty("Latitude");
- longitude = props.getProperty("Longitude");
- version = props.getProperty("Version");
- serviceName = props.getProperty("ServiceName");
- env = props.getProperty("Environment");
- partner = props.getProperty("Partner");
- subContextPathGetOneTopic = props.getProperty("subContextPathGetOneTopic");
- protocol = props.getProperty("Protocol");
- methodTypeGet = props.getProperty("MethodTypeGet");
- user = props.getProperty("user");
- password = props.getProperty("password");
- contenttype = props.getProperty("contenttype");
-
- String url = protocol + "://DME2SEARCH/" + "service=" + serviceName + "/" + "version=" + version + "/"
- + "envContext=" + env + "/" + "partner=" + partner;
- LoadPropertyFile.loadAFTProperties(latitude, longitude);
-
- HashMap<String, String> hm = new HashMap<String, String>();
- hm.put("AFT_DME2_EP_READ_TIMEOUT_MS", "50000");
- hm.put("AFT_DME2_ROUNDTRIP_TIMEOUT_MS", "240000");
- hm.put("AFT_DME2_EP_CONN_TIMEOUT", "5000");
- System.out.println("Retrieving topic detail");
- if (!topicExist(url, props, hm)) {
- createTopic(url, props, hm);
- } else {
- assertTrue(true);
- }
- }
-
- public void createTopicForDeletion(String url, Properties props, HashMap<String, String> mapData) {
- LOGGER.info("create topic method starts");
-
- LOGGER.info("creating a new topic for deletion");
- try {
- DME2Client sender = new DME2Client(new URI(url), 5000L);
- sender.setAllowAllHttpReturnCodes(true);
- sender.setMethod(props.getProperty("MethodTypePost"));
- sender.setSubContext(props.getProperty("SubContextPathCreateTopic"));
- TopicBeanDME2 topicBean = new TopicBeanDME2(props.getProperty("deleteTopic"),
- props.getProperty("topicDescription"), Integer.parseInt(props.getProperty("partition")),
- Integer.parseInt(props.getProperty("replication")), Boolean.valueOf(props.getProperty("txenabled")));
- String jsonStringApiBean = new ObjectMapper().writeValueAsString(topicBean);
- sender.setPayload(jsonStringApiBean);
- sender.addHeader("content-type", props.getProperty("contenttype"));
- sender.setCredentials(props.getProperty("user"), props.getProperty("password"));
-
- LOGGER.info("creating Topic");
- String reply = sender.sendAndWait(5000L);
- assertTrue(LoadPropertyFile.isValidJsonString(reply));
- LOGGER.info("response =" + reply);
-
- } catch (DME2Exception e) {
- e.printStackTrace();
- } catch (URISyntaxException e) {
- e.printStackTrace();
- } catch (Exception e) {
- e.printStackTrace();
- }
-
- }
-
- public boolean topicExistForDeletion(String url, Properties props, HashMap<String, String> mapData) {
- boolean topicExist = false;
- try {
- LOGGER.info("Checking topic exists for deletion");
- DME2Client sender = new DME2Client(new URI(url), 5000L);
- sender.setAllowAllHttpReturnCodes(true);
- sender.setMethod(props.getProperty("MethodTypeGet"));
- String subcontextPath = props.getProperty("subContextPathGetOneTopic") + props.getProperty("deleteTopic");
- sender.setSubContext(subcontextPath);
- sender.setPayload("");
- sender.addHeader("content-type", props.getProperty("contenttype"));
- sender.setCredentials(props.getProperty("user"), props.getProperty("password"));
- String reply = sender.sendAndWait(5000L);
- topicExist = LoadPropertyFile.isValidJsonString(reply);
- LOGGER.info("Topic exist for deletion=" + topicExist);
- } catch (DME2Exception e) {
- e.printStackTrace();
- } catch (URISyntaxException e) {
- e.printStackTrace();
- } catch (Exception e) {
- e.printStackTrace();
- }
- return topicExist;
- }
-
- public void testDeleteTopic() {
- Properties props = LoadPropertyFile.getPropertyFileDataProducer();
- latitude = props.getProperty("Latitude");
- longitude = props.getProperty("Longitude");
- version = props.getProperty("Version");
- serviceName = props.getProperty("ServiceName");
- env = props.getProperty("Environment");
- partner = props.getProperty("Partner");
- SubContextPathCreateTopic = props.getProperty("SubContextPathCreateTopic");
- protocol = props.getProperty("Protocol");
- methodTypePost = props.getProperty("MethodTypeDelete");
- user = props.getProperty("user");
- password = props.getProperty("password");
- contenttype = props.getProperty("contenttypejson");
- String url = protocol + "://DME2SEARCH/" + "service=" + serviceName + "/" + "version=" + version + "/"
- + "envContext=" + env + "/" + "partner=" + partner;
- LoadPropertyFile.loadAFTProperties(latitude, longitude);
- HashMap<String, String> hm = new HashMap<String, String>();
- hm.put("AFT_DME2_EP_READ_TIMEOUT_MS", "50000");
- hm.put("AFT_DME2_ROUNDTRIP_TIMEOUT_MS", "240000");
- hm.put("AFT_DME2_EP_CONN_TIMEOUT", "5000");
- System.out.println("deleteing topic");
- if (!topicExistForDeletion(url, props, hm)) {
- createTopicForDeletion(url, props, hm);
- deleteTopic(url, props, hm);
- } else {
- deleteTopic(url, props, hm);
- }
- }
-
- public void deleteTopic(String url, Properties props, HashMap<String, String> mapData) {
- try {
- DME2Client sender = new DME2Client(new URI(url), 5000L);
- sender.setAllowAllHttpReturnCodes(true);
- sender.setMethod(props.getProperty("MethodTypeDelete"));
- String subsontextPathDelete = props.getProperty("subContextPathGetOneTopic")
- + props.getProperty("deleteTopic");
- sender.setSubContext(subsontextPathDelete);
- sender.setPayload("");
- sender.addHeader("content-type", props.getProperty("contenttype"));
- sender.setCredentials(props.getProperty("user"), props.getProperty("password"));
- System.out.println("Deleting Topic " + props.getProperty("deleteTopic"));
- 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();
- }
- }
-
- public void testGetProducersTopics() {
- LOGGER.info("Test case get list of producers on topic");
- Properties props = LoadPropertyFile.getPropertyFileDataProducer();
- latitude = props.getProperty("Latitude");
- longitude = props.getProperty("Longitude");
- version = props.getProperty("Version");
- serviceName = props.getProperty("ServiceName");
- env = props.getProperty("Environment");
- partner = props.getProperty("Partner");
- SubContextPathGetPublisher = props.getProperty("SubContextPathGetPublisher");
- protocol = props.getProperty("Protocol");
- methodTypeGet = props.getProperty("MethodTypeGet");
- user = props.getProperty("user");
- password = props.getProperty("password");
- contenttype = props.getProperty("contenttype");
-
- String url = protocol + "://DME2SEARCH/" + "service=" + serviceName + "/" + "version=" + version + "/"
- + "envContext=" + env + "/" + "partner=" + partner;
- LoadPropertyFile.loadAFTProperties(latitude, longitude);
-
- HashMap<String, String> hm = new HashMap<String, String>();
- hm.put("AFT_DME2_EP_READ_TIMEOUT_MS", "50000");
- hm.put("AFT_DME2_ROUNDTRIP_TIMEOUT_MS", "240000");
- hm.put("AFT_DME2_EP_CONN_TIMEOUT", "5000");
-
- try {
- DME2Client sender = new DME2Client(new URI(url), 5000L);
- sender.setAllowAllHttpReturnCodes(true);
- sender.setMethod(methodTypeGet);
- sender.setSubContext(SubContextPathGetPublisher);
- sender.setPayload("");
-
- sender.addHeader("Content-Type", contenttype);
- sender.setCredentials(user, password);
- sender.setHeaders(hm);
-
- LOGGER.info("Retrieving List of publishers");
- String reply = sender.sendAndWait(5000L);
- assertTrue(LoadPropertyFile.isValidJsonString(reply));
- LOGGER.info("All Publishers details = " + reply);
-
- } catch (DME2Exception e) {
- e.printStackTrace();
- } catch (URISyntaxException e) {
- e.printStackTrace();
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-
- // permitting a producer on topic is not applicable
- // public void testPermitProducersTopics() {
- // LOGGER.info("Test case ");
- // Properties props = LoadPropertyFile.getPropertyFileDataProducer();
- // latitude = props.getProperty("Latitude");
- // longitude = props.getProperty("Longitude");
- // version = props.getProperty("Version");
- // serviceName = props.getProperty("ServiceName");
- // env = props.getProperty("Environment");
- // partner = props.getProperty("Partner");
- // SubContextPathGetPermitPublisher =
- // props.getProperty("SubContextPathGetPermitPublisher");
- // protocol = props.getProperty("Protocol");
- // methodTypePut = props.getProperty("MethodTypePut");
- // user = props.getProperty("user");
- // password = props.getProperty("password");
- // contenttype = props.getProperty("contenttype");
- //
- // String url = protocol + "://DME2SEARCH/" + "service=" + serviceName + "/"
- // + "version=" + version + "/"
- // + "envContext=" + env + "/" + "partner=" + partner;
- // LoadPropertyFile.loadAFTProperties(latitude, longitude);
- //
- // HashMap<String, String> hm = new HashMap<String, String>();
- // hm.put("AFT_DME2_EP_READ_TIMEOUT_MS", "50000");
- // hm.put("AFT_DME2_ROUNDTRIP_TIMEOUT_MS", "240000");
- // hm.put("AFT_DME2_EP_CONN_TIMEOUT", "5000");
- //
- // try {
- // DME2Client sender = new DME2Client(new URI(url), 5000L);
- // sender.setAllowAllHttpReturnCodes(true);
- // sender.setMethod(methodTypePut);
- // sender.setSubContext(SubContextPathGetPermitPublisher);
- // sender.setPayload("");
- //
- // sender.addHeader("Content-Type", contenttype);
- // sender.setCredentials(user, password);
- // sender.setHeaders(hm);
- //
- // System.out.println("Permitting a producer on topic");
- // String reply = sender.sendAndWait(5000L);
- // System.out.println("Reply from server = " + reply);
- //
- // } catch (DME2Exception e) {
- // e.printStackTrace();
- // } catch (URISyntaxException e) {
- // e.printStackTrace();
- // } catch (Exception e) {
- // e.printStackTrace();
- // }
- // }
-
- public void testGetConsumersTopics() {
- LOGGER.info("Test case get list of consumers on topic ");
- Properties props = LoadPropertyFile.getPropertyFileDataProducer();
- latitude = props.getProperty("Latitude");
- longitude = props.getProperty("Longitude");
- version = props.getProperty("Version");
- serviceName = props.getProperty("ServiceName");
- env = props.getProperty("Environment");
- partner = props.getProperty("Partner");
- SubContextPathGetConsumer = props.getProperty("SubContextPathGetConsumer");
- protocol = props.getProperty("Protocol");
- methodTypeGet = props.getProperty("MethodTypeGet");
- user = props.getProperty("user");
- password = props.getProperty("password");
- contenttype = props.getProperty("contenttype");
-
- String url = protocol + "://DME2SEARCH/" + "service=" + serviceName + "/" + "version=" + version + "/"
- + "envContext=" + env + "/" + "partner=" + partner;
- LoadPropertyFile.loadAFTProperties(latitude, longitude);
-
- HashMap<String, String> hm = new HashMap<String, String>();
- hm.put("AFT_DME2_EP_READ_TIMEOUT_MS", "50000");
- hm.put("AFT_DME2_ROUNDTRIP_TIMEOUT_MS", "240000");
- hm.put("AFT_DME2_EP_CONN_TIMEOUT", "5000");
-
- try {
- DME2Client sender = new DME2Client(new URI(url), 5000L);
- sender.setAllowAllHttpReturnCodes(true);
- sender.setMethod(methodTypeGet);
- sender.setSubContext(SubContextPathGetConsumer);
- sender.setPayload("");
-
- sender.addHeader("Content-Type", contenttype);
- sender.setCredentials(user, password);
- sender.setHeaders(hm);
-
- LOGGER.info("Retrieving consumer details on topics");
- String reply = sender.sendAndWait(5000L);
- assertTrue(LoadPropertyFile.isValidJsonString(reply));
- System.out.println("Reply from server = " + reply);
-
- } catch (DME2Exception e) {
- e.printStackTrace();
- } catch (URISyntaxException e) {
- e.printStackTrace();
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-
- public void testCreateTopic() {
- LOGGER.info("Test case create topic starts");
- Properties props = LoadPropertyFile.getPropertyFileDataProducer();
- latitude = props.getProperty("Latitude");
- longitude = props.getProperty("Longitude");
- version = props.getProperty("Version");
- serviceName = props.getProperty("ServiceName");
- env = props.getProperty("Environment");
- partner = props.getProperty("Partner");
- SubContextPathCreateTopic = props.getProperty("SubContextPathCreateTopic");
- protocol = props.getProperty("Protocol");
- methodTypePost = props.getProperty("MethodTypePost");
- user = props.getProperty("user");
- password = props.getProperty("password");
- contenttype = props.getProperty("contenttypejson");
-
- String url = protocol + "://DME2SEARCH/" + "service=" + serviceName + "/" + "version=" + version + "/"
- + "envContext=" + env + "/" + "partner=" + partner;
- LoadPropertyFile.loadAFTProperties(latitude, longitude);
- HashMap<String, String> hm = new HashMap<String, String>();
- hm.put("AFT_DME2_EP_READ_TIMEOUT_MS", "50000");
- hm.put("AFT_DME2_ROUNDTRIP_TIMEOUT_MS", "240000");
- hm.put("AFT_DME2_EP_CONN_TIMEOUT", "5000");
-
- createTopic(url, props, hm);
- }
- // permitting a consumer on topic is not applicable
- // public void testPermitConsumerTopics() {
- // Properties props = LoadPropertyFile.getPropertyFileDataProducer();
- // latitude = props.getProperty("Latitude");
- // longitude = props.getProperty("Longitude");
- // version = props.getProperty("Version");
- // serviceName = props.getProperty("ServiceName");
- // env = props.getProperty("Environment");
- // partner = props.getProperty("Partner");
- // SubContextPathGetPermitConsumer =
- // props.getProperty("SubContextPathGetPermitConsumer");
- // protocol = props.getProperty("Protocol");
- // methodTypePut = props.getProperty("MethodTypePut");
- // user = props.getProperty("user");
- // password = props.getProperty("password");
- // contenttype = props.getProperty("contenttype");
- //
- // String url = protocol + "://DME2SEARCH/" + "service=" + serviceName + "/"
- // + "version=" + version + "/"
- // + "envContext=" + env + "/" + "partner=" + partner;
- // LoadPropertyFile.loadAFTProperties(latitude, longitude);
- //
- // HashMap<String, String> hm = new HashMap<String, String>();
- // hm.put("AFT_DME2_EP_READ_TIMEOUT_MS", "50000");
- // hm.put("AFT_DME2_ROUNDTRIP_TIMEOUT_MS", "240000");
- // hm.put("AFT_DME2_EP_CONN_TIMEOUT", "5000");
- //
- // try {
- // DME2Client sender = new DME2Client(new URI(url), 5000L);
- // sender.setAllowAllHttpReturnCodes(true);
- // sender.setMethod(methodTypePut);
- // sender.setSubContext(SubContextPathGetPermitConsumer);
- // sender.setPayload("");
- //
- // sender.addHeader("Content-Type", contenttype);
- // sender.setCredentials(user, password);
- // sender.setHeaders(hm);
- //
- // System.out.println("Permitting a consumer on topic");
- // String reply = sender.sendAndWait(5000L);
- // assertNotNull(reply);
- // System.out.println("Reply from server = " + reply);
- //
- // } catch (DME2Exception e) {
- // e.printStackTrace();
- // } catch (URISyntaxException e) {
- // e.printStackTrace();
- // } catch (Exception e) {
- // e.printStackTrace();
- // }
- // }
-
-}
diff --git a/src/test/java/org/onap/dmaap/messagerouter/msgrtr/mr/test/dme2/JUnitTestSuite.java b/src/test/java/org/onap/dmaap/messagerouter/msgrtr/mr/test/dme2/JUnitTestSuite.java
deleted file mode 100644
index 45d1dba..0000000
--- a/src/test/java/org/onap/dmaap/messagerouter/msgrtr/mr/test/dme2/JUnitTestSuite.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*******************************************************************************
- * ============LICENSE_START=======================================================
- * org.onap.dmaap
- * ================================================================================
- * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- *
- * ECOMP is a trademark and service mark of AT&T Intellectual Property.
- *
- *******************************************************************************/
-package org.onap.dmaap.messagerouter.msgrtr.mr.test.dme2;
-
-import junit.framework.TestSuite;
-
-import org.junit.runner.RunWith;
-import org.junit.runners.Suite;
-import org.junit.runners.Suite.SuiteClasses;
-import org.apache.log4j.Logger;
-
-@RunWith(Suite.class)
-@SuiteClasses({ DME2AdminTest.class, DME2ApiKeyTest.class, DME2ConsumerTest.class, DME2ConsumerTest.class,
- DME2MetricsTest.class, DME2ProducerTest.class, DME2TopicTest.class, })
-public class JUnitTestSuite {
- private static final Logger LOGGER = Logger.getLogger(JUnitTestSuite.class);
-
- public static void main(String[] args) {
- LOGGER.info("Running the test suite");
-
- TestSuite tstSuite = new TestSuite();
- LOGGER.info("Total Test Counts " + tstSuite.countTestCases());
- }
-
-}
diff --git a/src/test/java/org/onap/dmaap/messagerouter/msgrtr/mr/test/dme2/LoadPropertyFile.java b/src/test/java/org/onap/dmaap/messagerouter/msgrtr/mr/test/dme2/LoadPropertyFile.java
deleted file mode 100644
index 188adc7..0000000
--- a/src/test/java/org/onap/dmaap/messagerouter/msgrtr/mr/test/dme2/LoadPropertyFile.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*******************************************************************************
- * ============LICENSE_START=======================================================
- * org.onap.dmaap
- * ================================================================================
- * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- *
- * ECOMP is a trademark and service mark of AT&T Intellectual Property.
- *
- *******************************************************************************/
-package org.onap.dmaap.messagerouter.msgrtr.mr.test.dme2;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.Properties;
-
-import com.att.eelf.configuration.EELFLogger;
-import com.att.eelf.configuration.EELFManager;
-import org.json.JSONObject;
-
-public class LoadPropertyFile {
- //private static final Logger LOGGER = Logger.getLogger(LoadPropertyFile.class);
- private static final EELFLogger LOGGER = EELFManager.getInstance().getLogger(LoadPropertyFile.class);
-
- static public Properties getPropertyFileDataProducer() {
- Properties prop = new Properties();
- LOGGER.info("loading the property file");
- try {
- InputStream inputStream = LoadPropertyFile.class.getClassLoader()
- .getResourceAsStream("dme2testcase.properties");
-
- prop.load(inputStream);
- LOGGER.info("successfully loaded the property file");
- } catch (IOException e) {
- LOGGER.error("Error while retrieving API keys: " + e);
- }
- return prop;
- }
-
- static public void loadAFTProperties(String lat, String longi) {
- System.setProperty("AFT_LATITUDE", lat);
- System.setProperty("AFT_LONGITUDE", longi);
- System.setProperty("AFT_ENVIRONMENT", "AFTUAT");
- // printProperties();
- System.out.println("Latitude =" + lat);
- System.out.println("Longitude =" + longi);
- }
-
- static public boolean isValidJsonString(String chkString) {
- boolean isJson = true;
- try {
- new JSONObject(chkString);
- } catch (Exception e) {
- isJson = false;
- }
- return isJson;
- }
-}
diff --git a/src/test/java/org/onap/dmaap/messagerouter/msgrtr/mr/test/dme2/TestRunner.java b/src/test/java/org/onap/dmaap/messagerouter/msgrtr/mr/test/dme2/TestRunner.java
deleted file mode 100644
index 26c8f34..0000000
--- a/src/test/java/org/onap/dmaap/messagerouter/msgrtr/mr/test/dme2/TestRunner.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*******************************************************************************
- * ============LICENSE_START=======================================================
- * org.onap.dmaap
- * ================================================================================
- * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- *
- * ECOMP is a trademark and service mark of AT&T Intellectual Property.
- *
- *******************************************************************************/
-package org.onap.dmaap.messagerouter.msgrtr.mr.test.dme2;
-
-import org.junit.runner.JUnitCore;
-import org.junit.runner.Result;
-import org.junit.runner.notification.Failure;
-import org.apache.log4j.Logger;
-
-public class TestRunner {
- private static final Logger LOGGER = Logger.getLogger(TestRunner.class);
-
- public static void main(String[] args) {
- // TODO Auto-generated method stub
- Result result = JUnitCore.runClasses(JUnitTestSuite.class);
- for (Failure failure : result.getFailures()) {
- LOGGER.info(failure.toString());
-
- }
- LOGGER.info(result.wasSuccessful());
- }
-
-}
diff --git a/src/test/java/org/onap/dmaap/messagerouter/msgrtr/mr/test/dme2/TopicBeanDME2.java b/src/test/java/org/onap/dmaap/messagerouter/msgrtr/mr/test/dme2/TopicBeanDME2.java
deleted file mode 100644
index d8b1287..0000000
--- a/src/test/java/org/onap/dmaap/messagerouter/msgrtr/mr/test/dme2/TopicBeanDME2.java
+++ /dev/null
@@ -1,94 +0,0 @@
-/*******************************************************************************
- * ============LICENSE_START=======================================================
- * org.onap.dmaap
- * ================================================================================
- * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- *
- * ECOMP is a trademark and service mark of AT&T Intellectual Property.
- *
- *******************************************************************************/
-/**
- *
- */
-package org.onap.dmaap.messagerouter.msgrtr.mr.test.dme2;
-
-import java.io.Serializable;
-
-public class TopicBeanDME2 implements Serializable {
-
- private static final long serialVersionUID = -8620390377775457949L;
- private String topicName;
- private String description;
-
-
- private int partitionCount;
- private int replicationCount;
- private boolean transactionEnabled = false;
-
- public boolean isTransactionEnabled() {
- return transactionEnabled;
- }
-
- public void setTransactionEnabled(boolean transactionEnabled) {
- this.transactionEnabled = transactionEnabled;
- }
-
- public TopicBeanDME2() {
- super();
- }
-
- public TopicBeanDME2(String topicName, String description, int partitionCount, int replicationCount,
- boolean transactionEnabled) {
- super();
- this.topicName = topicName;
- this.description = description;
- this.partitionCount = partitionCount;
- this.replicationCount = replicationCount;
- this.transactionEnabled = transactionEnabled;
- }
-
- public String getTopicName() {
- return topicName;
- }
-
- public void setTopicName(String topicName) {
- this.topicName = topicName;
- }
-
- public String getDescription() {
- return description;
- }
-
- public void setDescription(String description) {
- this.description = description;
- }
-
- public int getPartitionCount() {
- return partitionCount;
- }
-
- public void setPartitionCount(int partitionCount) {
- this.partitionCount = partitionCount;
- }
-
- public int getReplicationCount() {
- return replicationCount;
- }
-
- public void setReplicationCount(int replicationCount) {
- this.replicationCount = replicationCount;
- }
-
-}
diff --git a/src/test/java/org/onap/dmaap/messagerouter/msgrtr/nsa/cambria/CambriaApiTestCase.java b/src/test/java/org/onap/dmaap/messagerouter/msgrtr/nsa/cambria/CambriaApiTestCase.java
deleted file mode 100644
index 5800918..0000000
--- a/src/test/java/org/onap/dmaap/messagerouter/msgrtr/nsa/cambria/CambriaApiTestCase.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*******************************************************************************
- * ============LICENSE_START=======================================================
- * org.onap.dmaap
- * ================================================================================
- * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- *
- * ECOMP is a trademark and service mark of AT&T Intellectual Property.
- *
- *******************************************************************************/
-package org.onap.dmaap.messagerouter.msgrtr.nsa.cambria;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import junit.framework.TestCase;
-
-import org.junit.Ignore;
-
-@Ignore
-public class CambriaApiTestCase extends TestCase {
-
- @Override
- protected void setUp() throws Exception {
- final Map<String, String> argMap = new HashMap<String, String> ();
-
- argMap.put("broker.type", "memory");
- argMap.put("accounts.dao.class", "com.att.nsa.fe3c.dao.memory.MemoryDAOFactory");
- argMap.put("topic.dao.class", "com.att.nsa.fe3c.dao.memory.MemoryDAOFactory");
-
- //CambriaApiServer.start(argMap);
- System.out.println("setUp() complete");
- }
-
- @Override
- protected void tearDown() throws Exception {
- System.out.println("tearDown() started");
- //CambriaApiServer.stop();
- System.out.println("tearDown() complete");
- }
-}
diff --git a/src/test/java/org/onap/dmaap/messagerouter/msgrtr/nsa/cambria/CambriaRateLimiterTest.java b/src/test/java/org/onap/dmaap/messagerouter/msgrtr/nsa/cambria/CambriaRateLimiterTest.java
deleted file mode 100644
index f362a0c..0000000
--- a/src/test/java/org/onap/dmaap/messagerouter/msgrtr/nsa/cambria/CambriaRateLimiterTest.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/*******************************************************************************
- * ============LICENSE_START=======================================================
- * org.onap.dmaap
- * ================================================================================
- * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- *
- * ECOMP is a trademark and service mark of AT&T Intellectual Property.
- *
- *******************************************************************************/
-package org.onap.dmaap.messagerouter.msgrtr.nsa.cambria;
-
-import junit.framework.TestCase;
-
-import org.junit.Test;
-
-import com.att.nsa.apiServer.util.NsaTestClock;
-
-public class CambriaRateLimiterTest
-{
- @Test
- public void testRateLimiter ()
- {
- /*final NsaTestClock clock = new NsaTestClock(1, false);
-
- final String topic = "topic";
- final String consumerGroup = "group";
- final String clientId = "id";
-
- final int window = 5;
-
- // rate limit: 1 empty call/min avg over 5 minutes, with 10ms delay
- final CambriaRateLimiter rater = new CambriaRateLimiter ( 1.0, window, 10 );
- try
- {
- // prime with a call to start rate window
- rater.onCall ( topic, consumerGroup, clientId );
- rater.onSend ( topic, consumerGroup, clientId, 1 );
- clock.addMs ( 1000*60*window );
-
- // rate should now be 0, with a good window
- for ( int i=0; i<4; i++ )
- {
- clock.addMs ( 1000*15 );
- rater.onCall ( topic, consumerGroup, clientId );
- rater.onSend ( topic, consumerGroup, clientId, 0 );
- }
- // rate is now 0.8 = 4 calls in last 5 minutes = 4/5 = 0.8
-
- clock.addMs ( 1000*15 );
- rater.onCall ( topic, consumerGroup, clientId );
- rater.onSend ( topic, consumerGroup, clientId, 0 );
- // rate = 1.0 = 5 calls in last 5 mins
-
- clock.addMs ( 1000 );
- rater.onCall ( topic, consumerGroup, clientId );
- rater.onSend ( topic, consumerGroup, clientId, 0 );
- // rate = 1.2 = 6 calls in last 5 mins, should fire
-
- fail ( "Should have thrown rate limit exception." );
- }
- catch ( CambriaApiException x )
- {
- // good
- }*/
- }
-}
diff --git a/src/test/java/org/onap/dmaap/messagerouter/msgrtr/nsa/cambria/utils/UtilsTest.java b/src/test/java/org/onap/dmaap/messagerouter/msgrtr/nsa/cambria/utils/UtilsTest.java
deleted file mode 100644
index e768033..0000000
--- a/src/test/java/org/onap/dmaap/messagerouter/msgrtr/nsa/cambria/utils/UtilsTest.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*******************************************************************************
- * ============LICENSE_START=======================================================
- * org.onap.dmaap
- * ================================================================================
- * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- *
- * ECOMP is a trademark and service mark of AT&T Intellectual Property.
- *
- *******************************************************************************/
-package org.onap.dmaap.messagerouter.msgrtr.nsa.cambria.utils;
-
-import static org.junit.Assert.*;
-
-import java.text.SimpleDateFormat;
-import java.util.Date;
-
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-import org.onap.dmaap.messagerouter.msgrtr.nsa.cambria.utils.Utils;
-
-public class UtilsTest {
-
- private static final String DATE_FORMAT = "dd-MM-yyyy::hh:mm:ss:SSS";
-
- @Before
- public void setUp() throws Exception {
- }
-
- @After
- public void tearDown() throws Exception {
- }
-
- @Test
- public void testGetFormattedDate() {
- Date now = new Date();
- String dateStr = Utils.getFormattedDate(now);
- SimpleDateFormat sdf = new SimpleDateFormat(DATE_FORMAT);
- String expectedStr = sdf.format(now);
- assertNotNull(dateStr);
- assertTrue("Formatted date does not match - expected [" + expectedStr
- + "] received [" + dateStr + "]",
- dateStr.equalsIgnoreCase(expectedStr));
- }
-
-}