starting the infrastructure to test the sparql module
Project: http://git-wip-us.apache.org/repos/asf/incubator-marmotta/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-marmotta/commit/b92d74f5 Tree: http://git-wip-us.apache.org/repos/asf/incubator-marmotta/tree/b92d74f5 Diff: http://git-wip-us.apache.org/repos/asf/incubator-marmotta/diff/b92d74f5 Branch: refs/heads/master Commit: b92d74f54b7ab6e6ff898be992ed7469dc97a710 Parents: 1ceb90a Author: Sergio Fernández <[email protected]> Authored: Fri Apr 5 13:27:56 2013 +0200 Committer: Sergio Fernández <[email protected]> Committed: Fri Apr 5 13:27:56 2013 +0200 ---------------------------------------------------------------------- platform/marmotta-sparql/pom.xml | 54 ++++++++++++ .../sparql/webservices/SparqlWebServiceTest.java | 53 ++++++++++++ .../marmotta-sparql/src/test/resources/foaf.rdf | 63 +++++++++++++++ 3 files changed, 170 insertions(+), 0 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/b92d74f5/platform/marmotta-sparql/pom.xml ---------------------------------------------------------------------- diff --git a/platform/marmotta-sparql/pom.xml b/platform/marmotta-sparql/pom.xml index 24ac806..c809d5c 100644 --- a/platform/marmotta-sparql/pom.xml +++ b/platform/marmotta-sparql/pom.xml @@ -163,6 +163,60 @@ <groupId>org.openrdf.sesame</groupId> <artifactId>sesame-queryresultio-text</artifactId> </dependency> + + <!-- testing --> + <dependency> + <groupId>org.apache.marmotta</groupId> + <artifactId>marmotta-core</artifactId> + <version>${project.version}</version> + <type>test-jar</type> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.mortbay.jetty</groupId> + <artifactId>jetty-embedded</artifactId> + <version>6.1.26</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.jboss.weld.se</groupId> + <artifactId>weld-se-core</artifactId> + </dependency> + <dependency> + <groupId>com.h2database</groupId> + <artifactId>h2</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>com.jayway.restassured</groupId> + <artifactId>rest-assured</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.hamcrest</groupId> + <artifactId>hamcrest-library</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.hamcrest</groupId> + <artifactId>hamcrest-core</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>com.google.code.tempus-fugit</groupId> + <artifactId>tempus-fugit</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>com.googlecode.jatl</groupId> + <artifactId>jatl</artifactId> + <scope>test</scope> + </dependency> </dependencies> http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/b92d74f5/platform/marmotta-sparql/src/test/java/org/apache/marmotta/platform/sparql/webservices/SparqlWebServiceTest.java ---------------------------------------------------------------------- diff --git a/platform/marmotta-sparql/src/test/java/org/apache/marmotta/platform/sparql/webservices/SparqlWebServiceTest.java b/platform/marmotta-sparql/src/test/java/org/apache/marmotta/platform/sparql/webservices/SparqlWebServiceTest.java new file mode 100644 index 0000000..d7d3a61 --- /dev/null +++ b/platform/marmotta-sparql/src/test/java/org/apache/marmotta/platform/sparql/webservices/SparqlWebServiceTest.java @@ -0,0 +1,53 @@ +package org.apache.marmotta.platform.sparql.webservices; + +import java.io.IOException; +import java.io.InputStream; + +import org.apache.marmotta.platform.core.api.importer.ImportService; +import org.apache.marmotta.platform.core.api.triplestore.ContextService; +import org.apache.marmotta.platform.core.api.user.UserService; +import org.apache.marmotta.platform.core.exception.io.MarmottaImportException; +import org.apache.marmotta.platform.core.test.base.JettyMarmotta; +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; + +import com.jayway.restassured.RestAssured; + +/** + * Tests for testing the SPAQL endpoint + * + * @author Sergio Fernández + * + */ +public class SparqlWebServiceTest { + + private static JettyMarmotta marmotta; + + @BeforeClass + public static void setUp() throws MarmottaImportException { + marmotta = new JettyMarmotta("/marmotta"); + ImportService importService = marmotta.getService(ImportService.class); + UserService userService = marmotta.getService(UserService.class); + ContextService contextService = marmotta.getService(ContextService.class); + InputStream is = Thread.currentThread().getContextClassLoader().getResourceAsStream("foaf.rdf"); + importService.importData(is, "application/rdf+xml", userService.getAnonymousUser(), contextService.getDefaultContext()); + + RestAssured.baseURI = "http://localhost"; + RestAssured.port = marmotta.getPort(); + RestAssured.basePath = marmotta.getContext(); + + } + + @AfterClass + public static void tearDown() { + marmotta.shutdown(); + } + + @Test + public void testSet() throws IOException, InterruptedException { + + + } + +} http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/b92d74f5/platform/marmotta-sparql/src/test/resources/foaf.rdf ---------------------------------------------------------------------- diff --git a/platform/marmotta-sparql/src/test/resources/foaf.rdf b/platform/marmotta-sparql/src/test/resources/foaf.rdf new file mode 100644 index 0000000..d026773 --- /dev/null +++ b/platform/marmotta-sparql/src/test/resources/foaf.rdf @@ -0,0 +1,63 @@ +<?xml version="1.0" encoding="utf-8"?> +<rdf:RDF + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" + xmlns:owl="http://www.w3.org/2002/07/owl#" + xmlns:foaf="http://xmlns.com/foaf/0.1/" + xmlns:doap="http://usefulinc.com/ns/doap#" + xmlns:sioc="http://rdfs.org/sioc/ns#" + xmlns:sioct="http://rdfs.org/sioc/types#" + xmlns:dc="http://purl.org/dc/elements/1.1/" + xmlns:dct="http://purl.org/dc/terms/" + xmlns:mvcb="http://webns.net/mvcb/" + xmlns:rss="http://purl.org/rss/1.0/" + xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" + xmlns:contact="http://www.w3.org/2000/10/swap/pim/contact#" + xmlns:air="http://www.daml.org/2001/10/html/airport-ont#" + xmlns:wn="http://xmlns.com/wordnet/1.6/" + xmlns:uranai="http://kota.s12.xrea.com/vocab/uranai#" + xmlns:rel="http://purl.org/vocab/relationship/" + xmlns:session="http://redfoot.net/2005/session#" + xmlns:cert="http://www.w3.org/ns/auth/cert#" + xmlns:wot="http://xmlns.com/wot/0.1/" + xml:lang="en" +> + + <foaf:Document rdf:about="http://www.wikier.org/foaf.rdf"> + <rdfs:label>Wikier's FOAF document</rdfs:label> + <rdfs:comment>Document with Friend-of-a-Friend description of Wikier</rdfs:comment> + <foaf:maker rdf:resource="http://www.wikier.org/foaf#wikier"/> + <dct:license rdf:resource="http://creativecommons.org/licenses/by-sa/3.0/" /> + <foaf:primaryTopic rdf:resource="http://www.wikier.org/foaf#wikier"/> + <mvcb:generatorAgent rdf:resource="http://rdfohloh.wikier.org/project/emacs"/> + <mvcb:errorReportsTo rdf:resource="mailto:[email protected]" /> + </foaf:Document> + + <foaf:Person rdf:about="http://www.wikier.org/foaf#wikier"> + <foaf:name xml:lang="es">Sergio Fernández</foaf:name> + <foaf:title>Mr</foaf:title> + <foaf:firstName xml:lang="es">Sergio</foaf:firstName> + <foaf:surname xml:lang="es">Fernández</foaf:surname> + <foaf:gender>male</foaf:gender> + <foaf:nick>wikier</foaf:nick> + <session:hexdigest>30e97da6ad2d5be1086a64f3fc44a03a6fecadb3</session:hexdigest> + <uranai:bloodtype>O-</uranai:bloodtype> + <rdfs:comment>This URI indentifies me as a person. Feel free to use it when making statements about me as a person</rdfs:comment> + <rdfs:comment xml:lang="es">Esta URI me identifica como persona. Ãsala para referirte a mi como persona</rdfs:comment> + + <foaf:mbox rdf:resource="mailto:[email protected]" /> + <foaf:mbox_sha1sum>d0fd987214f56f70b4c47fb96795f348691f93ab</foaf:mbox_sha1sum> + + <foaf:mbox rdf:resource="mailto:[email protected]" /> + <foaf:mbox_sha1sum>119222cf3a2893a375cc4f884a0138155c771415</foaf:mbox_sha1sum> + + <foaf:mbox rdf:resource="mailto:[email protected]" /> + <foaf:mbox_sha1sum>fe6d23dc07ca84b1c487eb20d816aa4caf12ee84</foaf:mbox_sha1sum> + + <foaf:mbox rdf:resource="mailto:[email protected]" /> + <foaf:mbox_sha1sum>762842c4b57e9657fe68badcc5439d3053d85f05</foaf:mbox_sha1sum> + + </foaf:Person> + +</rdf:RDF> +
