Search in sources :

Example 1 with MergeRequest

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

the class WriteTransactionActorTestAdapter method testMerge.

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

Example 2 with MergeRequest

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

the class ProxyReadWriteTransactionTest method testMerge.

@Test
public void testMerge() {
    ProxyReadWriteTransaction tx = newSuccessfulProxyTx();
    tx.merge(STORE, PATH, node);
    final MergeRequest mergeRequest = masterActor.expectMsgClass(MergeRequest.class);
    assertEquals(STORE, mergeRequest.getStore());
    assertEquals(PATH, mergeRequest.getNormalizedNodeMessage().getIdentifier());
    assertEquals(node, mergeRequest.getNormalizedNodeMessage().getNode());
}
Also used : MergeRequest(org.opendaylight.netconf.topology.singleton.messages.transactions.MergeRequest) Test(org.junit.Test)

Example 3 with MergeRequest

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

the class ActorProxyTransactionFacade method merge.

@Override
public void merge(final LogicalDatastoreType store, final YangInstanceIdentifier path, final NormalizedNode data) {
    LOG.debug("{}: Merge {} {} via actor {}", id, store, path, masterTxActor);
    masterTxActor.tell(new MergeRequest(store, new NormalizedNodeMessage(path, data)), ActorRef.noSender());
}
Also used : MergeRequest(org.opendaylight.netconf.topology.singleton.messages.transactions.MergeRequest) NormalizedNodeMessage(org.opendaylight.netconf.topology.singleton.messages.NormalizedNodeMessage)

Example 4 with MergeRequest

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

the class WriteAdapter method handle.

@SuppressWarnings("checkstyle:IllegalCatch")
public void handle(final Object message, final ActorRef sender, final ActorContext context, final ActorRef self) {
    // TODO Maybe we should store it and fail the submit immediately?.
    try {
        if (message instanceof MergeRequest) {
            final MergeRequest mergeRequest = (MergeRequest) message;
            final NormalizedNodeMessage data = mergeRequest.getNormalizedNodeMessage();
            tx.merge(mergeRequest.getStore(), data.getIdentifier(), data.getNode());
        } else if (message instanceof PutRequest) {
            final PutRequest putRequest = (PutRequest) message;
            final NormalizedNodeMessage data = putRequest.getNormalizedNodeMessage();
            tx.put(putRequest.getStore(), data.getIdentifier(), data.getNode());
        } else if (message instanceof DeleteRequest) {
            final DeleteRequest deleteRequest = (DeleteRequest) message;
            tx.delete(deleteRequest.getStore(), deleteRequest.getPath());
        } else if (message instanceof CancelRequest) {
            cancel(context, sender, self);
        } else if (message instanceof SubmitRequest) {
            submit(sender, self, context);
        }
    } catch (final RuntimeException exception) {
        LOG.error("Write command has failed.", exception);
    }
}
Also used : MergeRequest(org.opendaylight.netconf.topology.singleton.messages.transactions.MergeRequest) NormalizedNodeMessage(org.opendaylight.netconf.topology.singleton.messages.NormalizedNodeMessage) PutRequest(org.opendaylight.netconf.topology.singleton.messages.transactions.PutRequest) CancelRequest(org.opendaylight.netconf.topology.singleton.messages.transactions.CancelRequest) SubmitRequest(org.opendaylight.netconf.topology.singleton.messages.transactions.SubmitRequest) DeleteRequest(org.opendaylight.netconf.topology.singleton.messages.transactions.DeleteRequest)

Aggregations

MergeRequest (org.opendaylight.netconf.topology.singleton.messages.transactions.MergeRequest)4 NormalizedNodeMessage (org.opendaylight.netconf.topology.singleton.messages.NormalizedNodeMessage)3 Test (org.junit.Test)2 CancelRequest (org.opendaylight.netconf.topology.singleton.messages.transactions.CancelRequest)1 DeleteRequest (org.opendaylight.netconf.topology.singleton.messages.transactions.DeleteRequest)1 PutRequest (org.opendaylight.netconf.topology.singleton.messages.transactions.PutRequest)1 SubmitRequest (org.opendaylight.netconf.topology.singleton.messages.transactions.SubmitRequest)1