You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@isis.apache.org by da...@apache.org on 2013/02/20 09:09:10 UTC

git commit: ISIS-233: more on RO spec

Updated Branches:
  refs/heads/dan/ISIS-233-ro ee3241aca -> a83bc29de


ISIS-233: more on RO spec

... working on the version resource.


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

Branch: refs/heads/dan/ISIS-233-ro
Commit: a83bc29de3f34b38c85ac6cc0dd17d0488bf1d91
Parents: ee3241a
Author: Dan Haywood <da...@apache.org>
Authored: Wed Feb 20 08:08:21 2013 +0000
Committer: Dan Haywood <da...@apache.org>
Committed: Wed Feb 20 08:08:21 2013 +0000

----------------------------------------------------------------------
 .../viewer/restfulobjects/applib/util/Parser.java  |    2 +-
 .../applib/version/VersionRepresentation.java      |    6 +
 ...RepresentationTypeTest_getMediaType_lookup.java |    2 +-
 .../restfulobjects/applib/util/ParserTest.java     |    1 +
 .../applib/util/PathNodeTest_equalsHashcode.java   |   26 +--
 .../server/RestfulObjectsApplication.java          |    2 +-
 .../server/resources/VersionReprRenderer.java      |   27 ++--
 ...ceContextTest_ensureCompatibleAcceptHeader.java |   33 +++-
 component/viewer/restfulobjects/tck/pom.xml        |    5 +
 .../isis/viewer/restfulobjects/tck/Dummy.java      |    6 +
 .../user/UserResourceTest_get_accept.java          |    2 -
 .../UserResourceTest_templated_representation.java |   13 --
 .../version/VersionResourceTest_accept.java        |   80 --------
 .../version/VersionResourceTest_get_accept.java    |  111 +++++++++++
 ...rsionResourceTest_representationAndHeaders.java |  150 ---------------
 ...rsionResourceTest_templated_representation.java |  125 ++++++++++++
 ...sionResourceTest_templated_responseHeaders.java |   82 ++++++++
 17 files changed, 387 insertions(+), 286 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/isis/blob/a83bc29d/component/viewer/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/util/Parser.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/util/Parser.java b/component/viewer/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/util/Parser.java
index 99503ad..706de82 100644
--- a/component/viewer/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/util/Parser.java
+++ b/component/viewer/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/util/Parser.java
@@ -236,7 +236,7 @@ public abstract class Parser<T> {
                 if (str == null) {
                     return Collections.emptyList();
                 }
-                return PathNode.split(str);
+                return Lists.newArrayList(Splitter.on(",").split(str));
             }
 
             @Override

http://git-wip-us.apache.org/repos/asf/isis/blob/a83bc29d/component/viewer/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/version/VersionRepresentation.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/version/VersionRepresentation.java b/component/viewer/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/version/VersionRepresentation.java
index 350abf3..a0f4792 100644
--- a/component/viewer/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/version/VersionRepresentation.java
+++ b/component/viewer/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/version/VersionRepresentation.java
@@ -19,6 +19,8 @@
 package org.apache.isis.viewer.restfulobjects.applib.version;
 
 import org.apache.isis.viewer.restfulobjects.applib.JsonRepresentation;
+import org.apache.isis.viewer.restfulobjects.applib.LinkRepresentation;
+import org.apache.isis.viewer.restfulobjects.applib.Rel;
 import org.apache.isis.viewer.restfulobjects.applib.domainobjects.DomainRepresentation;
 import org.codehaus.jackson.JsonNode;
 
@@ -28,6 +30,10 @@ public class VersionRepresentation extends DomainRepresentation {
         super(jsonNode);
     }
 
+    public LinkRepresentation getUp() {
+        return getLinkWithRel(Rel.UP);
+    }
+
     public JsonRepresentation getOptionalCapabilities() {
         return getMap("optionalCapabilities");
     }

http://git-wip-us.apache.org/repos/asf/isis/blob/a83bc29d/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/RepresentationTypeTest_getMediaType_lookup.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/RepresentationTypeTest_getMediaType_lookup.java b/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/RepresentationTypeTest_getMediaType_lookup.java
index bec0243..ae9aa2a 100644
--- a/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/RepresentationTypeTest_getMediaType_lookup.java
+++ b/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/RepresentationTypeTest_getMediaType_lookup.java
@@ -51,7 +51,7 @@ public class RepresentationTypeTest_getMediaType_lookup {
 
     @Test
     public void getMediaTypeProfile() {
-        assertThat(RepresentationType.VERSION.getMediaTypeProfile(), is("urn:org.restfulobjects/version"));
+        assertThat(RepresentationType.VERSION.getMediaTypeProfile(), is("urn:org.restfulobjects:repr-types/version"));
         assertThat(RepresentationType.GENERIC.getMediaTypeProfile(), is(nullValue()));
     }
 }

http://git-wip-us.apache.org/repos/asf/isis/blob/a83bc29d/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/util/ParserTest.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/util/ParserTest.java b/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/util/ParserTest.java
index 20e98d2..36bd0ed 100644
--- a/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/util/ParserTest.java
+++ b/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/util/ParserTest.java
@@ -34,6 +34,7 @@ import org.apache.isis.viewer.restfulobjects.applib.RepresentationType;
 import org.apache.isis.viewer.restfulobjects.applib.RestfulMediaType;
 import org.junit.Test;
 
