Use base64 encoding for netconf device passwords
[netconf.git] / apps / netconf-topology-singleton / src / test / java / org / opendaylight / netconf / topology / singleton / impl / NetconfTopologyManagerTest.java
index 3827787b3c1ceea4487ebd0e5a05a46f875c1ac2..e7faaf16d0d61e3be698684b570f7c998a486a77 100644 (file)
@@ -25,14 +25,13 @@ import static org.opendaylight.mdsal.binding.api.DataObjectModification.Modifica
 
 import akka.actor.ActorSystem;
 import akka.util.Timeout;
-import io.netty.util.concurrent.EventExecutor;
+import io.netty.util.Timer;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 import java.util.Objects;
 import java.util.Set;
 import java.util.concurrent.ExecutorService;
-import java.util.concurrent.ScheduledExecutorService;
 import java.util.concurrent.TimeUnit;
 import java.util.function.Function;
 import org.junit.Before;
@@ -55,7 +54,7 @@ import org.opendaylight.mdsal.dom.api.DOMMountPointService;
 import org.opendaylight.mdsal.singleton.common.api.ClusterSingletonServiceProvider;
 import org.opendaylight.mdsal.singleton.common.api.ClusterSingletonServiceRegistration;
 import org.opendaylight.mdsal.singleton.common.api.ServiceGroupIdentifier;
-import org.opendaylight.netconf.client.NetconfClientDispatcher;
+import org.opendaylight.netconf.client.NetconfClientFactory;
 import org.opendaylight.netconf.client.mdsal.api.DeviceActionFactory;
 import org.opendaylight.netconf.client.mdsal.impl.DefaultSchemaResourceManager;
 import org.opendaylight.netconf.topology.singleton.impl.utils.NetconfTopologySetup;
@@ -65,8 +64,8 @@ import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.PortNumber;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.node.topology.rev221225.NetconfNode;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.node.topology.rev221225.NetconfNodeBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.node.topology.rev231121.NetconfNode;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.node.topology.rev231121.NetconfNodeBuilder;
 import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NetworkTopology;
 import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId;
 import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node;
@@ -81,7 +80,7 @@ import org.opendaylight.yangtools.yang.parser.impl.DefaultYangParserFactory;
 
 @RunWith(MockitoJUnitRunner.StrictStubs.class)
 public class NetconfTopologyManagerTest extends AbstractBaseSchemasTest {
-    private static final Uint16 ACTOR_RESPONSE_WAIT_TIME = Uint16.valueOf(10);
+    private static final Uint16 ACTOR_RESPONSE_WAIT_TIME = Uint16.TEN;
     private static final String TOPOLOGY_ID = "topologyID";
 
     private NetconfTopologyManager netconfTopologyManager;
@@ -92,6 +91,24 @@ public class NetconfTopologyManagerTest extends AbstractBaseSchemasTest {
     private ListenerRegistration<?> mockListenerReg;
     @Mock
     private Registration mockRpcReg;
+    @Mock
+    private Timer timer;
+    @Mock
+    private ExecutorService processingService;
+    @Mock
+    private ActorSystem actorSystem;
+    @Mock
+    private NetconfClientFactory clientFactory;
+    @Mock
+    private DOMMountPointService mountPointService;
+    @Mock
+    private AAAEncryptionService encryptionService;
+    @Mock
+    private DeviceActionFactory actionFactory;
+    @Mock
+    private RpcProviderService rpcProviderService;
+    @Mock
+    private NetconfClientConfigurationBuilderFactory builderFactory;
 
     private DataBroker dataBroker;
 
@@ -110,27 +127,14 @@ public class NetconfTopologyManagerTest extends AbstractBaseSchemasTest {
         dataBrokerTest.setup();
         dataBroker = spy(dataBrokerTest.getDataBroker());
 
-        final ScheduledExecutorService keepaliveExecutor = mock(ScheduledExecutorService.class);
-        final ExecutorService processingService = mock(ExecutorService.class);
-        final ActorSystem actorSystem = mock(ActorSystem.class);
-        final EventExecutor eventExecutor = mock(EventExecutor.class);
-        final NetconfClientDispatcher clientDispatcher = mock(NetconfClientDispatcher.class);
-        final DOMMountPointService mountPointService = mock(DOMMountPointService.class);
-        final AAAEncryptionService encryptionService = mock(AAAEncryptionService.class);
-        final DeviceActionFactory deviceActionFactory = mock(DeviceActionFactory.class);
-        final RpcProviderService rpcProviderService = mock(RpcProviderService.class);
-        final NetconfClientConfigurationBuilderFactory builderFactory =
-            mock(NetconfClientConfigurationBuilderFactory.class);
-
         doNothing().when(mockListenerReg).close();
         doReturn(mockListenerReg).when(dataBroker).registerDataTreeChangeListener(any(), any());
         doReturn(mockRpcReg).when(rpcProviderService).registerRpcImplementations(any());
 
         netconfTopologyManager = new NetconfTopologyManager(BASE_SCHEMAS, dataBroker, clusterSingletonServiceProvider,
-                keepaliveExecutor, processingService, actorSystem, eventExecutor, clientDispatcher,
-                mountPointService, encryptionService, rpcProviderService, deviceActionFactory,
-                new DefaultSchemaResourceManager(new DefaultYangParserFactory()), builderFactory,
-                TOPOLOGY_ID, Uint16.ZERO) {
+                timer, processingService, actorSystem, clientFactory, mountPointService, encryptionService,
+                rpcProviderService, actionFactory, new DefaultSchemaResourceManager(new DefaultYangParserFactory()),
+                builderFactory, TOPOLOGY_ID, Uint16.ZERO) {
             @Override
             protected NetconfTopologyContext newNetconfTopologyContext(final NetconfTopologySetup setup,
                 final ServiceGroupIdentifier serviceGroupIdent, final Timeout actorResponseWaitTime,