*/
package org.opendaylight.netconf.callhome.mount;
-import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertThrows;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.verify;
import io.netty.util.concurrent.EventExecutor;
-import io.netty.util.concurrent.Future;
import java.net.InetSocketAddress;
import java.net.UnknownHostException;
+import java.util.concurrent.ExecutionException;
import org.junit.Before;
import org.junit.Test;
import org.opendaylight.controller.config.threadpool.ScheduledThreadPool;
import org.opendaylight.netconf.api.messages.NetconfHelloMessageAdditionalHeader;
import org.opendaylight.netconf.callhome.protocol.CallHomeChannelActivator;
import org.opendaylight.netconf.callhome.protocol.CallHomeProtocolSessionContext;
-import org.opendaylight.netconf.client.NetconfClientSession;
import org.opendaylight.netconf.client.NetconfClientSessionListener;
import org.opendaylight.netconf.client.conf.NetconfClientConfiguration;
import org.opendaylight.netconf.client.conf.NetconfClientConfigurationBuilder;
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;
-public class CallHomeMountDispatcherTest {
+public class CallHomeMountFactoryTest {
private String topologyId;
private EventExecutor mockExecutor;
private ScheduledThreadPool mockKeepAlive;
private ThreadPool mockProcessingExecutor;
private SchemaResourceManager mockSchemaRepoProvider;
- private CallHomeMountDispatcher instance;
+ private CallHomeMountFactory instance;
private DataBroker mockDataBroker;
private DOMMountPointService mockMount;
mockBuilderFactory = mock(NetconfClientConfigurationBuilderFactory .class);
mockBaseSchemas = mock(BaseNetconfSchemas.class);
- instance = new CallHomeMountDispatcher(topologyId, mockExecutor, mockKeepAlive,
+ instance = new CallHomeMountFactory(topologyId, mockExecutor, mockKeepAlive,
mockProcessingExecutor, mockSchemaRepoProvider, mockBaseSchemas, mockDataBroker, mockMount,
mockBuilderFactory) {
@Override
}
@Test
- public void noSessionIsCreatedWithoutAContextAvailableForAGivenAddress() {
+ public void noSessionIsCreatedWithoutAContextAvailableForAGivenAddress() throws Exception {
// given
final InetSocketAddress someAddress = InetSocketAddress.createUnresolved("1.2.3.4", 123);
final NetconfClientConfiguration someCfg = someConfiguration(someAddress);
// when
- final Future<NetconfClientSession> future = instance.createClient(someCfg);
+ final var future = instance.createClient(someCfg);
// then
- assertFalse(future.isSuccess());
+ assertNotNull(future);
+ assertThrows(ExecutionException.class, future::get);
}
@Test