2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6 * Copyright (C) 2017 Amdocs
7 * ================================================================================
8 * Licensed under the Apache License, Version 2.0 (the "License");
9 * you may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
19 * ============LICENSE_END=========================================================
20 * ECOMP is a trademark and service mark of AT&T Intellectual Property.
23 package org.openecomp.appc.listener.impl;
25 import static org.junit.Assert.assertEquals;
26 import static org.junit.Assert.fail;
28 import java.util.Properties;
30 import org.junit.Before;
31 import org.junit.Ignore;
32 import org.junit.Test;
33 import org.openecomp.appc.listener.Listener;
34 import org.openecomp.appc.listener.ListenerProperties;
35 import org.openecomp.appc.listener.demo.impl.ListenerImpl;
38 public class TestListener {
40 private static final String PROP_FILE = "/org/openecomp/appc/default.properties";
42 private Listener listener;
44 private Properties props;
48 props = new Properties();
50 props.load(getClass().getResourceAsStream(PROP_FILE));
51 props.setProperty("topic.read", "DCAE-CLOSED-LOOP-EVENTS-DEV1510SIM");
52 } catch (Exception e) {
54 fail("Failed to setup test: " + e.getMessage());
56 listener = new ListenerImpl(new ListenerProperties("appc.ClosedLoop", props));
60 public void testListenerId() {
61 String originalId = listener.getListenerId();
62 String newId = originalId + "-new";
64 listener.setListenerId(newId);
65 assertEquals(newId, listener.getListenerId());
69 public void testRun() {
71 Thread t = new Thread(listener);
78 System.out.println(listener.getBenchmark());
80 } catch (Exception e) {
87 public void testUpdateProperties() {
92 public void printSampleData() {
94 props.setProperty("threads.queuesize.min", "1");
95 props.setProperty("threads.queuesize.max", "1");
96 props.setProperty("threads.poolsize.min", "1");
97 props.setProperty("threads.poolsize.max", "1");
99 Thread t = new Thread(listener);
106 System.out.println(listener.getBenchmark());
108 } catch (Exception e) {
110 fail(e.getMessage());