Commit 7809ad9e authored by acoburn's avatar acoburn
Browse files

Add API-X support to acrepo-exts-ldpath

parent e4523668
......@@ -21,3 +21,8 @@ rest.host=localhost
# The global timeout for cache entries (in seconds)
cache.timeout=86400
# API-X configuration
extension.load=true
extension.load.uri=http://apix/services//apix:load
extension.load.maxiumumRedeliveries=60
......@@ -22,6 +22,9 @@
<cm:property name="rest.host" value="localhost"/>
<cm:property name="rest.port" value="9086"/>
<cm:property name="cache.timeout" value="86400"/>
<cm:property name="extension.load" value="true" />
<cm:property name="extension.load.uri" value="http://apix/services//apix:load" />
<cm:property name="extension.load.maximumRediveries" value="60" />
</cm:default-properties>
</cm:property-placeholder>
......@@ -94,5 +97,30 @@
<method ref="ldpath" method="programQuery(${headers.context}, ${body})"/>
</setBody>
</route>
<!-- Self-register the ldpath service as an API-X extension -->
<route id="load-extension">
<from uri="timer:register?repeatCount=1" />
<onException>
<exception>java.lang.Exception</exception>
<redeliveryPolicy maximumRedeliveries="{{extension.load.maximumRediveries}}"
logRetryAttempted="true" retryAttemptedLogLevel="INFO" />
</onException>
<setHeader headerName="Content-Type">
<constant>text/plain</constant>
</setHeader>
<setHeader headerName="CamelHttpMethod">
<constant>POST</constant>
</setHeader>
<setBody>
<simple>http://{{rest.host}}:{{rest.port}}{{rest.prefix}}</simple>
</setBody>
<choice>
<when>
<simple>{{extension.load}}</simple>
<to uri="jetty:{{extension.load.uri}}?okStatusCodeRange=200-399" />
</when>
</choice>
</route>
</camelContext>
</blueprint>
......@@ -115,6 +115,9 @@ public class AcrepoTemplateIT extends AbstractOSGiIT {
final String baseUrl = "http://localhost:" + System.getProperty("fcrepo.port") + "/fcrepo/rest";
final String baseSvcUrl = "http://localhost:" + System.getProperty("karaf.template.port") + "/template";
// Wait 10 seconds
Thread.sleep(10000);
assertTrue(options(baseSvcUrl).contains("apix:bindsTo fedora:Resource"));
range(1, 2).mapToObj(x -> post(baseUrl)).forEach(url -> {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment