package xapp
import (
+ "bytes"
"github.com/gorilla/mux"
"github.com/spf13/viper"
+ "github.com/stretchr/testify/assert"
"net/http"
"net/http/httptest"
- "github.com/stretchr/testify/assert"
"os"
"strings"
"testing"
"time"
- "bytes"
)
//var _ = func() bool {
params.Payload = []byte{1, 2, 3, 4, 5, 6}
params.Meid = &RMRMeid{PlmnID: "1234", EnbID: "7788", RanName: "RanName-1234"}
params.Xid = "TestXID"
-
- if i % 2 == 0 {
+
+ if i%2 == 0 {
Rmr.SendMsg(params)
} else {
Rmr.SendWithRetry(params, false, 1)
func TestConfigAccess(t *testing.T) {
Logger.Info("CASE: AddConfigChangeListener")
-
- assert.Equal(t, Config.GetString("name"), "xapp")
- assert.Equal(t, Config.GetInt("controls.logger.level"), 3)
- assert.Equal(t, Config.GetUint32("controls.logger.level"), uint32(3))
- assert.Equal(t, Config.GetBool("controls.waitForSdl"), false)
+
+ assert.Equal(t, Config.GetString("name"), "xapp")
+ assert.Equal(t, Config.GetInt("controls.logger.level"), 3)
+ assert.Equal(t, Config.GetUint32("controls.logger.level"), uint32(3))
+ assert.Equal(t, Config.GetBool("controls.waitForSdl"), false)
Config.Get("controls")
Config.GetStringSlice("messaging.ports")
Config.GetStringMap("messaging.ports")
}
func TestNewRMRClient(t *testing.T) {
- c := map[string]interface{} {"protPort": "tcp:4560"}
+ c := map[string]interface{}{"protPort": "tcp:4560"}
viper.Set("rmr", c)
assert.NotNil(t, NewRMRClient(), "NewRMRClient failed")
executeRequest(req, handleFunc)
}
+func TestappconfigHandler(t *testing.T) {
+ Logger.Error("CASE: TestappconfigHandler")
+ req, _ := http.NewRequest("POST", "/ric/v1/config", bytes.NewBuffer([]byte{}))
+ handleFunc := http.HandlerFunc(appconfigHandler)
+ executeRequest(req, handleFunc)
+}
+
+func TestSendRegistermsg(t *testing.T) {
+ Logger.Error("CASE: TestSendRegistermsg")
+ SendRegistermsg()
+}
+
+func TestSendDeregistermsg(t *testing.T) {
+ Logger.Error("CASE: TestSendDeregistermsg")
+ SendDeregistermsg()
+}
+
func TestMisc(t *testing.T) {
Logger.Info("CASE: TestMisc")