import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
-import java.text.ParseException;
import java.util.Collections;
import java.util.Optional;
import org.junit.Test;
import org.mockito.MockitoAnnotations;
import org.opendaylight.yangtools.yang.common.QName;
import org.opendaylight.yangtools.yang.common.QNameModule;
+import org.opendaylight.yangtools.yang.common.Revision;
import org.opendaylight.yangtools.yang.model.api.ChoiceSchemaNode;
import org.opendaylight.yangtools.yang.model.api.ContainerSchemaNode;
import org.opendaylight.yangtools.yang.model.api.DataNodeContainer;
@Test
public void findNodeInSchemaContextTest() throws URISyntaxException, IOException, YangSyntaxErrorException,
- ParseException, ReactorException {
+ ReactorException {
final SchemaContext context = TestUtils.parseYangSources("/schema-context-util-test");
- final Module myModule = context.findModule(new URI("uri:my-module"), QName.parseRevision("2014-10-07")).get();
+ final Module myModule = context.findModule(new URI("uri:my-module"),Revision.valueOf("2014-10-07")).get();
SchemaNode testNode = ((ContainerSchemaNode) myModule.getDataChildByName(QName.create(
myModule.getQNameModule(), "my-container"))).getDataChildByName(QName.create(myModule.getQNameModule(),
@Test
public void findNodeInSchemaContextTest2() throws URISyntaxException, IOException, YangSyntaxErrorException,
- ParseException, ReactorException {
+ ReactorException {
final SchemaContext context = TestUtils.parseYangSources("/schema-context-util-test");
- final Module myModule = context.findModule(new URI("uri:my-module"), QName.parseRevision("2014-10-07")).get();
+ final Module myModule = context.findModule(new URI("uri:my-module"), Revision.valueOf("2014-10-07")).get();
SchemaNode testNode = ((ContainerSchemaNode) myModule.getDataChildByName(QName.create(
myModule.getQNameModule(), "my-container"))).getDataChildByName(QName.create(myModule.getQNameModule(),
@Test
public void findNodeInSchemaContextTest3() throws URISyntaxException, IOException, YangSyntaxErrorException,
- ParseException, ReactorException {
+ ReactorException {
final SchemaContext context = TestUtils.parseYangSources("/schema-context-util-test");
- final Module myModule = context.findModule(new URI("uri:my-module"), QName.parseRevision("2014-10-07")).get();
+ final Module myModule = context.findModule(new URI("uri:my-module"), Revision.valueOf("2014-10-07")).get();
SchemaNode testNode = myModule.getDataChildByName(QName.create(myModule.getQNameModule(), "my-container"));
@Test
public void findParentModuleTest() throws URISyntaxException, IOException, YangSyntaxErrorException,
- ParseException, ReactorException {
+ ReactorException {
final SchemaContext context = TestUtils.parseYangSources("/schema-context-util-test");
- final Module myModule = context.findModule(new URI("uri:my-module"), QName.parseRevision("2014-10-07")).get();
+ final Module myModule = context.findModule(new URI("uri:my-module"), Revision.valueOf("2014-10-07")).get();
- final DataSchemaNode node = myModule
- .getDataChildByName(QName.create(myModule.getQNameModule(), "my-container"));
+ final DataSchemaNode node = myModule.getDataChildByName(QName.create(myModule.getQNameModule(),
+ "my-container"));
final Module foundModule = SchemaContextUtil.findParentModule(context, node);
public void findDataSchemaNodeTest() throws URISyntaxException, IOException, YangSyntaxErrorException,
ReactorException {
final SchemaContext context = TestUtils.parseYangSources("/schema-context-util-test");
- final Module module = context.findModule(new URI("uri:my-module"), QName.parseRevision("2014-10-07")).get();
+ final Module module = context.findModule(new URI("uri:my-module"), Revision.valueOf("2014-10-07")).get();
final Module importedModule = context.findModule(new URI("uri:imported-module"),
- QName.parseRevision("2014-10-07")).get();
+ Revision.valueOf("2014-10-07")).get();
final SchemaNode testNode = ((ContainerSchemaNode) importedModule.getDataChildByName(QName.create(
importedModule.getQNameModule(), "my-imported-container"))).getDataChildByName(QName.create(
// final RevisionAwareXPath nonCondXPath) {
final SchemaContext context = TestUtils.parseYangSources("/schema-context-util-test");
- final Module module = context.findModule(new URI("uri:my-module"), QName.parseRevision("2014-10-07")).get();
+ final Module module = context.findModule(new URI("uri:my-module"), Revision.valueOf("2014-10-07")).get();
final GroupingDefinition grouping = getGroupingByName(module, "my-grouping");
final SchemaNode testNode = grouping.getDataChildByName(QName.create(module.getQNameModule(),
@Test
public void findNodeInSchemaContextGroupingsTest() throws URISyntaxException, IOException,
- YangSyntaxErrorException, ParseException, ReactorException {
+ YangSyntaxErrorException, ReactorException {
final SchemaContext context = TestUtils.parseYangSources("/schema-context-util-test");
- final Module myModule = context.findModule(new URI("uri:my-module"), QName.parseRevision("2014-10-07")).get();
+ final Module myModule = context.findModule(URI.create("uri:my-module"), Revision.valueOf("2014-10-07")).get();
// find grouping in container
DataNodeContainer dataContainer = (DataNodeContainer) myModule.getDataChildByName(QName.create(
@Test
public void findNodeInSchemaContextGroupingsTest2() throws URISyntaxException, IOException,
- YangSyntaxErrorException, ParseException, ReactorException {
+ YangSyntaxErrorException, ReactorException {
final SchemaContext context = TestUtils.parseYangSources("/schema-context-util-test");
- final Module myModule = context.findModule(new URI("uri:my-module"), QName.parseRevision("2014-10-07")).get();
+ final Module myModule = context.findModule(new URI("uri:my-module"), Revision.valueOf("2014-10-07")).get();
// find grouping in container
DataNodeContainer dataContainer = (DataNodeContainer) myModule.getDataChildByName(QName.create(
@Test
public void findNodeInSchemaContextTheSameNameOfSiblingsTest() throws URISyntaxException, IOException,
- YangSyntaxErrorException, ParseException, ReactorException {
+ YangSyntaxErrorException, ReactorException {
final SchemaContext context = TestUtils.parseYangSources("/schema-context-util-test");
- final Module myModule = context.findModule(new URI("uri:my-module"), QName.parseRevision("2014-10-07")).get();
+ final Module myModule = context.findModule(new URI("uri:my-module"), Revision.valueOf("2014-10-07")).get();
final ChoiceSchemaNode choice = (ChoiceSchemaNode) getRpcByName(myModule, "my-name").getInput()
.getDataChildByName(QName.create(myModule.getQNameModule(), "my-choice"));
final SchemaNode testNode = choice.getCaseNodeByName("case-two").getDataChildByName(