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
10 * http://www.apache.org/licenses/LICENSE-2.0
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
16 * ============LICENSE_END==========================================================================
18 package org.oransc.oam.features.devicemanager.gran.test;
20 import static org.junit.Assert.*;
21 import static org.mockito.Mockito.mock;
22 import static org.mockito.Mockito.when;
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;
33 public class TestGRanNetworkElementFactory {
35 Capabilities capabilities;
36 NetconfAccessor netconfAccessor;
37 DeviceManagerServiceProvider devMgrService;
39 @SuppressWarnings("unused")
42 capabilities = mock(Capabilities.class);
43 netconfAccessor = mock(NetconfAccessor.class);
44 devMgrService = mock(DeviceManagerServiceProvider.class);
46 when(netconfAccessor.getCapabilites()).thenReturn(capabilities);
47 when(devMgrService.getDataProvider()).thenReturn(null);
52 public void testCreate() throws Exception {
53 when(netconfAccessor.getCapabilites().isSupportingNamespace(TopGrp.QNAME)).thenReturn(true);
55 GRanNetworkElementFactory gRanNeFactory = new GRanNetworkElementFactory();
56 assertTrue((gRanNeFactory.create(netconfAccessor, devMgrService)).isPresent());
60 public void testCreateNone() throws Exception {
61 when(netconfAccessor.getCapabilites().isSupportingNamespace(TopGrp.QNAME)).thenReturn(false);
63 GRanNetworkElementFactory gRanNeFactory = new GRanNetworkElementFactory();
64 assertTrue(!(gRanNeFactory.create(netconfAccessor, devMgrService).isPresent()));