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=b82f534839dca342c5c1a49e19947d0fd05caeaa;hp=0b05f9e49dc204ac621acefbf9cedcb2b10ae25f;hb=f781598707f0810491cb571f835ee49772e00e83;hpb=753515e8868a1a15982d3f2697439f522f273db5 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..b82f534839 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,12 +12,15 @@ import com.google.common.collect.Lists; import com.google.common.io.ByteSource; import java.io.IOException; import java.io.InputStream; +import java.util.ArrayList; import javax.xml.parsers.DocumentBuilderFactory; 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 { @@ -33,7 +36,7 @@ public class XmlUtilsTest { BUILDERFACTORY = factory; } - private SchemaContext schema; + private SchemaContext schemaContext; private RpcDefinition testRpc; public static final String XML_CONTENT = "" + @@ -49,8 +52,18 @@ public class XmlUtilsTest { return XmlUtilsTest.this.getClass().getResourceAsStream("rpcTest.yang"); } }; - schema = new YangParserImpl().parseSources(Lists.newArrayList(byteSource)); - final Module rpcTestModule = schema.getModules().iterator().next(); + + 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(); testRpc = rpcTestModule.getRpcs().iterator().next(); }