X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;ds=sidebyside;f=pkg%2Fcontrol%2Fut_stub_rtmgr_test.go;h=59467dcdff92b57c6c7f8078692d87d3c2975cd4;hb=83ada00338d2c9fa47d48c406b4a46b9d7888aff;hp=bdca2931c27bf4a38df0b626ed65f49e08d0d561;hpb=fa0156680b0bd8f7300f49c65d2ee7bedaaa0e44;p=ric-plt%2Fsubmgr.git diff --git a/pkg/control/ut_stub_rtmgr_test.go b/pkg/control/ut_stub_rtmgr_test.go index bdca293..59467dc 100644 --- a/pkg/control/ut_stub_rtmgr_test.go +++ b/pkg/control/ut_stub_rtmgr_test.go @@ -84,12 +84,22 @@ func (hc *testingHttpRtmgrStub) http_handler(w http.ResponseWriter, r *http.Requ hc.Lock() defer hc.Unlock() - var req rtmgr_models.XappSubscriptionData - err := json.NewDecoder(r.Body).Decode(&req) - if err != nil { - xapp.Logger.Error("%s", err.Error()) + if r.Method == http.MethodPost || r.Method == http.MethodDelete { + var req rtmgr_models.XappSubscriptionData + err := json.NewDecoder(r.Body).Decode(&req) + if err != nil { + xapp.Logger.Error("%s", err.Error()) + } + xapp.Logger.Info("(%s) handling SubscriptionID=%d Address=%s Port=%d", hc.desc, *req.SubscriptionID, *req.Address, *req.Port) + } + if r.Method == http.MethodPut { + var req rtmgr_models.XappList + err := json.NewDecoder(r.Body).Decode(&req) + if err != nil { + xapp.Logger.Error("%s", err.Error()) + } + xapp.Logger.Info("(%s) handling put", hc.desc) } - xapp.Logger.Info("(%s) handling Address=%s Port=%d SubscriptionID=%d", hc.desc, *req.Address, *req.Port, *req.SubscriptionID) var code int = 0 switch r.Method { @@ -107,6 +117,13 @@ func (hc *testingHttpRtmgrStub) http_handler(w http.ResponseWriter, r *http.Requ code = 400 } } + case http.MethodPut: + code = 201 + if hc.eventWaiter != nil { + if hc.eventWaiter.nextActionOk == false { + code = 400 + } + } default: code = 200 }