- private CompositeNode prepareCnSn() throws URISyntaxException {
- CompositeNodeWrapper cont = new CompositeNodeWrapper(new URI("instance:identifier:module"), "cont");
- CompositeNodeWrapper cont1 = new CompositeNodeWrapper(new URI("instance:identifier:module"), "cont1");
- CompositeNodeWrapper lst11 = new CompositeNodeWrapper(new URI("augment:module"), "lst11");
- InstanceIdentifier instanceIdentifier = createInstanceIdentifier();
- SimpleNodeWrapper lf111 = new SimpleNodeWrapper(new URI("augment:augment:module"), "lf111", instanceIdentifier);
+ private void validateXmlOutputWithLeafList(final String xml) throws XMLStreamException {
+ XMLInputFactory xmlInFactory = XMLInputFactory.newInstance();
+ XMLEventReader eventReader;
+
+ eventReader = xmlInFactory.createXMLEventReader(new ByteArrayInputStream(xml.getBytes()));
+ String aModuleLfLstPrefix = null;
+ String iiModulePrefix = null;
+ while (eventReader.hasNext()) {
+ XMLEvent nextEvent = eventReader.nextEvent();
+ if (nextEvent.isStartElement()) {
+ StartElement startElement = (StartElement) nextEvent;
+ if (startElement.getName().getLocalPart().equals("lf111")) {
+ Iterator<?> prefixes = startElement.getNamespaceContext().getPrefixes("augment:module:leaf:list");
+
+ while (prefixes.hasNext() && aModuleLfLstPrefix == null) {
+ String prefix = (String) prefixes.next();
+ if (!prefix.isEmpty()) {
+ aModuleLfLstPrefix = prefix;
+ }
+ }
+ iiModulePrefix = startElement.getNamespaceContext().getPrefix("instance:identifier:module");
+ break;
+ }
+ }
+ }
+
+ assertNotNull(aModuleLfLstPrefix);
+ assertNotNull(iiModulePrefix);
+
+ String instanceIdentifierValue = "/" + iiModulePrefix + ":cont/" + iiModulePrefix + ":cont1/"
+ + aModuleLfLstPrefix + ":lflst11[.='lflst11_1']";
+
+ assertTrue(xml.contains(instanceIdentifierValue));
+
+ }
+
+ private CompositeNode prepareCnSn(final InstanceIdentifier instanceIdentifier) throws URISyntaxException {
+ MutableCompositeNode cont = NodeFactory.createMutableCompositeNode(
+ TestUtils.buildQName("cont", "instance:identifier:module", "2014-01-17"), null, null,null,null);
+ MutableCompositeNode cont1 = NodeFactory.createMutableCompositeNode(
+ TestUtils.buildQName("cont1", "instance:identifier:module", "2014-01-17"), cont, null,null,null);
+ MutableCompositeNode lst11 = NodeFactory.createMutableCompositeNode(
+ TestUtils.buildQName("lst11", "augment:module", "2014-01-17"), cont1, null,null,null);
+
+ MutableSimpleNode<?> lf111 = NodeFactory.createMutableSimpleNode(TestUtils.buildQName("lf111", "augment:augment:module", "2014-01-17"),
+ lst11, instanceIdentifier,null,null);
+
+
+ lst11.getValue().add(lf111);
+ lst11.init();
+
+ cont1.getValue().add(lst11);
+ cont1.init();