db23123968d02453bb7b4ed7c4fdf0271c64326c
[netconf.git] / netconf / netconf-topology-singleton / src / test / java / org / opendaylight / netconf / topology / singleton / impl / TestingRemoteDeviceConnectorImpl.java
1 /*
2  * Copyright (c) 2016 Cisco Systems, Inc. and others. All rights reserved.
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6  * and is available at http://www.eclipse.org/legal/epl-v10.html
7  */
8
9 package org.opendaylight.netconf.topology.singleton.impl;
10
11 import static org.mockito.ArgumentMatchers.any;
12 import static org.mockito.Mockito.doReturn;
13
14 import org.opendaylight.netconf.sal.connect.api.RemoteDeviceHandler;
15 import org.opendaylight.netconf.sal.connect.netconf.listener.NetconfDeviceCommunicator;
16 import org.opendaylight.netconf.sal.connect.netconf.listener.NetconfSessionPreferences;
17 import org.opendaylight.netconf.sal.connect.util.RemoteDeviceId;
18 import org.opendaylight.netconf.topology.singleton.impl.utils.NetconfConnectorDTO;
19 import org.opendaylight.netconf.topology.singleton.impl.utils.NetconfTopologySetup;
20 import org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.node.topology.rev150114.NetconfNode;
21 import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId;
22 import org.opendaylight.yangtools.util.concurrent.FluentFutures;
23
24 class TestingRemoteDeviceConnectorImpl extends RemoteDeviceConnectorImpl {
25
26     private final NetconfDeviceCommunicator communicator;
27
28     TestingRemoteDeviceConnectorImpl(final NetconfTopologySetup netconfTopologyDeviceSetup,
29                                      final RemoteDeviceId remoteDeviceId,
30                                      final NetconfDeviceCommunicator communicator) {
31         super(netconfTopologyDeviceSetup, remoteDeviceId);
32         this.communicator = communicator;
33     }
34
35     @Override
36     public NetconfConnectorDTO createDeviceCommunicator(final NodeId nodeId, final NetconfNode node,
37             RemoteDeviceHandler<NetconfSessionPreferences> salFacade) {
38         final NetconfConnectorDTO connectorDTO = new NetconfConnectorDTO(communicator, salFacade);
39         doReturn(FluentFutures.immediateNullFluentFuture()).when(communicator).initializeRemoteConnection(any(), any());
40         return connectorDTO;
41     }
42
43 }