Skip to content

Commit 67eac07

Browse files
dannylambseth-shaw-unlv
authored andcommitted
Adding connection close to http4 endpoints (#58)
* Adding connection close to http4 endpoints * tests
1 parent df29780 commit 67eac07

File tree

6 files changed

+30
-20
lines changed

6 files changed

+30
-20
lines changed

islandora-connector-derivative/src/main/java/ca/islandora/alpaca/connector/derivative/DerivativeConnector.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -63,13 +63,13 @@ public void configure() {
6363
.setHeader("X-Islandora-Args", simple("${exchangeProperty.event.attachment.content.args}"))
6464
.setHeader("Apix-Ldp-Resource", simple("${exchangeProperty.event.attachment.content.sourceUri}"))
6565
.setBody(simple("${null}"))
66-
.to("{{derivative.service.url}}")
66+
.to("{{derivative.service.url}}?connectionClose=true")
6767

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

7575
}

islandora-connector-derivative/src/test/java/ca/islandora/alpaca/connector/derivative/DerivativeConnectorTest.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -66,15 +66,15 @@ public void configure() throws Exception {
6666
replaceFromWith("direct:start");
6767

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

77-
mockEndpointsAndSkip("http://localhost:8000/node/2/media/image/3");
77+
mockEndpointsAndSkip("http://localhost:8000/node/2/media/image/3?connectionClose=true");
7878
}
7979
});
8080
context.start();

islandora-indexing-fcrepo/src/main/java/ca/islandora/alpaca/indexing/fcrepo/FcrepoIndexer.java

+5-5
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ public void configure() {
137137
.setBody(simple("${null}"))
138138

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

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

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

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

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

189189
from("{{file.stream}}")
190190
.routeId("FcrepoIndexerFile")
@@ -207,7 +207,7 @@ public void configure() {
207207
)
208208

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

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

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

230230
}
231231
}

islandora-indexing-fcrepo/src/test/java/ca/islandora/alpaca/indexing/fcrepo/FcrepoIndexerTest.java

+13-5
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,9 @@ public void testNode() throws Exception {
5959
@Override
6060
public void configure() throws Exception {
6161
replaceFromWith("direct:start");
62-
mockEndpointsAndSkip("http://localhost:8000/milliner/node/72358916-51e9-4712-b756-4b0404c91b1d");
62+
mockEndpointsAndSkip(
63+
"http://localhost:8000/milliner/node/72358916-51e9-4712-b756-4b0404c91b1d?connectionClose=true"
64+
);
6365
}
6466
});
6567
context.start();
@@ -92,7 +94,9 @@ public void testNodeDelete() throws Exception {
9294
@Override
9395
public void configure() throws Exception {
9496
replaceFromWith("direct:start");
95-
mockEndpointsAndSkip("http://localhost:8000/milliner/node/72358916-51e9-4712-b756-4b0404c91b1d");
97+
mockEndpointsAndSkip(
98+
"http://localhost:8000/milliner/node/72358916-51e9-4712-b756-4b0404c91b1d?connectionClose=true"
99+
);
96100
}
97101
});
98102
context.start();
@@ -124,7 +128,9 @@ public void testFile() throws Exception {
124128
@Override
125129
public void configure() throws Exception {
126130
replaceFromWith("direct:start");
127-
mockEndpointsAndSkip("http://localhost:8000/gemini/148dfe8f-9711-4263-97e7-3ef3fb15864f");
131+
mockEndpointsAndSkip(
132+
"http://localhost:8000/gemini/148dfe8f-9711-4263-97e7-3ef3fb15864f?connectionClose=true"
133+
);
128134
}
129135
});
130136
context.start();
@@ -161,7 +167,9 @@ public void testFileDelet() throws Exception {
161167
@Override
162168
public void configure() throws Exception {
163169
replaceFromWith("direct:start");
164-
mockEndpointsAndSkip("http://localhost:8000/gemini/148dfe8f-9711-4263-97e7-3ef3fb15864f");
170+
mockEndpointsAndSkip(
171+
"http://localhost:8000/gemini/148dfe8f-9711-4263-97e7-3ef3fb15864f?connectionClose=true"
172+
);
165173
}
166174
});
167175
context.start();
@@ -193,7 +201,7 @@ public void testMedia() throws Exception {
193201
@Override
194202
public void configure() throws Exception {
195203
replaceFromWith("direct:start");
196-
mockEndpointsAndSkip("http://localhost:8000/milliner/media/field_media_image");
204+
mockEndpointsAndSkip("http://localhost:8000/milliner/media/field_media_image?connectionClose=true");
197205
}
198206
});
199207
context.start();

islandora-indexing-triplestore/src/main/java/ca/islandora/alpaca/indexing/triplestore/TriplestoreIndexer.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -59,19 +59,19 @@ public void configure() {
5959
.removeHeaders("*", "Authorization")
6060
.setHeader(Exchange.HTTP_METHOD, constant("GET"))
6161
.setBody(simple("${null}"))
62-
.toD("${exchangeProperty.url}")
62+
.toD("${exchangeProperty.url}&connectionClose=true")
6363
.setHeader(FCREPO_URI, simple("${exchangeProperty.url}"))
6464
.process(new SparqlUpdateProcessor())
6565
.log(INFO, LOGGER, "Indexing ${exchangeProperty.url} in triplestore")
66-
.to("{{triplestore.baseUrl}}");
66+
.to("{{triplestore.baseUrl}}?connectionClose=true");
6767

6868
from("{{delete.stream}}")
6969
.routeId("IslandoraTriplestoreIndexerDelete")
7070
.to("direct:parse.url")
7171
.setHeader(FCREPO_URI, simple("${exchangeProperty.url}"))
7272
.process(new SparqlDeleteProcessor())
7373
.log(INFO, LOGGER, "Deleting ${exchangeProperty.url} in triplestore")
74-
.to("{{triplestore.baseUrl}}");
74+
.to("{{triplestore.baseUrl}}?connectionClose=true");
7575

7676
// Extracts the JSONLD URL from the event message and stores it on the exchange.
7777
from("direct:parse.url")

islandora-indexing-triplestore/src/test/java/ca/islandora/alpaca/indexing/triplestore/TriplestoreIndexerTest.java

+5-3
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ public void configure() throws Exception {
131131
replaceFromWith("direct:start");
132132

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

144-
mockEndpointsAndSkip("http://localhost:8080/bigdata/namespace/islandora/sparql");
144+
mockEndpointsAndSkip(
145+
"http://localhost:8080/bigdata/namespace/islandora/sparql?connectionClose=true"
146+
);
145147
}
146148
});
147149
context.start();
@@ -181,7 +183,7 @@ public void testDelete() throws Exception {
181183
@Override
182184
public void configure() throws Exception {
183185
replaceFromWith("direct:start");
184-
mockEndpointsAndSkip("http://localhost:8080/bigdata/namespace/islandora/sparql");
186+
mockEndpointsAndSkip("http://localhost:8080/bigdata/namespace/islandora/sparql?connectionClose=true");
185187
}
186188
});
187189
context.start();

0 commit comments

Comments
 (0)