Search in sources :

Example 1 with NetconfServiceFailedException

use of org.opendaylight.netconf.topology.singleton.impl.netconf.NetconfServiceFailedException in project netconf by opendaylight.

the class NetconfDataTreeServiceActorTest method testCommitFail.

@Test
public void testCommitFail() {
    final RpcError rpcError = RpcResultBuilder.newError(RpcError.ErrorType.APPLICATION, "fail", "fail");
    final TransactionCommitFailedException failure = new TransactionCommitFailedException("fail", rpcError);
    final NetconfServiceFailedException cause = new NetconfServiceFailedException(String.format("%s: Commit of operation failed", 1), failure);
    when(netconfService.commit()).thenReturn(FluentFutures.immediateFailedFluentFuture(cause));
    actorRef.tell(new CommitRequest(), probe.ref());
    verify(netconfService).commit();
    final Status.Failure response = probe.expectMsgClass(Status.Failure.class);
    assertEquals(cause, response.cause());
}
Also used : CommitRequest(org.opendaylight.netconf.topology.singleton.messages.netconf.CommitRequest) Status(akka.actor.Status) TransactionCommitFailedException(org.opendaylight.mdsal.common.api.TransactionCommitFailedException) NetconfServiceFailedException(org.opendaylight.netconf.topology.singleton.impl.netconf.NetconfServiceFailedException) RpcError(org.opendaylight.yangtools.yang.common.RpcError) Test(org.junit.Test)

Aggregations

Status (akka.actor.Status)1 Test (org.junit.Test)1 TransactionCommitFailedException (org.opendaylight.mdsal.common.api.TransactionCommitFailedException)1 NetconfServiceFailedException (org.opendaylight.netconf.topology.singleton.impl.netconf.NetconfServiceFailedException)1 CommitRequest (org.opendaylight.netconf.topology.singleton.messages.netconf.CommitRequest)1 RpcError (org.opendaylight.yangtools.yang.common.RpcError)1