- @Test
- public void saveCnSnToXmlTest() throws WebApplicationException, IOException, URISyntaxException, XMLStreamException {
- CompositeNode cnSn = prepareCnSn(createInstanceIdentifier());
- String output = TestUtils.writeCompNodeWithSchemaContextToOutput(cnSn, modules, dataSchemaNode,
- StructuredDataToXmlProvider.INSTANCE);
- validateXmlOutput(output);
-
- }
-
- @Test
- public void saveCnSnWithLeafListInstIdentifierToXmlTest() throws WebApplicationException, IOException,
- URISyntaxException, XMLStreamException {
- CompositeNode cnSn = prepareCnSn(createInstanceIdentifierWithLeafList());
- String output = TestUtils.writeCompNodeWithSchemaContextToOutput(cnSn, modules, dataSchemaNode,
- StructuredDataToXmlProvider.INSTANCE);
- validateXmlOutputWithLeafList(output);
- }
-
- @Test
- public void saveCnSnToJsonTest() throws WebApplicationException, IOException, URISyntaxException {
- CompositeNode cnSn = prepareCnSn(createInstanceIdentifier());
- String output = TestUtils.writeCompNodeWithSchemaContextToOutput(cnSn, modules, dataSchemaNode,
- StructuredDataToJsonProvider.INSTANCE);
- boolean strInOutput = false;
- strInOutput = containsStringData(
- output,
- "\"augment-augment-module:lf111\"",
- ":",
- "\"/instance-identifier-module:cont/instance-identifier-module:cont1/augment-module:lst11\\[augment-module:keyvalue111=\\\\\"value1\\\\\"\\]\\[augment-module:keyvalue112=\\\\\"value2\\\\\"\\]/augment-augment-module:lf112\"");
-
- if (!strInOutput) {
- strInOutput = containsStringData(
- output,
- "\"augment-augment-module:lf111\"",
- ":",
- "\"/instance-identifier-module:cont/instance-identifier-module:cont1/augment-module:lst11\\[augment-module:keyvalue111='value1'\\]\\[augment-module:keyvalue112='value2'\\]/augment-augment-module:lf112\"");
- }
- assertTrue(strInOutput);
- }
-
- @Test
- public void saveCnSnWithLeafListInstIdentifierToJsonTest() throws WebApplicationException, IOException,
- URISyntaxException {
- CompositeNode cnSn = prepareCnSn(createInstanceIdentifierWithLeafList());
- String output = TestUtils.writeCompNodeWithSchemaContextToOutput(cnSn, modules, dataSchemaNode,
- StructuredDataToJsonProvider.INSTANCE);
- boolean strInOutput = false;
- strInOutput = containsStringData(
- output,
- "\"augment-augment-module:lf111\"",
- ":",
- "\"/instance-identifier-module:cont/instance-identifier-module:cont1/augment-module-leaf-list:lflst11\\[.='lflst11_1'\\]\"");
- if (!strInOutput) {
- strInOutput = containsStringData(
- output,
- "\"augment-augment-module:lf111\"",
- ":",
- "\"/instance-identifier-module:cont/instance-identifier-module:cont1/augment-module-leaf-list:lflst11\\[.=\\\\\"lflst11_1\\\\\"\\]\"");
- }
-
- assertTrue(strInOutput);
- }