use of org.opendaylight.restconf.nb.rfc8040.rests.transactions.MdsalRestconfStrategy in project netconf by opendaylight.
the class PutDataTransactionUtilTest method testPutLeafData.
@Test
public void testPutLeafData() {
final InstanceIdentifierContext<DataSchemaNode> iidContext = new InstanceIdentifierContext<>(iid, schemaNode, null, schema);
final NormalizedNodePayload payload = NormalizedNodePayload.of(iidContext, buildLeaf);
doReturn(readWrite).when(mockDataBroker).newReadWriteTransaction();
doReturn(read).when(mockDataBroker).newReadOnlyTransaction();
doReturn(immediateFalseFluentFuture()).when(read).exists(LogicalDatastoreType.CONFIGURATION, iid);
doNothing().when(readWrite).put(LogicalDatastoreType.CONFIGURATION, iid, payload.getData());
doReturn(CommitInfo.emptyFluentFuture()).when(readWrite).commit();
PutDataTransactionUtil.putData(payload, schema, new MdsalRestconfStrategy(mockDataBroker), WriteDataParams.empty());
verify(read).exists(LogicalDatastoreType.CONFIGURATION, iid);
verify(readWrite).put(LogicalDatastoreType.CONFIGURATION, iid, payload.getData());
}
use of org.opendaylight.restconf.nb.rfc8040.rests.transactions.MdsalRestconfStrategy in project netconf by opendaylight.
the class ReadDataTransactionUtilTest method setUp.
@Before
public void setUp() {
// FIXME: these tests need to be parameterized somehow. The trouble is we need mocking before we invoke
// the strategy. This needs some more thought.
doReturn(read).when(mockDataBroker).newReadOnlyTransaction();
mdsalStrategy = new MdsalRestconfStrategy(mockDataBroker);
netconfStrategy = new NetconfRestconfStrategy(netconfService);
}
Aggregations