Bug 7432 - eliminate use of yang-parser-impl internals
[netconf.git] / netconf / mdsal-netconf-connector / src / test / java / org / opendaylight / netconf / mdsal / connector / ops / NetconfMDSalMappingTest.java
index 87c40a5916575f2b7d7232840484c47de2be4b1e..009b3c64ca206901481d5a739772f2172c3c2845 100644 (file)
@@ -22,7 +22,6 @@ import java.io.InputStream;
 import java.io.StringWriter;
 import java.util.ArrayList;
 import java.util.Arrays;
-import java.util.Collection;
 import java.util.EnumMap;
 import java.util.List;
 import java.util.concurrent.ExecutorService;
@@ -42,7 +41,7 @@ import org.mockito.Mock;
 import org.mockito.MockitoAnnotations;
 import org.mockito.invocation.InvocationOnMock;
 import org.mockito.stubbing.Answer;
-import org.opendaylight.controller.cluster.datastore.ConcurrentDOMDataBroker;
+import org.opendaylight.controller.cluster.databroker.ConcurrentDOMDataBroker;
 import org.opendaylight.controller.config.util.xml.DocumentedException;
 import org.opendaylight.controller.config.util.xml.DocumentedException.ErrorSeverity;
 import org.opendaylight.controller.config.util.xml.DocumentedException.ErrorTag;
@@ -68,12 +67,10 @@ import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 import org.opendaylight.yangtools.yang.model.api.Module;
 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
 import org.opendaylight.yangtools.yang.model.api.SchemaContextListener;
-import org.opendaylight.yangtools.yang.model.parser.api.YangSyntaxErrorException;
 import org.opendaylight.yangtools.yang.model.repo.api.SourceIdentifier;
 import org.opendaylight.yangtools.yang.model.repo.api.YangTextSchemaSource;
 import org.opendaylight.yangtools.yang.model.repo.spi.SchemaSourceProvider;
