-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
enable redirection of iDigBio recordset uuids also; related to #199
- Loading branch information
Jorrit Poelen
committed
Dec 22, 2023
1 parent
a10a3ba
commit 1c2d3b3
Showing
7 changed files
with
121 additions
and
159 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 0 additions & 49 deletions
49
preston-serve/src/main/resources/bio/guoda/preston/server/hash.rq
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
62 changes: 62 additions & 0 deletions
62
preston-serve/src/test/java/bio/guoda/preston/server/RedirectingServletIT.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
package bio.guoda.preston.server; | ||
|
||
import bio.guoda.preston.RefNodeFactory; | ||
import com.fasterxml.jackson.databind.JsonNode; | ||
import com.fasterxml.jackson.databind.ObjectMapper; | ||
import org.hamcrest.core.Is; | ||
import org.junit.Test; | ||
|
||
import java.io.IOException; | ||
import java.net.URISyntaxException; | ||
import java.util.Map; | ||
|
||
import static bio.guoda.preston.server.RedirectingServlet.ACTIVITY; | ||
import static bio.guoda.preston.server.RedirectingServlet.CONTENT_ID; | ||
import static org.hamcrest.MatcherAssert.assertThat; | ||
|
||
public class RedirectingServletIT { | ||
|
||
|
||
private String sparqlEndpoint = "http://localhost:7878/query"; | ||
|
||
@Test | ||
public void dealiasDOI() throws IOException, URISyntaxException { | ||
Map<String, String> contentId = RedirectingServlet.findMostRecentContentId( | ||
RefNodeFactory.toIRI("https://doi.org/10.15468/aomfnb"), | ||
RedirectingServlet.QUERY_TYPE_DOI, | ||
sparqlEndpoint | ||
); | ||
assertThat(contentId.get(CONTENT_ID), Is.is("hash://sha256/1e2b7436fce1848f41698e5a9c193f311abaf0ee051bec1a2e48b5106d29524d")); | ||
assertThat(contentId.get(ACTIVITY), Is.is("urn:uuid:77f3faf7-acd2-4f14-9c0e-4e04ef5b63c7")); | ||
} | ||
|
||
@Test | ||
public void dealiasUUIDGBIF() throws IOException, URISyntaxException { | ||
Map<String, String> contentId = RedirectingServlet.findMostRecentContentId( | ||
RefNodeFactory.toIRI("urn:uuid:4fa7b334-ce0d-4e88-aaae-2e0c138d049e"), | ||
RedirectingServlet.QUERY_TYPE_UUID, | ||
sparqlEndpoint); | ||
assertThat(contentId.get(CONTENT_ID), Is.is("hash://sha256/1e2b7436fce1848f41698e5a9c193f311abaf0ee051bec1a2e48b5106d29524d")); | ||
|
||
} | ||
|
||
@Test | ||
public void dealiasUUIDiDigBio() throws IOException, URISyntaxException { | ||
Map<String, String> contentId = RedirectingServlet.findMostRecentContentId( | ||
RefNodeFactory.toIRI("urn:uuid:65007e62-740c-4302-ba20-260fe68da291"), | ||
RedirectingServlet.QUERY_TYPE_UUID, | ||
sparqlEndpoint); | ||
assertThat(contentId.get(CONTENT_ID), Is.is("hash://sha256/f5d8f67c1eca34cbba1abac12f353585c78bb053bc8ce7ee7e7a78846e1bfc4a")); | ||
|
||
} | ||
|
||
@Test | ||
public void dealiasURL() throws URISyntaxException, IOException { | ||
Map<String, String> contentId = RedirectingServlet.findMostRecentContentId( | ||
RefNodeFactory.toIRI("https://hosted-datasets.gbif.org/eBird/2022-eBird-dwca-1.0.zip"), | ||
RedirectingServlet.QUERY_TYPE_URL, | ||
sparqlEndpoint); | ||
assertThat(contentId.get(CONTENT_ID), Is.is("hash://sha256/1e2b7436fce1848f41698e5a9c193f311abaf0ee051bec1a2e48b5106d29524d")); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters