Create VES client example for domain 'notification'
[oam.git] / features / devicemanager / g-ran / ru-fh / provider / src / test / java / org / oransc / oam / features / devicemanager / gran / test / TestGRanNetworkElementFactory.java
1 /*
2  * ============LICENSE_START========================================================================
3  * ONAP : ccsdk feature sdnr wt
4  * =================================================================================================
5  * Copyright (C) 2020 highstreet technologies GmbH Intellectual Property. All rights reserved.
6  * =================================================================================================
7  * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
8  * in compliance with the License. You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software distributed under the License
13  * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
14  * or implied. See the License for the specific language governing permissions and limitations under
15  * the License.
16  * ============LICENSE_END==========================================================================
17  */
18 package org.oransc.oam.features.devicemanager.gran.test;
19
20 import static org.junit.Assert.*;
21 import static org.mockito.Mockito.mock;
22 import static org.mockito.Mockito.when;
23
24 import org.junit.Before;
25 import org.junit.Test;
26 import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.DeviceManagerServiceProvider;
27 import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.Capabilities;
28 import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.NetconfAccessor;
29 import org.opendaylight.yang.gen.v1.urn._3gpp.tsg.sa5.nrm.top.rev180731.TopGrp;
30 import org.oransc.oam.features.devicemanager.gran.GRanNetworkElementFactory;
31
32
33 public class TestGRanNetworkElementFactory {
34
35     Capabilities capabilities;
36     NetconfAccessor netconfAccessor;
37     DeviceManagerServiceProvider devMgrService;
38
39     @SuppressWarnings("unused")
40     @Before
41     public void init() {
42         capabilities = mock(Capabilities.class);
43         netconfAccessor = mock(NetconfAccessor.class);
44         devMgrService = mock(DeviceManagerServiceProvider.class);
45
46         when(netconfAccessor.getCapabilites()).thenReturn(capabilities);
47         when(devMgrService.getDataProvider()).thenReturn(null);
48
49     }
50
51     @Test
52     public void testCreate() throws Exception {
53         when(netconfAccessor.getCapabilites().isSupportingNamespace(TopGrp.QNAME)).thenReturn(true);
54
55         GRanNetworkElementFactory gRanNeFactory = new GRanNetworkElementFactory();
56         assertTrue((gRanNeFactory.create(netconfAccessor, devMgrService)).isPresent());
57     }
58
59     @Test
60     public void testCreateNone() throws Exception {
61         when(netconfAccessor.getCapabilites().isSupportingNamespace(TopGrp.QNAME)).thenReturn(false);
62
63         GRanNetworkElementFactory gRanNeFactory = new GRanNetworkElementFactory();
64         assertTrue(!(gRanNeFactory.create(netconfAccessor, devMgrService).isPresent()));
65     }
66
67 }