use of org.opendaylight.netconf.topology.singleton.messages.transactions.PutRequest in project netconf by opendaylight.
the class ActorProxyTransactionFacade method put.
@Override
public void put(final LogicalDatastoreType store, final YangInstanceIdentifier path, final NormalizedNode data) {
LOG.debug("{}: Put {} {} via actor {}", id, store, path, masterTxActor);
masterTxActor.tell(new PutRequest(store, new NormalizedNodeMessage(path, data)), ActorRef.noSender());
}
use of org.opendaylight.netconf.topology.singleton.messages.transactions.PutRequest in project netconf by opendaylight.
the class ProxyReadWriteTransactionTest method testPut.
@Test
public void testPut() {
ProxyReadWriteTransaction tx = newSuccessfulProxyTx();
tx.put(STORE, PATH, node);
final PutRequest putRequest = masterActor.expectMsgClass(PutRequest.class);
assertEquals(STORE, putRequest.getStore());
assertEquals(PATH, putRequest.getNormalizedNodeMessage().getIdentifier());
assertEquals(node, putRequest.getNormalizedNodeMessage().getNode());
}
use of org.opendaylight.netconf.topology.singleton.messages.transactions.PutRequest 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);
}
use of org.opendaylight.netconf.topology.singleton.messages.transactions.PutRequest 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);
}
}
Aggregations