summaryrefslogtreecommitdiffstats
path: root/dmaap-listener/src/test/java/org/onap/ccsdk/sli/northbound/dmaapclient/TestDmaapListener.java
blob: 943ef02042e9c4d53244e0491643962856c1977d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
package org.onap.ccsdk.sli.northbound.dmaapclient;

import static org.junit.Assert.*;

import java.util.LinkedList;
import java.util.List;
import java.util.Properties;

import org.junit.Before;
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class TestDmaapListener {

	private static final String DMAAP_LISTENER_PROPERTIES = "dmaap-listener.properties";
	private static final String DMAAP_LISTENER_PROPERTIES_DIR = "src/test/resources";

	private static final Logger LOG = LoggerFactory.getLogger(TestDmaapListener.class);

	@Before
	public void setUp() throws Exception {
	}

	@Test
	public void test() {
		Properties properties = new Properties();
		String propFileName = DMAAP_LISTENER_PROPERTIES;
		String propPath = null;
		String propDir = DMAAP_LISTENER_PROPERTIES_DIR;

		List<SdncDmaapConsumer> consumers = new LinkedList<>();


		propPath = propDir + "/" + propFileName;

		if (propPath != null) {
			properties = DmaapListener.loadProperties(propPath, properties);

			String subscriptionStr = properties.getProperty("subscriptions");

			boolean threadsRunning = false;

			LOG.debug("Dmaap subscriptions : " + subscriptionStr);

			if (subscriptionStr != null) {
				threadsRunning = DmaapListener.handleSubscriptions(subscriptionStr, propDir, properties, consumers);
			}
		}
	}

}