use of org.opendaylight.netconf.sal.connect.netconf.schema.mapping.SchemalessMessageTransformer in project netconf by opendaylight.
the class SchemalessNetconfDeviceTest method testSessionOnMethods.
@Test
public void testSessionOnMethods() throws Exception {
final RemoteDeviceHandler<NetconfSessionPreferences> facade = getFacade();
final NetconfDeviceCommunicator listener = mockCloseableClass(NetconfDeviceCommunicator.class);
final SchemalessMessageTransformer messageTransformer = mock(SchemalessMessageTransformer.class);
final RemoteDeviceId remoteDeviceId = new RemoteDeviceId("test-D", InetSocketAddress.createUnresolved("localhost", 22));
final Throwable throwable = new Throwable();
final SchemalessNetconfDevice device = new SchemalessNetconfDevice(BASE_SCHEMAS, remoteDeviceId, facade, messageTransformer);
final NetconfSessionPreferences sessionCaps = getSessionCaps(true, Lists.newArrayList(TEST_NAMESPACE + "?module=" + TEST_MODULE + "&revision=" + TEST_REVISION));
final NetconfMessage netconfMessage = mock(NetconfMessage.class);
device.onRemoteSessionUp(sessionCaps, listener);
verify(facade).onDeviceConnected(any(MountPointContext.class), any(NetconfSessionPreferences.class), any(DOMRpcService.class));
device.onNotification(netconfMessage);
verify(facade).onNotification(isNull());
device.onRemoteSessionDown();
verify(facade).onDeviceDisconnected();
device.onRemoteSessionFailed(throwable);
verify(facade).onDeviceFailed(throwable);
}
use of org.opendaylight.netconf.sal.connect.netconf.schema.mapping.SchemalessMessageTransformer in project netconf by opendaylight.
the class SchemalessNetconfDeviceRpcTest method setUp.
@Before
public void setUp() throws Exception {
RpcResult<NetconfMessage> msg = null;
ListenableFuture<RpcResult<NetconfMessage>> future = Futures.immediateFuture(msg);
doReturn(future).when(listener).sendRequest(any(), any());
final MessageCounter counter = new MessageCounter();
deviceRpc = new SchemalessNetconfDeviceRpc(new RemoteDeviceId("device1", InetSocketAddress.createUnresolved("0.0.0.0", 17830)), listener, new BaseRpcSchemalessTransformer(BASE_SCHEMAS, counter), new SchemalessMessageTransformer(counter));
}
Aggregations