Mohamed Abukar | 522d736 | 2020-11-25 09:41:01 +0200 | [diff] [blame^] | 1 | /* |
| 2 | ================================================================================== |
| 3 | Copyright (c) 2019 AT&T Intellectual Property. |
| 4 | Copyright (c) 2019 Nokia |
| 5 | |
| 6 | Licensed under the Apache License, Version 2.0 (the "License"); |
| 7 | you may not use this file except in compliance with the License. |
| 8 | You may obtain a copy of the License at |
| 9 | |
| 10 | http://www.apache.org/licenses/LICENSE-2.0 |
| 11 | |
| 12 | Unless required by applicable law or agreed to in writing, software |
| 13 | distributed under the License is distributed on an "AS IS" BASIS, |
| 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 15 | See the License for the specific language governing permissions and |
| 16 | limitations under the License. |
| 17 | ================================================================================== |
| 18 | */ |
| 19 | |
| 20 | package xapp |
| 21 | |
| 22 | import ( |
| 23 | "testing" |
| 24 | "github.com/stretchr/testify/assert" |
| 25 | |
| 26 | "gerrit.o-ran-sc.org/r/ric-plt/alarm-go.git/alarm" |
| 27 | ) |
| 28 | |
| 29 | func TestNewAlarmClient(t *testing.T) { |
| 30 | Logger.Info("TestNewAlarmClient") |
| 31 | |
| 32 | a := NewAlarmClient("", "") |
| 33 | assert.NotNil(t, a, "NewAlarmClient failed") |
| 34 | } |
| 35 | |
| 36 | func TestAlarmRaise(t *testing.T) { |
| 37 | Logger.Info("TestAlarmRaise") |
| 38 | |
| 39 | a := NewAlarmClient("", "") |
| 40 | assert.NotNil(t, a, "NewAlarmClient failed") |
| 41 | |
| 42 | a.Raise(1234, alarm.SeverityCritical, "Some App data", "eth 0 1") |
| 43 | } |
| 44 | |
| 45 | func TestAlarmClear(t *testing.T) { |
| 46 | Logger.Info("TestAlarmClear") |
| 47 | |
| 48 | a := NewAlarmClient("", "") |
| 49 | assert.NotNil(t, a, "NewAlarmClient failed") |
| 50 | |
| 51 | a.Clear(1234, alarm.SeverityCritical, "Some App data", "eth 0 1") |
| 52 | } |
| 53 | |
| 54 | func TestAlarmReraise(t *testing.T) { |
| 55 | Logger.Info("TestAlarmReraise") |
| 56 | |
| 57 | a := NewAlarmClient("", "") |
| 58 | assert.NotNil(t, a, "NewAlarmClient failed") |
| 59 | |
| 60 | a.Reraise(1234, alarm.SeverityCritical, "Some App data", "eth 0 1") |
| 61 | } |
| 62 | |
| 63 | func TestAlarmClearall(t *testing.T) { |
| 64 | Logger.Info("TestAlarmClearall") |
| 65 | |
| 66 | a := NewAlarmClient("", "") |
| 67 | assert.NotNil(t, a, "NewAlarmClient failed") |
| 68 | |
| 69 | a.ClearAll() |
| 70 | } |