X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fsal-clustering-commons%2Fsrc%2Ftest%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fxml%2Fcodec%2FXmlUtilsTest.java;h=023d1fad8f0d16b9d4c84bbdaba1e69d52b0caf0;hp=0b05f9e49dc204ac621acefbf9cedcb2b10ae25f;hb=4e696d9795fe7eef40369c05c340d137394126f3;hpb=79501c28d5f3e179cb67390fb160a63fc44bac8f
diff --git a/opendaylight/md-sal/sal-clustering-commons/src/test/java/org/opendaylight/controller/xml/codec/XmlUtilsTest.java b/opendaylight/md-sal/sal-clustering-commons/src/test/java/org/opendaylight/controller/xml/codec/XmlUtilsTest.java
index 0b05f9e49d..023d1fad8f 100644
--- a/opendaylight/md-sal/sal-clustering-commons/src/test/java/org/opendaylight/controller/xml/codec/XmlUtilsTest.java
+++ b/opendaylight/md-sal/sal-clustering-commons/src/test/java/org/opendaylight/controller/xml/codec/XmlUtilsTest.java
@@ -12,46 +12,43 @@ import com.google.common.collect.Lists;
import com.google.common.io.ByteSource;
import java.io.IOException;
import java.io.InputStream;
-import javax.xml.parsers.DocumentBuilderFactory;
+import java.util.ArrayList;
import org.junit.Before;
import org.opendaylight.yangtools.yang.model.api.Module;
-import org.opendaylight.yangtools.yang.model.api.RpcDefinition;
import org.opendaylight.yangtools.yang.model.api.SchemaContext;
-import org.opendaylight.yangtools.yang.parser.impl.YangParserImpl;
+import org.opendaylight.yangtools.yang.parser.spi.meta.ReactorException;
+import org.opendaylight.yangtools.yang.parser.stmt.reactor.CrossSourceStatementReactor;
+import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.YangInferencePipeline;
// FIXME : CompositeNode is not avaliable anymore so fix the test to use NormalizedNodeContainer ASAP
public class XmlUtilsTest {
-
- private static final DocumentBuilderFactory BUILDERFACTORY;
-
- static {
- final DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
- factory.setNamespaceAware(true);
- factory.setCoalescing(true);
- factory.setIgnoringElementContentWhitespace(true);
- factory.setIgnoringComments(true);
- BUILDERFACTORY = factory;
- }
-
- private SchemaContext schema;
- private RpcDefinition testRpc;
-
- public static final String XML_CONTENT = "" +
- "flowid" +
- "/ltha:node/ltha:node1[ltha:id='3@java.lang.Short']" +
- "";
-
- @Before
- public void setUp() throws Exception {
- final ByteSource byteSource = new ByteSource() {
- @Override
- public InputStream openStream() throws IOException {
- return XmlUtilsTest.this.getClass().getResourceAsStream("rpcTest.yang");
- }
- };
- schema = new YangParserImpl().parseSources(Lists.newArrayList(byteSource));
- final Module rpcTestModule = schema.getModules().iterator().next();
- testRpc = rpcTestModule.getRpcs().iterator().next();
- }
-
+ public static final String XML_CONTENT = ""
+ + "flowid"
+ + "/ltha:node/ltha:node1"
+ + "[ltha:id='3@java.lang.Short']";
+
+ private SchemaContext schemaContext;
+
+ @Before
+ public void setUp() throws Exception {
+ final ByteSource byteSource = new ByteSource() {
+ @Override
+ public InputStream openStream() throws IOException {
+ return XmlUtilsTest.this.getClass().getResourceAsStream("rpcTest.yang");
+ }
+ };
+
+ final CrossSourceStatementReactor.BuildAction reactor = YangInferencePipeline.RFC6020_REACTOR.newBuild();
+ final ArrayList sources = Lists.newArrayList(byteSource);
+
+ try {
+
+ schemaContext = reactor.buildEffective(sources);
+ } catch (ReactorException e) {
+ throw new RuntimeException("Unable to build schema context from " + sources, e);
+ }
+
+ final Module rpcTestModule = schemaContext.getModules().iterator().next();
+ rpcTestModule.getRpcs().iterator().next();
+ }
}