marmotta-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ja...@apache.org
Subject [32/50] [abbrv] git commit: MARMOTTA-438: started to think aboout the actual test cases, but I'll leave it from now since currently the document is not yet consistent
Date Fri, 04 Apr 2014 09:30:29 GMT
MARMOTTA-438: started to think aboout the actual test cases, but I'll leave it from now since
currently the document is not yet consistent


Project: http://git-wip-us.apache.org/repos/asf/marmotta/repo
Commit: http://git-wip-us.apache.org/repos/asf/marmotta/commit/0cb20f61
Tree: http://git-wip-us.apache.org/repos/asf/marmotta/tree/0cb20f61
Diff: http://git-wip-us.apache.org/repos/asf/marmotta/diff/0cb20f61

Branch: refs/heads/develop
Commit: 0cb20f61858a477d76e0e7364770d193c99abb38
Parents: 96ba6e0
Author: Sergio Fernández <wikier@apache.org>
Authored: Tue Mar 18 16:36:37 2014 +0100
Committer: Sergio Fernández <wikier@apache.org>
Committed: Tue Mar 18 16:36:37 2014 +0100

----------------------------------------------------------------------
 .../testsuite/LdpAbstractTestSuite.java         |  21 +-
 .../testsuite/LdpResourcesTestSuite.java        |  21 +-
 .../ldp/webservices/testsuite/TestCase.java     | 164 +++++
 .../LDP-Test-Cases-Custom-20140318.ttl          |  63 ++
 .../testsuite/LDP-Test-Cases-WD-20140317.ttl    | 640 +++++++++----------
 5 files changed, 585 insertions(+), 324 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/marmotta/blob/0cb20f61/platform/marmotta-ldp/src/test/java/org/apache/marmotta/platform/ldp/webservices/testsuite/LdpAbstractTestSuite.java
----------------------------------------------------------------------
diff --git a/platform/marmotta-ldp/src/test/java/org/apache/marmotta/platform/ldp/webservices/testsuite/LdpAbstractTestSuite.java
b/platform/marmotta-ldp/src/test/java/org/apache/marmotta/platform/ldp/webservices/testsuite/LdpAbstractTestSuite.java
index 1a0b60d..a9427cb 100644
--- a/platform/marmotta-ldp/src/test/java/org/apache/marmotta/platform/ldp/webservices/testsuite/LdpAbstractTestSuite.java
+++ b/platform/marmotta-ldp/src/test/java/org/apache/marmotta/platform/ldp/webservices/testsuite/LdpAbstractTestSuite.java
@@ -22,6 +22,7 @@ import org.junit.Assume;
 import org.junit.Before;
 import org.junit.Rule;
 import org.junit.rules.TestName;
+import org.openrdf.model.URI;
 import org.openrdf.repository.Repository;
 import org.openrdf.repository.RepositoryConnection;
 import org.openrdf.repository.RepositoryException;
