X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=restconf%2Frestconf-nb-bierman02%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fnetconf%2Fsal%2Frestconf%2Fimpl%2FFakeRestconfModule.java;h=e4b8bb4cee5e2e1536faf2a236e3eabf50aa6abf;hb=b8f5ebd2f817de1d613d84cf41f3516728767eba;hp=f1e6b8ab4fb8e3dfcbc0ee0e8989074f8c45a50b;hpb=297030dc32e29a3ac0c76aa3d6279e7e047532b3;p=netconf.git diff --git a/restconf/restconf-nb-bierman02/src/main/java/org/opendaylight/netconf/sal/restconf/impl/FakeRestconfModule.java b/restconf/restconf-nb-bierman02/src/main/java/org/opendaylight/netconf/sal/restconf/impl/FakeRestconfModule.java index f1e6b8ab4f..e4b8bb4cee 100644 --- a/restconf/restconf-nb-bierman02/src/main/java/org/opendaylight/netconf/sal/restconf/impl/FakeRestconfModule.java +++ b/restconf/restconf-nb-bierman02/src/main/java/org/opendaylight/netconf/sal/restconf/impl/FakeRestconfModule.java @@ -11,16 +11,17 @@ import com.google.common.collect.Collections2; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableSet; import java.net.URI; -import java.text.ParseException; import java.util.Collection; -import java.util.Date; import java.util.List; +import java.util.Optional; import java.util.Set; import org.opendaylight.restconf.common.errors.RestconfDocumentedException; +import org.opendaylight.yangtools.concepts.SemVer; import org.opendaylight.yangtools.yang.common.QName; import org.opendaylight.yangtools.yang.common.QNameModule; -import org.opendaylight.yangtools.yang.common.SimpleDateFormatUtil; -import org.opendaylight.yangtools.yang.model.api.AugmentationSchema; +import org.opendaylight.yangtools.yang.common.Revision; +import org.opendaylight.yangtools.yang.common.YangVersion; +import org.opendaylight.yangtools.yang.model.api.AugmentationSchemaNode; import org.opendaylight.yangtools.yang.model.api.ContainerSchemaNode; import org.opendaylight.yangtools.yang.model.api.DataSchemaNode; import org.opendaylight.yangtools.yang.model.api.Deviation; @@ -43,17 +44,8 @@ import org.opendaylight.yangtools.yang.model.api.UsesNode; */ final class FakeRestconfModule implements Module { - static final QNameModule QNAME; - - static { - Date date; - try { - date = SimpleDateFormatUtil.getRevisionFormat().parse("2016-06-28"); - } catch (final ParseException e) { - throw new ExceptionInInitializerError(e); - } - QNAME = QNameModule.create(URI.create("urn:ietf:params:xml:ns:yang:ietf-restconf"), date).intern(); - } + static final QNameModule QNAME = QNameModule.create(URI.create("urn:ietf:params:xml:ns:yang:ietf-restconf"), + Revision.of("2016-06-28")).intern(); private final Collection children; private final ImmutableSet imports; @@ -85,10 +77,10 @@ final class FakeRestconfModule implements Module { } @Override - public DataSchemaNode getDataChildByName(final QName name) { + public Optional findDataChildByName(final QName name) { for (final DataSchemaNode node : this.children) { if (node.getQName().equals(name)) { - return node; + return Optional.of(node); } } throw new RestconfDocumentedException(name + " is not in child of " + FakeRestconfModule.QNAME); @@ -99,11 +91,6 @@ final class FakeRestconfModule implements Module { throw new UnsupportedOperationException("Not supported operations."); } - @Override - public String getModuleSourcePath() { - throw new UnsupportedOperationException("Not supported operations."); - } - @Override public QNameModule getQNameModule() { return QNAME; @@ -120,7 +107,7 @@ final class FakeRestconfModule implements Module { } @Override - public Date getRevision() { + public Optional getRevision() { return QNAME.getRevision(); } @@ -130,27 +117,27 @@ final class FakeRestconfModule implements Module { } @Override - public String getYangVersion() { - throw new UnsupportedOperationException("Not supported operations."); + public YangVersion getYangVersion() { + return YangVersion.VERSION_1_1; } @Override - public String getDescription() { + public Optional getDescription() { throw new UnsupportedOperationException("Not supported operations."); } @Override - public String getReference() { + public Optional getReference() { throw new UnsupportedOperationException("Not supported operations."); } @Override - public String getOrganization() { + public Optional getOrganization() { throw new UnsupportedOperationException("Not supported operations."); } @Override - public String getContact() { + public Optional getContact() { throw new UnsupportedOperationException("Not supported operations."); } @@ -166,47 +153,46 @@ final class FakeRestconfModule implements Module { @Override public Set getFeatures() { - throw new UnsupportedOperationException("Not supported operations."); + return ImmutableSet.of(); } @Override public Set getNotifications() { - throw new UnsupportedOperationException("Not supported operations."); + return ImmutableSet.of(); } @Override - public Set getAugmentations() { - throw new UnsupportedOperationException("Not supported operations."); + public Set getAugmentations() { + return ImmutableSet.of(); } @Override public Set getRpcs() { - throw new UnsupportedOperationException("Not supported operations."); + return ImmutableSet.of(); } @Override public Set getDeviations() { - throw new UnsupportedOperationException("Not supported operations."); + return ImmutableSet.of(); } @Override public Set getIdentities() { - throw new UnsupportedOperationException("Not supported operations."); + return ImmutableSet.of(); } @Override public List getExtensionSchemaNodes() { - throw new UnsupportedOperationException("Not supported operations."); + return ImmutableList.of(); } @Override public List getUnknownSchemaNodes() { - throw new UnsupportedOperationException("Not supported operations."); + return ImmutableList.of(); } @Override - public String getSource() { + public Optional getSemanticVersion() { throw new UnsupportedOperationException("Not supported operations."); } - }