Search in sources :

Example 11 with NormalizedNodeMessage

use of org.opendaylight.netconf.topology.singleton.messages.NormalizedNodeMessage in project netconf by opendaylight.

the class WriteTransactionActorTestAdapter method testPut.

@Test
public void testPut() {
    final NormalizedNodeMessage normalizedNodeMessage = new NormalizedNodeMessage(PATH, NODE);
    actorRef.tell(new PutRequest(STORE, normalizedNodeMessage), probe.ref());
    verify(mockWriteTx).put(STORE, PATH, NODE);
}
Also used : NormalizedNodeMessage(org.opendaylight.netconf.topology.singleton.messages.NormalizedNodeMessage) PutRequest(org.opendaylight.netconf.topology.singleton.messages.transactions.PutRequest) Test(org.junit.Test)

Example 12 with NormalizedNodeMessage

use of org.opendaylight.netconf.topology.singleton.messages.NormalizedNodeMessage in project netconf by opendaylight.

the class ProxyNetconfServiceTest method testGetConfig.

@Test
public void testGetConfig() throws Exception {
    ProxyNetconfService netconf = newSuccessfulProxyNetconfService();
    final ListenableFuture<Optional<NormalizedNode>> getConfig = netconf.getConfig(PATH);
    final GetConfigRequest getRequest = masterActor.expectMsgClass(GetConfigRequest.class);
    assertEquals(PATH, getRequest.getPath());
    masterActor.reply(new NormalizedNodeMessage(PATH, node));
    final Optional<NormalizedNode> result = getConfig.get(5, TimeUnit.SECONDS);
    assertTrue(result.isPresent());
    assertEquals(node, result.get());
}
Also used : NormalizedNodeMessage(org.opendaylight.netconf.topology.singleton.messages.NormalizedNodeMessage) Optional(java.util.Optional) GetConfigRequest(org.opendaylight.netconf.topology.singleton.messages.netconf.GetConfigRequest) NormalizedNode(org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode) Test(org.junit.Test)

Example 13 with NormalizedNodeMessage

use of org.opendaylight.netconf.topology.singleton.messages.NormalizedNodeMessage in project netconf by opendaylight.

the class NetconfDataTreeServiceActorTest method testReplace.

@Test
public void testReplace() {
    doReturn(FluentFutures.immediateFluentFuture(new DefaultDOMRpcResult())).when(netconfService).replace(STORE, PATH, NODE, Optional.empty());
    final NormalizedNodeMessage node = new NormalizedNodeMessage(PATH, NODE);
    actorRef.tell(new ReplaceEditConfigRequest(STORE, node, null), probe.ref());
    verify(netconfService).replace(STORE, PATH, NODE, Optional.empty());
}
Also used : DefaultDOMRpcResult(org.opendaylight.mdsal.dom.spi.DefaultDOMRpcResult) NormalizedNodeMessage(org.opendaylight.netconf.topology.singleton.messages.NormalizedNodeMessage) ReplaceEditConfigRequest(org.opendaylight.netconf.topology.singleton.messages.netconf.ReplaceEditConfigRequest) Test(org.junit.Test)

Example 14 with NormalizedNodeMessage

use of org.opendaylight.netconf.topology.singleton.messages.NormalizedNodeMessage in project netconf by opendaylight.

the class NetconfDataTreeServiceActorTest method testCreate.

@Test
public void testCreate() {
    doReturn(FluentFutures.immediateFluentFuture(new DefaultDOMRpcResult())).when(netconfService).create(STORE, PATH, NODE, Optional.empty());
    final NormalizedNodeMessage node = new NormalizedNodeMessage(PATH, NODE);
    actorRef.tell(new CreateEditConfigRequest(STORE, node, null), probe.ref());
    verify(netconfService).create(STORE, PATH, NODE, Optional.empty());
}
Also used : DefaultDOMRpcResult(org.opendaylight.mdsal.dom.spi.DefaultDOMRpcResult) NormalizedNodeMessage(org.opendaylight.netconf.topology.singleton.messages.NormalizedNodeMessage) CreateEditConfigRequest(org.opendaylight.netconf.topology.singleton.messages.netconf.CreateEditConfigRequest) Test(org.junit.Test)

Example 15 with NormalizedNodeMessage

use of org.opendaylight.netconf.topology.singleton.messages.NormalizedNodeMessage in project netconf by opendaylight.

the class NetconfDataTreeServiceActorTest method testGet.

@Test
public void testGet() {
    doReturn(immediateFluentFuture(Optional.of(NODE))).when(netconfService).get(PATH);
    actorRef.tell(new GetRequest(PATH), probe.ref());
    verify(netconfService).get(PATH);
    final NormalizedNodeMessage response = probe.expectMsgClass(NormalizedNodeMessage.class);
    assertEquals(NODE, response.getNode());
}
Also used : NormalizedNodeMessage(org.opendaylight.netconf.topology.singleton.messages.NormalizedNodeMessage) GetRequest(org.opendaylight.netconf.topology.singleton.messages.netconf.GetRequest) Test(org.junit.Test)

Aggregations

NormalizedNodeMessage (org.opendaylight.netconf.topology.singleton.messages.NormalizedNodeMessage)20 Test (org.junit.Test)12 Optional (java.util.Optional)5 DefaultDOMRpcResult (org.opendaylight.mdsal.dom.spi.DefaultDOMRpcResult)4 MergeRequest (org.opendaylight.netconf.topology.singleton.messages.transactions.MergeRequest)3 PutRequest (org.opendaylight.netconf.topology.singleton.messages.transactions.PutRequest)3 ReadRequest (org.opendaylight.netconf.topology.singleton.messages.transactions.ReadRequest)3 NormalizedNode (org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode)3 CreateEditConfigRequest (org.opendaylight.netconf.topology.singleton.messages.netconf.CreateEditConfigRequest)2 GetConfigRequest (org.opendaylight.netconf.topology.singleton.messages.netconf.GetConfigRequest)2 GetRequest (org.opendaylight.netconf.topology.singleton.messages.netconf.GetRequest)2 MergeEditConfigRequest (org.opendaylight.netconf.topology.singleton.messages.netconf.MergeEditConfigRequest)2 ReplaceEditConfigRequest (org.opendaylight.netconf.topology.singleton.messages.netconf.ReplaceEditConfigRequest)2 Success (akka.actor.Status.Success)1 Collection (java.util.Collection)1 ReadFailedException (org.opendaylight.mdsal.common.api.ReadFailedException)1 DOMRpcResult (org.opendaylight.mdsal.dom.api.DOMRpcResult)1 ClusteringRpcException (org.opendaylight.netconf.topology.singleton.impl.utils.ClusteringRpcException)1 SchemaPathMessage (org.opendaylight.netconf.topology.singleton.messages.SchemaPathMessage)1 InvokeRpcMessage (org.opendaylight.netconf.topology.singleton.messages.rpc.InvokeRpcMessage)1