Commit 9a578353 authored by bseeger's avatar bseeger
Browse files

Adds integration tests. Cleans up the code a bit.

parent 4b77ebdc
...@@ -38,7 +38,12 @@ The base url of the fedora repository ...@@ -38,7 +38,12 @@ The base url of the fedora repository
fcrepo.baseUrl=localhost:8080/fcrepo/rest fcrepo.baseUrl=localhost:8080/fcrepo/rest
The port on which the service is made availalbe If the fedora repository requires authentication, the following values can be set
fcrepo.authUsername=<username>
fcrepo.authPassword=<password>
The port on which the service is made available
rest.port=9109 rest.port=9109
......
...@@ -10,9 +10,6 @@ dependencies { ...@@ -10,9 +10,6 @@ dependencies {
} }
compile group: 'org.apache.jena', name: 'jena-osgi', version: jenaVersion compile group: 'org.apache.jena', name: 'jena-osgi', version: jenaVersion
compile project(':acrepo-services-entailment') compile project(':acrepo-services-entailment')
testCompile group: 'junit', name: 'junit', version: junitVersion
testCompile group: 'org.apache.camel', name: 'camel-test-blueprint', version: camelVersion
testCompile group: 'ch.qos.logback', name: 'logback-classic', version: logbackVersion
} }
jar { jar {
......
/*
* Copyright 2016 Amherst College
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* 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 edu.amherst.acdc.exts.entailment;
/**
* Some header field definitions
*
* @author bseeger
*/
final class EntailmentHeaders {
public final static String ENTAILMENT_ACCEPT = "CamelEntailmentAccept";
private EntailmentHeaders() {
// prevent instantiation
}
}
...@@ -15,13 +15,19 @@ ...@@ -15,13 +15,19 @@
*/ */
package edu.amherst.acdc.exts.entailment; package edu.amherst.acdc.exts.entailment;
import static edu.amherst.acdc.exts.entailment.EntailmentHeaders.ENTAILMENT_ACCEPT;
import static java.util.Optional.ofNullable;
import static org.apache.camel.Exchange.CONTENT_TYPE; import static org.apache.camel.Exchange.CONTENT_TYPE;
import static org.apache.camel.Exchange.HTTP_METHOD; import static org.apache.camel.Exchange.HTTP_METHOD;
import static org.apache.camel.Exchange.HTTP_RESPONSE_CODE; import static org.apache.camel.Exchange.HTTP_RESPONSE_CODE;
import static org.fcrepo.camel.FcrepoHeaders.FCREPO_BASE_URL; import static org.fcrepo.camel.FcrepoHeaders.FCREPO_BASE_URL;
import static org.fcrepo.camel.FcrepoHeaders.FCREPO_URI; import static org.fcrepo.camel.FcrepoHeaders.FCREPO_URI;
import java.util.Optional;
import org.apache.camel.builder.RouteBuilder; import org.apache.camel.builder.RouteBuilder;
import org.apache.jena.riot.Lang;
import org.apache.jena.riot.RDFLanguages;
/** /**
* A content router for handling ORE extension requests * A content router for handling ORE extension requests
...@@ -52,13 +58,20 @@ public class EntailmentRouter extends RouteBuilder { ...@@ -52,13 +58,20 @@ public class EntailmentRouter extends RouteBuilder {
.setHeader("Allow").constant("GET,OPTIONS") .setHeader("Allow").constant("GET,OPTIONS")
.to("language:simple:resource:classpath:options.ttl") .to("language:simple:resource:classpath:options.ttl")
.when(header(HTTP_QUERY_CONTEXT).startsWith(header(FCREPO_BASE_URL))) .when(header(HTTP_QUERY_CONTEXT).startsWith(header(FCREPO_BASE_URL)))
.process(exchange -> {
final String contentType = exchange.getIn().getHeader("Accept", String.class);
final Optional<String> rdfLang = ofNullable(contentType).map(RDFLanguages::contentTypeToLang)
.map(Lang::getName);
exchange.getIn().setHeader(ENTAILMENT_ACCEPT, rdfLang.isPresent() ? contentType : DEFAULT_CONTENT_TYPE);
})
.to("direct:get"); .to("direct:get");
from("direct:get").routeId("EntailementGetTriples") from("direct:get").routeId("EntailementGetTriples")
.log("Building RDFS Entailment Info") .log("Building RDFS Entailment Info")
.setHeader("Accept").constant(DEFAULT_CONTENT_TYPE)
.to("fcrepo:{{fcrepo.baseUrl}}?throwExceptionOnFailure=false") .to("fcrepo:{{fcrepo.baseUrl}}?throwExceptionOnFailure=false")
.setHeader(CONTENT_TYPE).constant("text/turtle")
.setHeader(HTTP_RESPONSE_CODE).constant(200) .setHeader(HTTP_RESPONSE_CODE).constant(200)
.setHeader("Accept").header(ENTAILMENT_ACCEPT)
.to("direct:getTriples"); .to("direct:getTriples");
} }
} }
...@@ -36,7 +36,7 @@ ...@@ -36,7 +36,7 @@
<route id="EntailmentTriples"> <route id="EntailmentTriples">
<from uri="direct:getTriples"/> <from uri="direct:getTriples"/>
<setBody> <setBody>
<method ref="entailmentService" method="getEntailedTriples(${header[CamelFcrepoUri]}, ${body}, ${header[Content-Type]})"/> <method ref="entailmentService" method="getEntailedTriples(${header[CamelFcrepoUri]}, ${body}, ${header[Content-Type]}, ${header[Accept]})"/>
</setBody> </setBody>
</route> </route>
......
@prefix premis: <http://www.loc.gov/premis/rdf/v1#> .
@prefix pcdm: <http://pcdm.org/models#> .
@prefix fedora: <http://fedora.info/definitions/v4/repository#> .
@prefix ebucore: <http://www.ebu.ch/metadata/ontologies/ebucore/ebucore#> .
@prefix ldp: <http://www.w3.org/ns/ldp#> .
@prefix iana: <http://www.iana.org/assignments/relation/> .
<http://localhost:8080/fcrepo/rest/pcdm/members/page1/files/file1> a fedora:Binary , fedora:Resource , ldp:NonRDFSource , pcdm:File ;
ebucore:filename "IMG_0107.jpg" ;
ebucore:hasMimeType "image/jpeg" ;
premis:hasSize "1565421"^^<http://www.w3.org/2001/XMLSchema#long> ;
premis:hasMessageDigest <urn:sha1:c9790c378f3589bfcfe092f834d212685f44fff9> ;
iana:describedby <http://localhost:8080/fcrepo/rest/pcdm/members/page1/files/file1/fcr:metadata> ;
fedora:lastModifiedBy "bypassAdmin" ;
fedora:createdBy "bypassAdmin" ;
fedora:created "2016-06-28T00:21:22.621Z"^^<http://www.w3.org/2001/XMLSchema#dateTime> ;
fedora:lastModified "2016-06-28T00:21:22.621Z"^^<http://www.w3.org/2001/XMLSchema#dateTime> ;
fedora:writable "true"^^<http://www.w3.org/2001/XMLSchema#boolean> ;
fedora:hasParent <http://localhost:8080/fcrepo/rest/pcdm/members/page1/files> ;
fedora:numberOfChildren "0"^^<http://www.w3.org/2001/XMLSchema#long> ;
fedora:hasFixityService <http://localhost:8080/fcrepo/rest/pcdm/members/page1/files/file1/fcr:fixity> .
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE configuration>
<configuration>
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>%p %d{HH:mm:ss.SSS} \(%c{0}\) %m%n</pattern>
</encoder>
</appender>
<logger name="edu.amherst.acdc.exts.entailment" additivity="false" level="INFO">
<appender-ref ref="STDOUT"/>
</logger>
<logger name="org.apache.camel" additivity="false" level="INFO">
<appender-ref ref="STDOUT"/>
</logger>
<logger name="org.fcrepo.camel" additivity="false" level="INFO">
<appender-ref ref="STDOUT"/>
</logger>
<root additivity="false" level="INFO">
<appender-ref ref="STDOUT"/>
</root>
</configuration>
@prefix pcdm: <http://pcdm.org/models#> .
@prefix skos: <http://www.w3.org/2004/02/skos/core#> .
@prefix fedora: <http://fedora.info/definitions/v4/repository#> .
@prefix ldp: <http://www.w3.org/ns/ldp#> .
<http://localhost:8080/fcrepo/rest/pcdm> a fedora:Container , fedora:Resource , ldp:RDFSource , ldp:Container, pcdm:Object ;
skos:prefLabel "Top level pcdm:Object"@en ;
fedora:lastModifiedBy "bypassAdmin" ;
fedora:createdBy "bypassAdmin" ;
fedora:created "2016-06-28T00:14:06.677Z"^^<http://www.w3.org/2001/XMLSchema#dateTime> ;
fedora:lastModified "2016-06-28T00:16:25.55Z"^^<http://www.w3.org/2001/XMLSchema#dateTime> ;
fedora:writable "true"^^<http://www.w3.org/2001/XMLSchema#boolean> ;
fedora:hasParent <http://localhost:8080/fcrepo/rest/> ;
fedora:numberOfChildren "1"^^<http://www.w3.org/2001/XMLSchema#long> ;
ldp:contains <http://localhost:8080/fcrepo/rest/pcdm/members> ;
pcdm:hasMember <http://localhost:8080/fcrepo/rest/pcdm/members/page1> .
@prefix pcdm: <http://pcdm.org/models#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix fedora: <http://fedora.info/definitions/v4/repository#> .
@prefix ldp: <http://www.w3.org/ns/ldp#> .
<http://localhost:8080/fcrepo/rest/pcdm/members/page1> a fedora:Container , fedora:Resource , ldp:RDFSource , ldp:Container , pcdm:Object ;
rdfs:label "Page 1" ;
fedora:lastModifiedBy "bypassAdmin" ;
fedora:createdBy "bypassAdmin" ;
fedora:created "2016-06-28T00:16:25.552Z"^^<http://www.w3.org/2001/XMLSchema#dateTime> ;
fedora:lastModified "2016-06-28T00:56:43.618Z"^^<http://www.w3.org/2001/XMLSchema#dateTime> ;
fedora:writable "true"^^<http://www.w3.org/2001/XMLSchema#boolean> ;
fedora:hasParent <http://localhost:8080/fcrepo/rest/pcdm/members> ;
fedora:numberOfChildren "1"^^<http://www.w3.org/2001/XMLSchema#long> ;
ldp:contains <http://localhost:8080/fcrepo/rest/pcdm/members/page1/files> ;
pcdm:hasFile <http://localhost:8080/fcrepo/rest/pcdm/members/page1/files/file1> .
@prefix pcdm: <http://pcdm.org/models#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix fedora: <http://fedora.info/definitions/v4/repository#> .
@prefix ldp: <http://www.w3.org/ns/ldp#> .
<http://localhost:8080/fcrepo/rest/pcdm/members/page2> a fedora:Container , fedora:Resource , ldp:RDFSource , ldp:Container , pcdm:Object ;
rdfs:label "Page 2" ;
fedora:lastModifiedBy "bypassAdmin" ;
fedora:createdBy "bypassAdmin" ;
fedora:created "2016-06-28T00:16:25.552Z"^^<http://www.w3.org/2001/XMLSchema#dateTime> ;
fedora:lastModified "2016-06-28T00:56:43.618Z"^^<http://www.w3.org/2001/XMLSchema#dateTime> ;
fedora:writable "true"^^<http://www.w3.org/2001/XMLSchema#boolean> ;
fedora:hasParent <http://localhost:8080/fcrepo/rest/pcdm/members> ;
fedora:numberOfChildren "1"^^<http://www.w3.org/2001/XMLSchema#long> ;
ldp:contains <http://localhost:8080/fcrepo/rest/pcdm/members/page2/files> ;
pcdm:hasFile <http://localhost:8080/fcrepo/rest/pcdm/members/page2/files/file1> .
...@@ -48,10 +48,12 @@ dependencies { ...@@ -48,10 +48,12 @@ dependencies {
testCompile project(':acrepo-connector-broadcast') testCompile project(':acrepo-connector-broadcast')
testCompile project(':acrepo-connector-idiomatic') testCompile project(':acrepo-connector-idiomatic')
testCompile project(':acrepo-connector-idiomatic-pgsql') testCompile project(':acrepo-connector-idiomatic-pgsql')
testCompile project(':acrepo-services-entailment')
testCompile project(':acrepo-services-inference') testCompile project(':acrepo-services-inference')
testCompile project(':acrepo-services-mint') testCompile project(':acrepo-services-mint')
testCompile project(':acrepo-services-ore') testCompile project(':acrepo-services-ore')
testCompile project(':acrepo-services-pcdm') testCompile project(':acrepo-services-pcdm')
testCompile project(':acrepo-exts-entailment')
testCompile project(':acrepo-exts-fits') testCompile project(':acrepo-exts-fits')
testCompile project(':acrepo-exts-image') testCompile project(':acrepo-exts-image')
testCompile project(':acrepo-exts-ore') testCompile project(':acrepo-exts-ore')
...@@ -64,6 +66,8 @@ dependencies { ...@@ -64,6 +66,8 @@ dependencies {
testCompile group: 'org.osgi', name: 'org.osgi.compendium', version: osgiVersion testCompile group: 'org.osgi', name: 'org.osgi.compendium', version: osgiVersion
testCompile group: 'org.apache.jena', name: 'jena-osgi', version: jenaVersion testCompile group: 'org.apache.jena', name: 'jena-osgi', version: jenaVersion
testCompile group: 'org.glassfish.hk2.external', name: 'javax.inject', version: hk2Version testCompile group: 'org.glassfish.hk2.external', name: 'javax.inject', version: hk2Version
testCompile group: 'commons-io', name: 'commons-io', version: commonsIoVersion
testCompile group: 'org.apache.httpcomponents', name: 'httpclient-osgi', version: httpclientVersion testCompile group: 'org.apache.httpcomponents', name: 'httpclient-osgi', version: httpclientVersion
testCompile group: 'org.apache.httpcomponents', name: 'httpcore-osgi', version: httpcoreVersion testCompile group: 'org.apache.httpcomponents', name: 'httpcore-osgi', version: httpcoreVersion
testCompile group: 'com.fasterxml.jackson.core', name: 'jackson-core', version: jacksonVersion testCompile group: 'com.fasterxml.jackson.core', name: 'jackson-core', version: jacksonVersion
...@@ -133,6 +137,7 @@ task integrationTest(type: Test) { ...@@ -133,6 +137,7 @@ task integrationTest(type: Test) {
test { test {
systemProperty 'karaf.version', karafVersion systemProperty 'karaf.version', karafVersion
systemProperty 'karaf.commonsIo.version', commonsIoVersion
systemProperty 'karaf.ssh.port', randomPort() systemProperty 'karaf.ssh.port', randomPort()
systemProperty 'karaf.rmiServer.port', randomPort() systemProperty 'karaf.rmiServer.port', randomPort()
...@@ -140,6 +145,7 @@ test { ...@@ -140,6 +145,7 @@ test {
systemProperty 'karaf.template.port', randomPort() systemProperty 'karaf.template.port', randomPort()
systemProperty 'karaf.metadata.port', randomPort() systemProperty 'karaf.metadata.port', randomPort()
systemProperty 'karaf.ore.port', randomPort() systemProperty 'karaf.ore.port', randomPort()
systemProperty 'karaf.entailment.port', randomPort()
systemProperty 'karaf.pcdm.port', randomPort() systemProperty 'karaf.pcdm.port', randomPort()
systemProperty 'karaf.image.port', randomPort() systemProperty 'karaf.image.port', randomPort()
systemProperty 'karaf.idiomatic.port', randomPort() systemProperty 'karaf.idiomatic.port', randomPort()
......
/*
* Copyright 2016 Amherst College
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* 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 edu.amherst.acdc.itests;
import static java.nio.charset.StandardCharsets.UTF_8;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import static org.ops4j.pax.exam.CoreOptions.maven;
import static org.ops4j.pax.exam.CoreOptions.mavenBundle;
import static org.ops4j.pax.exam.CoreOptions.systemProperty;
import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.configureConsole;
import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.editConfigurationFilePut;
import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.features;
import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.karafDistributionConfiguration;
import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.keepRuntimeFolder;
import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.logLevel;
import static org.slf4j.LoggerFactory.getLogger;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.core.type.TypeReference;
import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.InputStream;
import java.io.StringWriter;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.HashMap;
import org.apache.camel.CamelContext;
import org.apache.commons.io.IOUtils;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.ops4j.pax.exam.Configuration;
import org.ops4j.pax.exam.ConfigurationManager;
import org.ops4j.pax.exam.Option;
import org.ops4j.pax.exam.junit.PaxExam;
import org.ops4j.pax.exam.karaf.options.LogLevelOption.LogLevel;
import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy;
import org.ops4j.pax.exam.spi.reactors.PerClass;
import org.slf4j.Logger;
/**
* @author Bethany Seeger
* @since April 3, 2017
*/
@RunWith(PaxExam.class)
@ExamReactorStrategy(PerClass.class)
public class AcrepoEntailmentIT extends AbstractOSGiIT {
private static Logger LOGGER = getLogger(AcrepoEntailmentIT.class);
@Configuration
public Option[] config() {
final ConfigurationManager cm = new ConfigurationManager();
final String fcrepoPort = cm.getProperty("fcrepo.dynamic.test.port");
final String entExtPort = cm.getProperty("karaf.entailment.port");
final String rmiRegistryPort = cm.getProperty("karaf.rmiRegistry.port");
final String rmiServerPort = cm.getProperty("karaf.rmiServer.port");
final String fcrepoBaseUrl = "http://localhost:" + fcrepoPort + "/fcrepo/rest";
final String sshPort = cm.getProperty("karaf.ssh.port");
final String commonIoVersion = cm.getProperty("karaf.commonsIo.version");
final List<String> ontologies = Arrays.asList("http://purl.org/dc/terms/",
"http://purl.org/dc/elements/1.1/", "http://id.loc.gov/ontologies/bibframe/",
"http://www.w3.org/2004/02/skos/core#", "http://www.w3.org/2000/01/rdf-schema#");
return new Option[] {
karafDistributionConfiguration()
.frameworkUrl(maven().groupId("org.apache.karaf").artifactId("apache-karaf")
.version(cm.getProperty("karaf.version")).type("zip"))
.unpackDirectory(new File("build", "exam"))
.useDeployFolder(false),
logLevel(LogLevel.INFO),
keepRuntimeFolder(),
configureConsole().ignoreLocalConsole(),
features(maven().groupId("org.apache.karaf.features").artifactId("standard")
.versionAsInProject().classifier("features").type("xml"), "scr"),
features(maven().groupId("org.apache.camel.karaf").artifactId("apache-camel")
.type("xml").classifier("features").versionAsInProject()),
features(maven().groupId("org.fcrepo.camel").artifactId("fcrepo-camel")
.type("xml").classifier("features").versionAsInProject()),
features(maven().groupId("edu.amherst.acdc").artifactId("acrepo-karaf")
.type("xml").classifier("features").versionAsInProject(),
"acrepo-exts-entailment"),
mavenBundle().groupId("commons-io").artifactId("commons-io").version(commonIoVersion),
systemProperty("karaf.entailment.port").value(entExtPort),
systemProperty("fcrepo.port").value(fcrepoPort),
editConfigurationFilePut("etc/org.apache.karaf.management.cfg", "rmiRegistryPort", rmiRegistryPort),
editConfigurationFilePut("etc/org.apache.karaf.management.cfg", "rmiServerPort", rmiServerPort),
editConfigurationFilePut("etc/org.apache.karaf.shell.cfg", "sshPort", sshPort),
editConfigurationFilePut("etc/edu.amherst.acdc.exts.entailment.cfg", "fcrepo.baseUrl", fcrepoBaseUrl),
editConfigurationFilePut("etc/edu.amherst.acdc.exts.entailment.cfg", "rest.port", entExtPort),
editConfigurationFilePut("etc/edu.amherst.acdc.exts.entailment.cfg", "extension.load", "false"),
editConfigurationFilePut("etc/edu.amherst.acdc.services.entailment.cfg", "rdfs.ontologies",
String.join(",", ontologies))
};
}
@Test
public void testInstallation() throws Exception {
assertTrue(featuresService.isInstalled(featuresService.getFeature("camel-core")));
assertTrue(featuresService.isInstalled(featuresService.getFeature("fcrepo-camel")));
assertTrue(featuresService.isInstalled(featuresService.getFeature("acrepo-services-entailment")));
assertTrue(featuresService.isInstalled(featuresService.getFeature("acrepo-exts-entailment")));
}
@Test
public void testEntailmentOptions() throws Exception {
// make sure that the camel context has started up.
final CamelContext ctx = getOsgiService(CamelContext.class, "(camel.context.name=AcrepoExtEntailment)",
10000);
assertNotNull(ctx);
final String baseUrl = "http://localhost:" + System.getProperty("fcrepo.port") + "/fcrepo/rest";
final String baseSvcUrl = "http://localhost:" + System.getProperty("karaf.entailment.port") + "/entailment";
assertTrue(options(baseSvcUrl).contains("apix:bindsTo ldp:RDFSource"));
}
@Test
public void testEntailmentTurtle() throws Exception {
// make sure that the camel context has started up.
final CamelContext ctx = getOsgiService(CamelContext.class, "(camel.context.name=AcrepoExtEntailment)",
10000);
assertNotNull(ctx);
final String baseUrl = "http://localhost:" + System.getProperty("fcrepo.port") + "/fcrepo/rest";
final String baseSvcUrl = "http://localhost:" + System.getProperty("karaf.entailment.port") + "/entailment";
final String obj = post(baseUrl, getClass().getResourceAsStream("/resource.ttl"), "text/turtle");
final String response = get(baseSvcUrl + "?context=" + obj);
final InputStream input = new ByteArrayInputStream(response.getBytes(UTF_8));
final StringWriter sw = new StringWriter();
IOUtils.copy(input, sw, UTF_8);
final String str = sw.toString();
assertTrue(str.contains("dc:rights"));
assertTrue(str.contains("rdfs:label"));
}
@Test
public void testEntailmentJsonLD() throws Exception {
// make sure that the camel context has started up.
final CamelContext ctx = getOsgiService(CamelContext.class, "(camel.context.name=AcrepoExtEntailment)",
10000);
assertNotNull(ctx);
final String baseUrl = "http://localhost:" + System.getProperty("fcrepo.port") + "/fcrepo/rest";
final String baseSvcUrl = "http://localhost:" + System.getProperty("karaf.entailment.port") + "/entailment";
final String obj = post(baseUrl, getClass().getResourceAsStream("/resource.ttl"), "text/turtle");
final String response = get(baseSvcUrl + "?context=" + obj, "application/ld+json");
final InputStream input = new ByteArrayInputStream(response.getBytes(UTF_8));
final ObjectMapper objectMapper = new ObjectMapper();
final TypeReference tr = new TypeReference<HashMap<String,Object>>() {};
final Map<String,Object> jsonMap = objectMapper.readValue(input, tr);
assertFalse(jsonMap.isEmpty());
}
}
...@@ -62,6 +62,7 @@ public class AcrepoServicesIT extends AbstractOSGiIT { ...@@ -62,6 +62,7 @@ public class AcrepoServicesIT extends AbstractOSGiIT {
final String imagePort = cm.getProperty("karaf.image.port"); final String imagePort = cm.getProperty("karaf.image.port");
final String ldpathPort = cm.getProperty("karaf.ldpath.port"); final String ldpathPort = cm.getProperty("karaf.ldpath.port");
final String fitsPort = cm.getProperty("karaf.fits.port"); final String fitsPort = cm.getProperty("karaf.fits.port");
final String entailmentPort = cm.getProperty("karaf.entailment.port");
return new Option[] { return new Option[] {
karafDistributionConfiguration() karafDistributionConfiguration()
...@@ -89,6 +90,7 @@ public class AcrepoServicesIT extends AbstractOSGiIT { ...@@ -89,6 +90,7 @@ public class AcrepoServicesIT extends AbstractOSGiIT {
"acrepo-connector-broadcast", "acrepo-connector-broadcast",
"acrepo-connector-triplestore", "acrepo-connector-triplestore",
"acrepo-exts-entailment",
"acrepo-exts-fits", "acrepo-exts-fits",
"acrepo-exts-image", "acrepo-exts-image",
"acrepo-exts-ldpath", "acrepo-exts-ldpath",
...@@ -101,11 +103,14 @@ public class AcrepoServicesIT extends AbstractOSGiIT { ...@@ -101,11 +103,14 @@ public class AcrepoServicesIT extends AbstractOSGiIT {
"acrepo-libs-jsonld", "acrepo-libs-jsonld",
"acrepo-libs-jackson", "acrepo-libs-jackson",
"acrepo-services-entailment",
"acrepo-services-inference", "acrepo-services-inference",
"acrepo-services-mint", "acrepo-services-mint",
"acrepo-services-ore", "acrepo-services-ore",
"acrepo-services-pcdm"), "acrepo-services-pcdm"),
editConfigurationFilePut("etc/edu.amherst.acdc.exts.entailment.cfg", "rest.port", entailmentPort),
editConfigurationFilePut("etc/edu.amherst.acdc.exts.entailment.cfg", "extension.load", "false"),
editConfigurationFilePut("etc/edu.amherst.acdc.exts.fits.cfg", "rest.port", fitsPort), editConfigurationFilePut("etc/edu.amherst.acdc.exts.fits.cfg", "rest.port", fitsPort),
editConfigurationFilePut("etc/edu.amherst.acdc.exts.fits.cfg", "extension.load", "false"), editConfigurationFilePut("etc/edu.amherst.acdc.exts.fits.cfg", "extension.load", "false"),
editConfigurationFilePut("etc/edu.amherst.acdc.exts.image.cfg", "rest.port", imagePort), editConfigurationFilePut("etc/edu.amherst.acdc.exts.image.cfg", "rest.port", imagePort),
...@@ -133,6 +138,7 @@ public class AcrepoServicesIT extends AbstractOSGiIT { ...@@ -133,6 +138,7 @@ public class AcrepoServicesIT extends AbstractOSGiIT {
assertTrue(featuresService.isInstalled(featuresService.getFeature("fcrepo-service-activemq"))); assertTrue(featuresService.isInstalled(featuresService.getFeature("fcrepo-service-activemq")));
assertTrue(featuresService.isInstalled(featuresService.getFeature("acrepo-connector-broadcast"))); assertTrue(featuresService.isInstalled(featuresService.getFeature("acrepo-connector-broadcast")));
assertTrue(featuresService.isInstalled(featuresService.getFeature("acrepo-connector-triplestore"))); assertTrue(featuresService.isInstalled(featuresService.getFeature("acrepo-connector-triplestore")));
assertTrue(featuresService.isInstalled(featuresService.getFeature("acrepo-exts-entailment")));
assertTrue(featuresService.isInstalled(featuresService.getFeature("acrepo-exts-fits"))); assertTrue(featuresService.isInstalled(featuresService.getFeature("acrepo-exts-fits")));
assertTrue(featuresService.isInstalled(featuresService.getFeature("acrepo-exts-image"))); assertTrue(featuresService.isInstalled(featuresService.getFeature("acrepo-exts-image")));
assertTrue(featuresService.isInstalled(featuresService.getFeature("acrepo-exts-ldpath"))); assertTrue(featuresService.isInstalled(featuresService.getFeature("acrepo-exts-ldpath")));
...@@ -143,6 +149,7 @@ public class AcrepoServicesIT extends AbstractOSGiIT { ...@@ -143,6 +149,7 @@ public class AcrepoServicesIT extends AbstractOSGiIT {
assertTrue(featuresService.isInstalled(featuresService.getFeature("acrepo-libs-jackson"))); assertTrue(featuresService.isInstalled(featuresService.getFeature("acrepo-libs-jackson")));
assertTrue(featuresService.isInstalled(featuresService.getFeature("acrepo-libs-jena"))); assertTrue(featuresService.isInstalled(featuresService.getFeature("acrepo-libs-jena")));
assertTrue(featuresService.isInstalled(featuresService.getFeature("acrepo-libs-jsonld"))); assertTrue(featuresService.isInstalled(featuresService.getFeature("acrepo-libs-jsonld")));
assertTrue(featuresService.isInstalled(featuresService.getFeature("acrepo-services-entailment")));
assertTrue(featuresService.isInstalled(featuresService.getFeature("acrepo-services-inference"))); assertTrue(featuresService.isInstalled(featuresService.getFeature("acrepo-services-inference")));
assertTrue(featuresService.isInstalled(featuresService.getFeature("acrepo-services-mint"))); assertTrue(featuresService.isInstalled(featuresService.getFeature("acrepo-services-mint")));
assertTrue(featuresService.isInstalled(featuresService.getFeature("acrepo-services-ore"))); assertTrue(featuresService.isInstalled(featuresService.getFeature("acrepo-services-ore")));
......
...@@ -7,6 +7,7 @@ dependencies { ...@@ -7,6 +7,7 @@ dependencies {
testCompile group: 'xerces', name: 'xercesImpl', version: xercesVersion testCompile group: 'xerces', name: 'xercesImpl', version: xercesVersion
testCompile group: 'junit', name: 'junit', version: junitVersion