-import org.opendaylight.yangtools.yang.parser.builder.impl.BuilderUtils;
-import org.opendaylight.yangtools.yang.parser.impl.YangParserImpl;
+import org.opendaylight.yangtools.yang.test.util.YangParserTestUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.w3c.dom.Document;
@@ -109,7 +106,7 @@ public class NetconfMDSalMappingTest {
     static {
         try {
             RPC_REPLY_OK = XmlFileLoader.xmlFileToDocument("messages/mapping/rpc-reply_ok.xml");
-        } catch (Exception e) {
+        } catch (final Exception e) {
             LOG.debug("unable to load rpc reply ok.", e);
             RPC_REPLY_OK = XmlUtil.newDocument();
         }
@@ -117,7 +114,7 @@ public class NetconfMDSalMappingTest {
 
     private CurrentSchemaContext currentSchemaContext = null;
     private SchemaContext schemaContext = null;
-    private String sessionIdForReporting = "netconf-test-session1";
+    private final String sessionIdForReporting = "netconf-test-session1";
 
     private TransactionProvider transactionProvider = null;
 
@@ -131,7 +128,7 @@ public class NetconfMDSalMappingTest {
         XMLUnit.setIgnoreWhitespace(true);
         XMLUnit.setIgnoreAttributeOrder(true);
 
-        this.schemaContext = parseSchemas(getYangSchemas());
+        this.schemaContext = YangParserTestUtils.parseYangStreams(getYangSchemas());
         schemaContext.getModules();
         final SchemaService schemaService = createSchemaService();
 
@@ -142,7 +139,7 @@ public class NetconfMDSalMappingTest {
         datastores.put(LogicalDatastoreType.CONFIGURATION, configStore);
         datastores.put(LogicalDatastoreType.OPERATIONAL, operStore);
 
-        ExecutorService listenableFutureExecutor = SpecialExecutors.newBlockingBoundedCachedThreadPool(
+        final ExecutorService listenableFutureExecutor = SpecialExecutors.newBlockingBoundedCachedThreadPool(
                 16, 16, "CommitFutures");
 
         final ConcurrentDOMDataBroker cdb = new ConcurrentDOMDataBroker(datastores, listenableFutureExecutor);
@@ -176,19 +173,19 @@ public class NetconfMDSalMappingTest {
         try {
             executeOperation(new GetConfig(sessionIdForReporting, currentSchemaContext, transactionProvider), "messages/mapping/bad_getConfig.xml");
             fail("Should have failed, this is an incorrect request");
-        } catch (DocumentedException e) {
-            assertTrue(e.getErrorSeverity() == ErrorSeverity.error);
-            assertTrue(e.getErrorTag() == ErrorTag.operation_failed);
-            assertTrue(e.getErrorType() == ErrorType.application);
+        } catch (final DocumentedException e) {
+            assertTrue(e.getErrorSeverity() == ErrorSeverity.ERROR);
+            assertTrue(e.getErrorTag() == ErrorTag.OPERATION_FAILED);
+            assertTrue(e.getErrorType() == ErrorType.APPLICATION);
         }
 
         try {
             executeOperation(new GetConfig(sessionIdForReporting, currentSchemaContext, transactionProvider), "messages/mapping/bad_namespace_getConfig.xml");
             fail("Should have failed, this is an incorrect request");
-        } catch (DocumentedException e) {
-            assertTrue(e.getErrorSeverity() == ErrorSeverity.error);
-            assertTrue(e.getErrorTag() == ErrorTag.operation_failed);
-            assertTrue(e.getErrorType() == ErrorType.application);
+        } catch (final DocumentedException e) {
+            assertTrue(e.getErrorSeverity() == ErrorSeverity.ERROR);
+            assertTrue(e.getErrorTag() == ErrorTag.OPERATION_FAILED);
+            assertTrue(e.getErrorType() == ErrorType.APPLICATION);
         }
 
 
@@ -200,10 +197,10 @@ public class NetconfMDSalMappingTest {
         try {
             edit("messages/mapping/editConfigs/editConfig_running.xml");
             fail("Should have failed - edit config on running datastore is not supported");
-        } catch (DocumentedException e) {
-            assertTrue(e.getErrorSeverity() == ErrorSeverity.error);
-            assertTrue(e.getErrorTag() == ErrorTag.operation_not_supported);
-            assertTrue(e.getErrorType() == ErrorType.protocol);
+        } catch (final DocumentedException e) {
+            assertTrue(e.getErrorSeverity() == ErrorSeverity.ERROR);
+            assertTrue(e.getErrorTag() == ErrorTag.OPERATION_NOT_SUPPORTED);
+            assertTrue(e.getErrorType() == ErrorType.PROTOCOL);
         }
 
     }
@@ -252,7 +249,7 @@ public class NetconfMDSalMappingTest {
         final int key2 = responseAsString.indexOf("key2");
 
         assertTrue(String.format("Key ordering invalid, should be key3(%d) < key1(%d) < key2(%d)", key3, key1, key2),
-            key3 < key1 && key1 < key2);
+                key3 < key1 && key1 < key2);
 
         deleteDatastore();
     }
@@ -310,20 +307,20 @@ public class NetconfMDSalMappingTest {
         try {
             lock();
             fail("Should have failed - locking of running datastore is not supported");
-        } catch (DocumentedException e) {
-            assertTrue(e.getErrorSeverity() == ErrorSeverity.error);
-            assertTrue(e.getErrorTag() == ErrorTag.operation_not_supported);
-            assertTrue(e.getErrorType() == ErrorType.application);
+        } catch (final DocumentedException e) {
+            assertTrue(e.getErrorSeverity() == ErrorSeverity.ERROR);
+            assertTrue(e.getErrorTag() == ErrorTag.OPERATION_NOT_SUPPORTED);
+            assertTrue(e.getErrorType() == ErrorType.APPLICATION);
         }
 
 
         try {
             lockWithoutTarget();
             fail("Should have failed, target is missing");
-        } catch (DocumentedException e) {
-            assertTrue(e.getErrorSeverity() == ErrorSeverity.error);
-            assertTrue(e.getErrorTag() == ErrorTag.invalid_value);
-            assertTrue(e.getErrorType() == ErrorType.application);
+        } catch (final DocumentedException e) {
+            assertTrue(e.getErrorSeverity() == ErrorSeverity.ERROR);
+            assertTrue(e.getErrorTag() == ErrorTag.INVALID_VALUE);
+            assertTrue(e.getErrorType() == ErrorType.APPLICATION);
         }
     }
 
@@ -335,19 +332,19 @@ public class NetconfMDSalMappingTest {
         try {
             unlock();
             fail("Should have failed - unlocking of running datastore is not supported");
-        } catch (DocumentedException e) {
-            assertTrue(e.getErrorSeverity() == ErrorSeverity.error);
-            assertTrue(e.getErrorTag() == ErrorTag.operation_not_supported);
-            assertTrue(e.getErrorType() == ErrorType.application);
+        } catch (final DocumentedException e) {
+            assertTrue(e.getErrorSeverity() == ErrorSeverity.ERROR);
+            assertTrue(e.getErrorTag() == ErrorTag.OPERATION_NOT_SUPPORTED);
+            assertTrue(e.getErrorType() == ErrorType.APPLICATION);
         }
 
         try {
             unlockWithoutTarget();
             fail("Should have failed, target is missing");
-        } catch (DocumentedException e) {
-            assertTrue(e.getErrorSeverity() == ErrorSeverity.error);
-            assertTrue(e.getErrorTag() == ErrorTag.invalid_value);
-            assertTrue(e.getErrorType() == ErrorType.application);
+        } catch (final DocumentedException e) {
+            assertTrue(e.getErrorSeverity() == ErrorSeverity.ERROR);
+            assertTrue(e.getErrorTag() == ErrorTag.INVALID_VALUE);
+            assertTrue(e.getErrorType() == ErrorType.APPLICATION);
         }
     }
 
@@ -361,10 +358,10 @@ public class NetconfMDSalMappingTest {
         try {
             edit("messages/mapping/editConfigs/editConfig_create.xml");
             fail("Create should have failed - data already exists");
-        } catch (DocumentedException e) {
-            assertTrue(e.getErrorSeverity() == ErrorSeverity.error);
-            assertTrue(e.getErrorTag() == ErrorTag.data_exists);
-            assertTrue(e.getErrorType() == ErrorType.protocol);
+        } catch (final DocumentedException e) {
+            assertTrue(e.getErrorSeverity() == ErrorSeverity.ERROR);
+            assertTrue(e.getErrorTag() == ErrorTag.DATA_EXISTS);
+            assertTrue(e.getErrorType() == ErrorType.PROTOCOL);
         }
 
         verifyResponse(discardChanges(), RPC_REPLY_OK);
@@ -380,10 +377,10 @@ public class NetconfMDSalMappingTest {
         try {
             edit("messages/mapping/editConfigs/editConfig_delete-top.xml");
             fail("Delete should have failed - data is missing");
-        } catch (DocumentedException e) {
-            assertTrue(e.getErrorSeverity() == ErrorSeverity.error);
-            assertTrue(e.getErrorTag() == ErrorTag.data_missing);
-            assertTrue(e.getErrorType() == ErrorType.protocol);
+        } catch (final DocumentedException e) {
+            assertTrue(e.getErrorSeverity() == ErrorSeverity.ERROR);
+            assertTrue(e.getErrorTag() == ErrorTag.DATA_MISSING);
+            assertTrue(e.getErrorType() == ErrorType.PROTOCOL);
         }
 
     }
@@ -401,16 +398,16 @@ public class NetconfMDSalMappingTest {
         deleteDatastore();
     }
 
-    public static void printDocument(Document doc) throws IOException, TransformerException {
-        TransformerFactory tf = TransformerFactory.newInstance();
-        Transformer transformer = tf.newTransformer();
+    public static void printDocument(final Document doc) throws IOException, TransformerException {
+        final TransformerFactory tf = TransformerFactory.newInstance();
+        final Transformer transformer = tf.newTransformer();
         transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "no");
         transformer.setOutputProperty(OutputKeys.METHOD, "xml");
         transformer.setOutputProperty(OutputKeys.INDENT, "yes");
         transformer.setOutputProperty(OutputKeys.ENCODING, "UTF-8");
         transformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "4");
 
-        StringWriter writer = new StringWriter();
+        final StringWriter writer = new StringWriter();
         transformer.transform(new DOMSource(doc),
                 new StreamResult(writer));
         LOG.warn(writer.getBuffer().toString());
@@ -437,10 +434,10 @@ public class NetconfMDSalMappingTest {
         try {
             edit("messages/mapping/editConfigs/editConfig_merge_multiple_operations_4_create_existing.xml");
             fail();
-        } catch (DocumentedException e) {
-            assertTrue(e.getErrorSeverity() == ErrorSeverity.error);
-            assertTrue(e.getErrorTag() == ErrorTag.data_exists);
-            assertTrue(e.getErrorType() == ErrorType.protocol);
+        } catch (final DocumentedException e) {
+            assertTrue(e.getErrorSeverity() == ErrorSeverity.ERROR);
+            assertTrue(e.getErrorTag() == ErrorTag.DATA_EXISTS);
+            assertTrue(e.getErrorType() == ErrorType.PROTOCOL);
         }
 
         verifyResponse(edit("messages/mapping/editConfigs/editConfig_merge_multiple_operations_4_delete_children_operations.xml"), RPC_REPLY_OK);
@@ -450,10 +447,10 @@ public class NetconfMDSalMappingTest {
         try {
             edit("messages/mapping/editConfigs/editConfig_merge_multiple_operations_4_delete-non-existing.xml");
             fail();
-        } catch (DocumentedException e) {
-            assertTrue(e.getErrorSeverity() == ErrorSeverity.error);
-            assertTrue(e.getErrorTag() == ErrorTag.data_missing);
-            assertTrue(e.getErrorType() == ErrorType.protocol);
+        } catch (final DocumentedException e) {
+            assertTrue(e.getErrorSeverity() == ErrorSeverity.ERROR);
+            assertTrue(e.getErrorTag() == ErrorTag.DATA_MISSING);
+            assertTrue(e.getErrorType() == ErrorType.PROTOCOL);
         }
 
         verifyResponse(edit("messages/mapping/editConfigs/editConfig_merge_multiple_operations_5_choice_setup.xml"), RPC_REPLY_OK);
@@ -469,6 +466,20 @@ public class NetconfMDSalMappingTest {
         deleteDatastore();
     }
 
+    @Test
+    public void testReplaceMapEntry() throws Exception {
+        verifyResponse(edit("messages/mapping/editConfigs/edit-config-replace-map-entry.xml"), RPC_REPLY_OK);
+        verifyResponse(commit(), RPC_REPLY_OK);
+        verifyResponse(getConfigRunning(), XmlFileLoader.xmlFileToDocument("messages/mapping/get-config-map-entry.xml"));
+    }
+
+    @Test
+    public void testMergeMapEntry() throws Exception {
+        verifyResponse(edit("messages/mapping/editConfigs/edit-config-merge-map-entry.xml"), RPC_REPLY_OK);
+        verifyResponse(commit(), RPC_REPLY_OK);
+        verifyResponse(getConfigRunning(), XmlFileLoader.xmlFileToDocument("messages/mapping/get-config-map-entry.xml"));
+    }
+
     @Test
     public void testFiltering() throws Exception {
 
@@ -503,7 +514,7 @@ public class NetconfMDSalMappingTest {
         verifyFilterIdentifier("messages/mapping/filters/get-filter-users.xml",
                 YangInstanceIdentifier.builder().node(TOP).node(USERS).build());
 
-        YangInstanceIdentifier ident = YangInstanceIdentifier.
+        final YangInstanceIdentifier ident = YangInstanceIdentifier.
                 builder(AUGMENTED_CONTAINER_IN_MODULES).
                 node(AUGMENTED_CONTAINER).
                 node(AUGMENTED_STRING_IN_CONT).build();
@@ -546,20 +557,20 @@ public class NetconfMDSalMappingTest {
 
     }
 
-    private void verifyFilterIdentifier(String resource, YangInstanceIdentifier identifier) throws Exception{
-        TestingGetConfig getConfig = new TestingGetConfig(sessionIdForReporting, currentSchemaContext, transactionProvider);
-        Document request = XmlFileLoader.xmlFileToDocument(resource);
-        YangInstanceIdentifier iid = getConfig.getInstanceIdentifierFromDocument(request);
+    private void verifyFilterIdentifier(final String resource, final YangInstanceIdentifier identifier) throws Exception {
+        final TestingGetConfig getConfig = new TestingGetConfig(sessionIdForReporting, currentSchemaContext, transactionProvider);
+        final Document request = XmlFileLoader.xmlFileToDocument(resource);
+        final YangInstanceIdentifier iid = getConfig.getInstanceIdentifierFromDocument(request);
         assertEquals(identifier, iid);
     }
 
     private class TestingGetConfig extends GetConfig{
-        public TestingGetConfig(String sessionId, CurrentSchemaContext schemaContext, TransactionProvider transactionProvider) {
+        public TestingGetConfig(final String sessionId, final CurrentSchemaContext schemaContext, final TransactionProvider transactionProvider) {
             super(sessionId, schemaContext, transactionProvider);
         }
 
-        public YangInstanceIdentifier getInstanceIdentifierFromDocument(Document request) throws DocumentedException {
-            XmlElement filterElement = XmlElement.fromDomDocument(request).getOnlyChildElement(GET_CONFIG).getOnlyChildElement(FILTER_NODE);
+        public YangInstanceIdentifier getInstanceIdentifierFromDocument(final Document request) throws DocumentedException {
+            final XmlElement filterElement = XmlElement.fromDomDocument(request).getOnlyChildElement(GET_CONFIG).getOnlyChildElement(FILTER_NODE);
             return getInstanceIdentifierFromFilter(filterElement);
         }
     }
@@ -572,8 +583,8 @@ public class NetconfMDSalMappingTest {
         assertEmptyDatastore(getConfigRunning());
     }
 
-    private void verifyResponse(Document response, Document template) throws IOException, TransformerException {
-        DetailedDiff dd = new DetailedDiff(new Diff(response, template));
+    private void verifyResponse(final Document response, final Document template) throws IOException, TransformerException {
+        final DetailedDiff dd = new DetailedDiff(new Diff(response, template));
         dd.overrideElementQualifier(new NetconfXmlUnitRecursiveQualifier());
 
         printDocument(response);
@@ -582,93 +593,93 @@ public class NetconfMDSalMappingTest {
         assertTrue(dd.toString(), dd.similar());
     }
 
-    private void assertEmptyDatastore(Document response) {
+    private void assertEmptyDatastore(final Document response) {
 
-        NodeList nodes = response.getChildNodes();
+        final NodeList nodes = response.getChildNodes();
         assertTrue(nodes.getLength() == 1);
 
         assertEquals(nodes.item(0).getLocalName(), RPC_REPLY_ELEMENT);
 
-        NodeList replyNodes = nodes.item(0).getChildNodes();
+        final NodeList replyNodes = nodes.item(0).getChildNodes();
         assertTrue(replyNodes.getLength() == 1);
 
-        Node dataNode = replyNodes.item(0);
+        final Node dataNode = replyNodes.item(0);
         assertEquals(dataNode.getLocalName(), DATA_ELEMENT);
         assertFalse(dataNode.hasChildNodes());
 
     }
 
     private Document commit() throws DocumentedException, ParserConfigurationException, SAXException, IOException {
-        Commit commit = new Commit(sessionIdForReporting, transactionProvider);
+        final Commit commit = new Commit(sessionIdForReporting, transactionProvider);
         return executeOperation(commit, "messages/mapping/commit.xml");
     }
 
     private Document discardChanges() throws DocumentedException, ParserConfigurationException, SAXException, IOException {
-        DiscardChanges discardOp = new DiscardChanges(sessionIdForReporting, transactionProvider);
+        final DiscardChanges discardOp = new DiscardChanges(sessionIdForReporting, transactionProvider);
         return executeOperation(discardOp, "messages/mapping/discardChanges.xml");
     }
 
-    private Document edit(String resource) throws DocumentedException, ParserConfigurationException, SAXException, IOException {
-        EditConfig editConfig = new EditConfig(sessionIdForReporting, currentSchemaContext, transactionProvider);
+    private Document edit(final String resource) throws DocumentedException, ParserConfigurationException, SAXException, IOException {
+        final EditConfig editConfig = new EditConfig(sessionIdForReporting, currentSchemaContext, transactionProvider);
         return executeOperation(editConfig, resource);
     }
 
     private Document get() throws DocumentedException, ParserConfigurationException, SAXException, IOException {
-        Get get = new Get(sessionIdForReporting, currentSchemaContext, transactionProvider);
+        final Get get = new Get(sessionIdForReporting, currentSchemaContext, transactionProvider);
         return executeOperation(get, "messages/mapping/get.xml");
     }
 
-    private Document getWithFilter(String resource) throws DocumentedException, ParserConfigurationException, SAXException, IOException {
-        Get get = new Get(sessionIdForReporting, currentSchemaContext, transactionProvider);
+    private Document getWithFilter(final String resource) throws DocumentedException, ParserConfigurationException, SAXException, IOException {
+        final Get get = new Get(sessionIdForReporting, currentSchemaContext, transactionProvider);
         return executeOperation(get, resource);
     }
 
     private Document getConfigRunning() throws DocumentedException, ParserConfigurationException, SAXException, IOException {
-        GetConfig getConfig = new GetConfig(sessionIdForReporting, currentSchemaContext, transactionProvider);
+        final GetConfig getConfig = new GetConfig(sessionIdForReporting, currentSchemaContext, transactionProvider);
         return executeOperation(getConfig, "messages/mapping/getConfig.xml");
     }
 
     private Document getConfigCandidate() throws DocumentedException, ParserConfigurationException, SAXException, IOException {
-        GetConfig getConfig = new GetConfig(sessionIdForReporting, currentSchemaContext, transactionProvider);
+        final GetConfig getConfig = new GetConfig(sessionIdForReporting, currentSchemaContext, transactionProvider);
         return executeOperation(getConfig, "messages/mapping/getConfig_candidate.xml");
     }
 
-    private Document getConfigWithFilter(String resource) throws DocumentedException, ParserConfigurationException, SAXException, IOException {
-        GetConfig getConfig = new GetConfig(sessionIdForReporting, currentSchemaContext, transactionProvider);
+    private Document getConfigWithFilter(final String resource) throws DocumentedException, ParserConfigurationException, SAXException, IOException {
+        final GetConfig getConfig = new GetConfig(sessionIdForReporting, currentSchemaContext, transactionProvider);
         return executeOperation(getConfig, resource);
     }
 
     private Document lock() throws DocumentedException, ParserConfigurationException, SAXException, IOException {
-        Lock lock = new Lock(sessionIdForReporting);
+        final Lock lock = new Lock(sessionIdForReporting);
         return executeOperation(lock, "messages/mapping/lock.xml");
     }
 
     private Document unlock() throws DocumentedException, ParserConfigurationException, SAXException, IOException {
-        Unlock unlock = new Unlock(sessionIdForReporting);
+        final Unlock unlock = new Unlock(sessionIdForReporting);
         return executeOperation(unlock, "messages/mapping/unlock.xml");
     }
 
     private Document lockWithoutTarget() throws DocumentedException, ParserConfigurationException, SAXException, IOException {
-        Lock lock = new Lock(sessionIdForReporting);
+        final Lock lock = new Lock(sessionIdForReporting);
         return executeOperation(lock, "messages/mapping/lock_notarget.xml");
     }
 
     private Document unlockWithoutTarget() throws DocumentedException, ParserConfigurationException, SAXException, IOException {
-        Unlock unlock = new Unlock(sessionIdForReporting);
+        final Unlock unlock = new Unlock(sessionIdForReporting);
         return executeOperation(unlock, "messages/mapping/unlock_notarget.xml");
     }
 
     private Document lockCandidate() throws DocumentedException, ParserConfigurationException, SAXException, IOException {
-        Lock lock = new Lock(sessionIdForReporting);
+        final Lock lock = new Lock(sessionIdForReporting);
         return executeOperation(lock, "messages/mapping/lock_candidate.xml");
     }
 
     private Document unlockCandidate() throws DocumentedException, ParserConfigurationException, SAXException, IOException {
-        Unlock unlock = new Unlock(sessionIdForReporting);
+        final Unlock unlock = new Unlock(sessionIdForReporting);
         return executeOperation(unlock, "messages/mapping/unlock_candidate.xml");
     }
 
-    private Document executeOperation(NetconfOperation op, String filename) throws ParserConfigurationException, SAXException, IOException, DocumentedException {
+    private Document executeOperation(final NetconfOperation op, final String filename) throws ParserConfigurationException, SAXException, IOException, DocumentedException {
         final Document request = XmlFileLoader.xmlFileToDocument(filename);
         final Document response = op.handle(request, NetconfOperationChainedExecution.EXECUTION_TERMINATION_POINT);
 
@@ -676,33 +687,27 @@ public class NetconfMDSalMappingTest {
         return response;
     }
 
-    private Collection<InputStream> getYangSchemas() {
+    private List<InputStream> getYangSchemas() {
         final List<String> schemaPaths = Arrays.asList("/META-INF/yang/config.yang", "/yang/mdsal-netconf-mapping-test.yang");
         final List<InputStream> schemas = new ArrayList<>();
 
-        for (String schemaPath : schemaPaths) {
-            InputStream resourceAsStream = getClass().getResourceAsStream(schemaPath);
+        for (final String schemaPath : schemaPaths) {
+            final InputStream resourceAsStream = getClass().getResourceAsStream(schemaPath);
             schemas.add(resourceAsStream);
         }
 
         return schemas;
     }
 
-    private SchemaContext parseSchemas(Collection<InputStream> schemas) throws IOException, YangSyntaxErrorException {
-        final YangParserImpl parser = new YangParserImpl();
-        Collection<ByteSource> sources = BuilderUtils.streamsToByteSources(schemas);
-        return parser.parseSources(sources);
-    }
-
     private SchemaService createSchemaService() {
         return new SchemaService() {
 
             @Override
-            public void addModule(Module module) {
+            public void addModule(final Module module) {
             }
 
             @Override
-            public void removeModule(Module module) {
+            public void removeModule(final Module module) {
 
             }