- @Test
- public void cnSnToXmlWithYangChoice() {
- String xmlOutput = "";
- try {
- xmlOutput = TestUtils.writeCompNodeWithSchemaContextToOutput(
- prepareCnStructForYangData("lf1", "String data1"), modules, dataSchemaNode,
- StructuredDataToXmlProvider.INSTANCE);
- } catch (WebApplicationException | IOException e) {
- }
-
- assertTrue(xmlOutput.contains("<lf1>String data1</lf1>"));
-
- try {
- xmlOutput = TestUtils.writeCompNodeWithSchemaContextToOutput(
- prepareCnStructForYangData("lf2", "String data2"), modules, dataSchemaNode,
- StructuredDataToXmlProvider.INSTANCE);
- } catch (WebApplicationException | IOException e) {
- }
- assertTrue(xmlOutput.contains("<lf2>String data2</lf2>"));
-
- }
-
- private CompositeNode prepareCnStructForYangData(String lfName, Object data) {
- MutableCompositeNode cont = NodeFactory.createMutableCompositeNode(TestUtils.buildQName("cont"), null, null,
- ModifyAction.CREATE, null);
-
- MutableSimpleNode<Object> lf1 = NodeFactory.createMutableSimpleNode(TestUtils.buildQName(lfName), cont, data,
- ModifyAction.CREATE, null);
- cont.getChildren().add(lf1);
- cont.init();
-
- return cont;
- }
-