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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
|
/*
* Copyright (C) 2017 CMCC, Inc. and others. All rights reserved.
*
* 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.
*/
package org.onap.usecaseui.server.controller;
import static org.mockito.Mockito.mock;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.onap.usecaseui.server.bean.AlarmsHeader;
import org.onap.usecaseui.server.bean.AlarmsInformation;
import org.onap.usecaseui.server.service.AlarmsHeaderService;
import org.onap.usecaseui.server.service.AlarmsInformationService;
import org.onap.usecaseui.server.util.Page;
public class AlarmControllerTest {
AlarmController controller = null;
AlarmsHeaderService service;
AlarmsInformationService alService;
@Before
public void before() throws Exception {
controller = new AlarmController();
service = mock(AlarmsHeaderService.class);
alService = mock(AlarmsInformationService.class);
controller.setAlarmsHeaderService(service);
controller.setAlarmsInformationService(alService);
}
@After
public void after() throws Exception {
}
@Test
public void testIndex() throws Exception {
controller.index();
}
@Test
public void testGetAlarmData() throws Exception {
try {
controller.getAlarmData("sourceId", "sourceName", "priority", "startTime", "endTime", "vfStatus", 1, 10);
controller.getAlarmData(null, null, null, null, null, null, 1, 10);
} catch (Exception e) {
e.printStackTrace();
}
}
@Test
public void testGetSourceId() throws Exception {
try {
controller.getSourceId();
} catch (Exception e) {
e.printStackTrace();
}
}
@Test
public void testGenDiagram() throws Exception {
try {
controller.diagram("sourceId", "2018-5-24 14:58:29", "2018-5-25 14:58:29", "day");
controller.diagram("sourceId", "2018-5-24 14:58:29", "2018-5-25 14:58:29", "hour");
controller.diagram("sourceId", "2018-5-24 14:58:29", "2018-5-25 14:58:29","month");
} catch (Exception e) {
e.printStackTrace();
}
}
@Test
public void testStatusCount() throws Exception {
try {
controller.getStatusCount();
} catch (Exception e) {
e.printStackTrace();
}
}
@Test
public void testGetAlarmsHeaderDetail() throws Exception {
try {
controller.getAlarmsHeaderDetail("33a8353381bb4e8fabbc739f9f7e02bf");
} catch (Exception e) {
e.printStackTrace();
}
}
}
|