diff options
author | vagrant <vv770d@att.com> | 2018-01-20 14:55:43 +0000 |
---|---|---|
committer | vagrant <vv770d@att.com> | 2018-01-20 14:59:57 +0000 |
commit | 7672276206d44d8dbc17bf73ef950b17191b6257 (patch) | |
tree | 12a3e1aad24ec7eb59294629adf677c7c62188e1 /src/test/java/org | |
parent | 3b9fd0933fcda7b4f85aff70fc72ffd517e5b30f (diff) |
Optimize collector publish mechanism
Change-Id: I6d5fb2ad45257831e8e0ff62812df1fd1401464d
Issue-ID: DCAEGEN2-281
Signed-off-by: Vijay VK <vv770d@att.com>
Diffstat (limited to 'src/test/java/org')
-rw-r--r-- | src/test/java/org/onap/dcae/vestest/TestEventProcessor.java | 71 |
1 files changed, 70 insertions, 1 deletions
diff --git a/src/test/java/org/onap/dcae/vestest/TestEventProcessor.java b/src/test/java/org/onap/dcae/vestest/TestEventProcessor.java index 31807dba..f11cc905 100644 --- a/src/test/java/org/onap/dcae/vestest/TestEventProcessor.java +++ b/src/test/java/org/onap/dcae/vestest/TestEventProcessor.java @@ -36,10 +36,11 @@ import org.junit.Test; import org.onap.dcae.commonFunction.CommonStartup; import org.onap.dcae.commonFunction.EventProcessor; import org.onap.dcae.commonFunction.EventPublisher; +import org.onap.dcae.commonFunction.EventPublisherHash; import org.onap.dcae.controller.LoadDynamicConfig; import org.onap.dcae.commonFunction.DmaapPropertyReader; - +import com.att.nsa.cambria.client.CambriaBatchingPublisher; import com.google.gson.JsonParser; public class TestEventProcessor { @@ -99,6 +100,74 @@ public class TestEventProcessor { assertEquals(true, flag); } + + @Test + public void testpublisherhashclass() { + + DmaapPropertyReader dr; + EventPublisherHash eph = null; + Boolean flag = false; + eph = EventPublisherHash.getInstance(); + + + if (eph.equals(null)) + { + flag = false; + } + else + { + flag = true; + } + assertEquals(true, flag); + + + } + + @Test + public void testpublisherhashclassload() { + DmaapPropertyReader dr; + EventPublisherHash eph = null; + String testinput = "src/test/resources/testDmaapConfig.json"; + Boolean flag = false; + dr = new DmaapPropertyReader(testinput); + eph = EventPublisherHash.getInstance(); + EventProcessor ec = new EventProcessor(); + ec.event=new org.json.JSONObject(ev); + CommonStartup.cambriaConfigFile="src/test/resources/testDmaapConfig.json"; + CambriaBatchingPublisher pub = eph.Dmaaphash("sec_fault_ueb"); + + if (pub == null || pub.equals(null)) + { + flag = false; + } + else + { + flag = true; + } + assertEquals(true, flag); + + } + + @Test + public void testpublisherhashSend() { + + DmaapPropertyReader dr; + EventPublisherHash eph = null; + String testinput = "src/test/resources/testDmaapConfig.json"; + Boolean flag = true; + dr = new DmaapPropertyReader(testinput); + eph = EventPublisherHash.getInstance(); + + + EventProcessor ec = new EventProcessor(); + ec.event=new org.json.JSONObject(ev); + CommonStartup.cambriaConfigFile="src/test/resources/testDmaapConfig.json"; + eph.sendEvent(ec.event, "sec_fault_ueb"); + + assertEquals(true, flag); + + } } + |