Changing status to connected state after timeout.
[ric-plt/e2mgr.git] / E2Manager / handlers / httpmsghandlers / update_nodeb_request_handler_test.go
index ff4b9f8..26bf3a6 100644 (file)
@@ -1,20 +1,37 @@
-//
-// Copyright 2019 AT&T Intellectual Property
-// Copyright 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 httpmsghandlers
+
+import (
+    "e2mgr/configuration"
+    "e2mgr/managers"
+    "e2mgr/mocks"
+    "e2mgr/logger"
+    "e2mgr/models"
+    "e2mgr/services"
+ //   "gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/entities"
+    "github.com/stretchr/testify/assert"
+    "testing"
+)
+
+func setupUpdateNodebRequestHandlerTest(t *testing.T) ( *UpdateNodebRequestHandler,  *mocks.RnibReaderMock, *mocks.RnibWriterMock){
+        logger, err := logger.InitLogger(logger.DebugLevel)
+        if err != nil {
+                t.Errorf("#... - failed to initialize logger, error: %s", err)
+        }
+        config := &configuration.Configuration{RnibRetryIntervalMs: 10, MaxRnibConnectionAttempts: 3}
+        readerMock := &mocks.RnibReaderMock{}
+        writerMock := &mocks.RnibWriterMock{}
+        rnibDataService := services.NewRnibDataService(logger, config, readerMock, writerMock)
+        updateNodebManager := managers.IUpdateNodebManager(nil)
+        handler := NewUpdateNodebRequestHandler(logger,rnibDataService,updateNodebManager)
+        return handler,readerMock, writerMock
+
+}
+
+func TestGetRanName(t *testing.T) {
+        handler,_,_ := setupUpdateNodebRequestHandlerTest(t)
+        updateEnbRequest := models.UpdateEnbRequest{}
+        ret := handler.getRanName(updateEnbRequest)
+        assert.Equal(t, "", ret )
+}
 
-//  This source code is part of the near-RT RIC (RAN Intelligent Controller)
-//  platform project (RICP).
 
-package httpmsghandlers