X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=pkg%2Fxapp%2Fxapp_test.go;h=388d079717d61b6c4aa4a331a946a6101662f4b5;hb=3fd54d11c9f548f1ebea30133e5198eb49511e55;hp=04bbbb872d833141ba58ad798be6ff81e9ba59c2;hpb=c1f00b7d54ecd16ede9687b8cdb1d6517180e7c9;p=ric-plt%2Fxapp-frame.git diff --git a/pkg/xapp/xapp_test.go b/pkg/xapp/xapp_test.go index 04bbbb8..388d079 100755 --- a/pkg/xapp/xapp_test.go +++ b/pkg/xapp/xapp_test.go @@ -20,16 +20,16 @@ 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 { @@ -118,8 +118,8 @@ func TestMessagesReceivedSuccessfully(t *testing.T) { 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) @@ -332,11 +332,11 @@ func TestAddConfigChangeListener(t *testing.T) { 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") @@ -354,7 +354,7 @@ func TestNewSubscriber(t *testing.T) { } 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") @@ -423,6 +423,23 @@ func TestConfigHandler(t *testing.T) { 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 TestRegisterXapp(t *testing.T) { + Logger.Error("CASE: TestRegisterXapp") + doRegister() +} + +func TestDeregisterXapp(t *testing.T) { + Logger.Error("CASE: TestDeregisterXapp") + doDeregister() +} + func TestMisc(t *testing.T) { Logger.Info("CASE: TestMisc")