use of org.opendaylight.restconf.nb.rfc8040.legacy.NormalizedNodePayload in project netconf by opendaylight.
the class XmlBodyReaderMountPointTest method moduleSubContainerDataPutTest.
@Test
public void moduleSubContainerDataPutTest() throws Exception {
final DataSchemaNode dataSchemaNode = schemaContext.getDataChildByName(QName.create(INSTANCE_IDENTIFIER_MODULE_QNAME, "cont"));
final String uri = "instance-identifier-module:cont/yang-ext:mount/instance-identifier-module:cont/cont1";
mockBodyReader(uri, xmlBodyReader, false);
final NormalizedNodePayload payload = xmlBodyReader.readFrom(null, null, null, mediaType, null, XmlBodyReaderMountPointTest.class.getResourceAsStream("/instanceidentifier/xml/xml_sub_container.xml"));
checkMountPointNormalizedNodePayload(payload);
checkExpectValueNormalizeNodeContext(dataSchemaNode, payload, QName.create(dataSchemaNode.getQName(), "cont1"));
}
use of org.opendaylight.restconf.nb.rfc8040.legacy.NormalizedNodePayload in project netconf by opendaylight.
the class XmlBodyReaderMountPointTest method moduleDataTest.
@Test
public void moduleDataTest() throws Exception {
final DataSchemaNode dataSchemaNode = schemaContext.getDataChildByName(QName.create(INSTANCE_IDENTIFIER_MODULE_QNAME, "cont"));
final String uri = "instance-identifier-module:cont/yang-ext:mount/instance-identifier-module:cont";
mockBodyReader(uri, xmlBodyReader, false);
final NormalizedNodePayload payload = xmlBodyReader.readFrom(null, null, null, mediaType, null, XmlBodyReaderMountPointTest.class.getResourceAsStream("/instanceidentifier/xml/xmldata.xml"));
checkMountPointNormalizedNodePayload(payload);
checkExpectValueNormalizeNodeContext(dataSchemaNode, payload);
}
use of org.opendaylight.restconf.nb.rfc8040.legacy.NormalizedNodePayload in project netconf by opendaylight.
the class XmlBodyReaderMountPointTest method moduleSubContainerDataPostActionTest.
@Test
public void moduleSubContainerDataPostActionTest() throws Exception {
final Optional<DataSchemaNode> dataSchemaNode = schemaContext.findDataChildByName(QName.create(INSTANCE_IDENTIFIER_MODULE_QNAME, "cont"));
final String uri = "instance-identifier-module:cont/yang-ext:mount/instance-identifier-module:cont/cont1/reset";
mockBodyReader(uri, xmlBodyReader, true);
final NormalizedNodePayload pyaload = xmlBodyReader.readFrom(null, null, null, mediaType, null, XmlBodyReaderMountPointTest.class.getResourceAsStream("/instanceidentifier/xml/xml_cont_action.xml"));
checkMountPointNormalizedNodePayload(pyaload);
checkExpectValueNormalizeNodeContext(dataSchemaNode.get(), pyaload);
}
use of org.opendaylight.restconf.nb.rfc8040.legacy.NormalizedNodePayload in project netconf by opendaylight.
the class PlainPatchDataTransactionUtilTest method testPatchListData.
@Test
public void testPatchListData() {
final InstanceIdentifierContext<DataSchemaNode> iidContext = new InstanceIdentifierContext<>(iidJukebox, schemaNodeForJukebox, null, schema);
final NormalizedNodePayload payload = NormalizedNodePayload.of(iidContext, jukeboxContainerWithPlaylist);
doReturn(readWrite).when(mockDataBroker).newReadWriteTransaction();
doReturn(CommitInfo.emptyFluentFuture()).when(readWrite).commit();
doReturn(Futures.immediateFuture(new DefaultDOMRpcResult())).when(netconfService).commit();
doReturn(Futures.immediateFuture(new DefaultDOMRpcResult())).when(netconfService).merge(any(), any(), any(), any());
PlainPatchDataTransactionUtil.patchData(payload, new MdsalRestconfStrategy(mockDataBroker), schema);
verify(readWrite).merge(LogicalDatastoreType.CONFIGURATION, iidJukebox, payload.getData());
PlainPatchDataTransactionUtil.patchData(payload, new NetconfRestconfStrategy(netconfService), schema);
verify(netconfService).merge(LogicalDatastoreType.CONFIGURATION, iidJukebox, payload.getData(), Optional.empty());
}
use of org.opendaylight.restconf.nb.rfc8040.legacy.NormalizedNodePayload in project netconf by opendaylight.
the class PutDataTransactionUtilTest method testValidTopLevelNodeNamePathEmpty.
@Test
public void testValidTopLevelNodeNamePathEmpty() {
final InstanceIdentifierContext<DataSchemaNode> iidContext = new InstanceIdentifierContext<>(iid, schemaNode, null, schema);
final NormalizedNodePayload payload = NormalizedNodePayload.of(iidContext, buildLeaf);
// FIXME: more asserts
assertThrows(RestconfDocumentedException.class, () -> RestconfDataServiceImpl.validTopLevelNodeName(YangInstanceIdentifier.empty(), payload));
}
Aggregations