X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=yang%2Fyang-parser-rfc7950%2Fsrc%2Ftest%2Fjava%2Forg%2Fopendaylight%2Fyangtools%2Fyang%2Fstmt%2FChoiceStmtTest.java;h=f604cc8df37ea6b1378feef6f92763a144717446;hb=e33920b9525f898e1db493f98aa2f97785005894;hp=46734d57864c15d2f5ea7b35ace6c98386388ec6;hpb=1cc6359e5bae1459582e9262a24ca56f23bcc70f;p=yangtools.git diff --git a/yang/yang-parser-rfc7950/src/test/java/org/opendaylight/yangtools/yang/stmt/ChoiceStmtTest.java b/yang/yang-parser-rfc7950/src/test/java/org/opendaylight/yangtools/yang/stmt/ChoiceStmtTest.java index 46734d5786..f604cc8df3 100644 --- a/yang/yang-parser-rfc7950/src/test/java/org/opendaylight/yangtools/yang/stmt/ChoiceStmtTest.java +++ b/yang/yang-parser-rfc7950/src/test/java/org/opendaylight/yangtools/yang/stmt/ChoiceStmtTest.java @@ -9,31 +9,23 @@ package org.opendaylight.yangtools.yang.stmt; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; -import static org.opendaylight.yangtools.yang.stmt.StmtTestUtils.sourceForResource; +import java.io.IOException; +import java.net.URISyntaxException; import org.junit.Test; import org.opendaylight.yangtools.yang.common.QName; -import org.opendaylight.yangtools.yang.model.api.ChoiceCaseNode; +import org.opendaylight.yangtools.yang.model.api.CaseSchemaNode; import org.opendaylight.yangtools.yang.model.api.ChoiceSchemaNode; import org.opendaylight.yangtools.yang.model.api.ContainerSchemaNode; import org.opendaylight.yangtools.yang.model.api.Module; import org.opendaylight.yangtools.yang.model.api.SchemaContext; -import org.opendaylight.yangtools.yang.parser.rfc7950.reactor.RFC7950Reactors; +import org.opendaylight.yangtools.yang.model.parser.api.YangSyntaxErrorException; import org.opendaylight.yangtools.yang.parser.spi.meta.ReactorException; -import org.opendaylight.yangtools.yang.parser.spi.source.StatementStreamSource; public class ChoiceStmtTest { - - private static final StatementStreamSource CHOICE_MODULE = sourceForResource("/model/foo.yang"); - private static final StatementStreamSource IMPORTED_MODULE1 = sourceForResource("/model/bar.yang"); - private static final StatementStreamSource IMPORTED_MODULE2 = sourceForResource("/model/baz.yang"); - private static final StatementStreamSource INCLUDED_MODULE = sourceForResource("/model/subfoo.yang"); - @Test - public void choiceAndCaseTest() throws ReactorException { - final SchemaContext result = RFC7950Reactors.defaultReactor().newBuild() - .addSources(CHOICE_MODULE, IMPORTED_MODULE1, IMPORTED_MODULE2, INCLUDED_MODULE) - .buildEffective(); + public void choiceAndCaseTest() throws ReactorException, YangSyntaxErrorException, URISyntaxException, IOException { + final SchemaContext result = StmtTestUtils.parseYangSources("/model"); assertNotNull(result); final Module testModule = result.findModules("foo").iterator().next(); @@ -48,7 +40,7 @@ public class ChoiceStmtTest { assertNotNull(choice); assertEquals(5, choice.getCases().size()); - ChoiceCaseNode caseNode = choice.findCaseNodes("input").iterator().next(); + CaseSchemaNode caseNode = choice.findCaseNodes("input").iterator().next(); assertNotNull(caseNode); caseNode = choice.findCaseNodes("output").iterator().next(); assertNotNull(caseNode);