diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/test/java/org/onap/dmaap/mr/client/impl/MRConsumerImplTest.java | 33 |
1 files changed, 28 insertions, 5 deletions
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 @@ public class MRConsumerImplTest extends TestCase { 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 @@ public class MRConsumerImplTest extends TestCase { 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); + } } } |