From 5a99e9824824b2fa5f22945cd58cd5e3ee0df1ef Mon Sep 17 00:00:00 2001 From: RY303T Date: Wed, 21 Feb 2018 16:42:18 -0500 Subject: modify listeners to only start when props present Change-Id: If4ba1552eb6bc78a95f1b53292752181bc29cb2d Issue-ID: APPC-564 Signed-off-by: RY303T --- .../listener/TestAppcDmaapListenerActivator.java | 40 +++++++++++++++-- .../resources/org/onap/appc/default.properties | 51 ++++++++++++++++++---- .../test/resources/org/onap/appc/empty.properties | 33 ++++++++++++++ 3 files changed, 111 insertions(+), 13 deletions(-) create mode 100644 appc-event-listener/appc-event-listener-bundle/src/test/resources/org/onap/appc/empty.properties (limited to 'appc-event-listener/appc-event-listener-bundle/src/test') 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()); + } } diff --git a/appc-event-listener/appc-event-listener-bundle/src/test/resources/org/onap/appc/default.properties b/appc-event-listener/appc-event-listener-bundle/src/test/resources/org/onap/appc/default.properties index 3bd5bf409..5929f287e 100644 --- a/appc-event-listener/appc-event-listener-bundle/src/test/resources/org/onap/appc/default.properties +++ b/appc-event-listener/appc-event-listener-bundle/src/test/resources/org/onap/appc/default.properties @@ -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 # ============================================================================= @@ -81,12 +81,45 @@ appc.ClosedLoop1607.threads.poolsize.min=1 appc.ClosedLoop1607.threads.poolsize.max=2 appc.ClosedLoop1607.provider.url=https://admin:password@localhost:8443/restconf/operations/appc-provider:topology-operation +### ### +### LCM properties ### +### ### +appc.LCM.disabled=true +appc.LCM.poolMembers=192.168.1.2:3904 +appc.LCM.topic.read=MY_DMAAP_TOPIC +appc.LCM.topic.write=MY_DMAAP_TOPIC +appc.LCM.topic.read.filter={"class":"Unassigned","field":"Status"} +appc.LCM.client.name=DMAAP-CLIENT-NAME +appc.LCM.client.name.id=0 +appc.LCM.threads.queuesize.min=1 +appc.LCM.threads.queuesize.max=1000 +appc.LCM.threads.poolsize.min=1 +appc.LCM.threads.poolsize.max=2 +appc.LCM.provider.url=https://admin:password@localhost:8443/restconf/operations/appc-provider:topology-operation - - - -### ### -### POINT TO AN ACTIVE TEST VM IN OPENSTACK INSTANCE ### -### ### -test.vm_url=https://example.com/v2/123/servers/123-345 - +### ### +### DEMO properties ### +### ### +appc.demo.poolMembers=192.168.1.2:3904 +appc.demo.topic.read=MY_DMAAP_TOPIC +appc.demo.topic.write=MY_DMAAP_TOPIC +appc.demo.topic.read.filter={"class":"Unassigned","field":"Status"} +appc.demo.client.name=DMAAP-CLIENT-NAME +appc.demo.client.name.id=0 +appc.demo.threads.queuesize.min=1 +appc.demo.threads.queuesize.max=1000 +appc.demo.threads.poolsize.min=1 +appc.demo.threads.poolsize.max=2 + +# OAM Listener +######################### +appc.OAM.disabled=false +appc.OAM.poolMembers=192.168.1.2:3904 +appc.OAM.topic.read=OAM_TOPIC +appc.OAM.topic.write=OAM_TOPIC +appc.OAM.client.name=OAM_CLIENT +#appc.OAM.provider.url= +#appc.OAM.provider.user=m97292@appc.att.com +#appc.OAM.provider.pass=enc:DBE7PBN7EAN+Pwom + +appc.demo.provider.url=https://admin:password@localhost:8443/restconf/operations/appc-provider:topology-operation \ No newline at end of file diff --git a/appc-event-listener/appc-event-listener-bundle/src/test/resources/org/onap/appc/empty.properties b/appc-event-listener/appc-event-listener-bundle/src/test/resources/org/onap/appc/empty.properties new file mode 100644 index 000000000..674c1197a --- /dev/null +++ b/appc-event-listener/appc-event-listener-bundle/src/test/resources/org/onap/appc/empty.properties @@ -0,0 +1,33 @@ +### +# ============LICENSE_START======================================================= +# ONAP : APPC +# ================================================================================ +# Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved. +# ================================================================================ +# Copyright (C) 2017 Amdocs +# ============================================================================= +# 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. +# +# ECOMP is a trademark and service mark of AT&T Intellectual Property. +# ============LICENSE_END========================================================= +### + + + + + +### ### +### ### +###Properties below are default values to be provided with real valuesin appc.properties### +### ### +### ### -- cgit 1.2.3-korg