2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6 * ================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * ============LICENSE_END=========================================================
21 package org.onap.dmaap.mr.apiServer.metrics.cambria;
24 import static org.junit.Assert.assertTrue;
28 import org.junit.After;
29 import org.junit.Before;
30 import org.junit.Test;
32 import com.att.ajsc.filemonitor.AJSCPropertiesMap;
33 import org.onap.dmaap.mr.apiServer.metrics.cambria.DMaaPMetricsSender;
35 public class DMaaPMetricsSenderTest {
38 public void setUp() throws Exception {
39 ClassLoader classLoader = getClass().getClassLoader();
40 AJSCPropertiesMap.refresh(new File(classLoader.getResource("MsgRtrApi.properties").getFile()));
44 public void tearDown() throws Exception {
48 public void testSendPeriodically() {
50 DMaaPMetricsSender sender = new DMaaPMetricsSender(null, "url", "testTopic");
52 sender.sendPeriodically(null, null, "testTopic");
53 } catch (org.json.JSONException e) {
54 // TODO Auto-generated catch block
56 } catch (NullPointerException e) {
57 // TODO Auto-generated catch block
58 //e.printStackTrace();
60 } catch (NoClassDefFoundError e) {
61 // TODO Auto-generated catch block
62 //e.printStackTrace();
66 String trueValue = "True";
67 assertTrue(trueValue.equalsIgnoreCase("True"));
72 public void testSendPeriodically2() {
74 DMaaPMetricsSender sender = new DMaaPMetricsSender(null, "url", "testTopic");
76 sender.sendPeriodically(null, null, "url", "testTopic", 2);
77 } catch (org.json.JSONException e) {
78 // TODO Auto-generated catch block
80 } catch (NullPointerException e) {
81 // TODO Auto-generated catch block
82 //e.printStackTrace();
86 String trueValue = "True";
87 assertTrue(trueValue.equalsIgnoreCase("True"));
92 public void testSend() {
94 DMaaPMetricsSender sender = new DMaaPMetricsSender(null, "url", "testTopic");
97 } catch (org.json.JSONException e) {
98 // TODO Auto-generated catch block
100 } catch (NullPointerException e) {
101 // TODO Auto-generated catch block
102 //e.printStackTrace();
106 String trueValue = "True";
107 assertTrue(trueValue.equalsIgnoreCase("True"));
112 public void testRun() {
114 DMaaPMetricsSender sender = new DMaaPMetricsSender(null, "url", "testTopic");
117 } catch (org.json.JSONException e) {
118 // TODO Auto-generated catch block
120 } catch (NullPointerException e) {
121 // TODO Auto-generated catch block
122 //e.printStackTrace();
126 String trueValue = "True";
127 assertTrue(trueValue.equalsIgnoreCase("True"));