From 1ac32033604ae6ca02e3ff05740be916a68c9a30 Mon Sep 17 00:00:00 2001 From: Patrick Dowler Date: Fri, 19 Apr 2024 16:00:24 -0700 Subject: [PATCH] reg: added example-content and tweaked OAIValidityTest test expects the example content to be deployed --- reg/example-content/Identify.xml | 49 ++++++++++++++++++ reg/example-content/ListMetadataFormats.xml | 15 ++++++ reg/example-content/ListSets.xml | 7 +++ reg/example-content/README.md | 28 +++++++++++ reg/example-content/example.net.xml | 38 ++++++++++++++ reg/example-content/example.net/deleted.xml | 10 ++++ reg/example-content/example.net/registry.xml | 50 +++++++++++++++++++ .../org/opencadc/reg/OAIValidityTest.java | 20 ++++---- 8 files changed, 206 insertions(+), 11 deletions(-) create mode 100644 reg/example-content/Identify.xml create mode 100644 reg/example-content/ListMetadataFormats.xml create mode 100644 reg/example-content/ListSets.xml create mode 100644 reg/example-content/README.md create mode 100644 reg/example-content/example.net.xml create mode 100644 reg/example-content/example.net/deleted.xml create mode 100644 reg/example-content/example.net/registry.xml diff --git a/reg/example-content/Identify.xml b/reg/example-content/Identify.xml new file mode 100644 index 0000000..555790f --- /dev/null +++ b/reg/example-content/Identify.xml @@ -0,0 +1,49 @@ + + + Example Repository + https://www.example.net/reg/oai + 2.0 + support@example.net + 2000-01-01T00:00:00Z + persistent + YYYY-MM-DDThh:mm:ssZ + + + Example Registry + Example Registry + ivo://example.net/registry + + Example Data Provider + + Responsible Person +
Center of the Universe
+ responsible.person@example.net +
+
+ + registry + Example Registry + https://www.example.net/reg + Registry + + + + https://www.example.net/reg/capabilities + + + + + https://www.example.net/reg/oai + + 100 + + false + example.net +
+
+
diff --git a/reg/example-content/ListMetadataFormats.xml b/reg/example-content/ListMetadataFormats.xml new file mode 100644 index 0000000..f10bfb6 --- /dev/null +++ b/reg/example-content/ListMetadataFormats.xml @@ -0,0 +1,15 @@ + + + + ivo_vor + http://www.ivoa.net/xml/VOResource/v1.0 + http://www.ivoa.net/xml/VOResource/v1.0 + + + diff --git a/reg/example-content/ListSets.xml b/reg/example-content/ListSets.xml new file mode 100644 index 0000000..de6eda5 --- /dev/null +++ b/reg/example-content/ListSets.xml @@ -0,0 +1,7 @@ + + + + ivo_managed + ivo_managed + + diff --git a/reg/example-content/README.md b/reg/example-content/README.md new file mode 100644 index 0000000..8203f55 --- /dev/null +++ b/reg/example-content/README.md @@ -0,0 +1,28 @@ +# example registry content + +This example is for the _authority_ named `example.net`. To expose this content +and run the integration tests, the `reg` service needs to be configured with +``` +org.opencadc.reg.authority = example.net +``` +and the remaining files must be included in `/config/content` of the container. + +## Identify.xml and example.net/registry.xml +These two files describe the registry itself. It's the same VOResource +record inside a different OAI _envelope_. + +## example.net.xml +This file is the authority record. + +## ListMetadataFormats.xml and ListSets.xml +These are static responses to OAI queries and can be used as-is. + +## example.net +This directory contains records for all the resources to be published. In this +example there is only the registry record itself, but other files can be added. + +If resource identifiers (`ivo://{authority}/{name}`) have multiple path components, +those should be reflected in the structure under the _authority_ directory. + +For example, the `ivo://example.net/registry` record is in `example.net/registry.xml` +and the `ivo://example.net/foo/bar` record would be in `example.net/foo/bar.xml`. diff --git a/reg/example-content/example.net.xml b/reg/example-content/example.net.xml new file mode 100644 index 0000000..574aaab --- /dev/null +++ b/reg/example-content/example.net.xml @@ -0,0 +1,38 @@ + + + +
+ ivo://example.net + 2020-01-02T03:04:05Z + ivo_managed +
+ + + Example Data Provider + EG + ivo://example.net + + Example Data Provider + + Responsible Person +
Center of the Universe
+ responsible.person@example.net +
+
+ + virtual observatory + authority for EG + https://www.example.net/ + Other + General + + Example Data Provider +
+
+
+
diff --git a/reg/example-content/example.net/deleted.xml b/reg/example-content/example.net/deleted.xml new file mode 100644 index 0000000..7161d2c --- /dev/null +++ b/reg/example-content/example.net/deleted.xml @@ -0,0 +1,10 @@ + + + +
+ ivo://example.net/deleted + 2021-01-02T03:04:05Z + ivo_managed +
+
+
diff --git a/reg/example-content/example.net/registry.xml b/reg/example-content/example.net/registry.xml new file mode 100644 index 0000000..1c95449 --- /dev/null +++ b/reg/example-content/example.net/registry.xml @@ -0,0 +1,50 @@ + + + +
+ ivo://example.net/registry + 2020-01-02T03:04:05Z + ivo_managed +
+ + + Example Registry + Example Registry + ivo://example.net/registry + + Example Data Provider + + Responsible Person +
Center of the Universe
+ responsible.person@example.net +
+
+ + registry + Example Registry + https://example.net/reg + Registry + + + + https://example.net/reg/capabilities + + + + + https://example.net/reg/oai + + 100 + + false + example.net +
+
+
+
diff --git a/reg/src/intTest/java/org/opencadc/reg/OAIValidityTest.java b/reg/src/intTest/java/org/opencadc/reg/OAIValidityTest.java index 5a0d03f..cd155ad 100644 --- a/reg/src/intTest/java/org/opencadc/reg/OAIValidityTest.java +++ b/reg/src/intTest/java/org/opencadc/reg/OAIValidityTest.java @@ -67,13 +67,11 @@ package org.opencadc.reg; -import ca.nrc.cadc.auth.AuthMethod; import ca.nrc.cadc.net.HttpDownload; import ca.nrc.cadc.reg.Capabilities; import ca.nrc.cadc.reg.Capability; import ca.nrc.cadc.reg.Interface; import ca.nrc.cadc.reg.Standards; -import ca.nrc.cadc.reg.client.RegistryClient; import ca.nrc.cadc.util.Log4jInit; import java.io.ByteArrayOutputStream; import java.io.StringReader; @@ -97,14 +95,11 @@ public class OAIValidityTest { private static final Logger log = Logger.getLogger(OAIValidityTest.class); - private static final List DELETED_RESOURCES = new ArrayList(); + private static final String DELETED_RESOURCE = "ivo://example.net/deleted"; static { - Log4jInit.setLevel("org.opencadc.reg.server", Level.INFO); + Log4jInit.setLevel("org.opencadc.reg", Level.INFO); Log4jInit.setLevel("ca.nrc.cadc.reg", Level.INFO); - DELETED_RESOURCES.add("ivo://cadc.nrc.ca/hips2"); - DELETED_RESOURCES.add("ivo://cadc.nrc.ca/tap"); - DELETED_RESOURCES.add("ivo://cadc.nrc.ca/vospace"); } final URL oaiEndpoint; @@ -234,7 +229,7 @@ public void testListIdentifiers() { log.info("testListIdentifiers: " + id + " status: " + status); Assert.assertNotNull(id); - if (DELETED_RESOURCES.contains(id)) { + if (DELETED_RESOURCE.equals(id)) { Assert.assertEquals("deleted", status); } else { Assert.assertNull(status); @@ -277,7 +272,10 @@ public void testListIdentifiersEmpty() { @Test public void testListIdentifiersFromUntil() { try { - URL u = new URL(oaiEndpoint.toExternalForm() + "?verb=ListIdentifiers&metadataPrefix=ivo_vor&from=2019-06-15T21:15:10Z&until=2019-06-15T21:15:20Z"); + String from = "2020-01-01T00:00:00Z"; + String until = "2020-02-02T00:00:00Z"; + URL u = new URL(oaiEndpoint.toExternalForm() + "?verb=ListIdentifiers&metadataPrefix=ivo_vor" + + "&from=" + from + "&until=" + until); log.info(u.toExternalForm()); ByteArrayOutputStream bos = new ByteArrayOutputStream(); HttpDownload get = new HttpDownload(u, bos); @@ -304,7 +302,7 @@ public void testListIdentifiersFromUntil() { @Test public void testGetRecord() { try { - URL u = new URL(oaiEndpoint.toExternalForm() + "?verb=GetRecord&metadataPrefix=ivo_vor&identifier=ivo://cadc.nrc.ca/argus"); + URL u = new URL(oaiEndpoint.toExternalForm() + "?verb=GetRecord&metadataPrefix=ivo_vor&identifier=ivo://example.net/registry"); log.info(u.toExternalForm()); ByteArrayOutputStream bos = new ByteArrayOutputStream(); HttpDownload get = new HttpDownload(u, bos); @@ -348,7 +346,7 @@ public void testGetRecord() { @Test public void testGetDeletedRecord() { try { - URL u = new URL(oaiEndpoint.toExternalForm() + "?verb=GetRecord&metadataPrefix=ivo_vor&identifier=ivo://cadc.nrc.ca/tap"); + URL u = new URL(oaiEndpoint.toExternalForm() + "?verb=GetRecord&metadataPrefix=ivo_vor&identifier=" + DELETED_RESOURCE); log.info(u.toExternalForm()); ByteArrayOutputStream bos = new ByteArrayOutputStream(); HttpDownload get = new HttpDownload(u, bos);