import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
-import java.io.FileNotFoundException;
import java.net.URI;
-import java.net.URISyntaxException;
-import java.text.ParseException;
import org.junit.Test;
import org.opendaylight.yangtools.concepts.SemVer;
import org.opendaylight.yangtools.yang.model.api.Module;
import org.opendaylight.yangtools.yang.model.repo.api.StatementParserMode;
import org.opendaylight.yangtools.yang.model.util.RevisionAwareXPathImpl;
import org.opendaylight.yangtools.yang.model.util.SchemaContextUtil;
-import org.opendaylight.yangtools.yang.parser.spi.meta.ReactorException;
-import org.opendaylight.yangtools.yang.parser.spi.source.SourceException;
import org.opendaylight.yangtools.yang.stmt.StmtTestUtils;
public class SemanticVersionComplexTest {
@Test
- public void complexTest1() throws SourceException, FileNotFoundException, ReactorException, URISyntaxException,
- ParseException {
+ public void complexTest1() throws Exception {
final SchemaContext context = StmtTestUtils.parseYangSources("/semantic-version/complex/complex-1",
StatementParserMode.SEMVER_MODE);
verifySchemaContextTest1(context);
}
@Test
- public void complexTest1Yang1_1() throws SourceException, FileNotFoundException, ReactorException, URISyntaxException,
- ParseException {
+ public void complexTest1Yang1_1() throws Exception {
final SchemaContext context = StmtTestUtils.parseYangSources("/rfc7950/semantic-version/complex-1",
StatementParserMode.SEMVER_MODE);
verifySchemaContextTest1(context);
}
- private void verifySchemaContextTest1(final SchemaContext context) throws URISyntaxException {
+ private static void verifySchemaContextTest1(final SchemaContext context) {
assertNotNull(context);
- final Module foo = context.findModuleByNamespace(new URI("foo")).iterator().next();
- final Module semVer = context.findModuleByNamespace(new URI("urn:opendaylight:yang:extension:semantic-version"))
- .iterator().next();
+ final Module foo = context.findModuleByNamespace(URI.create("foo")).iterator().next();
+ final Module semVer = context.findModuleByNamespace(
+ URI.create("urn:opendaylight:yang:extension:semantic-version")).iterator().next();
// check module versions
assertEquals(SemVer.valueOf("1.3.95"), semVer.getSemanticVersion());
}
@Test
- public void complexTest2() throws SourceException, FileNotFoundException, ReactorException, URISyntaxException,
- ParseException {
+ public void complexTest2() throws Exception {
final SchemaContext context = StmtTestUtils.parseYangSources("/semantic-version/complex/complex-2",
StatementParserMode.SEMVER_MODE);
verifySchemaContextTest2(context);
}
@Test
- public void complexTest2Yang1_1() throws SourceException, FileNotFoundException, ReactorException, URISyntaxException,
- ParseException {
+ public void complexTest2Yang1_1() throws Exception {
final SchemaContext context = StmtTestUtils.parseYangSources("/rfc7950/semantic-version/complex-2",
StatementParserMode.SEMVER_MODE);
verifySchemaContextTest2(context);
}
- private void verifySchemaContextTest2(final SchemaContext context) throws URISyntaxException {
+ private static void verifySchemaContextTest2(final SchemaContext context) {
assertNotNull(context);
- final Module foo = context.findModuleByNamespace(new URI("foo")).iterator().next();
- final Module semVer = context.findModuleByNamespace(new URI("urn:opendaylight:yang:extension:semantic-version"))
- .iterator().next();
+ final Module foo = context.findModuleByNamespace(URI.create("foo")).iterator().next();
+ final Module semVer = context.findModuleByNamespace(URI.create(
+ "urn:opendaylight:yang:extension:semantic-version")).iterator().next();
// check module versions
assertEquals(SemVer.valueOf("2.5.50"), semVer.getSemanticVersion());