import java.io.IOException;
import java.io.Serializable;
import java.net.URI;
-import java.net.URISyntaxException;
import java.util.Objects;
import java.util.Optional;
import org.eclipse.jdt.annotation.NonNull;
return Objects.equals(revision, other.revision) && namespace.equals(other.namespace);
}
- /**
- * Returns a namespace in form defined by section 5.6.4. of
- * <a href=https://tools.ietf.org/html/rfc6020">RFC6020</a>, for example
- * {@code http://example.acme.com/system?revision=2008-04-01}.
- *
- * @return Namespace in form defined by section 5.6.4. of RFC6020.
- * @throws URISyntaxException on incorrect namespace definition
- *
- */
- @NonNull URI getRevisionNamespace() throws URISyntaxException {
- final String query = revision == null ? "" : "revision=" + revision.toString();
- return new URI(namespace.getScheme(), namespace.getUserInfo(), namespace.getHost(), namespace.getPort(),
- namespace.getPath(), query, namespace.getFragment());
- }
-
@Override
public @NonNull String toString() {
return MoreObjects.toStringHelper(QNameModule.class).omitNullValues().add("ns", namespace)
package org.opendaylight.yangtools.yang.common;
import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertThrows;
import static org.junit.Assert.assertTrue;
@Test
public void testQNameModule() throws URISyntaxException {
final QNameModule qnameModule = QNameModule.create(NS, Revision.of("2000-01-01"));
- assertNotNull(qnameModule.toString());
- assertNotNull(qnameModule.getRevisionNamespace());
+ assertEquals("QNameModule{ns=urn:foo, rev=2000-01-01}", qnameModule.toString());
}
}