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/04/27 20:31:27 UTC

[08/50] [abbrv] ISIS-233-ro: testing domainservices_services resource

http://git-wip-us.apache.org/repos/asf/isis/blob/1b9a2a74/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/DomainServiceResourceTest_serviceId_request_header_accept.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/DomainServiceResourceTest_serviceId_request_header_accept.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/DomainServiceResourceTest_serviceId_request_header_accept.java
new file mode 100644
index 0000000..52ea9cd
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/DomainServiceResourceTest_serviceId_request_header_accept.java
@@ -0,0 +1,110 @@
+/*
+ *  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.domainservice;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
+
+import javax.ws.rs.core.MediaType;
+
+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.domainobjects.DomainObjectRepresentation;
+import org.apache.isis.viewer.restfulobjects.applib.domainobjects.ListRepresentation;
+import org.apache.isis.viewer.restfulobjects.tck.IsisWebServerRule;
+import org.jboss.resteasy.client.ClientRequest;
+import org.jboss.resteasy.client.ClientResponse;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+
+public class DomainServiceResourceTest_serviceId_request_header_accept {
+
+    @Rule
+    public IsisWebServerRule webServerRule = new IsisWebServerRule();
+
+    private RestfulClient client;
+    private RestfulRequest request;
+
+    private String href;
+
+    @Before
+    public void setUp() throws Exception {
+        client = webServerRule.getClient();
+        href = Util.givenLinkToService(client, "JdkValuedEntities");
+        request = client.createRequest(RestfulHttpMethod.GET, href);
+    }
+
+    @Test
+    public void applicationJson_noProfile_returns200() throws Exception {
+
+        request.withHeader(RestfulRequest.Header.ACCEPT, MediaType.APPLICATION_JSON_TYPE);
+        final RestfulResponse<DomainObjectRepresentation> restfulResponse = request.executeT();
+
+        assertThat(restfulResponse.getStatus(), is(HttpStatusCode.OK));
+    }
+
+    @Test
+    public void applicationJson_profileDomainObject_returns200() throws Exception {
+
+        request.withHeader(RestfulRequest.Header.ACCEPT, RepresentationType.DOMAIN_OBJECT.getMediaType());
+        final RestfulResponse<DomainObjectRepresentation> restfulResponse = request.executeT();
+
+        assertThat(restfulResponse.getStatus(), is(HttpStatusCode.OK));
+    }
+
+    @Test
+    public void missingHeader_returns200() throws Exception {
+
+        final RestfulResponse<DomainObjectRepresentation> restfulResp = request.executeT();
+
+        assertThat(restfulResp.getStatus(), is(HttpStatusCode.OK));
+    }
+
+    @Test
+    public void applicationJson_profileIncorrect_returns406() throws Exception {
+
+        request.withHeader(RestfulRequest.Header.ACCEPT, RepresentationType.VERSION.getMediaType());
+        final RestfulResponse<ListRepresentation> restfulResponse = request.executeT();
+
+        assertThat(restfulResponse.getStatus(), is(HttpStatusCode.NOT_ACCEPTABLE));
+    }
+
+    @Test
+    public void incorrectMediaType_returnsNotAcceptable() throws Exception {
+
+        // given
+        final ClientRequest clientRequest = client.getClientRequestFactory().createRequest(href);
+        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/1b9a2a74/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/DomainServiceResourceTest_serviceId_request_queryarg_xrodomainmodel.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/DomainServiceResourceTest_serviceId_request_queryarg_xrodomainmodel.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/DomainServiceResourceTest_serviceId_request_queryarg_xrodomainmodel.java
new file mode 100644
index 0000000..02827df
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/DomainServiceResourceTest_serviceId_request_queryarg_xrodomainmodel.java
@@ -0,0 +1,75 @@
+/*
+ *  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.domainservice;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
+
+import javax.ws.rs.core.MediaType;
+
+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.RestfulRequest.RequestParameter;
+import org.apache.isis.viewer.restfulobjects.applib.client.RestfulResponse.HttpStatusCode;
+import org.apache.isis.viewer.restfulobjects.applib.domainobjects.DomainObjectRepresentation;
+import org.apache.isis.viewer.restfulobjects.tck.IsisWebServerRule;
+import org.junit.Before;
+import org.junit.Ignore;
+import org.junit.Rule;
+import org.junit.Test;
+
+public class DomainServiceResourceTest_serviceId_request_queryarg_xrodomainmodel {
+
+    @Rule
+    public IsisWebServerRule webServerRule = new IsisWebServerRule();
+
+    private RestfulClient client;
+    private RestfulRequest request;
+
+
+    @Before
+    public void setUp() throws Exception {
+        client = webServerRule.getClient();
+        String href = Util.givenLinkToService(client, "JdkValuedEntities");
+        request = client.createRequest(RestfulHttpMethod.GET, href);
+    }
+
+    @Test
+    public void simple_rejected() throws Exception {
+
+        request.withArg(RequestParameter.DOMAIN_MODEL, "simple");
+        final RestfulResponse<DomainObjectRepresentation> restfulResponse = request.executeT();
+
+        assertThat(restfulResponse.getStatus(), is(HttpStatusCode.BAD_REQUEST));
+        assertThat(restfulResponse.getHeader(RestfulResponse.Header.WARNING), is("x-ro-domain-model of 'simple' is not supported"));
+    }
+
+    @Test
+    public void formal_accepted() throws Exception {
+        
+        request.withArg(RequestParameter.DOMAIN_MODEL, "formal");
+        final RestfulResponse<DomainObjectRepresentation> restfulResponse = request.executeT();
+
+        assertThat(restfulResponse.getStatus(), is(HttpStatusCode.OK));
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/1b9a2a74/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/DomainServiceResourceTest_serviceId_request_queryarg_xrofollowlinks.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/DomainServiceResourceTest_serviceId_request_queryarg_xrofollowlinks.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/DomainServiceResourceTest_serviceId_request_queryarg_xrofollowlinks.java
new file mode 100644
index 0000000..e354fe7
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/DomainServiceResourceTest_serviceId_request_queryarg_xrofollowlinks.java
@@ -0,0 +1,99 @@
+/*
+ *  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.domainservice;
+
+import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.isArray;
+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.Response;
+
+import org.codehaus.jackson.JsonParseException;
+import org.codehaus.jackson.map.JsonMappingException;
+import org.junit.Before;
+import org.junit.Ignore;
+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.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.RestfulRequest.RequestParameter;
+import org.apache.isis.viewer.restfulobjects.applib.client.RestfulResponse.HttpStatusCode;
+import org.apache.isis.viewer.restfulobjects.applib.domainobjects.DomainObjectRepresentation;
+import org.apache.isis.viewer.restfulobjects.applib.domainobjects.DomainServiceResource;
+import org.apache.isis.viewer.restfulobjects.applib.domainobjects.ListRepresentation;
+import org.apache.isis.viewer.restfulobjects.tck.IsisWebServerRule;
+
+public class DomainServiceResourceTest_serviceId_request_queryarg_xrofollowlinks {
+
+    @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());
+    }
+
+    @Ignore("todo... the service Id is wrong")
+    @Test
+    public void withCriteria() throws Exception {
+
+        final String href = givenHrefToService("simples");
+
+        final RestfulRequest request = client.createRequest(RestfulHttpMethod.GET, href).withArg(RequestParameter.FOLLOW_LINKS, "members[id=%s].links[rel=details]", "list");
+        final RestfulResponse<DomainObjectRepresentation> restfulResponse = request.executeT();
+
+        assertThat(restfulResponse.getStatus(), is(HttpStatusCode.OK));
+        final DomainObjectRepresentation repr = restfulResponse.getEntity();
+
+        final JsonRepresentation membersList = repr.getMembers();
+        assertThat(membersList, isArray());
+
+        JsonRepresentation actionRepr;
+
+        actionRepr = membersList.getRepresentation("[id=%s]", "list");
+        assertThat(actionRepr.getRepresentation("links[rel=details]"), is(not(nullValue())));
+        assertThat(actionRepr.getRepresentation("links[rel=details].value"), is(not(nullValue()))); // followed
+
+        actionRepr = membersList.getRepresentation("[id=%s]", "newTransientEntity");
+        assertThat(actionRepr.getRepresentation("links[rel=details]"), is(not(nullValue())));
+        assertThat(actionRepr.getRepresentation("links[rel=details].value"), is(nullValue())); // not
+                                                                                               // followed
+    }
+
+    private String givenHrefToService(final String serviceId) throws JsonParseException, JsonMappingException, IOException {
+        final DomainServiceResource resource = client.getDomainServiceResource();
+        final Response response = resource.services();
+        final ListRepresentation services = RestfulResponse.<ListRepresentation> ofT(response).getEntity();
+
+        return services.getRepresentation("values[id=%s]", serviceId).asLink().getHref();
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/1b9a2a74/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/DomainServiceResourceTest_serviceId_response_headers.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/DomainServiceResourceTest_serviceId_response_headers.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/DomainServiceResourceTest_serviceId_response_headers.java
new file mode 100644
index 0000000..bdac603
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/DomainServiceResourceTest_serviceId_response_headers.java
@@ -0,0 +1,66 @@
+/*
+ *  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.domainservice;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
+
+import javax.ws.rs.core.Response;
+
+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.HttpStatusCode;
+import org.apache.isis.viewer.restfulobjects.applib.domainobjects.DomainObjectRepresentation;
+import org.apache.isis.viewer.restfulobjects.applib.domainobjects.DomainServiceResource;
+import org.apache.isis.viewer.restfulobjects.tck.IsisWebServerRule;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+
+public class DomainServiceResourceTest_serviceId_response_headers {
+
+    @Rule
+    public IsisWebServerRule webServerRule = new IsisWebServerRule();
+
+    private RestfulClient client;
+    private DomainServiceResource resource;
+
+    @Before
+    public void setUp() throws Exception {
+        client = webServerRule.getClient();
+        
+        resource = client.getDomainServiceResource();
+    }
+
+    @Test
+    public void headers() throws Exception {
+        // given
+        final Response resp = resource.service("JdkValuedEntities");
+
+        // when
+        final RestfulResponse<DomainObjectRepresentation> jsonResp = RestfulResponse.ofT(resp);
+
+        // then
+        assertThat(jsonResp.getStatus(), is(HttpStatusCode.OK));
+        assertThat(jsonResp.getHeader(RestfulResponse.Header.CONTENT_TYPE), is(RepresentationType.DOMAIN_OBJECT.getMediaType("x-ro-domain-type", "org.apache.isis.core.tck.dom.scalars.JdkValuedEntityRepository")));
+        assertThat(jsonResp.getHeader(RestfulResponse.Header.CACHE_CONTROL).getMaxAge(), is(24 * 60 * 60));
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/1b9a2a74/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/DomainServiceResourceTest_serviceId_response_representation.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/DomainServiceResourceTest_serviceId_response_representation.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/DomainServiceResourceTest_serviceId_response_representation.java
new file mode 100644
index 0000000..107c048
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/DomainServiceResourceTest_serviceId_response_representation.java
@@ -0,0 +1,88 @@
+/*
+ *  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.domainservice;
+
+import static org.apache.isis.core.commons.matchers.IsisMatchers.matches;
+import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.assertThat;
+import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.isArray;
+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.junit.Assert.assertThat;
+
+import javax.ws.rs.core.Response;
+
+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.HttpStatusCode;
+import org.apache.isis.viewer.restfulobjects.applib.domainobjects.DomainObjectRepresentation;
+import org.apache.isis.viewer.restfulobjects.applib.domainobjects.DomainServiceResource;
+import org.apache.isis.viewer.restfulobjects.tck.IsisWebServerRule;
+import org.junit.Before;
+import org.junit.Ignore;
+import org.junit.Rule;
+import org.junit.Test;
+
+public class DomainServiceResourceTest_serviceId_response_representation {
+
+    @Rule
+    public IsisWebServerRule webServerRule = new IsisWebServerRule();
+
+    private RestfulClient client;
+    private DomainServiceResource resource;
+
+    @Before
+    public void setUp() throws Exception {
+        client = webServerRule.getClient();
+
+        resource = client.getDomainServiceResource();
+    }
+
+    @Ignore("todo... the service Id is wrong")
+    @Test
+    public void representation() throws Exception {
+
+        // given
+        final Response resp = resource.service("simples");
+
+        // when
+        final RestfulResponse<DomainObjectRepresentation> jsonResp = RestfulResponse.ofT(resp);
+
+        // then
+        assertThat(jsonResp.getStatus(), is(HttpStatusCode.OK));
+
+        final DomainObjectRepresentation repr = jsonResp.getEntity();
+
+        assertThat(repr, isMap());
+
+        assertThat(repr.getSelf(), isLink().httpMethod(RestfulHttpMethod.GET));
+        assertThat(repr.getOid(), matches("OID[:].+"));
+        assertThat(repr.getTitle(), matches("Simples"));
+
+        assertThat(repr.getMembers(), isArray());
+
+        assertThat(repr.getLinks(), isArray());
+        assertThat(repr.getLinks().size(), is(3));
+        
+        assertThat(repr.getExtensions(), isMap());
+    }
+
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/1b9a2a74/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/DomainServiceResourceTest_serviceId_status_notFound.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/DomainServiceResourceTest_serviceId_status_notFound.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/DomainServiceResourceTest_serviceId_status_notFound.java
new file mode 100644
index 0000000..aa39d8f
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/DomainServiceResourceTest_serviceId_status_notFound.java
@@ -0,0 +1,70 @@
+/*
+ *  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.domainservice;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
+
+import java.io.IOException;
+
+import javax.ws.rs.core.Response;
+
+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.Rel;
+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.HttpStatusCode;
+import org.apache.isis.viewer.restfulobjects.applib.domainobjects.DomainServiceResource;
+import org.apache.isis.viewer.restfulobjects.applib.domainobjects.ListRepresentation;
+import org.apache.isis.viewer.restfulobjects.tck.IsisWebServerRule;
+import org.codehaus.jackson.JsonParseException;
+import org.codehaus.jackson.map.JsonMappingException;
+
+public class DomainServiceResourceTest_serviceId_status_notFound {
+
+    @Rule
+    public IsisWebServerRule webServerRule = new IsisWebServerRule();
+
+    private RestfulClient client;
+    private DomainServiceResource resource;
+
+    @Before
+    public void setUp() throws Exception {
+        client = webServerRule.getClient();
+
+        resource = client.getDomainServiceResource();
+    }
+
+    @Test
+    public void notFound_usingTemplatedMethod() throws Exception {
+        
+        // when
+        final Response resp = resource.service("nonExistentServiceId");
+        final RestfulResponse<JsonRepresentation> jsonResp = RestfulResponse.of(resp);
+
+        // then
+        assertThat(jsonResp.getStatus(), is(HttpStatusCode.NOT_FOUND));
+    }
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/1b9a2a74/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/DomainServiceResourceTest_services_header_accept.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/DomainServiceResourceTest_services_header_accept.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/DomainServiceResourceTest_services_header_accept.java
new file mode 100644
index 0000000..a11478d
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/DomainServiceResourceTest_services_header_accept.java
@@ -0,0 +1,105 @@
+/*
+ *  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.domainservice;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
+
+import javax.ws.rs.core.MediaType;
+
+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.domainobjects.ListRepresentation;
+import org.apache.isis.viewer.restfulobjects.tck.IsisWebServerRule;
+import org.jboss.resteasy.client.ClientRequest;
+import org.jboss.resteasy.client.ClientResponse;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+
+public class DomainServiceResourceTest_services_header_accept {
+
+    @Rule
+    public IsisWebServerRule webServerRule = new IsisWebServerRule();
+
+    private RestfulClient client;
+    private RestfulRequest request;
+
+    @Before
+    public void setUp() throws Exception {
+        client = webServerRule.getClient();
+        request = client.createRequest(RestfulHttpMethod.GET, "services");
+    }
+
+    @Test
+    public void applicationJson_noProfile_returns200() throws Exception {
+
+        request.withHeader(RestfulRequest.Header.ACCEPT, MediaType.APPLICATION_JSON_TYPE);
+        final RestfulResponse<ListRepresentation> restfulResponse = request.executeT();
+
+        assertThat(restfulResponse.getStatus(), is(HttpStatusCode.OK));
+        assertThat(restfulResponse.getHeader(RestfulResponse.Header.CONTENT_TYPE), is(RepresentationType.LIST.getMediaType()));
+    }
+
+    @Test
+    public void applicationJson_profileList_returns200() throws Exception {
+
+        request.withHeader(RestfulRequest.Header.ACCEPT, RepresentationType.LIST.getMediaType());
+        final RestfulResponse<ListRepresentation> restfulResponse = request.executeT();
+
+        assertThat(restfulResponse.getStatus(), is(HttpStatusCode.OK));
+    }
+
+    @Test
+    public void missingHeader_returns200() throws Exception {
+
+        final RestfulResponse<ListRepresentation> restfulResp = request.executeT();
+
+        assertThat(restfulResp.getStatus(), is(HttpStatusCode.OK));
+    }
+
+    @Test
+    public void applicationJson_profileIncorrect_returns406() throws Exception {
+
+        request.withHeader(RestfulRequest.Header.ACCEPT, RepresentationType.VERSION.getMediaType());
+        final RestfulResponse<ListRepresentation> restfulResponse = request.executeT();
+
+        assertThat(restfulResponse.getStatus(), is(HttpStatusCode.NOT_ACCEPTABLE));
+    }
+
+    @Test
+    public void incorrectMediaType_returnsNotAcceptable() throws Exception {
+
+        // given
+        final ClientRequest clientRequest = client.getClientRequestFactory().createRelativeRequest("services");
+        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/1b9a2a74/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/DomainServiceResourceTest_services_queryarg_xrofollowlinks.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/DomainServiceResourceTest_services_queryarg_xrofollowlinks.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/DomainServiceResourceTest_services_queryarg_xrofollowlinks.java
new file mode 100644
index 0000000..5414ee9
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/DomainServiceResourceTest_services_queryarg_xrofollowlinks.java
@@ -0,0 +1,152 @@
+/*
+ *  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.domainservice;
+
+import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.assertThat;
+import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.isArray;
+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.*;
+import static org.hamcrest.CoreMatchers.containsString;
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.CoreMatchers.not;
+import static org.hamcrest.CoreMatchers.nullValue;
+import static org.hamcrest.Matchers.greaterThan;
+import static org.junit.Assert.assertThat;
+
+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.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.RestfulRequest.RequestParameter;
+import org.apache.isis.viewer.restfulobjects.applib.client.RestfulResponse.HttpStatusCode;
+import org.apache.isis.viewer.restfulobjects.applib.client.RestfulResponse;
+import org.apache.isis.viewer.restfulobjects.applib.domainobjects.ListRepresentation;
+import org.apache.isis.viewer.restfulobjects.applib.user.UserRepresentation;
+import org.apache.isis.viewer.restfulobjects.tck.IsisWebServerRule;
+import org.hamcrest.Matchers;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+
+public class DomainServiceResourceTest_services_queryarg_xrofollowlinks {
+
+    @Rule
+    public IsisWebServerRule webServerRule = new IsisWebServerRule();
+
+    private RestfulClient client;
+
+    private RestfulRequest request;
+    private RestfulResponse<ListRepresentation> restfulResponse;
+    private ListRepresentation repr;
+
+    @Before
+    public void setUp() throws Exception {
+        client = webServerRule.getClient();
+
+    }
+
+    @Test
+    public void noFollow() throws Exception {
+
+        request = client.createRequest(RestfulHttpMethod.GET, "services");
+        restfulResponse = request.executeT();
+        repr = restfulResponse.getEntity();
+
+        assertThat(repr.getSelf().getValue(), is(nullValue()));
+        assertThat(repr.getUp().getValue(), is(nullValue()));
+    }
+
+    @Test
+    public void self() throws Exception {
+
+        request = client.createRequest(RestfulHttpMethod.GET, "services")
+                    .withArg(RequestParameter.FOLLOW_LINKS, "links[rel=" + Rel.SELF.getName() + "]");
+        restfulResponse = request.executeT();
+        repr = restfulResponse.getEntity();
+
+        assertThat(repr.getSelf().getValue(), is(not(nullValue())));
+    }
+
+    @Test
+    public void up() throws Exception {
+
+        request = client.createRequest(RestfulHttpMethod.GET, "services")
+                    .withArg(RequestParameter.FOLLOW_LINKS, "links[rel=" + Rel.UP.getName() + "]");
+        restfulResponse = request.executeT();
+        repr = restfulResponse.getEntity();
+
+        assertThat(repr.getUp().getValue(), is(not(nullValue())));
+    }
+
+    @Test
+    public void value_noQualifications_andSoAllOfThemEagerlyReturned() throws Exception {
+
+        request = client.createRequest(RestfulHttpMethod.GET, "services")
+                .withArg(RequestParameter.FOLLOW_LINKS, "value[rel=" + Rel.SERVICE.getName() + "]");
+        restfulResponse = request.executeT();
+        repr = restfulResponse.getEntity();
+
+        request = client.createRequest(RestfulHttpMethod.GET, "services")
+                .withArg(RequestParameter.FOLLOW_LINKS, "value");
+        restfulResponse = request.executeT();
+        repr = restfulResponse.getEntity();
+
+        // then
+        for (final LinkRepresentation link : repr.getValue().arrayIterable(LinkRepresentation.class)) {
+
+            assertThat(link, isLink(client)
+                    .rel(containsString(Rel.SERVICE.getName()))
+                    .href(containsString(":39393/"))
+                    .httpMethod(RestfulHttpMethod.GET)
+                    .type(RepresentationType.DOMAIN_OBJECT.getMediaType())
+                    .value(is(not(nullValue(JsonRepresentation.class))))
+                    );
+        }
+
+    }
+
+    @Test
+    public void value_withQualification_andSoSingleServiceEagerlyReturned() throws Exception {
+
+        request = client.createRequest(RestfulHttpMethod.GET, "services")
+                .withArg(RequestParameter.FOLLOW_LINKS, "value[rel=" + Rel.SERVICE.getName() + ";serviceId=\"JdkValuedEntities\"]");
+        restfulResponse = request.executeT();
+        repr = restfulResponse.getEntity();
+
+        // then
+        int numWithValue = 0;
+        int numWithoutValue = 0;
+        for (final LinkRepresentation link : repr.getValue().arrayIterable(LinkRepresentation.class)) {
+            
+            if(isLink(client).value(is(not(nullValue(JsonRepresentation.class)))).build().matches(link)) {
+                numWithValue++;
+            } else {
+                numWithoutValue++;
+            }
+        }
+        
+        assertThat(numWithValue, is(1));
+        assertThat(numWithoutValue, is(greaterThan(0)));
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/1b9a2a74/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/DomainServiceResourceTest_services_response_headers.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/DomainServiceResourceTest_services_response_headers.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/DomainServiceResourceTest_services_response_headers.java
new file mode 100644
index 0000000..62c06c7
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/DomainServiceResourceTest_services_response_headers.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.domainservice;
+
+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.client.RestfulResponse.HttpStatusCode;
+import org.apache.isis.viewer.restfulobjects.applib.domainobjects.DomainServiceResource;
+import org.apache.isis.viewer.restfulobjects.applib.domainobjects.ListRepresentation;
+import org.apache.isis.viewer.restfulobjects.applib.homepage.HomePageRepresentation;
+import org.apache.isis.viewer.restfulobjects.tck.IsisWebServerRule;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+
+public class DomainServiceResourceTest_services_response_headers {
+
+    @Rule
+    public IsisWebServerRule webServerRule = new IsisWebServerRule();
+
+    private RestfulClient client;
+    private DomainServiceResource resource;
+
+    @Before
+    public void setUp() throws Exception {
+        client = webServerRule.getClient();
+        resource = client.getDomainServiceResource();
+    }
+
+
+    @Test
+    public void contentType_and_cacheControl() throws Exception {
+        // given
+        final Response resp = resource.services();
+
+        // when
+        final RestfulResponse<ListRepresentation> 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/list"));
+        assertThat(contentType, is(RepresentationType.LIST.getMediaType()));
+
+        // then
+        final CacheControl cacheControl = restfulResponse.getHeader(Header.CACHE_CONTROL);
+        assertThat(cacheControl, hasMaxAge(24 * 60 * 60));
+        assertThat(cacheControl.getMaxAge(), is(24 * 60 * 60));
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/1b9a2a74/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/DomainServiceResourceTest_services_response_representation.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/DomainServiceResourceTest_services_response_representation.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/DomainServiceResourceTest_services_response_representation.java
new file mode 100644
index 0000000..1241c36
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/DomainServiceResourceTest_services_response_representation.java
@@ -0,0 +1,128 @@
+/*
+ *  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.domainservice;
+
+import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.assertThat;
+import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.isArray;
+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.containsString;
+import static org.hamcrest.CoreMatchers.endsWith;
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
+
+import javax.ws.rs.core.Response;
+
+import org.apache.isis.core.webserver.WebServer;
+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.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.HttpStatusCode;
+import org.apache.isis.viewer.restfulobjects.applib.domainobjects.DomainServiceResource;
+import org.apache.isis.viewer.restfulobjects.applib.domainobjects.ListRepresentation;
+import org.apache.isis.viewer.restfulobjects.tck.IsisWebServerRule;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+
+public class DomainServiceResourceTest_services_response_representation {
+
+    @Rule
+    public IsisWebServerRule webServerRule = new IsisWebServerRule();
+
+    private RestfulClient client;
+    private DomainServiceResource resource;
+
+    @Before
+    public void setUp() throws Exception {
+        final WebServer webServer = webServerRule.getWebServer();
+        client = new RestfulClient(webServer.getBase());
+
+        resource = client.getDomainServiceResource();
+    }
+
+    @Test
+    public void representation() throws Exception {
+
+        // when
+        final Response response = resource.services();
+        final RestfulResponse<ListRepresentation> restfulResponse = RestfulResponse.ofT(response);
+
+        // then
+        final ListRepresentation repr = restfulResponse.getEntity();
+
+        assertThat(repr, isMap());
+
+        assertThat(repr.getSelf(), isLink(client)
+                                    .rel(Rel.SELF)
+                                    .href(endsWith(":39393/services"))
+                                    .httpMethod(RestfulHttpMethod.GET)
+                                    .type(RepresentationType.LIST.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.getValue(), isArray());
+
+        assertThat(repr.getLinks(), isArray());
+        assertThat(repr.getExtensions(), isMap());
+    }
+
+    @Test
+    public void linksToDomainServiceResources() throws Exception {
+
+        // given
+        final RestfulResponse<ListRepresentation> jsonResp = RestfulResponse.ofT(resource.services());
+        final ListRepresentation repr = jsonResp.getEntity();
+
+        // when
+        final JsonRepresentation values = repr.getValue();
+
+        // then
+        for (final LinkRepresentation link : values.arrayIterable(LinkRepresentation.class)) {
+            assertThat("HiddenRepository should not show up in services list", false, is(link.getHref().endsWith("HiddenRepository")));
+        }
+        
+        // and also
+        for (final LinkRepresentation link : values.arrayIterable(LinkRepresentation.class)) {
+
+            assertThat(link, isLink(client)
+                    .rel(containsString(Rel.SERVICE.getName()))
+                    .href(containsString(":39393/"))
+                    .httpMethod(RestfulHttpMethod.GET)
+                    .type(RepresentationType.DOMAIN_OBJECT.getMediaType())
+                    );
+            assertThat(link, isLink(client)
+                    .returning(HttpStatusCode.OK)
+                    .responseEntityWithSelfHref(link.getHref())
+                    );
+        }
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/1b9a2a74/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/Util.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/Util.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/Util.java
new file mode 100644
index 0000000..3b64116
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/Util.java
@@ -0,0 +1,49 @@
+/*
+ *  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.domainservice;
+
+import java.io.IOException;
+
+import javax.ws.rs.core.Response;
+
+import org.apache.isis.viewer.restfulobjects.applib.Rel;
+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.domainobjects.DomainServiceResource;
+import org.apache.isis.viewer.restfulobjects.applib.domainobjects.ListRepresentation;
+import org.codehaus.jackson.JsonParseException;
+import org.codehaus.jackson.map.JsonMappingException;
+
+public class Util {
+    
+    private Util(){}
+
+    public static String givenLinkToService(RestfulClient restfulClient, String serviceId) throws JsonParseException, JsonMappingException, IOException {
+        
+        final DomainServiceResource resource = restfulClient.getDomainServiceResource();
+        final Response response = resource.services();
+        final ListRepresentation services = RestfulResponse.<ListRepresentation> ofT(response).getEntity();
+
+        final String href = services.getRepresentation("value[rel=" + Rel.SERVICE.getName() + ";serviceId=\"" +
+        		serviceId +
+        		"\"]").asLink().getHref();
+        return href;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/1b9a2a74/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/homepage/HomePageResourceTest_root_header_accept.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/homepage/HomePageResourceTest_root_header_accept.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/homepage/HomePageResourceTest_root_header_accept.java
new file mode 100644
index 0000000..8eaf96d
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/homepage/HomePageResourceTest_root_header_accept.java
@@ -0,0 +1,106 @@
+/*
+ *  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.homepage;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
+
+import javax.ws.rs.core.MediaType;
+
+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.homepage.HomePageRepresentation;
+import org.apache.isis.viewer.restfulobjects.tck.IsisWebServerRule;
+import org.jboss.resteasy.client.ClientRequest;
+import org.jboss.resteasy.client.ClientResponse;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+
+public class HomePageResourceTest_root_header_accept {
+
+    @Rule
+    public IsisWebServerRule webServerRule = new IsisWebServerRule();
+
+    private RestfulClient client;
+
+    private RestfulRequest request;
+
+    @Before
+    public void setUp() throws Exception {
+        client = webServerRule.getClient();
+        request = client.createRequest(RestfulHttpMethod.GET, "/");
+    }
+
+    @Test
+    public void applicationJson_noProfile_returns200() throws Exception {
+
+        request.withHeader(RestfulRequest.Header.ACCEPT, MediaType.APPLICATION_JSON_TYPE);
+        final RestfulResponse<HomePageRepresentation> restfulResponse = request.executeT();
+
+        assertThat(restfulResponse.getStatus(), is(HttpStatusCode.OK));
+        assertThat(restfulResponse.getHeader(RestfulResponse.Header.CONTENT_TYPE), is(RepresentationType.HOME_PAGE.getMediaType()));
+    }
+
+    @Test
+    public void applicationJson_profileHomePage_returns200() throws Exception {
+
+        request.withHeader(RestfulRequest.Header.ACCEPT, RepresentationType.HOME_PAGE.getMediaType());
+        final RestfulResponse<HomePageRepresentation> restfulResponse = request.executeT();
+
+        assertThat(restfulResponse.getStatus(), is(HttpStatusCode.OK));
+    }
+
+    @Test
+    public void missingHeader_returns200() throws Exception {
+
+        final RestfulResponse<HomePageRepresentation> restfulResp = request.executeT();
+
+        assertThat(restfulResp.getStatus(), is(HttpStatusCode.OK));
+    }
+
+    @Test
+    public void applicationJson_profileIncorrect_returns406() throws Exception {
+
+        request.withHeader(RestfulRequest.Header.ACCEPT, RepresentationType.USER.getMediaType());
+        final RestfulResponse<HomePageRepresentation> restfulResponse = request.executeT();
+
+        assertThat(restfulResponse.getStatus(), is(HttpStatusCode.NOT_ACCEPTABLE));
+    }
+
+    @Test
+    public void incorrectMediaType_returnsNotAcceptable() throws Exception {
+
+        // given
+        final ClientRequest clientRequest = client.getClientRequestFactory().createRelativeRequest("/");
+        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/1b9a2a74/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/homepage/HomePageResourceTest_root_queryargs_xrofollowlinks.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/homepage/HomePageResourceTest_root_queryargs_xrofollowlinks.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/homepage/HomePageResourceTest_root_queryargs_xrofollowlinks.java
new file mode 100644
index 0000000..b3e27d4
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/homepage/HomePageResourceTest_root_queryargs_xrofollowlinks.java
@@ -0,0 +1,168 @@
+/*
+ *  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.homepage;
+
+import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.isArray;
+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 org.apache.isis.viewer.restfulobjects.applib.JsonRepresentation;
+import org.apache.isis.viewer.restfulobjects.applib.Rel;
+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.RestfulRequest.RequestParameter;
+import org.apache.isis.viewer.restfulobjects.applib.client.RestfulResponse;
+import org.apache.isis.viewer.restfulobjects.applib.homepage.HomePageRepresentation;
+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 HomePageResourceTest_root_queryargs_xrofollowlinks {
+
+    @Rule
+    public IsisWebServerRule webServerRule = new IsisWebServerRule();
+
+    private RestfulClient client;
+
+    private RestfulRequest request;
+    private RestfulResponse<HomePageRepresentation> restfulResponse;
+    private HomePageRepresentation repr;
+
+    @Before
+    public void setUp() throws Exception {
+        client = webServerRule.getClient();
+
+    }
+
+    @Test
+    public void noFollow() throws Exception {
+        request = client.createRequest(RestfulHttpMethod.GET, "");
+        restfulResponse = request.executeT();
+        repr = restfulResponse.getEntity();
+        
+        assertThat(repr.getSelf().getValue(), is(nullValue()));
+        assertThat(repr.getUser().getValue(), is(nullValue()));
+        assertThat(repr.getVersion().getValue(), is(nullValue()));
+        assertThat(repr.getServices().getValue(), is(nullValue()));
+    }
+    
+    @Test
+    public void self() throws Exception {
+
+        repr = whenExecuteAndFollowLinksUsing("/", "links[rel=" + Rel.SELF.getName() + "]");
+
+        assertThat(repr.getSelf().getValue(), is(not(nullValue())));
+    }
+
+    @Test
+    public void user() throws Exception {
+
+        repr = whenExecuteAndFollowLinksUsing("/", "links[rel=" + Rel.USER.getName() + "]");
+
+        assertThat(repr.getUser().getValue(), is(not(nullValue())));
+    }
+
+    @Test
+    public void services() throws Exception {
+
+        repr = whenExecuteAndFollowLinksUsing("/", "links[rel=" + Rel.SERVICES.getName() + "]");
+
+        assertThat(repr.getServices().getValue(), is(not(nullValue())));
+    }
+
+    @Test
+    public void version() throws Exception {
+
+        repr = whenExecuteAndFollowLinksUsing("/", "links[rel=" + Rel.VERSION.getName() + "]");
+
+        assertThat(repr.getVersion().getValue(), is(not(nullValue())));
+    }
+
+    @Test
+    public void multiple() throws Exception {
+
+        repr = whenExecuteAndFollowLinksUsing("/", 
+                        "links[rel=" + Rel.USER.getName() + "]," +
+        		        "links[rel=" + Rel.SERVICES.getName() + "]," +
+        				"links[rel=" + Rel.VERSION.getName() + "]");
+
+        assertThat(repr.getServices().getValue(), is(not(nullValue())));
+        assertThat(repr.getUser().getValue(), is(not(nullValue())));
+        assertThat(repr.getVersion().getValue(), is(not(nullValue())));
+    }
+
+    @Test
+    public void allServices_Value() throws Exception {
+
+        repr = whenExecuteAndFollowLinksUsing("/", "links[rel=" + Rel.SERVICES.getName() + "].value");
+
+        final JsonRepresentation servicesValue = repr.getServices().getValue();
+        assertThat(servicesValue, is(not(nullValue())));
+        assertThat(servicesValue, isMap());
+        final JsonRepresentation serviceLinkList = servicesValue.getArray("value");
+        assertThat(serviceLinkList, isArray());
+
+        JsonRepresentation service;
+
+        service = serviceLinkList.getRepresentation("[rel=%s;serviceId=\"%s\"]", Rel.SERVICE.getName(), "JdkValuedEntities");
+        assertThat(service, isMap());
+        assertThat(service.getRepresentation("value"), is(not(nullValue())));
+
+        service = serviceLinkList.getRepresentation("[rel=%s;serviceId=\"%s\"]", Rel.SERVICE.getName(), "WrapperValuedEntities");
+        assertThat(service, isMap());
+        assertThat(service.getRepresentation("value"), is(not(nullValue())));
+    }
+
+    @Test
+    public void selectedService_Value() throws Exception {
+
+        repr = whenExecuteAndFollowLinksUsing("/", "links[rel=" + Rel.SERVICES.getName() + "].value[rel=" + Rel.SERVICE.andParam("serviceId", "WrapperValuedEntities")+"]");
+
+        final JsonRepresentation servicesValue = repr.getServices().getValue();
+        assertThat(servicesValue, is(not(nullValue())));
+        assertThat(servicesValue, isMap());
+        final JsonRepresentation serviceLinkList = servicesValue.getArray("value");
+        assertThat(serviceLinkList, isArray());
+
+        JsonRepresentation service;
+
+        service = serviceLinkList.getRepresentation("[rel=%s;serviceId=\"%s\"]", Rel.SERVICE.getName(), "WrapperValuedEntities");
+        assertThat(service, isMap());
+        assertThat(service.getRepresentation("value"), is(not(nullValue())));
+
+        service = serviceLinkList.getRepresentation("[rel=%s;serviceId=\"%s\"]", Rel.SERVICE.getName(), "JdkValuedEntities");
+        assertThat(service.getRepresentation("value"), is(nullValue()));
+    }
+
+    private HomePageRepresentation whenExecuteAndFollowLinksUsing(final String uriTemplate, final String followLinks) throws JsonParseException, JsonMappingException, IOException {
+        request = client.createRequest(RestfulHttpMethod.GET, uriTemplate).withArg(RequestParameter.FOLLOW_LINKS, followLinks);
+        restfulResponse = request.executeT();
+        return restfulResponse.getEntity();
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/1b9a2a74/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/homepage/HomePageResourceTest_root_response_headers.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/homepage/HomePageResourceTest_root_response_headers.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/homepage/HomePageResourceTest_root_response_headers.java
new file mode 100644
index 0000000..6b8da68
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/homepage/HomePageResourceTest_root_response_headers.java
@@ -0,0 +1,79 @@
+/*
+ *  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.homepage;
+
+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.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.homepage.HomePageRepresentation;
+import org.apache.isis.viewer.restfulobjects.applib.homepage.HomePageResource;
+import org.apache.isis.viewer.restfulobjects.tck.IsisWebServerRule;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+
+public class HomePageResourceTest_root_response_headers {
+
+    @Rule
+    public IsisWebServerRule webServerRule = new IsisWebServerRule();
+
+    private RestfulClient client;
+    private HomePageResource resource;
+
+    @Before
+    public void setUp() throws Exception {
+        client = webServerRule.getClient();
+        resource = client.getHomePageResource();
+    }
+
+
+    @Test
+    public void contentType_and_cacheControl() throws Exception {
+        // given
+        final Response resp = resource.homePage();
+
+        // when
+        final RestfulResponse<HomePageRepresentation> 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/homepage"));
+        assertThat(contentType, is(RepresentationType.HOME_PAGE.getMediaType()));
+
+        // then
+        final CacheControl cacheControl = restfulResponse.getHeader(Header.CACHE_CONTROL);
+        assertThat(cacheControl, hasMaxAge(24 * 60 * 60));
+        assertThat(cacheControl.getMaxAge(), is(24 * 60 * 60));
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/1b9a2a74/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/homepage/HomePageResourceTest_root_response_representation.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/homepage/HomePageResourceTest_root_response_representation.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/homepage/HomePageResourceTest_root_response_representation.java
new file mode 100644
index 0000000..282165d
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/homepage/HomePageResourceTest_root_response_representation.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.homepage;
+
+import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.assertThat;
+import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.isArray;
+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 javax.ws.rs.core.Response;
+import javax.ws.rs.core.Response.Status.Family;
+
+import org.apache.isis.viewer.restfulobjects.applib.Rel;
+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.HttpStatusCode;
+import org.apache.isis.viewer.restfulobjects.applib.homepage.HomePageRepresentation;
+import org.apache.isis.viewer.restfulobjects.applib.homepage.HomePageResource;
+import org.apache.isis.viewer.restfulobjects.tck.IsisWebServerRule;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+
+public class HomePageResourceTest_root_response_representation {
+
+    @Rule
+    public IsisWebServerRule webServerRule = new IsisWebServerRule();
+
+    private RestfulClient client;
+    private HomePageResource resource;
+
+    @Before
+    public void setUp() throws Exception {
+        client = webServerRule.getClient();
+        resource = client.getHomePageResource();
+    }
+
+    @Test
+    public void representation() throws Exception {
+
+        // given
+        final Response resp = resource.homePage();
+
+        // when
+        final RestfulResponse<HomePageRepresentation> restfulResponse = RestfulResponse.ofT(resp);
+        assertThat(restfulResponse.getStatus().getFamily(), is(Family.SUCCESSFUL));
+
+        // then
+        assertThat(restfulResponse.getStatus(), is(HttpStatusCode.OK));
+
+        final HomePageRepresentation repr = restfulResponse.getEntity();
+        assertThat(repr, is(not(nullValue())));
+        assertThat(repr, isMap());
+
+        assertThat(repr.getSelf(), isLink(client)
+                                        .rel(Rel.SELF)
+                                        .href(endsWith(":39393/"))
+                                        .httpMethod(RestfulHttpMethod.GET)
+                                        .type(RepresentationType.HOME_PAGE.getMediaType())
+                                        .returning(HttpStatusCode.OK)
+                                        );
+        assertThat(repr.getUser(), isLink(client)
+                                        .rel(Rel.USER)
+                                        .href(endsWith(":39393/user"))
+                                        .httpMethod(RestfulHttpMethod.GET)
+                                        .type(RepresentationType.USER.getMediaType())
+                                        .returning(HttpStatusCode.OK)
+                                        );
+        assertThat(repr.getServices(), isLink(client)
+                                        .rel(Rel.SERVICES)
+                                        .href(endsWith(":39393/services"))
+                                        .httpMethod(RestfulHttpMethod.GET)
+                                        .type(RepresentationType.LIST.getMediaType())
+                                        .returning(HttpStatusCode.OK)
+                                        );
+        assertThat(repr.getVersion(), isLink(client)
+                                        .rel(Rel.VERSION)
+                                        .href(endsWith(":39393/version"))
+                                        .httpMethod(RestfulHttpMethod.GET)
+                                        .type(RepresentationType.VERSION.getMediaType())
+                                        .returning(HttpStatusCode.OK)
+                                        );
+
+        assertThat(repr.getLinks(), isArray());
+        assertThat(repr.getExtensions(), isMap());
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/1b9a2a74/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/AnyResourceTest_serverSideException_exceptionHandling.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/AnyResourceTest_serverSideException_exceptionHandling.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/AnyResourceTest_serverSideException_exceptionHandling.java
deleted file mode 100644
index 8aa79ff..0000000
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/AnyResourceTest_serverSideException_exceptionHandling.java
+++ /dev/null
@@ -1,72 +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;
-
-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.RestfulRequest.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.util.Parser;
-import org.apache.isis.viewer.restfulobjects.tck.IsisWebServerRule;
-
-public class AnyResourceTest_serverSideException_exceptionHandling {
-
-    @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 runtimeException_isMapped() throws Exception {
-
-        // given
-        final RestfulRequest restfulReq = client.createRequest(RestfulHttpMethod.GET, "version");
-        final Header<Boolean> header = new Header<Boolean>("X-FAIL", Parser.forBoolean());
-        restfulReq.withHeader(header, true);
-
-        // when
-        final RestfulResponse<JsonRepresentation> jsonResp = restfulReq.execute();
-
-        // then
-        assertThat(jsonResp.getStatus(), is(HttpStatusCode.METHOD_FAILURE));
-    }
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/1b9a2a74/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/domainService/DomainServiceResourceTest_services_acceptHeader.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/domainService/DomainServiceResourceTest_services_acceptHeader.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/domainService/DomainServiceResourceTest_services_acceptHeader.java
deleted file mode 100644
index c62e641..0000000
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/domainService/DomainServiceResourceTest_services_acceptHeader.java
+++ /dev/null
@@ -1,106 +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.domainService;
-
-import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertThat;
-
-import javax.ws.rs.core.MediaType;
-
-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.domainobjects.ListRepresentation;
-import org.apache.isis.viewer.restfulobjects.applib.user.UserRepresentation;
-import org.apache.isis.viewer.restfulobjects.tck.IsisWebServerRule;
-import org.jboss.resteasy.client.ClientRequest;
-import org.jboss.resteasy.client.ClientResponse;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-
-public class DomainServiceResourceTest_services_acceptHeader {
-
-    @Rule
-    public IsisWebServerRule webServerRule = new IsisWebServerRule();
-
-    private RestfulClient client;
-    private RestfulRequest request;
-
-    @Before
-    public void setUp() throws Exception {
-        client = webServerRule.getClient();
-        request = client.createRequest(RestfulHttpMethod.GET, "services");
-    }
-
-    @Test
-    public void applicationJson_noProfile_returns200() throws Exception {
-
-        request.withHeader(RestfulRequest.Header.ACCEPT, MediaType.APPLICATION_JSON_TYPE);
-        final RestfulResponse<ListRepresentation> restfulResponse = request.executeT();
-
-        assertThat(restfulResponse.getStatus(), is(HttpStatusCode.OK));
-        assertThat(restfulResponse.getHeader(RestfulResponse.Header.CONTENT_TYPE), is(RepresentationType.LIST.getMediaType()));
-    }
-
-    @Test
-    public void applicationJson_profileList_returns200() throws Exception {
-
-        request.withHeader(RestfulRequest.Header.ACCEPT, RepresentationType.LIST.getMediaType());
-        final RestfulResponse<ListRepresentation> restfulResponse = request.executeT();
-
-        assertThat(restfulResponse.getStatus(), is(HttpStatusCode.OK));
-    }
-
-    @Test
-    public void missingHeader_returns200() throws Exception {
-
-        final RestfulResponse<ListRepresentation> restfulResp = request.executeT();
-
-        assertThat(restfulResp.getStatus(), is(HttpStatusCode.OK));
-    }
-
-    @Test
-    public void applicationJson_profileIncorrect_returns406() throws Exception {
-
-        request.withHeader(RestfulRequest.Header.ACCEPT, RepresentationType.VERSION.getMediaType());
-        final RestfulResponse<ListRepresentation> restfulResponse = request.executeT();
-
-        assertThat(restfulResponse.getStatus(), is(HttpStatusCode.NOT_ACCEPTABLE));
-    }
-
-    @Test
-    public void incorrectMediaType_returnsNotAcceptable() throws Exception {
-
-        // given
-        final ClientRequest clientRequest = client.getClientRequestFactory().createRelativeRequest("services");
-        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));
-    }
-}