+import com.google.common.collect.Lists;
 import com.google.common.net.MediaType;
 
 public class ParserTest {

http://git-wip-us.apache.org/repos/asf/isis/blob/a83bc29d/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/util/PathNodeTest_equalsHashcode.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/util/PathNodeTest_equalsHashcode.java b/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/util/PathNodeTest_equalsHashcode.java
index 9af1f28..b181a76 100644
--- a/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/util/PathNodeTest_equalsHashcode.java
+++ b/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/util/PathNodeTest_equalsHashcode.java
@@ -33,20 +33,6 @@ public class PathNodeTest_equalsHashcode {
     }
 
     @Test
-    public void oneCriterium() throws Exception {
-        final PathNode node = PathNode.parse("a[b=c]");
-        final PathNode node2 = PathNode.parse("a");
-        assertFalse(node.equals(node2));
-    }
-
-    @Test
-    public void moreThanOneCriterium() throws Exception {
-        final PathNode node = PathNode.parse("a[b=c d=e]");
-        final PathNode node2 = PathNode.parse("a");
-        assertFalse(node.equals(node2));
-    }
-
-    @Test
     public void sameCriterium() throws Exception {
         final PathNode node = PathNode.parse("a[b=c]");
         final PathNode node2 = PathNode.parse("a[b=c]");
@@ -68,9 +54,17 @@ public class PathNodeTest_equalsHashcode {
     }
 
     @Test
-    public void notEqualCriterium() throws Exception {
+    public void criteriumIgnored() throws Exception {
         final PathNode node = PathNode.parse("a[b=c]");
         final PathNode node2 = PathNode.parse("a[b=d]");
-        assertFalse(node.equals(node2));
+        assertEquals(node, node2);
+    }
+
+    @Test
+    public void criteriumIgnoredHereAlso() throws Exception {
+        final PathNode node = PathNode.parse("a[b=c d=e]");
+        final PathNode node2 = PathNode.parse("a");
+        assertEquals(node, node2);
     }
+
 }

http://git-wip-us.apache.org/repos/asf/isis/blob/a83bc29d/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/RestfulObjectsApplication.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/RestfulObjectsApplication.java b/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/RestfulObjectsApplication.java
index 8cbbda1..2724886 100644
--- a/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/RestfulObjectsApplication.java
+++ b/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/RestfulObjectsApplication.java
@@ -27,7 +27,7 @@ import org.apache.isis.viewer.restfulobjects.server.resources.VersionResourceSer
 
 public class RestfulObjectsApplication extends AbstractJaxRsApplication {
 
-    public static final String SPEC_VERSION = "0.52";
+    public static final String SPEC_VERSION = "1.0.0";
 
     public RestfulObjectsApplication() {
         addClass(HomePageResourceServerside.class);

http://git-wip-us.apache.org/repos/asf/isis/blob/a83bc29d/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/resources/VersionReprRenderer.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/resources/VersionReprRenderer.java b/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/resources/VersionReprRenderer.java
index 2849e9b..f917698 100644
--- a/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/resources/VersionReprRenderer.java
+++ b/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/resources/VersionReprRenderer.java
@@ -18,7 +18,9 @@
  */
 package org.apache.isis.viewer.restfulobjects.server.resources;
 
+import java.net.URL;
 import java.nio.charset.Charset;
+import java.util.Properties;
 
 import org.apache.isis.viewer.restfulobjects.applib.JsonRepresentation;
 import org.apache.isis.viewer.restfulobjects.applib.Rel;
@@ -32,7 +34,7 @@ import com.google.common.io.Resources;
 
 public class VersionReprRenderer extends ReprRendererAbstract<VersionReprRenderer, Void> {
 
-    private static final String META_INF_POM_PROPERTIES = "/META-INF/maven/org.apache.isis.viewer/restfulobjects-viewer/pom.properties";
+    private static final String META_INF_POM_PROPERTIES = "/META-INF/maven/org.apache.isis.viewer/isis-viewer-restfulobjects-server/pom.properties";
 
     VersionReprRenderer(final RendererContext resourceContext, final LinkFollowSpecs linkFollower, final JsonRepresentation representation) {
         super(resourceContext, linkFollower, RepresentationType.VERSION, representation);
@@ -47,7 +49,8 @@ public class VersionReprRenderer extends ReprRendererAbstract<VersionReprRendere
     public JsonRepresentation render() {
 
         if (includesSelf) {
-            withLink(Rel.SELF, "version/");
+            withLink(Rel.SELF, "version");
+            withLink(Rel.UP, "");
         }
 
         representation.mapPut("specVersion", RestfulObjectsApplication.SPEC_VERSION);
@@ -61,7 +64,10 @@ public class VersionReprRenderer extends ReprRendererAbstract<VersionReprRendere
 
     private static String versionFromManifest() {
         try {
-            return Resources.toString(Resources.getResource(META_INF_POM_PROPERTIES), Charset.defaultCharset());
+            URL resource = Resources.getResource(META_INF_POM_PROPERTIES);
+            Properties p = new Properties();
+            p.load(Resources.newReaderSupplier(resource, Charset.defaultCharset()).getInput());
+            return p.getProperty("version");
         } catch (final Exception ex) {
             return "UNKNOWN";
         }
@@ -70,16 +76,11 @@ public class VersionReprRenderer extends ReprRendererAbstract<VersionReprRendere
     private void putOptionalCapabilities() {
         final JsonRepresentation optionalCapabilities = JsonRepresentation.newMap();
 
-        optionalCapabilities.mapPut("concurrencyChecking", "no");
-        optionalCapabilities.mapPut("transientObjects", "yes");
-        optionalCapabilities.mapPut("deleteObjects", "no");
-        optionalCapabilities.mapPut("simpleArguments", "no");
-        optionalCapabilities.mapPut("partialArguments", "no");
-        optionalCapabilities.mapPut("followLinks", "yes");
-        optionalCapabilities.mapPut("validateOnly", "no");
-        optionalCapabilities.mapPut("pagination", "no");
-        optionalCapabilities.mapPut("sorting", "no");
-        optionalCapabilities.mapPut("domainModel", "rich");
+        optionalCapabilities.mapPut("blobsClobs", "yes");
+        optionalCapabilities.mapPut("deleteObjects", "yes");
+        optionalCapabilities.mapPut("domainModel", "formal");
+        optionalCapabilities.mapPut("validateOnly", "yes");
+        optionalCapabilities.mapPut("protoPersistentObjects", "yes");
 
         representation.mapPut("optionalCapabilities", optionalCapabilities);
     }

http://git-wip-us.apache.org/repos/asf/isis/blob/a83bc29d/component/viewer/restfulobjects/server/src/test/java/org/apache/isis/viewer/restfulobjects/server/ResourceContextTest_ensureCompatibleAcceptHeader.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/server/src/test/java/org/apache/isis/viewer/restfulobjects/server/ResourceContextTest_ensureCompatibleAcceptHeader.java b/component/viewer/restfulobjects/server/src/test/java/org/apache/isis/viewer/restfulobjects/server/ResourceContextTest_ensureCompatibleAcceptHeader.java
index ba8e248..cd27f5a 100644
--- a/component/viewer/restfulobjects/server/src/test/java/org/apache/isis/viewer/restfulobjects/server/ResourceContextTest_ensureCompatibleAcceptHeader.java
+++ b/component/viewer/restfulobjects/server/src/test/java/org/apache/isis/viewer/restfulobjects/server/ResourceContextTest_ensureCompatibleAcceptHeader.java
@@ -18,6 +18,9 @@
  */
 package org.apache.isis.viewer.restfulobjects.server;
 
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
+
 import java.util.Arrays;
 import java.util.List;
 
@@ -26,7 +29,7 @@ import javax.ws.rs.core.HttpHeaders;
 import javax.ws.rs.core.MediaType;
 
 import org.apache.isis.viewer.restfulobjects.applib.RepresentationType;
-import org.apache.isis.viewer.restfulobjects.rendering.ReprRendererException;
+import org.apache.isis.viewer.restfulobjects.applib.client.RestfulResponse.HttpStatusCode;
 import org.jmock.Expectations;
 import org.jmock.Mockery;
 import org.jmock.integration.junit4.JUnit4Mockery;
@@ -84,32 +87,44 @@ public class ResourceContextTest_ensureCompatibleAcceptHeader {
         instantiateResourceContext(representationType);
     }
 
-    @Test(expected = ReprRendererException.class)
+    @Test
     public void nonMatching() throws Exception {
         final RepresentationType representationType = RepresentationType.HOME_PAGE;
         givenHttpHeadersGetAcceptableMediaTypesReturns(Arrays.<MediaType> asList(MediaType.APPLICATION_ATOM_XML_TYPE));
 
-        instantiateResourceContext(representationType);
+        try {
+            instantiateResourceContext(representationType);
+        } catch(RestfulObjectsApplicationException ex ) {
+            assertThat(ex.getHttpStatusCode(), is(HttpStatusCode.NOT_ACCEPTABLE));
+        }
     }
 
-    @Test(expected = RestfulObjectsApplicationException.class)
+    @Test
     public void nonMatchingProfile() throws Exception {
         final RepresentationType representationType = RepresentationType.HOME_PAGE;
         givenHttpHeadersGetAcceptableMediaTypesReturns(Arrays.<MediaType> asList(RepresentationType.USER.getMediaType()));
 
-        instantiateResourceContext(representationType);
+        try {
+            instantiateResourceContext(representationType);
+        } catch(RestfulObjectsApplicationException ex ) {
+            assertThat(ex.getHttpStatusCode(), is(HttpStatusCode.NOT_ACCEPTABLE));
+        }
     }
 
-    @Test(expected = RestfulObjectsApplicationException.class)
+    @Test
     public void nonMatchingProfile_ignoreGeneric() throws Exception {
         final RepresentationType representationType = RepresentationType.HOME_PAGE;
         givenHttpHeadersGetAcceptableMediaTypesReturns(Arrays.<MediaType> asList(RepresentationType.USER.getMediaType(), MediaType.APPLICATION_JSON_TYPE));
 
-        instantiateResourceContext(representationType);
+        try {
+            instantiateResourceContext(representationType);
+        } catch(RestfulObjectsApplicationException ex ) {
+            assertThat(ex.getHttpStatusCode(), is(HttpStatusCode.NOT_ACCEPTABLE));
+        }
     }
 
-    @Test(expected = ReprRendererException.class)
-    public void emptyList() throws Exception {
+    @Test
+    public void emptyList_isOK() throws Exception {
         final RepresentationType representationType = RepresentationType.HOME_PAGE;
         givenHttpHeadersGetAcceptableMediaTypesReturns(Arrays.<MediaType> asList());
 

http://git-wip-us.apache.org/repos/asf/isis/blob/a83bc29d/component/viewer/restfulobjects/tck/pom.xml
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/pom.xml b/component/viewer/restfulobjects/tck/pom.xml
index 2a8f76a..9d162d2 100644
--- a/component/viewer/restfulobjects/tck/pom.xml
+++ b/component/viewer/restfulobjects/tck/pom.xml
@@ -123,5 +123,10 @@
             <scope>test</scope>
         </dependency>
 
+        <dependency>
+            <groupId>cglib</groupId>
+            <artifactId>cglib-nodep</artifactId>
+        </dependency>
+
 	</dependencies>
 </project>

http://git-wip-us.apache.org/repos/asf/isis/blob/a83bc29d/component/viewer/restfulobjects/tck/src/main/java/org/apache/isis/viewer/restfulobjects/tck/Dummy.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/main/java/org/apache/isis/viewer/restfulobjects/tck/Dummy.java b/component/viewer/restfulobjects/tck/src/main/java/org/apache/isis/viewer/restfulobjects/tck/Dummy.java
new file mode 100644
index 0000000..7c27933
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/main/java/org/apache/isis/viewer/restfulobjects/tck/Dummy.java
@@ -0,0 +1,6 @@
+package org.apache.isis.viewer.restfulobjects.tck;
+
+
+public class Dummy {
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/a83bc29d/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/user/UserResourceTest_get_accept.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/user/UserResourceTest_get_accept.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/user/UserResourceTest_get_accept.java
index 7b3677d..4246313 100644
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/user/UserResourceTest_get_accept.java
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/user/UserResourceTest_get_accept.java
@@ -104,6 +104,4 @@ public class UserResourceTest_get_accept {
         // then
         assertThat(restfulResp.getStatus(), is(HttpStatusCode.NOT_ACCEPTABLE));
     }
-
-
 }

http://git-wip-us.apache.org/repos/asf/isis/blob/a83bc29d/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/user/UserResourceTest_templated_representation.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/user/UserResourceTest_templated_representation.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/user/UserResourceTest_templated_representation.java
index de494de..da95307 100644
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/user/UserResourceTest_templated_representation.java
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/user/UserResourceTest_templated_representation.java
@@ -19,12 +19,7 @@
 package org.apache.isis.viewer.restfulobjects.tck.resources.user;
 
 import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.assertThat;
-import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.hasMaxAge;
-import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.hasParameter;
-import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.hasSubType;
-import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.hasType;
 import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.isArray;
-import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.isFollowableLinkToSelf;
 import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.isLink;
 import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.isMap;
 import static org.hamcrest.CoreMatchers.endsWith;
@@ -33,10 +28,6 @@ import static org.hamcrest.CoreMatchers.not;
 import static org.hamcrest.CoreMatchers.nullValue;
 import static org.junit.Assert.assertThat;
 
-import java.io.IOException;
-
-import javax.ws.rs.core.CacheControl;
-import javax.ws.rs.core.MediaType;
 import javax.ws.rs.core.Response;
 import javax.ws.rs.core.Response.Status.Family;
 
@@ -45,14 +36,10 @@ import org.apache.isis.viewer.restfulobjects.applib.RepresentationType;
 import org.apache.isis.viewer.restfulobjects.applib.RestfulHttpMethod;
 import org.apache.isis.viewer.restfulobjects.applib.client.RestfulClient;
 import org.apache.isis.viewer.restfulobjects.applib.client.RestfulResponse;
-import org.apache.isis.viewer.restfulobjects.applib.client.RestfulResponse.Header;
 import org.apache.isis.viewer.restfulobjects.applib.client.RestfulResponse.HttpStatusCode;
-import org.apache.isis.viewer.restfulobjects.applib.homepage.HomePageRepresentation;
 import org.apache.isis.viewer.restfulobjects.applib.user.UserRepresentation;
 import org.apache.isis.viewer.restfulobjects.applib.user.UserResource;
 import org.apache.isis.viewer.restfulobjects.tck.IsisWebServerRule;
-import org.codehaus.jackson.JsonParseException;
-import org.codehaus.jackson.map.JsonMappingException;
 import org.junit.Before;
 import org.junit.Rule;
 import org.junit.Test;

http://git-wip-us.apache.org/repos/asf/isis/blob/a83bc29d/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/version/VersionResourceTest_accept.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/version/VersionResourceTest_accept.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/version/VersionResourceTest_accept.java
deleted file mode 100644
index 10d5b4c..0000000
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/version/VersionResourceTest_accept.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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 org.apache.isis.viewer.restfulobjects.tck.resources.version;
-
-import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertThat;
-
-import javax.ws.rs.core.MediaType;
-
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-
-import org.apache.isis.core.webserver.WebServer;
-import org.apache.isis.viewer.restfulobjects.applib.RepresentationType;
-import org.apache.isis.viewer.restfulobjects.applib.RestfulHttpMethod;
-import org.apache.isis.viewer.restfulobjects.applib.client.RestfulClient;
-import org.apache.isis.viewer.restfulobjects.applib.client.RestfulRequest;
-import org.apache.isis.viewer.restfulobjects.applib.client.RestfulResponse;
-import org.apache.isis.viewer.restfulobjects.applib.client.RestfulResponse.HttpStatusCode;
-import org.apache.isis.viewer.restfulobjects.applib.version.VersionRepresentation;
-import org.apache.isis.viewer.restfulobjects.tck.IsisWebServerRule;
-
-public class VersionResourceTest_accept {
-
-    @Rule
-    public IsisWebServerRule webServerRule = new IsisWebServerRule();
-
-    private RestfulClient client;
-
-    @Before
-    public void setUp() throws Exception {
-        final WebServer webServer = webServerRule.getWebServer();
-        client = new RestfulClient(webServer.getBase());
-    }
-
-    @Test
-    public void applicationJson() throws Exception {
-
-        final RestfulRequest request = client.createRequest(RestfulHttpMethod.GET, "version").withHeader(RestfulRequest.Header.ACCEPT, MediaType.APPLICATION_JSON_TYPE);
-        final RestfulResponse<VersionRepresentation> restfulResponse = request.executeT();
-
-        assertThat(restfulResponse.getStatus(), is(HttpStatusCode.OK));
-    }
-
-    @Test
-    public void applicationJson_profileVersion() throws Exception {
-
-        final RestfulRequest request = client.createRequest(RestfulHttpMethod.GET, "version").withHeader(RestfulRequest.Header.ACCEPT, RepresentationType.VERSION.getMediaType());
-        final RestfulResponse<VersionRepresentation> restfulResponse = request.executeT();
-
-        assertThat(restfulResponse.getStatus(), is(HttpStatusCode.OK));
-    }
-
-    @Test
-    public void applicationJson_invalid() throws Exception {
-
-        final RestfulRequest request = client.createRequest(RestfulHttpMethod.GET, "/").withHeader(RestfulRequest.Header.ACCEPT, RepresentationType.USER.getMediaType());
-        final RestfulResponse<VersionRepresentation> restfulResponse = request.executeT();
-
-        assertThat(restfulResponse.getStatus(), is(HttpStatusCode.NOT_ACCEPTABLE));
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/a83bc29d/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/version/VersionResourceTest_get_accept.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/version/VersionResourceTest_get_accept.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/version/VersionResourceTest_get_accept.java
new file mode 100644
index 0000000..25347ee
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/version/VersionResourceTest_get_accept.java
@@ -0,0 +1,111 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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 org.apache.isis.viewer.restfulobjects.tck.resources.version;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
+
+import javax.ws.rs.core.MediaType;
+
+import org.jboss.resteasy.client.ClientRequest;
+import org.jboss.resteasy.client.ClientResponse;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+
+import org.apache.isis.core.webserver.WebServer;
+import org.apache.isis.viewer.restfulobjects.applib.JsonRepresentation;
+import org.apache.isis.viewer.restfulobjects.applib.RepresentationType;
+import org.apache.isis.viewer.restfulobjects.applib.RestfulHttpMethod;
+import org.apache.isis.viewer.restfulobjects.applib.client.RestfulClient;
+import org.apache.isis.viewer.restfulobjects.applib.client.RestfulRequest;
+import org.apache.isis.viewer.restfulobjects.applib.client.RestfulResponse;
+import org.apache.isis.viewer.restfulobjects.applib.client.RestfulResponse.HttpStatusCode;
+import org.apache.isis.viewer.restfulobjects.applib.user.UserRepresentation;
+import org.apache.isis.viewer.restfulobjects.applib.version.VersionRepresentation;
+import org.apache.isis.viewer.restfulobjects.tck.IsisWebServerRule;
+
+public class VersionResourceTest_get_accept {
+
+    @Rule
+    public IsisWebServerRule webServerRule = new IsisWebServerRule();
+
+    private RestfulClient client;
+
+    @Before
+    public void setUp() throws Exception {
+        client = webServerRule.getClient();
+    }
+
+    @Test
+    public void applicationJson_noProfile_returns200() throws Exception {
+
+        final RestfulRequest request = client.createRequest(RestfulHttpMethod.GET, "version").withHeader(RestfulRequest.Header.ACCEPT, MediaType.APPLICATION_JSON_TYPE);
+        final RestfulResponse<VersionRepresentation> restfulResponse = request.executeT();
+
+        assertThat(restfulResponse.getStatus(), is(HttpStatusCode.OK));
+        assertThat(restfulResponse.getHeader(RestfulResponse.Header.CONTENT_TYPE), is(RepresentationType.VERSION.getMediaType()));
+    }
+
+
+    @Test
+    public void applicationJson_profileVersion_returns200() throws Exception {
+
+        final RestfulRequest request = client.createRequest(RestfulHttpMethod.GET, "version").withHeader(RestfulRequest.Header.ACCEPT, RepresentationType.VERSION.getMediaType());
+        final RestfulResponse<VersionRepresentation> restfulResponse = request.executeT();
+
+        assertThat(restfulResponse.getStatus(), is(HttpStatusCode.OK));
+    }
+
+    @Test
+    public void missingHeader_returns200() throws Exception {
+        // given
+        final RestfulRequest restfulReq = client.createRequest(RestfulHttpMethod.GET, "version");
+
+        // when
+        final RestfulResponse<VersionRepresentation> restfulResp = restfulReq.executeT();
+
+        // then
+        assertThat(restfulResp.getStatus(), is(HttpStatusCode.OK));
+    }
+
+    @Test
+    public void applicationJson_profileIncorrect_returns406() throws Exception {
+
+        final RestfulRequest request = client.createRequest(RestfulHttpMethod.GET, "version").withHeader(RestfulRequest.Header.ACCEPT, RepresentationType.USER.getMediaType());
+        final RestfulResponse<VersionRepresentation> restfulResponse = request.executeT();
+
+        assertThat(restfulResponse.getStatus(), is(HttpStatusCode.NOT_ACCEPTABLE));
+    }
+
+    @Test
+    public void incorrectMediaType_returnsNotAcceptable() throws Exception {
+
+        // given
+        final ClientRequest clientRequest = client.getClientRequestFactory().createRelativeRequest("version");
+        clientRequest.accept(MediaType.APPLICATION_ATOM_XML_TYPE);
+
+        // when
+        final ClientResponse<?> resp = clientRequest.get();
+        final RestfulResponse<JsonRepresentation> restfulResp = RestfulResponse.of(resp);
+        
+        // then
+        assertThat(restfulResp.getStatus(), is(HttpStatusCode.NOT_ACCEPTABLE));
+    }
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/a83bc29d/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/version/VersionResourceTest_representationAndHeaders.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/version/VersionResourceTest_representationAndHeaders.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/version/VersionResourceTest_representationAndHeaders.java
deleted file mode 100644
index fe6ce0b..0000000
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/version/VersionResourceTest_representationAndHeaders.java
+++ /dev/null
@@ -1,150 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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 org.apache.isis.viewer.restfulobjects.tck.resources.version;
-
-import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.assertThat;
-import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.hasMaxAge;
-import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.hasParameter;
-import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.hasSubType;
-import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.hasType;
-import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.isArray;
-import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.isFollowableLinkToSelf;
-import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.isLink;
-import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.isMap;
-import static org.hamcrest.CoreMatchers.is;
-import static org.hamcrest.CoreMatchers.not;
-import static org.hamcrest.CoreMatchers.nullValue;
-import static org.junit.Assert.assertThat;
-
-import java.io.IOException;
-
-import javax.ws.rs.core.CacheControl;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.Response;
-import javax.ws.rs.core.Response.Status.Family;
-
-import org.apache.isis.core.webserver.WebServer;
-import org.apache.isis.viewer.restfulobjects.applib.JsonRepresentation;
-import org.apache.isis.viewer.restfulobjects.applib.RepresentationType;
-import org.apache.isis.viewer.restfulobjects.applib.client.RestfulClient;
-import org.apache.isis.viewer.restfulobjects.applib.client.RestfulResponse;
-import org.apache.isis.viewer.restfulobjects.applib.client.RestfulResponse.Header;
-import org.apache.isis.viewer.restfulobjects.applib.client.RestfulResponse.HttpStatusCode;
-import org.apache.isis.viewer.restfulobjects.applib.RestfulHttpMethod;
-import org.apache.isis.viewer.restfulobjects.applib.version.VersionRepresentation;
-import org.apache.isis.viewer.restfulobjects.applib.version.VersionResource;
-import org.apache.isis.viewer.restfulobjects.tck.IsisWebServerRule;
-import org.codehaus.jackson.JsonParseException;
-import org.codehaus.jackson.map.JsonMappingException;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-
-public class VersionResourceTest_representationAndHeaders {
-
-    @Rule
-    public IsisWebServerRule webServerRule = new IsisWebServerRule();
-
-    private RestfulClient client;
-    private VersionResource resource;
-
-    @Before
-    public void setUp() throws Exception {
-        final WebServer webServer = webServerRule.getWebServer();
-        client = new RestfulClient(webServer.getBase());
-
-        resource = client.getVersionResource();
-    }
-
-    @Test
-    public void representation() throws Exception {
-
-        // given
-        final Response servicesResp = resource.version();
-
-        // when
-        final RestfulResponse<VersionRepresentation> restfulResponse = RestfulResponse.ofT(servicesResp);
-        assertThat(restfulResponse.getStatus().getFamily(), is(Family.SUCCESSFUL));
-
-        // then
-        assertThat(restfulResponse.getStatus(), is(HttpStatusCode.OK));
-
-        final VersionRepresentation repr = restfulResponse.getEntity();
-        assertThat(repr, is(not(nullValue())));
-        assertThat(repr, isMap());
-
-        assertThat(repr.getSelf(), isLink().httpMethod(RestfulHttpMethod.GET));
-
-        assertThat(repr.getString("specVersion"), is("0.52"));
-        assertThat(repr.getString("implVersion"), is(not(nullValue())));
-
-        final JsonRepresentation optionalCapbilitiesRepr = repr.getOptionalCapabilities();
-        assertThat(optionalCapbilitiesRepr, isMap());
-
-        assertThat(optionalCapbilitiesRepr.getString("concurrencyChecking"), is("no"));
-        assertThat(optionalCapbilitiesRepr.getString("transientObjects"), is("yes"));
-        assertThat(optionalCapbilitiesRepr.getString("deleteObjects"), is("no"));
-        assertThat(optionalCapbilitiesRepr.getString("simpleArguments"), is("no"));
-        assertThat(optionalCapbilitiesRepr.getString("partialArguments"), is("no"));
-        assertThat(optionalCapbilitiesRepr.getString("followLinks"), is("yes"));
-        assertThat(optionalCapbilitiesRepr.getString("validateOnly"), is("no"));
-        assertThat(optionalCapbilitiesRepr.getString("pagination"), is("no"));
-        assertThat(optionalCapbilitiesRepr.getString("sorting"), is("no"));
-        assertThat(optionalCapbilitiesRepr.getString("domainModel"), is("rich"));
-
-        assertThat(repr.getLinks(), isArray());
-        assertThat(repr.getExtensions(), is(not(nullValue())));
-    }
-
-    @Test
-    public void headers() throws Exception {
-        // given
-        final Response resp = resource.version();
-
-        // when
-        final RestfulResponse<VersionRepresentation> restfulResponse = RestfulResponse.ofT(resp);
-
-        // then
-        final MediaType contentType = restfulResponse.getHeader(Header.CONTENT_TYPE);
-        assertThat(contentType, hasType("application"));
-        assertThat(contentType, hasSubType("json"));
-        assertThat(contentType, hasParameter("profile", "urn:org.restfulobjects:repr-types/version"));
-        assertThat(contentType, is(RepresentationType.VERSION.getMediaType()));
-
-        // then
-        final CacheControl cacheControl = restfulResponse.getHeader(Header.CACHE_CONTROL);
-        assertThat(cacheControl, hasMaxAge(24 * 60 * 60));
-        assertThat(cacheControl.getMaxAge(), is(24 * 60 * 60));
-    }
-
-    @Test
-    public void selfIsFollowable() throws Exception {
-        // given
-        final VersionRepresentation repr = givenRepresentation();
-
-        // when, then
-        assertThat(repr, isFollowableLinkToSelf(client));
-    }
-
-    private VersionRepresentation givenRepresentation() throws JsonParseException, JsonMappingException, IOException {
-        final RestfulResponse<VersionRepresentation> jsonResp = RestfulResponse.ofT(resource.version());
-        return jsonResp.getEntity();
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/a83bc29d/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/version/VersionResourceTest_templated_representation.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/version/VersionResourceTest_templated_representation.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/version/VersionResourceTest_templated_representation.java
new file mode 100644
index 0000000..cd91d7a
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/version/VersionResourceTest_templated_representation.java
@@ -0,0 +1,125 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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 org.apache.isis.viewer.restfulobjects.tck.resources.version;
+
+import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.assertThat;
+import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.hasMaxAge;
+import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.hasParameter;
+import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.hasSubType;
+import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.hasType;
+import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.isArray;
+import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.isFollowableLinkToSelf;
+import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.isLink;
+import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.isMap;
+import static org.hamcrest.CoreMatchers.endsWith;
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.CoreMatchers.not;
+import static org.hamcrest.CoreMatchers.nullValue;
+import static org.junit.Assert.assertThat;
+
+import java.io.IOException;
+
+import javax.ws.rs.core.CacheControl;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+import javax.ws.rs.core.Response.Status.Family;
+
+import org.apache.isis.core.webserver.WebServer;
+import org.apache.isis.viewer.restfulobjects.applib.JsonRepresentation;
+import org.apache.isis.viewer.restfulobjects.applib.Rel;
+import org.apache.isis.viewer.restfulobjects.applib.RepresentationType;
+import org.apache.isis.viewer.restfulobjects.applib.client.RestfulClient;
+import org.apache.isis.viewer.restfulobjects.applib.client.RestfulResponse;
+import org.apache.isis.viewer.restfulobjects.applib.client.RestfulResponse.Header;
+import org.apache.isis.viewer.restfulobjects.applib.client.RestfulResponse.HttpStatusCode;
+import org.apache.isis.viewer.restfulobjects.applib.RestfulHttpMethod;
+import org.apache.isis.viewer.restfulobjects.applib.version.VersionRepresentation;
+import org.apache.isis.viewer.restfulobjects.applib.version.VersionResource;
+import org.apache.isis.viewer.restfulobjects.tck.IsisWebServerRule;
+import org.codehaus.jackson.JsonParseException;
+import org.codehaus.jackson.map.JsonMappingException;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+
+public class VersionResourceTest_templated_representation {
+
+    @Rule
+    public IsisWebServerRule webServerRule = new IsisWebServerRule();
+
+    private RestfulClient client;
+    private VersionResource resource;
+
+    @Before
+    public void setUp() throws Exception {
+        final WebServer webServer = webServerRule.getWebServer();
+        client = new RestfulClient(webServer.getBase());
+
+        resource = client.getVersionResource();
+    }
+
+    @Test
+    public void representation() throws Exception {
+
+        // given
+        final Response servicesResp = resource.version();
+
+        // when
+        final RestfulResponse<VersionRepresentation> restfulResponse = RestfulResponse.ofT(servicesResp);
+        assertThat(restfulResponse.getStatus().getFamily(), is(Family.SUCCESSFUL));
+
+        // then
+        assertThat(restfulResponse.getStatus(), is(HttpStatusCode.OK));
+
+        final VersionRepresentation repr = restfulResponse.getEntity();
+        assertThat(repr, is(not(nullValue())));
+        assertThat(repr, isMap());
+
+        assertThat(repr.getSelf(), isLink(client)
+                                    .rel(Rel.SELF)
+                                    .href(endsWith(":39393/version"))
+                                    .httpMethod(RestfulHttpMethod.GET)
+                                    .type(RepresentationType.VERSION.getMediaType())
+                                    .returning(HttpStatusCode.OK)
+                                    );
+        assertThat(repr.getUp(), isLink(client)
+                                    .rel(Rel.UP)
+                                    .href(endsWith(":39393/"))
+                                    .httpMethod(RestfulHttpMethod.GET)
+                                    .type(RepresentationType.HOME_PAGE.getMediaType())
+                                    .returning(HttpStatusCode.OK)
+                                    );
+
+        assertThat(repr.getString("specVersion"), is("1.0.0"));
+        assertThat(repr.getString("implVersion"), is(not(nullValue())));
+        //assertThat(repr.getString("implVersion"), is(not("UNKNOWN")));
+
+        final JsonRepresentation optionalCapbilitiesRepr = repr.getOptionalCapabilities();
+        assertThat(optionalCapbilitiesRepr, isMap());
+
+        assertThat(optionalCapbilitiesRepr.getString("blobsClobs"), is("yes"));
+        assertThat(optionalCapbilitiesRepr.getString("deleteObjects"), is("yes"));
+        assertThat(optionalCapbilitiesRepr.getString("domainModel"), is("formal"));
+        assertThat(optionalCapbilitiesRepr.getString("validateOnly"), is("yes"));
+        assertThat(optionalCapbilitiesRepr.getString("protoPersistentObjects"), is("yes"));
+
+        assertThat(repr.getLinks(), isArray());
+        assertThat(repr.getExtensions(), is(not(nullValue())));
+    }
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/a83bc29d/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/version/VersionResourceTest_templated_responseHeaders.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/version/VersionResourceTest_templated_responseHeaders.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/version/VersionResourceTest_templated_responseHeaders.java
new file mode 100644
index 0000000..e39644e
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/version/VersionResourceTest_templated_responseHeaders.java
@@ -0,0 +1,82 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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 org.apache.isis.viewer.restfulobjects.tck.resources.version;
+
+import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.hasMaxAge;
+import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.hasParameter;
+import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.hasSubType;
+import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.hasType;
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
+
+import javax.ws.rs.core.CacheControl;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+
+import org.apache.isis.core.webserver.WebServer;
+import org.apache.isis.viewer.restfulobjects.applib.RepresentationType;
+import org.apache.isis.viewer.restfulobjects.applib.client.RestfulClient;
+import org.apache.isis.viewer.restfulobjects.applib.client.RestfulResponse;
+import org.apache.isis.viewer.restfulobjects.applib.client.RestfulResponse.Header;
+import org.apache.isis.viewer.restfulobjects.applib.version.VersionRepresentation;
+import org.apache.isis.viewer.restfulobjects.applib.version.VersionResource;
+import org.apache.isis.viewer.restfulobjects.tck.IsisWebServerRule;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+
+public class VersionResourceTest_templated_responseHeaders {
+
+    @Rule
+    public IsisWebServerRule webServerRule = new IsisWebServerRule();
+
+    private RestfulClient client;
+    private VersionResource resource;
+
+    @Before
+    public void setUp() throws Exception {
+        final WebServer webServer = webServerRule.getWebServer();
+        client = new RestfulClient(webServer.getBase());
+
+        resource = client.getVersionResource();
+    }
+
+
+    @Test
+    public void headers() throws Exception {
+        // given
+        final Response resp = resource.version();
+
+        // when
+        final RestfulResponse<VersionRepresentation> restfulResponse = RestfulResponse.ofT(resp);
+
+        // then
+        final MediaType contentType = restfulResponse.getHeader(Header.CONTENT_TYPE);
+        assertThat(contentType, hasType("application"));
+        assertThat(contentType, hasSubType("json"));
+        assertThat(contentType, hasParameter("profile", "urn:org.restfulobjects:repr-types/version"));
+        assertThat(contentType, is(RepresentationType.VERSION.getMediaType()));
+
+        // then
+        final CacheControl cacheControl = restfulResponse.getHeader(Header.CACHE_CONTROL);
+        assertThat(cacheControl, hasMaxAge(24 * 60 * 60));
+        assertThat(cacheControl.getMaxAge(), is(24 * 60 * 60));
+    }
+
+}