@@ -49,7 +50,9 @@ public abstract class LdpAbstractTestSuite {
 
     public final static String FILES_PATH = "/testsuite/";
 
-    public final static String TEST_CASES_CACHE = "LDP-Test-Cases-WD-20140317";
+    public final static String BASE = "http://www.w3.org/TR/ldp-test-cases/";
+
+    public final static String TEST_CASES_CACHE = "LDP-Test-Cases-Custom-20140318";
 
     protected Repository repo;
 
@@ -115,7 +118,7 @@ public abstract class LdpAbstractTestSuite {
             log.error("test cases data {} not found where expected ({})", file, path);
         } else {
             try {
-                conn.add(is, "", RDFFormat.TURTLE);
+                conn.add(is, BASE, RDFFormat.TURTLE);
             } finally {
                 is.close();
             }
@@ -148,4 +151,18 @@ public abstract class LdpAbstractTestSuite {
 
     }
 
+
+    /**
+     * Load a Test Case according the specified format
+     *
+     * @param uri test case uri
+     * @return test case bean
+     * @see <a href="http://www.w3.org/TR/ldp-test-cases/#test-case-description">LDP
Tests Cases</a>
+     */
+    private TestCase loadTestCase(URI uri) {
+        TestCase tc = new TestCase(uri);
+        //TODO
+        return tc;
+    }
+
 }

http://git-wip-us.apache.org/repos/asf/marmotta/blob/0cb20f61/platform/marmotta-ldp/src/test/java/org/apache/marmotta/platform/ldp/webservices/testsuite/LdpResourcesTestSuite.java
----------------------------------------------------------------------
diff --git a/platform/marmotta-ldp/src/test/java/org/apache/marmotta/platform/ldp/webservices/testsuite/LdpResourcesTestSuite.java
b/platform/marmotta-ldp/src/test/java/org/apache/marmotta/platform/ldp/webservices/testsuite/LdpResourcesTestSuite.java
index 6c7ed93..229bf18 100644
--- a/platform/marmotta-ldp/src/test/java/org/apache/marmotta/platform/ldp/webservices/testsuite/LdpResourcesTestSuite.java
+++ b/platform/marmotta-ldp/src/test/java/org/apache/marmotta/platform/ldp/webservices/testsuite/LdpResourcesTestSuite.java
@@ -17,7 +17,13 @@
 
 package org.apache.marmotta.platform.ldp.webservices.testsuite;
 
+import org.junit.Assert;
 import org.junit.Test;
+import org.openrdf.model.URI;
+import org.openrdf.model.ValueFactory;
+import org.openrdf.model.vocabulary.RDF;
+import org.openrdf.repository.RepositoryConnection;
+import org.openrdf.repository.RepositoryException;
 
 /**
  * LDPRs Test Suite
@@ -27,8 +33,19 @@ import org.junit.Test;
 public class LdpResourcesTestSuite extends LdpAbstractTestSuite {
 
     @Test
-    public void R1() {
-
+    public void TCR1() throws RepositoryException {
+        //not really used, traces of the initial approach
+        RepositoryConnection conn = repo.getConnection();
+        try {
+            conn.begin();
+            ValueFactory vf = conn.getValueFactory();
+            URI uri = vf.createURI(BASE, name.getMethodName());
+            URI tdTestCase = vf.createURI("http://www.w3.org/2006/03/test-description#TestCase");
//TOD: import vocab
+            Assert.assertTrue(conn.hasStatement(uri, RDF.TYPE, tdTestCase, false));
+            //TestCase tc = loadTestCase(uri);
+        } finally {
+            conn.close();
+        }
     }
 
 }

http://git-wip-us.apache.org/repos/asf/marmotta/blob/0cb20f61/platform/marmotta-ldp/src/test/java/org/apache/marmotta/platform/ldp/webservices/testsuite/TestCase.java
----------------------------------------------------------------------
diff --git a/platform/marmotta-ldp/src/test/java/org/apache/marmotta/platform/ldp/webservices/testsuite/TestCase.java
b/platform/marmotta-ldp/src/test/java/org/apache/marmotta/platform/ldp/webservices/testsuite/TestCase.java
new file mode 100644
index 0000000..cb47a8a
--- /dev/null
+++ b/platform/marmotta-ldp/src/test/java/org/apache/marmotta/platform/ldp/webservices/testsuite/TestCase.java
@@ -0,0 +1,164 @@
+package org.apache.marmotta.platform.ldp.webservices.testsuite;
+
+import org.openrdf.model.URI;
+
+import java.util.List;
+
+/**
+ * LDP Test Case
+ *
+ * @author Sergio Fernández
+ * @see <a href="http://www.w3.org/TR/ldp-test-cases/#test-case-description">LDP Tests
Cases</a>
+ */
+public class TestCase {
+
+    /**
+     * Test Case Uniform Resource Identifier
+     */
+    private URI uri;
+
+    /**
+     * rdfs:label. The human-readable label of the test.
+     */
+    private String label;
+
+    /**
+     * dc:title. The name of the test.
+     */
+    private String title;
+
+    /**
+     * dc:description. The description of the test.
+     */
+    private String description;
+
+    /**
+     * dc:contributor. The person (foaf:Person) contributing the test.
+     */
+    private URI contributor;
+
+    /**
+     * td:reviewStatus. The status of the test; possible status are: td:unreviewed, td:approved
or td:rejected.
+     */
+    private URI reviewStatus;
+
+    //td:specificationReference. An excerpt (tn:Excerpt) of the specification that is relevant
to the test.
+
+    /**
+     * td:input. An input (tn:TestInput) used in the test.
+     */
+    private URI input;
+
+    /**
+     * td:precondition. A precondition that must be satisfied before running the test.
+     */
+    private URI precondition;
+
+    /**
+     * tn:output. An output (tn:TestOutput) to be produced by the test.
+     */
+    private URI output;
+
+    /**
+     * tn:testProcess. The list of steps (tn:Step) to be performed during the test.
+     */
+    private List<URI> testProcess;
+
+    /**
+     * tn:testAssertion. An assertion (tn:TestAssertion) to be performed over the test output.
+     */
+    private URI testAssertion;
+
+    public TestCase(URI uri) {
+        this.uri = uri;
+    }
+
+    public URI getUri() {
+        return uri;
+    }
+
+    public void setUri(URI uri) {
+        this.uri = uri;
+    }
+
+    public String getLabel() {
+        return label;
+    }
+
+    public void setLabel(String label) {
+        this.label = label;
+    }
+
+    public String getTitle() {
+        return title;
+    }
+
+    public void setTitle(String title) {
+        this.title = title;
+    }
+
+    public String getDescription() {
+        return description;
+    }
+
+    public void setDescription(String description) {
+        this.description = description;
+    }
+
+    public URI getContributor() {
+        return contributor;
+    }
+
+    public void setContributor(URI contributor) {
+        this.contributor = contributor;
+    }
+
+    public URI getReviewStatus() {
+        return reviewStatus;
+    }
+
+    public void setReviewStatus(URI reviewStatus) {
+        this.reviewStatus = reviewStatus;
+    }
+
+    public URI getInput() {
+        return input;
+    }
+
+    public void setInput(URI input) {
+        this.input = input;
+    }
+
+    public URI getPrecondition() {
+        return precondition;
+    }
+
+    public void setPrecondition(URI precondition) {
+        this.precondition = precondition;
+    }
+
+    public URI getOutput() {
+        return output;
+    }
+
+    public void setOutput(URI output) {
+        this.output = output;
+    }
+
+    public List<URI> getTestProcess() {
+        return testProcess;
+    }
+
+    public void setTestProcess(List<URI> testProcess) {
+        this.testProcess = testProcess;
+    }
+
+    public URI getTestAssertion() {
+        return testAssertion;
+    }
+
+    public void setTestAssertion(URI testAssertion) {
+        this.testAssertion = testAssertion;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/marmotta/blob/0cb20f61/platform/marmotta-ldp/src/test/resources/testsuite/LDP-Test-Cases-Custom-20140318.ttl
----------------------------------------------------------------------
diff --git a/platform/marmotta-ldp/src/test/resources/testsuite/LDP-Test-Cases-Custom-20140318.ttl
b/platform/marmotta-ldp/src/test/resources/testsuite/LDP-Test-Cases-Custom-20140318.ttl
new file mode 100644
index 0000000..1f621bc
--- /dev/null
+++ b/platform/marmotta-ldp/src/test/resources/testsuite/LDP-Test-Cases-Custom-20140318.ttl
@@ -0,0 +1,63 @@
+@prefix dc: <http://purl.org/dc/terms/> .
+@prefix foaf: <http://xmlns.com/foaf/0.1/> .
+@prefix ht: <http://www.w3.org/2011/http#> .
+@prefix owl: <http://www.w3.org/2002/07/owl#> .
+@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
+@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
+@prefix td: <http://www.w3.org/2006/03/test-description#> .
+@prefix tn: <http://ldp.example.org/NewTestDefinitions#> .
+@prefix : <http://www.w3.org/TR/ldp-test-cases/> .
+
+:TCR1 a td:TestCase;
+         rdfs:label "TC-R1";
+         dc:title "GET on an LDPR";
+         dc:description "Tests making a GET request on an existing LDPR";
+         dc:contributor :RaulGarciaCastro;
+         td:reviewStatus td:unreviewed;
+         rdfs:seeAlso <http://www.w3.org/TR/ldp/>;
+         td:specificationReference [
+             a tn:Excerpt;
+             rdfs:seeAlso <http://www.w3.org/TR/ldp/>;
+             tn:includesText "4.2.8 LDPR server responses MUST use entity tags (either weak
or strong ones) as response ETag header values."
+           ],
+                                [
+            a tn:Excerpt;
+             rdfs:seeAlso <http://www.w3.org/TR/ldp/>;
+             tn:includesText "4.2.10 LDPR servers MUST advertise their LDP support by exposing
a HTTP Link header with a target URI of http://www.w3.org/ns/ldp/Resource, and a link relation
type of type (that is, rel=\"type\") in all responses to requests made to the resource's HTTP
Request-URI. [...]"
+           ],
+                               [
+            a tn:Excerpt;
+             rdfs:seeAlso <http://www.w3.org/TR/ldp/>;
+             tn:includesText "4.3.1 LDPR servers MUST support the HTTP GET Method for LDPRs."
+           ];
+         td:input :TCR1-I1-LDPR-URI;
+         td:precondition "The LDP server contains an LDPR at <LDPR URI>";
+         tn:output :TCR1-O1-Response-1-GET;
+         tn:testProcess (:TCR1-RQ1-GET-LDPR-URI);
+         tn:testAssertion :TCR1-A1-Response-1-GET.
+
+:RaulGarciaCastro a foaf:Person;
+                    rdfs:label "Raúl García-Castro";
+                    owl:sameAs <http://delicias.dia.fi.upm.es/~rgarcia/#me>.
+
+:TCR1-I1-LDPR-URI a tn:TestInput;
+           dc:title "<LDPR URI>";
+           dc:description "The URI of an LDPR".
+
+:TCR1-O1-Response-1-GET a tn:TestOutput;
+            a ht:Response;
+            tn:fromStep :TCR1-RQ1-GET-LDPR-URI;
+            dc:title "<Response 1 GET>";
+            dc:description "The response of the GET request in step 1".
+
+:TCR1-RQ1-GET-LDPR-URI a tn:Step;
+            a ht:Request;
+            dc:description "GET <LDPR URI>";
+            tn:usesInput :TCR1-I1-LDPR-URI.
+
+:TCR1-A1-Response-1-GET a tn:TestAssertion;
+            tn:outputAsserted :TCR1-O1-Response-1-GET;
+            dc:title "GET correct";
+            dc:description """[Status-Line].Status-Code = 2xx
+        [response-header].ETag exists
+        [response-header].Link = ldp:Resource; rel="type" """.


Mime
View raw message