Skip to content

Commit

Permalink
Merge pull request #117 from DiSSCo/feature/update-locations
Browse files Browse the repository at this point in the history
Update URLs for locations
  • Loading branch information
samleeflang authored Dec 11, 2024
2 parents 7b3ed7b + 8ddab99 commit a24c92e
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -871,22 +871,22 @@ private List<XmlElement> getXmlElements(String handle, FdoType fdoType, String k
applicationProperties.getUiUrl() + "/ds/" + handle,
"HTML"));
locations.add(new XmlElement(i.getAndIncrement(), "0",
applicationProperties.getApiUrl() + "/digital-specimen/" + handle, "JSON"));
applicationProperties.getApiUrl() + "/digital-specimen/v1/" + handle, "JSON"));
if (keyAttribute != null) {
locations.add(new XmlElement(i.getAndIncrement(), "0", keyAttribute, "CATALOG"));
}
}
case DATA_MAPPING -> {
locations.add(new XmlElement(i.getAndIncrement(), "1",
applicationProperties.getOrchestrationUrl() + "/mapping/" + handle, "HTML"));
applicationProperties.getOrchestrationUrl() + "/data-mapping/" + handle, "HTML"));
locations.add(new XmlElement(i.getAndIncrement(), "0",
applicationProperties.getOrchestrationUrl() + "/api/v1/mapping/" + handle, "JSON"));
applicationProperties.getOrchestrationUrl() + "/data-mapping/v1/" + handle, "JSON"));
}
case SOURCE_SYSTEM -> {
locations.add(new XmlElement(i.getAndIncrement(), "1",
applicationProperties.getOrchestrationUrl() + "/source-system/" + handle, "HTML"));
locations.add(new XmlElement(i.getAndIncrement(), "0",
applicationProperties.getOrchestrationUrl() + "/api/v1/source-system/" + handle,
applicationProperties.getOrchestrationUrl() + "/source-system/v1/" + handle,
"JSON"));
}
case DIGITAL_MEDIA -> {
Expand All @@ -895,18 +895,18 @@ private List<XmlElement> getXmlElements(String handle, FdoType fdoType, String k
applicationProperties.getUiUrl() + "/dm/" + handle,
"HTML"));
locations.add(new XmlElement(i.getAndIncrement(), "0",
applicationProperties.getApiUrl() + "/digital-media/" + handle, "JSON"));
applicationProperties.getApiUrl() + "/digital-media/v1/" + handle, "JSON"));
if (keyAttribute != null) {
locations.add(new XmlElement(i.getAndIncrement(), "0", keyAttribute, "MEDIA"));
}
}
case ANNOTATION -> locations.add(new XmlElement(i.getAndIncrement(), "1",
applicationProperties.getApiUrl() + "/annotations/" + handle, "JSON"));
applicationProperties.getApiUrl() + "/annotations/v1/" + handle, "JSON"));
case MAS -> {
locations.add(new XmlElement(i.getAndIncrement(), "1",
applicationProperties.getOrchestrationUrl() + "/mas/" + handle, "HTML"));
locations.add(new XmlElement(i.getAndIncrement(), "0",
applicationProperties.getOrchestrationUrl() + "/api/v1/mas/" + handle, "JSON"));
applicationProperties.getOrchestrationUrl() + "/mas/v1/" + handle, "JSON"));
}
case ORGANISATION ->
locations.add(new XmlElement(i.getAndIncrement(), "1", keyAttribute, "ROR"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -468,7 +468,7 @@ void testPrepareNewAnnotationRecordMinWithLoc() throws Exception {

attributes.replace(LOC, new FdoAttribute(LOC, CREATED,
"<locations>"
+ "<location href=\"https://sandbox.dissco.tech/api/v1/annotations/20.5000.1025/QRS-321-ABC\" id=\"0\" view=\"JSON\" weight=\"1\"/>"
+ "<location href=\"https://sandbox.dissco.tech/annotations/v1/20.5000.1025/QRS-321-ABC\" id=\"0\" view=\"JSON\" weight=\"1\"/>"
+ "<location href=\"" + LOC_TESTVAL + "\" id=\"1\" weight=\"0\"/>" + "</locations>"));
var expected = new FdoRecord(HANDLE, FdoType.ANNOTATION, attributes, null, attributes.values());

Expand Down Expand Up @@ -507,7 +507,7 @@ void testActivateDigitalSpecimenRecordWithUserLocations() throws Exception {
attributes.replace(LOC, new FdoAttribute(LOC, UPDATED,
"<locations>"
+ "<location href=\"https://sandbox.dissco.tech/ds/20.5000.1025/QRS-321-ABC\" id=\"0\" view=\"HTML\" weight=\"1\"/>"
+ "<location href=\"https://sandbox.dissco.tech/api/v1/digital-specimen/20.5000.1025/QRS-321-ABC\" id=\"1\" view=\"JSON\" weight=\"0\"/>"
+ "<location href=\"https://sandbox.dissco.tech/digital-specimen/v1/20.5000.1025/QRS-321-ABC\" id=\"1\" view=\"JSON\" weight=\"0\"/>"
+ "<location href=\"" + CATALOG_ID_TEST + "\" id=\"2\" view=\"CATALOG\" weight=\"0\"/>"
+ "<location href=\"" + LOC_TESTVAL + "\" id=\"3\" weight=\"0\"/>" + "</locations>"));
activateRecord(attributes);
Expand Down Expand Up @@ -539,7 +539,7 @@ void testActivateDigitalSpecimenRecordWithoutOtherSpecimenIds() throws Exception

var expected = new FdoAttribute(LOC, UPDATED,
setLocations(HANDLE, FdoType.DIGITAL_SPECIMEN, true));
//<locations><location href="https://sandbox.dissco.tech/ds/20.5000.1025/QRS-321-ABC" id="0" weight="0"/><location href="https://sandbox.dissco.tech/api/v1/digital-specimen/20.5000.1025/QRS-321-ABC" id="1" weight="0"/><location href="https://botanical.nl/-qrs-123" id="2" weight="0"/><location href="https://sandbox.dissco.tech/ds/20.5000.1025/QRS-321-ABC" id="HTML" weight="1"/><location href="https://sandbox.dissco.tech/api/v1/digital-specimen/20.5000.1025/QRS-321-ABC" id="JSON" weight="0"/><location href="https://botanical.nl/-qrs-123" id="CATALOG" weight="0"/></locations>), ttl=86400, timestamp=2023-11-01T09:59:24Z),
//<locations><location href="https://sandbox.dissco.tech/ds/20.5000.1025/QRS-321-ABC" id="0" weight="0"/><location href="https://sandbox.dissco.tech/digital-specimen/v1/20.5000.1025/QRS-321-ABC" id="1" weight="0"/><location href="https://botanical.nl/-qrs-123" id="2" weight="0"/><location href="https://sandbox.dissco.tech/ds/20.5000.1025/QRS-321-ABC" id="HTML" weight="1"/><location href="https://sandbox.dissco.tech/api/v1/digital-specimen/20.5000.1025/QRS-321-ABC" id="JSON" weight="0"/><location href="https://botanical.nl/-qrs-123" id="CATALOG" weight="0"/></locations>), ttl=86400, timestamp=2023-11-01T09:59:24Z),

// When
var result = fdoRecordService.activatePidRecord(draft, UPDATED);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ public class TestUtils {
// Tombstone Record vals
public static final String TOMBSTONE_TEXT_TESTVAL = "pid was deleted";
// Misc
public static final String API_URL = "https://sandbox.dissco.tech/api/v1";
public static final String API_URL = "https://sandbox.dissco.tech";
public static final String UI_URL = "https://sandbox.dissco.tech";
public static final String PATH = UI_URL + HANDLE;
public static final String ORCHESTRATION_URL = "https://orchestration.dissco.tech/";
Expand Down Expand Up @@ -933,18 +933,18 @@ private static List<XmlElement> defaultLocations(String handle, FdoType type, bo
case DIGITAL_SPECIMEN -> {
locations.add(new XmlElement(i.getAndIncrement(), "1", UI_URL + "/ds/" + handle, "HTML"));
locations.add(
new XmlElement(i.getAndIncrement(), "0", API_URL + "/digital-specimen/" + handle,
new XmlElement(i.getAndIncrement(), "0", API_URL + "/digital-specimen/v1/" + handle,
"JSON"));
if (addKeyLoc) {
locations.add(new XmlElement(i.getAndIncrement(), "0", CATALOG_ID_TEST, "CATALOG"));
}
}
case DATA_MAPPING -> {
locations.add(
new XmlElement(i.getAndIncrement(), "1", ORCHESTRATION_URL + "/mapping/" + handle,
new XmlElement(i.getAndIncrement(), "1", ORCHESTRATION_URL + "/data-mapping/" + handle,
"HTML"));
locations.add(new XmlElement(i.getAndIncrement(), "0",
ORCHESTRATION_URL + "/api/v1/mapping/" + handle,
ORCHESTRATION_URL + "/data-mapping/v1/" + handle,
"JSON"));
}
case SOURCE_SYSTEM -> {
Expand All @@ -953,21 +953,21 @@ private static List<XmlElement> defaultLocations(String handle, FdoType type, bo
"HTML"));
locations.add(
new XmlElement(i.getAndIncrement(), "0",
ORCHESTRATION_URL + "/api/v1/source-system/" + handle, "JSON"));
ORCHESTRATION_URL + "/source-system/v1/" + handle, "JSON"));
}
case DIGITAL_MEDIA -> {
locations.add(
new XmlElement(i.getAndIncrement(), "1", UI_URL + "/dm/" + handle, "HTML"));
locations.add(
new XmlElement(i.getAndIncrement(), "0", API_URL + "/digital-media/" + handle, "JSON"));
new XmlElement(i.getAndIncrement(), "0", API_URL + "/digital-media/v1/" + handle, "JSON"));
if (addKeyLoc) {
locations.add(
new XmlElement(i.getAndIncrement(), "0", PRIMARY_MEDIA_ID_TESTVAL, "MEDIA"));
}
}
case ANNOTATION -> {
locations.add(
new XmlElement(i.getAndIncrement(), "1", API_URL + "/annotations/" + handle, "JSON"));
new XmlElement(i.getAndIncrement(), "1", API_URL + "/annotations/v1/" + handle, "JSON"));
}
case ORGANISATION -> {
if (addKeyLoc) {
Expand All @@ -978,7 +978,7 @@ private static List<XmlElement> defaultLocations(String handle, FdoType type, bo
locations.add(
new XmlElement(i.getAndIncrement(), "1", ORCHESTRATION_URL + "/mas/" + handle, "HTML"));
locations.add(
new XmlElement(i.getAndIncrement(), "0", ORCHESTRATION_URL + "/api/v1/mas/" + handle,
new XmlElement(i.getAndIncrement(), "0", ORCHESTRATION_URL + "/mas/v1/" + handle,
"JSON"));
}
default -> {
Expand Down

0 comments on commit a24c92e

Please sign in to comment.