Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding connection close to http4 endpoints #58

Merged
merged 2 commits into from
Mar 7, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,13 @@ public void configure() {
.setHeader("X-Islandora-Args", simple("${exchangeProperty.event.attachment.content.args}"))
.setHeader("Apix-Ldp-Resource", simple("${exchangeProperty.event.attachment.content.sourceUri}"))
.setBody(simple("${null}"))
.to("{{derivative.service.url}}")
.to("{{derivative.service.url}}?connectionClose=true")

// PUT the media.
.removeHeaders("*", "Authorization", "Content-Type")
.setHeader("Content-Location", simple("${exchangeProperty.event.attachment.content.fileUploadUri}"))
.setHeader(Exchange.HTTP_METHOD, constant("PUT"))
.toD("${exchangeProperty.event.attachment.content.destinationUri}");
.toD("${exchangeProperty.event.attachment.content.destinationUri}?connectionClose=true");
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -66,15 +66,15 @@ public void configure() throws Exception {
replaceFromWith("direct:start");

// Rig Drupal REST endpoint to return canned jsonld
interceptSendToEndpoint("http://example.org/derivative/convert")
interceptSendToEndpoint("http://example.org/derivative/convert?connectionClose=true")
.skipSendToOriginalEndpoint()
.process(exchange -> {
exchange.getIn().removeHeaders("*", "Authorization");
exchange.getIn().setHeader("Content-Type", "image/jpeg");
exchange.getIn().setBody("SOME DERIVATIVE", String.class);
});

mockEndpointsAndSkip("http://localhost:8000/node/2/media/image/3");
mockEndpointsAndSkip("http://localhost:8000/node/2/media/image/3?connectionClose=true");
}
});
context.start();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ public void configure() {
.setBody(simple("${null}"))

// Pass it to milliner.
.toD(getMillinerBaseUrl() + "node/${exchangeProperty.uuid}");
.toD(getMillinerBaseUrl() + "node/${exchangeProperty.uuid}?connectionClose=true");

from("{{node.delete.stream}}")
.routeId("FcrepoIndexerDeleteNode")
Expand All @@ -164,7 +164,7 @@ public void configure() {
.setBody(simple("${null}"))

// Remove the file from Gemini.
.toD(getMillinerBaseUrl() + "node/${exchangeProperty.uuid}");
.toD(getMillinerBaseUrl() + "node/${exchangeProperty.uuid}?connectionClose=true");

from("{{media.stream}}")
.routeId("FcrepoIndexerMedia")
Expand All @@ -184,7 +184,7 @@ public void configure() {
.setBody(simple("${null}"))

// Pass it to milliner.
.toD(getMillinerBaseUrl() + "media/${exchangeProperty.sourceField}");
.toD(getMillinerBaseUrl() + "media/${exchangeProperty.sourceField}?connectionClose=true");

from("{{file.stream}}")
.routeId("FcrepoIndexerFile")
Expand All @@ -207,7 +207,7 @@ public void configure() {
)

// Index the file in Gemini.
.toD(getGeminiBaseUrl() + "${exchangeProperty.uuid}");
.toD(getGeminiBaseUrl() + "${exchangeProperty.uuid}?connectionClose=true");

from("{{file.delete.stream}}")
.routeId("FcrepoIndexerFileDelete")
Expand All @@ -225,7 +225,7 @@ public void configure() {
.setBody(simple("${null}"))

// Remove the file from Gemini.
.toD(getGeminiBaseUrl() + "${exchangeProperty.uuid}");
.toD(getGeminiBaseUrl() + "${exchangeProperty.uuid}?connectionClose=true");

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,9 @@ public void testNode() throws Exception {
@Override
public void configure() throws Exception {
replaceFromWith("direct:start");
mockEndpointsAndSkip("http://localhost:8000/milliner/node/72358916-51e9-4712-b756-4b0404c91b1d");
mockEndpointsAndSkip(
"http://localhost:8000/milliner/node/72358916-51e9-4712-b756-4b0404c91b1d?connectionClose=true"
);
}
});
context.start();
Expand Down Expand Up @@ -92,7 +94,9 @@ public void testNodeDelete() throws Exception {
@Override
public void configure() throws Exception {
replaceFromWith("direct:start");
mockEndpointsAndSkip("http://localhost:8000/milliner/node/72358916-51e9-4712-b756-4b0404c91b1d");
mockEndpointsAndSkip(
"http://localhost:8000/milliner/node/72358916-51e9-4712-b756-4b0404c91b1d?connectionClose=true"
);
}
});
context.start();
Expand Down Expand Up @@ -124,7 +128,9 @@ public void testFile() throws Exception {
@Override
public void configure() throws Exception {
replaceFromWith("direct:start");
mockEndpointsAndSkip("http://localhost:8000/gemini/148dfe8f-9711-4263-97e7-3ef3fb15864f");
mockEndpointsAndSkip(
"http://localhost:8000/gemini/148dfe8f-9711-4263-97e7-3ef3fb15864f?connectionClose=true"
);
}
});
context.start();
Expand Down Expand Up @@ -161,7 +167,9 @@ public void testFileDelet() throws Exception {
@Override
public void configure() throws Exception {
replaceFromWith("direct:start");
mockEndpointsAndSkip("http://localhost:8000/gemini/148dfe8f-9711-4263-97e7-3ef3fb15864f");
mockEndpointsAndSkip(
"http://localhost:8000/gemini/148dfe8f-9711-4263-97e7-3ef3fb15864f?connectionClose=true"
);
}
});
context.start();
Expand Down Expand Up @@ -193,7 +201,7 @@ public void testMedia() throws Exception {
@Override
public void configure() throws Exception {
replaceFromWith("direct:start");
mockEndpointsAndSkip("http://localhost:8000/milliner/media/field_media_image");
mockEndpointsAndSkip("http://localhost:8000/milliner/media/field_media_image?connectionClose=true");
}
});
context.start();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,19 +59,19 @@ public void configure() {
.removeHeaders("*", "Authorization")
.setHeader(Exchange.HTTP_METHOD, constant("GET"))
.setBody(simple("${null}"))
.toD("${exchangeProperty.url}")
.toD("${exchangeProperty.url}&connectionClose=true")
.setHeader(FCREPO_URI, simple("${exchangeProperty.url}"))
.process(new SparqlUpdateProcessor())
.log(INFO, LOGGER, "Indexing ${exchangeProperty.url} in triplestore")
.to("{{triplestore.baseUrl}}");
.to("{{triplestore.baseUrl}}?connectionClose=true");

from("{{delete.stream}}")
.routeId("IslandoraTriplestoreIndexerDelete")
.to("direct:parse.url")
.setHeader(FCREPO_URI, simple("${exchangeProperty.url}"))
.process(new SparqlDeleteProcessor())
.log(INFO, LOGGER, "Deleting ${exchangeProperty.url} in triplestore")
.to("{{triplestore.baseUrl}}");
.to("{{triplestore.baseUrl}}?connectionClose=true");

// Extracts the JSONLD URL from the event message and stores it on the exchange.
from("direct:parse.url")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ public void configure() throws Exception {
replaceFromWith("direct:start");

// Rig Drupal REST endpoint to return canned jsonld
interceptSendToEndpoint("http://localhost:8000/node/1?_format=jsonld")
interceptSendToEndpoint("http://localhost:8000/node/1?_format=jsonld&connectionClose=true")
.skipSendToOriginalEndpoint()
.process(exchange -> {
exchange.getIn().removeHeaders("*");
Expand All @@ -141,7 +141,9 @@ public void configure() throws Exception {
String.class);
});

mockEndpointsAndSkip("http://localhost:8080/bigdata/namespace/islandora/sparql");
mockEndpointsAndSkip(
"http://localhost:8080/bigdata/namespace/islandora/sparql?connectionClose=true"
);
}
});
context.start();
Expand Down Expand Up @@ -181,7 +183,7 @@ public void testDelete() throws Exception {
@Override
public void configure() throws Exception {
replaceFromWith("direct:start");
mockEndpointsAndSkip("http://localhost:8080/bigdata/namespace/islandora/sparql");
mockEndpointsAndSkip("http://localhost:8080/bigdata/namespace/islandora/sparql?connectionClose=true");
}
});
context.start();
Expand Down