96eb505844f9fa8d83743bc7ab6837fc3b6cc8e9
[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.Matchers.any;
12 import static org.mockito.Mockito.doReturn;
13
14 import akka.actor.ActorRef;
15 import akka.util.Timeout;
16 import com.google.common.util.concurrent.Futures;
17 import org.opendaylight.controller.md.sal.dom.api.DOMMountPointService;
18 import org.opendaylight.netconf.sal.connect.api.RemoteDeviceHandler;
19 import org.opendaylight.netconf.sal.connect.netconf.listener.NetconfDeviceCommunicator;
20 import org.opendaylight.netconf.sal.connect.util.RemoteDeviceId;
21 import org.opendaylight.netconf.topology.singleton.impl.utils.NetconfConnectorDTO;
22 import org.opendaylight.netconf.topology.singleton.impl.utils.NetconfTopologySetup;
23 import org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.node.topology.rev150114.NetconfNode;
24 import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId;
25
26 class TestingRemoteDeviceConnectorImpl extends RemoteDeviceConnectorImpl {
27
28     private final NetconfDeviceCommunicator communicator;
29     private final RemoteDeviceHandler salFacade;
30
31     TestingRemoteDeviceConnectorImpl(final NetconfTopologySetup netconfTopologyDeviceSetup,
32                                      final RemoteDeviceId remoteDeviceId,
33                                      final NetconfDeviceCommunicator communicator,
34                                      final RemoteDeviceHandler salFacade,
35                                      final Timeout actorResponseWaitTime,
36                                      final DOMMountPointService mountPointService) {
37         super(netconfTopologyDeviceSetup, remoteDeviceId, actorResponseWaitTime, mountPointService);
38         this.communicator = communicator;
39         this.salFacade = salFacade;
40     }
41
42     @Override
43     public NetconfConnectorDTO createDeviceCommunicator(final NodeId nodeId, final NetconfNode node,
44                                                         final ActorRef deviceContextActorRef) {
45         final NetconfConnectorDTO connectorDTO = new NetconfConnectorDTO(communicator, salFacade);
46         doReturn(Futures.immediateCheckedFuture(null)).when(communicator).initializeRemoteConnection(any(), any());
47         return connectorDTO;
48     }
49
50 }