Take golog v0.0.2 into use
Change-Id: Ie73e96da2146b38581ab58c07a29927a6e6edc98
Signed-off-by: Mohamed Abukar <abukar.mohamed@nokia.com>
diff --git a/pkg/xapp/alarm_test.go b/pkg/xapp/alarm_test.go
new file mode 100755
index 0000000..b72c319
--- /dev/null
+++ b/pkg/xapp/alarm_test.go
@@ -0,0 +1,70 @@
+/*
+==================================================================================
+ Copyright (c) 2019 AT&T Intellectual Property.
+ Copyright (c) 2019 Nokia
+
+ 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 xapp
+
+import (
+ "testing"
+ "github.com/stretchr/testify/assert"
+
+ "gerrit.o-ran-sc.org/r/ric-plt/alarm-go.git/alarm"
+)
+
+func TestNewAlarmClient(t *testing.T) {
+ Logger.Info("TestNewAlarmClient")
+
+ a := NewAlarmClient("", "")
+ assert.NotNil(t, a, "NewAlarmClient failed")
+}
+
+func TestAlarmRaise(t *testing.T) {
+ Logger.Info("TestAlarmRaise")
+
+ a := NewAlarmClient("", "")
+ assert.NotNil(t, a, "NewAlarmClient failed")
+
+ a.Raise(1234, alarm.SeverityCritical, "Some App data", "eth 0 1")
+}
+
+func TestAlarmClear(t *testing.T) {
+ Logger.Info("TestAlarmClear")
+
+ a := NewAlarmClient("", "")
+ assert.NotNil(t, a, "NewAlarmClient failed")
+
+ a.Clear(1234, alarm.SeverityCritical, "Some App data", "eth 0 1")
+}
+
+func TestAlarmReraise(t *testing.T) {
+ Logger.Info("TestAlarmReraise")
+
+ a := NewAlarmClient("", "")
+ assert.NotNil(t, a, "NewAlarmClient failed")
+
+ a.Reraise(1234, alarm.SeverityCritical, "Some App data", "eth 0 1")
+}
+
+func TestAlarmClearall(t *testing.T) {
+ Logger.Info("TestAlarmClearall")
+
+ a := NewAlarmClient("", "")
+ assert.NotNil(t, a, "NewAlarmClient failed")
+
+ a.ClearAll()
+}
\ No newline at end of file
diff --git a/pkg/xapp/logger.go b/pkg/xapp/logger.go
index 5009354..69bed09 100755
--- a/pkg/xapp/logger.go
+++ b/pkg/xapp/logger.go
@@ -36,6 +36,10 @@
}
}
+func (l *Log) SetFormat(logMonitor int) {
+ l.logger.Mdclog_format_initialize(logMonitor)
+}
+
func (l *Log) SetLevel(level int) {
l.logger.LevelSet(mdclog.Level(level))
}
diff --git a/pkg/xapp/xapp.go b/pkg/xapp/xapp.go
index a9a130e..1ab7ee0 100755
--- a/pkg/xapp/xapp.go
+++ b/pkg/xapp/xapp.go
@@ -128,6 +128,8 @@
} else {
Logger.SetLevel(viper.GetInt("logger.level"))
}
+ Logger.SetFormat(0)
+
Resource = NewRouter()
Config = Configurator{}
Metric = NewMetrics(viper.GetString("metrics.url"), viper.GetString("metrics.namespace"), Resource.router)