diff --git a/islandora-connector-houdini/src/main/java/ca/islandora/alpaca/connector/houdini/HoudiniConnector.java b/islandora-connector-houdini/src/main/java/ca/islandora/alpaca/connector/houdini/HoudiniConnector.java index 75c775ae..25cb0647 100644 --- a/islandora-connector-houdini/src/main/java/ca/islandora/alpaca/connector/houdini/HoudiniConnector.java +++ b/islandora-connector-houdini/src/main/java/ca/islandora/alpaca/connector/houdini/HoudiniConnector.java @@ -61,13 +61,12 @@ public void configure() { .setHeader("Accept", simple("${exchangeProperty.event.attachment.content.mimetype}")) .setHeader("X-Islandora-Args", simple("${exchangeProperty.event.attachment.content.args}")) .setHeader("Apix-Ldp-Resource", simple("${exchangeProperty.event.attachment.content.sourceUri}")) - .transform(simple("${null}")) + .setBody(simple("${null}")) .to("{{houdini.convert.url}}") // PUT the media. .removeHeaders("*", "Authorization", "Content-Type") - .setHeader("Content-Disposition", - simple("attachment; filename=\"${exchangeProperty.event.attachment.content.filename}\"")) + .setHeader("Content-Location", simple("${exchangeProperty.event.attachment.content.fileUploadUri}")) .setHeader(Exchange.HTTP_METHOD, constant("PUT")) .toD("${exchangeProperty.event.attachment.content.destinationUri}"); } diff --git a/islandora-connector-houdini/src/main/java/ca/islandora/alpaca/connector/houdini/event/AS2AttachmentContent.java b/islandora-connector-houdini/src/main/java/ca/islandora/alpaca/connector/houdini/event/AS2AttachmentContent.java index 5fceec0c..d3ad2de8 100644 --- a/islandora-connector-houdini/src/main/java/ca/islandora/alpaca/connector/houdini/event/AS2AttachmentContent.java +++ b/islandora-connector-houdini/src/main/java/ca/islandora/alpaca/connector/houdini/event/AS2AttachmentContent.java @@ -86,23 +86,24 @@ public void setArgs(final String args) { } /** - * @return Filename + * @return File upload uri */ - public String getFilename() { - return filename; + @JsonProperty(value = "file_upload_uri") + public String getFileUploadUri() { + return fileUploadUri; } /** - * @param filename Filename + * @param fileUploadUri File upload uri */ - public void setFilename(final String filename) { - this.filename = filename; + public void setFileUploadUri(final String fileUploadUri) { + this.fileUploadUri = fileUploadUri; } private String sourceUri; private String destinationUri; private String mimetype; private String args; - private String filename; + private String fileUploadUri; } diff --git a/islandora-connector-houdini/src/test/java/ca/islandora/alpaca/connector/houdini/HoudiniConnectorTest.java b/islandora-connector-houdini/src/test/java/ca/islandora/alpaca/connector/houdini/HoudiniConnectorTest.java index d583ab58..5f0c018e 100644 --- a/islandora-connector-houdini/src/test/java/ca/islandora/alpaca/connector/houdini/HoudiniConnectorTest.java +++ b/islandora-connector-houdini/src/test/java/ca/islandora/alpaca/connector/houdini/HoudiniConnectorTest.java @@ -74,17 +74,17 @@ public void configure() throws Exception { exchange.getIn().setBody("SOME DERIVATIVE", String.class); }); - mockEndpointsAndSkip("http://localhost:8000/node/1/media/image/3"); + mockEndpointsAndSkip("http://localhost:8000/node/2/media/image/3"); } }); context.start(); - final MockEndpoint endpoint = getMockEndpoint("mock:http:localhost:8000/node/1/media/image/3"); + final MockEndpoint endpoint = getMockEndpoint("mock:http:localhost:8000/node/2/media/image/3"); endpoint.expectedMessageCount(1); endpoint.expectedHeaderReceived(Exchange.HTTP_METHOD, "PUT"); endpoint.expectedHeaderReceived(CONTENT_TYPE, "image/jpeg"); - endpoint.expectedHeaderReceived("Content-Disposition", "attachment; filename=\"1 - ServiceFile.jpeg\""); + endpoint.expectedHeaderReceived("Content-Location", "public://2018-08/2-Service File.jpg"); endpoint.expectedHeaderReceived("Authorization", "Bearer islandora"); template.send(exchange -> { diff --git a/islandora-connector-houdini/src/test/resources/AS2Event.jsonld b/islandora-connector-houdini/src/test/resources/AS2Event.jsonld index 515265ff..7b659272 100644 --- a/islandora-connector-houdini/src/test/resources/AS2Event.jsonld +++ b/islandora-connector-houdini/src/test/resources/AS2Event.jsonld @@ -2,7 +2,7 @@ "@context":"https:\/\/www.w3.org\/ns\/activitystreams", "actor":{ "type":"Person", - "id":"urn:uuid:01e93c43-bb4a-4c7e-9402-f15242472853", + "id":"urn:uuid:9029a0c0-d845-4ddd-864c-2198d45839da", "url":[ { "name":"Canonical", @@ -14,26 +14,28 @@ ] }, "object":{ - "id":"urn:uuid:3d3550ff-1d4c-4484-a406-8f97c1673e5c", + "id":"urn:uuid:72358916-51e9-4712-b756-4b0404c91b1d", "url":[ { - "name":"Canoncial", + "name":"Canonical", "type":"Link", - "href":"http:\/\/localhost:8000\/node\/1", + "href":"http:\/\/localhost:8000\/node\/2", "mediaType":"text\/html", "rel":"canonical" }, { - "name":"JSONLD", + "name":"JSON", "type":"Link", - "href":"http:\/\/localhost:8000\/node\/1?_format=jsonld", - "mediaType":"application\/ld+json" + "href":"http:\/\/localhost:8000\/node\/2?_format=json", + "mediaType":"application\/json", + "rel":"alternate" }, { - "name":"JSON", + "name":"JSONLD", "type":"Link", - "href":"http:\/\/localhost:8000\/node\/1?_format=json", - "mediaType":"application\/json" + "href":"http:\/\/localhost:8000\/node\/2?_format=jsonld", + "mediaType":"application\/ld+json", + "rel":"alternate" } ] }, @@ -44,9 +46,9 @@ "content":{ "mimetype":"image\/jpeg", "args":"", - "source_uri":"http:\/\/localhost:8000\/sites\/default\/files\/2018-05\/Test.jpg", - "destination_uri":"http:\/\/localhost:8000\/node\/1\/media\/image\/3", - "filename":"1 - ServiceFile.jpeg" + "source_uri":"http:\/\/localhost:8000\/_flysystem\/fedora\/2018-07\/Egyptology.jpg", + "destination_uri":"http:\/\/localhost:8000\/node\/2\/media\/image\/3", + "file_upload_uri":"public:\/\/2018-08\/2-Service File.jpg" }, "mediaType":"application\/json" } diff --git a/islandora-indexing-fcrepo/build.gradle b/islandora-indexing-fcrepo/build.gradle index 5ebd9fd7..ba126fe8 100644 --- a/islandora-indexing-fcrepo/build.gradle +++ b/islandora-indexing-fcrepo/build.gradle @@ -6,6 +6,7 @@ dependencies { compile group: 'org.apache.camel', name: 'camel-core', version: camelVersion compile group: 'org.apache.camel', name: 'camel-blueprint', version: camelVersion compile group: 'org.apache.camel', name: 'camel-http4', version: camelVersion + compile group: 'org.apache.camel', name: 'camel-jackson', version: camelVersion compile group: 'org.apache.camel', name: 'camel-jsonpath', version: camelVersion compile group: 'org.slf4j', name: 'slf4j-api', version: slf4jVersion compile group: 'commons-io', name: 'commons-io', version: commonsIoVersion diff --git a/islandora-indexing-fcrepo/src/main/cfg/ca.islandora.alpaca.indexing.fcrepo.cfg b/islandora-indexing-fcrepo/src/main/cfg/ca.islandora.alpaca.indexing.fcrepo.cfg index 203802c7..77e6bd15 100644 --- a/islandora-indexing-fcrepo/src/main/cfg/ca.islandora.alpaca.indexing.fcrepo.cfg +++ b/islandora-indexing-fcrepo/src/main/cfg/ca.islandora.alpaca.indexing.fcrepo.cfg @@ -2,10 +2,12 @@ error.maxRedeliveries=5 # Input queues -content.stream=activemq:queue:islandora-indexing-fcrepo-content -file.stream=activemq:queue:islandora-indexing-fcrepo-file +node.stream=activemq:queue:islandora-indexing-fcrepo-content +node.delete.stream=activemq:queue:islandora-indexing-fcrepo-delete media.stream=activemq:queue:islandora-indexing-fcrepo-media -delete.stream=activemq:queue:islandora-indexing-fcrepo-delete +file.stream=activemq:queue:islandora-indexing-fcrepo-file +file.delete.stream=activemq:queue:islandora-indexing-fcrepo-file-delete -# Base url for Milliner microservice +# Base url for microservices milliner.baseUrl=http://localhost:8000/milliner/ +gemini.baseUrl=http://localhost:8000/gemini/ diff --git a/islandora-indexing-fcrepo/src/main/java/ca/islandora/alpaca/indexing/fcrepo/FcrepoIndexer.java b/islandora-indexing-fcrepo/src/main/java/ca/islandora/alpaca/indexing/fcrepo/FcrepoIndexer.java index a8e58c49..14be670c 100644 --- a/islandora-indexing-fcrepo/src/main/java/ca/islandora/alpaca/indexing/fcrepo/FcrepoIndexer.java +++ b/islandora-indexing-fcrepo/src/main/java/ca/islandora/alpaca/indexing/fcrepo/FcrepoIndexer.java @@ -22,12 +22,14 @@ import static org.apache.camel.LoggingLevel.INFO; import static org.slf4j.LoggerFactory.getLogger; +import ca.islandora.alpaca.indexing.fcrepo.event.AS2Event; import org.apache.camel.Exchange; import org.apache.camel.Predicate; import org.apache.camel.PropertyInject; import org.apache.camel.builder.RouteBuilder; import org.apache.camel.builder.PredicateBuilder; import org.apache.camel.http.common.HttpOperationFailedException; +import org.apache.camel.model.dataformat.JsonLibrary; import org.slf4j.Logger; /** @@ -53,9 +55,7 @@ public void setMaxRedeliveries(final int maxRedeliveries) { * @return Milliner base url */ public String getMillinerBaseUrl() { - // Enforce trailing slash. - final String trimmed = millinerBaseUrl.trim(); - return trimmed.endsWith("/") ? trimmed : trimmed + "/"; + return enforceTrailingSlash(millinerBaseUrl); } /** @@ -65,12 +65,34 @@ public void setMillinerBaseUrl(final String millinerBaseUrl) { this.millinerBaseUrl = millinerBaseUrl; } + /** + * @return Gemini base url + */ + public String getGeminiBaseUrl() { + return enforceTrailingSlash(geminiBaseUrl); + } + + /** + * @param geminiBaseUrl Gemini base url + */ + public void setGeminiBaseUrl(final String geminiBaseUrl) { + this.geminiBaseUrl = geminiBaseUrl; + } + + private String enforceTrailingSlash(final String baseUrl) { + final String trimmed = baseUrl.trim(); + return trimmed.endsWith("/") ? trimmed : trimmed + "/"; + } + @PropertyInject("error.maxRedeliveries") private int maxRedeliveries; @PropertyInject("milliner.baseUrl") private String millinerBaseUrl; + @PropertyInject("gemini.baseUrl") + private String geminiBaseUrl; + private static final Logger LOGGER = getLogger(FcrepoIndexer.class); @Override @@ -97,29 +119,28 @@ public void configure() { "Error indexing resource in fcrepo: ${exception.message}\n\n${exception.stacktrace}" ); - from("{{content.stream}}") - .routeId("FcrepoIndexerContent") - .removeHeaders("*", "Authorization") - .setHeader(Exchange.CONTENT_TYPE, constant("application/ld+json")) - .setHeader(Exchange.HTTP_METHOD, constant("POST")) - .toD(getMillinerBaseUrl() + "content"); + from("{{node.stream}}") + .routeId("FcrepoIndexerNode") - from("{{file.stream}}") - .routeId("FcrepoIndexerFile") - .removeHeaders("*", "Authorization") - .setHeader(Exchange.CONTENT_TYPE, constant("application/ld+json")) - .setHeader(Exchange.HTTP_METHOD, constant("POST")) - .to(getMillinerBaseUrl() + "file"); + // Parse the event into a POJO. + .unmarshal().json(JsonLibrary.Jackson, AS2Event.class) - from("{{media.stream}}") - .routeId("FcrepoIndexerMedia") + // Extract relevant data from the event. + .setProperty("event").simple("${body}") + .setProperty("uuid").simple("${exchangeProperty.event.object.id.replaceAll(\"urn:uuid:\",\"\")}") + .setProperty("jsonldUrl").simple("${exchangeProperty.event.object.url[2].href}") + + // Prepare the message. .removeHeaders("*", "Authorization") - .setHeader(Exchange.CONTENT_TYPE, constant("application/ld+json")) .setHeader(Exchange.HTTP_METHOD, constant("POST")) - .to(getMillinerBaseUrl() + "media"); + .setHeader("Content-Location", simple("${exchangeProperty.jsonldUrl}")) + .setBody(simple("${null}")) + + // Pass it to milliner. + .toD(getMillinerBaseUrl() + "node/${exchangeProperty.uuid}"); - from("{{delete.stream}}") - .routeId("FcrepoIndexerDelete") + from("{{node.delete.stream}}") + .routeId("FcrepoIndexerDeleteNode") .onException(HttpOperationFailedException.class) .onWhen(is404) .useOriginalMessage() @@ -130,10 +151,81 @@ public void configure() { "Received 404 from Milliner, skipping de-indexing." ) .end() - .setProperty("urn").jsonpath("$.object.id") - .setProperty("uuid").simple("${exchangeProperty.urn.replaceAll(\"urn:uuid:\",\"\")}") + // Parse the event into a POJO. + .unmarshal().json(JsonLibrary.Jackson, AS2Event.class) + + // Extract relevant data from the event. + .setProperty("event").simple("${body}") + .setProperty("uuid").simple("${exchangeProperty.event.object.id.replaceAll(\"urn:uuid:\",\"\")}") + + // Prepare the message. .removeHeaders("*", "Authorization") .setHeader(Exchange.HTTP_METHOD, constant("DELETE")) - .toD(getMillinerBaseUrl() + "resource/${exchangeProperty.uuid}"); + .setBody(simple("${null}")) + + // Remove the file from Gemini. + .toD(getMillinerBaseUrl() + "node/${exchangeProperty.uuid}"); + + from("{{media.stream}}") + .routeId("FcrepoIndexerMedia") + + // Parse the event into a POJO. + .unmarshal().json(JsonLibrary.Jackson, AS2Event.class) + + // Extract relevant data from the event. + .setProperty("event").simple("${body}") + .setProperty("sourceField").simple("${exchangeProperty.event.attachment.content.sourceField}") + .setProperty("jsonUrl").simple("${exchangeProperty.event.object.url[1].href}") + + // Prepare the message. + .removeHeaders("*", "Authorization") + .setHeader(Exchange.HTTP_METHOD, constant("POST")) + .setHeader("Content-Location", simple("${exchangeProperty.jsonUrl}")) + .setBody(simple("${null}")) + + // Pass it to milliner. + .toD(getMillinerBaseUrl() + "media/${exchangeProperty.sourceField}"); + + from("{{file.stream}}") + .routeId("FcrepoIndexerFile") + + // Parse the event into a POJO. + .unmarshal().json(JsonLibrary.Jackson, AS2Event.class) + + // Extract relevant data from the event. + .setProperty("event").simple("${body}") + .setProperty("uuid").simple("${exchangeProperty.event.object.id.replaceAll(\"urn:uuid:\",\"\")}") + .setProperty("drupal").simple("${exchangeProperty.event.object.url[0].href}") + .setProperty("fedora").simple("${exchangeProperty.event.attachment.content.fedoraUri}") + + // Prepare the message. + .removeHeaders("*", "Authorization") + .setHeader(Exchange.CONTENT_TYPE, constant("application/json")) + .setHeader(Exchange.HTTP_METHOD, constant("PUT")) + .setBody(simple( + "{\"drupal\": \"${exchangeProperty.drupal}\", \"fedora\": \"${exchangeProperty.fedora}\"}") + ) + + // Index the file in Gemini. + .toD(getGeminiBaseUrl() + "${exchangeProperty.uuid}"); + + from("{{file.delete.stream}}") + .routeId("FcrepoIndexerFileDelete") + + // Parse the event into a POJO. + .unmarshal().json(JsonLibrary.Jackson, AS2Event.class) + + // Extract relevant data from the event. + .setProperty("event").simple("${body}") + .setProperty("uuid").simple("${exchangeProperty.event.object.id.replaceAll(\"urn:uuid:\",\"\")}") + + // Prepare the message. + .removeHeaders("*", "Authorization") + .setHeader(Exchange.HTTP_METHOD, constant("DELETE")) + .setBody(simple("${null}")) + + // Remove the file from Gemini. + .toD(getGeminiBaseUrl() + "${exchangeProperty.uuid}"); + } } diff --git a/islandora-indexing-fcrepo/src/main/java/ca/islandora/alpaca/indexing/fcrepo/event/AS2Actor.java b/islandora-indexing-fcrepo/src/main/java/ca/islandora/alpaca/indexing/fcrepo/event/AS2Actor.java new file mode 100644 index 00000000..9194e013 --- /dev/null +++ b/islandora-indexing-fcrepo/src/main/java/ca/islandora/alpaca/indexing/fcrepo/event/AS2Actor.java @@ -0,0 +1,75 @@ +/* + * Licensed to Islandora Foundation under one or more contributor license + * agreements. See the NOTICE file distributed with this work for additional + * information regarding copyright ownership. + * + * The Islandora Foundation licenses this file to you under the MIT License. + * You may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://opensource.org/licenses/MIT + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package ca.islandora.alpaca.indexing.fcrepo.event; + +/** + * POJO for a user performing an action. Part of a AS2Event. + * + * @author Danny Lamb + */ +public class AS2Actor { + + /** + * @return Type of user + */ + public String getType() { + return type; + } + + /** + * @param type Type of user + */ + public void setType(final String type) { + this.type = type; + } + + /** + * @return URN of user + */ + public String getId() { + return id; + } + + /** + * @param id URN of user + */ + public void setId(final String id) { + this.id = id; + } + + /** + * @return URL for user + */ + public AS2Url[] getUrl() { + return url; + } + + /** + * @param url URL for user + */ + public void setUrl(final AS2Url[] url) { + this.url = url; + } + + private String type; + private String id; + private AS2Url[] url; + +} + diff --git a/islandora-indexing-fcrepo/src/main/java/ca/islandora/alpaca/indexing/fcrepo/event/AS2Attachment.java b/islandora-indexing-fcrepo/src/main/java/ca/islandora/alpaca/indexing/fcrepo/event/AS2Attachment.java new file mode 100644 index 00000000..7b048c07 --- /dev/null +++ b/islandora-indexing-fcrepo/src/main/java/ca/islandora/alpaca/indexing/fcrepo/event/AS2Attachment.java @@ -0,0 +1,77 @@ +/* + * Licensed to Islandora Foundation under one or more contributor license + * agreements. See the NOTICE file distributed with this work for additional + * information regarding copyright ownership. + * + * The Islandora Foundation licenses this file to you under the MIT License. + * You may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://opensource.org/licenses/MIT + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package ca.islandora.alpaca.indexing.fcrepo.event; + +/** + * POJO for an attachment. Part of a AS2Event. + * + * @author Danny Lamb + */ +public class AS2Attachment { + + /** + * @return Type + */ + public String getType() { + return type; + } + + /** + * @param type Type + */ + public void setType(final String type) { + this.type = type; + } + + /** + * @return Mimetype + */ + public String getMediaType() { + return mediaType; + } + + /** + * @param mediaType Mimetype + */ + public void setMediaType(final String mediaType) { + this.mediaType = mediaType; + } + + /** + * @return Content + */ + public AS2AttachmentContent getContent() { + return content; + } + + /** + * @param content Content + */ + public void setContent(final AS2AttachmentContent content) { + this.content = content; + } + + private String type; + private String mediaType; + private AS2AttachmentContent content; + +} + + + diff --git a/islandora-indexing-fcrepo/src/main/java/ca/islandora/alpaca/indexing/fcrepo/event/AS2AttachmentContent.java b/islandora-indexing-fcrepo/src/main/java/ca/islandora/alpaca/indexing/fcrepo/event/AS2AttachmentContent.java new file mode 100644 index 00000000..43b01232 --- /dev/null +++ b/islandora-indexing-fcrepo/src/main/java/ca/islandora/alpaca/indexing/fcrepo/event/AS2AttachmentContent.java @@ -0,0 +1,63 @@ +/* + * Licensed to Islandora Foundation under one or more contributor license + * agreements. See the NOTICE file distributed with this work for additional + * information regarding copyright ownership. + * + * The Islandora Foundation licenses this file to you under the MIT License. + * You may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://opensource.org/licenses/MIT + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package ca.islandora.alpaca.indexing.fcrepo.event; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * POJO for attachment content. Part of a AS2Event. + * + * @author Danny Lamb + */ +public class AS2AttachmentContent { + + /** + * @return Fedora uri + */ + @JsonProperty(value = "fedora_uri") + public String getFedoraUri() { + return fedoraUri; + } + + /** + * @param fedoraUri Fedora uri + */ + public void setFedoraUri(final String fedoraUri) { + this.fedoraUri = fedoraUri; + } + + /** + * @return Source field + */ + @JsonProperty(value = "source_field") + public String getSourceField() { + return sourceField; + } + + /** + * @param sourceField Source field + */ + public void setSourceField(final String sourceField) { + this.sourceField = sourceField; + } + + private String fedoraUri; + private String sourceField; + +} diff --git a/islandora-indexing-fcrepo/src/main/java/ca/islandora/alpaca/indexing/fcrepo/event/AS2Event.java b/islandora-indexing-fcrepo/src/main/java/ca/islandora/alpaca/indexing/fcrepo/event/AS2Event.java new file mode 100644 index 00000000..08455921 --- /dev/null +++ b/islandora-indexing-fcrepo/src/main/java/ca/islandora/alpaca/indexing/fcrepo/event/AS2Event.java @@ -0,0 +1,121 @@ +/* + * Licensed to Islandora Foundation under one or more contributor license + * agreements. See the NOTICE file distributed with this work for additional + * information regarding copyright ownership. + * + * The Islandora Foundation licenses this file to you under the MIT License. + * You may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://opensource.org/licenses/MIT + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package ca.islandora.alpaca.indexing.fcrepo.event; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * POJO for events emitted by Islandora. + * + * @author Danny Lamb + */ +public class AS2Event { + + /** + * @return Event type (Create, Update, Delete, etc...) + */ + public String getType() { + return type; + } + + /** + * @param type Event type (Create, Update, Delete, etc...) + */ + public void setType(final String type) { + this.type = type; + } + + /** + * @return Summary + */ + public String getSummary() { + return summary; + } + + /** + * @param summary Summary + */ + public void setSummary(final String summary) { + this.summary = summary; + } + /** + * @return Resource acted upon + */ + public AS2Object getObject() { + return object; + } + + /** + * @param object Resource acted upon + */ + public void setObject(final AS2Object object) { + this.object = object; + } + + /** + * @return User performing the action + */ + public AS2Actor getActor() { + return actor; + } + + /** + * @param actor User performing the action + */ + public void setActor(final AS2Actor actor) { + this.actor = actor; + } + + /** + * @return Configuration as an attachment + */ + public AS2Attachment getAttachment() { + return attachment; + } + + /** + * @param attachment Configuration as an attachment + */ + public void setAttachment(final AS2Attachment attachment) { + this.attachment = attachment; + } + + /** + * @return JSON-LD Context + */ + @JsonProperty(value = "@context") + public String getContext() { + return context; + } + + /** + * @param context JSON-LD Context + */ + public void setContext(final String context) { + this.context = context; + } + + private String context; + private String type; + private String summary; + private AS2Object object; + private AS2Actor actor; + private AS2Attachment attachment; + +} diff --git a/islandora-indexing-fcrepo/src/main/java/ca/islandora/alpaca/indexing/fcrepo/event/AS2Object.java b/islandora-indexing-fcrepo/src/main/java/ca/islandora/alpaca/indexing/fcrepo/event/AS2Object.java new file mode 100644 index 00000000..0441ebd4 --- /dev/null +++ b/islandora-indexing-fcrepo/src/main/java/ca/islandora/alpaca/indexing/fcrepo/event/AS2Object.java @@ -0,0 +1,74 @@ +/* + * Licensed to Islandora Foundation under one or more contributor license + * agreements. See the NOTICE file distributed with this work for additional + * information regarding copyright ownership. + * + * The Islandora Foundation licenses this file to you under the MIT License. + * You may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://opensource.org/licenses/MIT + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package ca.islandora.alpaca.indexing.fcrepo.event; + +/** + * POJO for a user performing an action. Part of a AS2Event. + * + * @author Danny Lamb + */ +public class AS2Object { + + /** + * @return Type of object + */ + public String getType() { + return type; + } + + /** + * @param type Type of object + */ + public void setType(final String type) { + this.type = type; + } + + /** + * @return URN of object + */ + public String getId() { + return id; + } + + /** + * @param id URN of object + */ + public void setId(final String id) { + this.id = id; + } + + /** + * @return URLs for object + */ + public AS2Url[] getUrl() { + return url; + } + + /** + * @param url URLs for object + */ + public void setUrl(final AS2Url[] url) { + this.url = url; + } + + private String type; + private String id; + private AS2Url[] url; + +} diff --git a/islandora-indexing-fcrepo/src/main/java/ca/islandora/alpaca/indexing/fcrepo/event/AS2Url.java b/islandora-indexing-fcrepo/src/main/java/ca/islandora/alpaca/indexing/fcrepo/event/AS2Url.java new file mode 100644 index 00000000..916ca21d --- /dev/null +++ b/islandora-indexing-fcrepo/src/main/java/ca/islandora/alpaca/indexing/fcrepo/event/AS2Url.java @@ -0,0 +1,106 @@ +/* + * Licensed to Islandora Foundation under one or more contributor license + * agreements. See the NOTICE file distributed with this work for additional + * information regarding copyright ownership. + * + * The Islandora Foundation licenses this file to you under the MIT License. + * You may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://opensource.org/licenses/MIT + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package ca.islandora.alpaca.indexing.fcrepo.event; + +/** + * POJO for a URL. Part of a AS2Event. + * + * @author Danny Lamb + */ +public class AS2Url { + + /** + * @return Name + */ + public String getName() { + return name; + } + + /** + * @param name Name + */ + public void setName(final String name) { + this.name = name; + } + + /** + * @return Type + */ + public String getType() { + return type; + } + + /** + * @param type Type + */ + public void setType(final String type) { + this.type = type; + } + + /** + * @return Url as string + */ + public String getHref() { + return href; + } + + /** + * @param href Url as string + */ + public void setHref(final String href) { + this.href = href; + } + + /** + * @return Mimetype + */ + public String getMediaType() { + return mediaType; + } + + /** + * @param mediaType Mimetype + */ + public void setMediaType(final String mediaType) { + this.mediaType = mediaType; + } + + /** + * @return Link relation + */ + public String getRel() { + return rel; + } + + /** + * @param rel Link relation + */ + public void setRel(final String rel) { + this.rel = rel; + } + + private String name; + private String type; + private String href; + private String mediaType; + private String rel; + +} + + diff --git a/islandora-indexing-fcrepo/src/main/resources/OSGI-INF/blueprint/blueprint.xml b/islandora-indexing-fcrepo/src/main/resources/OSGI-INF/blueprint/blueprint.xml index 51c5a45a..1f83fc16 100644 --- a/islandora-indexing-fcrepo/src/main/resources/OSGI-INF/blueprint/blueprint.xml +++ b/islandora-indexing-fcrepo/src/main/resources/OSGI-INF/blueprint/blueprint.xml @@ -11,11 +11,13 @@ - + + + - + diff --git a/islandora-indexing-fcrepo/src/test/java/ca/islandora/alpaca/indexing/fcrepo/FcrepoIndexerTest.java b/islandora-indexing-fcrepo/src/test/java/ca/islandora/alpaca/indexing/fcrepo/FcrepoIndexerTest.java index b8e9dc9b..8633a0d2 100644 --- a/islandora-indexing-fcrepo/src/test/java/ca/islandora/alpaca/indexing/fcrepo/FcrepoIndexerTest.java +++ b/islandora-indexing-fcrepo/src/test/java/ca/islandora/alpaca/indexing/fcrepo/FcrepoIndexerTest.java @@ -53,29 +53,31 @@ protected String getBlueprintDescriptor() { } @Test - public void testContent() throws Exception { - final String route = "FcrepoIndexerContent"; + public void testNode() throws Exception { + final String route = "FcrepoIndexerNode"; context.getRouteDefinition(route).adviceWith(context, new AdviceWithRouteBuilder() { @Override public void configure() throws Exception { replaceFromWith("direct:start"); - mockEndpointsAndSkip("http://localhost:8000/milliner/content"); + mockEndpointsAndSkip("http://localhost:8000/milliner/node/72358916-51e9-4712-b756-4b0404c91b1d"); } }); context.start(); - // Assert we POST the event to milliner with creds. - final MockEndpoint milliner = getMockEndpoint("mock:http:localhost:8000/milliner/content"); + // Assert we POST to milliner with creds. + final MockEndpoint milliner = getMockEndpoint( + "mock:http:localhost:8000/milliner/node/72358916-51e9-4712-b756-4b0404c91b1d" + ); milliner.expectedMessageCount(1); milliner.expectedHeaderReceived("Authorization", "Bearer islandora"); - milliner.expectedHeaderReceived(Exchange.CONTENT_TYPE, "application/ld+json"); + milliner.expectedHeaderReceived("Content-Location", "http://localhost:8000/node/2?_format=jsonld"); milliner.expectedHeaderReceived(Exchange.HTTP_METHOD, "POST"); // Send an event. template.send(exchange -> { exchange.getIn().setHeader("Authorization", "Bearer islandora"); exchange.getIn().setBody( - IOUtils.toString(loadResourceAsStream("AS2Event.jsonld"), "UTF-8"), + IOUtils.toString(loadResourceAsStream("NodeAS2Event.jsonld"), "UTF-8"), String.class ); }); @@ -84,29 +86,30 @@ public void configure() throws Exception { } @Test - public void testFile() throws Exception { - final String route = "FcrepoIndexerFile"; + public void testNodeDelete() throws Exception { + final String route = "FcrepoIndexerDeleteNode"; context.getRouteDefinition(route).adviceWith(context, new AdviceWithRouteBuilder() { @Override public void configure() throws Exception { replaceFromWith("direct:start"); - mockEndpointsAndSkip("http://localhost:8000/milliner/file"); + mockEndpointsAndSkip("http://localhost:8000/milliner/node/72358916-51e9-4712-b756-4b0404c91b1d"); } }); context.start(); - // Assert we POST the event to milliner with creds. - final MockEndpoint milliner = getMockEndpoint("mock:http:localhost:8000/milliner/file"); + // Assert we DELETE to milliner with creds. + final MockEndpoint milliner = getMockEndpoint( + "mock:http:localhost:8000/milliner/node/72358916-51e9-4712-b756-4b0404c91b1d" + ); milliner.expectedMessageCount(1); milliner.expectedHeaderReceived("Authorization", "Bearer islandora"); - milliner.expectedHeaderReceived(Exchange.CONTENT_TYPE, "application/ld+json"); - milliner.expectedHeaderReceived(Exchange.HTTP_METHOD, "POST"); + milliner.expectedHeaderReceived(Exchange.HTTP_METHOD, "DELETE"); // Send an event. template.send(exchange -> { exchange.getIn().setHeader("Authorization", "Bearer islandora"); exchange.getIn().setBody( - IOUtils.toString(loadResourceAsStream("AS2Event.jsonld"), "UTF-8"), + IOUtils.toString(loadResourceAsStream("NodeAS2Event.jsonld"), "UTF-8"), String.class ); }); @@ -115,29 +118,35 @@ public void configure() throws Exception { } @Test - public void testMedia() throws Exception { - final String route = "FcrepoIndexerMedia"; + public void testFile() throws Exception { + final String route = "FcrepoIndexerFile"; context.getRouteDefinition(route).adviceWith(context, new AdviceWithRouteBuilder() { @Override public void configure() throws Exception { replaceFromWith("direct:start"); - mockEndpointsAndSkip("http://localhost:8000/milliner/media"); + mockEndpointsAndSkip("http://localhost:8000/gemini/148dfe8f-9711-4263-97e7-3ef3fb15864f"); } }); context.start(); - // Assert we POST the event to milliner with creds. - final MockEndpoint milliner = getMockEndpoint("mock:http:localhost:8000/milliner/media"); - milliner.expectedMessageCount(1); - milliner.expectedHeaderReceived("Authorization", "Bearer islandora"); - milliner.expectedHeaderReceived(Exchange.CONTENT_TYPE, "application/ld+json"); - milliner.expectedHeaderReceived(Exchange.HTTP_METHOD, "POST"); + // Assert we PUT to gemini with creds. + final MockEndpoint gemini = getMockEndpoint( + "mock:http:localhost:8000/gemini/148dfe8f-9711-4263-97e7-3ef3fb15864f" + ); + gemini.expectedMessageCount(1); + gemini.expectedHeaderReceived("Authorization", "Bearer islandora"); + gemini.expectedHeaderReceived(Exchange.CONTENT_TYPE, "application/json"); + gemini.expectedHeaderReceived(Exchange.HTTP_METHOD, "PUT"); + gemini.allMessages().body().startsWith( + "{\"drupal\": \"http://localhost:8000/_flysystem/fedora/2018-08/Voltaire-Records1.jpg\", \"fedora\": " + + "\"http://localhost:8080/fcrepo/rest/2018-08/Voltaire-Records1.jpg\"}" + ); // Send an event. template.send(exchange -> { exchange.getIn().setHeader("Authorization", "Bearer islandora"); exchange.getIn().setBody( - IOUtils.toString(loadResourceAsStream("AS2Event.jsonld"), "UTF-8"), + IOUtils.toString(loadResourceAsStream("FileAS2Event.jsonld"), "UTF-8"), String.class ); }); @@ -146,31 +155,61 @@ public void configure() throws Exception { } @Test - public void testDelete() throws Exception { + public void testFileDelet() throws Exception { + final String route = "FcrepoIndexerFileDelete"; + context.getRouteDefinition(route).adviceWith(context, new AdviceWithRouteBuilder() { + @Override + public void configure() throws Exception { + replaceFromWith("direct:start"); + mockEndpointsAndSkip("http://localhost:8000/gemini/148dfe8f-9711-4263-97e7-3ef3fb15864f"); + } + }); + context.start(); + + // Assert we PUT to gemini with creds. + final MockEndpoint gemini = getMockEndpoint( + "mock:http:localhost:8000/gemini/148dfe8f-9711-4263-97e7-3ef3fb15864f" + ); + gemini.expectedMessageCount(1); + gemini.expectedHeaderReceived("Authorization", "Bearer islandora"); + gemini.expectedHeaderReceived(Exchange.HTTP_METHOD, "DELETE"); + + // Send an event. + template.send(exchange -> { + exchange.getIn().setHeader("Authorization", "Bearer islandora"); + exchange.getIn().setBody( + IOUtils.toString(loadResourceAsStream("FileAS2Event.jsonld"), "UTF-8"), + String.class + ); + }); - final String uuid = "9541c0c1-5bee-4973-a9d0-e55c1658bc81"; + assertMockEndpointsSatisfied(); + } - final String route = "FcrepoIndexerDelete"; + @Test + public void testMedia() throws Exception { + final String route = "FcrepoIndexerMedia"; context.getRouteDefinition(route).adviceWith(context, new AdviceWithRouteBuilder() { @Override public void configure() throws Exception { replaceFromWith("direct:start"); - mockEndpointsAndSkip("http://localhost:8000/milliner/resource/" + uuid); + mockEndpointsAndSkip("http://localhost:8000/milliner/media/field_media_image"); } }); context.start(); // Assert we POST the event to milliner with creds. - final MockEndpoint milliner = getMockEndpoint("mock:http:localhost:8000/milliner/resource/" + uuid); + final MockEndpoint milliner = getMockEndpoint("mock:http:localhost:8000/milliner/media/field_media_image"); milliner.expectedMessageCount(1); milliner.expectedHeaderReceived("Authorization", "Bearer islandora"); - milliner.expectedHeaderReceived(Exchange.HTTP_METHOD, "DELETE"); + milliner.expectedHeaderReceived("Content-Location", "http://localhost:8000/media/6?_format=json"); + milliner.expectedHeaderReceived(Exchange.HTTP_METHOD, "POST"); // Send an event. template.send(exchange -> { exchange.getIn().setHeader("Authorization", "Bearer islandora"); exchange.getIn().setBody( - IOUtils.toString(loadResourceAsStream("AS2Event.jsonld"), "UTF-8"), + IOUtils.toString(loadResourceAsStream("MediaAS2Event.jsonld"), "UTF-8"), String.class ); }); diff --git a/islandora-indexing-fcrepo/src/test/resources/AS2Event.jsonld b/islandora-indexing-fcrepo/src/test/resources/AS2Event.jsonld deleted file mode 100644 index fd22e0fd..00000000 --- a/islandora-indexing-fcrepo/src/test/resources/AS2Event.jsonld +++ /dev/null @@ -1,53 +0,0 @@ -{ - "@context":"https:\/\/www.w3.org\/ns\/activitystreams", - "actor":{ - "type":"Person", - "id":"urn:uuid:2fcb7300-6d2e-43d5-b07b-4d4784690117", - "url":[ - { - "name":"Drupal Canonical", - "type":"Link", - "href":"http:\/\/localhost:8000\/user\/1", - "mediaType":"text\/html", - "rel":"canonical" - }, - { - "name":"Drupal JSONLD", - "type":"Link", - "href":"http:\/\/localhost:8000\/user\/1?_format=jsonld", - "mediaType":"application\/ld+json" - }, - { - "name":"Drupal JSON", - "type":"Link", - "href":"http:\/\/localhost:8000\/user\/1?_format=json", - "mediaType":"application\/json" - } - ] - }, - "object":{ - "id":"urn:uuid:9541c0c1-5bee-4973-a9d0-e55c1658bc81", - "url":[ - { - "name":"Drupal Canoncial", - "type":"Link", - "href":"http:\/\/localhost:8000\/node\/1", - "mediaType":"text\/html", - "rel":"canonical" - }, - { - "name":"Drupal JSONLD", - "type":"Link", - "href":"http:\/\/localhost:8000\/node\/1?_format=jsonld", - "mediaType":"application\/ld+json" - }, - { - "name":"Drupal JSON", - "type":"Link", - "href":"http:\/\/localhost:8000\/node\/1?_format=json", - "mediaType":"application\/json" - } - ] - }, - "type":"Update" -} \ No newline at end of file diff --git a/islandora-indexing-fcrepo/src/test/resources/FileAS2Event.jsonld b/islandora-indexing-fcrepo/src/test/resources/FileAS2Event.jsonld new file mode 100644 index 00000000..011d111b --- /dev/null +++ b/islandora-indexing-fcrepo/src/test/resources/FileAS2Event.jsonld @@ -0,0 +1,37 @@ +{ + "@context":"https:\/\/www.w3.org\/ns\/activitystreams", + "actor":{ + "type":"Person", + "id":"urn:uuid:9029a0c0-d845-4ddd-864c-2198d45839da", + "url":[ + { + "name":"Canonical", + "type":"Link", + "href":"http:\/\/localhost:8000\/user\/1", + "mediaType":"text\/html", + "rel":"canonical" + } + ] + }, + "object":{ + "id":"urn:uuid:148dfe8f-9711-4263-97e7-3ef3fb15864f", + "url":[ + { + "name":"Canonical", + "type":"Link", + "href":"http:\/\/localhost:8000\/_flysystem\/fedora\/2018-08\/Voltaire-Records1.jpg", + "mediaType":"image\/jpeg", + "rel":"canonical" + } + ] + }, + "type":"Create", + "summary":"Create a File", + "attachment":{ + "type":"Object", + "content":{ + "fedora_uri":"http:\/\/localhost:8080\/fcrepo\/rest\/2018-08\/Voltaire-Records1.jpg" + }, + "mediaType":"application\/json" + } +} diff --git a/islandora-indexing-fcrepo/src/test/resources/MediaAS2Event.jsonld b/islandora-indexing-fcrepo/src/test/resources/MediaAS2Event.jsonld new file mode 100644 index 00000000..b6712d99 --- /dev/null +++ b/islandora-indexing-fcrepo/src/test/resources/MediaAS2Event.jsonld @@ -0,0 +1,51 @@ +{ + "@context":"https:\/\/www.w3.org\/ns\/activitystreams", + "actor":{ + "type":"Person", + "id":"urn:uuid:9029a0c0-d845-4ddd-864c-2198d45839da", + "url":[ + { + "name":"Canonical", + "type":"Link", + "href":"http:\/\/localhost:8000\/user\/1", + "mediaType":"text\/html", + "rel":"canonical" + } + ] + }, + "object":{ + "id":"urn:uuid:4f528a92-4be2-4a9d-85e6-c5f4d36b1bce", + "url":[ + { + "name":"Canonical", + "type":"Link", + "href":"http:\/\/localhost:8000\/media\/6", + "mediaType":"text\/html", + "rel":"canonical" + }, + { + "name":"JSON", + "type":"Link", + "href":"http:\/\/localhost:8000\/media\/6?_format=json", + "mediaType":"application\/json", + "rel":"alternate" + }, + { + "name":"JSONLD", + "type":"Link", + "href":"http:\/\/localhost:8000\/media\/6?_format=jsonld", + "mediaType":"application\/ld+json", + "rel":"alternate" + } + ] + }, + "type":"Update", + "summary":"Update a Media", + "attachment":{ + "type":"Object", + "content":{ + "source_field":"field_media_image" + }, + "mediaType":"application\/json" + } +} diff --git a/islandora-indexing-fcrepo/src/test/resources/NodeAS2Event.jsonld b/islandora-indexing-fcrepo/src/test/resources/NodeAS2Event.jsonld new file mode 100644 index 00000000..25580e76 --- /dev/null +++ b/islandora-indexing-fcrepo/src/test/resources/NodeAS2Event.jsonld @@ -0,0 +1,44 @@ +{ + "@context":"https:\/\/www.w3.org\/ns\/activitystreams", + "actor":{ + "type":"Person", + "id":"urn:uuid:9029a0c0-d845-4ddd-864c-2198d45839da", + "url":[ + { + "name":"Canonical", + "type":"Link", + "href":"http:\/\/localhost:8000\/user\/1", + "mediaType":"text\/html", + "rel":"canonical" + } + ] + }, + "object":{ + "id":"urn:uuid:72358916-51e9-4712-b756-4b0404c91b1d", + "url":[ + { + "name":"Canonical", + "type":"Link", + "href":"http:\/\/localhost:8000\/node\/2", + "mediaType":"text\/html", + "rel":"canonical" + }, + { + "name":"JSON", + "type":"Link", + "href":"http:\/\/localhost:8000\/node\/2?_format=json", + "mediaType":"application\/json", + "rel":"alternate" + }, + { + "name":"JSONLD", + "type":"Link", + "href":"http:\/\/localhost:8000\/node\/2?_format=jsonld", + "mediaType":"application\/ld+json", + "rel":"alternate" + } + ] + }, + "type":"Update", + "summary":"Update a Node" +} diff --git a/islandora-indexing-fcrepo/src/test/resources/OSGI-INF/blueprint/blueprint-test.xml b/islandora-indexing-fcrepo/src/test/resources/OSGI-INF/blueprint/blueprint-test.xml index 0c726066..41f1f5a1 100644 --- a/islandora-indexing-fcrepo/src/test/resources/OSGI-INF/blueprint/blueprint-test.xml +++ b/islandora-indexing-fcrepo/src/test/resources/OSGI-INF/blueprint/blueprint-test.xml @@ -11,11 +11,13 @@ - - + + + - + + diff --git a/islandora-indexing-fcrepo/src/test/resources/create-binary-event.json b/islandora-indexing-fcrepo/src/test/resources/create-binary-event.json deleted file mode 100644 index 8dc1da43..00000000 --- a/islandora-indexing-fcrepo/src/test/resources/create-binary-event.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "@context": "https://www.w3.org/ns/activitystreams", - "type": "Create", - "actor": { - "type": "Person", - "id": "http://localhost:8000/user/1" - }, - "object": "http://localhost:8000/media/1", - "attachment": { - "url": "http://localhost:8000/sites/default/files/image.jpeg", - "mediaType": "image/jpeg" - } -} diff --git a/islandora-indexing-fcrepo/src/test/resources/create-event.json b/islandora-indexing-fcrepo/src/test/resources/create-event.json deleted file mode 100644 index 93fbd3db..00000000 --- a/islandora-indexing-fcrepo/src/test/resources/create-event.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "@context": "https://www.w3.org/ns/activitystreams", - "type": "Create", - "actor": { - "type": "Person", - "id": "http://localhost:8000/user/1" - }, - "object": "http://localhost:8000/fedora_resource/1" -} \ No newline at end of file diff --git a/islandora-indexing-fcrepo/src/test/resources/delete-binary-event.json b/islandora-indexing-fcrepo/src/test/resources/delete-binary-event.json deleted file mode 100644 index c457ed17..00000000 --- a/islandora-indexing-fcrepo/src/test/resources/delete-binary-event.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "@context": "https://www.w3.org/ns/activitystreams", - "type": "Delete", - "actor": { - "type": "Person", - "id": "http://localhost:8000/user/1" - }, - "object": "http://localhost:8000/media/1", - "attachment": { - "url": "http://localhost:8000/sites/default/files/image.jpeg", - "mediaType": "image/jpeg" - } -} diff --git a/islandora-indexing-fcrepo/src/test/resources/delete-event.json b/islandora-indexing-fcrepo/src/test/resources/delete-event.json deleted file mode 100644 index 1b459bef..00000000 --- a/islandora-indexing-fcrepo/src/test/resources/delete-event.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "@context": "https://www.w3.org/ns/activitystreams", - "type": "Delete", - "actor": { - "type": "Person", - "id": "http://localhost:8000/user/1" - }, - "object": "http://localhost:8000/fedora_resource/1" -} \ No newline at end of file diff --git a/islandora-indexing-fcrepo/src/test/resources/update-binary-event.json b/islandora-indexing-fcrepo/src/test/resources/update-binary-event.json deleted file mode 100644 index 4726b8cf..00000000 --- a/islandora-indexing-fcrepo/src/test/resources/update-binary-event.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "@context": "https://www.w3.org/ns/activitystreams", - "type": "Update", - "actor": { - "type": "Person", - "id": "http://localhost:8000/user/1" - }, - "object": "http://localhost:8000/media/1", - "attachment": { - "url": "http://localhost:8000/sites/default/files/image.jpeg", - "mediaType": "image/jpeg" - } -} diff --git a/islandora-indexing-fcrepo/src/test/resources/update-event.json b/islandora-indexing-fcrepo/src/test/resources/update-event.json deleted file mode 100644 index 6253b9f7..00000000 --- a/islandora-indexing-fcrepo/src/test/resources/update-event.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "@context": "https://www.w3.org/ns/activitystreams", - "type": "Update", - "actor": { - "type": "Person", - "id": "http://localhost:8000/user/1" - }, - "object": "http://localhost:8000/fedora_resource/1" -} \ No newline at end of file diff --git a/islandora-indexing-triplestore/src/main/java/ca/islandora/alpaca/indexing/triplestore/TriplestoreIndexer.java b/islandora-indexing-triplestore/src/main/java/ca/islandora/alpaca/indexing/triplestore/TriplestoreIndexer.java index 4205a7c2..495cfc49 100644 --- a/islandora-indexing-triplestore/src/main/java/ca/islandora/alpaca/indexing/triplestore/TriplestoreIndexer.java +++ b/islandora-indexing-triplestore/src/main/java/ca/islandora/alpaca/indexing/triplestore/TriplestoreIndexer.java @@ -58,7 +58,7 @@ public void configure() { .to("direct:parse.url") .removeHeaders("*", "Authorization") .setHeader(Exchange.HTTP_METHOD, constant("GET")) - .transform(simple("${null}")) + .setBody(simple("${null}")) .toD("${exchangeProperty.url}") .setHeader(FCREPO_URI, simple("${exchangeProperty.url}")) .process(new SparqlUpdateProcessor()) diff --git a/islandora-indexing-triplestore/src/test/resources/AS2Event.jsonld b/islandora-indexing-triplestore/src/test/resources/AS2Event.jsonld index fd22e0fd..25610f5b 100644 --- a/islandora-indexing-triplestore/src/test/resources/AS2Event.jsonld +++ b/islandora-indexing-triplestore/src/test/resources/AS2Event.jsonld @@ -29,7 +29,7 @@ "id":"urn:uuid:9541c0c1-5bee-4973-a9d0-e55c1658bc81", "url":[ { - "name":"Drupal Canoncial", + "name":"Drupal Canonical", "type":"Link", "href":"http:\/\/localhost:8000\/node\/1", "mediaType":"text\/html", @@ -50,4 +50,4 @@ ] }, "type":"Update" -} \ No newline at end of file +} diff --git a/islandora-indexing-triplestore/src/test/resources/AS2EventNoJsonldUrl.jsonld b/islandora-indexing-triplestore/src/test/resources/AS2EventNoJsonldUrl.jsonld index d1bff68b..85ffe229 100644 --- a/islandora-indexing-triplestore/src/test/resources/AS2EventNoJsonldUrl.jsonld +++ b/islandora-indexing-triplestore/src/test/resources/AS2EventNoJsonldUrl.jsonld @@ -29,7 +29,7 @@ "id":"urn:uuid:9541c0c1-5bee-4973-a9d0-e55c1658bc81", "url":[ { - "name":"Drupal Canoncial", + "name":"Drupal Canonical", "type":"Link", "href":"http:\/\/localhost:8000\/node\/1", "mediaType":"text\/html", @@ -44,4 +44,4 @@ ] }, "type":"Update" -} \ No newline at end of file +}