[RICPLT-2146] Remove E2Sessions......
[ric-plt/e2mgr.git] / E2Manager / handlers / rmrmsghandlers / endc_configuration_update_handler_test.go
1 //
2 // Copyright 2019 AT&T Intellectual Property
3 // Copyright 2019 Nokia
4 //
5 // Licensed under the Apache License, Version 2.0 (the "License");
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
8 //
9 //      http://www.apache.org/licenses/LICENSE-2.0
10 //
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
16 //
17 package rmrmsghandlers
18
19 import (
20         "e2mgr/logger"
21         "e2mgr/models"
22         "e2mgr/rmrCgo"
23         "e2mgr/tests"
24         "github.com/stretchr/testify/assert"
25         "testing"
26         "time"
27 )
28
29 func TestHandleSuccessEndcConfigUpdate(t *testing.T) {
30         /*      log, err := logger.InitLogger(logger.InfoLevel)
31                 if err!=nil{
32                         t.Errorf("#endc_configuration_update_handler_test.TestHandleSuccessEndcConfigUpdate - failed to initialize logger, error: %s", err)
33                 }
34                 h := EndcConfigurationUpdateHandler{}
35
36                 payload := tests.GetPackedPayload(t)
37                 mBuf := rmrCgo.NewMBuf(10370, len(payload),"RanName", &payload, &tests.DummyXAction)
38                 notificationRequest := models.NotificationRequest{RanName: mBuf.Meid, Len: mBuf.Len, Payload: *mBuf.Payload, StartTime: time.Now()}
39                 messageChannel := make(chan *models.NotificationResponse)
40
41                 go h.Handle(log, &notificationRequest, messageChannel)
42
43                 response := <-messageChannel
44
45                 assert.NotEmpty(t, response)
46                 assert.EqualValues(t, 10371, response.MgsType)
47                 assert.True(t, len(response.Payload) > 0)*/
48 }
49
50 func TestHandleFailureEndcConfigUpdate(t *testing.T) {
51         log, err := logger.InitLogger(logger.InfoLevel)
52         if err != nil {
53                 t.Errorf("#endc_configuration_update_handler_test.TestHandleFailureEndcConfigUpdate - failed to initialize logger, error: %s", err)
54         }
55         h := EndcConfigurationUpdateHandler{}
56
57         mBuf := rmrCgo.NewMBuf(tests.MessageType, 4, "RanName", &tests.DummyPayload, &tests.DummyXAction)
58         notificationRequest := models.NotificationRequest{RanName: mBuf.Meid, Len: mBuf.Len, Payload: *mBuf.Payload, StartTime: time.Now()}
59         messageChannel := make(chan *models.NotificationResponse)
60
61         go h.Handle(log, &notificationRequest, messageChannel)
62
63         response := <-messageChannel
64
65         assert.NotEmpty(t, response)
66         assert.EqualValues(t, 10372, response.MgsType)
67         assert.True(t, len(response.Payload) > 0)
68 }