add testcases
Issue-ID: DMAAP-1147
Change-Id: Ia8bec69d04f49d2b05eda75f1c8b594c0b3f5b29
Signed-off-by: sunil.unnava <sunil.unnava@att.com>
diff --git a/src/test/java/org/onap/dmaap/mr/client/impl/MRConsumerImplTest.java b/src/test/java/org/onap/dmaap/mr/client/impl/MRConsumerImplTest.java
index 8765845..f3eab69 100644
--- a/src/test/java/org/onap/dmaap/mr/client/impl/MRConsumerImplTest.java
+++ b/src/test/java/org/onap/dmaap/mr/client/impl/MRConsumerImplTest.java
@@ -103,10 +103,22 @@
hosts.add("localhost:8080");
Properties properties = new Properties();
properties.load(
- MRSimplerBatchConsumerTest.class.getClassLoader().getResourceAsStream("dme2/consumer.properties"));
+ MRSimplerBatchPublisherTest.class.getClassLoader().getResourceAsStream("dme2/consumer.properties"));
+
+ String routeFilePath = "dme2/preferredRoute.txt";
+
+ File file = new File(MRSimplerBatchPublisherTest.class.getClassLoader().getResource(routeFilePath).getFile());
+ properties.put("routeFilePath",
+ MRSimplerBatchPublisherTest.class.getClassLoader().getResource(routeFilePath).getFile());
+
+ File outFile = new File(file.getParent() + "/consumer_tmp.properties");
+ properties.store(new FileOutputStream(outFile), "");
+
+ MRClientFactory.prop=properties;
final MRConsumerImpl c = new MRConsumerImpl(hosts, "topic", "cg", "cid", -1, -1, "{ \"foo\"=\"bar\"bar\" }",
null, null);
+ c.setProps(properties);
assertNotNull(c.fetchWithReturnConsumerResponse());
c.setProtocolFlag(ProtocolTypeConstants.AAF_AUTH.getValue());
assertNotNull(c.fetchWithReturnConsumerResponse());
@@ -146,11 +158,22 @@
assertTrue(true);
}
c.setProtocolFlag(ProtocolTypeConstants.AAF_AUTH.getValue());
- assertNotNull(c.fetchWithReturnConsumerResponse());
+ try {
+ c.fetch();
+ } catch (Exception e) {
+ assertTrue(true);
+ }
c.setProtocolFlag(ProtocolTypeConstants.HTTPNOAUTH.getValue());
- assertNotNull(c.fetchWithReturnConsumerResponse());
+ try {
+ c.fetch();
+ } catch (Exception e) {
+ assertTrue(true);
+ }
c.setProtocolFlag(ProtocolTypeConstants.AUTH_KEY.getValue());
- assertNotNull(c.fetchWithReturnConsumerResponse());
- assertTrue(true);
+ try {
+ c.fetch();
+ } catch (Exception e) {
+ assertTrue(true);
+ }
}
}