diff options
author | 2018-02-21 16:42:18 -0500 | |
---|---|---|
committer | 2018-02-22 23:41:58 +0000 | |
commit | 5a99e9824824b2fa5f22945cd58cd5e3ee0df1ef (patch) | |
tree | b9c916228c3440d70bbf9e34ab57df731934ca8d /appc-event-listener/appc-event-listener-bundle/src/test/java/org | |
parent | 7353bcd8f2b85a50720b7cc7ca04c837c7b1796a (diff) |
modify listeners to only start when props present
Change-Id: If4ba1552eb6bc78a95f1b53292752181bc29cb2d
Issue-ID: APPC-564
Signed-off-by: RY303T <RY303T@att.com>
Diffstat (limited to 'appc-event-listener/appc-event-listener-bundle/src/test/java/org')
-rw-r--r-- | appc-event-listener/appc-event-listener-bundle/src/test/java/org/onap/appc/listener/TestAppcDmaapListenerActivator.java | 40 |
1 files changed, 36 insertions, 4 deletions
diff --git a/appc-event-listener/appc-event-listener-bundle/src/test/java/org/onap/appc/listener/TestAppcDmaapListenerActivator.java b/appc-event-listener/appc-event-listener-bundle/src/test/java/org/onap/appc/listener/TestAppcDmaapListenerActivator.java index 6bb96b95c..f8cbdb3dc 100644 --- a/appc-event-listener/appc-event-listener-bundle/src/test/java/org/onap/appc/listener/TestAppcDmaapListenerActivator.java +++ b/appc-event-listener/appc-event-listener-bundle/src/test/java/org/onap/appc/listener/TestAppcDmaapListenerActivator.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * ONAP : APPC * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Copyright (C) 2017 Amdocs * ============================================================================= @@ -27,18 +27,25 @@ package org.onap.appc.listener; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.fail; +import java.io.IOException; +import java.io.InputStream; +import java.util.Properties; + import org.junit.Test; +import org.mockito.Mockito; + +import static org.mockito.Mockito.doReturn; + import org.onap.appc.listener.AppcEventListenerActivator; public class TestAppcDmaapListenerActivator { @Test - public void testStartStop() { - // TODO - How do we tests activators + public void testStartStopDefaultProperties() { AppcEventListenerActivator appc = new AppcEventListenerActivator(); try { appc.start(null); - Thread.sleep(2000); + Thread.sleep(1000); appc.stop(null); } catch (Exception e) { e.printStackTrace(); @@ -46,4 +53,29 @@ public class TestAppcDmaapListenerActivator { } assertNotNull(appc.getName()); } + + @Test + public void testStartStopEmptyProperties() { + InputStream input = getClass().getResourceAsStream("/org/onap/appc/empty.properties"); + Properties props = new Properties(); + try { + props.load(input); + } catch (IOException e) { + e.printStackTrace(); + } + + AppcEventListenerActivator appc = new AppcEventListenerActivator(); + AppcEventListenerActivator spyAppc = Mockito.spy(appc); + doReturn(props).when(spyAppc).getProperties(); + + try { + spyAppc.start(null); + Thread.sleep(1000); + spyAppc.stop(null); + } catch (Exception e) { + e.printStackTrace(); + fail(e.getMessage()); + } + assertNotNull(spyAppc.getName()); + } } |