2 * Copyright 2017 ZTE Corporation.
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
17 package org.onap.holmes.common.api.stat;
19 import static org.hamcrest.core.IsEqual.equalTo;
20 import static org.junit.Assert.*;
23 import java.util.HashMap;
24 import java.util.TimeZone;
25 import org.junit.Test;
27 public class VesAlarmTest {
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());
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));
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()));
57 public void getterAndSetterTest() {
58 VesAlarm alarm = new VesAlarm();
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("");
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");
93 alarm.getInternalHeaderFields();
94 alarm.getLastEpochMicrosec();
95 alarm.getNfcNamingCode();
96 alarm.getNfNamingCode();
98 alarm.getReportingEntityId();
99 alarm.getReportingEntityName();
102 alarm.getSourceName();
103 alarm.getStartEpochMicrosec();
105 alarm.getAlarmAdditionalInformation();
106 alarm.getAlarmCondition();
107 alarm.getAlarmInterfaceA();
108 alarm.getEventCategory();
109 alarm.getEventSeverity();
110 alarm.getEventSourceType();
111 alarm.getFaultFieldsVersion();
112 alarm.getSpecificProblem();