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;
26 import com.att.ajsc.filemonitor.AJSCPropertiesMap;
28 import org.junit.After;
29 import org.junit.Before;
30 import org.junit.Test;
32 public class DMaaPMetricsSenderTest {
35 public void setUp() throws Exception {
36 ClassLoader classLoader = getClass().getClassLoader();
37 AJSCPropertiesMap.refresh(new File(classLoader.getResource("MsgRtrApi.properties").getFile()));
41 public void tearDown() throws Exception {
45 public void testSendPeriodically() {
47 DMaaPMetricsSender sender = new DMaaPMetricsSender(null, "url", "testTopic");
49 sender.sendPeriodically(null, null, "testTopic");
50 } catch (org.json.JSONException e) {
51 // TODO Auto-generated catch block
53 } catch (NullPointerException e) {
54 // TODO Auto-generated catch block
55 //e.printStackTrace();
57 } catch (NoClassDefFoundError e) {
58 // TODO Auto-generated catch block
59 //e.printStackTrace();
63 String trueValue = "True";
64 assertTrue(trueValue.equalsIgnoreCase("True"));
69 public void testSendPeriodically2() {
71 DMaaPMetricsSender sender = new DMaaPMetricsSender(null, "url", "testTopic");
73 sender.sendPeriodically(null, null, "url", "testTopic", 2);
74 } catch (org.json.JSONException e) {
75 // TODO Auto-generated catch block
77 } catch (NullPointerException e) {
78 // TODO Auto-generated catch block
79 //e.printStackTrace();
83 String trueValue = "True";
84 assertTrue(trueValue.equalsIgnoreCase("True"));
89 public void testSend() {
91 DMaaPMetricsSender sender = new DMaaPMetricsSender(null, "url", "testTopic");
94 } catch (org.json.JSONException e) {
95 // TODO Auto-generated catch block
97 } catch (NullPointerException e) {
98 // TODO Auto-generated catch block
99 //e.printStackTrace();
103 String trueValue = "True";
104 assertTrue(trueValue.equalsIgnoreCase("True"));
109 public void testRun() {
111 DMaaPMetricsSender sender = new DMaaPMetricsSender(null, "url", "testTopic");
114 } catch (org.json.JSONException e) {
115 // TODO Auto-generated catch block
117 } catch (NullPointerException e) {
118 // TODO Auto-generated catch block
119 //e.printStackTrace();
123 String trueValue = "True";
124 assertTrue(trueValue.equalsIgnoreCase("True"));