Released Version 1.4.7
[holmes/common.git] / holmes-actions / src / test / java / org / onap / holmes / common / api / stat / VesAlarmTest.java
1 /*
2  * Copyright 2017 ZTE Corporation.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17 package org.onap.holmes.common.api.stat;
18
19 import static org.hamcrest.core.IsEqual.equalTo;
20 import static org.junit.Assert.*;
21
22 import java.util.Map;
23 import java.util.HashMap;
24 import java.util.TimeZone;
25 import org.junit.Test;
26
27 public class VesAlarmTest {
28
29     @Test
30     public void hashCodeTest() throws Exception {
31         VesAlarm alarm = new VesAlarm();
32         alarm.setEventName("unique");
33         alarm.setSourceId("123");
34         VesAlarm alarmClone = (VesAlarm)alarm.clone();
35         assertTrue(alarm.hashCode() == alarmClone.hashCode());
36     }
37
38     @Test
39     public void equalsTest() throws Exception {
40         VesAlarm alarm = new VesAlarm();
41         alarm.setEventName("unique");
42         alarm.setSourceId("123");
43         VesAlarm alarmClone = (VesAlarm)alarm.clone();
44         assertTrue(alarm.equals(alarmClone));
45     }
46
47     @Test
48     public void cloneTest() throws Exception {
49         VesAlarm alarm = new VesAlarm();
50         alarm.setDomain("Test");
51         alarm.setEventName("unique");
52         alarm.setSourceId("123");
53         assertThat(alarm, equalTo(alarm.clone()));
54     }
55
56     @Test
57     public void getterAndSetterTest() {
58         VesAlarm alarm = new VesAlarm();
59         alarm.setDomain("");
60         alarm.setEventId("");
61         alarm.setEventName("");
62         alarm.setEventType("");
63         alarm.setInternalHeaderFields(new Object());
64         alarm.setLastEpochMicrosec(0L);
65         alarm.setNfcNamingCode("");
66         alarm.setNfNamingCode("");
67         alarm.setPriority("");
68         alarm.setReportingEntityId("");
69         alarm.setReportingEntityName("");
70         alarm.setSequence(1);
71         alarm.setSourceId("");
72         alarm.setSourceName("");
73         alarm.setStartEpochMicrosec(0L);
74         alarm.setVersion("0");
75         alarm.setAlarmAdditionalInformation(new HashMap<>());
76         alarm.setAlarmCondition("");
77         alarm.setAlarmInterfaceA("");
78         alarm.setEventCategory("");
79         alarm.setEventSeverity("");
80         alarm.setEventSourceType("");
81         alarm.setFaultFieldsVersion("0");
82         alarm.setSpecificProblem("");
83         alarm.setVfStatus("");
84         TimeZone offtime_zone = TimeZone.getTimeZone("Europe/Rome");
85         alarm.setTimeZoneOffset(offtime_zone);
86         alarm.setNfVendorName("");
87         alarm.setVesEventListenerVersion("0");
88
89         alarm.getDomain();
90         alarm.getEventId();
91         alarm.getEventName();
92         alarm.getEventType();
93         alarm.getInternalHeaderFields();
94         alarm.getLastEpochMicrosec();
95         alarm.getNfcNamingCode();
96         alarm.getNfNamingCode();
97         alarm.getPriority();
98         alarm.getReportingEntityId();
99         alarm.getReportingEntityName();
100         alarm.getSequence();
101         alarm.getSourceId();
102         alarm.getSourceName();
103         alarm.getStartEpochMicrosec();
104         alarm.getVersion();
105         alarm.getAlarmAdditionalInformation();
106         alarm.getAlarmCondition();
107         alarm.getAlarmInterfaceA();
108         alarm.getEventCategory();
109         alarm.getEventSeverity();
110         alarm.getEventSourceType();
111         alarm.getFaultFieldsVersion();
112         alarm.getSpecificProblem();
113         alarm.getVfStatus();
114     }
115
116 }