From 7fddce3610dd815a3c4274334b167dc8f02fb636 Mon Sep 17 00:00:00 2001 From: dannylamb Date: Thu, 24 Oct 2019 18:38:21 +0000 Subject: [PATCH] Adding disableStreamCache=true on every http call --- .../derivative/DerivativeConnector.java | 6 ++++-- .../derivative/DerivativeConnectorTest.java | 7 +++++-- .../alpaca/indexing/fcrepo/FcrepoIndexer.java | 18 +++++++++++++----- .../indexing/fcrepo/FcrepoIndexerTest.java | 16 +++++++++++----- .../triplestore/TriplestoreIndexer.java | 6 +++--- .../triplestore/TriplestoreIndexerTest.java | 11 ++++++++--- 6 files changed, 44 insertions(+), 20 deletions(-) diff --git a/islandora-connector-derivative/src/main/java/ca/islandora/alpaca/connector/derivative/DerivativeConnector.java b/islandora-connector-derivative/src/main/java/ca/islandora/alpaca/connector/derivative/DerivativeConnector.java index 13bdb089..6a258b1f 100644 --- a/islandora-connector-derivative/src/main/java/ca/islandora/alpaca/connector/derivative/DerivativeConnector.java +++ b/islandora-connector-derivative/src/main/java/ca/islandora/alpaca/connector/derivative/DerivativeConnector.java @@ -63,13 +63,15 @@ 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}}?connectionClose=true") + .to("{{derivative.service.url}}?connectionClose=true&disableStreamCache=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}?connectionClose=true"); + .toD("${exchangeProperty.event.attachment.content.destinationUri}" + + "?connectionClose=true&disableStreamCache=true" + ); } } diff --git a/islandora-connector-derivative/src/test/java/ca/islandora/alpaca/connector/derivative/DerivativeConnectorTest.java b/islandora-connector-derivative/src/test/java/ca/islandora/alpaca/connector/derivative/DerivativeConnectorTest.java index 50094f16..b6ba67d4 100644 --- a/islandora-connector-derivative/src/test/java/ca/islandora/alpaca/connector/derivative/DerivativeConnectorTest.java +++ b/islandora-connector-derivative/src/test/java/ca/islandora/alpaca/connector/derivative/DerivativeConnectorTest.java @@ -66,7 +66,9 @@ public void configure() throws Exception { replaceFromWith("direct:start"); // Rig Drupal REST endpoint to return canned jsonld - interceptSendToEndpoint("http://example.org/derivative/convert?connectionClose=true") + final String endpoint = "http://example.org/derivative/convert" + + "?connectionClose=true&disableStreamCache=true"; + interceptSendToEndpoint(endpoint) .skipSendToOriginalEndpoint() .process(exchange -> { exchange.getIn().removeHeaders("*", "Authorization"); @@ -74,7 +76,8 @@ public void configure() throws Exception { exchange.getIn().setBody("SOME DERIVATIVE", String.class); }); - mockEndpointsAndSkip("http://localhost:8000/node/2/media/image/3?connectionClose=true"); + mockEndpointsAndSkip("http://localhost:8000/node/2/media/image/3" + + "?connectionClose=true&disableStreamCache=true"); } }); context.start(); 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 c87864c1..a998ecd3 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 @@ -137,7 +137,9 @@ public void configure() { .setBody(simple("${null}")) // Pass it to milliner. - .toD(getMillinerBaseUrl() + "node/${exchangeProperty.uuid}?connectionClose=true"); + .toD(getMillinerBaseUrl() + + "node/${exchangeProperty.uuid}?connectionClose=true&disableStreamCache=true" + ); from("{{node.delete.stream}}") .routeId("FcrepoIndexerDeleteNode") @@ -164,7 +166,9 @@ public void configure() { .setBody(simple("${null}")) // Remove the file from Gemini. - .toD(getMillinerBaseUrl() + "node/${exchangeProperty.uuid}?connectionClose=true"); + .toD(getMillinerBaseUrl() + + "node/${exchangeProperty.uuid}?connectionClose=true&disableStreamCache=true" + ); from("{{media.stream}}") .routeId("FcrepoIndexerMedia") @@ -184,7 +188,9 @@ public void configure() { .setBody(simple("${null}")) // Pass it to milliner. - .toD(getMillinerBaseUrl() + "media/${exchangeProperty.sourceField}?connectionClose=true"); + .toD(getMillinerBaseUrl() + + "media/${exchangeProperty.sourceField}?connectionClose=true&disableStreamCache=true" + ); from("{{file.stream}}") .routeId("FcrepoIndexerFile") @@ -207,7 +213,7 @@ public void configure() { ) // Index the file in Gemini. - .toD(getGeminiBaseUrl() + "${exchangeProperty.uuid}?connectionClose=true"); + .toD(getGeminiBaseUrl() + "${exchangeProperty.uuid}?connectionClose=true&disableStreamCache=true"); from("{{file.external.stream}}") .routeId("FcrepoIndexerExternalFile") @@ -227,7 +233,9 @@ public void configure() { .setBody(simple("${null}")) // Pass it to milliner. - .toD(getMillinerBaseUrl() + "external/${exchangeProperty.uuid}?connectionClose=true"); + .toD(getMillinerBaseUrl() + + "external/${exchangeProperty.uuid}?connectionClose=true&disableStreamCache=true" + ); } } 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 690a6c01..153d4e1e 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 @@ -60,7 +60,8 @@ public void testNode() throws Exception { public void configure() throws Exception { replaceFromWith("direct:start"); mockEndpointsAndSkip( - "http://localhost:8000/milliner/node/72358916-51e9-4712-b756-4b0404c91b1d?connectionClose=true" + "http://localhost:8000/milliner/node/72358916-51e9-4712-b756-4b0404c91b1d" + + "?connectionClose=true&disableStreamCache=true" ); } }); @@ -95,7 +96,8 @@ public void testNodeDelete() throws Exception { public void configure() throws Exception { replaceFromWith("direct:start"); mockEndpointsAndSkip( - "http://localhost:8000/milliner/node/72358916-51e9-4712-b756-4b0404c91b1d?connectionClose=true" + "http://localhost:8000/milliner/node/72358916-51e9-4712-b756-4b0404c91b1d" + + "?connectionClose=true&disableStreamCache=true" ); } }); @@ -129,7 +131,8 @@ public void testFile() throws Exception { public void configure() throws Exception { replaceFromWith("direct:start"); mockEndpointsAndSkip( - "http://localhost:8000/gemini/148dfe8f-9711-4263-97e7-3ef3fb15864f?connectionClose=true" + "http://localhost:8000/gemini/148dfe8f-9711-4263-97e7-3ef3fb15864f" + + "?connectionClose=true&disableStreamCache=true" ); } }); @@ -168,7 +171,8 @@ public void testExternalFile() throws Exception { public void configure() throws Exception { replaceFromWith("direct:start"); mockEndpointsAndSkip( - "http://localhost:8000/milliner/external/148dfe8f-9711-4263-97e7-3ef3fb15864f?connectionClose=true" + "http://localhost:8000/milliner/external/148dfe8f-9711-4263-97e7-3ef3fb15864f" + + "?connectionClose=true&disableStreamCache=true" ); } }); @@ -205,7 +209,9 @@ public void testMedia() throws Exception { @Override public void configure() throws Exception { replaceFromWith("direct:start"); - mockEndpointsAndSkip("http://localhost:8000/milliner/media/field_media_image?connectionClose=true"); + mockEndpointsAndSkip("http://localhost:8000/milliner/media/field_media_image" + + "?connectionClose=true&disableStreamCache=true" + ); } }); context.start(); 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 0b4f546f..b7dc9539 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 @@ -59,11 +59,11 @@ public void configure() { .removeHeaders("*", "Authorization") .setHeader(Exchange.HTTP_METHOD, constant("GET")) .setBody(simple("${null}")) - .toD("${exchangeProperty.jsonld_url}&connectionClose=true") + .toD("${exchangeProperty.jsonld_url}&connectionClose=true&disableStreamCache=true") .setHeader(FCREPO_URI, simple("${exchangeProperty.subject_url}")) .process(new SparqlUpdateProcessor()) .log(INFO, LOGGER, "Indexing ${exchangeProperty.subject_url} in triplestore") - .to("{{triplestore.baseUrl}}?connectionClose=true"); + .to("{{triplestore.baseUrl}}?connectionClose=true&disableStreamCache=true"); from("{{delete.stream}}") .routeId("IslandoraTriplestoreIndexerDelete") @@ -71,7 +71,7 @@ public void configure() { .setHeader(FCREPO_URI, simple("${exchangeProperty.subject_url}")) .process(new SparqlDeleteProcessor()) .log(INFO, LOGGER, "Deleting ${exchangeProperty.subject_url} in triplestore") - .to("{{triplestore.baseUrl}}?connectionClose=true"); + .to("{{triplestore.baseUrl}}?connectionClose=true&disableStreamCache=true"); // Extracts the JSONLD URL from the event message and stores it on the exchange. from("direct:parse.url") diff --git a/islandora-indexing-triplestore/src/test/java/ca/islandora/alpaca/indexing/triplestore/TriplestoreIndexerTest.java b/islandora-indexing-triplestore/src/test/java/ca/islandora/alpaca/indexing/triplestore/TriplestoreIndexerTest.java index b02a4fb1..7a78e163 100644 --- a/islandora-indexing-triplestore/src/test/java/ca/islandora/alpaca/indexing/triplestore/TriplestoreIndexerTest.java +++ b/islandora-indexing-triplestore/src/test/java/ca/islandora/alpaca/indexing/triplestore/TriplestoreIndexerTest.java @@ -136,7 +136,9 @@ public void configure() throws Exception { replaceFromWith("direct:start"); // Rig Drupal REST endpoint to return canned jsonld - interceptSendToEndpoint("http://localhost:8000/node/1?_format=jsonld&connectionClose=true") + final String endpoint = "http://localhost:8000/node/1" + + "?_format=jsonld&connectionClose=true&disableStreamCache=true"; + interceptSendToEndpoint(endpoint) .skipSendToOriginalEndpoint() .process(exchange -> { exchange.getIn().removeHeaders("*"); @@ -147,7 +149,8 @@ public void configure() throws Exception { }); mockEndpointsAndSkip( - "http://localhost:8080/bigdata/namespace/islandora/sparql?connectionClose=true" + "http://localhost:8080/bigdata/namespace/islandora/sparql" + + "?connectionClose=true&disableStreamCache=true" ); } }); @@ -188,7 +191,9 @@ public void testDelete() throws Exception { @Override public void configure() throws Exception { replaceFromWith("direct:start"); - mockEndpointsAndSkip("http://localhost:8080/bigdata/namespace/islandora/sparql?connectionClose=true"); + mockEndpointsAndSkip("http://localhost:8080/bigdata/namespace/islandora/sparql" + + "?connectionClose=true&disableStreamCache=true" + ); } }); context.start();