Supporting of reading subscriptions from subscription manager while restarting rtmgr
[ric-plt/rtmgr.git] / pkg / nbi / httpgetter_test.go
index a6cbbf7..0080a84 100644 (file)
    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.
+
+
+   This source code is part of the near-RT RIC (RAN Intelligent Controller)
+   platform project (RICP).
+
 ==================================================================================
 */
 /*
@@ -28,27 +33,24 @@ import (
        "net"
        "net/http"
        "net/http/httptest"
-       "routing-manager/pkg/rtmgr"
        "testing"
 )
 
 var (
-       XMURL string = "http://127.0.0.1:3000/ric/v1/xapps"
+       XMURL = "http://127.0.0.1:3000/ric/v1/xapps"
+       E2MURL = "http://127.0.0.1:8080/ric/v1/e2t/list"
 )
 
-
 func TestFetchXappListInvalidData(t *testing.T) {
        var httpGetter = NewHttpGetter()
-        _, err := httpGetter.FetchAllXapps(XMURL)
+       _, err := httpGetter.FetchAllXApps(XMURL)
        if err == nil {
-               t.Error("No XApp data received: "+err.Error())
+               t.Error("No XApp data received: " + err.Error())
        }
 }
 
-
 func TestFetchXappListWithInvalidData(t *testing.T) {
-       var expected int = 0
-       rtmgr.SetLogLevel("debug")
+       var expected = 0
        b := []byte(`{"ID":"deadbeef1234567890", "Version":0, "EventType":"all"}`)
        l, err := net.Listen("tcp", "127.0.0.1:3000")
        if err != nil {
@@ -70,7 +72,7 @@ func TestFetchXappListWithInvalidData(t *testing.T) {
        ts.Start()
        defer ts.Close()
        var httpGetter = NewHttpGetter()
-        xapplist, err := httpGetter.FetchAllXapps(XMURL)
+       xapplist, err := httpGetter.FetchAllXApps(XMURL)
        if err == nil {
                t.Error("Error occured: " + err.Error())
        } else {
@@ -81,8 +83,8 @@ func TestFetchXappListWithInvalidData(t *testing.T) {
        }
 }
 
-func TestFetchAllXappsWithValidData(t *testing.T) {
-       var expected int = 1
+func TestFetchAllXAppsWithValidData(t *testing.T) {
+       var expected = 1
        b := []byte(`[
  {
  "name":"xapp-01","status":"unknown","version":"1.2.3",
@@ -118,7 +120,7 @@ func TestFetchAllXappsWithValidData(t *testing.T) {
        ts.Start()
        defer ts.Close()
        var httpGetter = NewHttpGetter()
-       xapplist, err := httpGetter.FetchAllXapps(XMURL)
+       xapplist, err := httpGetter.FetchAllXApps(XMURL)
        if err != nil {
                t.Error("Error occured: " + err.Error())
        } else {
@@ -127,4 +129,3 @@ func TestFetchAllXappsWithValidData(t *testing.T) {
                }
        }
 }
-