Add annotation map round-tripping test based on Drupal's content deployment use case
authorMarkus Lanthaler <mark_lanthaler@gmx.net>
Thu, 13 Dec 2012 19:38:57 +0100
changeset 1037 8c4133b9be73
parent 1036 db21172b1b0f
child 1038 0a2bb382731e
Add annotation map round-tripping test based on Drupal's content deployment use case

This addresses #196.
test-suite/tests/compact-0038-context.jsonld
test-suite/tests/compact-0038-in.jsonld
test-suite/tests/compact-0038-out.jsonld
test-suite/tests/compact-manifest.jsonld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-suite/tests/compact-0038-context.jsonld	Thu Dec 13 19:38:57 2012 +0100
@@ -0,0 +1,18 @@
+{
+  "@context": {
+    "site": "http://example.com/",
+    "site-cd": "site:site-schema/content-deployment/",
+    "title": {
+      "@id": "site-cd:node/article/title",
+      "@container": "@annotation"
+    },
+    "body": {
+      "@id": "site-cd:node/article/body",
+      "@container": "@annotation"
+    },
+    "field_tags": {
+      "@id": "site-cd:node/article/field_tags",
+      "@container": "@annotation"
+    }
+  }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-suite/tests/compact-0038-in.jsonld	Thu Dec 13 19:38:57 2012 +0100
@@ -0,0 +1,85 @@
+{
+  "@context": {
+    "site": "http://example.com/",
+    "site-cd": "site:site-schema/content-deployment/",
+    "title": {
+      "@id": "site-cd:node/article/title",
+      "@container": "@annotation"
+    },
+    "body": {
+      "@id": "site-cd:node/article/body",
+      "@container": "@annotation"
+    },
+    "field_tags": {
+      "@id": "site-cd:node/article/field_tags",
+      "@container": "@annotation"
+    }
+  },
+  "@id": "site:node/1",
+  "@type": "site-cd:node/article",
+  "title": {
+    "en": [
+      {
+        "@context": {
+          "value": "site-cd:node/article/title/value"
+        },
+        "@type": "site-cd:field-types/title_field",
+        "value": "This is the English title"
+      }
+    ],
+    "es": [
+      {
+        "@context": {
+          "value": "site-cd:node/article/title/value"
+        },
+        "@type": "site-cd:field-types/title_field",
+        "value": "Este es el t’tulo espa–ol"
+      }
+    ]
+  },
+  "body": {
+    "en": [
+      {
+        "@context": {
+          "value": "site-cd:node/article/body/value",
+          "summary": "site-cd:node/article/body/summary",
+          "format": "site-cd:node/article/body/format"
+        },
+        "@type": "site-cd:field-types/text_with_summary",
+        "value": "This is the English body. There is no Spanish body, so this will be displayed for both the English and Spanish versions.",
+        "summary": "This is the teaser for the body.",
+        "format": "full_html"
+      }
+    ]
+  },
+  "field_tags": {
+    "en": [
+      {
+        "@context": {
+          "uuid": "site-cd:taxonomy/term/uuid"
+        },
+        "@type": "site-cd:taxonomy/term",
+        "@id": "site:taxonomy/term/1",
+        "uuid": "e34b982c-98ac-4862-9b00-fa771a388010"
+      }
+    ],
+    "es": [
+      {
+        "@context": {
+          "uuid": "site-cd:taxonomy/term/uuid"
+        },
+        "@type": "site-cd:taxonomy/term",
+        "@id": "site:taxonomy/term/1",
+        "uuid": "e34b982c-98ac-4862-9b00-fa771a388010"
+      },
+      {
+        "@context": {
+          "uuid": "site-cd:taxonomy/term/uuid"
+        },
+        "@type": "site-cd:taxonomy/term",
+        "@id": "site:taxonomy/term/2",
+        "uuid": "a55b982c-58ac-4862-9b00-aa221a388010"
+      }
+    ]
+  }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-suite/tests/compact-0038-out.jsonld	Thu Dec 13 19:38:57 2012 +0100
@@ -0,0 +1,57 @@
+{
+  "@context": {
+    "site": "http://example.com/",
+    "site-cd": "site:site-schema/content-deployment/",
+    "title": {
+      "@id": "site-cd:node/article/title",
+      "@container": "@annotation"
+    },
+    "body": {
+      "@id": "site-cd:node/article/body",
+      "@container": "@annotation"
+    },
+    "field_tags": {
+      "@id": "site-cd:node/article/field_tags",
+      "@container": "@annotation"
+    }
+  },
+  "@id": "site:node/1",
+  "@type": "site-cd:node/article",
+  "title": {
+    "en": {
+        "@type": "site-cd:field-types/title_field",
+        "title:/value": "This is the English title"
+    },
+    "es": {
+      "@type": "site-cd:field-types/title_field",
+      "title:/value": "Este es el t’tulo espa–ol"
+    }
+  },
+  "body": {
+    "en": {
+      "@type": "site-cd:field-types/text_with_summary",
+      "body:/value": "This is the English body. There is no Spanish body, so this will be displayed for both the English and Spanish versions.",
+      "body:/summary": "This is the teaser for the body.",
+      "body:/format": "full_html"
+    }
+  },
+  "field_tags": {
+    "en": {
+        "@type": "site-cd:taxonomy/term",
+        "@id": "site:taxonomy/term/1",
+        "site-cd:taxonomy/term/uuid": "e34b982c-98ac-4862-9b00-fa771a388010"
+    },
+    "es": [
+      {
+        "@type": "site-cd:taxonomy/term",
+        "@id": "site:taxonomy/term/1",
+        "site-cd:taxonomy/term/uuid": "e34b982c-98ac-4862-9b00-fa771a388010"
+      },
+      {
+        "@type": "site-cd:taxonomy/term",
+        "@id": "site:taxonomy/term/2",
+        "site-cd:taxonomy/term/uuid": "a55b982c-58ac-4862-9b00-aa221a388010"
+      }
+    ]
+  }
+}
--- a/test-suite/tests/compact-manifest.jsonld	Thu Dec 13 19:17:51 2012 +0100
+++ b/test-suite/tests/compact-manifest.jsonld	Thu Dec 13 19:38:57 2012 +0100
@@ -228,5 +228,11 @@
     "input": "compact-0037-in.jsonld",
     "context": "compact-0037-context.jsonld",
     "expect": "compact-0037-out.jsonld"
+  }, {
+    "@type": ["test:TestCase", "jld:CompactTest"],
+    "name": "Annotation map round-tripping (Drupal content deployment)",
+    "input": "compact-0038-in.jsonld",
+    "context": "compact-0038-context.jsonld",
+    "expect": "compact-0038-out.jsonld"
   }]
 }