Add remote-doc tests.
authorGregg Kellogg <gregg@kellogg-assoc.com>
Tue, 03 Sep 2013 15:15:08 -0700
changeset 1956 1d8c40b91cfa
parent 1955 836bd7f8ab6f
child 1957 ce304cba36b4
Add remote-doc tests.
test-suite/tests/.htaccess
test-suite/tests/remote-doc-0001-in.jsonld
test-suite/tests/remote-doc-0001-out.jsonld
test-suite/tests/remote-doc-0002-in.json
test-suite/tests/remote-doc-0002-out.jsonld
test-suite/tests/remote-doc-0003-in.jldt
test-suite/tests/remote-doc-0003-out.jsonld
test-suite/tests/remote-doc-0004-in.jldte
test-suite/tests/remote-doc-0009-context.jsonld
test-suite/tests/remote-doc-0009-in.json
test-suite/tests/remote-doc-0009-in.jsonld
test-suite/tests/remote-doc-0009-out.jsonld
test-suite/tests/remote-doc-0010-context.jsonld
test-suite/tests/remote-doc-0010-in.json
test-suite/tests/remote-doc-0010-out.jsonld
test-suite/tests/remote-doc-0011-context.jsonld
test-suite/tests/remote-doc-0011-in.jldt
test-suite/tests/remote-doc-0011-out.jsonld
test-suite/tests/remote-doc-0012-context1.jsonld
test-suite/tests/remote-doc-0012-context2.jsonld
test-suite/tests/remote-doc-0012-in.json
test-suite/tests/remote-doc-manifest.jsonld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-suite/tests/.htaccess	Tue Sep 03 15:15:08 2013 -0700
@@ -0,0 +1,30 @@
+# Special rules for document loader tests
+# Rewrite engine setup
+RewriteEngine On
+RewriteBase /test-suite
+
+# Add directive for test types
+AddType application/jldTest+json .jldt
+AddType application/jldTest .jldte
+
+# Tests 0005-0007, status redirect to 0001
+RewriteRule ^remote-doc-0005-in.jsonld$ remote-doc-0001-in.jsonld [R=301]
+RewriteRule ^remote-doc-0006-in.jsonld$ remote-doc-0001-in.jsonld [R=303]
+RewriteRule ^remote-doc-0007-in.jsonld$ remote-doc-0001-in.jsonld [R=307]
+
+# Tests 0009-0011 Add link header
+<FilesMatch "remote-doc-0009-in.jsonld">
+  Header set Link '<remote-doc-0009-context.jsonld>; rel="http://www.w3.org/ns/json-ld#context"‘
+</FilesMatch>
+<FilesMatch "remote-doc-0010-in.json">
+  Header set Link '<remote-doc-0010-context.jsonld>; rel="http://www.w3.org/ns/json-ld#context"‘
+</FilesMatch>
+<FilesMatch "remote-doc-0011-in.jldt">
+  Header set Link '<remote-doc-0011-context.jsonld>; rel="http://www.w3.org/ns/json-ld#context"‘
+</FilesMatch>
+
+# Test 00012 adds multiple link headers
+<FilesMatch "remote-doc-0012-in.json">
+  Header set Link '<remote-doc-0012-context1.jsonld>; rel="http://www.w3.org/ns/json-ld#context"‘
+  Header append Link '<remote-doc-0012-context2.jsonld>; rel="http://www.w3.org/ns/json-ld#context"‘
+</FilesMatch>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-suite/tests/remote-doc-0001-in.jsonld	Tue Sep 03 15:15:08 2013 -0700
@@ -0,0 +1,7 @@
+{
+  "@context": {
+    "@vocab": "http://example/vocab#"
+  },
+  "@id": "",
+  "term": "object"
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-suite/tests/remote-doc-0001-out.jsonld	Tue Sep 03 15:15:08 2013 -0700
@@ -0,0 +1,4 @@
+[{
+  "@id": "http://json-ld.org/test-suite/tests/document-loader-0001-in.jsonld",
+  "http://example/vocab#term": [{"@value": "object"}]
+}]
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-suite/tests/remote-doc-0002-in.json	Tue Sep 03 15:15:08 2013 -0700
@@ -0,0 +1,7 @@
+{
+  "@context": {
+    "@vocab": "http://example/vocab#"
+  },
+  "@id": "",
+  "term": "object"
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-suite/tests/remote-doc-0002-out.jsonld	Tue Sep 03 15:15:08 2013 -0700
@@ -0,0 +1,4 @@
+[{
+  "@id": "http://json-ld.org/test-suite/tests/document-loader-0002-in.json",
+  "http://example/vocab#term": [{"@value": "object"}]
+}]
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-suite/tests/remote-doc-0003-in.jldt	Tue Sep 03 15:15:08 2013 -0700
@@ -0,0 +1,7 @@
+{
+  "@context": {
+    "@vocab": "http://example/vocab#"
+  },
+  "@id": "",
+  "term": "object"
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-suite/tests/remote-doc-0003-out.jsonld	Tue Sep 03 15:15:08 2013 -0700
@@ -0,0 +1,4 @@
+[{
+  "@id": "http://json-ld.org/test-suite/tests/document-loader-0003-in.jldt",
+  "http://example/vocab#term": [{"@value": "object"}]
+}]
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-suite/tests/remote-doc-0009-in.json	Tue Sep 03 15:15:08 2013 -0700
@@ -0,0 +1,4 @@
+[{
+  "@id": "",
+  "term": "value"
+}]
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-suite/tests/remote-doc-0009-out.jsonld	Tue Sep 03 15:15:08 2013 -0700
@@ -0,0 +1,3 @@
+[{
+  "@id": "http"
+}]
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-suite/tests/remote-doc-0010-context.jsonld	Tue Sep 03 15:15:08 2013 -0700
@@ -0,0 +1,5 @@
+{
+  "@context": {
+    "@vocab": "http://example/vocab#"
+  }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-suite/tests/remote-doc-0010-out.jsonld	Tue Sep 03 15:15:08 2013 -0700
@@ -0,0 +1,4 @@
+[{
+  "@id": "http://json-ld.org/test-suite/tests/document-loader-0002-in.json",
+  "http://example/vocab#term": [{"@value": "object"}]
+}]
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-suite/tests/remote-doc-0011-context.jsonld	Tue Sep 03 15:15:08 2013 -0700
@@ -0,0 +1,5 @@
+{
+  "@context": {
+    "@vocab": "http://example/vocab#"
+  }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-suite/tests/remote-doc-0011-in.jldt	Tue Sep 03 15:15:08 2013 -0700
@@ -0,0 +1,4 @@
+[{
+  "@id": "",
+  "term": "value"
+}]
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-suite/tests/remote-doc-0011-out.jsonld	Tue Sep 03 15:15:08 2013 -0700
@@ -0,0 +1,4 @@
+[{
+  "@id": "http://json-ld.org/test-suite/tests/document-loader-0011-in.json",
+  "http://example/vocab#term": [{"@value": "object"}]
+}]
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-suite/tests/remote-doc-0012-context1.jsonld	Tue Sep 03 15:15:08 2013 -0700
@@ -0,0 +1,5 @@
+{
+  "@context": {
+    "@vocab": "http://example/vocab#"
+  }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-suite/tests/remote-doc-0012-context2.jsonld	Tue Sep 03 15:15:08 2013 -0700
@@ -0,0 +1,5 @@
+{
+  "@context": {
+    "@vocab": "http://example/vocab#"
+  }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-suite/tests/remote-doc-0012-in.json	Tue Sep 03 15:15:08 2013 -0700
@@ -0,0 +1,4 @@
+[{
+  "@id": "",
+  "term": "value"
+}]
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-suite/tests/remote-doc-manifest.jsonld	Tue Sep 03 15:15:08 2013 -0700
@@ -0,0 +1,95 @@
+{
+  "@context": "http://json-ld.org/test-suite/context.jsonld",
+  "@id": "",
+  "@type": "mf:Manifest",
+  "description": "Tests appropriate document loading behavior as defined in the API",
+  "name": "Remote document",
+  "baseIri": "http://json-ld.org/test-suite/tests/",
+  "sequence": [
+    {
+      "@id": "#t0001",
+      "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"],
+      "name": "load JSON-LD document",
+      "purpose": "Document loader loads a JSON-LD document.",
+      "input": "remote-doc-0001-in.jsonld",
+      "expect": "remote-doc-0001-out.jsonld"
+    }, {
+      "@id": "#t0002",
+      "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"],
+      "name": "load JSON document",
+      "purpose": "Document loader loads a JSON document.",
+      "input": "remote-doc-0002-in.json",
+      "expect": "remote-doc-0002-out.jsonld"
+    }, {
+      "@id": "#t0003",
+      "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"],
+      "name": "load JSON document with extension-type",
+      "purpose": "Document loader loads a JSON document having an extension mime-subtype.",
+      "input": "remote-doc-0003-in.jldt",
+      "expect": "remote-doc-0003-out.jsonld"
+    }, {
+      "@id": "#t0004",
+      "@type": ["jld:NegativeEvaluationTest", "jld:ExpandTest"],
+      "name": "loading an unknown type raises loading document failed",
+      "purpose": "Loading a document with a non-JSON mime type raises loading document failed",
+      "input": "remote-doc-0004-in.jldt",
+      "expect": "loading document failed"
+    }, {
+      "@id": "#t0005",
+      "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"],
+      "name": "Load JSON-LD through 301 redirect",
+      "purpose": "Loading a document with a redirect should use the redirected URL as document base",
+      "input": "remote-doc-0005-in.jldt",
+      "expect": "remote-doc-0001-out.jsonld"
+    }, {
+      "@id": "#t0006",
+      "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"],
+      "name": "Load JSON-LD through 303 redirect",
+      "purpose": "Loading a document with a redirect should use the redirected URL as document base",
+      "input": "remote-doc-0006-in.jldt",
+      "expect": "remote-doc-0001-out.jsonld"
+    }, {
+      "@id": "#t0007",
+      "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"],
+      "name": "Load JSON-LD through 307 redirect",
+      "purpose": "Loading a document with a redirect should use the redirected URL as document base",
+      "input": "remote-doc-0007-in.jldt",
+      "expect": "remote-doc-0001-out.jsonld"
+    }, {
+      "@id": "#t0008",
+      "@type": ["jld:NegativeEvaluationTest", "jld:ExpandTest"],
+      "name": "Non-existant file (403)",
+      "purpose": "Loading a non-existant file raises locaing document failed error",
+      "input": "remote-doc-0004-in.jldt",
+      "expect": "loading document failed"
+    }, {
+      "@id": "#t0009",
+      "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"],
+      "name": "load JSON-LD document with link",
+      "purpose": "If a context is specified in a link header, it is not used for JSON-LD.",
+      "input": "remote-doc-0009-in.jsonld",
+      "expect": "remote-doc-0009-out.jsonld"
+    }, {
+      "@id": "#t0010",
+      "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"],
+      "name": "load JSON document with link",
+      "purpose": "If a context is specified in a link header, it is used for JSON.",
+      "input": "remote-doc-0010-in.json",
+      "expect": "remote-doc-0010-out.jsonld"
+    }, {
+      "@id": "#t0011",
+      "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"],
+      "name": "load JSON document with extension-type with link",
+      "purpose": "IfIf a context is specified in a link header, it is used for a JSON extension type.",
+      "input": "remote-doc-0011-in.jldt",
+      "expect": "remote-doc-0011-out.jsonld"
+    }, {
+      "@id": "#t0012",
+      "@type": ["jld:NegativeEvaluationTest", "jld:ExpandTest"],
+      "name": "Multiple link headers",
+      "purpose": "Loading a file when multiple link headers are returned is an error",
+      "input": "remote-doc-0012-in.jldt",
+      "expect": "multiple content link headers"
+    }
+  ]
+}