2 * ============LICENSE_START=======================================================
3 * ONAP : ccsdk features
4 * ================================================================================
5 * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property.
7 * ================================================================================
8 * Update Copyright (C) 2020 AT&T Intellectual Property. All rights reserved.
9 * ================================================================================
10 * Licensed under the Apache License, Version 2.0 (the "License");
11 * you may not use this file except in compliance with the License.
12 * You may obtain a copy of the License at
14 * http://www.apache.org/licenses/LICENSE-2.0
16 * Unless required by applicable law or agreed to in writing, software
17 * distributed under the License is distributed on an "AS IS" BASIS,
18 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19 * See the License for the specific language governing permissions and
20 * limitations under the License.
21 * ============LICENSE_END=======================================================
24 package org.onap.ccsdk.features.sdnr.wt.mountpointstateprovider.test;
27 import static org.mockito.Mockito.mock;
28 import static org.mockito.Mockito.when;
29 import org.json.JSONObject;
30 import org.junit.After;
31 import org.junit.Before;
32 import org.junit.Test;
33 import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.DeviceManagerServiceProvider;
34 import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.NetconfNetworkElementService;
35 import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.VESCollectorCfgService;
36 import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.VESCollectorService;
37 import org.onap.ccsdk.features.sdnr.wt.mountpointstateprovider.impl.MountpointStatePublisher;
39 public class TestMountpointStatePublisher {
41 MountpointStatePublisher mountpointStatePublisher;
42 VESCollectorService vesCollectorService;
43 VESCollectorCfgService vesCfg;
45 JSONObject testJsonData;
48 public void testMountpointStatePublisherData() {
49 testJsonData = new JSONObject();
50 testJsonData.put("NodeId", "69322972e178_50001");
51 testJsonData.put("NetConfNodeState", "Connecting");
52 testJsonData.put("TimeStamp", java.time.Clock.systemUTC().instant());
55 DeviceManagerServiceProvider serviceProvider = mock(DeviceManagerServiceProvider.class);
56 vesCollectorService = mock(VESCollectorService.class);
57 vesCfg = mock(VESCollectorCfgService.class);
58 NetconfNetworkElementService netconfNetworkElementService = mock(NetconfNetworkElementService.class);
59 when(netconfNetworkElementService.getServiceProvider()).thenReturn(serviceProvider);
60 when(serviceProvider.getVESCollectorService()).thenReturn(vesCollectorService);
61 when(vesCollectorService.getConfig()).thenReturn(vesCfg);
62 when(vesCfg.getReportingEntityName()).thenReturn("ONAP SDN-R");
63 when(vesCollectorService.publishVESMessage(vesMsg)).thenReturn(true);
65 mountpointStatePublisher = new MountpointStatePublisher(vesCollectorService);
66 mountpointStatePublisher.addToPublish(testJsonData);
67 //mountpointStatePublisher.getStateObjects().add(testJsonData);
71 public void testMountpointStatePublisherConfiguration() throws InterruptedException {
72 Thread t = new Thread(mountpointStatePublisher);
79 mountpointStatePublisher.stop();