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.onap.ccsdk.features.sdnr.wt.devicemanager.adaptermanager.test;
20 import static org.junit.Assert.assertTrue;
21 import static org.mockito.Mockito.mock;
22 import static org.mockito.Mockito.when;
23 import java.io.IOException;
24 import org.junit.After;
25 import org.junit.BeforeClass;
26 import org.junit.Test;
27 import org.onap.ccsdk.features.sdnr.wt.devicemanager.adaptermanager.impl.AdapterManagerNetworkElementFactory;
28 import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.DeviceManagerServiceProvider;
29 import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.Capabilities;
30 import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.NetconfBindingAccessor;
31 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.network.topology.simulator.rev191025.SimulatorStatus;
32 import org.opendaylight.yangtools.yang.common.QName;
34 public class TestAdapterManagerNetworkElementFactory {
36 static NetconfBindingAccessor accessor;
37 static DeviceManagerServiceProvider serviceProvider;
38 static Capabilities capabilities;
42 public static void init() throws InterruptedException, IOException {
43 capabilities = mock(Capabilities.class);
44 accessor = mock(NetconfBindingAccessor.class);
45 serviceProvider = mock(DeviceManagerServiceProvider.class);
47 when(accessor.getCapabilites()).thenReturn(capabilities);
48 when(serviceProvider.getDataProvider()).thenReturn(null);
54 public void testCreateSimulator() throws Exception {
55 when(accessor.getCapabilites().isSupportingNamespace(SimulatorStatus.QNAME)).thenReturn(true);
56 AdapterManagerNetworkElementFactory factory = new AdapterManagerNetworkElementFactory();
57 assertTrue(factory.create(accessor, serviceProvider).isPresent());
61 public void testCreateNone() throws Exception {
62 when(accessor.getCapabilites().isSupportingNamespace(SimulatorStatus.QNAME)).thenReturn(false);
63 AdapterManagerNetworkElementFactory factory = new AdapterManagerNetworkElementFactory();
64 assertTrue(!(factory.create(accessor, serviceProvider).isPresent()));
68 public void cleanUp() throws Exception {